/* KeyCap Studio — Dark Studio
   Type: Inter Tight + JetBrains Mono. Tracking tight on display.
   Palette: deep ink with sky / pink accents at same chroma. */

:root {
  color-scheme: dark;

  /* surfaces */
  --ink: #07070a;
  --canvas: #0c0c10;
  --surface: #131318;
  --surface-2: #1b1b22;
  --surface-3: #25252d;
  --panel: rgb(20 20 26 / 0.78);
  --popover-bg: rgb(15 15 20 / 0.96);
  --tooltip-bg: rgb(7 7 10 / 0.92);

  /* hairlines */
  --hairline-soft: rgb(255 255 255 / 0.05);
  --hairline: rgb(255 255 255 / 0.09);
  --hairline-strong: rgb(255 255 255 / 0.16);

  /* text */
  --text: #f4f4f7;
  --text-secondary: rgb(244 244 247 / 0.62);
  --text-muted: rgb(244 244 247 / 0.40);
  --text-faint: rgb(244 244 247 / 0.22);

  /* accents (same C/L, different hue) */
  --accent: #7cc0ff;            /* sky — primary action */
  --accent-soft: rgb(124 192 255 / 0.16);
  --accent-pressed: #9ccdff;
  --pink: #ff9ec1;              /* pink — selected / live */
  --pink-soft: rgb(255 158 193 / 0.14);

  /* shadows */
  --shadow-dock: 0 1px 0 rgb(255 255 255 / 0.04) inset,
                 0 24px 60px -20px rgb(0 0 0 / 0.7),
                 0 2px 8px rgb(0 0 0 / 0.4);
  --shadow-popover: 0 1px 0 rgb(255 255 255 / 0.06) inset,
                    0 24px 80px -10px rgb(0 0 0 / 0.7),
                    0 2px 10px rgb(0 0 0 / 0.5);

  /* radius */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 9999px;

  /* type */
  --font-display: "Inter Tight", "Söhne", "Neue Haas Grotesk Display Pro", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: "Inter Tight", "Söhne", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Berkeley Mono", "SF Mono", ui-monospace, monospace;
}

/* Light theme override */
:root[data-theme="light"] {
  color-scheme: light;
  --ink: #f5f5f7;
  --canvas: #fafafc;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --surface-3: #ececef;
  --panel: rgb(255 255 255 / 0.82);
  --popover-bg: rgb(255 255 255 / 0.96);
  --tooltip-bg: rgb(255 255 255 / 0.94);
  --hairline-soft: rgb(0 0 0 / 0.05);
  --hairline: rgb(0 0 0 / 0.09);
  --hairline-strong: rgb(0 0 0 / 0.16);
  --text: #15151a;
  --text-secondary: rgb(21 21 26 / 0.62);
  --text-muted: rgb(21 21 26 / 0.42);
  --text-faint: rgb(21 21 26 / 0.24);
  --accent: #0066cc;
  --accent-soft: rgb(0 102 204 / 0.10);
  --accent-pressed: #0071e3;
  --pink: #d6447a;
  --pink-soft: rgb(214 68 122 / 0.10);
  --shadow-dock: 0 1px 0 rgb(255 255 255 / 0.9) inset,
                 0 24px 60px -20px rgb(0 0 0 / 0.18),
                 0 2px 8px rgb(0 0 0 / 0.08);
}

/* Studio theme — warmer dark */
:root[data-theme="studio"] {
  --ink: #0a0908;
  --canvas: #100e0c;
  --surface: #1a1814;
  --surface-2: #221f1a;
  --surface-3: #2c2823;
  --popover-bg: rgb(18 16 13 / 0.96);
  --tooltip-bg: rgb(18 16 13 / 0.94);
  --hairline-soft: rgb(255 240 220 / 0.05);
  --hairline: rgb(255 240 220 / 0.09);
  --text: #f7f2ea;
  --text-secondary: rgb(247 242 234 / 0.62);
  --accent: #ffb88a;
  --accent-soft: rgb(255 184 138 / 0.16);
  --accent-pressed: #ffc9a3;
  --pink: #ff9ec1;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font-sans);
  font-feature-settings: "ss03", "cv11", "tnum";
  color: var(--text);
  background: var(--canvas);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, select, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

::selection { background: var(--accent-soft); color: var(--text); }
.mobile-only { display: none; }
.keep-line { white-space: nowrap; }

/* ──────────────────────────────────── Global nav */

.global-nav {
  position: relative;
  z-index: 30;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  background: var(--ink);
  border-bottom: 1px solid var(--hairline-soft);
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0;
}

.nav-mark {
  position: relative;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: linear-gradient(155deg, var(--surface-3) 0%, var(--surface-2) 60%, var(--ink) 100%);
  box-shadow: inset 0 1px 0 var(--hairline-strong),
              inset 0 -2px 6px rgb(0 0 0 / 0.5),
              0 1px 2px rgb(0 0 0 / 0.4);
  cursor: pointer;
}
.nav-mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 2px;
  background: radial-gradient(ellipse at 50% 40%, var(--text-faint) 0%, transparent 70%);
}

.nav-brand {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  margin-right: 8px;
}

.nav-crumbs {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.nav-crumbs span { display: flex; align-items: center; gap: 14px; }
.nav-crumbs span + span::before {
  content: "";
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
}

.nav-spacer { flex: 1; }

.nav-link {
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 0 6px;
  cursor: pointer;
  transition: color 120ms ease;
}
.nav-link:hover { color: var(--text); }

.theme-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: rgb(255 255 255 / 0.04);
}

.theme-button {
  min-height: 24px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-muted);
  padding: 0 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.theme-button:hover {
  color: var(--text-secondary);
}

.theme-button.is-selected {
  background: var(--accent-soft);
  color: var(--accent-pressed);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

/* ──────────────────────────────────── Landing */

.landing {
  position: relative;
  min-height: calc(100vh - 48px);
  background:
    radial-gradient(ellipse at 16% 8%, rgb(124 192 255 / 0.16) 0%, transparent 34%),
    radial-gradient(ellipse at 92% 22%, rgb(255 158 193 / 0.09) 0%, transparent 38%),
    radial-gradient(ellipse at 50% 75%, rgb(255 255 255 / 0.035) 0%, transparent 45%),
    var(--canvas);
  overflow: hidden;
  line-break: strict;
  word-break: normal;
}

.landing::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--hairline-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--hairline-soft) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at 50% 18%, black 0%, transparent 72%);
  pointer-events: none;
}

.lp-section {
  position: relative;
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.hero {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(340px, 0.98fr);
  align-items: center;
  gap: 56px;
  padding: 92px 0 80px;
}

.hero-copy {
  display: grid;
  gap: 24px;
  justify-items: start;
}

.eyebrow {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 12px var(--pink);
}

.hero h1,
.landing h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.035em;
  color: var(--text);
}

.hero h1 {
  max-width: 780px;
  font-size: clamp(58px, 8.4vw, 116px);
  line-height: 0.96;
  background: linear-gradient(180deg, var(--text) 0%, rgb(244 244 247 / 0.56) 122%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.landing h2 {
  font-size: clamp(38px, 5vw, 72px);
  line-height: 1.02;
}

.lead {
  max-width: 680px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 19px;
  line-height: 1.7;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.lead span { display: block; }

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.hero-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 22px 0 24px;
}
.hero-action::after {
  content: "→";
  font-family: var(--font-mono);
  font-size: 14px;
  transform: translateY(-0.5px);
}

.secondary-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: rgb(255 255 255 / 0.035);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.secondary-action:hover { color: var(--text); border-color: var(--hairline-strong); background: rgb(255 255 255 / 0.06); }

.hero-product {
  position: relative;
  min-height: 520px;
  display: grid;
  place-items: center;
}

.product-window {
  position: relative;
  width: min(100%, 520px);
  aspect-ratio: 1 / 1.06;
  border: 1px solid var(--hairline);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.085), rgb(255 255 255 / 0.025)),
    radial-gradient(circle at 50% 42%, var(--accent-soft), transparent 44%),
    var(--ink);
  box-shadow: var(--shadow-popover);
  overflow: hidden;
}

.window-topbar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 18px;
  border-bottom: 1px solid var(--hairline-soft);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.window-topbar span { width: 8px; height: 8px; border-radius: 50%; background: var(--hairline-strong); }
.window-topbar em { margin-left: auto; font-style: normal; }

.keycap-render {
  position: absolute;
  inset: 72px 52px 86px;
  transform: perspective(900px) rotateX(58deg) rotateZ(-36deg);
  transform-style: preserve-3d;
  z-index: 2;
}
.keycap-top,
.keycap-body,
.keycap-stem { position: absolute; left: 50%; top: 50%; transform-style: preserve-3d; }
.keycap-top {
  width: 230px;
  height: 210px;
  transform: translate(-50%, -58%) translateZ(82px);
  border-radius: 34px;
  background:
    radial-gradient(ellipse at 45% 35%, rgb(255 255 255 / 0.38), transparent 34%),
    linear-gradient(135deg, rgb(244 244 247 / 0.92), rgb(124 192 255 / 0.36) 58%, rgb(255 158 193 / 0.20));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.45), inset 0 -22px 36px rgb(0 0 0 / 0.18), 0 38px 80px rgb(0 0 0 / 0.45);
}
.keycap-body {
  width: 282px;
  height: 260px;
  transform: translate(-50%, -50%) translateZ(18px);
  border-radius: 46px;
  background: linear-gradient(145deg, rgb(244 244 247 / 0.24), rgb(124 192 255 / 0.14) 55%, rgb(0 0 0 / 0.18));
  border: 1px solid rgb(255 255 255 / 0.14);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08), inset 0 -42px 54px rgb(0 0 0 / 0.34);
}
.keycap-stem {
  width: 72px;
  height: 72px;
  transform: translate(-50%, -50%) translateZ(-36px);
  border-radius: 18px;
  background: rgb(255 255 255 / 0.18);
  border: 1px solid rgb(255 255 255 / 0.16);
}
.keycap-stem::before,
.keycap-stem::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  border-radius: 4px;
  background: rgb(7 7 10 / 0.62);
  transform: translate(-50%, -50%);
}
.keycap-stem::before { width: 16px; height: 58px; }
.keycap-stem::after { width: 58px; height: 16px; }

.orbit-ring {
  position: absolute;
  left: 50%;
  top: 51%;
  z-index: 1;
  width: 360px;
  height: 220px;
  border: 1px solid rgb(124 192 255 / 0.36);
  border-inline-color: rgb(255 255 255 / 0.08);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  box-shadow: 0 0 48px rgb(124 192 255 / 0.10);
}
.orbit-ring::after {
  content: "";
  position: absolute;
  right: 36px;
  top: 20px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}

.orbit-hint {
  position: absolute;
  right: 32px;
  bottom: 102px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: rgb(7 7 10 / 0.54);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.orbit-hint span {
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
}

.mock-handle {
  position: absolute;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-pressed);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 1px 10px rgb(0 0 0 / 0.65);
}
.mock-handle span {
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 5px var(--accent-soft), 0 0 20px rgb(124 192 255 / 0.72);
}
.mock-handle em { font-style: normal; }
.handle-a { left: 174px; top: 142px; }
.handle-b { right: 134px; top: 214px; }
.handle-c { left: 158px; bottom: 156px; }

.floating-spec {
  position: absolute;
  display: grid;
  gap: 4px;
  min-width: 128px;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-dock);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
.floating-spec span { color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.floating-spec strong { font-size: 15px; font-weight: 500; }
.spec-a { left: 28px; top: 88px; }
.spec-b { right: 24px; top: 190px; }
.spec-c { left: 58px; bottom: 46px; }

.concept-strip {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-block: 1px solid var(--hairline);
  background: var(--canvas);
}

.concept-strip article {
  min-height: 218px;
  display: grid;
  align-content: end;
  gap: 8px;
  padding: 30px 32px 34px;
  border-right: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgb(255 255 255 / 0.018), transparent), var(--canvas);
}
.concept-strip article:last-child { border-right: 0; }

.concept-num,
.section-kicker,
.step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.concept-strip strong {
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.concept-strip p,
.workflow-card p,
.output-section p,
.problem-section p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.concept-strip p { max-width: 310px; }

.problem-section {
  display: grid;
  gap: 22px;
  padding: 128px 0;
  text-align: center;
}
.problem-section p {
  max-width: 820px;
  margin-inline: auto;
  color: var(--text-secondary);
  font-size: 18px;
}

.workflow-section {
  padding: 88px 0 112px;
}
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}
.section-heading > div { display: grid; gap: 14px; }
.compact-action { min-height: 38px; padding-inline: 18px; flex: 0 0 auto; }
.workflow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.workflow-card {
  min-height: 260px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--hairline);
  border-radius: 22px;
  background: rgb(255 255 255 / 0.035);
}
.workflow-card h3 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.workflow-card .step-num { color: var(--accent-pressed); }

.output-section {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  align-items: center;
  gap: 48px;
  padding: 96px 0;
  border-top: 1px solid var(--hairline-soft);
}
.output-copy { display: grid; gap: 18px; }
.output-copy p { color: var(--text-secondary); font-size: 17px; }
.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.spec-grid div {
  min-height: 138px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.045), rgb(255 255 255 / 0.02));
}
.spec-grid span { color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.spec-grid strong { font-size: 18px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }

.final-cta {
  display: grid;
  justify-items: center;
  gap: 24px;
  padding: 120px 0 140px;
  text-align: center;
}
.final-cta h2 { max-width: 760px; }

/* ──────────────────────────────────── Designer chrome */

.designer { position: relative; min-height: calc(100vh - 48px); background: var(--canvas); }

.sub-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: rgb(7 7 10 / 0.72);
  border-bottom: 1px solid var(--hairline-soft);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.sub-nav .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

.sub-nav .meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--hairline);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 10px var(--pink);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.export-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-resolution-tabs {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: rgb(255 255 255 / 0.04);
}

.preview-resolution-menu {
  height: 32px;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: rgb(255 255 255 / 0.05);
  color: var(--text-secondary);
}

.preview-resolution-menu span {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-resolution-menu select {
  min-width: 86px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  outline: 0;
}

.preview-resolution-label {
  padding: 0 8px 0 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.preview-res-tab {
  height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.preview-res-tab:hover {
  color: var(--text-secondary);
}

.preview-res-tab.is-selected {
  background: var(--accent-soft);
  color: var(--accent-pressed);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

/* Stage */

.app { position: relative; height: calc(100vh - 100px); }

.stage {
  position: relative;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 55%, rgb(40 40 50 / 0.65) 0%, transparent 60%),
    radial-gradient(circle at 50% 92%, rgb(124 192 255 / 0.05) 0%, transparent 50%),
    var(--ink);
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 30% at 50% 65%, rgb(0 0 0 / 0.5) 0%, transparent 100%);
  pointer-events: none;
}

#preview {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#preview.is-dragging { cursor: grabbing; }
.stage.is-rendering #preview {
  cursor: progress;
}

.preview-busy {
  position: absolute;
  left: 50%;
  top: 74px;
  z-index: 9;
  transform: translateX(-50%);
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--panel);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: var(--shadow-dock);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  pointer-events: none;
}

.busy-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--hairline-strong);
  border-top-color: var(--accent);
  animation: spin 760ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.stage-status {
  position: absolute;
  left: 28px;
  top: 24px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.stage-status .key {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.stage-status .val {
  color: var(--text);
  font-size: 13px;
}

.view-controls {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 4;
  display: flex;
  gap: 6px;
}

.view-button {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--panel);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: color 120ms, border-color 120ms, background 120ms;
}
.view-button:hover { color: var(--text); border-color: var(--hairline-strong); }

/* ──────────────────────────────────── Bottom Dock */

.editor-panel {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 6;
  width: min(1180px, calc(100% - 48px));
  max-height: min(42vh, 400px);
  display: flex;
  flex-direction: column;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-dock);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  overflow: hidden;
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 240ms ease,
              max-height 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.editor-panel #controls {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.editor-panel #controls::-webkit-scrollbar { width: 8px; }
.editor-panel #controls::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: 4px;
}
.editor-panel .control-panel { flex-shrink: 0; }

/* panel-position variants */
.editor-panel[data-position="top"] { top: 72px; bottom: auto; }
.editor-panel[data-position="left"],
.editor-panel[data-position="right"] {
  display: flex;
  flex-direction: column;
}
.editor-panel[data-position="left"] {
  left: 24px; top: 72px; bottom: 24px;
  transform: none;
  width: 360px;
}
.editor-panel[data-position="right"] {
  right: 24px; left: auto; top: 72px; bottom: 24px;
  transform: none;
  width: 360px;
}
.editor-panel[data-position="left"] .field-grid,
.editor-panel[data-position="right"] .field-grid {
  grid-template-columns: 1fr 1fr;
}
.editor-panel[data-position="left"] .preset-row,
.editor-panel[data-position="right"] .preset-row {
  flex-wrap: wrap;
}
.editor-panel[data-position="left"] .editor-tabs,
.editor-panel[data-position="right"] .editor-tabs {
  flex-wrap: wrap;
  row-gap: 4px;
  flex-shrink: 0;
}
.editor-panel[data-position="left"] .control-panel,
.editor-panel[data-position="right"] .control-panel,
.editor-panel[data-position="left"] #controls,
.editor-panel[data-position="right"] #controls {
  overflow-y: auto;
  min-height: 0;
}
.editor-panel[data-position="left"] #controls,
.editor-panel[data-position="right"] #controls {
  flex: 1;
}

.editor-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline-soft);
  flex: 0 0 auto;
}

.tab-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 12px 0 6px;
}

.handle-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 0 12px 0 10px;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.handle-legend::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1.5px var(--accent-soft);
}
.handle-legend:hover,
.handle-legend[aria-expanded="true"] {
  background: var(--accent-soft);
  border-color: var(--hairline);
  color: var(--text);
}

.tab {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  transition: color 120ms, background 120ms;
}
.tab:hover { color: var(--text); background: var(--hairline-soft); }
.tab.is-selected {
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.tab-spacer { flex: 1; }

.panel-toggle {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 120ms, border-color 120ms, background 120ms, transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  display: inline-grid;
  place-items: center;
  font-size: 0; /* hide accessible text */
}
.panel-toggle::before,
.panel-toggle::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 1.25px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.panel-toggle::before { transform: translate(-2px, 0) rotate(45deg); }
.panel-toggle::after  { transform: translate( 2px, 0) rotate(-45deg); }

/* Collapsed → flip the chevron */
.editor-panel.is-collapsed .panel-toggle::before { transform: translate(-2px, 0) rotate(-45deg); }
.editor-panel.is-collapsed .panel-toggle::after  { transform: translate( 2px, 0) rotate(45deg); }

.panel-toggle:hover {
  color: var(--text);
  border-color: var(--hairline-strong);
  background: var(--surface-2);
}
.panel-toggle:active { transform: scale(0.92); }

.editor-panel.is-collapsed { padding-bottom: 0; }
.editor-panel.is-collapsed .control-panel,
.editor-panel.is-collapsed #controls { display: none; }
.editor-panel.is-collapsed .editor-tabs { border-bottom: 0; }

.control-panel { display: none; padding: 18px 18px 20px; }
.control-panel.is-active { display: block; }

/* Preset chips */

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

.preset-row[role="group"] {
  /* group rows */
}

.preset {
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  transition: all 140ms;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.preset:hover {
  border-color: var(--hairline-strong);
  color: var(--text);
  background: var(--surface-2);
}
.preset.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.preset.is-selected::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.pitch-picker {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.pitch-picker-label {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pitch-picker-label span:last-child {
  color: var(--text-faint);
}

.pitch-help {
  position: relative;
  width: 16px;
  height: 16px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  cursor: help;
  text-transform: none;
  overflow: visible;
}

.pitch-tooltip {
  position: absolute;
  left: 42px;
  bottom: calc(100% + 8px);
  z-index: 12;
  width: min(340px, calc(100vw - 40px));
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-dock);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0;
  text-transform: none;
  pointer-events: none;
  transform: translateY(4px);
  transition: transform 120ms ease;
}

.pitch-tooltip:not([hidden]) {
  display: block;
  transform: translateY(0);
}

.pitch-row .preset {
  min-width: 52px;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
}

.pitch-custom-badge {
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}

/* Dish toggle (sphere / cylinder) — segmented control */
.dish-row {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--ink);
  margin-bottom: 16px;
  gap: 0;
  flex-wrap: nowrap;
}
.dish-row .preset {
  height: 28px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: 7px;
  font-size: 12px;
}
.dish-row .preset::before { display: none; }
.dish-row .preset:hover { background: var(--hairline-soft); }
.dish-row .preset.is-selected {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

/* Field grid (sliders) */

.panel-heading {
  display: none; /* hidden — section identity is in tabs */
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-sm);
  background: rgb(255 255 255 / 0.025);
}

.field label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: 0;
  line-height: 1.2;
}
.field label span:first-child {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.field.has-handle label span:first-child::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1.5px var(--accent-soft);
  flex-shrink: 0;
}
.field.has-handle { position: relative; }
.field label span:last-child {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.field-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 8px;
  align-items: center;
}

/* Slider track */
.field input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}
.field input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg,
    var(--accent) 0%, var(--accent) var(--pct, 50%),
    var(--hairline) var(--pct, 50%), var(--hairline) 100%);
}
.field input[type="range"]::-moz-range-track {
  height: 2px;
  border-radius: 2px;
  background: var(--hairline);
}
.field input[type="range"]::-moz-range-progress {
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--text);
  border: 0;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.4),
              0 2px 6px rgb(0 0 0 / 0.5);
  transition: transform 120ms;
}
.field input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
.field input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  border: 0;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.4), 0 2px 6px rgb(0 0 0 / 0.5);
}

.field input[type="number"] {
  width: 100%;
  height: 28px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-xs);
  padding: 0 7px;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  -moz-appearance: textfield;
}
.field input[type="number"]::-webkit-inner-spin-button,
.field input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field input[type="number"]:focus {
  color: var(--text);
  background: var(--surface);
}

/* ──────────────────────────────────── Buttons */

button.primary-action,
.primary-action {
  height: 36px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  transition: transform 80ms, background 140ms, box-shadow 140ms;
  box-shadow: 0 0 0 0 var(--accent-soft);
}
.primary-action:hover {
  background: var(--accent-pressed);
  border-color: var(--accent-pressed);
  box-shadow: 0 0 0 5px var(--accent-soft);
}
.primary-action:active { transform: scale(0.97); }

.hero-action {
  height: 48px;
  padding: 0 24px;
  font-size: 14px;
}

.ghost-button {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 140ms;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ghost-button:hover { color: var(--text); border-color: var(--hairline-strong); background: var(--surface); }

button:focus-visible,
.preset:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ──────────────────────────────────── Tooltip + Fine editor */

.handle-tooltip {
  position: absolute;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  background: var(--tooltip-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.5);
}
.handle-tooltip::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px; height: 8px;
  background: var(--tooltip-bg);
  border-right: 1px solid var(--hairline-strong);
  border-bottom: 1px solid var(--hairline-strong);
}

.fine-editor {
  position: absolute;
  z-index: 8;
  width: 220px;
  padding: 14px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  background: var(--tooltip-bg);
  color: var(--text);
  box-shadow: var(--shadow-popover);
  transform: translate(-50%, calc(-100% - 22px));
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}
.fine-editor label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.fine-editor input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-xs);
  padding: 0 12px;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.handle-guide {
  position: absolute;
  right: 28px;
  bottom: 168px;
  z-index: 8;
  width: 260px;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  background: var(--tooltip-bg);
  color: var(--text-secondary);
  box-shadow: var(--shadow-popover);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}
.handle-guide strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.handle-guide span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 1.35;
}
.handle-guide span::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1.5px var(--accent-soft);
}

/* ──────────────────────────────────── Toolbar selects (sub-nav) */

.toolbar-select {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px 0 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  gap: 6px;
  transition: all 140ms;
}
.toolbar-select:hover { border-color: var(--hairline-strong); color: var(--text); }
.toolbar-select > span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.toolbar-select select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 12px;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-sans);
}
.toolbar-select::after {
  content: "▾";
  color: var(--text-faint);
  font-size: 10px;
  margin-left: 2px;
}

/* ──────────────────────────────────── Export popover */

.export-popover {
  position: absolute;
  z-index: 50;
  top: 60px;
  right: 20px;
  width: 380px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--popover-bg);
  color: var(--text);
  box-shadow: var(--shadow-popover);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}
.export-popover.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--hairline-soft);
}
.popover-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}
.popover-title {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0;
}
.popover-close {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease, opacity 120ms ease;
}
.popover-close::before,
.popover-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
}
.popover-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.popover-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.popover-close:hover {
  border-color: var(--hairline-strong);
  background: var(--surface-2);
  color: var(--text);
}
.popover-close[disabled] {
  opacity: 0.45;
  cursor: progress;
}

.popover-body { padding: 16px 18px; display: grid; gap: 18px; }

.popover-section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.popover-section-label .hint {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: none;
}

.res-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--ink);
}
.res-grid .res-cell {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  height: 56px;
  padding: 6px 0 8px;
  border-radius: 7px;
  cursor: pointer;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  transition: all 120ms;
}
.res-grid .res-cell:hover { color: var(--text); background: var(--hairline-soft); }
.res-grid .res-cell.is-selected {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.res-grid .res-cell .res-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}
.res-grid .res-cell .res-tri {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}
.res-grid .res-cell.is-selected .res-tri { color: var(--accent); }

.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.format-card {
  appearance: none;
  text-align: left;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--text);
  padding: 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  display: grid;
  gap: 6px;
  transition: all 140ms;
}
.format-card:hover { border-color: var(--hairline-strong); background: var(--surface-2); }
.format-card[disabled],
.format-card[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.48;
}
.format-card[disabled]:hover,
.format-card[aria-disabled="true"]:hover {
  border-color: var(--hairline);
  background: var(--surface);
}
.format-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.format-card .fmt-name {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.format-card .fmt-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.popover-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 12px 0 4px;
  border-top: 1px solid var(--hairline-soft);
}
.popover-summary .stat { display: grid; gap: 2px; }
.popover-summary .stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}
.popover-summary .stat-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text);
}

.popover-footer {
  padding: 12px 18px 14px;
  border-top: 1px solid var(--hairline-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.export-popover .primary-action { height: 36px; padding: 0 20px; }
.export-popover .primary-action[disabled] {
  opacity: 0.72;
  cursor: progress;
  transform: none;
}
.popover-footer .filename {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.export-status {
  margin-left: auto;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* dim background when open */
.export-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: transparent;
  pointer-events: none;
}
.export-scrim.is-open { pointer-events: auto; }

/* ──────────────────────────────────── Tweaks panel host overrides */

.tweaks-toggle-shim { display: none; }

/* ──────────────────────────────────── Responsive */

@media (max-width: 1100px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-top: 72px;
  }
  .hero-copy { justify-items: center; text-align: center; }
  .hero h1 { font-size: clamp(56px, 10vw, 92px); }
  .lead { margin-inline: auto; }
  .hero-product { min-height: 430px; }
  .product-window { width: min(100%, 620px); }
  .concept-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .concept-strip article:nth-child(2) { border-right: 0; }
  .concept-strip article:nth-child(-n + 2) { border-bottom: 1px solid var(--hairline); }
  .workflow-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .output-section { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .editor-panel { width: calc(100% - 32px); }
}

@media (max-width: 760px) {
  .global-nav { gap: 16px; padding: 0 16px; }
  .nav-link { display: none; }
  .nav-crumbs { display: none; }
  .theme-button { padding: 0 7px; }
  .mobile-only { display: block; }
  .hero {
    min-height: auto;
    padding: 58px 0 44px;
    gap: 28px;
  }
  .lp-section { width: min(100% - 32px, 1180px); }
  .hero-copy { gap: 18px; }
  .hero h1 {
    font-size: 58px;
    line-height: 1.02;
  }
  .landing h2 { font-size: 38px; }
  .lead {
    max-width: 520px;
    font-size: 16px;
    line-height: 1.65;
  }
  .hero-actions { justify-content: center; }
  .hero-action { margin-top: 0; }
  .hero-product { min-height: 360px; width: 100%; }
  .product-window { border-radius: 22px; }
  .keycap-render { inset: 64px 36px 70px; transform: perspective(780px) rotateX(58deg) rotateZ(-36deg) scale(0.82); }
  .orbit-ring { width: 310px; height: 188px; }
  .orbit-hint { right: 18px; bottom: 82px; }
  .handle-a { left: 126px; top: 132px; }
  .handle-b { right: 88px; top: 194px; }
  .handle-c { left: 112px; bottom: 132px; }
  .floating-spec { min-width: 112px; padding: 10px 12px; }
  .spec-a { left: 16px; top: 70px; }
  .spec-b { right: 12px; top: 160px; }
  .spec-c { left: 24px; bottom: 30px; }
  .concept-strip { grid-template-columns: 1fr; }
  .concept-strip article {
    min-height: 136px;
    padding: 22px 24px 24px;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
  }
  .problem-section { padding: 76px 0; }
  .problem-section p { font-size: 16px; }
  .section-heading { align-items: start; flex-direction: column; }
  .workflow-section { padding: 64px 0 76px; }
  .workflow-grid { grid-template-columns: 1fr; }
  .workflow-card { min-height: 180px; }
  .output-section { padding: 72px 0; gap: 28px; }
  .spec-grid { grid-template-columns: 1fr; }
  .final-cta { padding: 84px 0 96px; }
  .sub-nav { padding: 0 14px; }
  .sub-nav .meta { display: none; }
  .preview-resolution-tabs { display: none; }
  .preview-resolution-menu { display: inline-flex; }
  .editor-tabs {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    scroll-padding-inline: 14px;
    mask-image: linear-gradient(90deg, transparent 0, black 18px, black calc(100% - 18px), transparent 100%);
  }
  .editor-tabs::-webkit-scrollbar { display: none; }
  .tab-section-label,
  .tab-spacer {
    flex: 0 0 auto;
  }
  .handle-legend {
    flex: 0 0 auto;
    margin-left: 8px;
  }
  .tab { flex: 0 0 auto; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-control-row { grid-template-columns: minmax(0, 1fr) 58px; }
  .stage-status { left: 14px; top: 16px; }
  .view-controls { right: 14px; top: 16px; }
  .editor-panel {
    width: calc(100% - 16px);
    bottom: 10px;
    max-height: min(54vh, 430px);
    border-radius: var(--r-md);
  }
  .control-panel { padding: 14px; }
  .handle-guide {
    right: 14px;
    bottom: 174px;
    width: min(260px, calc(100% - 28px));
  }
  .export-scrim.is-open {
    background: rgb(0 0 0 / 0.42);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
  }
  .export-popover {
    top: auto;
    left: 14px;
    right: 14px;
    bottom: 12px;
    width: auto;
    max-height: calc(100dvh - 92px);
    overflow-y: auto;
    border-radius: var(--r-md);
    transform: translateY(14px);
  }
  .export-popover.is-open { transform: translateY(0); }
}

@media (max-width: 520px) {
  .sub-nav .brand { display: none; }
  .export-actions { width: 100%; justify-content: flex-end; min-width: 0; }
  .preview-resolution-menu { max-width: 132px; }
  .preview-resolution-menu span { display: none; }
  .preview-resolution-menu select { min-width: 94px; }
  #downloadTop { padding: 0 13px; }
  .hero h1 { font-size: 38px; letter-spacing: -0.025em; max-width: 100%; }
  .landing h2 { font-size: 32px; }
  .lead { width: min(100%, 300px); max-width: 300px; font-size: 14px; line-height: 1.7; word-break: break-all; }
  .hero-copy { width: 100%; overflow: hidden; }
  .hero-actions { width: 100%; }
  .hero-actions > * { width: 100%; }
  .hero-product { min-height: 310px; overflow: hidden; }
  .product-window { width: 100%; }
  .window-topbar em { display: none; }
  .keycap-render { transform: perspective(720px) rotateX(58deg) rotateZ(-36deg) scale(0.58); }
  .orbit-ring { width: 248px; height: 150px; }
  .orbit-hint { right: 12px; bottom: 82px; font-size: 9px; }
  .mock-handle em { display: none; }
  .handle-a { left: 114px; top: 128px; }
  .handle-b { right: 94px; top: 178px; }
  .handle-c { left: 106px; bottom: 122px; }
  .floating-spec { min-width: auto; padding: 9px 11px; }
  .spec-a { left: 14px; top: 70px; }
  .spec-b { display: none; }
  .spec-c { left: 24px; bottom: 30px; }
  .concept-strip article { min-height: 124px; }
  .workflow-card,
  .spec-grid div { padding: 18px; }
  .field-grid { grid-template-columns: 1fr; }
  .field { padding: 9px; }
}
