/* Hamelton Music app shell. Mobile first; side rail from 900px. */
:root {
  --navy: #101E2D;
  --navy-2: #16273A;
  --slate: #203448;
  --slate-2: #2A4159;
  --gold: #F5B323;
  --gold-2: #FFD067;
  --ivory: #F3E9D5;
  --ivory-dim: rgba(243, 233, 213, .72);
  --ivory-faint: rgba(243, 233, 213, .5);
  --line: rgba(243, 233, 213, .12);
  --accent: var(--gold);
  --radius: 16px;
  --tabbar-h: 64px;
  --topbar-h: 56px;
  --mini-h: 0px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--navy);
  color: var(--ivory);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
em { font-family: var(--serif); font-style: italic; font-weight: 400; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--gold); color: var(--navy); padding: 8px 14px; border-radius: 999px; font-weight: 700; }
.skip:focus { left: calc(8px + var(--safe-l)); }
.noscript { padding: 24px; }
[hidden] { display: none !important; }

/* ---------- Launch screen ---------- */
.splash {
  position: fixed; inset: 0; z-index: 90; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: radial-gradient(120% 80% at 50% 30%, var(--slate) 0%, var(--navy) 70%);
  transition: opacity .45s var(--ease), visibility .45s;
}
.splash img { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 18px 50px rgba(0,0,0,.45); }
.splash__name { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.splash__name em { color: var(--gold); }
.splash__bar { width: 120px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.splash__bar span { display: block; width: 40%; height: 100%; background: var(--gold); border-radius: 3px; animation: load 1.1s var(--ease) infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.splash.is-done { opacity: 0; visibility: hidden; }

/* ---------- Shell ---------- */
.app { min-height: 100%; }
.topbar {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  height: calc(var(--topbar-h) + var(--safe-t)); padding: var(--safe-t) calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l));
  display: flex; align-items: center; gap: 10px;
  background: rgba(16, 30, 45, .82); -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar__title { flex: 1; margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__back { width: 40px; height: 40px; margin-left: -8px; display: grid; place-items: center; border: 0; background: none; border-radius: 50%; cursor: pointer; }
.topbar__back svg { width: 24px; height: 24px; stroke: var(--ivory); }

.view {
  min-height: 100vh;
  padding: calc(var(--topbar-h) + var(--safe-t) + 8px) calc(16px + var(--safe-r)) calc(var(--tabbar-h) + var(--mini-h) + var(--safe-b) + 28px) calc(16px + var(--safe-l));
  outline: none;
}
.view.is-entering { animation: enter .28s var(--ease); }
.view.is-entering-back { animation: enterBack .28s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes enterBack { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }

/* Bottom tab bar (mobile) */
.rail {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  background: rgba(13, 24, 36, .92); -webkit-backdrop-filter: saturate(160%) blur(20px); backdrop-filter: saturate(160%) blur(20px);
  border-top: 1px solid var(--line);
}
.brand, .rail__install { display: none; }
.tabs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar-h); }
.tabs a {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; font-size: 11px; font-weight: 600; color: var(--ivory-faint); transition: color .15s;
}
.tabs svg { width: 25px; height: 25px; fill: currentColor; stroke: currentColor; stroke-width: 0; }
.tabs svg [fill="none"] { fill: none; }
.tabs a[aria-current="page"] { color: var(--gold); }

/* Mini-player slot */
.mini {
  position: fixed; z-index: 25; left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r));
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); height: 60px;
  border-radius: 14px; background: var(--slate); box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

@media (min-width: 900px) {
  :root { --rail-w: 240px; }
  .rail {
    top: 0; right: auto; width: var(--rail-w); bottom: 0; padding: calc(20px + var(--safe-t)) 14px 20px calc(14px + var(--safe-l));
    border-top: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 22px;
  }
  .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 18px; padding: 0 8px; }
  .brand img { border-radius: 9px; }
  .brand em { color: var(--gold); }
  .tabs { display: flex; flex-direction: column; height: auto; gap: 4px; }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 11px 12px; border-radius: 12px; font-size: 15px; }
  .tabs a:hover { background: rgba(243,233,213,.06); color: var(--ivory); }
  .tabs a[aria-current="page"] { background: rgba(245,179,35,.12); }
  .tabs svg { width: 22px; height: 22px; }
  .rail__install { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid rgba(245,179,35,.5); border-radius: 12px; background: none; color: var(--gold); font-weight: 600; cursor: pointer; }
  .rail__install svg { width: 20px; height: 20px; stroke: currentColor; }
  .topbar { left: var(--rail-w); }
  .topbar #topInstall { display: none; }
  .view { margin-left: var(--rail-w); padding-left: 32px; padding-right: 32px; padding-bottom: calc(var(--mini-h) + 40px); max-width: calc(1200px + var(--rail-w)); }
  .mini { left: calc(var(--rail-w) + 16px); right: 16px; bottom: 16px; }
}

/* ---------- Building blocks ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(243,233,213,.06); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.chip:hover { background: rgba(243,233,213,.1); }
.chip--gold { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.chip--gold:hover { background: var(--gold-2); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 999px;
  border: 0; background: var(--gold); color: var(--navy); font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--gold-2); }
.btn--ghost { background: rgba(243,233,213,.08); color: var(--ivory); border: 1px solid var(--line); }
.btn--ghost:hover { background: rgba(243,233,213,.14); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.section { margin: 26px 0 10px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section__head h2 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
.section__head a { font-size: 14px; color: var(--gold); text-decoration: none; font-weight: 600; }
.muted { color: var(--ivory-dim); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }

.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 6px 16px 10px; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { scroll-snap-align: start; }
@media (min-width: 900px) { .scroller { margin: 0 -6px; padding: 6px 6px 10px; } }

.hello { margin: 6px 0 4px; font-size: 30px; line-height: 1.1; letter-spacing: -.02em; font-weight: 800; }
.hello em { color: var(--gold); }

/* Artist bubbles */
.bubble { width: 112px; text-decoration: none; text-align: center; }
.bubble__img { width: 112px; height: 112px; border-radius: 50%; overflow: hidden; background: var(--slate); box-shadow: 0 0 0 3px var(--navy), 0 0 0 5px var(--accent); }
.bubble__img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.bubble__name { margin-top: 10px; font-weight: 700; font-size: 14px; }
.bubble__genre { font-size: 12px; color: var(--ivory-faint); }

/* Release cards */
.card { width: 160px; text-decoration: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; }
.grid .card { width: auto; }
.cover { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, var(--slate), var(--navy-2)); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover__badge { position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(16,30,45,.85); color: var(--gold); }
.card__title { margin-top: 9px; font-weight: 700; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__sub { font-size: 13px; color: var(--ivory-faint); }

/* Countdown cards */
.soon { width: min(330px, 82vw); display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; padding: 12px; border-radius: var(--radius); text-decoration: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--slate)), var(--navy-2)); border: 1px solid var(--line); }
.soon .cover { box-shadow: none; }
.soon__title { font-weight: 800; font-size: 16px; line-height: 1.2; }
.soon__meta { font-size: 13px; color: var(--ivory-dim); margin-top: 2px; }
.count { display: flex; gap: 8px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.count div { text-align: center; min-width: 34px; }
.count b { display: block; font-size: 18px; line-height: 1; }
.count span { font-size: 10px; color: var(--ivory-faint); text-transform: uppercase; letter-spacing: .06em; }

/* Install card */
.install { margin: 18px 0 6px; padding: 16px; border-radius: var(--radius); display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center;
  background: linear-gradient(120deg, rgba(245,179,35,.18), rgba(32,52,72,.6)); border: 1px solid rgba(245,179,35,.35); }
.install img { width: 52px; height: 52px; border-radius: 13px; }
.install h3 { margin: 0; font-size: 16px; }
.install p { margin: 2px 0 10px; font-size: 14px; color: var(--ivory-dim); }

/* Genre chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* Artist page */
.hero { position: relative; margin: calc(-8px - var(--topbar-h) - var(--safe-t)) -16px 0; min-height: 360px; display: flex; align-items: flex-end; overflow: hidden; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(16,30,45,.1) 30%, var(--navy) 98%); }
.hero__body { position: relative; z-index: 1; padding: 0 16px 8px; }
.hero h2 { margin: 4px 0 4px; font-size: 40px; line-height: 1; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--ivory-dim); max-width: 60ch; }
@media (min-width: 900px) { .hero { margin-left: -32px; margin-right: -32px; min-height: 420px; } .hero__body { padding: 0 32px 12px; } .hero h2 { font-size: 56px; } }
.prose p { max-width: 68ch; color: var(--ivory-dim); }
.note { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: rgba(243,233,213,.05); border: 1px solid var(--line); font-size: 13px; color: var(--ivory-dim); }

/* Album page */
.album { display: grid; gap: 18px; }
.album .cover { width: min(260px, 70vw); margin: 0 auto; box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 0 1px var(--line); }
.album__meta { text-align: center; }
.album__meta h2 { margin: 6px 0 2px; font-size: 26px; line-height: 1.15; letter-spacing: -.01em; }
.album__meta a { color: var(--accent); text-decoration: none; font-weight: 700; }
@media (min-width: 900px) { .album { grid-template-columns: 260px 1fr; align-items: end; } .album .cover { margin: 0; width: 260px; } .album__meta { text-align: left; } }
.tracks { list-style: none; margin: 16px 0 0; padding: 0; }
.track { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 11px 6px; border-radius: 10px; cursor: pointer; }
.track:hover { background: rgba(243,233,213,.05); }
.track__no { color: var(--ivory-faint); font-variant-numeric: tabular-nums; text-align: center; font-size: 14px; }
.track__title { font-weight: 600; }
.track__sub { font-size: 13px; color: var(--ivory-faint); }
.track__time { font-size: 13px; color: var(--ivory-faint); font-variant-numeric: tabular-nums; }
.track.is-locked { cursor: default; opacity: .55; }

/* Search */
.search { position: relative; margin: 6px 0 14px; }
.search input { width: 100%; height: 48px; padding: 0 16px 0 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--navy-2); color: var(--ivory); font: inherit; font-size: 16px; }
.search input:focus { outline: none; border-color: var(--gold); }
.search svg { position: absolute; left: 14px; top: 13px; width: 22px; height: 22px; stroke: var(--ivory-faint); fill: none; }
.results h3 { font-size: 15px; margin: 20px 0 8px; color: var(--ivory-dim); }

/* Placeholder screens */
.soonpanel { margin: 26px 0; padding: 26px 20px; border-radius: var(--radius); text-align: center; background: var(--navy-2); border: 1px dashed rgba(245,179,35,.4); }
.soonpanel h2 { margin: 8px 0 6px; font-size: 22px; }
.soonpanel p { margin: 0 auto 6px; max-width: 46ch; color: var(--ivory-dim); }
.soonpanel ul { text-align: left; max-width: 40ch; margin: 14px auto 0; color: var(--ivory-dim); }

/* Profile / settings */
.list { margin: 0; padding: 0; list-style: none; border-radius: var(--radius); background: var(--navy-2); border: 1px solid var(--line); overflow: hidden; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .k { font-weight: 600; }
.list .v { color: var(--ivory-dim); font-size: 14px; text-align: right; }
.ok { color: #7FD69B; }
.warn { color: var(--gold); }
.list select { background: var(--slate); color: var(--ivory); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 14px; }

/* Toast + sheet */
.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--safe-b) + 16px);
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); padding: 12px 14px 12px 18px; border-radius: 14px;
  background: var(--ivory); color: var(--navy); font-weight: 600; font-size: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.4);
  animation: up .25s var(--ease);
}
.toast button { border: 0; background: var(--navy); color: var(--ivory); border-radius: 999px; padding: 7px 14px; font-weight: 700; cursor: pointer; }
@media (min-width: 900px) { .toast { bottom: calc(var(--mini-h) + 24px); left: calc(50% + var(--rail-w) / 2); } }
@keyframes up { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

.sheet { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; background: rgba(5,10,16,.6); animation: fade .2s; }
.sheet__panel { width: 100%; max-width: 480px; max-height: 88vh; overflow: auto; padding: 10px 20px calc(24px + var(--safe-b)); border-radius: 22px 22px 0 0; background: var(--navy-2); border: 1px solid var(--line); animation: sheetUp .3s var(--ease); }
.sheet__grab { width: 40px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: var(--line); }
.sheet h2 { margin: 0 0 6px; font-size: 22px; }
.sheet ol { padding-left: 0; list-style: none; counter-reset: s; margin: 16px 0 20px; }
.sheet ol li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.sheet ol li::before { content: counter(s); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--navy); font-weight: 800; }
.sheet .glyph { display: inline-block; vertical-align: -5px; width: 22px; height: 22px; stroke: var(--gold-2); fill: none; }
@media (min-width: 600px) { .sheet { align-items: center; } .sheet__panel { border-radius: 22px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } }

.skeleton { border-radius: 12px; background: linear-gradient(90deg, var(--navy-2), var(--slate), var(--navy-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { padding: 40px 10px; text-align: center; color: var(--ivory-dim); }

/* Reduced motion: system setting, or the app's own switch */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
