/* app.css - FocusTube. Compact, dark-first, responsive, no framework. */

/* ---------- tokens ---------- */
:root {
  --accent: #ff473a;
  --bg: #0b0f1a;
  --bg2: #0f1524;
  --panel: #141c2e;
  --panel2: #1b2438;
  --panel3: #232d45;
  --line: #26314b;
  --line2: #33405f;
  --tx: #e8edf7;
  --tx2: #a8b4cc;
  --muted: #7b8aa6;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --r: 12px;
  --r2: 8px;
  --sh: 0 6px 24px rgba(0,0,0,.35);
  --sh2: 0 2px 10px rgba(0,0,0,.25);
  --sidebar: 236px;
  --top: 52px;
  --player: 62px;
  --f: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --speed: 1;
}
html[data-theme="light"] {
  --bg: #f8fafc;
  --bg2: #f1f5f9;
  --panel: #ffffff;
  --panel2: #f8fafc;
  --panel3: #e2e8f0;
  --line: #e2e8f0;
  --line2: #cbd5e1;
  --tx: #0f172a;
  --tx2: #334155;
  --muted: #64748b;
  --sh: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --sh2: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --c1: #64748b; --c2: #94a3b8; --c3: #cbd5e1; --c4: #e2e8f0; --c5: #f1f5f9;
}

/* ============================================================
   THEME: Nextdeck Deep Navy Glass (1:1 with nextdeck-dashboard-theme.html)
   ============================================================ */
html[data-theme="nextdeck"] {
  --bg: #0a0e17;
  --bg2: #0d121c;
  --panel: #121826;
  --panel2: #141b2b;
  --panel3: #1c2438;
  --line: rgba(255, 255, 255, 0.08);
  --line2: rgba(255, 255, 255, 0.14);
  --tx: #e8edf5;
  --tx2: #8b95a8;
  --muted: #5c677a;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --r: 12px;
  --r2: 8px;
  --sh: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 8px 32px rgba(0, 0, 0, 0.45);
  --sh2: 0 4px 20px rgba(0, 0, 0, 0.35);
}
html[data-theme="nextdeck"] body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(34, 211, 238, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 80%, rgba(14, 165, 233, 0.06) 0%, transparent 45%),
    linear-gradient(180deg, #0b1019 0%, #0a0e17 100%) !important;
  background-attachment: fixed !important;
}
html[data-theme="nextdeck"] .vcard,
html[data-theme="nextdeck"] .stat,
html[data-theme="nextdeck"] .sh-card,
html[data-theme="nextdeck"] .pl-card,
html[data-theme="nextdeck"] .note-card,
html[data-theme="nextdeck"] .empty-hero {
  background: rgba(18, 24, 38, 0.72) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
}
html[data-theme="nextdeck"] .vcard:hover,
html[data-theme="nextdeck"] .stat:hover {
  border-color: rgba(34, 211, 238, 0.35) !important;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.15), 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

/* ============================================================
   THEME: PredictParity Chalkboard Mono (1:1 with oklch.html)
   ============================================================ */
html[data-theme="oklch"] {
  --bg: oklch(0.2603 0 0);
  --bg2: oklch(0.22 0 0);
  --panel: oklch(0.2603 0 0);
  --panel2: oklch(0.29 0 0);
  --panel3: oklch(0.33 0 0);
  --line: oklch(1 0 0 / 0.14);
  --line2: oklch(1 0 0 / 0.22);
  --tx: oklch(0.985 0 0);
  --tx2: oklch(0.74 0 0);
  --muted: oklch(0.6698 0 0);
  --ok: oklch(0.7463 0.0604 130.33);
  --warn: oklch(0.8203 0.0764 85.06);
  --err: oklch(0.605 0.1194 14.55);
  --r: 2px;
  --r2: 2px;
  --f: 'JetBrains Mono', ui-monospace, monospace;
  --sh: none;
  --sh2: none;
}
html[data-theme="oklch"] body {
  background-color: var(--bg) !important;
  background-image:
    radial-gradient(ellipse at 50% 0%, oklch(0.32 0 0) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, oklch(0.22 0.01 260 / 0.4) 0%, transparent 40%) !important;
  background-attachment: fixed !important;
  font-family: var(--f) !important;
}
html[data-theme="oklch"] button,
html[data-theme="oklch"] input,
html[data-theme="oklch"] select,
html[data-theme="oklch"] textarea,
html[data-theme="oklch"] .btn {
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
}
html[data-theme="oklch"] .vcard,
html[data-theme="oklch"] .stat,
html[data-theme="oklch"] .sidebar,
html[data-theme="oklch"] .topbar,
html[data-theme="oklch"] .statusbar,
html[data-theme="oklch"] .dialog,
html[data-theme="oklch"] .now,
html[data-theme="oklch"] .empty-hero,
html[data-theme="oklch"] .sh-card,
html[data-theme="oklch"] .pl-card,
html[data-theme="oklch"] .note-card {
  border-style: dashed !important;
  border-color: var(--line) !important;
  border-radius: 2px !important;
}
html[data-theme="oklch"] .btn {
  border-radius: 2px !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
}
html[data-theme="oklch"] .btn.primary {
  background: oklch(0.8203 0.0764 85.06) !important;
  color: #000 !important;
  border-color: transparent !important;
}

/* ============================================================
   THEME: OLED Pure Black
   ============================================================ */
html[data-theme="oled"] {
  --bg: #000000;
  --bg2: #050505;
  --panel: #0a0a0a;
  --panel2: #121212;
  --panel3: #1a1a1a;
  --line: #222222;
  --line2: #333333;
  --tx: #f5f5f5;
  --tx2: #a3a3a3;
  --muted: #737373;
  --ok: #22c55e;
  --warn: #eab308;
  --err: #ef4444;
  --r: 10px;
  --r2: 6px;
  --sh: 0 4px 20px rgba(0,0,0,0.85);
  --sh2: 0 2px 10px rgba(0,0,0,0.7);
}
html[data-theme="oled"] body {
  background: #000000 !important;
}

/* ============================================================
   THEME: Nordic Frost
   ============================================================ */
html[data-theme="nord"] {
  --bg: #2e3440;
  --bg2: #242933;
  --panel: #3b4252;
  --panel2: #434c5e;
  --panel3: #4c566a;
  --line: #4c566a;
  --line2: #616e88;
  --tx: #eceff4;
  --tx2: #d8dee9;
  --muted: #9aa5b8;
  --ok: #a3be8c;
  --warn: #ebcb8b;
  --err: #bf616a;
  --r: 12px;
  --r2: 8px;
  --sh: 0 8px 24px rgba(0,0,0,0.25);
  --sh2: 0 4px 12px rgba(0,0,0,0.2);
}

/* ============================================================
   THEME: Cyberpunk Obsidian
   ============================================================ */
html[data-theme="cyberpunk"] {
  --bg: #101114;
  --bg2: #15171a;
  --panel: #1b1e22;
  --panel2: #23272c;
  --panel3: #2c3138;
  --line: #323840;
  --line2: #424a54;
  --tx: #f0f3f6;
  --tx2: #9ba3a9;
  --muted: #6e767e;
  --ok: #00ff9f;
  --warn: #ffb800;
  --err: #ff0055;
  --r: 8px;
  --r2: 4px;
  --f: 'JetBrains Mono', ui-monospace, monospace;
  --sh: 0 0 20px rgba(0, 255, 159, 0.07), 0 8px 30px rgba(0,0,0,0.5);
  --sh2: 0 4px 12px rgba(0,0,0,0.4);
}
html[data-theme="cyberpunk"] body {
  font-family: var(--f) !important;
}

* { box-sizing: border-box; }
html, body { height: 100%; max-width: 100vw; overflow-x: hidden; }
body {
  margin: 0; font-family: var(--f); background: var(--bg); color: var(--tx);
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body.cozy { font-size: 15px; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.25rem; } h2 { font-size: 1rem; } h3 { font-size: .9rem; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; } .row.wrap { flex-wrap: wrap; } .row.center { justify-content: center; }
.pad { padding: 14px; }
kbd {
  font: 600 11px ui-monospace, Menlo, Consolas, monospace; background: var(--panel2);
  border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px;
}
.dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .45; flex: none; }
.spacer-line { flex: 1; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: var(--r2); border: 1px solid var(--line2);
  background: var(--panel2); color: var(--tx); cursor: pointer; white-space: nowrap;
  font-size: 13px; font-weight: 550; transition: background .13s, border-color .13s, transform .08s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--panel3); border-color: var(--line2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: #fff; background: color-mix(in srgb, var(--err) 82%, transparent); border-color: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r2); border: 0; background: transparent;
  color: var(--tx2); cursor: pointer; font-size: 15px; flex: none;
}
.icon:hover { background: var(--panel2); color: var(--tx); }
.input, .select, textarea.input {
  height: 34px; padding: 0 10px; border-radius: var(--r2); border: 1px solid var(--line);
  background: var(--bg2); color: var(--tx); width: 100%; outline: none; min-width: 0;
}
textarea.input { height: auto; padding: 9px 10px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); }
.select { appearance: none; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.select.sm, .input.sm { height: 28px; font-size: 12px; }
.input.num { width: 74px; }
.color-input { width: 40px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg2); cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.lbl { font-size: 11.5px; color: var(--tx2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.radio { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0; cursor: pointer; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px;
  border-radius: 6px; background: var(--panel3); color: var(--tx2); font-size: 11px; font-weight: 600;
}
.chip.adfree { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.badge { font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: var(--panel2); color: var(--muted); text-transform: uppercase; }
.badge.ok { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.badge.err { background: color-mix(in srgb, var(--err) 20%, transparent); color: var(--err); }
.tag {
  display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px; border-radius: 6px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--tx2); font-size: 11px; cursor: pointer;
}
.tag.on { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--accent); color: var(--tx); }
.tag.big { height: 26px; font-size: 13px; }
.tag-x { background: none; border: 0; color: inherit; cursor: pointer; padding: 0 0 0 2px; }
.offline-page,
.lock {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(900px 500px at 20% -10%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 70%),
    radial-gradient(700px 500px at 110% 110%, rgba(34,211,238,.18), transparent 70%),
    var(--bg);
}
.lock.bye { opacity: 0; transition: opacity .3s; }
.lock.shake .lock-card { animation: shake .42s; }
@keyframes shake { 10%,90%{transform:translateX(-2px)} 20%,80%{transform:translateX(4px)} 30%,50%,70%{transform:translateX(-7px)} 40%,60%{transform:translateX(7px)} }
.lock-card {
  width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 30px 26px; text-align: center; box-shadow: var(--sh);
}
.lock-logo {
  width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 17px; display: grid; place-items: center;
  font-size: 24px; color: #fff;
  background: linear-gradient(135deg, var(--accent), #22d3ee);
  box-shadow: 0 8px 26px color-mix(in srgb, var(--accent) 40%, transparent);
}
.lock-card h1 { font-size: 1.4rem; }
.lock-sub { color: var(--muted); margin: 5px 0 20px; font-size: 13px; }
.lock-input {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--bg2); color: var(--tx); outline: none; margin-bottom: 10px;
}
.lock-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.lock-btn { width: 100%; height: 42px; }
.lock-err { color: var(--err); font-size: 12.5px; margin-top: 9px; opacity: 0; transition: opacity .2s; min-height: 17px; }
.lock-err.on { opacity: 1; }
.lock-foot { color: var(--muted); font-size: 11.5px; margin: 16px 0 0; }

/* ---------- app shell ---------- */
.app { display: flex; height: 100dvh; overflow: hidden; }
.sidebar {
  width: var(--sidebar); flex: none; background: var(--bg2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden; transition: width .16s, transform .2s; z-index: 60;
}
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(var(--player) + 14px); }
body.player-open .main { padding-bottom: calc(var(--player) + 20px); }
.page { padding: 14px 18px 24px; max-width: 1680px; margin: 0 auto; }

.brand {
  display: flex; align-items: center; gap: 9px; padding: 0 10px 0 14px; height: var(--top);
  flex: none; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none;
}
.brand-m {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 11px;
  background: linear-gradient(135deg, var(--accent), #22d3ee); flex: none;
}
.brand-t { font-weight: 700; letter-spacing: -.02em; flex: 1; }
/* ---------- sidebar collapse ----------
   Collapsed shows a 64px icon rail. Because a collapsed rail hides labels,
   we keep THREE ways back: the chevron button, a dedicated edge expander that
   only appears while collapsed, and hover-to-open. State is persisted. */
body.nav-collapsed .sidebar { width: 64px; }
body.nav-collapsed .brand { padding: 0 8px; justify-content: center; cursor: pointer; gap: 4px; }
body.nav-collapsed .brand-t, body.nav-collapsed .nav-t, body.nav-collapsed .nav-n,
body.nav-collapsed .nav-sec, body.nav-collapsed .nav-foot .nav-t { display: none; }
body.nav-collapsed .brand .icon {
  display: inline-flex;
  font-size: 16px;
  font-weight: 700;
  color: var(--tx2);
}
body.nav-collapsed .brand .icon:hover { color: var(--accent); }
body.nav-collapsed .nav-i { justify-content: center; padding: 0; gap: 0; }
body.nav-collapsed .nav-i i { font-size: 17px; }
body.nav-collapsed .nav { padding: 8px 6px; }
body.nav-collapsed .nav-foot { padding: 7px 6px; display: flex; flex-direction: column; gap: 6px; }
body.nav-collapsed .nav-expand-foot-btn {
  height: 32px; border-radius: 8px; background: var(--panel2);
  color: var(--accent); font-weight: bold; font-size: 16px;
}
body.nav-collapsed .nav-expand-foot-btn:hover { background: var(--accent); color: #fff; }
body.nav-collapsed .nav-badge {
  position: absolute; top: 2px; right: 4px; font-size: 9px; padding: 0 4px;
}

/* Also show topbar menu icon on desktop when rail is collapsed */
body.nav-collapsed .topbar #btn-menu { display: inline-flex !important; }

/* the expander handle: sits cleanly on the 64px rail edge, clearly visible */
.nav-expand {
  position: fixed; left: 64px; top: 50%; transform: translateY(-50%);
  z-index: 100; width: 24px; height: 60px; border-radius: 0 10px 10px 0;
  background: var(--panel2); border: 1px solid var(--line2); border-left: 0;
  color: var(--tx2); cursor: pointer; display: none;
  align-items: center; justify-content: center; font-size: 17px; font-weight: 700; padding: 0;
  box-shadow: 3px 6px 18px rgba(0,0,0,0.45); transition: width .16s ease, background .14s ease, color .14s ease;
}
body.nav-collapsed .nav-expand { display: flex; }
.nav-expand:hover { width: 30px; background: var(--accent); color: #fff; }
.nav-expand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* hover-peek: the collapsed rail previews the full sidebar, floats above content */
body.nav-collapsed.nav-peek .sidebar { width: var(--sidebar); box-shadow: var(--sh); }
body.nav-collapsed.nav-peek .brand { padding: 0 10px 0 14px; justify-content: flex-start; }
body.nav-collapsed.nav-peek .brand-t,
body.nav-collapsed.nav-peek .nav-t,
body.nav-collapsed.nav-peek .nav-n,
body.nav-collapsed.nav-peek .nav-sec,
body.nav-collapsed.nav-peek .nav-foot .nav-t { display: block; }
body.nav-collapsed.nav-peek .nav-i { justify-content: flex-start; padding: 0 9px; gap: 9px; }
body.nav-collapsed.nav-peek .nav-expand { display: none; }
@media (max-width: 820px) { .nav-expand { display: none !important; } }

.nav { padding: 8px 7px; display: flex; flex-direction: column; gap: 1px; flex: none; }
.nav-i {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 34px; padding: 0 10px;
  border-radius: 8px; border: 0; background: transparent; color: var(--tx2); cursor: pointer;
  font-size: 13px; font-weight: 500; text-align: left; transition: background .14s ease, color .14s ease;
}
.nav-i i { font-style: normal; width: 18px; text-align: center; flex: none; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
.nav-i:hover { background: var(--panel2); color: var(--tx); }
.nav-i.on {
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--tx); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-badge { background: var(--accent); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 10.5px; font-weight: 700; }
.nav-sec { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 7px; }
.nav-sech {
  display: flex; align-items: center; justify-content: space-between; padding: 6px 9px 4px;
  font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em;
}
.nav-list { display: flex; flex-direction: column; gap: 1px; }
.nav-foot { padding: 7px; border-top: 1px solid var(--line); flex: none; }
.shelf-i { position: relative; }
.shelf-i .dotc { width: 9px; height: 9px; border-radius: 3px; flex: none; margin-left: 4px; box-shadow: 0 0 6px var(--c); }
.shelf-i.on { background: color-mix(in srgb, var(--c) 18%, transparent); }

/* ---------- topbar ---------- */
.topbar {
  min-height: var(--top); flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: color-mix(in srgb, var(--bg2) 88%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50;
}
.pastebar {
  flex: 1; min-width: 0; position: relative; display: flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0 6px 0 10px;
  min-height: 36px; max-height: 168px;
  transition: border-color .15s, box-shadow .15s;
}
.pastebar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.paste-ico { color: var(--muted); font-size: 13px; flex: none; }
.paste-input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font-size: 13px; font-family: inherit; line-height: 1.45; color: var(--tx);
  resize: none; overflow-y: hidden; padding: 8px 0; display: block;
}
.paste-input::placeholder { color: var(--muted); }
/* A long placeholder is not truncated by the browser, it just clips mid-word
   against the Add button on narrow screens. Let it shrink instead. */
@media (max-width: 820px) { .paste-input { font-size: 12px; } }
.paste-hint {
  position: absolute; left: 8px; right: 8px; top: calc(100% + 5px); font-size: 11.5px; color: var(--tx2);
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px;
  opacity: 0; pointer-events: none; transition: opacity .13s; z-index: 5; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; box-shadow: var(--sh2);
}
.paste-hint.on { opacity: 1; }
.top-right { display: flex; align-items: center; gap: 4px; flex: none; }
.search-box { position: relative; display: flex; align-items: center; }
.search {
  width: 190px; height: 32px; padding: 0 28px 0 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--tx); outline: none; font-size: 12.5px;
  transition: width .2s ease, border-color .15s ease, box-shadow .15s ease;
}
.search:focus { border-color: var(--accent); width: 240px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.search-clear-btn {
  position: absolute; right: 7px; width: 18px; height: 18px; border-radius: 50%;
  border: 0; background: var(--panel2); color: var(--muted); cursor: pointer;
  display: grid; place-items: center; font-size: 10px; line-height: 1; padding: 0;
  transition: color .12s, background .12s;
}
.search-clear-btn:hover { color: var(--tx); background: var(--panel3); }

/* Topbar Cloud Sync & Device Pairing */
.topbar-sync-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 0 10px; cursor: pointer; color: var(--tx2); font-size: 11.5px;
  font-weight: 600; transition: border-color .15s, background .15s, color .15s;
  white-space: nowrap; flex: none;
}
.topbar-sync-btn:hover { background: var(--panel2); border-color: var(--line2); color: var(--tx); }
.topbar-sync-btn .sync-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6); flex: none;
}
.topbar-sync-btn.syncing .sync-dot {
  background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.8);
  animation: pulseSyncDot 0.8s infinite alternate ease-in-out;
}
.topbar-sync-btn.err .sync-dot {
  background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
}
.topbar-sync-btn.local .sync-dot {
  background: var(--muted); box-shadow: none;
}
@keyframes pulseSyncDot {
  from { opacity: 0.35; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.2); }
}

.pair-qr-wrap svg { display: block; border-radius: 12px; }

.statusbar {
  height: 26px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border-top: 1px solid var(--line); background: var(--bg2); font-size: 11.5px;
}
/* the player bar is fixed, so lift the status bar clear of it */
body.player-open .statusbar { margin-bottom: var(--player); }
.statusbar .net::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 5px; }
body.is-offline .statusbar .net::before { background: var(--err); }
.scrim { display: none; }

/* ---------- cards / grid ---------- */
.sec { margin-bottom: 18px; }
/* Horizontal shelves scroll sideways; a soft edge fade makes that obvious
   instead of leaving the last card looking accidentally clipped. */
.sec:has(> .vrow) { position: relative; }
.sec:has(> .vrow)::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 56px;
  pointer-events: none; opacity: 0; transition: opacity .18s;
  background: linear-gradient(to right, transparent, var(--bg));
}
.sec:has(> .vrow.can-scroll)::after { opacity: 1; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; padding: 0 2px; }
.sec-h h2 { display: flex; align-items: center; gap: 7px; font-size: .95rem; }
.sec-n { font-size: 11px; color: var(--muted); background: var(--panel2); border-radius: 6px; padding: 1px 6px; font-weight: 600; }
.sec-a { display: flex; gap: 5px; opacity: 0; transition: opacity .13s; }
.sec:hover .sec-a, .sec:focus-within .sec-a { opacity: 1; }
.sec-h:hover .sec-a { opacity: 1; }
.sel-all { font-size: 11px; color: var(--accent); cursor: pointer; font-weight: 600; }
/* Fixed-width cards. A single item must NOT stretch to fill the row, so every
   track in a horizontal shelf uses a real px width (never 1fr). */
.vgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.vrow {
  display: grid; gap: 12px; grid-auto-flow: column; grid-template-columns: none;
  grid-auto-columns: 264px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x proximity; padding: 2px 2px 8px; margin: -2px -2px 0;
}
.vrow::-webkit-scrollbar { height: 6px; }
.vrow > * { scroll-snap-align: start; }
.vrow:empty { display: none; }
.seeall { display: flex; justify-content: center; padding-top: 2px; }
body.cozy .vgrid, body.cozy .vrow { gap: 14px; }
body.cozy .vrow { grid-auto-columns: 292px; }

.vcard {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: var(--r); overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  transition: transform .18s cubic-bezier(0.16, 1, 0.3, 1), border-color .18s, box-shadow .18s; contain: content;
  will-change: transform;
}
.vcard:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,.36); border-color: var(--line2); }
.vcard.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.vcard.done .vcard-title { color: var(--muted); text-decoration: line-through; }
.vcard-thumb { position: relative; aspect-ratio: 16/9; background: var(--panel2); overflow: hidden; }
.vcard-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1;
  opacity: 1; transition: opacity .18s, transform .22s ease;
}
.vcard:hover .vcard-thumb img { transform: scale(1.03); }
.vcard-thumb img.img-fail { display: none !important; opacity: 0 !important; }
/* sits behind the image, so a missing/failed thumbnail still looks deliberate */
.vcard-fb {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 26px; color: var(--tx2); opacity: .45; pointer-events: none;
  background: radial-gradient(circle at center, rgba(255,255,255,0.06) 0%, transparent 70%);
}
.vcard-preview-wrap {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; overflow: hidden;
  animation: vcardPreviewFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1); background: #000;
}
.vcard-preview-iframe { width: 100%; height: 100%; border: 0; pointer-events: none; transform: scale(1.02); }
.vcard-preview-badge {
  position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,0.82); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px; z-index: 5; pointer-events: none;
  backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.2);
}
@keyframes vcardPreviewFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
/* global broken-image guard (see setupImageFallbacks in app.js) */
img.img-fail { display: none !important; }
.now-thumb, .audio-thumb, .ph-thumb, .pb-thumb, .q-thumb, .plc-thumbs img { background: var(--panel2); }
.vcard-dur {
  position: absolute; right: 5px; bottom: 5px; background: rgba(0,0,0,.8); color: #fff;
  font-size: 10.5px; font-weight: 600; padding: 1px 5px; border-radius: 4px; font-variant-numeric: tabular-nums;
  z-index: 5;
}
.vcard-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.18); z-index: 5; }
.vcard-prog i { display: block; height: 100%; }
.vcard-play {
  position: absolute; inset: 0; margin: auto; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: color-mix(in srgb, var(--accent) 92%, #fff); color: #fff; display: grid; place-items: center;
  font-size: 16px; opacity: 0; transform: scale(.8); transition: opacity .18s ease, transform .18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,.4); pointer-events: auto; cursor: pointer; z-index: 6;
}
.vcard:hover .vcard-play { opacity: 1; transform: scale(1); }
.vcard-sel {
  position: absolute; left: 5px; top: 5px; width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid rgba(255,255,255,.85); background: rgba(0,0,0,.45); color: #fff;
  font-size: 12px; cursor: pointer; display: grid; place-items: center; opacity: 0; padding: 0; z-index: 6;
}
.vcard:hover .vcard-sel, .vcard.selected .vcard-sel { opacity: 1; }
.vcard.selected .vcard-sel { background: var(--accent); border-color: #fff; }
.vcard-body { padding: 7px 9px 9px; display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.vcard-title {
  /* fixed 2-line box so every card in a row lines up, even for short titles */
  min-height: 2.6em;
  font-size: 12.8px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}
body.cozy .vcard-title { -webkit-line-clamp: 3; line-clamp: 3; }
.vcard-meta { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--tx2); overflow: hidden; white-space: nowrap; }
.vcard-meta > span:not(.chip):not(.dot) { overflow: hidden; text-overflow: ellipsis; }
.vcard-resume { font-size: 10.5px; color: var(--accent); font-weight: 600; }
.vcard-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.vcard-menu {
  position: absolute; right: 4px; top: 4px; width: 26px; height: 26px; border-radius: 6px; border: 0;
  background: rgba(0,0,0,.55); color: #fff; cursor: pointer; opacity: 0; font-size: 14px; line-height: 1;
}
.vcard:hover .vcard-menu { opacity: 1; }
.sec.drop { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: var(--r); }

/* ---------- toolbar & filters ---------- */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
  padding: 8px 10px; border-radius: var(--r); background: color-mix(in srgb, var(--panel) 85%, var(--bg));
  border: 1px solid var(--line); box-shadow: var(--sh2);
}
.tb-pills {
  display: flex; align-items: center; gap: 4px; overflow-x: auto;
  scrollbar-width: none; padding: 2px 0; max-width: 100%;
}
.tb-pills::-webkit-scrollbar { display: none; }
.tb-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel2);
  color: var(--tx2); font-size: 11.5px; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: all .14s cubic-bezier(0.16, 1, 0.3, 1); user-select: none;
}
.tb-pill:hover { border-color: var(--line2); color: var(--tx); transform: translateY(-1px); }
.tb-pill.active {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--panel2));
  color: var(--tx); font-weight: 650; box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 22%, transparent);
}
.tb-pill-badge {
  font-size: 10px; font-weight: 700; border-radius: 999px;
  background: var(--panel3); color: var(--muted); padding: 1px 6px;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.tb-pill.active .tb-pill-badge {
  background: var(--accent); color: #fff;
}
.tb-search-wrap {
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--panel2);
  color: var(--tx); position: relative; transition: border-color .15s, box-shadow .15s;
}
.tb-search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}
.tb-search-ico { color: var(--muted); display: grid; place-items: center; flex: none; }
.tb-search-input {
  border: 0; background: transparent; color: var(--tx); font-size: 12px;
  outline: none; width: 140px; transition: width .18s ease; font-family: inherit;
}
.tb-search-input:focus { width: 180px; }
.tb-search-clear {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 11px; padding: 0 2px; line-height: 1; display: grid; place-items: center;
}
.tb-search-clear:hover { color: var(--err); }
.tb-control {
  display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted);
}
.tb-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tb-select {
  height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--tx); outline: none; font-size: 12px;
  cursor: pointer; transition: border-color .15s;
}
.tb-select:hover { border-color: var(--line2); }
.tb-select:focus { border-color: var(--accent); }
.tb-reset-btn {
  height: 28px; padding: 0 9px; font-size: 11px; font-weight: 600;
  border-radius: 6px; color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--err) 30%, transparent); cursor: pointer;
  transition: all .14s;
}
.tb-reset-btn:hover { background: color-mix(in srgb, var(--err) 22%, transparent); color: #fff; }
.tb-count-hint { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; margin-right: 2px; }
.tb-right { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }

/* ---------- page header ---------- */
.page-h {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); margin-bottom: 14px;
}
.ph-thumb { width: 92px; border-radius: 8px; flex: none; }
.ph-icon { font-size: 26px; }
.ph-meta { flex: 1; min-width: 0; }
.ph-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.ph-a { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- selection bar ---------- */
.selbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--player) + 12px);
  z-index: 90; display: flex; align-items: center; gap: 6px; padding: 7px 9px;
  background: color-mix(in srgb, var(--panel) 96%, transparent); backdrop-filter: blur(14px);
  border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--sh); max-width: calc(100vw - 20px);
  flex-wrap: wrap; animation: pop .16s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 10px); } }
.selbar-n { font-size: 12.5px; font-weight: 700; padding: 0 6px; color: var(--accent); white-space: nowrap; }

/* ---------- menus / modals ---------- */
.menu {
  position: fixed; z-index: 120; min-width: 208px; max-height: 70vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; padding: 4px;
  box-shadow: var(--sh); animation: pop2 .12s ease-out;
}
@keyframes pop2 { from { opacity: 0; transform: scale(.97); } }
.menu-i {
  display: block; width: 100%; text-align: left; padding: 7px 9px; border: 0; border-radius: 6px;
  background: transparent; color: var(--tx); cursor: pointer; font-size: 12.8px; white-space: nowrap;
}
.menu-i:hover { background: var(--panel2); }
.menu-i.danger { color: var(--err); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }

/* ---------- sync header popover dropdown ---------- */
.sync-popover {
  position: fixed;
  z-index: 1000;
  width: 330px;
  max-width: calc(100vw - 20px);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  box-shadow: 0 16px 40px rgba(0,0,0,0.55), 0 0 0 1px var(--line);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: pop2 .14s cubic-bezier(0.16, 1, 0.3, 1);
}
.sync-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line2);
}
.sync-popover-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--tx);
  display: flex;
  align-items: center;
  gap: 7px;
}
.sync-popover-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .02em;
}
.sync-popover-pill.ok {
  background: rgba(16, 185, 129, 0.16);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.sync-popover-pill.syncing {
  background: rgba(34, 211, 238, 0.16);
  color: #22d3ee;
  border: 1px solid rgba(34, 211, 238, 0.35);
}
.sync-popover-pill.err {
  background: rgba(239, 68, 68, 0.16);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.sync-popover-pill.local {
  background: rgba(148, 163, 184, 0.16);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.sync-quota-card {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sync-quota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.sync-quota-lbl {
  color: var(--tx2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sync-quota-val {
  font-weight: 650;
  color: var(--tx);
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
}
.sync-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--panel3);
  overflow: hidden;
}
.sync-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .3s ease;
}

.sync-limits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 2px;
}
.sync-limit-item {
  background: color-mix(in srgb, var(--panel) 60%, transparent);
  border: 1px solid var(--line2);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sync-limit-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--tx);
  font-family: var(--font-mono, monospace);
}
.sync-limit-sub {
  font-size: 9.5px;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.sync-popover-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sync-popover-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--r2);
  border: 1px solid var(--line2);
  background: var(--panel2);
  color: var(--tx);
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .1s;
}
.sync-popover-btn:hover {
  background: var(--panel3);
  border-color: var(--line);
  transform: translateY(-1px);
}
.sync-popover-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.sync-popover-btn.primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, #fff);
}
.backdrop {
  position: fixed; inset: 0; z-index: 150; background: rgba(3,6,14,.72); backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s ease;
}
.backdrop.in { opacity: 1; }
.modal {
  width: min(560px, 100%); max-height: 86dvh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.45);
  transform: translateY(12px) scale(.96); opacity: 0; transition: transform .22s cubic-bezier(0.16, 1, 0.3, 1), opacity .22s ease;
  will-change: transform, opacity;
}
.backdrop.in .modal { transform: translateY(0) scale(1); opacity: 1; }
.modal.md { width: min(680px, 100%); } .modal.lg { width: min(760px, 100%); }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.modal-h h3 { font-size: 1rem; }
.modal-b { padding: 15px; overflow-y: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 15px; border-top: 1px solid var(--line); }
.confirm-msg { margin: 0; font-size: 13.5px; color: var(--tx2); }
.dlg { display: flex; flex-direction: column; gap: 11px; }
.opt-list { display: flex; flex-direction: column; gap: 6px; }
.opt {
  display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 9px 11px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg2); color: var(--tx);
}
.opt:hover { border-color: var(--line2); }
.opt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.opt span { font-size: 11.5px; }
/* settings rows: a real switch, never a squashed native checkbox */
.opt.toggle {
  flex-direction: row; align-items: center; justify-content: space-between; gap: 16px;
  padding: 11px 13px; background: var(--bg2);
}
.opt.toggle > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.opt.toggle strong { font-size: 13px; font-weight: 600; }
.opt.toggle span { font-size: 11.5px; line-height: 1.35; }
.opt.toggle input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 40px; height: 23px; flex: none; margin: 0; cursor: pointer; position: relative;
  background: var(--panel3); border: 1px solid var(--line2); border-radius: 999px;
  transition: background .16s, border-color .16s;
}
.opt.toggle input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4);
  transition: transform .16s;
}
.opt.toggle input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.opt.toggle input[type="checkbox"]:checked::after { transform: translateX(17px); }
.opt.toggle input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.shelf-pick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--tx); text-align: left;
}
.shelf-pick:hover { filter: brightness(1.15); }
.sp-icon { font-size: 17px; } .sp-name { font-weight: 650; font-size: 13px; }
.sp-count { font-size: 11px; color: var(--muted); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 27px; height: 27px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.sw.on { border-color: var(--tx); transform: scale(1.08); }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; min-height: 22px; }

/* ---------- hero / kpi ---------- */
.hero { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.hero-l { flex: 1 1 420px; min-width: 260px; }
.hero-r { flex: 1 1 300px; min-width: 250px; }
.hero-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 11px; }
.kpi-l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.kpi-v { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; margin: 1px 0; font-variant-numeric: tabular-nums; }
.kpi-s { font-size: 11px; color: var(--muted); }
.now {
  display: flex; align-items: center; gap: 11px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 11px; height: 100%;
}
.now.empty { color: var(--muted); font-size: 12.5px; justify-content: center; text-align: center; }
.now-thumb { width: 88px; aspect-ratio: 16/9; object-fit: cover; border-radius: 7px; flex: none; }
.now-meta { min-width: 0; flex: 1; }
.now-title { font-weight: 600; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.now-sub { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 11.5px; flex-wrap: wrap; }

/* ---------- stat cards / charts ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 13px;
  display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden;
}
.stat-l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.stat-v { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-s { font-size: 11.5px; color: var(--tx2); }
.stat-spark { margin-top: 5px; height: 30px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 15px; }
.card h3 { margin-bottom: 9px; color: var(--tx2); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; margin-bottom: 14px; }
.chart-card { min-width: 0; overflow: hidden; }
.chart { width: 100%; position: relative; }
.chart-tip {
  position: fixed; z-index: 300; background: #0b0f1a; color: #e8edf7; border: 1px solid #33405f;
  border-radius: 7px; padding: 5px 8px; font-size: 11.5px; pointer-events: none; opacity: 0;
  transition: opacity .1s; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,.4); max-width: 240px;
}
.chart-tip.show { opacity: 1; }
.goal-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: center; }
.goal-side { display: flex; flex-direction: column; gap: 8px; min-width: 190px; }
.mini-bar { height: 6px; border-radius: 4px; background: var(--panel2); overflow: hidden; min-width: 60px; }
.mini-bar i { display: block; height: 100%; border-radius: 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  padding: 6px 8px; border-bottom: 1px solid var(--line); font-weight: 650;
}
.table td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--panel2); }
.cell-title { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }

/* ---------- playlists ---------- */
.pl-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.pl-chip {
  flex: none; width: 168px; text-align: left; padding: 10px 12px; border-radius: var(--r); cursor: pointer;
  border: 1px solid; color: var(--tx);
}
.plc-n { font-size: 19px; font-weight: 700; }
.plc-t { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plc-s { font-size: 11px; color: var(--muted); }
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 11px; }
.pl-card { position: relative; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.plc-bar { height: 4px; }
.plc-head { padding: 10px 12px 7px; cursor: pointer; }
.plc-head h3 { font-size: 14px; }
.plc-head .muted { font-size: 11.5px; }
.plc-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 0 12px; }
.plc-thumbs img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 4px; }
.plc-a { display: flex; gap: 5px; padding: 9px 12px 11px; flex-wrap: wrap; }
.tag-card {
  display: flex; align-items: center; gap: 7px; padding: 9px 11px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; font-size: 12px;
}
.tag-card:hover { border-color: var(--accent); }
.tag-card .muted { flex: 1; font-size: 11px; }

/* ---------- notes / links / trash ---------- */
.searchbar { margin-bottom: 12px; max-width: 420px; }
.note-list, .link-list, .trash-list { display: flex; flex-direction: column; gap: 8px; }
.note-card, .link-card, .trash-row {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px;
}
.note-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.time-chip {
  background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--tx); border: 0;
  border-radius: 6px; padding: 2px 7px; font-size: 11.5px; font-weight: 650; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.note-video { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-body, .note-text { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.note-row { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.note-row:last-child { border-bottom: 0; }
.note-text { flex: 1; }
.link-t { font-weight: 600; font-size: 13.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-u { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-d { font-size: 12px; color: var(--tx2); margin: 3px 0; }
.link-a { display: flex; gap: 5px; margin-top: 7px; }
.trash-row { display: flex; align-items: center; gap: 9px; }
.trash-l { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- focus ---------- */
.focus-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 11px; margin-bottom: 14px; }
.pomo-card { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pomo-ring {
  width: 186px; height: 186px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) 0%, var(--panel2) 0); padding: 12px;
}
.pomo-in { width: 100%; height: 100%; border-radius: 50%; background: var(--panel); display: grid; place-items: center; }
.pomo-time { font-size: 2.5rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.pomo-phase { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 650; }
/* Settings: 2 comfortable columns, each card sized to its own content so the
   page never shows ragged half-empty boxes. */
/* Settings: multi-column masonry so a short card never leaves a tall gap
   underneath it (a grid would force every card in a row to the tallest height). */
/* Settings: Modern Dashboard & Horizontal Category Tab Architecture */
.settings-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  margin-top: 2px;
}
.settings-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 6px;
  box-shadow: var(--sh);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}
.settings-nav::-webkit-scrollbar { display: none; }

.settings-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r2);
  border: 1px solid transparent;
  background: transparent;
  color: var(--tx2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all .16s ease;
  user-select: none;
  white-space: nowrap;
  flex: none;
}
.settings-tab-btn:hover {
  color: var(--tx);
  background: var(--panel2);
  border-color: var(--line2);
  transform: translateY(-1px);
}
.settings-tab-btn.active {
  color: var(--tx);
  background: color-mix(in srgb, var(--accent) 14%, var(--panel2));
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 18%, transparent);
}
.settings-tab-icon {
  font-size: 15px;
  flex: none;
  line-height: 1;
}
.settings-tab-label {
  flex: none;
  line-height: 1.2;
}
.settings-tab-badge {
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel3);
  color: var(--tx3);
  font-weight: 700;
  letter-spacing: .02em;
}
.settings-tab-btn.active .settings-tab-badge {
  background: var(--accent);
  color: #fff;
}
.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.settings-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 20px;
  box-shadow: var(--sh);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-card-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line2);
}
.settings-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--tx);
}
.settings-card-desc {
  font-size: 12px;
  color: var(--tx2);
  line-height: 1.35;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line2);
}
.setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.setting-row:first-child {
  padding-top: 0;
}
.setting-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.setting-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--tx);
}
.setting-hint {
  font-size: 11.5px;
  color: var(--tx2);
  line-height: 1.35;
}
.setting-ctrl {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.setting-ctrl .input {
  min-width: 140px;
  height: 34px;
  padding: 0 10px;
}
.setting-ctrl .input.num {
  width: 85px;
  min-width: 85px;
}
.setting-ctrl .input.wide {
  min-width: 240px;
}
@media (max-width: 640px) {
  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .setting-ctrl {
    width: 100%;
    justify-content: flex-end;
  }
  .setting-ctrl .input.wide {
    width: 100%;
  }
}

/* Modern Physical Toggle Switch */
.switch-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.switch-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  width: 44px;
  height: 24px;
  background: var(--panel3);
  border: 1px solid var(--line);
  border-radius: 999px;
  position: relative;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.switch-thumb {
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform .22s cubic-bezier(0.34, 1.56, 0.64, 1), background .2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.35);
}
.switch-toggle input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 35%, transparent);
}
.switch-toggle input:checked + .switch-track .switch-thumb {
  transform: translateX(20px);
}
.switch-toggle input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Accent Preset Color Chips */
.accent-presets-grid {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.accent-chip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s, border-color .15s, box-shadow .15s;
  position: relative;
  padding: 0;
}
.accent-chip:hover {
  transform: scale(1.15);
}
.accent-chip.active {
  border-color: #ffffff;
  box-shadow: 0 0 10px currentColor;
  transform: scale(1.12);
}
.accent-chip.active::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Cloud Sync Hero Banner */
.sync-hero-card {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--panel)), var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  border-radius: var(--r);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sync-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.sync-hero-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--tx);
}
.sync-hero-pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.sync-hero-pill.ok { background: rgba(16, 185, 129, 0.16); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.sync-hero-pill.syncing { background: rgba(34, 211, 238, 0.16); color: #22d3ee; border: 1px solid rgba(34, 211, 238, 0.3); }
.sync-hero-pill.err { background: rgba(239, 68, 68, 0.16); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }
.sync-hero-pill.local { background: rgba(148, 163, 184, 0.16); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }

/* Storage & Telemetry Metrics */
.storage-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}
.storage-kpi {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.storage-kpi-val {
  font-size: 20px;
  font-weight: 750;
  color: var(--tx);
  font-family: var(--font-mono, monospace);
}
.storage-kpi-lbl {
  font-size: 11px;
  color: var(--tx2);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.storage-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--panel2);
  border-radius: var(--r2);
  border: 1px solid var(--line);
}
.storage-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--tx2);
}
.storage-progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--panel3);
  overflow: hidden;
}
.storage-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .3s ease;
}

/* Danger Zone Card */
.danger-zone-card {
  border-color: rgba(239, 68, 68, 0.35);
  background: color-mix(in srgb, #ef4444 3%, var(--panel));
}
.danger-zone-card .settings-card-title {
  color: #ef4444;
}

/* Legacy helper styles maintained */
.set-grid-cards { column-width: 380px; column-gap: 14px; }
.set-card { break-inside: avoid; display: inline-block; width: 100%; margin: 0 0 14px; }
.set-card h3 { margin-bottom: 12px; }
.set-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.set-grid .field { min-width: 0; }
.set-grid .opt { width: 100%; }

/* ---------- Settings Theme Cards Grid ---------- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--panel2);
  border: 2px solid var(--line);
  cursor: pointer;
  transition: transform .12s, border-color .15s, box-shadow .15s, background .15s;
  text-align: left;
}
.theme-card:hover {
  transform: translateY(-2px);
  border-color: var(--line2);
  box-shadow: var(--sh2);
}
.theme-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel2));
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 25%, transparent);
}
.theme-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.theme-card-icon {
  font-size: 20px;
}
.theme-card-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.theme-card-name {
  font-size: 13px;
  font-weight: 650;
  color: var(--tx);
}
.theme-card-desc {
  font-size: 11px;
  color: var(--tx2);
  line-height: 1.35;
  flex: 1;
}
.theme-preview-swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.theme-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex: none;
}

/* ---------- page layout ---------- */
.page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
}
@media (prefers-reduced-motion: reduce) {
  .toast, .modal, .vcard, .vcard-thumb img, .vcard-play { animation: none !important; transition: none !important; }
}

/* ---------- skeleton shimmer ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--panel2) 25%, var(--panel3) 50%, var(--panel2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r2);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.chart-skeleton { min-height: 160px; width: 100%; border-radius: var(--r); }
.skel-card { height: 180px; border-radius: var(--r); }
.skel-line { height: 14px; width: 60%; margin: 8px 0; border-radius: 4px; }
.skel-circle { width: 40px; height: 40px; border-radius: 50%; }

/* ---------- empty states & view hero ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--tx2); }
.empty-box, .empty-hero {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 28px; text-align: center; max-width: 520px; margin: 32px auto;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 16px;
  box-shadow: 0 16px 36px -12px rgba(0,0,0,.4), 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent);
  position: relative; overflow: hidden;
  transition: transform .2s ease, border-color .2s ease;
}
.empty-box:hover, .empty-hero:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}
.empty-glow, .empty-hero-icon {
  position: relative; width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel2)); color: var(--accent);
  margin-bottom: 16px; border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 20%, transparent);
}
.empty-hero-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: 2px 10px; border-radius: 20px; margin-bottom: 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.empty-title, .empty-hero-title {
  font-size: 1.25rem; font-weight: 700; margin: 0 0 8px; color: var(--tx);
  letter-spacing: -.015em;
}
.empty-desc, .empty-hero-desc {
  font-size: 13.5px; line-height: 1.55; margin: 0 0 22px; color: var(--muted);
  max-width: 420px;
}
.empty-hero-actions {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
}

/* ---------- unified view toolbar ---------- */
.view-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.view-toolbar .search-wrap {
  position: relative; flex: 1; max-width: 400px; min-width: 220px;
}
.view-toolbar .search-ico {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; display: flex; align-items: center;
}
.view-toolbar .search-input {
  padding-left: 32px; height: 34px; border-radius: var(--r2);
  border: 1px solid var(--line); background: var(--bg2); color: var(--tx);
  transition: border-color .15s, box-shadow .15s;
}
.view-toolbar .search-input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}
.view-toolbar .toolbar-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed; z-index: 400; bottom: calc(var(--player) + 16px); left: 50%;
  transform: translateX(-50%); display: flex; flex-direction: column; gap: 7px;
  align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 10px;
  padding: 9px 16px; font-size: 13px; font-weight: 500; box-shadow: var(--sh);
  opacity: 0; transform: translateY(10px) scale(0.96);
  transition: opacity .2s cubic-bezier(0.16, 1, 0.3, 1), transform .2s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90vw; pointer-events: auto;
}
.toast.in { opacity: 1; transform: none; }
.toast::before { font-size: 14px; font-weight: 700; flex: none; }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 60%, var(--line2)); background: color-mix(in srgb, var(--panel) 92%, var(--ok)); }
.toast.ok::before { content: '✓'; color: var(--ok); }
.toast.err { border-color: color-mix(in srgb, var(--err) 60%, var(--line2)); background: color-mix(in srgb, var(--panel) 92%, var(--err)); }
.toast.err::before { content: '✕'; color: var(--err); }
.toast.info { border-color: color-mix(in srgb, var(--accent) 60%, var(--line2)); }
.toast.info::before { content: 'ℹ'; color: var(--accent); }
.toast-act {
  margin-left: 8px; background: var(--accent); color: #fff;
  border: none; border-radius: 6px; padding: 3px 10px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .15s;
}
.toast-act:hover { opacity: 0.9; transform: translateY(-1px); }

/* ---------- accessible focus-visible ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.nav-i:focus-visible, .vcard:focus-visible, .toast-act:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- history timeline ---------- */
.hist-group { margin-bottom: 24px; }
.hist-date {
  font-size: 13px; font-weight: 700; color: var(--tx2);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding-bottom: 8px; margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-card {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color .15s, transform .15s;
}
.hist-card:hover { border-color: var(--line2); transform: translateX(2px); }
.hist-thumb {
  position: relative; width: 100px; aspect-ratio: 16/9;
  border-radius: var(--r2); overflow: hidden; flex: none; cursor: pointer;
}
.hist-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hist-bar {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: rgba(0,0,0,0.5);
}
.hist-prog { height: 100%; background: var(--accent); }
.hist-dur {
  position: absolute; right: 4px; bottom: 6px;
  background: rgba(0,0,0,.78); color: #fff;
  font-size: 10px; font-weight: 650; padding: 1px 5px;
  border-radius: 4px; font-variant-numeric: tabular-nums;
  line-height: 1.3; pointer-events: none;
}
.hist-info { flex: 1; min-width: 0; }
.hist-title {
  font-size: 13.5px; font-weight: 600; color: var(--tx);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
}
.hist-title:hover { color: var(--accent); }
.hist-sub {
  font-size: 11.5px; color: var(--muted); margin-top: 3px;
  display: flex; align-items: center; gap: 8px;
}
.hist-acts { display: flex; align-items: center; gap: 6px; flex: none; }

/* ---------- player bar ---------- */
.playerbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--player); z-index: 80;
  display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: color-mix(in srgb, var(--bg2) 90%, transparent); backdrop-filter: blur(16px);
  border-top: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  box-shadow: 0 -4px 20px rgba(0,0,0,.18);
}
.pb-info { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; cursor: pointer; }
.pb-thumb { width: 72px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; flex: none; }
.pb-meta { min-width: 0; }
.pb-title { font-size: 12.8px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-sub { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; overflow: hidden; }
.pb-ctl { display: flex; align-items: center; gap: 3px; flex: none; }
.pb-b {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--tx2);
  cursor: pointer; font-size: 14px; display: grid; place-items: center; flex: none;
  transition: background .14s ease, color .14s ease, transform .1s ease, box-shadow .14s ease;
}
.pb-b:hover { background: var(--panel2); color: var(--tx); transform: translateY(-1px); }
.pb-b:active { transform: translateY(0); }
.pb-b.on {
  background: color-mix(in srgb, var(--accent) 22%, var(--panel2));
  color: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 30%, transparent);
}
.pb-b.play { background: var(--accent); color: #fff; width: 36px; height: 36px; font-size: 16px; border-radius: 50%; box-shadow: 0 2px 10px rgba(99,102,241,.35); }
.pb-b.play:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); transform: scale(1.05); }
.pb-b.close:hover { background: color-mix(in srgb, var(--err) 25%, transparent); color: #fff; }

/* ---------- drag and drop backup restore overlay ---------- */
.drop-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  display: grid; place-items: center; pointer-events: none;
  animation: pageFadeIn .15s ease-out;
}
.drop-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 48px 64px;
  background: var(--panel);
  border: 2px dashed var(--accent);
  border-radius: var(--r);
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
  text-align: center;
  transform: scale(1.02);
  transition: transform .2s cubic-bezier(0.16, 1, 0.3, 1);
}
.drop-ico { font-size: 52px; }
.drop-title { font-size: 18px; font-weight: 700; color: var(--tx); }
.drop-sub { font-size: 13px; color: var(--muted); }
.pb-time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin: 0 6px; white-space: nowrap; font-weight: 500; }
.pb-prog { width: 160px; height: 6px; border-radius: 4px; background: var(--panel3); cursor: pointer; position: relative; }
.pb-prog i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .25s linear; position: relative; }
.pb-prog i::after {
  content: ''; position: absolute; right: -4px; top: -3px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 6px var(--accent); opacity: 0; transition: opacity .15s;
}
.pb-prog:hover i::after { opacity: 1; }

/* Miniplayer default: docked floating player in bottom-right corner */
.yt-stage {
  position: fixed; z-index: 85; right: 18px; bottom: calc(var(--player) + 14px);
  width: 360px; height: 202px; max-width: calc(100vw - 36px); background: #000;
  border-radius: var(--r); overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--line2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: width .22s cubic-bezier(0.16, 1, 0.3, 1),
              height .22s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius .22s ease,
              transform .18s ease;
  cursor: pointer;
}
.yt-stage:hover {
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--accent);
}
.yt-player-box {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 86; background: #000;
}
.yt-stage iframe, .yt-mount, .media-el, .yt-player-box iframe, .yt-player-box .yt-mount, .yt-player-box .media-el {
  width: 100% !important; height: 100% !important; border: 0 !important;
  display: block !important; background: #000;
}
/* Theater / Expanded mode fills the screen */
body.player-expanded .yt-stage {
  left: 0 !important; top: 0 !important; right: 0 !important; bottom: var(--player) !important;
  width: 100vw !important; height: auto !important; border-radius: 0 !important;
  box-shadow: none !important; cursor: default;
}
@media (max-width: 600px) {
  .yt-stage {
    width: calc(100vw - 24px); right: 12px; height: calc((100vw - 24px) * 9 / 16);
  }
}
.stage-overlay-bar {
  position: absolute; top: 14px; left: 18px; right: 18px; height: 48px;
  display: flex; align-items: center; gap: 14px; z-index: 95; pointer-events: auto;
  background: rgba(11, 15, 26, 0.88); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line2);
  border-radius: 12px; padding: 0 16px; box-shadow: 0 10px 32px rgba(0,0,0,0.55);
}
.stage-overlay-bar.mini {
  top: 8px; right: 8px; left: auto; height: 30px; padding: 0 6px;
  background: rgba(11, 15, 26, 0.88); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); border-radius: 8px; border: 1px solid var(--line2);
  gap: 6px; opacity: 0; transition: opacity .18s ease; z-index: 95;
}
.yt-stage:hover .stage-overlay-bar.mini {
  opacity: 1;
}
.stage-overlay-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stage-overlay-title { font-size: 13.5px; font-weight: 650; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-overlay-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-back-btn, .stage-close-btn { background: var(--panel2); border-color: var(--line2); color: var(--tx); font-size: 12px; cursor: pointer; }
.stage-back-btn:hover, .stage-close-btn:hover { background: var(--panel3); border-color: var(--accent); }
.media-wrap { width: 100%; height: 100%; display: grid; place-items: center; }
.audio-el { display: none; }
.audio-wrap { background: linear-gradient(135deg, var(--bg), var(--panel)); flex-direction: column; gap: 14px; }
.audio-card { display: flex; align-items: center; gap: 14px; padding: 20px; max-width: 520px; }
.audio-thumb { width: 108px; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; }
.audio-title { font-weight: 650; margin-bottom: 3px; }
.audio-sub { font-size: 12px; color: var(--muted); }
body.focus-mode .sidebar, body.focus-mode .topbar, body.focus-mode .statusbar, body.focus-mode .main { display: none; }
body.focus-mode .yt-stage { left: 0; top: 0; }
.stage-cc-btn, .stage-speed-btn {
  background: var(--panel2); border: 1px solid var(--line2); color: var(--tx); font-size: 12px; cursor: pointer; padding: 4px 9px; border-radius: 6px; display: inline-flex; align-items: center; gap: 5px; font-weight: 600;
}
.stage-cc-btn:hover, .stage-speed-btn:hover { background: var(--panel3); border-color: var(--accent); }
.stage-cc-btn.on { background: rgba(34, 211, 238, 0.2); border-color: #22d3ee; color: #22d3ee; }

/* ---------- Up Next / Queue Dialog ---------- */
.queue-dlg { display: flex; flex-direction: column; gap: 12px; }
.queue-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.queue-header-stats {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--tx2);
}
.q-count { font-weight: 700; color: var(--tx); }
.q-upnext-tag {
  background: rgba(34, 211, 238, 0.12); color: #22d3ee;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.q-total-time { color: var(--muted); font-size: 12px; }
.q-clear-btn {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 4px 10px;
  border-radius: 6px; background: transparent; border: 1px solid var(--line); color: var(--tx2);
  cursor: pointer; transition: all .15s ease;
}
.q-clear-btn:hover { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.4); color: #ef4444; }
.queue-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 58vh; overflow-y: auto; padding-right: 4px;
}
.queue-list::-webkit-scrollbar { width: 6px; }
.queue-list::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 3px; }

.q-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; background: var(--panel); border: 1px solid var(--line);
  cursor: pointer; transition: background .14s ease, border-color .14s ease, transform .1s ease;
  position: relative;
}
.q-row:hover {
  background: var(--panel2); border-color: rgba(34, 211, 238, 0.3); transform: translateY(-1px);
}
.q-row.on {
  background: rgba(34, 211, 238, 0.08); border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.1);
}
.q-row.past { opacity: 0.6; }
.q-row.past:hover { opacity: 0.9; }

.q-idx-col {
  width: 20px; display: flex; align-items: center; justify-content: center; flex: none;
}
.q-playing-dot {
  color: #22d3ee; font-size: 11px; animation: pulsePlay 1.5s infinite ease-in-out;
}
.q-idx-num { font-size: 12px; font-weight: 600; color: var(--muted); }

.q-thumb-wrap {
  width: 88px; height: 50px; aspect-ratio: 16/9; border-radius: 6px;
  overflow: hidden; position: relative; flex: none; background: #000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.q-thumb {
  width: 100% !important; height: 100% !important; object-fit: cover !important;
  display: block; pointer-events: none;
}
.q-dur {
  position: absolute; right: 4px; bottom: 3px; background: rgba(0, 0, 0, 0.82);
  color: #fff; font-size: 10px; font-weight: 600; padding: 1px 4px;
  border-radius: 3px; font-variant-numeric: tabular-nums;
}

.q-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.q-title {
  font-size: 13px; font-weight: 600; color: var(--tx); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.q-row:hover .q-title { color: #22d3ee; }
.q-sub {
  font-size: 11.5px; color: var(--muted); display: flex; align-items: center;
  gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.q-author { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-chip {
  background: rgba(34, 211, 238, 0.15); color: #22d3ee; font-size: 9.5px;
  padding: 1px 6px; border-radius: 4px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; flex: none;
}

.q-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.q-remove-btn {
  width: 28px; height: 28px; border-radius: 6px; border: 0; background: transparent;
  color: var(--muted); display: grid; place-items: center; cursor: pointer;
  transition: all .12s ease;
}
.q-remove-btn:hover {
  background: rgba(239, 68, 68, 0.15); color: #ef4444;
}

.q-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 36px 16px; color: var(--muted); gap: 10px;
}
.q-empty-ico { opacity: 0.45; color: var(--tx3); }
.q-empty-title { font-size: 15px; font-weight: 650; color: var(--tx); }
.q-empty-sub { font-size: 12.5px; max-width: 320px; line-height: 1.45; }

/* ---------- Playback Speed & Options Dropup ---------- */
.speed-popover {
  position: fixed; z-index: 1000;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line2); border-radius: 12px; padding: 12px;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
  animation: popoverSlideUp .16s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; flex-direction: column; gap: 10px;
}
.speed-popover-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.speed-popover-title {
  font-size: 11.5px; font-weight: 700; color: var(--tx);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.speed-rate-pill {
  font-size: 11px; font-weight: 700; color: #22d3ee;
  background: rgba(34, 211, 238, 0.12); padding: 2px 7px; border-radius: 999px;
}
.speed-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px;
}
.speed-chip {
  padding: 6px 2px; font-size: 11.5px; font-weight: 600; text-align: center;
  border-radius: 6px; border: 1px solid var(--line); background: var(--panel2);
  color: var(--tx2); cursor: pointer; transition: all .12s ease;
}
.speed-chip:hover {
  background: var(--panel3); color: var(--tx); border-color: rgba(34, 211, 238, 0.3);
}
.speed-chip.active {
  background: rgba(34, 211, 238, 0.18); border-color: #22d3ee; color: #22d3ee;
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.2); font-weight: 700;
}
.speed-adjust-row {
  display: flex; gap: 6px; justify-content: space-between;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.speed-step-btn {
  flex: 1; text-align: center; font-size: 11.5px; font-weight: 600; padding: 5px 0;
  border-radius: 6px; background: var(--panel2); border: 1px solid var(--line);
  color: var(--tx2); cursor: pointer; transition: all .12s ease;
}
.speed-step-btn:hover {
  background: var(--panel3); color: var(--tx); border-color: rgba(34, 211, 238, 0.3);
}
.speed-options-sec { display: flex; flex-direction: column; gap: 4px; }
.speed-opt-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 8px; border-radius: 7px; cursor: pointer;
  transition: background .12s ease;
}
.speed-opt-item:hover { background: var(--panel2); }
.speed-opt-lbl {
  display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--tx);
}
.speed-opt-toggle {
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--panel3); color: var(--muted); transition: all .15s ease;
}
.speed-opt-toggle.on {
  background: #10b981; color: #fff; box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
}
.speed-opt-sub { font-size: 11px; color: var(--tx3); font-weight: 500; }

@keyframes popoverSlideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulsePlay {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.9); }
}

/* ---------- keyboard shortcut sheet ---------- */
.sc-grid { display: grid; gap: 2px; }
.sc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 8px; border-radius: 7px; min-width: 0;
}
.sc-row:nth-child(odd) { background: color-mix(in srgb, var(--panel) 60%, transparent); }
.sc-row kbd {
  flex: none; min-width: 116px; text-align: center;
  font: 600 11.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 2px 7px; border-radius: 6px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--tx);
  white-space: nowrap;
}
.sc-d { font-size: 12.5px; color: var(--tx2); min-width: 0; }
@media (max-width: 480px) {
  .sc-row kbd { min-width: 96px; font-size: 10.5px; }
  .sc-d { font-size: 11.5px; }
}

/* ---------- empty chart state ---------- */
.chart-empty {
  min-height: 168px; display: grid; place-content: center; justify-items: center;
  gap: 8px; text-align: center; padding: 18px 14px;
  border: 1px dashed var(--line); border-radius: 12px;
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%);
}
.chart-empty-mark { color: var(--muted); opacity: .45; font-size: 26px; line-height: 1; }
.chart-empty p { margin: 0; font-size: 12.5px; color: var(--muted); max-width: 30ch; }

/* ---------- error boundary ---------- */
.err-panel { border-color: color-mix(in srgb, var(--err) 45%, var(--line)); }
.err-panel h2 { margin-bottom: 6px; font-size: 1.05rem; }
.err-detail {
  margin: 10px 0 14px; padding: 10px 12px; max-height: 190px; overflow: auto;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 9px;
  font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--tx2); white-space: pre-wrap; word-break: break-word;
}
.chart-skeleton { min-height: 200px; display: grid; place-items: center; color: var(--muted); font-size: 12.5px; }

/* ---------- responsive ---------- */
.only-mobile { display: none !important; }
@media (max-width: 1000px) {
  .search { width: 130px; }
  .pb-prog { width: 90px; }
}
/* ---------- mobile bottom navigation ---------- */
.mobile-nav { display: none; }

@media (max-width: 820px) {
  :root { --top: 50px; --player: 54px; }
  .only-desktop { display: none !important; }
  .only-mobile { display: inline-flex !important; }

  /* Mobile Slide-Over Sidebar Drawer */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px; max-width: 85vw;
    transform: translateX(-100%);
    box-shadow: 0 10px 40px rgba(0,0,0,0.65); z-index: 150;
    transition: transform .26s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg2);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.68);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); z-index: 140;
  }
  body.nav-collapsed .sidebar { width: 280px; }

  /* Mobile Topbar */
  .topbar { padding: 0 8px; gap: 6px; }
  .search, .search-box { display: none !important; }
  #btn-install, #btn-lock { display: none !important; }
  .topbar-sync-btn {
    height: 32px;
    padding: 0 8px;
    gap: 0;
  }
  .topbar-sync-btn #sync-badge { display: none !important; }
  .pastebar { min-height: 36px; padding: 0 4px 0 8px; }

  /* Mobile App Bottom Navigation Bar */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(52px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--line);
    z-index: 90;
    align-items: center;
    justify-content: space-around;
  }
  .mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--tx3);
    cursor: pointer;
    transition: color .15s ease, transform .12s ease;
    padding: 4px 0;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-nav-btn:hover { color: var(--tx); }
  .mobile-nav-btn.active { color: var(--accent); }
  .mobile-nav-ico { font-size: 18px; line-height: 1; }
  .mobile-nav-lbl { font-size: 10.5px; font-weight: 600; letter-spacing: .02em; }

  /* Layout adjustments for mobile bottom bar */
  .statusbar { display: none !important; }
  .playerbar {
    bottom: calc(52px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .main {
    padding-bottom: calc(var(--player) + 72px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .toasts {
    bottom: calc(64px + var(--player) + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Sync Dropdown Popover on Mobile */
  .sync-popover {
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-width: none !important;
    top: calc(var(--top) + 6px) !important;
  }

  /* Settings on Mobile */
  .settings-nav {
    padding: 4px;
    gap: 4px;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
  }
  .settings-tab-btn {
    padding: 7px 12px;
    font-size: 12px;
    gap: 6px;
  }
  .settings-tab-icon { font-size: 14px; }
  .settings-card { padding: 14px 12px; gap: 12px; }
  .sync-hero-card { padding: 14px 12px; }
  .storage-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .storage-kpi-val { font-size: 17px; }

  .page { padding: 10px 10px 24px; }
  .vgrid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 8px; }
  .vrow { grid-auto-columns: 178px; }
  .vcard-title { font-size: 12.2px; }
  .hero { gap: 8px; }
  .kpi-v { font-size: 1.15rem; }
  .chart-grid, .set-grid-cards, .focus-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .set-grid { grid-template-columns: 1fr; }
  .page-h { flex-wrap: wrap; padding: 10px 12px; }
  .toolbar { gap: 8px; padding: 6px 8px; }
  .tb-pills { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .tb-search-wrap { flex: 1 1 140px; }
  .tb-search-input { width: 100%; }
  .tb-search-input:focus { width: 100%; }
  .tb-control { flex: 1 1 120px; }
  .tb-control .tb-select { width: 100%; }
  .tb-right { width: 100%; margin-left: 0; justify-content: flex-end; }
  body.player-expanded .yt-stage { left: 0; top: var(--top); }
  .playerbar { padding: 0 7px; gap: 6px; }
  .pb-thumb { width: 54px; }
  .pb-b { width: 28px; height: 28px; font-size: 13px; }
  .pb-b.play { width: 32px; height: 32px; }
  .pb-prog, .pb-time { display: none; }
  .selbar { bottom: calc(var(--player) + 60px); padding: 6px; gap: 4px; justify-content: center; }
  .selbar .btn { padding: 0 8px; font-size: 11.5px; }
  .selbar .btn:nth-child(n+5):not(.danger) { display: none; }
  .modal { max-height: 90dvh; }
  .shelves-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .pl-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .pomo-ring { width: 160px; height: 160px; }
  .pomo-time { font-size: 2.1rem; }
}
@media (max-width: 680px) {
  .pb-secondary:not(.speed-btn) { display: none !important; }
  .pb-time { font-size: 10.5px; }
  .pb-thumb { width: 48px; }
  .speed-popover {
    width: calc(100vw - 20px) !important;
    left: 10px !important;
    bottom: calc(var(--player) + 8px) !important;
  }
}
@media (max-width: 480px) {
  .q-thumb-wrap { width: 72px; height: 41px; }
  .q-title { font-size: 12px; }
  .speed-grid { grid-template-columns: repeat(4, 1fr); }
  .vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .vcard-body { padding: 6px 7px 8px; }
  .vcard-title { font-size: 11.6px; -webkit-line-clamp: 2; line-clamp: 2; }
  .vcard-meta { font-size: 10.2px; }
  .pastebar { min-height: 34px; max-height: 132px; padding: 0 4px 0 8px; }
  .paste-input { font-size: 12px; padding: 7px 0; }
  .paste-ico { display: none; }
  .page { padding: 8px 8px 20px; }
  .ph-thumb { width: 62px; }
  .goal-wrap { gap: 10px; }
}
@media (hover: none) {
  .vcard-play { opacity: .92; width: 36px; height: 36px; }
  .vcard-sel, .vcard-menu { opacity: .9; }
  .sec-a { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media print { .sidebar, .topbar, .playerbar, .statusbar, .mobile-nav { display: none; } }
