﻿:root {
  --page-bg: #e6ebf1;
  --panel-bg: #ffffff;
  --panel-border: #c9d1da;
  --panel-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
  --input-border: #8f99a4;
  --text-muted: #4a5b72;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Segoe UI Variable Text", Tahoma, sans-serif;
  background: var(--page-bg);
  color: #111;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 410px) 1fr;
  gap: 16px;
  min-height: 100vh;
  padding: 16px;
}

.controls,
.preview {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  box-shadow: var(--panel-shadow);
}

.controls {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: 16px;
}

.controls-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.controls-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}

.field,
.switch-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 12px;
  color: #283343;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: 2px;
  background: #fff;
  color: #111;
  padding: 7px 8px;
  font-size: 13px;
  font-family: "Segoe UI", Tahoma, sans-serif;
}

.field textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.35;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #2e74d2;
  box-shadow: 0 0 0 1px #2e74d2;
}

.switch-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.switch-field input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.switch-field span {
  font-size: 13px;
  color: #111;
}

.full-width {
  grid-column: 1 / -1;
}

.range-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.range-field input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #2f75da;
}

.range-value {
  min-width: 68px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: #2d4058;
}

.controls-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.primary-button,
.ghost-button {
  min-height: 34px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #818c97;
  border-radius: 2px;
  cursor: pointer;
}

.ghost-button {
  color: #111;
  background: linear-gradient(180deg, #ffffff 0%, #e8edf4 100%);
}

.ghost-button:hover {
  background: linear-gradient(180deg, #ffffff 0%, #e1e8f1 100%);
}

.primary-button {
  color: #fff;
  border-color: #2b71d5;
  background: linear-gradient(180deg, #4e98f0 0%, #2977df 100%);
}

.primary-button:hover {
  filter: brightness(1.03);
}

.primary-button[disabled] {
  opacity: 0.72;
  cursor: progress;
}

.preview {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 10px;
  padding: 12px;
}

.preview-stage {
  border: 1px solid #b4bcc6;
  border-radius: 4px;
  overflow: hidden;
}

.desktop-surface {
  position: relative;
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}

.desktop-surface.win11-surface {
  background:
    radial-gradient(circle at 20% 14%, rgba(255, 255, 255, 0.35), transparent 40%),
    radial-gradient(circle at 85% 78%, rgba(26, 69, 163, 0.36), transparent 48%),
    linear-gradient(130deg, #8baecc 0%, #96b3cf 42%, #789fc2 100%);
}

.desktop-surface.win10-surface {
  background: linear-gradient(120deg, #045cb6 0%, #0078d7 48%, #1495e4 100%);
}

.desktop-surface.win10-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 49.5%, rgba(255, 255, 255, 0.26) 50%, transparent 50.5%),
    linear-gradient(180deg, transparent 49.5%, rgba(255, 255, 255, 0.22) 50%, transparent 50.5%);
  transform: scale(1.8);
  opacity: 0.36;
}

.desktop-surface.win10-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.22), transparent 35%);
}

.notification-window {
  position: relative;
  width: 760px;
  border: 1px solid #a8a8a8;
  background: #fff;
  color: #111;
  display: flex;
  flex-direction: column;
  box-shadow: 0 22px 42px rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

.notification-window.win10 {
  border-radius: 0;
}

.notification-window.win11 {
  border-radius: 8px;
  border-color: #b0b0b0;
}

.window-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  flex: 0 0 auto;
}

.win11 .window-caption {
  background: #f5f5f5;
}

.win10 .window-caption {
  background: #ececec;
}

.caption-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 10px;
  padding-right: 10px;
}

.caption-app-icon {
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
  flex: 0 0 16px;
}

#windowCaptionPreview {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #111;
}

.caption-close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #1f1f1f;
  padding: 0;
  cursor: default;
  display: grid;
  place-items: center;
}

.win11 .caption-close {
  border-top-right-radius: 8px;
}

.caption-close:hover {
  background: #e81123;
  color: #fff;
}

.caption-close.is-empty span {
  visibility: hidden;
}

.caption-close.is-empty:hover {
  background: transparent;
  color: #1f1f1f;
}

.caption-close span {
  font-size: 14px;
  line-height: 1;
  transform: translateY(-0.5px);
}

.window-main {
  display: flex;
  align-items: flex-start;
  flex: 0 0 auto;
  overflow: hidden;
}

.icon-shell {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}

.icon-shell img,
.icon-shell svg {
  width: 32px;
  height: 32px;
  display: block;
}

.system-icon {
  image-rendering: auto;
}

.custom-icon {
  width: 34px;
  height: 34px;
  border: 1px solid #6f6f6f;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  color: #214f95;
  background: #fff;
}

.text-shell p {
  margin: 0;
  font: 400 13.333px/1.25 "Segoe UI", Tahoma, sans-serif;
  white-space: pre-wrap;
  word-break: break-word;
  color: #101010;
}

.window-actions {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 0;
  background: #f0f0f0;
  flex: 0 0 auto;
  overflow: hidden;
}

.win11 .window-actions {
  background: #f5f5f5;
}

.action-button {
  position: relative;
  min-width: 92px;
  border: 1px solid #8d8d8d;
  border-radius: 2px;
  background: #fcfcfc;
  color: #000;
  font: 400 12px "Segoe UI", Tahoma, sans-serif;
  padding: 0 18px;
  order: 2;
}

.action-button:not(.is-default) {
  order: 1;
}

.action-button:hover {
  filter: brightness(0.985);
}

.action-button:active {
  filter: brightness(0.96);
}

.action-button.is-default {
  border-color: #676767;
}

.action-button.is-default::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px dotted #212121;
  opacity: 0.72;
  pointer-events: none;
}

.status-text {
  margin: 0;
  min-height: 20px;
  font-size: 13px;
  color: #2f3f54;
}

.message-measure {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 560px;
  white-space: pre-wrap;
  word-break: break-word;
  font: 400 13.333px/1.25 "Segoe UI", Tahoma, sans-serif;
  padding: 0;
  margin: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .desktop-surface {
    min-height: 460px;
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 10px;
    gap: 10px;
  }

  .controls,
  .preview {
    border-radius: 8px;
  }

  .controls {
    padding: 12px;
  }

  .controls-grid {
    grid-template-columns: 1fr;
  }

  .desktop-surface {
    min-height: 380px;
    padding: 12px;
  }

  .window-main {
    min-width: 0;
  }

  .window-actions {
    flex-wrap: wrap;
  }

  .action-button {
    flex: 1;
    min-width: 120px;
  }
}
