:root {
  --bg-canvas: #f5f2eb;
  --bg-surface: #fbfaf6;
  --bg-panel: rgba(252, 250, 245, 0.86);
  --bg-card: rgba(255, 254, 250, 0.92);
  --bg-card-hover: #ffffff;
  --bg-well: rgba(23, 33, 48, 0.05);

  --border-hairline: rgba(23, 33, 48, 0.10);
  --border-brass: rgba(168, 111, 40, 0.38);
  --border-focus: #12748f;

  --text-primary: #172130;
  --text-secondary: #4a5a70;
  --text-muted: #566579;

  --accent-brass: #a86f28;
  --accent-brass-ink: #8a5718;
  --accent-brass-soft: rgba(168, 111, 40, 0.12);
  --accent-brass-bright: #b87c2e;
  --accent-cerulean: #12748f;
  --accent-cerulean-soft: rgba(18, 116, 143, 0.12);
  --accent-teal: #168a7a;
  --accent-teal-soft: rgba(22, 138, 122, 0.13);
  --accent-emerald: #1e8259;
  --accent-emerald-soft: rgba(30, 130, 89, 0.12);
  --accent-crimson: #b84444;
  --accent-crimson-soft: rgba(184, 68, 68, 0.12);

  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --shadow-subtle: 0 4px 14px rgba(23, 33, 48, 0.04);
  --shadow-soft: 0 14px 32px rgba(23, 33, 48, 0.08);
  --shadow-elevation: 0 20px 48px rgba(23, 33, 48, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

@keyframes viewFadeSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ambient-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 85% at 50% 45%, transparent 55%, rgba(214, 206, 190, 0.36) 100%),
    repeating-linear-gradient(0deg, rgba(23, 33, 48, 0.025) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(90deg, rgba(23, 33, 48, 0.025) 0 1px, transparent 1px 48px),
    radial-gradient(ellipse 75% 50% at 15% 10%, rgba(18, 116, 143, 0.08), transparent 65%),
    radial-gradient(ellipse 65% 55% at 85% 85%, rgba(168, 111, 40, 0.09), transparent 65%),
    linear-gradient(180deg, #f7f4ed 0%, #ece8df 100%);
  z-index: 0;
}

/* =========================================================
   ГЛАВНО МЕНИ (EDITORIAL GALLERY LAYOUT)
========================================================= */
.menu-screen {
  position: relative;
  min-height: 100vh;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(22px, 3.8vh, 42px) 24px;
}

.menu-screen:not(.hidden) .menu-shell {
  animation: viewFadeSlide 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.menu-bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.65;
  z-index: 0;
}

.menu-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1120px;
}

.menu-header {
  margin-bottom: clamp(20px, 3vh, 34px);
  position: relative;
  padding-bottom: 18px;
}

.menu-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--border-brass) 0%, rgba(23, 33, 48, 0.08) 50%, transparent 100%);
}

.menu-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.curriculum-pill,
.author-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.03em;
  border: 1px solid var(--border-hairline);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-subtle);
}

.curriculum-pill {
  color: var(--accent-cerulean);
  border-color: rgba(18, 116, 143, 0.24);
  font-weight: 500;
}

.author-badge {
  color: var(--accent-brass-ink);
  border-color: var(--border-brass);
  font-weight: 600;
}

.menu-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.2rem, 4.4vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.menu-subtitle {
  margin: 0;
  max-width: 720px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.65;
}

.suite-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.suite-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  padding: 26px 26px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(23, 33, 48, 0.10);
  background: linear-gradient(155deg, rgba(255, 255, 252, 0.96) 0%, rgba(246, 241, 232, 0.90) 100%);
  backdrop-filter: blur(14px);
  color: var(--text-primary);
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.24s ease,
    background 0.24s ease,
    box-shadow 0.24s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 8px 24px rgba(23, 33, 48, 0.05);
}

.suite-card > * {
  position: relative;
  z-index: 1;
}

.suite-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-brass), var(--accent-cerulean));
  opacity: 0;
  transition: opacity 0.24s ease;
  z-index: 2;
}

.suite-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle 240px at 88% 12%,
    rgba(18, 116, 143, 0.10),
    rgba(168, 111, 40, 0.07) 45%,
    transparent 75%
  );
  opacity: 0.38;
  transition: opacity 0.28s ease;
  z-index: 0;
}

.suite-card:nth-child(1)::before {
  background: linear-gradient(90deg, var(--accent-cerulean), var(--accent-brass));
}

.suite-card:nth-child(1)::after {
  background: radial-gradient(
    circle 240px at 88% 12%,
    rgba(18, 116, 143, 0.11),
    rgba(168, 111, 40, 0.07) 45%,
    transparent 75%
  );
}

.suite-card:nth-child(2)::before {
  background: linear-gradient(90deg, var(--accent-teal), var(--accent-cerulean));
}

.suite-card:nth-child(2)::after {
  background: radial-gradient(
    circle 240px at 88% 12%,
    rgba(22, 138, 122, 0.12),
    rgba(18, 116, 143, 0.06) 45%,
    transparent 75%
  );
}

.suite-card:nth-child(3)::before {
  background: linear-gradient(90deg, var(--accent-brass), var(--accent-brass-bright));
}

.suite-card:nth-child(3)::after {
  background: radial-gradient(
    circle 240px at 88% 12%,
    rgba(168, 111, 40, 0.13),
    rgba(184, 124, 46, 0.06) 45%,
    transparent 75%
  );
}

.suite-card:nth-child(4)::before {
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cerulean));
}

.suite-card:nth-child(4)::after {
  background: radial-gradient(
    circle 240px at 88% 12%,
    rgba(30, 130, 89, 0.12),
    rgba(18, 116, 143, 0.06) 45%,
    transparent 75%
  );
}

.suite-card:hover,
.suite-card:focus-visible {
  outline: none;
  transform: translateY(-4px);
  border-color: rgba(168, 111, 40, 0.42);
  background: linear-gradient(155deg, #ffffff 0%, #f9f6ef 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    var(--shadow-elevation);
}

.suite-card:hover::before,
.suite-card:focus-visible::before,
.suite-card:hover::after,
.suite-card:focus-visible::after {
  opacity: 1;
}

.suite-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.suite-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-brass-ink);
  background: var(--accent-brass-soft);
  border: 1px solid rgba(168, 111, 40, 0.28);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.suite-motif {
  width: 64px;
  height: 36px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(23, 33, 48, 0.03);
  border: 1px solid rgba(23, 33, 48, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  opacity: 0.96;
  flex-shrink: 0;
  transition: background 0.24s ease, border-color 0.24s ease, transform 0.24s ease;
}

.suite-card:hover .suite-motif,
.suite-card:focus-visible .suite-motif {
  background: rgba(18, 116, 143, 0.06);
  border-color: rgba(168, 111, 40, 0.24);
  transform: scale(1.03);
}

.suite-card-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

.suite-card-desc {
  margin: 0 0 20px;
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.6;
}

.suite-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid rgba(23, 33, 48, 0.08);
  font-size: 12.5px;
  color: var(--accent-cerulean);
  font-weight: 600;
}

.suite-card-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-cerulean-soft);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.2s ease;
}

.suite-card:hover .suite-card-arrow {
  transform: translateX(4px);
  background: rgba(18, 116, 143, 0.22);
}

.menu-footer {
  margin-top: clamp(20px, 3vh, 28px);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-hairline);
}

/* =========================================================
   РАБОТЕН ПРОСТОР ЗА СИМУЛАЦИИ
========================================================= */
.workspace {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
}

.workspace:not(.hidden) {
  animation: viewFadeSlide 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-hairline);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-subtle);
  flex-shrink: 0;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.toolbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border-hairline);
  flex-shrink: 0;
}

.toolbar-title-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-brass-ink);
  background: var(--accent-brass-soft);
  padding: 3px 9px;
  border-radius: 5px;
  border: 1px solid rgba(168, 111, 40, 0.24);
  font-weight: 600;
  white-space: nowrap;
}

.toolbar-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.12rem, 1.7vw, 1.45rem);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: #ffffff;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(23, 33, 48, 0.05);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}

.btn:hover {
  background: #fafaf7;
  border-color: rgba(23, 33, 48, 0.22);
  box-shadow: 0 2px 6px rgba(23, 33, 48, 0.08);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(180deg, #1682a0 0%, var(--accent-cerulean) 100%);
  border-color: var(--accent-cerulean);
  color: #ffffff;
  font-weight: 600;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 2px 8px rgba(18, 116, 143, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #12718c 0%, #0f6279 100%);
  border-color: #0f6279;
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 4px 12px rgba(18, 116, 143, 0.32);
}

.btn-toggle[aria-pressed="true"] {
  background: var(--accent-brass-soft);
  border-color: var(--border-brass);
  color: var(--accent-brass-ink);
  font-weight: 600;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  background: rgba(23, 33, 48, 0.06);
  border-color: rgba(23, 33, 48, 0.10);
}

.btn-accent-warm {
  width: 100%;
  justify-content: center;
  margin: 10px 0 4px;
  padding: 10px 14px;
  background: #ffffff;
  border-color: rgba(168, 111, 40, 0.45);
  color: var(--accent-brass-ink);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(168, 111, 40, 0.12);
}

.btn-accent-warm:hover {
  background: var(--accent-brass-soft);
  border-color: var(--accent-brass);
  color: #6f4410;
}

.workspace-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(340px, 25vw, 384px);
}

.stage-container {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 10px 10px 10px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(23, 33, 48, 0.14);
  background: #ece8df;
  box-shadow:
    0 0 0 1px rgba(255, 254, 250, 0.85),
    0 10px 28px rgba(23, 33, 48, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  overflow: hidden;
}

.sim-canvas {
  display: block;
  flex: 1;
  min-height: 0;
  width: 100%;
  touch-action: none;
}

.sim-canvas.is-draggable {
  cursor: grab;
}

.sim-canvas.is-draggable.is-dragging {
  cursor: grabbing;
}

.stage-status-pill {
  position: absolute;
  top: 14px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(255, 254, 250, 0.92);
  border: 1px solid var(--border-hairline);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-soft);
  pointer-events: none;
}

.stage-status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.stage-status-pill.is-tir {
  color: var(--accent-brass-ink);
  border-color: rgba(168, 111, 40, 0.65);
  background: rgba(255, 248, 238, 0.94);
  box-shadow: 0 4px 18px rgba(168, 111, 40, 0.22);
}

.stage-status-pill.is-tir::before {
  background: var(--accent-brass);
  box-shadow: 0 0 0 2px rgba(168, 111, 40, 0.22);
}

.stage-status-pill.is-partial {
  color: var(--accent-cerulean);
  border-color: rgba(18, 116, 143, 0.38);
  background: rgba(242, 250, 252, 0.94);
}

.stage-status-pill.is-partial::before {
  background: var(--accent-cerulean);
  box-shadow: 0 0 0 2px rgba(18, 116, 143, 0.20);
}

.stage-status-pill.is-resonance {
  color: var(--accent-emerald);
  border-color: rgba(30, 130, 89, 0.55);
  background: rgba(240, 252, 245, 0.94);
  box-shadow: 0 4px 18px rgba(30, 130, 89, 0.20);
}

.stage-status-pill.is-resonance::before {
  background: var(--accent-emerald);
  box-shadow: 0 0 0 2px rgba(30, 130, 89, 0.22);
}

.stage-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  max-width: calc(100% - 32px);
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-primary);
  background: rgba(252, 250, 245, 0.90);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-subtle);
  text-align: center;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.35s ease;
}

.stage-hint.is-dimmed {
  opacity: 0.56;
}

/* =========================================================
   КОНТРОЛЕН ПАНЕЛ И МЕРЕЊА
========================================================= */
.inspector-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-hairline);
  backdrop-filter: blur(14px);
  box-shadow: -4px 0 20px rgba(23, 33, 48, 0.04);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 33, 48, 0.18) transparent;
  padding: 18px 20px 24px;
  gap: 18px;
}

.inspector-panel::-webkit-scrollbar {
  width: 6px;
}

.inspector-panel::-webkit-scrollbar-track {
  background: transparent;
}

.inspector-panel::-webkit-scrollbar-thumb {
  background: rgba(23, 33, 48, 0.16);
  border-radius: 999px;
}

.inspector-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(23, 33, 48, 0.28);
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.readouts-section {
  padding-top: 14px;
  border-top: 1px solid var(--border-hairline);
}

.panel-heading {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(23, 33, 48, 0.08);
}

.controls-mount {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.control-group {
  --slider-accent: var(--accent-brass);
  --slider-ink: var(--accent-brass-ink);
  --slider-accent-soft: var(--accent-brass-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 2px 12px;
  border-radius: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(23, 33, 48, 0.07);
  box-shadow: none;
}

.control-group:last-child {
  border-bottom: none;
}

.control-group + .toggle-row {
  margin-top: 2px;
}

.control-group[data-tone="cerulean"] {
  --slider-accent: var(--accent-cerulean);
  --slider-ink: var(--accent-cerulean);
  --slider-accent-soft: var(--accent-cerulean-soft);
}

.control-group[data-tone="teal"] {
  --slider-accent: var(--accent-teal);
  --slider-ink: #0f7062;
  --slider-accent-soft: var(--accent-teal-soft);
}

.control-group[data-tone="emerald"] {
  --slider-accent: var(--accent-emerald);
  --slider-ink: var(--accent-emerald);
  --slider-accent-soft: var(--accent-emerald-soft);
}

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.control-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--slider-ink);
  font-weight: 600;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 9px;
  background: var(--bg-well);
  border: 1px solid rgba(23, 33, 48, 0.08);
}

.segmented-btn {
  padding: 7px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.segmented-btn.is-active {
  background: #ffffff;
  color: var(--accent-cerulean);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(23, 33, 48, 0.08);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  border: 1px solid rgba(23, 33, 48, 0.09);
  background: linear-gradient(90deg, var(--slider-accent, var(--accent-brass)) var(--range-pct, 50%), rgba(23, 33, 48, 0.11) var(--range-pct, 50%));
  box-shadow: inset 0 1px 2px rgba(23, 33, 48, 0.12);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--slider-accent, var(--accent-brass));
  border: 2.5px solid #ffffff;
  box-shadow: 0 0 0 1px var(--slider-accent, var(--accent-brass)), 0 2px 6px rgba(23, 33, 48, 0.24);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px var(--slider-accent-soft, var(--accent-brass-soft)), 0 2px 8px rgba(23, 33, 48, 0.25);
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.12);
  box-shadow: 0 0 0 5px var(--slider-accent-soft, var(--accent-brass-soft)), 0 2px 8px rgba(23, 33, 48, 0.25);
}

input[type="range"]::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--slider-accent, var(--accent-brass));
  border: 2.5px solid #ffffff;
  box-shadow: 0 0 0 1px var(--slider-accent, var(--accent-brass)), 0 2px 6px rgba(23, 33, 48, 0.24);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px var(--slider-accent-soft, var(--accent-brass-soft)), 0 2px 8px rgba(23, 33, 48, 0.25);
}

input[type="range"]:active::-moz-range-thumb {
  transform: scale(1.12);
  box-shadow: 0 0 0 5px var(--slider-accent-soft, var(--accent-brass-soft)), 0 2px 8px rgba(23, 33, 48, 0.25);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 6px;
  border-radius: 6px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(23, 33, 48, 0.07);
  box-shadow: none;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.16s ease, color 0.16s ease;
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row:hover {
  background: rgba(23, 33, 48, 0.035);
  color: var(--text-primary);
}

.toggle-row.is-checked {
  background: rgba(18, 116, 143, 0.06);
  color: var(--text-primary);
}

.toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: rgba(23, 33, 48, 0.16);
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(23, 33, 48, 0.22);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toggle-input:checked + .toggle-switch {
  background: var(--accent-cerulean);
}

.toggle-input:checked + .toggle-switch::after {
  transform: translateX(15px);
}

.btn:focus-visible,
.segmented-btn:focus-visible,
.preset-chip:focus-visible,
.toggle-row:focus-within,
input[type="range"]:focus-visible {
  outline: 2px solid var(--accent-cerulean);
  outline-offset: 2px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(23, 33, 48, 0.11);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.preset-chip:hover {
  border-color: var(--accent-brass);
  color: var(--accent-brass-ink);
  background: #ffffff;
  box-shadow: var(--shadow-subtle);
}

.preset-chip.is-active {
  border-color: var(--accent-brass);
  background: var(--accent-brass-soft);
  color: var(--accent-brass-ink);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(168, 111, 40, 0.14);
}

.readouts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.readout-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(255, 254, 250, 0.72);
  border: 1px solid rgba(23, 33, 48, 0.08);
  box-shadow: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.readout-card.full-span {
  grid-column: span 2;
}

.readout-card.highlight-warm {
  border-color: rgba(168, 111, 40, 0.42);
  background: rgba(255, 249, 240, 0.92);
}

.readout-card.highlight-emerald {
  border-color: rgba(30, 130, 89, 0.42);
  background: rgba(242, 250, 245, 0.92);
}

.readout-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.readout-card[data-tone] .readout-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.readout-card[data-tone="brass"] .readout-label::before {
  background: var(--accent-brass);
}

.readout-card[data-tone="cerulean"] .readout-label::before {
  background: var(--accent-cerulean);
}

.readout-card[data-tone="teal"] .readout-label::before {
  background: var(--accent-teal);
}

.readout-card[data-tone="emerald"] .readout-label::before {
  background: var(--accent-emerald);
}

.readout-value {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
}

/* =========================================================
   ОДЗИВНОСТ (RESPONSIVE)
========================================================= */
@media (max-width: 1080px) {
  .toolbar {
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 10px 16px;
  }

  .toolbar-left {
    flex: 1 1 320px;
  }

  .toolbar-title {
    white-space: normal;
    line-height: 1.25;
  }
}

@media (max-width: 960px) {
  .suite-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .workspace-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(430px, 56vh) auto;
  }

  .stage-container {
    margin: 10px;
  }

  .inspector-panel {
    border-left: none;
    border-top: 1px solid var(--border-hairline);
  }
}

@media (max-width: 640px) {
  .menu-screen {
    padding: 24px 16px;
  }

  .suite-card {
    padding: 20px 18px 16px;
  }

  .toolbar {
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .toolbar-title-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .toolbar-title {
    font-size: 1.15rem;
    white-space: normal;
    line-height: 1.2;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .workspace-body {
    grid-template-rows: minmax(300px, 44vh) auto;
  }

  .stage-container {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .stage-hint {
    bottom: 10px;
    padding: 5px 12px;
    font-size: 11px;
  }

  .btn,
  .segmented-btn {
    min-height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .menu-screen:not(.hidden) .menu-shell,
  .workspace:not(.hidden) {
    animation: none !important;
  }

  .suite-card,
  .suite-motif,
  .suite-card-arrow,
  .btn,
  .segmented-btn,
  .toggle-row,
  .toggle-switch,
  .toggle-switch::after,
  .preset-chip,
  .readout-card,
  .stage-hint {
    transition-duration: 0.01ms !important;
  }
}
