/* Orange Music — dark, quiet, one accent. Orange marks what's alive (playing, active,
   tappable-primary); everything else is warm greys. */
:root {
  --bg: #0E0C0B;
  --surface: #1A1715;
  --surface-2: #26221F;
  --surface-3: #332E2A;
  --text: #F5F0EB;
  --text-2: #A9A099;
  --text-3: #6F6761;
  --hairline: rgba(255, 240, 225, 0.08);
  --accent: #F0883E;
  --accent-soft: rgba(240, 136, 62, 0.14);
  --accent-press: #D9752F;
  --leaf: #78A85A;
  --danger: #E5624F;
  --radius: 10px;
  --tabbar-h: 56px;
  --mini-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.35 var(--font); }
body { overscroll-behavior-y: none; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }
svg.i { width: 24px; height: 24px; fill: currentColor; display: block; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-logo { width: 112px; height: 112px; margin: 0 auto 4px; }
.login-card h1 { margin: 0 0 12px; font-size: 28px; letter-spacing: -0.02em; }
.login-card input {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius);
  color: var(--text); font: inherit; padding: 14px 14px; outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-error { color: var(--danger); min-height: 1.4em; margin: 0; font-size: 14px; }

.btn-primary {
  background: var(--accent); color: #1B0F06; font-weight: 600; border-radius: var(--radius);
  padding: 14px; min-height: 48px;
}
.btn-primary:active { background: var(--accent-press); }

/* ---------- layout ---------- */
.view {
  padding: calc(var(--safe-t) + 12px) 16px calc(var(--tabbar-h) + var(--mini-h) + var(--safe-b) + 24px);
  max-width: 1100px; margin: 0 auto; min-height: 100dvh;
}
.large-title { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; }
.large-title h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.025em; margin: 0; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); min-height: 44px; margin-left: -6px; font-size: 17px; }
.back svg.i { width: 28px; height: 28px; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 10px; }
.section-title h2 { font-size: 21px; font-weight: 700; letter-spacing: -0.015em; margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.empty { color: var(--text-2); text-align: center; padding: 48px 16px; }

/* ---------- tab bar + mini player ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; justify-content: space-around;
  background: rgba(20, 17, 15, 0.86); backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px); border-top: 1px solid var(--hairline);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; color: var(--text-3); font-weight: 500;
}
.tabbar a.active { color: var(--accent); }

.mini {
  position: fixed; left: 8px; right: 8px; z-index: 21;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 6px); height: var(--mini-h);
  display: flex; align-items: center; gap: 4px; padding: 0 6px 0 8px;
  background: rgba(38, 34, 31, 0.92); backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-radius: 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); overflow: hidden;
  max-width: 1084px; margin: 0 auto;
}
.mini .icon-btn { width: 44px; }
.mini-open { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; height: 100%; text-align: left; }
.mini-art { width: 46px; height: 46px; border-radius: 6px; background: var(--surface-3); object-fit: cover; flex: none; }
.mini-text { min-width: 0; display: flex; flex-direction: column; }
.mini-title, .mini-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-title { font-size: 15px; font-weight: 500; }
.mini-artist { font-size: 13px; color: var(--text-2); }
.mini-feedback { display: none; gap: 2px; margin-right: 6px; padding-right: 8px; border-right: 1px solid var(--hairline); }
.mini-feedback .fb { width: 40px; height: 40px; }
.mini-feedback .fb svg.i { width: 22px; height: 22px; }
@media (min-width: 760px) {
  .mini-feedback { display: flex; }
}
@media (hover: hover) {
  .fb:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
  .fb.on:hover { color: var(--accent); }
}
.mini-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; }
.mini-progress div { height: 100%; width: 0; background: var(--accent); }

.icon-btn { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.icon-btn:active { background: var(--surface-3); }
.icon-btn svg.i { width: 28px; height: 28px; }
.icon-btn.big svg.i { width: 40px; height: 40px; }
.icon-btn.huge { width: 80px; height: 80px; }
.icon-btn.huge svg.i { width: 56px; height: 56px; }
.icon-btn:disabled { opacity: 0.35; }

/* ---------- segmented control + sort ---------- */
.large-title .sort { height: 36px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.segmented { display: flex; background: var(--surface); border-radius: 9px; padding: 2px; flex: 1; min-width: 0; }
.segmented a {
  flex: 1; text-align: center; padding: 7px 4px; font-size: 14px; font-weight: 500; border-radius: 7px;
  color: var(--text-2); white-space: nowrap; min-height: 36px; display: grid; place-items: center;
}
.segmented a.on { background: var(--surface-3); color: var(--text); }
.sort {
  appearance: none; -webkit-appearance: none; background: var(--surface); color: var(--text-2);
  border: 0; border-radius: 9px; padding: 0 30px 0 12px; height: 40px; font: 500 14px var(--font);
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: right 15px top 18px, right 10px top 18px; background-size: 5px 5px; background-repeat: no-repeat;
}

/* ---------- grids + tiles ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 14px; }
.tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tile .art { aspect-ratio: 1; }
.tile-title { font-size: 14px; font-weight: 500; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.tile-sub { font-size: 13px; color: var(--text-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin-top: -4px; }
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 172px); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.shelf::-webkit-scrollbar { display: none; }
.shelf > * { scroll-snap-align: start; }

.art { width: 100%; border-radius: 8px; background: var(--surface-2) center/40% no-repeat url("/icons/logo.svg"); object-fit: cover; }
.art.round { border-radius: 50%; }
.art[data-failed] { opacity: 1; }
img.art { color: transparent; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 0;
  border-bottom: 1px solid var(--hairline); width: 100%; text-align: left;
}
.row:active { background: var(--surface); }
.row .thumb { width: 48px; height: 48px; flex: none; }
.row .thumb.round { width: 52px; height: 52px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { color: var(--text-3); font-size: 14px; font-variant-numeric: tabular-nums; flex: none; }
.row .num { width: 26px; text-align: center; color: var(--text-3); font-size: 15px; font-variant-numeric: tabular-nums; flex: none; }
.row.playing .row-title, .row.playing .num { color: var(--accent); }
.chev { color: var(--text-3); flex: none; }

.badge { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); color: var(--text-2); }
.badge.qz { color: var(--accent); background: var(--accent-soft); }
.hires { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; color: var(--accent); }
.group-note { font-size: 13px; color: var(--text-3); margin: -14px 16px 22px; }
.group-row button.quiet { color: var(--text-2); }
.group-row .sort { max-width: 60%; }
.badge.lib { color: var(--leaf); background: rgba(120, 168, 90, 0.13); }

/* equalizer glyph for the playing row */
.eq { display: inline-flex; gap: 2px; height: 14px; align-items: flex-end; }
.eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s; } .eq i:nth-child(3) { animation-delay: -0.6s; }
.eq.paused i { animation-play-state: paused; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }

/* ---------- detail headers ---------- */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; margin: 8px 0 18px; }
.hero .art { width: min(280px, 72vw); aspect-ratio: 1; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55); }
.hero-text { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.hero .actions { width: 100%; }
.hero h1 { font-size: 22px; margin: 14px 0 0; letter-spacing: -0.015em; }
.hero .hero-link { color: var(--accent); font-size: 20px; }
.hero .hero-meta { font-size: 13px; color: var(--text-2); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 8px; }
.pill {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px;
  background: var(--surface-2); color: var(--accent); font-weight: 600; border-radius: var(--radius);
}
.pill:active { background: var(--surface-3); }
.pill svg.i { width: 20px; height: 20px; }
.footnote { color: var(--text-2); font-size: 13px; margin: 14px 0; }

@media (min-width: 760px) {
  .hero { flex-direction: row; text-align: left; align-items: flex-end; gap: 24px; }
  .hero .art { width: 240px; }
  .hero-text { align-items: flex-start; }
  .hero .actions { max-width: 360px; }
}

/* ---------- search ---------- */
.searchbox { position: sticky; top: 0; z-index: 5; padding: calc(var(--safe-t) + 8px) 0 10px; margin-top: calc(-1 * var(--safe-t) - 12px); background: var(--bg); }
.searchbox input {
  width: 100%; background: var(--surface); border: 0; border-radius: var(--radius); color: var(--text);
  font: 17px var(--font); padding: 12px 14px 12px 40px; outline: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23A9A099'%3E%3Cpath d='M10 3a7 7 0 0 1 5.6 11.2l4.6 4.6-1.4 1.4-4.6-4.6A7 7 0 1 1 10 3zm0 2a5 5 0 1 0 0 10 5 5 0 0 0 0-10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center; background-size: 20px;
}

/* ---------- settings ---------- */
.group { background: var(--surface); border-radius: 12px; overflow: hidden; margin-bottom: 22px; }
.group-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; min-height: 52px; border-bottom: 1px solid var(--hairline); }
.group-row:last-child { border-bottom: 0; }
.group-row button { color: var(--accent); font-weight: 500; }
.group-row.danger button { color: var(--danger); }
.group-label { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 16px 8px; }
.about { text-align: center; color: var(--text-3); font-size: 13px; padding: 12px 0 24px; }
.about img { width: 64px; height: 64px; margin: 0 auto 8px; }

/* ---------- now playing ---------- */
.np {
  position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow: hidden;
  transform: translateY(100%); transition: transform 0.36s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 0.36s;
  visibility: hidden;
}
.np.open { transform: none; visibility: visible; transition: transform 0.36s cubic-bezier(0.32, 0.72, 0, 1); }
.np-bg { position: absolute; inset: 0; z-index: 0; background-size: cover; background-position: center; transform: scale(1.5); filter: blur(40px) saturate(1.3) brightness(0.42); }
.np-scroll { position: absolute; inset: 0; z-index: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.np-inner { max-width: 520px; margin: 0 auto; padding: calc(var(--safe-t) + 6px) 24px calc(var(--safe-b) + 24px); display: flex; flex-direction: column; min-height: 100%; }
.np-grab { height: 36px; display: grid; place-items: center; width: 100%; }
.np-grab span { width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.35); }
.np-art-wrap { padding: 18px 4px 26px; }
.np-art { width: 100%; aspect-ratio: 1; border-radius: 12px; object-fit: cover; background: var(--surface-2); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); transition: transform 0.35s ease; }
.np.paused .np-art { transform: scale(0.86); }
.np-meta { min-height: 56px; display: flex; align-items: center; gap: 8px; }
.np-meta-text { flex: 1; min-width: 0; }
.np-feedback { display: flex; gap: 2px; flex: none; }
.fb { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.fb:active { background: rgba(255, 255, 255, 0.08); }
.fb svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.fb.on { color: var(--accent); }
.fb.on svg.i { fill: currentColor; }
.fb[data-fb="dislike"].on { color: var(--text); }
.np.queue-mode .np-feedback { display: none; }
.np-section { font-size: 13px; color: var(--text-2); font-weight: 600; padding: 16px 0 4px; display: flex; gap: 6px; align-items: center; list-style: none; }
.np-section .inf { color: var(--accent); font-size: 17px; line-height: 1; }
.row .origin-ap { color: var(--accent); }
.np-title { font-size: 21px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { font-size: 19px; color: var(--accent); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-scrub { margin-top: 18px; }
.np-scrub input[type=range] { width: 100%; -webkit-appearance: none; appearance: none; background: transparent; height: 28px; margin: 0; --p: 0%; }
.np-scrub input[type=range]::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(to right, var(--text) var(--p), rgba(255,255,255,.22) var(--p)); }
.np-scrub input[type=range]::-moz-range-track { height: 5px; border-radius: 3px; background: linear-gradient(to right, var(--text) var(--p), rgba(255,255,255,.22) var(--p)); }
.np-scrub input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); margin-top: -4.5px; }
.np-scrub input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--text); }
.np-times { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.np-src { text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; font-size: 10px; align-self: center; color: var(--text-3); }
.np-controls { display: flex; justify-content: space-evenly; align-items: center; margin: 16px 0 4px; }
.np-tools { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.np-tools .icon-btn { color: var(--text-2); }
.np.queue-mode .np-tools .icon-btn { color: var(--accent); background: var(--accent-soft); }
.np-top { display: flex; flex-direction: column; }
.np.queue-mode .np-top { flex-direction: row; align-items: center; gap: 14px; padding: 8px 0 4px; }
.np.queue-mode .np-art-wrap { padding: 0; width: 72px; flex: none; }
.np.queue-mode .np-art, .np.queue-mode.paused .np-art { border-radius: 8px; transform: none; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); }
.np.queue-mode .np-meta { flex: 1; min-width: 0; min-height: 0; }
.np.queue-mode .np-title { font-size: 17px; }
.np.queue-mode .np-artist { font-size: 16px; }
.np-queue-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; font-size: 17px; border-top: 1px solid var(--hairline); padding-top: 18px; }
.np-context { font-size: 13px; font-weight: 400; color: var(--text-2); }
.np-queue { list-style: none; margin: 6px 0 0; padding: 0; }
.np-queue .row { border-bottom-color: rgba(255, 255, 255, 0.06); }
.np-queue .row:active { background: rgba(255, 255, 255, 0.05); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--safe-b) + 20px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: 0.25s;
  background: var(--surface-3); color: var(--text); padding: 10px 16px; border-radius: 20px; font-size: 14px;
  max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton { height: 200px; display: grid; place-items: center; color: var(--text-3); }

/* ---------- switch ---------- */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 31px; transition: background 0.2s; }
.switch span::before { content: ""; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); }
