/* Base: colours and type (tokens), reset, buttons and inputs, menus, tabs, empty states, banners, toasts, dialogs.
   Visual language: docs/design.md. Files load in this order: base, layout, browse, player, speaker,
   onboarding, settings, mobile (mobile last, so its overrides win). */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #0A0A0C;
  --surface: #141418;
  --raised: #1C1C22;
  --raised-2: #24242C;
  --line: #2A2A32;
  --text: #F4F4F6;
  --text-2: #A1A1AA;
  --text-3: #6B6B76;
  --accent: #FF6B4A;
  --accent-2: #FF8A5B;
  --accent-ink: #160A06;
  --teal: #2DD4BF;
  --gold: #F5C451;
  --warn: #F5A524;
  --danger: #F2555A;
  --radius: 12px;
  --radius-sm: 6px;
  --bar-h: 88px;
  --side-w: 288px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--raised); padding: 2px 6px; border-radius: 4px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.block { display: block; }
.center { text-align: center; }
.error { color: var(--danger); }
.strong { font-weight: 600; color: var(--text); }
.icon { flex: none; display: block; }
.flip { transform: scaleX(-1); }
.rot { transform: rotate(-90deg); }
#root { height: 100%; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 999px; background: var(--raised); border: 1px solid var(--line); color: var(--text);
  font-weight: 600; font-size: 14px; transition: background .15s, transform .15s var(--ease), border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--raised-2); border-color: #3a3a44; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--raised); color: var(--text); }
.btn-danger { color: var(--danger); }
.btn-on { border-color: var(--accent); color: var(--accent); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn-lg { height: 48px; padding: 0 26px; font-size: 15px; width: 100%; justify-content: center; }
.btn-play { height: 48px; padding: 0 26px; font-size: 15px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px;
  color: var(--text-2); transition: color .15s, background .15s, transform .15s var(--ease); position: relative; flex: none;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.on { color: var(--accent); }
.icon-btn.round { border: 1px solid var(--line); width: 32px; height: 32px; }
.icon-btn.big { width: 48px; height: 48px; }
.heart.on { color: var(--accent); }

.input {
  height: 44px; width: 100%; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; transition: border-color .15s, background .15s;
}
.input:focus { outline: none; border-color: var(--accent); background: var(--raised); }
.input-lg { height: 54px; font-size: 18px; text-align: center; font-weight: 600; }
.code-input { letter-spacing: .2em; font-weight: 700; text-transform: uppercase; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 500; }

.range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 16px; background: transparent; cursor: pointer; margin: 0;
  --pct: 0%;
}
.range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(to right, var(--text) var(--pct), rgba(255,255,255,.18) var(--pct));
}
.range::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,.18); }
.range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--text); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: #fff; opacity: 0; transition: opacity .15s; }
.range::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; opacity: 0; }
.range:hover::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--accent) var(--pct), rgba(255,255,255,.18) var(--pct)); }
.range:hover::-webkit-slider-thumb, .range:focus-visible::-webkit-slider-thumb { opacity: 1; }
.range:hover::-moz-range-thumb { opacity: 1; }
.range:hover::-moz-range-progress { background: var(--accent); }
.range:disabled { opacity: .4; cursor: default; }

.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; font-size: 10px; font-weight: 800; letter-spacing: .06em; vertical-align: middle; }
.badge-lossless { color: var(--teal); background: rgba(45,212,191,.12); }
.badge-max { color: var(--gold); background: rgba(245,196,81,.14); }
.badge-lg { height: 24px; font-size: 12px; padding: 0 8px; }
.explicit { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 3px; background: var(--text-3); color: var(--bg); font-size: 10px; font-weight: 800; margin-right: 6px; vertical-align: -2px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: rgba(255,255,255,.08); font-size: 12px; font-weight: 600; color: var(--text); text-transform: capitalize; margin-right: 6px; }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; letter-spacing: .02em; box-shadow: 0 0 0 2px var(--bg); }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- menu ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 60; min-width: 230px; padding: 6px;
  background: var(--raised-2); border: 1px solid #34343e; border-radius: 10px; box-shadow: 0 16px 40px rgba(0,0,0,.55);
  animation: pop .14s var(--ease);
}
.menu.up { top: auto; bottom: calc(100% + 4px); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; padding: 0 12px; border-radius: 6px; font-size: 14px; font-weight: 500; text-align: left; }
.menu-item:hover { background: rgba(255,255,255,.08); }
.menu-item .icon { color: var(--text-2); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
/* The menu sheet (phones; a right click on a computer opens it in the middle) */
.sheet-backdrop { position: fixed; inset: 0; z-index: 86; display: grid; place-items: center; background: rgba(0,0,0,.55); animation: fade .15s; }
.sheet { width: min(360px, calc(100vw - 32px)); max-height: 80vh; overflow-y: auto; padding: 8px; background: var(--raised-2); border: 1px solid #34343e; border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.55); animation: pop .14s var(--ease); }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 6px 8px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.sheet-head .sheet-art { width: 48px; height: 48px; aspect-ratio: 1; border-radius: 6px; flex: none; }
.sheet-title { min-width: 0; }
.sheet-title .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- tabs, segmented ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tab { flex: none; padding: 8px 16px; border-radius: 999px; background: var(--raised); font-size: 14px; font-weight: 600; transition: background .15s, color .15s; }
.tab:hover { text-decoration: none; background: var(--raised-2); }
.tab.on { background: var(--text); color: var(--bg); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin: 20px 0; }
.segmented button { height: 38px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.segmented button.on { background: var(--raised-2); color: var(--text); }

/* ---------- empty, skeleton ---------- */
.empty { display: grid; justify-items: center; gap: 8px; padding: 48px 20px; text-align: center; }
.empty-title { font-size: 18px; font-weight: 700; margin: 0; }
.empty p { margin: 0; }
.card-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; max-width: 520px; margin: 24px auto; padding: 32px; justify-items: stretch; text-align: left; }
.skel { background: linear-gradient(90deg, var(--surface) 0, var(--raised) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-title { height: 22px; width: 220px; margin-bottom: 14px; }
.skel-art { aspect-ratio: 1; margin-bottom: 10px; }
.skel-line { height: 12px; margin: 6px 0; width: 80%; }
.skel-line.short { width: 50%; }
.skel-thumb { width: 44px; height: 44px; }

/* ---------- banners & toasts ---------- */
.start-overlay { position: fixed; inset: 0; z-index: 88; display: grid; place-items: center; padding: 20px; background: rgba(10,10,12,.82); backdrop-filter: blur(8px); animation: fade .2s; }
.start-card { width: min(420px, 100%); display: grid; justify-items: center; gap: 10px; text-align: center; padding: 36px 32px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.start-card h2 { margin: 6px 0 0; font-size: 26px; letter-spacing: -.02em; }
.start-card p { margin: 0; }
.start-card .btn-lg { margin: 14px 0 6px; width: auto; }
.start-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: rgba(255,107,74,.12); color: var(--accent); }
.update-banner { position: sticky; top: 0; z-index: 22; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 9px 20px; background: var(--raised-2); border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.offline-banner { position: sticky; top: 0; z-index: 21; padding: 8px 20px; background: var(--raised-2); color: var(--warn); font-size: 13px; font-weight: 600; text-align: center; }
.toasts { position: fixed; left: 50%; bottom: calc(var(--bar-h) + 16px); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { padding: 11px 18px; border-radius: 10px; background: #f4f4f6; color: #111; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: toast .25s var(--ease); }
.toast-error { background: #3b1416; color: #ffd5d6; border: 1px solid #6b2226; }
@keyframes toast { from { transform: translateY(10px); opacity: 0; } }

/* ---------- dialogs ---------- */
.dialog-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); animation: fade .2s; }
.dialog { position: relative; width: min(460px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 32px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: pop .2s var(--ease); }
.dialog-wide { width: min(720px, 100%); }
.dialog-close { position: absolute; top: 14px; right: 14px; }
.dialog-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; text-align: center; margin: 4px 0 6px; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.mode-card { position: relative; display: grid; justify-items: center; gap: 8px; padding: 22px 20px 24px; border-radius: 16px; background: var(--raised); border: 1px solid var(--line); text-align: center; transition: border-color .2s, transform .2s var(--ease), background .2s; }
.mode-card:hover { border-color: var(--accent); transform: translateY(-2px); background: var(--raised-2); }
.mode-card.current { border-color: rgba(255,107,74,.6); }
.mode-art { width: 100%; max-width: 230px; height: auto; margin-bottom: 4px; }
.mode-name { font-size: 20px; font-weight: 800; }
.mode-desc { color: var(--text-2); font-size: 14px; max-width: 250px; }
.mode-tag { position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 700; color: var(--accent); background: rgba(255,107,74,.12); padding: 3px 8px; border-radius: 999px; }
.wave { animation: wave 1.8s ease-in-out infinite; }
.wave.w2 { animation-delay: .3s; } .wave.w3 { animation-delay: .6s; }
@keyframes wave { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.stack { display: grid; gap: 14px; }
.stack.narrow { max-width: 360px; margin: 20px auto 0; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; }
.row-gap { display: flex; align-items: center; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.chip:hover { border-color: var(--accent); }
