/* =====================================================================
   JellyTune — design tokens (light theme)

   Palette:  warm paper base, deep walnut text, burnished copper accent.
             Not pure white — a hint of cream keeps things from feeling
             clinical. Copper rather than orange for editorial weight.
   Type:     Fraunces (display serif) + IBM Plex Sans (body), with strong
             CJK fallbacks for the Japanese / Chinese library.
   ===================================================================== */
:root {
  --bg-0: #faf7f0;        /* paper */
  --bg-1: #f3eee1;        /* surface */
  --bg-2: #ece6d4;        /* elevated surface */
  --bg-3: #ded6bf;        /* pressed / strong surface */
  --line: #c5bca4;
  --line-soft: #ddd5c0;
  --text: #1a1611;        /* near-black with warmth */
  --text-dim: #655b4a;
  --text-faint: #9a917c;
  --accent: #a86921;      /* deep amber / copper — reads on cream */
  --accent-hi: #c27e2f;
  --accent-ink: #ffffff;
  --danger: #b54733;
  --ok: #4f7a3a;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  --shadow: 0 30px 60px -30px rgba(70, 55, 35, .22),
            0 10px 30px -15px rgba(70, 55, 35, .16);
  --shadow-sm: 0 6px 16px -8px rgba(70, 55, 35, .18);

  --bar-h: 72px;
  --nav-w: 240px;

  --ff-display: "Fraunces", "Songti SC", "Noto Serif CJK SC", "STZhongsong",
                ui-serif, Georgia, serif;
  --ff-body: "IBM Plex Sans", "Hiragino Sans", "Noto Sans CJK SC",
             "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
             "Segoe UI", Roboto, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg-0); }
html { -webkit-text-size-adjust: 100%; }
body {
  color: var(--text);
  font-family: var(--ff-body);
  font-size: 15px;
  line-height: 1.45;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;      /* iOS: no pull-to-refresh */
  touch-action: manipulation;     /* iOS: no double-tap zoom */
}

/* Subtle warm glow so the paper background isn't flat. */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1200px 700px at 85% -10%, rgba(217, 160, 84, .12), transparent 60%),
    radial-gradient(900px 600px at -5% 110%, rgba(181, 102, 48, .10), transparent 60%);
}

input, button, select, textarea {
  font: inherit; color: inherit;
  background: none; border: 0;
}
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ol, ul { list-style: none; margin: 0; padding: 0; }
progress { -webkit-appearance: none; appearance: none; }

/* Scrollbars on desktop / Windows — leave iOS defaults alone. */
@media (hover: hover) and (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--line); }
  ::-webkit-scrollbar-track { background: transparent; }
}

::selection { background: rgba(168, 105, 33, .25); color: var(--text); }

/* =====================================================================
   App shell layout
   Desktop: sidebar + main + docked bar at bottom.
   Mobile:  bottom tab bar + main + docked bar stacked above it.
   ===================================================================== */
.app-root {
  position: relative;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "nav  main"
    "nav  bar";
}

.nav {
  grid-area: nav;
  position: sticky; top: 0;
  height: 100dvh;
  padding: calc(20px + var(--safe-top)) 18px calc(20px + var(--safe-bot));
  padding-left: calc(18px + var(--safe-left));
  background: linear-gradient(180deg, var(--bg-1), rgba(243, 238, 225, .5));
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 14px;
  z-index: 10;
}
.nav__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 16px;
}
.nav__mark {
  width: 28px; height: 28px; border-radius: 8px;
  background:
    radial-gradient(circle at 35% 35%, #f1b865, #c27e2f 55%, #7a4512);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 6px 18px -6px rgba(168, 105, 33, .5);
}
.nav__name {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: .5px;
  font-variation-settings: "opsz" 144;
}
.nav__list { display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  width: 100%;
  border-radius: var(--r-md);
  color: var(--text-dim);
  font-size: 14px;
  transition: color .15s ease, background .15s ease;
}
.nav__item svg { width: 20px; height: 20px; flex: 0 0 auto; }
.nav__item:hover { color: var(--text); background: var(--bg-2); }
.nav__item[aria-selected="true"] {
  color: var(--text);
  background: var(--bg-2);
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav__foot { margin-top: auto; }

.search {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 9px 12px;
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
.search:focus {
  border-color: var(--accent);
  background: var(--bg-1);
}
.search::placeholder { color: var(--text-faint); }

.main {
  grid-area: main;
  min-width: 0;
  padding: calc(24px + var(--safe-top)) 32px 140px;
  padding-right: calc(32px + var(--safe-right));
  position: relative;
  z-index: 1;
}

/* =====================================================================
   View headers (reusable)
   ===================================================================== */
.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.view-head h1 {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: clamp(28px, 3.2vw, 44px);
  letter-spacing: -.01em;
  line-height: 1.05;
  margin: 0;
  font-variation-settings: "opsz" 144;
}
.view-head .sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 6px;
}
.view-head .actions { display: flex; gap: 10px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  transition: transform .1s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--bg-3); border-color: var(--line); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 600;
}
.btn--primary:hover { background: var(--accent-hi); }
.btn--ghost { background: transparent; }

.linkbtn { color: var(--accent); font-size: 13px; }
.linkbtn:hover { color: var(--accent-hi); }

/* =====================================================================
   Generic grids & rows
   ===================================================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 22px 18px;
}
.tile {
  cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  border-radius: var(--r-md);
  padding: 6px;
  transition: background .15s ease, transform .15s ease;
}
.tile:hover { background: rgba(168, 105, 33, .06); transform: translateY(-2px); }
.tile__art {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  box-shadow: var(--shadow-sm);
}
.tile__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile__art--round { border-radius: 50%; }
.tile__play {
  position: absolute;
  right: 10px; bottom: 10px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid; place-items: center;
  opacity: 0; transform: translateY(8px);
  transition: opacity .15s ease, transform .15s ease;
  box-shadow: 0 10px 24px -6px rgba(168, 105, 33, .5);
}
.tile:hover .tile__play { opacity: 1; transform: translateY(0); }
.tile__play svg { width: 18px; height: 18px; }
.tile__title {
  font-size: 14px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile__sub {
  color: var(--text-dim);
  font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Song list rows */
.rows { display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: 36px 40px 1fr 1fr 80px 36px 36px;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text);
  transition: background .12s ease;
}
.row:hover { background: var(--bg-2); }
.row.is-playing { color: var(--accent); }
.row.is-playing .row__idx .idx { display: none; }
.row.is-playing .row__idx .mark { display: inline-block; }
.row__idx { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.row__idx .mark { display: none; }
.row:hover .row__idx .idx { display: none; }
.row:hover .row__idx .play { display: inline-flex; }
.row__idx .play {
  display: none;
  width: 24px; height: 24px;
  color: var(--text);
}
.row__idx .play svg { width: 16px; height: 16px; }
.row__art {
  width: 40px; height: 40px;
  border-radius: 6px; overflow: hidden;
  background: var(--bg-2);
}
.row__art img { width: 100%; height: 100%; object-fit: cover; }
.row__name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px;
}
.row__artist {
  color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px;
}
.row__dur {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  font-size: 13px;
  text-align: right;
}
.row__heart {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  color: var(--text-faint);
  transition: color .15s ease, background .15s ease;
}
.row__heart:hover { color: var(--text); background: var(--bg-3); }
.row__heart[data-on="true"] { color: var(--accent); }
.row__heart svg { width: 18px; height: 18px; }

.row__more {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  color: var(--text-faint);
}
.row__more:hover { color: var(--text); background: var(--bg-3); }
.row__more svg { width: 18px; height: 18px; }

/* Artist / album header */
.detail-head {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: end;
  margin-bottom: 28px;
}
.detail-head__art {
  aspect-ratio: 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-2);
  box-shadow: var(--shadow);
}
.detail-head__art--round { border-radius: 50%; }
.detail-head__art img { width: 100%; height: 100%; object-fit: cover; }
.detail-head__kicker {
  font-size: 12px; color: var(--text-dim);
  letter-spacing: .12em; text-transform: uppercase;
}
.detail-head__title {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.05;
  margin: 6px 0 12px;
  font-variation-settings: "opsz" 144;
  letter-spacing: -.02em;
}
.detail-head__meta { color: var(--text-dim); font-size: 14px; }
.detail-head__actions {
  display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap;
}

/* Section titles */
.section-title {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 22px;
  margin: 36px 0 14px;
  letter-spacing: -.01em;
}

/* =====================================================================
   Docked bar (mini player)
   ===================================================================== */
.bar {
  grid-area: bar;
  position: sticky; bottom: 0;
  height: calc(var(--bar-h) + var(--safe-bot));
  padding-bottom: var(--safe-bot);
  background: rgba(250, 247, 240, .82);
  backdrop-filter: saturate(1.4) blur(20px);
  -webkit-backdrop-filter: saturate(1.4) blur(20px);
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding-left: 16px; padding-right: 16px;
  z-index: 20;
}
.bar__art {
  width: 52px; height: 52px;
  border-radius: 8px; overflow: hidden;
  background: var(--bg-2);
  box-shadow: var(--shadow-sm);
}
.bar__art img { width: 100%; height: 100%; object-fit: cover; }
.bar__meta { min-width: 0; }
.bar__title {
  font-size: 14px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar__artist {
  color: var(--text-dim); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar__ctrls { display: flex; align-items: center; gap: 6px; }
.bar__prog {
  position: absolute; left: 0; right: 0; top: 0;
  height: 2px; width: 100%;
  border: 0; background: transparent;
}
.bar__prog::-webkit-progress-bar { background: transparent; }
.bar__prog::-webkit-progress-value { background: var(--accent); }
.bar__prog::-moz-progress-bar { background: var(--accent); }

.icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text);
  transition: color .15s ease, background .15s ease, transform .1s ease;
}
.icon:hover { background: var(--bg-3); }
.icon:active { transform: scale(.94); }
.icon svg { width: 20px; height: 20px; }
.icon--primary {
  background: var(--text);
  color: var(--bg-0);
}
.icon--primary:hover { background: #000; }
.icon--big { width: 64px; height: 64px; }
.icon--big svg { width: 28px; height: 28px; }
.icon--big.icon--primary { background: var(--accent); color: var(--accent-ink); }
.icon--big.icon--primary:hover { background: var(--accent-hi); }

.icon[data-on="true"] { color: var(--accent); }
.icon[data-mode="one"], .icon[data-mode="all"] { color: var(--accent); }
.icon[data-mode="one"] { position: relative; }
.icon[data-mode="one"]::after {
  content: "1";
  position: absolute;
  top: 6px; right: 7px;
  font-size: 9px; font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  width: 12px; height: 12px; border-radius: 50%;
  display: grid; place-items: center;
}

/* =====================================================================
   Now-playing full-screen view
   ===================================================================== */
.now {
  position: fixed;
  inset: 0;
  background: var(--bg-0);
  z-index: 50;
  transform: translateY(100%);
  transition: transform .38s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bot);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
.now[aria-hidden="false"] { transform: translateY(0); }

.now__head {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
}
.now__tabs {
  display: flex; justify-content: center; gap: 6px;
}
.now__tab {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-dim);
  transition: color .15s ease, background .15s ease;
}
.now__tab.is-on { color: var(--text); background: var(--bg-2); }

.now__body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.now__pane {
  position: absolute; inset: 0;
  overflow: hidden;
  display: none;
  padding: 12px clamp(16px, 5vw, 56px);
}
.now__pane.is-on { display: flex; flex-direction: column; }

.now__pane--art {
  align-items: center;
  justify-content: center;
  gap: 32px;
}
.now__art {
  width: min(72vh, 80vw, 520px);
  aspect-ratio: 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-2);
  box-shadow: 0 40px 80px -20px rgba(70, 55, 35, .28),
              0 10px 30px -10px rgba(70, 55, 35, .18);
}
.now__art img { width: 100%; height: 100%; object-fit: cover; }
.now__info { text-align: center; max-width: 640px; }
.now__title {
  font-family: var(--ff-display);
  font-size: clamp(24px, 3.4vw, 36px);
  font-weight: 600;
  margin: 0;
  line-height: 1.15;
  font-variation-settings: "opsz" 144;
}
.now__sub {
  color: var(--text-dim);
  font-size: 15px;
  margin-top: 6px;
}
.now__sub--muted { color: var(--text-faint); font-size: 13px; }

.now__foot {
  padding: 10px clamp(16px, 5vw, 56px) 18px;
  display: flex; flex-direction: column; gap: 14px;
}

.scrub {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 10px;
}
.scrub__t {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}
.scrub__bar {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
}
.scrub__bar::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--bg-3) 0);
}
.scrub__bar::-moz-range-track {
  height: 4px; border-radius: 4px; background: var(--bg-3);
}
.scrub__bar::-moz-range-progress {
  height: 4px; border-radius: 4px; background: var(--accent);
}
.scrub__bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text);
  margin-top: -5px;
  box-shadow: 0 0 0 3px rgba(26, 22, 17, .08);
}
.scrub__bar::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; border: 0;
  background: var(--text);
}

.now__ctrls {
  display: flex; align-items: center; justify-content: center;
  gap: 22px;
}

/* =====================================================================
   Lyrics pane
   ===================================================================== */
.now__pane--lyrics { padding: 0; position: absolute; inset: 0; }
.lyrics {
  position: relative;              /* anchor offsetTop math for auto-scroll */
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 0 clamp(20px, 6vw, 80px);
  /* Let users swipe the list without the browser hijacking it. */
  overscroll-behavior: contain;
}
.lyrics__pad { height: 45vh; pointer-events: none; }
.lyrics__list {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--ff-display);
  font-variation-settings: "opsz" 144;
}
.lyrics__line {
  font-size: clamp(19px, 2.4vw, 26px);
  line-height: 1.35;
  font-weight: 500;
  color: var(--text-faint);
  padding: 10px 6px;
  cursor: pointer;
  border-radius: 6px;
  transition: color .3s ease, transform .3s ease, filter .3s ease, opacity .3s ease;
  transform-origin: left center;
  text-align: left;
}
.lyrics__line:hover { color: var(--text-dim); }
.lyrics__line.is-past { color: var(--text-faint); }
.lyrics__line.is-current {
  color: var(--text);
  font-weight: 600;
  transform: scale(1.04);
  filter: drop-shadow(0 2px 12px rgba(168, 105, 33, .2));
}
.lyrics__line.is-empty { color: var(--text-faint); opacity: .4; }
.lyrics__line--unsynced { cursor: default; }
.lyrics__empty {
  color: var(--text-faint);
  text-align: center;
  font-family: var(--ff-display);
  font-size: 18px;
  padding: 60px 20px;
}
.lyrics__snap {
  position: absolute;
  left: 50%; bottom: 24px;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 10px 24px -6px rgba(168, 105, 33, .5);
  animation: pop .2s ease;
}
@keyframes pop { from { transform: translate(-50%, 6px); opacity: 0; } }

/* =====================================================================
   Queue pane
   ===================================================================== */
.now__pane--queue { padding-top: 8px; flex-direction: column; }
.queue__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 4px 14px;
  font-size: 13px; color: var(--text-dim);
  font-family: var(--ff-display);
  font-variation-settings: "opsz" 144;
  letter-spacing: .02em;
}
.queue__head span { font-size: 20px; color: var(--text); font-weight: 600; }
.queue__list {
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 60px;
}
.queue__list .row {
  grid-template-columns: 40px 1fr 60px;
}
.queue__list .row__art {
  grid-column: 1;
}
.queue__list .row__name, .queue__list .row__artist { grid-column: auto; }
.queue__list .row__dur { grid-column: auto; }

/* =====================================================================
   Context menu (song actions)
   ===================================================================== */
.menu {
  position: fixed;
  z-index: 100;
  min-width: 200px;
  padding: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  font-size: 14px;
}
.menu__item {
  padding: 9px 12px;
  text-align: left;
  border-radius: var(--r-sm);
  color: var(--text);
  transition: background .1s ease;
  display: flex; align-items: center; gap: 10px;
}
.menu__item:hover { background: var(--bg-3); }
.menu__item--danger { color: var(--danger); }
.menu__sep { height: 1px; background: var(--line-soft); margin: 4px 0; }

/* =====================================================================
   Toast
   ===================================================================== */
.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--bar-h) + var(--safe-bot) + 18px);
  transform: translateX(-50%);
  padding: 10px 18px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  z-index: 90;
  box-shadow: var(--shadow-sm);
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* =====================================================================
   Empty states & loading
   ===================================================================== */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-faint);
}
.empty__title {
  font-family: var(--ff-display);
  font-size: 22px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.spin {
  width: 24px; height: 24px;
  border: 2px solid var(--bg-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   Search results
   ===================================================================== */
.search-results { display: flex; flex-direction: column; gap: 28px; }

/* =====================================================================
   Responsive breakpoints — mobile swaps sidebar for bottom tabs
   ===================================================================== */
@media (max-width: 820px) {
  .app-root {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto auto;
    grid-template-areas:
      "main"
      "bar"
      "nav";
  }
  .nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: auto;
    padding: 6px max(12px, var(--safe-left)) calc(6px + var(--safe-bot)) max(12px, var(--safe-right));
    background: rgba(250, 247, 240, .92);
    backdrop-filter: saturate(1.4) blur(20px);
    -webkit-backdrop-filter: saturate(1.4) blur(20px);
    border-top: 1px solid var(--line-soft);
    border-right: 0;
    flex-direction: column;
    gap: 0;
    z-index: 30;
  }
  .nav__brand, .nav__foot { display: none; }
  .nav__list { flex-direction: row; justify-content: space-around; gap: 0; }
  .nav__item {
    flex-direction: column;
    gap: 2px;
    padding: 8px 4px;
    font-size: 10px;
    color: var(--text-faint);
  }
  .nav__item svg { width: 22px; height: 22px; }
  .nav__item:hover { background: transparent; }
  .nav__item[aria-selected="true"] {
    color: var(--accent);
    background: transparent;
    box-shadow: none;
  }

  .main {
    padding: calc(16px + var(--safe-top)) 16px;
    padding-bottom: calc(var(--bar-h) + 72px + var(--safe-bot));
  }

  .bar {
    position: fixed;
    bottom: calc(62px + var(--safe-bot));
    left: 8px; right: 8px;
    height: var(--bar-h);
    padding: 0 12px;
    border-radius: 14px;
    border: 1px solid var(--line-soft);
    box-shadow: 0 16px 40px -16px rgba(70, 55, 35, .28);
  }
  .bar__prog { border-radius: 14px 14px 0 0; overflow: hidden; }

  /* Hide prev on mobile bar to save room — available in full view. */
  #barPrev { display: none; }

  .detail-head {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .detail-head__art {
    width: min(60vw, 260px);
    justify-self: center;
  }

  .row {
    grid-template-columns: 40px 1fr 44px;
    gap: 10px;
  }
  .row__idx, .row__dur, .row__more { display: none; }
  .row__heart { justify-self: end; }

  .view-head h1 { font-size: 28px; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px 12px; }

  .now__ctrls { gap: 14px; }
  .icon--big { width: 56px; height: 56px; }
}

/* Hover adjustments for pure-touch devices. */
@media (hover: none) {
  .tile__play { opacity: 1; transform: none; }
  .row__heart { opacity: 1; }
}
