/* ============ Goalkeep Music — dark theme ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: "Space Grotesk", "Inter", -apple-system, "Segoe UI", sans-serif;
  --bg: #0f1115;
  --bg2: #161a21;
  --bg3: #1f2530;
  --fg: #e8eaf0;
  --muted: #8a93a5;
  --accent: #3ecf8e;
  --accent2: #2aa871;
  --danger: #e05555;
  --border: #262d3a;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
  --radius: 12px;
  --playerbar-h: 84px;
  --tabbar-h: 56px;
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
h1, h2, h3, .brand span, .section-title {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
}
.stat b, .stat-tile b, .gate-card h1 { font-family: var(--font-display); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input[type="text"], input[type="search"] {
  font: inherit; color: var(--fg);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
}
input[type="text"]:focus, input[type="search"]:focus { border-color: var(--accent); }

/* ---- buttons ---- */
.btn { border-radius: 8px; padding: 10px 16px; font-weight: 600; }
.btn-primary { background: var(--accent); color: #08120d; }
.btn-primary:hover { background: var(--accent2); }
.btn-ghost { background: var(--bg3); color: var(--fg); }
.btn-ghost:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: .85rem; }

/* ---- sign-in gate ---- */
.gate {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 700px at 70% -10%, #1c2432 0%, var(--bg) 55%);
  z-index: 50;
}
.gate-card { text-align: center; padding: 40px; max-width: 400px; }
.gate-logo { width: 96px; height: 96px; margin-bottom: 18px; }
.gate-card h1 { margin-bottom: 8px; font-size: 1.6rem; }
.gate-card p { margin-bottom: 24px; }
.gate-card .btn { display: block; width: 100%; margin-bottom: 10px; }
.gate-msg { font-size: .85rem; min-height: 1.2em; margin-top: 8px; }

/* ---- shell layout ---- */
.shell { display: flex; height: 100vh; height: 100dvh; }
.sidenav {
  width: 220px; flex: none; background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 18px 10px; display: flex; flex-direction: column; gap: 2px;
}
.sidenav .brand {
  display: flex; align-items: center; gap: 10px; font-weight: 700;
  padding: 6px 12px 18px; font-size: .95rem; line-height: 1.25;
}
.sidenav .brand img { width: 28px; height: 28px; }
.sidenav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.sidenav a:hover { color: var(--fg); background: var(--bg3); }
.sidenav a.active { color: var(--fg); background: var(--bg3); }
.nico { width: 22px; text-align: center; }

.main {
  flex: 1; overflow-y: auto; padding: 24px 28px;
  padding-bottom: calc(var(--playerbar-h) + 30px);
}

/* ---- mobile tab bar ---- */
.tabbar { display: none; }

/* ---- in-app back button ---- */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--muted); font-size: .85rem; font-weight: 600;
  border-radius: 999px; padding: 7px 15px; margin-bottom: 14px;
}
.back-btn:hover { color: var(--fg); border-color: var(--accent); transform: translateX(-2px); }
.back-btn:active { transform: scale(.96); }

/* ---- headers & sections ---- */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 1.5rem; flex: 1; }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 22px 0 10px; }
.count-badge { color: var(--muted); font-size: .85rem; font-weight: 400; margin-left: 8px; }

/* ---- search ---- */
.search-wrap { position: relative; max-width: 560px; }
.search-wrap input { padding: 13px 16px; font-size: 1.05rem; border-radius: 12px; }

/* ---- grids ---- */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.card { cursor: pointer; }
.card .art {
  width: 100%; aspect-ratio: 1; border-radius: 10px; object-fit: cover;
  background: var(--bg3); display: block; box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.card .art-ph {
  width: 100%; aspect-ratio: 1; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 800; color: rgba(255,255,255,.85);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.card .c-title { margin-top: 8px; font-weight: 600; font-size: .92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .c-sub { color: var(--muted); font-size: .82rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card:hover .c-title { color: var(--accent); }

/* round artist tiles */
.card.artist .art, .card.artist .art-ph { border-radius: 50%; }
.card.artist { text-align: center; }

/* ---- letter index ---- */
.letter-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.letter-row button {
  padding: 4px 9px; border-radius: 6px; color: var(--muted); font-weight: 600; font-size: .85rem;
}
.letter-row button:hover { background: var(--bg3); color: var(--fg); }

/* ---- track rows ---- */
.trow {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.trow:hover { background: var(--bg2); }
.trow.playing { background: var(--bg3); }
.trow.playing .t-title { color: var(--accent); }
.t-num { width: 26px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.t-art { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--bg3); flex: none; }
.t-main { flex: 1; min-width: 0; }
.t-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-sub { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-tags { display: flex; gap: 4px; flex: none; max-width: 30%; overflow: hidden; }
.t-actions { flex: none; display: flex; gap: 2px; opacity: 0; }
.trow:hover .t-actions, .trow.playing .t-actions { opacity: 1; }
.t-actions button { padding: 6px; border-radius: 6px; color: var(--muted); }
.t-actions button:hover { color: var(--fg); background: var(--bg3); }

/* ---- album / artist detail hero ---- */
.hero { display: flex; gap: 24px; align-items: flex-end; margin-bottom: 22px; flex-wrap: wrap; }
.hero .art, .hero .art-ph {
  width: 200px; height: 200px; border-radius: 12px; object-fit: cover;
  background: var(--bg3); box-shadow: var(--shadow); flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 3rem; font-weight: 800;
}
.hero.artist-hero .art, .hero.artist-hero .art-ph { border-radius: 50%; }
.hero-info { flex: 1; min-width: 240px; }
.hero-info .kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--muted); }
.hero-info h2 { font-size: 1.9rem; margin: 6px 0 10px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }

/* ---- chips / tags ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px; font-size: .85rem; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip .x { color: var(--muted); font-weight: 700; padding: 0 2px; }
.chip .x:hover { color: var(--danger); }
.chip.mini { padding: 1px 8px; font-size: .72rem; pointer-events: none; }
.chip.big { padding: 10px 18px; font-size: 1rem; }
.chip .chip-count { color: var(--muted); font-size: .78rem; }

/* ---- player bar ---- */
.playerbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--playerbar-h);
  background: rgba(22,26,33,.97); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 18px; z-index: 30;
}
.pb-left { display: flex; align-items: center; gap: 12px; width: 26%; min-width: 160px; }
.pb-art { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; background: var(--bg3); }
.pb-meta { min-width: 0; }
.pb-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-artist { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-center { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pb-controls { display: flex; align-items: center; gap: 8px; }
.pbtn { font-size: 1.1rem; padding: 6px 10px; border-radius: 8px; color: var(--muted); }
.pbtn:hover { color: var(--fg); background: var(--bg3); }
.pbtn.active { color: var(--accent); }
.pbtn-big {
  font-size: 1.15rem; background: var(--fg); color: var(--bg);
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.pbtn-big:hover { background: #fff; color: var(--bg); transform: scale(1.04); }
.pb-seek { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 560px; }
.pb-time { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; width: 38px; }
.pb-right { display: flex; align-items: center; gap: 10px; width: 16%; min-width: 90px; justify-content: flex-end; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px;
  background: var(--border); flex: 1; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--fg); border: none;
}
#volume { width: 80px; flex: none; }

/* ---- queue drawer ---- */
.queue-drawer {
  position: fixed; right: 0; top: 0; bottom: var(--playerbar-h);
  width: 340px; max-width: 92vw; background: var(--bg2);
  border-left: 1px solid var(--border); z-index: 29;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.qd-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; padding-top: calc(16px + env(safe-area-inset-top)); border-bottom: 1px solid var(--border); }
.qd-list { flex: 1; overflow-y: auto; padding: 8px; }

/* ---- lyrics panel ---- */
.lyrics-panel {
  position: fixed; right: 0; top: 0; bottom: var(--playerbar-h);
  width: 460px; max-width: 100vw; background: var(--bg2);
  border-left: 1px solid var(--border); z-index: 29;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.lp-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
}
.lp-head h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lp-body { flex: 1; overflow-y: auto; padding: 30px 26px 40vh; text-align: center; }
.lp-line { font-size: 1.06rem; line-height: 1.5; padding: 7px 0; color: var(--muted); transition: color .25s, transform .25s; }
.lp-line.active { color: var(--fg); font-weight: 700; transform: scale(1.06); }
.lp-line.static { color: var(--fg); font-size: .95rem; padding: 3px 0; }
.lp-note { padding: 46px 12px; }
.lp-credit { font-size: .72rem; margin-top: 34px; }

/* ---- modals ---- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px;
  overflow-y: auto;              /* tall dialogs must never be unreachable */
}
.modal-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; width: 100%; max-width: 440px; box-shadow: var(--shadow);
  max-height: calc(100dvh - 32px); overflow-y: auto;
}
/* full-screen sheet on phones, with the actions always reachable */
@media (max-width: 560px) {
  .modal { padding: 0; align-items: stretch; }
  .modal-card {
    max-width: none; border-radius: 0; border: none;
    min-height: 100dvh; max-height: none;
    padding: 16px calc(16px + env(safe-area-inset-left)) 0 calc(16px + env(safe-area-inset-right));
    padding-top: calc(16px + env(safe-area-inset-top));
    display: flex; flex-direction: column;
  }
  .modal-actions {
    position: sticky; bottom: 0; margin-top: auto;
    background: var(--bg2); border-top: 1px solid var(--border);
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  }
  .modal-actions .btn { flex: 1; }
  .art-picker-grid, .add-results, .vm-ytresults { max-height: none; }
}
.modal-card h3 { margin-bottom: 12px; }
.tag-add-row { display: flex; gap: 8px; margin-top: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.pl-modal-list { max-height: 40vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.pl-modal-list button { text-align: left; padding: 10px 12px; border-radius: 8px; background: var(--bg3); }
.pl-modal-list button:hover { background: var(--border); }

/* ---- playlist covers ---- */
/* The hero cover also carries `.art` for sizing, and `.hero .art` sets the
   `background` shorthand — which resets background-size/position. These need
   matching specificity (and to come later) or the image renders at natural
   size in the box and you only see its top-left corner. */
.hero .pl-cover {
  background-image: linear-gradient(135deg, #2a3242, #171c25);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.pl-cover.has-art { font-size: 0; }
.pl-thumb {
  width: 40px; height: 40px; border-radius: 6px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
  background: var(--bg3); background-size: cover; background-position: center;
}
.pl-thumb.has-art { font-size: 0; }
.pl-actions { margin-top: 4px; }

/* cover editor */
.cover-stage { display: flex; justify-content: center; margin: 6px 0 10px; }
.cover-canvas {
  width: 280px; max-width: 100%; aspect-ratio: 1; border-radius: 12px;
  background: var(--bg3); cursor: grab; touch-action: none;
}
.cover-canvas:active { cursor: grabbing; }
.cover-drop {
  width: 280px; max-width: 100%; aspect-ratio: 1; border-radius: 12px;
  border: 2px dashed var(--border); background: var(--bg3);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; color: var(--muted); font-size: .88rem; padding: 16px;
}
.cover-drop.over { border-color: var(--accent); background: var(--bg2); }
.cd-icon { font-size: 2rem; }
.cd-link { color: var(--accent); cursor: pointer; text-decoration: underline; }
.cover-tools { display: flex; align-items: center; gap: 10px; }
.cover-tools input[type="range"] { flex: 1; }
.cover-hint { font-size: .76rem; margin-top: 8px; text-align: center; }

/* ---- search & add panel ---- */
.add-results {
  max-height: 52vh; overflow-y: auto; margin-top: 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.add-hint {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 12px 4px 4px;
}
.add-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.add-row:hover { background: var(--bg3); }
.add-kind { flex: none; font-size: .95rem; opacity: .8; }
.add-main { flex: 1; min-width: 0; }
.add-title { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.add-sub { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.add-btn { flex: none; }
.add-btn.added { color: var(--accent); border-color: var(--accent); }
#nameInput { margin-top: 4px; }

/* ---- artist photo picker ---- */
.modal-wide { max-width: 580px; }
.art-picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px; max-height: 52vh; overflow-y: auto; margin-top: 10px; padding: 2px;
}
.art-pick { cursor: pointer; border: 2px solid transparent; border-radius: 10px; padding: 5px; text-align: center; }
.art-pick:hover { background: var(--bg3); }
.art-pick.selected { border-color: var(--accent); }
.art-pick .art, .art-pick .art-ph {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 800; color: rgba(255,255,255,.85);
}
.hero-art-box { position: relative; flex: none; }
.hero-edit {
  position: absolute; right: 8px; bottom: 8px; width: 38px; height: 38px;
  border-radius: 50%; background: rgba(15,17,21,.88);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
  backdrop-filter: blur(6px); box-shadow: 0 2px 8px rgba(0,0,0,.45); z-index: 2;
}
.hero-edit:hover { border-color: var(--accent); transform: scale(1.06); }
.ap-name { font-size: .68rem; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- toast ---- */
.toast {
  position: fixed; bottom: calc(var(--playerbar-h) + 16px); left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--border); color: var(--fg);
  padding: 10px 18px; border-radius: 10px; z-index: 70; box-shadow: var(--shadow);
  font-size: .9rem; max-width: 90vw; text-align: center;
}

/* ---- settings / scan ---- */
.settings-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; max-width: 640px;
}
.settings-card h3 { margin-bottom: 8px; }
.settings-card p { margin-bottom: 12px; }
.progress-outer { background: var(--bg3); border-radius: 6px; height: 10px; overflow: hidden; margin: 10px 0; }
.progress-inner { background: var(--accent); height: 100%; width: 0%; transition: width .3s; }
.stat-row { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 8px; }
.stat { text-align: center; }
.stat b { display: block; font-size: 1.4rem; }
.stat span { color: var(--muted); font-size: .8rem; }

/* ---- videos ---- */
.vgrid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.vcard { cursor: pointer; transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.vcard:hover { transform: translateY(-4px); }
.vcard:hover .c-title { color: var(--accent); }
.vthumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, #1c2430, #12161d);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  transition: box-shadow .25s;
}
.vcard:hover .vthumb { box-shadow: 0 12px 28px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.07); }
.vthumb img { width: 100%; height: 100%; object-fit: cover; }
.vplay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.8);
  background: rgba(0,0,0,.12); opacity: .85; transition: opacity .2s, background .2s;
}
.vcard:hover .vplay { opacity: 1; background: rgba(0,0,0,.3); }
.vsize {
  position: absolute; right: 6px; bottom: 6px; font-size: .68rem; font-weight: 600;
  background: rgba(0,0,0,.7); color: #fff; border-radius: 5px; padding: 2px 6px;
}
.vcard .c-title { margin-top: 8px; }
.v-extra { display: none; font-size: .74rem; color: var(--muted); }
.vkind {
  position: absolute; left: 6px; bottom: 6px; font-size: .64rem; font-weight: 600;
  background: rgba(62,207,142,.9); color: #06130c; border-radius: 5px; padding: 2px 6px;
}
.v-edited { font-size: .7rem; color: var(--accent); }
.vcard { position: relative; }
.v-edit {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(15,17,21,.86); border: 1px solid var(--border);
  color: var(--muted); font-size: .8rem; opacity: 0;
  display: flex; align-items: center; justify-content: center;
}
.vcard:hover .v-edit { opacity: 1; }
.v-edit:hover { color: var(--fg); border-color: var(--accent); }
@media (hover: none) { .v-edit { opacity: 1; } }
.vgrid.list .v-edit { position: static; opacity: 1; flex: none; margin-left: auto; }

/* video details editor */
.vm-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.vm-thumb {
  width: 108px; aspect-ratio: 16/9; border-radius: 8px; flex: none;
  background: var(--bg3) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.vm-file { min-width: 0; }
.vm-filename { font-size: .78rem; word-break: break-word; color: var(--fg); }
.vm-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vm-form label, .vm-notes {
  display: flex; flex-direction: column; gap: 4px;
  font-size: .76rem; color: var(--muted);
}
.vm-notes { margin-top: 10px; }

/* combo field: free text plus a picker that works on iOS (datalist doesn't) */
.vm-combo { display: flex; gap: 6px; align-items: stretch; }
.vm-combo input { flex: 1; min-width: 0; }
.vm-combo-btn {
  flex: none; width: 40px; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border); color: var(--muted);
  font-size: .9rem; line-height: 1;
}
.vm-combo-btn:hover { color: var(--fg); border-color: var(--accent); }
.vm-picker {
  margin-top: 6px; max-height: 210px; overflow-y: auto;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  display: flex; flex-direction: column; padding: 4px;
  -webkit-overflow-scrolling: touch;
}
.vm-pick-opt {
  text-align: left; padding: 9px 10px; border-radius: 6px;
  font-size: .9rem; color: var(--fg);
}
.vm-pick-opt:hover, .vm-pick-opt:active { background: var(--bg2); color: var(--accent); }
.vm-pick-note { padding: 8px 10px; font-size: .74rem; color: var(--muted); }
.vm-tags { margin-top: 12px; }
.vm-taglabel { font-size: .76rem; color: var(--muted); margin-bottom: 4px; }
.vm-tags .chips { margin: 0 0 8px; min-height: 26px; }
.vm-tags .tag-add-row { margin-top: 0; }
#vmFilename { color: var(--muted); font-size: .8rem; }

/* YouTube source lookup */
.vm-yt { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.vm-ytactions { display: flex; gap: 8px; }
.vm-ytlinked {
  background: rgba(229,57,53,.1); border: 1px solid rgba(229,57,53,.35);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 10px;
}
.vm-ytlink { color: var(--accent); font-size: .88rem; font-weight: 600; display: block; }
.vm-ytlink:hover { text-decoration: underline; }
.vm-ytmeta { font-size: .74rem; color: var(--muted); margin-top: 3px; }
.vm-ytuse { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.vm-ytresults { max-height: 260px; overflow-y: auto; margin-top: 8px; }
.vm-ytrow {
  display: flex; gap: 10px; align-items: center; padding: 6px;
  border-radius: 8px; cursor: pointer;
}
.vm-ytrow:hover { background: var(--bg3); }
.vm-ytrow img { width: 80px; border-radius: 5px; flex: none; }
.vm-ytrowmain { min-width: 0; }
.vm-ytrowtitle { font-size: .84rem; line-height: 1.35; }
.vyt {
  position: absolute; right: 6px; bottom: 6px; z-index: 3;
  background: #e53935; color: #fff; font-size: .62rem; font-weight: 700;
  border-radius: 5px; padding: 2px 6px; text-decoration: none;
}
.vyt:hover { background: #ff5350; }
.vm-form input, .vm-form select, .vm-notes textarea {
  font: inherit; font-size: .9rem; color: var(--fg); background: var(--bg3);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%;
  resize: vertical;
}
.vm-form input:focus, .vm-form select:focus, .vm-notes textarea:focus { border-color: var(--accent); outline: none; }
@media (max-width: 560px) { .vm-form { grid-template-columns: 1fr; } }

/* toolbar: filter + sort + view switch */
.vid-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.vid-toolbar #vidFilter { max-width: 260px; }
.view-seg { display: flex; gap: 2px; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.view-seg button {
  padding: 5px 10px; border-radius: 6px; color: var(--muted); font-size: .9rem; line-height: 1;
}
.view-seg button:hover { color: var(--fg); }
.view-seg button.active { background: var(--bg2); color: var(--accent); }

/* view modes */
.vgrid.large { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.vgrid.list { display: flex; flex-direction: column; gap: 2px; }
.vgrid.list .vcard {
  display: flex; align-items: center; gap: 14px;
  padding: 7px 8px; border-radius: 8px;
}
.vgrid.list .vcard:hover { background: var(--bg2); transform: none; }
.vgrid.list .vthumb { width: 132px; flex: none; }
.vgrid.list .vplay { font-size: 1.1rem; }
.vgrid.list .vsize { display: none; }
.vgrid.list .vmeta { flex: 1; min-width: 0; }
.vgrid.list .c-title { margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vgrid.list .v-extra { display: block; }

/* theater overlay */
.video-overlay {
  position: fixed; inset: 0; z-index: 90; background: #000;
  display: flex; flex-direction: column;
}
.vo-top {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 18px; padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(15,17,21,.9);
}
.vo-title { font-weight: 600; font-family: var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#videoEl { flex: 1; width: 100%; min-height: 0; background: #000; outline: none; }

/* ---- stats page ---- */
.quick-links { margin-top: 14px; }
.stat-tiles { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.stat-tile {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; flex: 1; min-width: 118px;
}
.stat-tile b { display: block; font-size: 1.45rem; }
.stat-tile span { color: var(--muted); font-size: .76rem; }
.stat-tile.link { cursor: pointer; }
.stat-tile.link:hover { border-color: var(--accent); }
.stats-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 6px 32px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 8px; }
a.rank-row:hover { background: var(--bg2); }
a.rank-row:hover .rank-label { color: var(--accent); }
.rank-n { width: 20px; text-align: right; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; flex: none; }
.rank-main { flex: 1; min-width: 0; }
.rank-label { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-bar { height: 6px; background: var(--bg3); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.rank-bar > div { height: 100%; background: var(--accent); border-radius: 3px; }
.rank-bar > div.alt { background: #d4a017; }
.rank-val { color: var(--muted); font-size: .8rem; white-space: nowrap; flex: none; }

/* ---- favorites ---- */
.card-fav {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  font-size: .8rem; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6));
  pointer-events: none;
}
.fav-btn.on { border: 1px solid #d4a017; color: #ffd54f; }

/* ---- YouTube Music badges ---- */
.card { position: relative; }
.card-yt {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: #e53935; color: #fff; font-size: .62rem; font-weight: 700;
  border-radius: 6px; padding: 2px 6px; box-shadow: 0 2px 6px rgba(0,0,0,.5);
  pointer-events: none;
}
.yt-badge { font-size: .72rem; border-radius: 5px; padding: 1px 5px; margin-left: 6px; text-decoration: none; }
.yt-badge.on { background: #e53935; color: #fff; }
.yt-badge.on:hover { background: #ff5350; }
.yt-badge.off { opacity: .55; cursor: default; }
.yt-status { font-size: .86rem; padding: 8px 10px; border-radius: 8px; margin-bottom: 10px; }
.yt-status.on { background: rgba(229,57,53,.12); border: 1px solid rgba(229,57,53,.4); }
.yt-status.off { background: var(--bg3); border: 1px solid var(--border); }
.yt-status a { color: var(--accent); margin-left: 6px; }
.yt-status a:hover { text-decoration: underline; }
.vol-hint { font-size: .74rem; color: var(--muted); }
#btnCollapse { display: none; }

.yt-filter {
  font: inherit; color: var(--fg); background: var(--bg3);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}

/* ---- album detail: tracklist + info card ---- */
.album-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.info-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; position: sticky; top: 0;
}
.info-card h3 { margin-bottom: 10px; font-size: 1rem; }
.info-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .86rem;
}
.info-row span { color: var(--muted); flex: none; }
.info-row b { text-align: right; font-weight: 600; }
.info-extract { font-size: .87rem; line-height: 1.55; margin: 12px 0 4px; }
.info-link { display: block; color: var(--accent); font-size: .85rem; margin-top: 10px; }
.info-link:hover { text-decoration: underline; }
@media (max-width: 980px) {
  .album-body { grid-template-columns: 1fr; }
  .info-card { position: static; }
}

/* ---- empty states ---- */
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .big { font-size: 2.4rem; margin-bottom: 10px; }

/* ============ modern polish: gradients, glass, motion ============ */

/* -- gradient display text -- */
.page-head h2, .hero-info h2 {
  background: linear-gradient(180deg, #ffffff 20%, #aab4c4 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.brand span, .gate-card h1 {
  background: linear-gradient(100deg, #3ecf8e 0%, #38bdf8 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* -- glowing gradient play controls -- */
.pbtn-big {
  background: linear-gradient(135deg, #46e39d, #23a06a);
  color: #06130c;
  box-shadow: 0 0 18px rgba(62, 207, 142, .35), 0 4px 12px rgba(0, 0, 0, .4);
}
.pbtn-big:hover {
  background: linear-gradient(135deg, #5aeeab, #2bb87b);
  color: #06130c;
  box-shadow: 0 0 26px rgba(62, 207, 142, .5), 0 4px 14px rgba(0, 0, 0, .4);
  transform: scale(1.06);
}
.btn-primary {
  background: linear-gradient(135deg, #46e39d, #27ab72);
  box-shadow: 0 2px 10px rgba(62, 207, 142, .22);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #5aeeab, #2bb87b);
  box-shadow: 0 4px 16px rgba(62, 207, 142, .35);
}

/* -- glass player bar: lifted off the page with a gradient + top highlight -- */
.playerbar {
  background: linear-gradient(180deg, rgba(40, 49, 63, .82) 0%, rgba(19, 23, 30, .9) 100%);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border-top: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .45);
}

/* -- cards & surfaces: soft top-light sheen -- */
.settings-card, .info-card, .stat-tile, .modal-card, .yt-status {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 45%);
  border-color: rgba(255, 255, 255, .07);
}

/* -- hover lifts & glows -- */
.card { transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.card:hover { transform: translateY(-4px); }
.card .art, .card .art-ph { transition: box-shadow .25s; }
.card:hover .art, .card:hover .art-ph {
  box-shadow: 0 12px 28px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .07);
}
.trow { transition: background .15s; }
.btn, .pbtn, .chip { transition: background .15s, color .15s, border-color .15s, box-shadow .2s, transform .12s; }
.btn:active, .pbtn:active, .chip:active { transform: scale(.96); }
.stat-tile { transition: transform .2s, border-color .2s; }
.stat-tile.link:hover { transform: translateY(-2px); }

/* -- active nav accent -- */
.sidenav a.active { box-shadow: inset 3px 0 0 var(--accent); color: var(--fg); }

/* -- panel & modal entrances -- */
@keyframes slideInRight { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes popIn { from { transform: scale(.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes growBar { from { width: 0; } }
.queue-drawer:not(.hidden), .lyrics-panel:not(.hidden) { animation: slideInRight .28s cubic-bezier(.2, .8, .2, 1); }
.modal-card { animation: popIn .2s cubic-bezier(.2, .8, .2, 1); }
.main > * { animation: fadeUp .3s ease both; }
.rank-bar > div { animation: growBar .7s cubic-bezier(.2, .8, .2, 1); }
.toast:not(.hidden) { animation: popIn .18s ease; }

/* -- slim modern scrollbars -- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* touch devices have no hover — row actions must always be visible */
@media (hover: none) {
  .t-actions { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============ responsive ============ */
@media (max-width: 760px) {
  .sidenav { display: none; }
  .main {
    padding: 16px;
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-bottom: calc(var(--playerbar-h) + var(--tabbar-h) + 30px);
  }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabbar-h);
    background: var(--bg2); border-top: 1px solid var(--border); z-index: 31;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; font-size: 1.05rem; color: var(--muted);
  }
  .tabbar a span { font-size: .62rem; }
  .tabbar a.active { color: var(--accent); }
  .toast { bottom: calc(var(--tabbar-h) + 80px); }
  .queue-drawer { bottom: calc(var(--tabbar-h) + 64px); }
  .lyrics-panel { bottom: calc(var(--tabbar-h) + 64px); width: 100vw; }

  /* ---- collapsed mini bar: art, what's playing, play/next ---- */
  .playerbar {
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    height: 64px; padding: 0 12px; gap: 10px;
    /* opaque (nothing bleeds through) and clearly lighter than the page behind it */
    background: linear-gradient(180deg, #2a3242 0%, #191f28 100%);
    border-top: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .55);
  }
  .pb-left { width: auto; flex: 1; min-width: 0; gap: 10px; }
  .pb-art { width: 44px; height: 44px; }
  .pb-title { font-size: .9rem; }
  .pb-artist { font-size: .76rem; }
  .pb-center { flex: none; }
  .pb-seek { display: none; }
  .pb-right { display: none; }
  .pb-controls { gap: 2px; }
  #btnShuffle, #btnRepeat, #btnPrev, #btnLyrics, #btnCollapse { display: none; }
  .t-tags { display: none; }   /* chips get clipped on narrow rows */
  .pbtn-big { width: 38px; height: 38px; }

  /* ---- expanded "now playing" sheet ---- */
  .playerbar.expanded {
    inset: 0; height: 100dvh; width: 100vw; z-index: 40;
    flex-direction: column; justify-content: center; gap: 22px;
    padding: calc(env(safe-area-inset-top) + 56px) 26px calc(env(safe-area-inset-bottom) + 34px);
    background: linear-gradient(180deg, #1b2230 0%, var(--bg) 65%);
    border-top: none;
  }
  .playerbar.expanded .pb-left {
    flex: none; width: 100%; flex-direction: column; gap: 22px; text-align: center;
  }
  .playerbar.expanded .pb-art {
    width: min(70vw, 290px); height: auto; aspect-ratio: 1;
    border-radius: 16px; box-shadow: 0 18px 46px rgba(0,0,0,.6);
  }
  .playerbar.expanded .pb-meta { width: 100%; min-width: 0; }
  .playerbar.expanded .pb-title { font-size: 1.2rem; white-space: normal; line-height: 1.3; }
  .playerbar.expanded .pb-artist { font-size: .92rem; white-space: normal; }
  .playerbar.expanded .pb-center { width: 100%; flex: none; gap: 14px; }
  /* seek above the transport controls, as in every other music app */
  .playerbar.expanded .pb-seek { display: flex; width: 100%; max-width: none; order: -1; }
  .playerbar.expanded .pb-controls { gap: 16px; }
  .playerbar.expanded .pbtn { font-size: 1.35rem; }
  .playerbar.expanded .pbtn-big { width: 66px; height: 66px; font-size: 1.5rem; }
  .playerbar.expanded #btnShuffle,
  .playerbar.expanded #btnRepeat,
  .playerbar.expanded #btnPrev,
  .playerbar.expanded #btnLyrics { display: flex; }
  .playerbar.expanded #btnCollapse {
    display: block; position: absolute; left: 14px; font-size: 1.7rem;
    top: calc(env(safe-area-inset-top) + 8px);
  }
  .playerbar.expanded .pb-right {
    display: flex; width: 100%; justify-content: center; align-items: center;
    flex-wrap: wrap; gap: 12px; min-width: 0;
  }
  .playerbar.expanded #volume { display: block; width: 120px; flex: none; }
  .playerbar.expanded #btnMute { display: flex; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
  .hero .art, .hero .art-ph { width: 140px; height: 140px; font-size: 2rem; }
  .hero-info h2 { font-size: 1.4rem; }
  .main::-webkit-scrollbar { display: none; }
}
