/* Load order matters: later files override equal-specificity rules in earlier
 * ones (index.html links them base → views → about → player → overlays →
 * responsive → bee). Keep new rules in the file that owns their section. */

/* Self-hosted fonts (variable weight, latin + latin-ext; JP glyphs fall back
 * to the system stack). No third-party font requests. */
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
  src: url("../fonts/baloo2-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
  src: url("../fonts/baloo2-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Quicksand";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../fonts/quicksand-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Quicksand";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../fonts/quicksand-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  --bg: #11131f;
  --bg-deep: #0b0d18;
  --panel: #141726;
  --panel-soft: rgba(255, 255, 255, 0.05);
  --panel-strong: #202248;
  --panel-strong-soft: rgba(32, 34, 72, 0.82);
  --iris: #262a65;
  --iris-deep: #182449;
  --iris-soft: rgba(38, 42, 101, 0.72);
  --iris-text: #e0dffe;
  --text: #f4f2ff;
  --text-soft: rgba(224, 223, 254, 0.84);
  --text-dim: rgba(224, 223, 254, 0.72);
  --blue-soft: #a9b7ea;
  --blue-soft-dim: rgba(169, 183, 234, 0.9);
  --amber: #ffc53d;
  --amber-text: #16120c;
  --amber-soft: rgba(255, 197, 61, 0.14);
  --amber-glow: rgba(255, 197, 61, 0.35);
  --amber-line: rgba(255, 197, 61, 0.75);
  --danger: #ff8ba5;
  --danger-soft: rgba(255, 107, 138, 0.14);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 12px 32px rgba(5, 6, 17, 0.22);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --control-sm: 32px;
  --control-md: 40px;
  --control-lg: 48px;
  --player-height: 100px;
  --content-pad: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20px 18px, rgba(255, 255, 255, 0.12) 1px, transparent 1.5px),
    radial-gradient(circle at 84px 56px, rgba(255, 197, 61, 0.15) 1px, transparent 1.5px),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-size: 140px 110px, 220px 180px, auto;
  color: var(--text);
  font-family: "Quicksand", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

/* Two-layer indicator stays visible on amber-filled controls too. */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--bg);
  outline-offset: 0;
  box-shadow: 0 0 0 4px var(--amber);
}

.icon-sprite {
  display: none;
}

svg {
  display: block;
  height: 1em;
  width: 1em;
}

.sr-only {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.skip-link {
  background: var(--amber);
  border-radius: 0 0 var(--radius-sm) 0;
  color: var(--amber-text);
  font-weight: 700;
  left: 0;
  padding: 8px 14px;
  position: fixed;
  top: 0;
  transform: translateY(-120%);
  transition: transform 120ms ease;
  z-index: 40;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ------------------------------- app shell ------------------------------ */

/* Locked to the viewport: tall content scrolls inside its own view, never
 * the page. (min-height instead would let the grid row grow with content and
 * put a scrollbar on the whole page.) The mobile block resets this. */
.app-shell {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr) minmax(280px, 340px);
  /* minmax(0, 1fr), not auto: an auto row sizes to its content and lets the
   * columns grow past the 100dvh box, scrolling the whole page. */
  grid-template-rows: minmax(0, 1fr);
  height: 100dvh;
  padding-bottom: var(--player-height);
}

/* Fold the panel column away while nothing has ever been selected. */
.app-shell:has(.now-panel[hidden]) {
  grid-template-columns: 216px minmax(0, 1fr);
}

.sidebar {
  align-content: start;
  background: rgba(15, 17, 31, 0.96);
  display: grid;
  gap: 18px;
  /* The shell is viewport-locked; a long playlist list scrolls here. */
  overflow-y: auto;
  padding: 24px 20px 20px;
}

.brand {
  align-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  gap: 10px;
  justify-self: start;
  padding: 0;
}

.brand span:last-child {
  font-family: "Baloo 2", "Quicksand", sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}

.brand-star {
  animation: star-twinkle 3.2s ease-in-out infinite;
  color: var(--amber);
  filter: drop-shadow(0 0 10px rgba(255, 197, 61, 0.28));
}

@keyframes star-twinkle {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.brand-star svg {
  height: 14px;
  width: 14px;
}

.nav {
  display: grid;
  gap: 2px;
}

/* Nav rows are plain text with an amber thread on the active one — boxed
 * nav items made the sidebar read as a stack of cards. */
.nav-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  text-align: left;
  transition: background 160ms ease, color 160ms ease;
}

.nav-item svg {
  color: currentColor;
  height: 20px;
  width: 20px;
}

.nav-item span {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 2px 0 0 var(--amber-line);
  color: var(--text);
}

.nav-item.active svg {
  color: var(--amber);
}

.nav-item.active span {
  font-weight: 700;
}

.playlists-block {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.playlists-head {
  align-items: center;
  color: var(--blue-soft-dim);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  justify-content: space-between;
  letter-spacing: 0.04em;
  padding: 2px 2px 0;
  text-transform: uppercase;
}

.playlists-head button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  height: var(--control-sm);
  justify-content: center;
  width: var(--control-sm);
}

.playlists-head button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--amber);
}

.playlist-nav {
  display: grid;
  gap: 2px;
}

.playlist-item {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--iris-text);
  cursor: pointer;
  display: grid;
  gap: 2px;
  min-height: 46px;
  padding: 6px 12px;
  text-align: left;
  transition: background 160ms ease;
}

.playlist-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.playlist-item.active {
  background: rgba(32, 34, 72, 0.9);
  box-shadow: inset 2px 0 0 var(--amber-line);
}

/* The sidebar draft sits where the created playlist will appear, sized like
 * a playlist row so the list doesn't jump when it commits. */
.playlist-nav .playlist-draft {
  margin: 2px 0;
}

.playlist-nav .playlist-draft input {
  height: 40px;
  padding: 0 11px;
}

.playlist-name,
.playlist-count {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.playlist-count {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
}

.main-shell {
  background: rgba(17, 19, 31, 0.98);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  /* clip, not hidden: focus/scrollIntoView must never shove this sideways. */
  overflow: clip;
  padding: var(--content-pad);
  position: relative;
}

/* -------------------------------- header -------------------------------- */

/* No border of its own: the search field's underline is the only line here —
 * a header hairline right beneath it read as a doubled rule. */
.top-header {
  align-items: center;
  background: transparent;
  display: flex;
  gap: 16px;
  height: 64px;
  justify-content: space-between;
  padding: 0 16px;
}

/* About is static content — a search box there is dead chrome. The badge
 * keeps its right-edge spot once the search field is gone. */
.app-shell[data-view="about"] .search-field {
  display: none;
}

.app-shell[data-view="about"] .top-header {
  justify-content: flex-end;
}

/* A quiet underlined field, not a pill — the search shouldn't outweigh the
 * content it filters. */
.search-field {
  align-items: center;
  background: transparent;
  border-bottom: 1px solid rgba(224, 223, 254, 0.22);
  color: var(--blue-soft-dim);
  display: flex;
  gap: 10px;
  flex: 1 1 auto;
  height: 40px;
  max-width: 420px;
  /* Shrinkable: a fixed vw width would stretch the main column under the
   * now-playing panel. */
  min-width: 0;
  padding: 0 4px 0 2px;
  position: relative;
  transition: border-color 160ms ease;
}

/* The amber stitch that used to sit on the header hairline now starts the
 * search underline. */
.search-field::after {
  background: linear-gradient(90deg, rgba(255, 197, 61, 0.45) 0 4px, transparent 4px 10px);
  bottom: -1px;
  content: "";
  height: 1px;
  left: 0;
  pointer-events: none;
  position: absolute;
  width: 46px;
}

.search-field > svg {
  flex: 0 0 auto;
  height: 18px;
  width: 18px;
}

.search-field input {
  background: transparent;
  border: 0;
  color: var(--iris-text);
  font-size: 14px;
  font-weight: 500;
  min-width: 0;
  outline: 0;
  width: 100%;
}

.search-field input:focus-visible {
  box-shadow: none;
}

/* The field (not the borderless input) carries the focus indicator: the
 * underline turns amber like a pulled thread. */
.search-field:focus-within {
  border-bottom-color: var(--amber);
}

.search-field input::placeholder {
  color: var(--blue-soft-dim);
  opacity: 1;
}

.search-field input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--iris-text);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.search-clear:hover {
  background: rgba(255, 255, 255, 0.08);
}

.search-clear[hidden] {
  display: none;
}

.search-clear svg {
  height: 14px;
  width: 14px;
}

.fan-badge {
  align-items: center;
  color: var(--text-dim);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  gap: 8px;
}

.fan-badge svg {
  color: var(--amber);
  height: 14px;
  width: 14px;
}

/* ------------------------------ data banner ----------------------------- */

.data-banner {
  align-items: center;
  background: var(--amber-soft);
  border: 1px dashed rgba(255, 197, 61, 0.45);
  border-radius: var(--radius-sm);
  color: var(--text);
  display: flex;
  font-size: 13px;
  font-weight: 500;
  gap: 12px;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 14px;
}

.data-banner[hidden] {
  display: none;
}

.banner-retry {
  background: var(--amber);
  border: 0;
  border-radius: 8px;
  color: var(--amber-text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  height: var(--control-sm);
  padding: 0 14px;
}

