/* The lab's shell: one toolbar and the two frames. The mock app is app.css. */

:root {
  color-scheme: light dark;
  --bg: #f6f6f5;
  --surface: #ffffff;
  --line: rgb(0 0 0 / .08);
  --line-strong: rgb(0 0 0 / .13);
  --text: #1a1a1e;
  --text-2: #55555e;
  --muted: #71717a;
  --hover: rgb(0 0 0 / .04);
  --accent: #5e5ed6;
  --on-accent: #ffffff;
  --naive: #d9734a;
  --tuned: #3fa37a;
  --frame-shadow: 0 0 0 1px rgb(0 0 0 / .06), 0 1px 2px rgb(0 0 0 / .04), 0 12px 32px -8px rgb(0 0 0 / .08);
  --pop-shadow: 0 0 0 1px rgb(0 0 0 / .06), 0 16px 40px rgb(0 0 0 / .12);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bar: 56px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);   /* strong ease-out for anything entering */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --surface: #121214;
    --line: rgb(255 255 255 / .07);
    --line-strong: rgb(255 255 255 / .12);
    --text: #ececef;
    --text-2: #a7a7b0;
    --muted: #8a8a93;
    --hover: rgb(255 255 255 / .05);
    --accent: #7373f0;
    --frame-shadow: 0 0 0 1px rgb(255 255 255 / .07), 0 16px 40px -12px rgb(0 0 0 / .6);
    --pop-shadow: 0 0 0 1px rgb(255 255 255 / .08), 0 16px 40px rgb(0 0 0 / .55);
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13.5px/1.5 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
button, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
kbd { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; font: 500 11px/1 var(--font); color: var(--text-2); border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); }

/* ---------- toolbar ---------- */

.bar { display: flex; align-items: center; gap: 16px; height: var(--bar); padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; letter-spacing: -.01em; margin-right: 4px; white-space: nowrap; }
.brand-mark { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: var(--accent); }
.brand-mark svg { width: 15px; height: 15px; fill: none; stroke: var(--on-accent); stroke-width: 1.9; stroke-linecap: round; }
.bar-end { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.seg { display: inline-flex; gap: 1px; margin: 0; padding: 2px; border: 0; border-radius: 8px; background: var(--hover); box-shadow: inset 0 0 0 1px var(--line); }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: block; padding: 4px 11px; border-radius: 6px; font-weight: 500; color: var(--muted); white-space: nowrap; transition: color 120ms, transform 160ms var(--ease-out); }
.seg label:active span { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .seg label:hover span { color: var(--text-2); } }
.seg input:checked + span { color: var(--text); background: var(--surface); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(0 0 0 / .06); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; border-radius: 7px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background 120ms, color 120ms, transform 160ms var(--ease-out); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .pick:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-quiet { background: transparent; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }
@media (hover: hover) and (pointer: fine) { .btn-quiet:hover { background: var(--hover); color: var(--text); } }
.btn-quiet[aria-pressed="true"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn-icon { width: 30px; padding: 0; justify-content: center; }
.btn-primary { background: var(--accent); color: var(--on-accent); padding: 0 12px 0 10px; }
@media (hover: hover) and (pointer: fine) { .btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); } }
.btn-primary .i { fill: currentColor; stroke-width: 1.2; }
.btn-primary.is-playing { background: var(--text); color: var(--surface); }

.pick { position: relative; display: inline-flex; align-items: center; height: 30px; border-radius: 7px; box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); }
@media (hover: hover) and (pointer: fine) { .pick:hover { background: var(--hover); } }
.pick-label { padding-left: 10px; color: var(--muted); pointer-events: none; }
.pick select { appearance: none; height: 100%; padding: 0 28px 0 6px; border: 0; background: transparent; color: var(--text); font-weight: 500; cursor: pointer; outline: 0; }
.pick .i { position: absolute; right: 8px; width: 13px; height: 13px; color: var(--muted); pointer-events: none; }

/* ---------- guide ---------- */

.guide { position: fixed; inset: calc(var(--bar) + 4px) 16px auto auto; width: min(380px, calc(100vw - 32px)); max-height: calc(100dvh - var(--bar) - 24px); overflow: auto; margin: 0; padding: 18px 20px 16px; border: 0; border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--pop-shadow); }
.guide h2 { margin: 0 0 6px; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.guide h3 { margin: 18px 0 8px; font-size: 12px; font-weight: 500; color: var(--muted); }
.guide p { margin: 0; color: var(--text-2); line-height: 1.6; }
.guide b { color: var(--text); font-weight: 500; }
.guide ol { margin: 0; padding: 0; list-style: none; counter-reset: t; display: grid; gap: 10px; color: var(--text-2); line-height: 1.55; }
.guide li { counter-increment: t; position: relative; padding-left: 28px; }
.guide li::before { content: counter(t); position: absolute; left: 0; top: 1px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 5px; background: var(--hover); color: var(--muted); font-size: 11px; font-weight: 500; }
.guide kbd { vertical-align: 1px; }
.guide-note { font-size: 12.5px; }
.guide { transform-origin: top right; }
/* Grows from the Guide button; a transition, so a quick second click retargets it. Leaving
   is instant: nothing to wait for on the way out. Reduced motion keeps only the fade. */
.guide:popover-open { transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out); }
@starting-style { .guide:popover-open { opacity: 0; transform: scale(0.97); } }
@media (prefers-reduced-motion: reduce) {
  .guide:popover-open { transition: opacity 120ms ease; }
  @starting-style { .guide:popover-open { opacity: 0; transform: none; } }
}

/* ---------- stage ---------- */

.stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 0 16px 16px; }
.stage[data-view="both"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.side { display: flex; flex-direction: column; min-width: 0; }
.side-head { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 4px; }
.side-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 600; }
.side-head h2::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); }
.side[data-side="naive"] { --dot: var(--naive); }
.side[data-side="tuned"] { --dot: var(--tuned); }
.side-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.side-keys { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--accent); opacity: 0; transition: opacity 140ms; }
.side-keys::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.side.has-keys .side-keys { opacity: 1; }
.side iframe { display: block; width: 100%; height: max(560px, calc(100dvh - var(--bar) - 30px - 16px)); border: 0; border-radius: 12px; background: var(--surface); box-shadow: var(--frame-shadow); transition: box-shadow 140ms; }
.side.has-keys iframe { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent), 0 12px 32px -8px rgb(0 0 0 / .1); }

@media (max-width: 1100px) {
  .bar { flex-wrap: wrap; height: auto; padding: 12px 16px; row-gap: 10px; }
  .bar-end { margin-left: 0; flex-wrap: wrap; }
  .guide { inset: 60px 16px auto auto; }
}
@media (max-width: 900px) {
  .stage[data-view="both"] { grid-template-columns: minmax(0, 1fr); }
  .side iframe { height: 640px; }
}
@media (max-width: 560px) {
  .seg-type { order: 3; width: 100%; overflow-x: auto; }
  .seg-type span { padding: 4px 9px; }
  #fail { display: none; }
  .brand { flex: 1; }
}
