:root {
  --bg: #0D0D0C; --fg: #EDEDE8; --mut: #A6A69F; --dim: #55554F;
  --line: rgba(237,237,232,0.16); --card: #161615; --glass: rgba(13,13,12,0.6);
  --accent: #C6F432; --ink: #111110;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --pad: 24px; --gap: 24px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font-family: 'Inter Tight', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--mut); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* cover wash background */
.bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.bg img {
  position: absolute; left: -10%; top: -10%; width: 120%; height: 120%; object-fit: cover;
  filter: blur(70px) saturate(1.25); opacity: 0; transition: opacity 1.2s ease; transform: translateZ(0);
}
.bg img.on { opacity: 0.8; }
.bg .scrim { position: absolute; inset: 0; background: rgba(13,13,12,0.45); }

.app { position: relative; height: 100vh; height: 100dvh; min-height: 420px; display: flex; flex-direction: column; }
.glass { background: var(--glass); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }

/* header */
.top {
  flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 4px 24px; padding: 8px var(--pad); padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); position: relative; z-index: 3;
}
.brand { color: inherit; text-decoration: none; font-family: var(--mono); font-size: 14px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; padding: 13px 0; }
.tags { display: flex; flex-wrap: nowrap; gap: 6px; flex: 1 1 0; min-width: 0; overflow-x: auto; scrollbar-width: none; justify-content: safe center; }
.tags::-webkit-scrollbar { display: none; }
.tags button { flex: none; }
.top { flex-wrap: nowrap; }
.tags button {
  min-height: 44px; padding: 0 14px; font-family: var(--mono); font-size: 12px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--fg);
}
.tags button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
nav { display: flex; gap: 24px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
nav button { min-height: 44px; padding: 0; border: 0; background: none; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
nav a { color: inherit; text-decoration: none; padding: 13px 0; }

/* grid */
.stage { position: relative; flex: 1 1 0; min-height: 0; container-type: size; }
.scroller { height: 100cqh; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--dim) transparent; overscroll-behavior-x: contain; }
.grid {
  --tile: min(calc((100cqh - var(--pad) * 2 - var(--gap)) / 2), calc(100cqw - var(--pad) * 2 - 16px));
  height: 100cqh; padding: var(--pad); display: grid; grid-auto-flow: column;
  grid-template-rows: repeat(2, var(--tile)); grid-auto-columns: var(--tile); gap: var(--gap);
  width: max-content; align-content: center;
}
.tile { position: relative; overflow: hidden; border-radius: 2px; background: #1A1A19; box-shadow: 0 12px 40px rgba(0,0,0,0.35); }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .hit {
  position: absolute; inset: 0; padding: 0; border: 0; cursor: pointer;
  background: linear-gradient(to top, rgba(0,0,0,0.82), rgba(0,0,0,0) 58%);
  box-shadow: inset 0 0 0 3px transparent; transition: box-shadow .2s;
}
.tile.cur .hit { box-shadow: inset 0 0 0 3px var(--accent); }
.chip { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; padding: 4px 8px; background: rgba(13,13,12,0.8); color: #F2F2ED; }
.chip.accent, .tile.cur .chip { background: var(--accent); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tile .chips { position: absolute; top: 16px; left: 16px; right: 64px; pointer-events: none; }
.share {
  position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(13,13,12,0.6); color: #F2F2ED; display: flex; align-items: center; justify-content: center;
}
.share:hover { background: rgba(13,13,12,0.85); }
.meta { position: absolute; left: 16px; right: 16px; bottom: 16px; pointer-events: none; color: #F2F2ED; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.meta > div { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.meta .t { font-size: 26px; line-height: 1.02; font-weight: 500; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.meta .s { font-family: var(--mono); font-size: 12px; color: #D5D5CE; }
.meta .p { flex: none; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(13,13,12,0.6); color: #F2F2ED; }
.tile.cur .meta .p { background: var(--accent); color: var(--ink); }
.i-pause { display: none; }
.playing .i-play { display: none; }
.playing .i-pause { display: block; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-family: var(--mono); color: var(--mut); }

/* about layer */
.about {
  position: absolute; inset: 0; z-index: 2; overflow-y: auto; padding: clamp(24px, 5cqw, 72px);
  background: rgba(13,13,12,0.5); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  display: flex; flex-wrap: wrap; align-items: center; align-content: center; gap: 32px 56px;
}
.about img { flex: 0 1 340px; min-width: 0; width: 340px; height: auto; aspect-ratio: 1; object-fit: cover; object-position: 58% 30%; border-radius: 2px; box-shadow: 0 12px 40px rgba(0,0,0,0.35); }
.about-text { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.about h2 { margin: 0; max-width: 760px; font-size: clamp(30px, 4.2cqw, 60px); line-height: 1; font-weight: 500; letter-spacing: -0.03em; }
.about p { margin: 0; max-width: 560px; font-size: 17px; line-height: 1.5; }
.genres { display: flex; flex-wrap: wrap; gap: 8px; max-width: 560px; font-family: var(--mono); font-size: 12px; }
.genres span { border: 1px solid var(--line); padding: 6px 10px; }
.about-actions { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.about-actions .btn { min-height: 48px; padding: 0 20px; font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; font-family: var(--mono); font-size: 12px;
  cursor: pointer; border: 1px solid var(--line); background: transparent; color: var(--fg); text-decoration: none; letter-spacing: inherit; text-transform: inherit;
}
.btn.solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* player */
.player { flex: none; position: relative; z-index: 4; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.drawer {
  position: absolute; left: 0; right: 0; bottom: 100%; max-height: min(440px, 70dvh); overflow-y: auto;
  background: var(--card); border-top: 1px solid var(--line); padding: 28px var(--pad);
  display: flex; flex-wrap: wrap; gap: 28px 56px;
}
.drawer-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.drawer-main .chips { align-self: flex-start; }
.drawer h2 { margin: 0; font-size: 40px; line-height: 0.98; font-weight: 500; letter-spacing: -0.03em; }
.dsub { margin: -6px 0 0; font-family: var(--mono); font-size: 12px; color: var(--mut); }
.ddesc { margin: 0; max-width: 520px; font-size: 16px; line-height: 1.5; white-space: pre-line; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.drawer-tracks { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; }
.drawer-tracks h3 { margin: 0 0 12px; font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mut); }
.drawer-tracks ol { list-style: none; margin: 0; padding: 0; }
.drawer-tracks li button {
  width: 100%; display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 6px 0; cursor: pointer;
  border: 0; border-top: 1px solid var(--line); background: none; color: var(--mut); text-align: left;
}
.drawer-tracks li button.now { color: var(--fg); }
.drawer-tracks li .tt { flex: none; width: 72px; font-family: var(--mono); font-size: 12px; }
.drawer-tracks li .tn { font-size: 15px; }
.progress { height: 2px; background: var(--line); }
.progress > div { height: 2px; width: 0; background: var(--accent); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding: 10px var(--pad); }
.pp { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: var(--accent); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.now { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.ntitle { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wave { flex: 1 1 160px; min-width: 0; height: 36px; cursor: pointer; touch-action: none; display: block; }
.time { white-space: nowrap; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 10;
  background: var(--fg); color: var(--bg); font-family: var(--mono); font-size: 12px; padding: 10px 14px; transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  :root { --pad: 16px; --gap: 12px; }
  .top { gap: 0 16px; flex-wrap: wrap; }
  .tags { flex-basis: 100%; justify-content: flex-start; }
  .tags { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  .tags button { flex: none; min-height: 36px; }
  nav { gap: 16px; }
  .meta .t { font-size: 22px; }
  .bar { gap: 8px 14px; }
  .now { flex: 1 1 0; }
  .wave { order: 5; flex-basis: 100%; height: 32px; }
  .info { padding: 0 12px; }
  .info .long { display: none; }
  .drawer h2 { font-size: 32px; }
  .about img { width: 100%; flex-basis: 100%; max-width: 340px; }
}
@media (prefers-reduced-motion: reduce) { .bg img, .toast { transition: none; } }
.drawer-tracks li button:disabled { cursor: default; }
.now .mono { white-space: nowrap; }
@media (max-width: 720px) { #nTag { display: none; } }
