/* ==========================================================================
   Sync — styles
   Warm neutrals, black & white controls, hairline borders. Light and dark.
   ========================================================================== */

:root {
  --bg: #FAF9F5;
  --surface: #FFFFFF;
  --sunken: #F2F0E9;
  --hover: rgba(20, 20, 19, .05);
  --press: rgba(20, 20, 19, .09);
  --line: rgba(20, 20, 19, .09);
  --line-strong: rgba(20, 20, 19, .16);
  --text: #141413;
  --muted: #5F5E5A;
  --faint: #8F8D87;
  --ink: #141413;          /* primary button / play button */
  --on-ink: #FAF9F5;
  --wave-rest: rgba(20, 20, 19, .16);
  --ok: #3B8A5A;
  --warn: #B7791F;
  --bad: #C4553A;
  --shadow: 0 1px 2px rgba(20, 20, 19, .04), 0 8px 24px -12px rgba(20, 20, 19, .12);
  --art-shadow: 0 1px 2px rgba(20, 20, 19, .06), 0 24px 48px -24px rgba(20, 20, 19, .28);
  --backdrop: rgba(20, 20, 19, .28);

  --r-lg: 16px;
  --r: 12px;
  --r-sm: 8px;
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Source Serif 4', ui-serif, Georgia, 'Times New Roman', serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sb: env(safe-area-inset-bottom, 0px);
  --st: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1F1E1D;
  --surface: #262624;
  --sunken: #191918;
  --hover: rgba(250, 249, 245, .06);
  --press: rgba(250, 249, 245, .1);
  --line: rgba(250, 249, 245, .09);
  --line-strong: rgba(250, 249, 245, .17);
  --text: #FAF9F5;
  --muted: #B4B2AB;
  --faint: #7F7D77;
  --ink: #FAF9F5;
  --on-ink: #141413;
  --wave-rest: rgba(250, 249, 245, .17);
  --ok: #6CC08B;
  --warn: #E0A84B;
  --bad: #E07A5F;
  --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 8px 24px -12px rgba(0, 0, 0, .5);
  --art-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 24px 48px -24px rgba(0, 0, 0, .7);
  --backdrop: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--text); color: var(--bg); }

svg.i {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: var(--r-sm); }
.muted { color: var(--muted); }

.scroll { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.scroll::-webkit-scrollbar { width: 10px; }
.scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

/* ------------------------------------------------------------- controls */

.btn {
  height: 44px; padding: 0 18px; border-radius: var(--r);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 500; font-size: 15px; letter-spacing: -.005em; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg.i { width: 18px; height: 18px; }
.btn.primary { background: var(--ink); color: var(--on-ink); }
.btn.primary:hover { opacity: .88; }
.btn.secondary { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.secondary:hover { background: var(--sunken); }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 1.6px solid currentColor; border-color: var(--on-ink) transparent var(--on-ink) var(--on-ink); animation: spin .7s linear infinite;
}
.btn.secondary.busy::after { border-color: var(--text) transparent var(--text) var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm); flex: none;
  display: inline-grid; place-items: center; color: var(--text);
  transition: background-color .15s, color .15s, transform .1s, opacity .15s;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { background: var(--press); transform: scale(.94); }
.icon-btn:disabled { opacity: .3; pointer-events: none; }
.icon-btn.quiet { color: var(--muted); }
.icon-btn.quiet:hover { color: var(--text); }
.icon-btn.quiet.on { color: var(--text); background: var(--hover); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg.i { width: 17px; height: 17px; }
.icon-btn.lg { width: 48px; height: 48px; border-radius: 50%; }
.icon-btn.lg svg.i { width: 24px; height: 24px; }

.chip {
  height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line); transition: all .15s;
}
.chip:hover, .chip.on { color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--surface); }
.chip.on { background: var(--ink); color: var(--on-ink); box-shadow: none; }

.field { display: grid; gap: 8px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--muted); display: flex; justify-content: space-between; }
.field > span b { color: var(--text); font: 500 13px var(--mono); }
.field input:not([type="range"]) {
  height: 44px; padding: 0 14px; border-radius: var(--r); outline: none;
  background: var(--surface); border: 0; box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: box-shadow .15s;
}
.field input:not([type="range"])::placeholder { color: var(--faint); }
.field input:not([type="range"]):focus { box-shadow: inset 0 0 0 1.5px var(--text); }

input[type="range"] { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; width: 100%; height: 20px; background: none; cursor: pointer; --v: 50%; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--text) var(--v), var(--wave-rest) var(--v)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: var(--wave-rest); }
input[type="range"]::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--text); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%; background: var(--ink); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--line-strong); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 2px solid var(--bg); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: var(--r); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.segmented button { height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--muted); transition: all .15s; }
.segmented button svg.i { width: 16px; height: 16px; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, .06); }

.count { margin-left: 6px; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font: 500 11.5px var(--mono); color: var(--muted); background: var(--hover); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; display: inline-block; }

/* -------------------------------------------------------------- top bar */

.bar { display: flex; align-items: center; gap: 12px; height: calc(60px + var(--st)); padding: var(--st) 24px 0; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; margin-right: auto; font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.brand .mark { width: 24px; height: 24px; stroke-width: 1.5; }
.bar-end { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.room-code {
  display: inline-flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px 0 12px; border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--surface); transition: background-color .15s;
}
.room-code:hover { background: var(--sunken); }
.room-code span { font-size: 12.5px; color: var(--muted); }
.room-code b { font: 500 15px var(--mono); letter-spacing: .18em; }
.room-code svg.i { width: 16px; height: 16px; color: var(--muted); }

.sync-pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; margin-right: 4px; border-radius: 999px; font: 500 12.5px var(--mono); color: var(--muted); white-space: nowrap; }
.sync-pill[data-level="ok"] .dot { background: var(--ok); }
.sync-pill[data-level="warn"] .dot { background: var(--warn); }
.sync-pill[data-level="bad"] .dot { background: var(--bad); }
.sync-pill[data-level="wait"] .dot { animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* ----------------------------------------------------------------- home */

.home { min-height: 100dvh; display: flex; flex-direction: column; }
.home-main {
  flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 48px 24px;
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 72px; align-items: center;
}
.intro h1 { font: 400 clamp(40px, 5.4vw, 64px)/1.05 var(--serif); letter-spacing: -.025em; font-optical-sizing: auto; }
.lede { margin-top: 20px; max-width: 460px; font-size: 17px; line-height: 1.6; color: var(--muted); }

.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.join { padding: 28px; display: grid; gap: 16px; }
.card-head h2 { font: 500 22px/1.25 var(--serif); letter-spacing: -.01em; }
.card-head p { margin-top: 4px; font-size: 14px; color: var(--muted); }
.or { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--faint); }
.or::before, .or::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.code-row { display: flex; gap: 8px; }
.code-row .btn { height: 52px; padding: 0 22px; }
.code { position: relative; flex: 1; height: 52px; cursor: text; }
.code input { position: absolute; inset: 0; width: 100%; opacity: 0; font-size: 16px; text-transform: uppercase; caret-color: transparent; border: 0; outline: 0; z-index: 2; }
.cells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cells i {
  display: grid; place-items: center; border-radius: var(--r); font: 500 21px/1 var(--mono); font-style: normal;
  background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-strong); transition: box-shadow .15s;
}
.code.focus .cells i.active { box-shadow: inset 0 0 0 1.5px var(--text); }
.code.focus .cells i.active:empty::after { content: ''; width: 1.5px; height: 22px; background: var(--text); animation: blink 1s steps(1) infinite; }
.code.shake { animation: shake .35s; }
@keyframes shake { 25%, 75% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }
.form-error { color: var(--bad); font-size: 13.5px; text-align: center; }
.form-error:empty { display: none; }

.get-app { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); text-decoration: none; color: var(--text); background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); transition: background-color .15s; }
.get-app:hover { background: var(--sunken); }
.get-app > span { flex: 1; display: grid; }
.get-app b { font-size: 14px; font-weight: 500; }
.get-app small { font-size: 12.5px; color: var(--muted); }
.get-app svg.i:last-child { width: 16px; height: 16px; color: var(--muted); }

.steps { list-style: none; display: flex; justify-content: center; gap: 32px; padding: 0 24px calc(40px + var(--sb)); color: var(--muted); font-size: 14px; }
.steps li { display: flex; align-items: center; gap: 10px; }
.steps span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 500 11.5px var(--mono); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text); }

/* ----------------------------------------------------------------- room */

.room { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.room-bar { border-bottom: 1px solid var(--line); flex: none; }
.room-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 420px; }
.panel { min-height: 0; display: flex; flex-direction: column; }

/* player */
.player { overflow-y: auto; scrollbar-width: none; }
.player::-webkit-scrollbar { display: none; }
.player-inner { width: min(100%, 460px); margin: auto; padding: 32px 24px; display: flex; flex-direction: column; }
.art {
  position: relative; width: 100%; aspect-ratio: 1; border-radius: var(--r-lg); overflow: hidden;
  background: var(--sunken); box-shadow: 0 0 0 1px var(--line), var(--art-shadow);
  transition: aspect-ratio .35s var(--ease), transform .45s var(--ease);
}
.art.video { aspect-ratio: 16 / 9; }
body:not([data-playing="true"]) .art { transform: scale(.985); }
.art-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.art-fallback svg.i { width: 44px; height: 44px; stroke-width: 1.2; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: fade .4s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.yt-wrap { position: absolute; inset: 0; background: #000; }
.yt-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.art-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; pointer-events: none; background: rgba(20, 20, 19, .82); color: #FAF9F5; }

.now { margin-top: 28px; min-width: 0; }
.now-label { display: flex; align-items: center; gap: 8px; font: 500 11.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.now h2 { margin-top: 8px; font: 400 28px/1.2 var(--serif); letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now p#t-artist { margin-top: 2px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now.swap h2, .now.swap #t-artist { animation: rise .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.eq i { width: 2px; height: 100%; border-radius: 1px; background: currentColor; transform-origin: bottom; transform: scaleY(.3); }
body[data-playing="true"] .now-label { color: var(--text); }
body[data-playing="true"] .eq i { animation: eq 1.1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.4s !important; }
.eq i:nth-child(3) { animation-delay: -.75s !important; }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

.scrub { margin-top: 22px; height: 44px; cursor: pointer; touch-action: none; position: relative; }
.scrub.locked { cursor: default; }
.scrub canvas { display: block; width: 100%; height: 100%; }
.times { display: flex; justify-content: space-between; margin-top: 6px; font: 400 12px var(--mono); color: var(--faint); font-variant-numeric: tabular-nums; }

.transport { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding: 0 4px; }
.play-btn {
  position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--on-ink); transition: transform .12s, opacity .15s;
}
.play-btn:hover { opacity: .9; }
.play-btn:active { transform: scale(.95); }
.play-btn:disabled { opacity: .25; pointer-events: none; }
.play-btn svg.i, .mini .icon-btn svg.i { grid-area: 1 / 1; transition: opacity .15s, transform .2s var(--ease); }
.play-btn svg.i { width: 26px; height: 26px; }
.play-btn .ic-play { transform: translateX(1.5px); }
.ic-pause { opacity: 0; transform: scale(.7); }
body[data-playing="true"] .ic-play { opacity: 0; transform: scale(.7); }
body[data-playing="true"] .ic-pause { opacity: 1; transform: none; }
.play-btn .spinner { position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid transparent; border-top-color: var(--text); opacity: 0; transition: opacity .2s; }
body[data-waiting="true"] .play-btn .spinner { opacity: 1; animation: spin .9s linear infinite; }

.player-foot { margin-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.status { font-size: 13px; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.volume { display: flex; align-items: center; gap: 4px; width: 150px; flex: none; }

/* side */
.side { border-left: 1px solid var(--line); min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.side-tabs { display: flex; gap: 4px; padding: 12px 16px 0; border-bottom: 1px solid var(--line); flex: none; }
.side-tabs button { position: relative; height: 40px; padding: 0 10px; display: inline-flex; align-items: center; font-size: 14px; font-weight: 500; color: var(--muted); transition: color .15s; }
.side-tabs button:hover { color: var(--text); }
.side-tabs button.on { color: var(--text); }
.side-tabs button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 1.5px; background: var(--text); }
.side .panel { flex: 1; display: none; padding: 16px; }
body[data-tab="player"] .side .panel.search, body[data-tab="search"] .side .panel.search,
body[data-tab="queue"] .side .panel.queue, body[data-tab="devices"] .side .panel.devices { display: flex; }

.search-box { position: relative; display: flex; align-items: center; flex: none; }
.search-box svg.i { position: absolute; left: 13px; width: 17px; height: 17px; color: var(--faint); pointer-events: none; }
.search-box input {
  width: 100%; height: 42px; padding: 0 40px; border-radius: var(--r); outline: none; border: 0;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); transition: box-shadow .15s;
}
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-box input::placeholder { color: var(--faint); }
.search-box input:focus { box-shadow: inset 0 0 0 1.5px var(--text); }
.search-box kbd { position: absolute; right: 10px; font: 500 11.5px var(--mono); color: var(--faint); padding: 1px 6px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--line-strong); }
.search-box input:focus ~ kbd { display: none; }

.drop {
  flex: none; margin-top: 10px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); cursor: pointer;
  border: 1px dashed var(--line-strong); color: var(--muted); font-size: 13.5px; transition: all .15s;
}
.drop b { color: var(--text); font-weight: 500; }
.drop span { flex: 1; }
.drop small { font: 500 11px var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.drop svg.i { width: 18px; height: 18px; }
.drop:hover, .drop.over { border-color: var(--text); background: var(--surface); }
.uploads { flex: none; display: grid; gap: 6px; margin-top: 8px; }
.uploads:empty { display: none; }
.up-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.up-item .meta { flex: 1; min-width: 0; }
.up-bar { height: 2px; border-radius: 2px; background: var(--wave-rest); margin-top: 8px; overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; background: var(--text); transition: width .2s; }
.up-item.done .up-bar { display: none; }
.up-item.err .meta span { color: var(--bad); }

.results, .list { flex: 1; min-height: 0; margin: 12px -8px 0; padding: 0 8px; list-style: none; }

.row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--r); transition: background-color .12s; }
.row:hover { background: var(--hover); }
.thumb { position: relative; width: 44px; height: 44px; border-radius: var(--r-sm); flex: none; overflow: hidden; background: var(--sunken) center / cover no-repeat; box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; color: var(--faint); }
.thumb.wide { width: 64px; height: 40px; }
.thumb svg.i { width: 18px; height: 18px; }
.meta { flex: 1; min-width: 0; }
.meta b { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dur { font: 400 12px var(--mono); color: var(--faint); font-variant-numeric: tabular-nums; flex: none; }
.row-actions { display: flex; gap: 2px; flex: none; }
.row-actions .icon-btn.done { color: var(--ok); }

.q-item { cursor: pointer; }
.q-item .num { width: 20px; flex: none; text-align: center; font: 400 12px var(--mono); color: var(--faint); }
.q-item.current { background: var(--hover); }
.q-item.current .num { color: var(--text); }
.q-item.played .meta, .q-item.played .thumb { opacity: .5; }
.q-item .icon-btn { opacity: 0; }
.q-item:hover .icon-btn, .q-item:focus-within .icon-btn { opacity: 1; }
@media (hover: none) { .q-item .icon-btn { opacity: .7; } }
.thumb .eq { color: #FAF9F5; height: 12px; position: relative; z-index: 1; }
.thumb.playing::before { content: ''; position: absolute; inset: 0; background: rgba(20, 20, 19, .45); }

.skeleton .thumb, .skeleton .sk { background: var(--sunken); animation: pulse 1.2s ease-in-out infinite; box-shadow: none; }
.skeleton .sk { height: 10px; border-radius: 5px; margin: 6px 0; }
@keyframes pulse { 50% { opacity: .5; } }

.empty { margin: auto; padding: 40px 16px; text-align: center; max-width: 300px; display: grid; justify-items: center; gap: 4px; }
.empty b { font: 400 18px var(--serif); }
.empty p { font-size: 13.5px; color: var(--muted); }
.suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 16px; }

.d-icon { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); position: relative; }
.d-icon svg.i { width: 19px; height: 19px; }
.d-icon::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--bg); }
.d-item .meta b { display: flex; align-items: center; gap: 6px; }
.d-item .meta b svg.i { width: 13px; height: 13px; color: var(--muted); }
.tag { font: 500 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; border-radius: 5px; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.ms { font: 400 12px var(--mono); color: var(--muted); flex: none; }
.btn.tiny { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.d-item .btn.tiny { opacity: 0; }
.d-item:hover .btn.tiny { opacity: 1; }
@media (hover: none) { .d-item .btn.tiny { opacity: 1; } }
.devices-foot { flex: none; display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); margin-top: 8px; }

.switch-row { display: flex; align-items: center; gap: 12px; padding: 4px 0; cursor: pointer; }
.switch-row span { flex: 1; display: grid; }
.switch-row b { font-size: 14px; font-weight: 500; }
.switch-row small { font-size: 12.5px; color: var(--muted); }
.switch-row input { display: none; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); transition: background-color .2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .2s var(--ease); }
.switch-row input:checked + .switch { background: var(--ink); }
.switch-row input:checked + .switch::after { transform: translateX(16px); background: var(--on-ink); }

/* mini player + tab bar: phones only */
.mini, .tabbar { display: none; }
.tabbar {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; padding: 6px 8px calc(6px + var(--sb));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); gap: 4px;
}
.tabbar button { position: relative; flex: 1; height: 50px; border-radius: var(--r); display: grid; place-items: center; align-content: center; gap: 3px; color: var(--faint); font-size: 11px; font-weight: 500; transition: color .15s; }
.tabbar button svg.i { width: 22px; height: 22px; }
.tabbar button.on { color: var(--text); }
.badge { position: absolute; top: 5px; left: calc(50% + 7px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; display: grid; place-items: center; font: 500 10px var(--mono); background: var(--ink); color: var(--on-ink); }
.mini {
  position: fixed; z-index: 19; left: 10px; right: 10px; bottom: calc(70px + var(--sb));
  height: 58px; padding: 7px 6px 7px 7px; border-radius: var(--r-lg); align-items: center; gap: 10px; overflow: hidden; cursor: pointer;
  background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow);
}
.mini-art { width: 44px; height: 44px; border-radius: var(--r-sm); flex: none; background: var(--sunken) center / cover no-repeat; }
.mini-meta { flex: 1; min-width: 0; }
.mini-meta b { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-meta span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .icon-btn { width: 44px; height: 44px; }
.mini .icon-btn svg.i { width: 22px; height: 22px; }
.mini-progress { position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: var(--wave-rest); }
.mini-progress i { display: block; height: 100%; width: 0; background: var(--text); }

/* -------------------------------------------------------------- sheets */

dialog.sheet {
  margin: auto; width: min(420px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; overflow: auto;
  color: var(--text); background: var(--surface); border-radius: var(--r-lg); box-shadow: 0 0 0 1px var(--line), 0 24px 64px -16px rgba(0, 0, 0, .35);
}
dialog.sheet[open] { animation: sheet-in .25s var(--ease); }
dialog.sheet::backdrop { background: var(--backdrop); animation: fade .2s; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.sheet-body { padding: 22px 24px 24px; display: grid; gap: 16px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-right: -8px; }
.sheet-head h3 { font: 400 22px var(--serif); letter-spacing: -.01em; }
.sheet-body > .muted { margin-top: -8px; font-size: 14px; }
.qr-frame { justify-self: center; width: 200px; height: 200px; padding: 12px; border-radius: var(--r); background: #fff; box-shadow: inset 0 0 0 1px rgba(20, 20, 19, .1); }
.qr-frame img { width: 100%; height: 100%; }
.share-code { text-align: center; font: 500 32px/1 var(--mono); letter-spacing: .3em; padding-left: .3em; }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border-radius: var(--r); border: 0; outline: none; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font: 400 13px var(--mono); }
.hint { font-size: 12.5px; color: var(--faint); text-align: center; }
.hint:empty { display: none; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.field small { font-size: 12.5px; line-height: 1.5; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border-radius: var(--r); overflow: hidden; background: var(--line); box-shadow: 0 0 0 1px var(--line); }
.stats div { padding: 10px 12px; background: var(--surface); }
.stats dt { font-size: 12px; color: var(--faint); }
.stats dd { margin-top: 2px; font: 500 14px var(--mono); }

.tap-gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: var(--backdrop); animation: fade .2s; }
.tap-card { display: grid; justify-items: center; gap: 6px; padding: 28px 32px; border-radius: var(--r-lg); text-align: center; background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.tap-card svg.i { width: 28px; height: 28px; }
.tap-card b { font: 400 20px var(--serif); margin-top: 8px; }
.tap-card span { color: var(--muted); font-size: 14px; }

.toasts { position: fixed; z-index: 60; left: 50%; top: calc(14px + var(--st)); transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 500; background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow); animation: toast-in .25s var(--ease); }
.toast svg.i { width: 16px; height: 16px; }
.toast.out { animation: toast-out .2s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }

/* --------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .room-body { grid-template-columns: minmax(0, 1fr) 360px; }
}

@media (max-width: 900px) {
  .home-main { grid-template-columns: 1fr; gap: 36px; padding: 24px 20px 32px; max-width: 520px; }
  .steps { flex-direction: column; align-items: flex-start; gap: 12px; max-width: 520px; width: 100%; margin: 0 auto; padding: 0 20px calc(32px + var(--sb)); }

  .bar { padding: var(--st) 12px 0 16px; height: calc(56px + var(--st)); }
  .brand span { display: none; }
  .room-code span { display: none; }
  .room-bar .brand { margin-right: 0; }
  .room-bar .room-code { margin-right: auto; }

  .room-body { display: block; position: relative; padding-bottom: calc(64px + var(--sb)); }
  .side { border: 0; height: 100%; }
  .side-tabs { display: none; }
  .panel.player { display: none; height: 100%; }
  body[data-tab="player"] .panel.player { display: flex; }
  body[data-tab="player"] .side { display: none; }
  body[data-tab="player"] .side .panel.search { display: none; }
  .side .panel { height: 100%; padding: 12px 16px; }
  .player-inner { padding: 16px 20px 20px; justify-content: center; min-height: 100%; }
  .art { width: min(100%, 42vh); align-self: center; }
  .art.video { width: 100%; }
  .now { margin-top: 20px; }
  .now h2 { font-size: 24px; }
  .scrub { margin-top: 16px; }
  .transport { margin-top: 12px; }
  .player-foot { margin-top: 14px; }

  .tabbar { display: flex; }
  body:not([data-tab="player"]) .mini { display: flex; }
  body:not([data-tab="player"]) .room-body { padding-bottom: calc(136px + var(--sb)); }

  dialog.sheet { margin: auto auto 0; width: 100%; max-width: 100%; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: var(--sb); }
  dialog.sheet[open] { animation: sheet-up .3s var(--ease); }
  @keyframes sheet-up { from { transform: translateY(100%); } }
}

@media (max-width: 380px) {
  .sync-pill span { display: none; }
  .volume { width: 120px; }
}

@media (max-height: 680px) and (max-width: 900px) {
  .art { width: min(100%, 34vh); }
  .player-foot .volume { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
