@font-face {
  font-family: "Schibsted Grotesk";
  src: url("./fonts/schibsted-grotesk-latin.woff2") format("woff2");
  font-weight: 400 800; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  color-scheme: light dark;
  --bg: oklch(0.972 0.003 285);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.948 0.004 285);
  --surface-3: oklch(0.915 0.005 285);
  --text: oklch(0.21 0.008 285);
  --muted: oklch(0.47 0.01 285);
  --line: oklch(0.21 0.008 285 / 0.1);
  --line-strong: oklch(0.21 0.008 285 / 0.22);
  --accent: oklch(0.66 0.17 44);
  --accent-deep: oklch(0.56 0.17 40);
  --accent-ink: oklch(0.52 0.15 42);
  --ok: oklch(0.5 0.13 150);
  --ok-bg: oklch(0.5 0.13 150 / 0.12);
  --warn: oklch(0.62 0.15 70);
  --danger: oklch(0.53 0.19 27);
  --focus: oklch(0.55 0.16 42);
  --bar-bg: oklch(0.972 0.003 285 / 0.72);
  --shadow: 0 1px 2px oklch(0.2 0.01 285 / 0.06), 0 0 0 0.5px var(--line);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --r-control: 11px;
  --r-surface: 16px;
  --r-pill: 999px;
  --radius: var(--r-surface);
  font: 100%/1.5 "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-optical-sizing: auto;
  color: var(--text); background: var(--bg);
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.155 0.004 285);
    --surface: oklch(0.205 0.005 285);
    --surface-2: oklch(0.25 0.006 285);
    --surface-3: oklch(0.3 0.007 285);
    --text: oklch(0.965 0.003 285);
    --muted: oklch(0.73 0.008 285);
    --line: oklch(1 0 0 / 0.09);
    --line-strong: oklch(1 0 0 / 0.2);
    --accent-ink: oklch(0.76 0.13 48);
    --ok: oklch(0.78 0.14 150);
    --ok-bg: oklch(0.78 0.14 150 / 0.14);
    --danger: oklch(0.72 0.16 25);
    --focus: oklch(0.76 0.13 48);
    --bar-bg: oklch(0.155 0.004 285 / 0.7);
    --shadow: 0 0 0 0.5px var(--line), 0 1px 0 oklch(1 0 0 / 0.04) inset;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { overscroll-behavior-y: none; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
code { font: 0.86em/1.4 ui-monospace, "SF Mono", Menlo, monospace; overflow-wrap: anywhere; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Top bar */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  padding: calc(0.7rem + env(safe-area-inset-top, 0px)) max(1.25rem, calc((100% - 1040px) / 2), env(safe-area-inset-right, 0px)) 0.7rem max(1.25rem, calc((100% - 1040px) / 2), env(safe-area-inset-left, 0px));
  background: var(--bar-bg);
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 0.5px 0 var(--line);
}
.brand { justify-self: start; display: inline-flex; align-items: center; gap: 0.55rem; color: var(--text); text-decoration: none; font-weight: 650; font-size: 1.02rem; letter-spacing: -0.015em; }
.brand img { border-radius: 7px; }
.segmented {
  position: relative; display: inline-flex; padding: 3px; border-radius: var(--r-pill);
  background: var(--surface-2); box-shadow: inset 0 0 0 0.5px var(--line); isolation: isolate;
}
.seg-thumb {
  position: absolute; inset: 3px; z-index: 0; border-radius: var(--r-pill);
  background: var(--surface); box-shadow: 0 1px 3px oklch(0 0 0 / 0.12), 0 0 0 0.5px var(--line);
  transition: clip-path 280ms var(--ease-drawer); pointer-events: none; will-change: clip-path;
}
.segmented a {
  position: relative; z-index: 1; display: inline-flex; align-items: center; min-height: 2rem; padding: 0 0.95rem; border-radius: var(--r-pill);
  color: var(--muted); text-decoration: none; font-size: 0.85rem; font-weight: 590; white-space: nowrap;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: color 200ms var(--ease-out), transform 140ms var(--ease-out);
}
.segmented a[aria-current] { color: var(--text); }

/* Shared */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0 1.15rem; border: 0; border-radius: var(--r-control);
  font-weight: 600; font-size: 0.92rem; text-decoration: none; cursor: pointer; white-space: nowrap;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, opacity 160ms ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-secondary { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 0.5px var(--line); }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--danger) 40%, transparent); }
.btn-ghost-danger { background: transparent; color: var(--danger); }
.btn-small { min-height: 2.1rem; padding: 0 0.85rem; font-size: 0.84rem; }
.tag { display: inline-flex; align-items: center; gap: 0.3rem; min-height: 1.5rem; padding: 0 0.6rem; border-radius: var(--r-pill); font-size: 0.75rem; font-weight: 620; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.meta { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; min-height: 1.25rem; }
.code { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; flex: none; border-radius: var(--r-control); background: var(--surface-2); box-shadow: inset 0 0 0 0.5px var(--line); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em; }
.progress { position: relative; height: 5px; border-radius: var(--r-pill); overflow: hidden; background: var(--surface-3); }
.progress span { position: absolute; inset: 0; background: var(--accent); border-radius: inherit; transform: scaleX(0); transform-origin: left; will-change: transform; }
.progress.indeterminate span { right: auto; width: 32%; animation: slide 1.3s var(--ease-in-out) infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(320%); } }
.drop {
  display: flex; align-items: center; gap: 0.9rem; padding: 0.95rem 1.05rem; border-radius: var(--r-control);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--text); cursor: pointer; transition: background-color 160ms ease, box-shadow 160ms ease, transform 140ms var(--ease-out);
}
.drop svg { flex: none; color: var(--accent-ink); }
.drop > span { display: flex; flex-direction: column; min-width: 0; }
.drop strong { font-weight: 600; font-size: 0.93rem; overflow-wrap: anywhere; }
.drop-hint { color: var(--muted); font-size: 0.8rem; }
.drop:active { transform: scale(0.99); }
.drop[data-over], .drop:has(+ input:focus-visible) { box-shadow: inset 0 0 0 1.5px var(--accent); background: color-mix(in oklch, var(--accent) 7%, var(--surface-2)); }
.drop:has(+ input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }

/* Listen */
.simple { max-width: 29rem; margin: 0 auto; padding: 0 1.25rem calc(2rem + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 1.25rem; }
.stage { display: flex; flex-direction: column; align-items: center; padding: clamp(2.75rem, 11vh, 6rem) 0 0.5rem; }

/* Compact resting stage while first-run setup card is active */
.simple[data-setup="true"] .stage { padding: clamp(1.25rem, 5vh, 2.5rem) 0 0.25rem; }
.simple[data-setup="true"] .mic { width: 108px; height: 108px; }
.simple[data-setup="true"] .listen-status, .simple[data-setup="true"] .listen-hint { display: none; }

.mic {
  position: relative; width: 224px; height: 224px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; display: grid; place-items: center;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform 180ms var(--ease-out);
}
.orb-canvas { width: 100%; height: 100%; display: block; pointer-events: none; }
.mic:active:not(:disabled) { transform: scale(0.95); transition-duration: 100ms; }
.mic:disabled { cursor: default; }
.mic:focus-visible { outline: 2px solid var(--focus); outline-offset: 6px; }

.listen-status { margin-top: 0.9rem; font-size: 1.32rem; font-weight: 650; letter-spacing: -0.02em; text-align: center; min-height: 1.95rem; font-variant-numeric: tabular-nums; }
.listen-hint { margin-top: 0.35rem; font-size: 0.88rem; color: var(--muted); text-align: center; animation: rise 240ms var(--ease-out); }
.listen-hint a { color: var(--text); text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; font-weight: 560; }

/* Setup */
.prep {
  padding: 1.35rem; display: flex; flex-direction: column; gap: 1rem;
  animation: rise 320ms var(--ease-drawer);
}
.prep-head { display: flex; flex-direction: column; gap: 0.3rem; }
.prep h2 { font-size: 1.15rem; font-weight: 680; letter-spacing: -0.02em; }
.prep-detail { color: var(--muted); font-size: 0.9rem; line-height: 1.45; text-wrap: pretty; }
.prep-library {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem 0.85rem; border-radius: var(--r-control);
  background: var(--surface-2); box-shadow: inset 0 0 0 0.5px var(--line);
}
.prep-library .code {
  width: 2.1rem; height: 2.1rem; border-radius: 8px;
  background: color-mix(in oklch, var(--accent) 14%, var(--surface));
  color: var(--accent-ink); box-shadow: none; font-size: 0.72rem;
}
.prep-library-name { font-weight: 620; font-size: 0.94rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prep-size { font-size: 0.86rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.prep-size[data-loading="true"] {
  width: 4.2rem; height: 0.9rem; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface) 50%, var(--surface-3) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.prep-progress-wrap { display: flex; flex-direction: column; gap: 0.45rem; }
.prep-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; font-size: 0.85rem; }
.prep-progress-label { font-weight: 580; color: var(--text); }
.prep-pct { font-weight: 660; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.prep-btn { width: 100%; min-height: 2.95rem; font-size: 0.95rem; }
.model-drop { margin: 0; }

/* Ready extras */
.extras { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; text-align: center; color: var(--muted); font-size: 0.92rem; margin-top: -0.35rem; }
.try { max-width: 34ch; line-height: 1.5; text-wrap: balance; }
.try a { color: var(--text); text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; font-weight: 560; transition: color 150ms ease; }
.how { width: 100%; max-width: 24rem; }
.how summary {
  cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.75rem; border-radius: var(--r-pill); font-size: 0.82rem; font-weight: 560;
  color: var(--muted); background: var(--surface); box-shadow: var(--shadow);
  list-style: none; user-select: none; -webkit-user-select: none;
  transition: color 150ms ease, background-color 150ms ease;
}
.how summary::-webkit-details-marker { display: none; }
.how summary svg { transition: transform 240ms var(--ease-drawer); }
.how[open] summary svg { transform: rotate(180deg); }
.how ol {
  margin: 0.65rem 0 0; padding: 0.95rem 1.1rem 0.95rem 2.1rem; text-align: left;
  display: grid; gap: 0.4rem; font-size: 0.84rem; line-height: 1.45;
  background: var(--surface); border-radius: var(--r-control); box-shadow: var(--shadow);
}

/* Footer */
.foot {
  width: 100%; margin-top: auto; border-top: 0.5px solid var(--line);
  padding: 1.15rem max(1.25rem, calc((100% - 1040px) / 2), env(safe-area-inset-right, 0px)) calc(1.35rem + env(safe-area-inset-bottom, 0px)) max(1.25rem, calc((100% - 1040px) / 2), env(safe-area-inset-left, 0px));
  color: var(--muted); font-size: 0.78rem;
}
.foot-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; }
.foot-col { display: flex; align-items: center; gap: 0.5rem 0.85rem; flex-wrap: wrap; }
.foot-labs { flex-direction: column; align-items: flex-end; gap: 0.2rem; text-align: right; }
.foot a { color: var(--muted); text-decoration: none; transition: color 150ms ease; }
.foot-labs > p:first-child a { color: var(--text); }
.foot-links { display: inline-flex; flex-wrap: wrap; gap: 0.25rem 0.85rem; }
.foot-install {
  display: inline-flex; align-items: center; min-height: 1.85rem; padding: 0 0.75rem;
  border: 0; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text);
  box-shadow: inset 0 0 0 0.5px var(--line); font-size: 0.76rem; font-weight: 590; cursor: pointer;
  transition: background-color 150ms ease, transform 140ms var(--ease-out);
}
.foot-install:active { transform: scale(0.96); }
.ios-hint { font-size: 0.75rem; }

/* Result */
.result { display: grid; grid-template-columns: auto 1fr; gap: 1rem 1.1rem; align-items: center; padding: 1.25rem; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
.emblem { width: 76px; height: 76px; border-radius: var(--r-control); display: grid; place-items: center; background: linear-gradient(145deg, var(--surface-3), var(--surface-2)); box-shadow: inset 0 0 0 0.5px var(--line); }
.emblem svg { width: 60px; height: 60px; }
.emblem .disc { fill: oklch(0.2 0.006 285); }
.emblem .groove { fill: none; stroke: oklch(1 0 0 / 0.1); stroke-width: 0.8; }
.emblem .label { fill: var(--accent); }
.emblem .hole { fill: oklch(0.2 0.006 285); }
.result-body { min-width: 0; }
.result h2 { font-size: 1.35rem; font-weight: 680; line-height: 1.2; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.artist { margin-top: 0.15rem; font-size: 1rem; font-weight: 520; overflow-wrap: anywhere; }
.album { margin-top: 0.1rem; color: var(--muted); font-size: 0.86rem; overflow-wrap: anywhere; }
.tags { margin-top: 0.6rem; display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.result-link { grid-column: 1 / -1; width: 100%; }
.result.morph h2, .result.morph .artist { will-change: transform; }
.segment { margin-top: 0.3rem; color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.tag-quiet { background: var(--surface-2); color: var(--muted); }

/* History */
.history { margin-top: 0.5rem; }
.history h2 { font-size: 0.95rem; font-weight: 640; letter-spacing: -0.01em; padding: 0 0.25rem 0.5rem; }
.history ol { list-style: none; margin: 0; padding: 0 0.25rem; }
.history li.enter, .lib-list li.enter { animation: rise 280ms var(--ease-out); }
.history li { display: flex; align-items: center; gap: 0.75rem; min-height: 3.5rem; padding: 0.55rem 0; box-shadow: 0 -0.5px 0 var(--line); }
.h-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.h-text strong { font-weight: 590; font-size: 0.93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-text span { color: var(--muted); font-size: 0.83rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history time { color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; flex: none; }
.h-play { flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--surface-2); color: var(--text); transition: transform 140ms var(--ease-out), background-color 160ms ease; }
.h-play:active { transform: scale(0.92); }

/* Library & Debug */
.debug { max-width: 68rem; margin: 0 auto; padding: 2rem max(1.25rem, env(safe-area-inset-right, 0px)) calc(2.5rem + env(safe-area-inset-bottom, 0px)) max(1.25rem, env(safe-area-inset-left, 0px)); }
.debug-head { margin-bottom: 1.5rem; }
.debug h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.025em; }
.lede { margin-top: 0.35rem; color: var(--muted); max-width: 46ch; }
.bento { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.panel { padding: 1.3rem; display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
.panel-libraries { grid-row: span 2; }
.panel-head h2 { font-size: 1.05rem; font-weight: 660; letter-spacing: -0.015em; }
.panel-sub { margin-top: 0.15rem; color: var(--muted); font-size: 0.84rem; }

.lib-list { list-style: none; margin: 0; padding: 0; }
.lib-list li { display: flex; align-items: center; gap: 0.85rem; padding: 0.7rem 0; box-shadow: 0 -0.5px 0 var(--line); }
.lib-list li:first-child { box-shadow: none; }
.lib-list li[data-active] .code { background: var(--ok-bg); color: var(--ok); box-shadow: none; }
.lib-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lib-info strong { font-weight: 600; font-size: 0.93rem; }
.lib-info span { color: var(--muted); font-size: 0.8rem; }
.lib-actions { display: flex; align-items: center; gap: 0.35rem; flex: none; }
.lib-list .empty { color: var(--muted); font-size: 0.88rem; padding: 1rem 0; }
.add-region { display: flex; flex-direction: column; gap: 0.55rem; padding-top: 1rem; box-shadow: 0 -0.5px 0 var(--line); }
.add-region > label, .legend, legend { font-size: 0.8rem; font-weight: 600; color: var(--muted); padding: 0; }
.add-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.add-row select { flex: 1 1 12rem; }
.select { position: relative; display: flex; flex: 1 1 12rem; min-width: 0; }
.select::after { content: ""; position: absolute; right: 1rem; top: 50%; width: 0.45rem; height: 0.45rem; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select select { flex: 1; width: 100%; min-width: 0; padding-right: 2.4rem; }
select, .num {
  appearance: none; -webkit-appearance: none;
  min-height: 2.75rem; padding: 0 0.85rem; border: 0; border-radius: var(--r-control); font-size: max(16px, 0.95rem);
  background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.num { width: 5.5rem; font-variant-numeric: tabular-nums; }
.panel-foot { display: flex; justify-content: flex-end; padding-top: 0.25rem; }

.drop-large { padding: 1.4rem 1.2rem; border-radius: var(--r-control); box-shadow: inset 0 0 0 1px var(--line-strong); }
.drop-large[data-filled] svg { color: var(--ok); }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.9rem 1rem; }
.options > .option:first-child { grid-column: 1 / -1; }
.option { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.pills { position: relative; isolation: isolate; display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--surface-2); box-shadow: inset 0 0 0 0.5px var(--line); width: fit-content; max-width: 100%; }
.pills label { position: relative; z-index: 1; }
.pills input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pills span { display: inline-flex; align-items: center; min-height: 2rem; padding: 0 0.75rem; border-radius: var(--r-pill); font-size: 0.82rem; font-weight: 580; color: var(--muted); white-space: nowrap; transition: color 180ms var(--ease-out), transform 140ms var(--ease-out); }
.pills input:checked + span { color: var(--text); }
.pills input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.pills label:active span, .segmented a:active { transform: scale(0.97); }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0; border-radius: var(--r-control); overflow: hidden; background: var(--line); box-shadow: 0 0 0 0.5px var(--line); }
.metrics > div { background: var(--surface); padding: 0.7rem 0.85rem; min-width: 0; }
.metrics .wide { grid-column: 1 / -1; }
.metrics dt { color: var(--muted); font-size: 0.74rem; font-weight: 600; }
.metrics dd { margin: 0.1rem 0 0; font-weight: 600; font-size: 0.92rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.raw summary { cursor: pointer; font-size: 0.86rem; font-weight: 600; min-height: 2.75rem; display: flex; align-items: center; gap: 0.4rem; list-style: none; }
.raw summary::-webkit-details-marker { display: none; }
.raw summary::before { content: ""; width: 0.45rem; height: 0.45rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 200ms var(--ease-out); }
.raw[open] summary::before { transform: rotate(45deg); }
.raw pre { margin: 0.25rem 0 0; padding: 0.85rem; border-radius: var(--r-control); background: var(--surface-2); font: 0.76rem/1.5 ui-monospace, "SF Mono", Menlo, monospace; max-height: 18rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

.view:not([hidden]) { animation: view-in 220ms var(--ease-out); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

/* Info tips */
.label-row { display: inline-flex; align-items: center; gap: 0.3rem; }
.tip-wrap { display: inline-flex; }
.info {
  position: relative; display: grid; place-items: center; width: 1.375rem; height: 1.375rem; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: help; touch-action: manipulation;
  transition: color 150ms ease, background-color 150ms ease, transform 140ms var(--ease-out);
}
.info::after { content: ""; position: absolute; inset: -0.6rem; }
.info:active { transform: scale(0.92); }
.info[aria-expanded="true"] { color: var(--text); background: var(--surface-2); }
.tip {
  position: fixed; left: 0; top: 0; z-index: 30; width: max-content; max-width: min(17rem, calc(100vw - 1.5rem));
  padding: 0.55rem 0.75rem; border-radius: var(--r-control); background: var(--text); color: var(--bg);
  font-size: 0.8rem; font-weight: 450; line-height: 1.45; letter-spacing: 0; text-align: start; white-space: normal; text-wrap: pretty;
  box-shadow: 0 6px 20px -6px oklch(0 0 0 / 0.35);
  opacity: 0; visibility: hidden; transform: scale(0.97); pointer-events: none;
  transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out), visibility 0s linear 150ms;
}
.info[aria-expanded="true"] + .tip { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.empty-state { display: grid; place-items: center; min-height: 7rem; border-radius: var(--r-control); background: var(--surface-2); color: var(--muted); font-size: 0.9rem; text-align: center; padding: 1rem; }
.m-body { display: flex; flex-direction: column; gap: 0.5rem; }

/* Live leaderboard */
.board { padding: 0.9rem 1rem 0.6rem; animation: rise 320ms var(--ease-drawer); }
.board-title { font-size: 0.78rem; font-weight: 620; color: var(--muted); letter-spacing: 0.01em; margin-bottom: 0.35rem; }
.board[data-state="none"] .board-title { color: var(--text); }
.board-list { position: relative; list-style: none; margin: 0; padding: 0; display: grid; }
.board-list li { display: grid; grid-template-columns: 1.1rem minmax(0, 1fr) auto; grid-template-rows: auto 3px; column-gap: 0.6rem; row-gap: 0.3rem; align-items: center; padding: 0.48rem 0; transition: opacity 220ms var(--ease-out); }
.board-list .rank { grid-row: 1 / 3; color: var(--muted); font-size: 0.78rem; font-weight: 620; font-variant-numeric: tabular-nums; text-align: center; }
.board-list .who { min-width: 0; font-size: 0.88rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-list .who strong { font-weight: 620; }
.board-list .who span { color: var(--muted); }
.board-list .pct { font-size: 0.8rem; font-weight: 640; font-variant-numeric: tabular-nums; color: var(--muted); }
.board-list li:first-child .pct { color: var(--accent-ink); }
.board-list .meter { position: relative; grid-column: 2 / 4; height: 3px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.board-list .meter i { position: absolute; inset: 0; background: var(--line-strong); transform-origin: left center; transform: scaleX(0); transition: transform 480ms cubic-bezier(0.65, 0, 0.35, 1); will-change: transform; }
.board-list li:first-child .meter i { background: var(--accent); }
.board-list li.leaving { position: absolute; pointer-events: none; }
.board[data-state="none"] .board-list { opacity: 0.6; }

@media (hover: hover) and (pointer: fine) {
  .info:hover { color: var(--text); }
  .mic:not(:disabled):hover { transform: scale(1.03); }
  .listen-hint a:hover { color: var(--accent-ink); }
  .btn-primary:not(:disabled):hover { opacity: 0.88; }
  .btn-secondary:not(:disabled):hover { background: var(--surface-3); }
  .btn-danger:not(:disabled):hover, .btn-ghost-danger:not(:disabled):hover { background: color-mix(in oklch, var(--danger) 10%, transparent); }
  .segmented a:not([aria-current]):hover { color: var(--text); }
  .drop:hover { background: var(--surface-3); }
  .h-play:hover { background: var(--surface-3); }
  .pills label:hover span { color: var(--text); }
  .try a:hover { color: var(--accent-ink); }
  .how summary:hover { color: var(--text); background: var(--surface-2); }
  .foot a:hover { color: var(--text); }
  .foot-install:hover { background: var(--surface-3); }
}
@media (pointer: coarse) {
  .segmented a, .pills span, .btn-small { min-height: 44px; }
  .h-play { width: 44px; height: 44px; }
  .info::after { inset: -0.7rem; }
}
@media (max-width: 860px) {
  .bento { grid-template-columns: 1fr; }
  .panel-libraries { grid-row: auto; }
}
@media (max-width: 640px) {
  .bar { grid-template-columns: auto 1fr; row-gap: 0.6rem; }
  .bar .segmented { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .segmented a { flex: 1; justify-content: center; }
  .debug { padding-top: 1.4rem; }
  .panel { padding: 1.1rem; }
  .prep { padding: 1.15rem; }
  .foot-inner { flex-direction: column; align-items: center; text-align: center; gap: 0.85rem; }
  .foot-col { justify-content: center; }
  .foot-labs { align-items: center; text-align: center; }
}
@media (max-width: 360px) {
  .pills span { padding: 0 0.55rem; }
  .simple, .debug { padding-left: max(1rem, env(safe-area-inset-left, 0px)); padding-right: max(1rem, env(safe-area-inset-right, 0px)); }
}
@media (prefers-reduced-transparency: reduce) {
  .bar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --line: var(--line-strong); }
}
