:root {
  --bg: #0d0d0e;
  --surface: #18181a;
  --surface-2: #242427;
  --line: rgba(255, 255, 255, .08);
  --text: #f2f2f3;
  --muted: #9a9aa2;
  --accent: #3e6ae1;
  --ok: #2fbf71;
  --warn: #f2a531;
  --radius: 18px;
  --tb: 64px;
  --dock: 92px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eceef1;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --line: rgba(0, 0, 0, .08);
  --text: #16171a;
  --muted: #6b6f78;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 500 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: background .3s, color .3s;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
input { user-select: text; }
h3 { font-size: 17px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }

.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.fill { fill: currentColor; stroke: none; }

.app { display: grid; grid-template-rows: var(--tb) 1fr var(--dock); height: 100dvh; }

/* ---------- Top bar ---------- */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 28px; }
.logo { font-weight: 700; letter-spacing: .34em; font-size: 13px; }
.tb-right { display: flex; justify-content: flex-end; align-items: center; gap: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.clock { color: var(--text); font-size: 17px; font-weight: 600; }
.speed:empty { display: none; }
.pill { display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 18px; border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 600; transition: background .3s; }
.pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); animation: pulse 1.6s infinite; }
.pill[data-s="parked"] .dot { background: var(--ok); animation: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); }
.pill[data-s="moving"] .dot { background: var(--accent); }
@keyframes pulse { 50% { opacity: .35; } }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); font-weight: 650; font-size: 14px; }
.chip .ic { width: 18px; height: 18px; }

/* ---------- Main + views ---------- */
main { overflow-y: auto; padding: 8px 32px 32px; scrollbar-width: none; }
main::-webkit-scrollbar { display: none; }
.view { display: none; }
.view.active { display: block; animation: rise .28s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.sec { font-size: 15px; font-weight: 650; color: var(--muted); margin: 30px 0 14px; display: flex; gap: 10px; align-items: baseline; }
.sec span { font-weight: 500; font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.big { font-size: 34px; line-height: 1.12; font-weight: 650; letter-spacing: -.015em; margin: 8px 0 16px; }

/* ---------- Buttons / inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 50px; padding: 0 22px; border-radius: 14px; background: var(--surface-2); font-weight: 650; white-space: nowrap; transition: transform .12s, background .2s, filter .2s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.lg { height: 58px; padding: 0 26px; font-size: 17px; }
.btn.block { width: 100%; }
.btn .ic { width: 22px; height: 22px; }
.btns { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.btns.tight { margin-top: 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); flex: none; transition: background .2s, color .2s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.input { flex: 1; min-width: 0; height: 52px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); outline: none; transition: border-color .2s; }
.input:focus { border-color: var(--accent); }
select.input { appearance: none; cursor: pointer; }
.add-form { display: flex; gap: 10px; margin-top: 30px; max-width: 680px; }
.add-form.compact { margin-top: 14px; }
.add-form.compact .input { background: var(--surface-2); height: 48px; }
.add-form.compact .btn { height: 48px; width: 48px; padding: 0; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.accent { background: var(--accent); color: #fff; vertical-align: middle; margin-left: 6px; }
.tag { display: inline-block; margin-top: 12px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.panel { background: var(--surface); border-radius: 22px; padding: 22px; }
.panel-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.split { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }
.split.three { grid-template-columns: repeat(3, 1fr); margin-top: 20px; }

.bar { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; max-width: 380px; margin-top: 14px; }
.bar.wide { max-width: none; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; }
.bar.seekable { height: 8px; cursor: pointer; position: relative; }
.bar.seekable::before { content: ""; position: absolute; inset: -14px 0; }

/* ---------- Hero ---------- */
.hero { position: relative; border-radius: 26px; overflow: hidden; background: var(--surface); }
.hero-bg { position: absolute; inset: -60px; background-size: cover; background-position: center; filter: blur(50px) saturate(1.4); opacity: .5; }
:root[data-theme="light"] .hero-bg { opacity: .3; }
.hero-in { position: relative; display: flex; gap: 36px; align-items: center; justify-content: space-between; padding: 40px 44px; min-height: 280px; }
.hero h1 { font-size: 36px; line-height: 1.12; font-weight: 680; letter-spacing: -.015em; margin: 8px 0 10px; max-width: 20ch; }
.hero p { max-width: 54ch; }
.hero-thumb { width: min(42%, 460px); aspect-ratio: 16 / 9; object-fit: cover; border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); cursor: pointer; }

/* ---------- Apps ---------- */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 14px; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 10px 16px; border-radius: var(--radius); background: var(--surface); transition: transform .15s, background .2s; }
.app-tile:active { transform: scale(.96); }
.app-tile:hover { background: var(--surface-2); }
.app-ic { width: 58px; height: 58px; border-radius: 17px; display: grid; place-items: center; font-weight: 800; font-size: 24px; margin-bottom: 4px; box-shadow: 0 8px 20px rgba(0, 0, 0, .25); }
.app-tile small { color: var(--muted); font-size: 12px; }

/* ---------- Cards ---------- */
.row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 290px); gap: 18px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.row::-webkit-scrollbar { display: none; }
.card { scroll-snap-align: start; cursor: pointer; outline: none; }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.card:hover .thumb img, .card:focus-visible .thumb img { transform: scale(1.05); }
.dur { position: absolute; right: 8px; bottom: 10px; background: rgba(0, 0, 0, .78); color: #fff; font-size: 12px; font-weight: 650; padding: 2px 7px; border-radius: 6px; }
.prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .25); }
.prog span { display: block; height: 100%; background: var(--accent); }
.card-add { position: absolute; top: 8px; right: 8px; width: 42px; height: 42px; border-radius: 12px; background: rgba(0, 0, 0, .62); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .2s; backdrop-filter: blur(6px); }
.card:hover .card-add, .card:focus-within .card-add { opacity: 1; }
@media (hover: none) { .card-add { opacity: 1; } }
.card-t { margin-top: 11px; font-weight: 650; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-s { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---------- Lists ---------- */
.list { list-style: none; display: flex; flex-direction: column; gap: 2px; max-height: 52vh; overflow-y: auto; scrollbar-width: thin; }
.q-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; cursor: pointer; transition: background .2s; }
.q-item:hover { background: var(--surface-2); }
.q-item.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.q-item img { width: 104px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 9px; flex: none; }
.q-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 13px; font-weight: 700; color: var(--muted); flex: none; }
.q-item.on .q-n { background: var(--accent); color: #fff; }
.q-txt { flex: 1; min-width: 0; }
.q-t { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-s { color: var(--muted); font-size: 13px; }
.q-empty { color: var(--muted); padding: 18px 8px; font-size: 14px; }

/* ---------- Watch ---------- */
.watch { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }
.player-wrap { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 22px; overflow: hidden; }
.player-wrap iframe, #player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #777; }
.empty .ic { width: 48px; height: 48px; margin-bottom: 8px; }
.watch-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; }
.w-info { min-width: 0; }
.w-title { font-size: 22px; font-weight: 680; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Audio ---------- */
.np { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; padding: 32px; }
.np-body { width: 100%; }
.art { width: 200px; height: 200px; border-radius: 28px; display: grid; place-items: center; color: #fff; background-color: var(--accent); background-image: linear-gradient(135deg, rgba(255, 255, 255, .12), rgba(0, 0, 0, .45)); box-shadow: 0 24px 50px color-mix(in srgb, var(--accent) 30%, transparent); transition: transform .4s; }
.art .ic { width: 72px; height: 72px; }
.art.playing { transform: scale(1.03); }
.art.sm { width: 56px; height: 56px; border-radius: 14px; box-shadow: none; flex: none; }
.art.sm .ic { width: 26px; height: 26px; }
.np-title { font-size: 22px; font-weight: 680; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seek { margin-top: 10px; }
.times { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 8px; font-variant-numeric: tabular-nums; }
.ctls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.ctl { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-size: 16px; transition: transform .12s; }
.ctl:active { transform: scale(.93); }
.ctl .ic { width: 26px; height: 26px; }
.ctl.main { width: 88px; height: 88px; background: var(--accent); color: #fff; }
.ctl.main .ic { width: 36px; height: 36px; }
.t-art { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.q-item.on .t-art { background: var(--accent); color: #fff; }

/* ---------- Charge ---------- */
.charge-main { padding: 32px; }
.presets { display: flex; flex-wrap: wrap; gap: 10px; }
.est { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 16px; }
.field { display: grid; grid-template-columns: 120px 1fr 56px; align-items: center; gap: 14px; color: var(--muted); }
.field b { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.field select { grid-column: 2 / 4; }
input[type="range"] { appearance: none; height: 6px; border-radius: 6px; background: var(--surface-2); outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.ring-wrap { position: relative; width: 260px; height: 260px; margin: 18px auto 8px; }
.ring { width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 12; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg { stroke: var(--ok); stroke-linecap: round; stroke-dasharray: 603.19; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 1s linear; }
.ring-txt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-num { font-size: 52px; font-weight: 300; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.plan-note { margin: -4px 0 10px; }
#plan-go { margin-top: 16px; }

/* ---------- Pro ---------- */
.pro-hero { max-width: 660px; margin: 12px 0 24px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.plan { padding: 28px; }
.plan.pro { box-shadow: inset 0 0 0 2px var(--accent); }
.price { font-size: 40px; font-weight: 700; margin: 6px 0 18px; }
.price small { font-size: 16px; color: var(--muted); font-weight: 500; }
.perks { list-style: none; display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.perks li { display: flex; gap: 10px; align-items: center; }
.perks .ic { color: var(--accent); width: 20px; height: 20px; }
.fine { font-size: 12px; color: var(--muted); margin-top: 12px; }
.swatches { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.sw { width: 44px; height: 44px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 3px var(--surface); outline: 2px solid transparent; transition: outline-color .2s; }
.sw.on { outline-color: var(--c); }
.code { margin-top: 16px; font: 700 30px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .2em; }
.pro-only { position: relative; }
.pro-only.locked > * { opacity: .35; pointer-events: none; }
.pro-only.locked::after { content: "PRO"; position: absolute; top: 18px; right: 18px; font-size: 11px; font-weight: 800; letter-spacing: .1em; padding: 4px 9px; border-radius: 999px; background: var(--accent); color: #fff; }

/* ---------- Dock ---------- */
.dock { display: flex; justify-content: center; align-items: center; padding: 0 16px 14px; }
.dock-in { display: flex; gap: 4px; background: var(--surface); padding: 7px; border-radius: 24px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.dock button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 96px; height: 62px; border-radius: 18px; color: var(--muted); font-size: 12px; font-weight: 650; transition: background .2s, color .2s; }
.dock button.on { background: var(--surface-2); color: var(--text); }
.dock button.on .ic { color: var(--accent); }

/* ---------- Motion lock ---------- */
.lock { position: fixed; inset: var(--tb) 0 0 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(13, 13, 14, .94); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px); animation: fadein .3s ease; }
@keyframes fadein { from { opacity: 0; } }
.lock-card { width: min(620px, 100%); text-align: center; }
.lock-ic { width: 84px; height: 84px; margin: 0 auto 20px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.lock-ic .ic { width: 44px; height: 44px; }
body[data-motion="unknown"] .lock-ic { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); animation: pulse 1.6s infinite; }
.lock h1 { font-size: 30px; font-weight: 680; letter-spacing: -.01em; }
.lock p { color: var(--muted); margin: 10px auto 28px; max-width: 46ch; }
.np-mini { padding: 22px 24px 26px; text-align: left; }
.np-mini-top { display: flex; align-items: center; gap: 14px; }
.np-mini .np-title { font-size: 18px; margin: 0; }
.np-mini .times { margin: 0; gap: 4px; }

/* ---------- Toast ---------- */
.toast { position: fixed; top: calc(var(--tb) + 6px); left: 50%; z-index: 80; transform: translate(-50%, -16px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg); padding: 13px 22px; border-radius: 14px; font-weight: 650; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); transition: opacity .25s, transform .25s; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Dev simulator (localhost only) ---------- */
.dev { position: fixed; left: 16px; bottom: calc(var(--dock) + 8px); z-index: 90; width: 280px; padding: 14px 16px; border-radius: 16px; background: #1f2937; color: #e5e7eb; font-size: 13px; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); }
.dev-h b { cursor: pointer; }
.dev-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dev input[type="range"] { width: 100%; background: #374151; }
.dev-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.dev-row button { padding: 4px 10px; border-radius: 8px; background: #374151; margin-left: 4px; font-size: 12px; font-weight: 650; }
.dev p { color: #9ca3af; font-size: 11px; margin-top: 8px; }
.dev.min > :not(.dev-h) { display: none; }
.dev.min .dev-h { margin: 0; }

/* ---------- Narrow screens ---------- */
@media (max-width: 900px) {
  .watch, .split, .split.three, .plans { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --tb: 56px; --dock: 84px; }
  .topbar { padding: 0 16px; grid-template-columns: auto 1fr; }
  .tb-left { display: none; }
  .tb-center { justify-self: start; }
  .tb-right { gap: 10px; }
  .speed { display: none; }
  main { padding: 4px 16px 24px; }
  .hero-in { padding: 26px 22px; min-height: 0; }
  .hero h1, .big { font-size: 26px; }
  .hero-thumb { display: none; }
  .dock { padding: 0 8px 10px; }
  .dock button { width: 64px; height: 58px; font-size: 11px; }
  .row { grid-auto-columns: 78%; }
  .apps { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .app-tile { padding: 12px 4px 10px; font-size: 12px; text-align: center; }
  .app-tile small { display: none; }
  .app-ic { width: 48px; height: 48px; font-size: 20px; border-radius: 14px; }
  .field { grid-template-columns: 96px 1fr 48px; }
  .art { width: 150px; height: 150px; }
  .np, .charge-main { padding: 22px; }
  .dev { width: auto; right: 16px; }
}
