/* =========================================================================
   Dalga — 45'lik, simplified
   Paper, ink, tomato, mustard. One player card, a category bar, record shelves.
   Night mode is the gazino: oxblood dark, cream type, amber light.
   ========================================================================= */

:root {
  --paper: #EFE3C9;
  --card: #F6ECD8;
  --card-2: #EADCC0;
  --ink: #1F1A16;
  --ink-2: #5A5047;
  --line: #1F1A16;
  --shadow: #1F1A16;
  --track: rgba(31, 26, 22, 0.14);
  --rule: rgba(31, 26, 22, 0.12);
  --plank: #D8C49C;
  --tomato: #D2442A;
  --tomato-ink: #B23A22;
  --mustard: #E0A630;
  --teal: #1E6A65;
  --on-accent: #1F1A16;
  --vinyl: #191614;
  --groove: #2E2925;
  --f-display: "Alfa Slab One", Rockwell, Georgia, serif;
  --f-ui: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #23120E;
  --card: #301912;
  --card-2: #3A2016;
  --ink: #F3E6CC;
  --ink-2: #CDBB9D;
  --line: #E9D9BC;
  --shadow: #0B0504;
  --track: rgba(243, 230, 204, 0.18);
  --rule: rgba(243, 230, 204, 0.12);
  --plank: #4A2E22;
  --tomato: #E2553A;
  --tomato-ink: #F08566;
  --mustard: #F2B23E;
  --teal: #3AA197;
  --vinyl: #120A08;
  --groove: #2A1A15;
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--f-ui);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }
[data-icon] { display: inline-flex; }
:focus-visible { outline: 3px solid var(--tomato); outline-offset: 3px; }

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 48px) 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------------------------------------------------------------- buttons */

.round {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  transition: background 0.15s, transform 0.08s;
}
.round:hover { background: var(--card-2); }
.round:active { transform: scale(0.96); }
.round:disabled { opacity: 0.4; cursor: default; transform: none; }
.round-lg { width: 48px; height: 48px; }
.round-text { width: auto; padding: 0 13px 0 11px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; }
.round[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink);
  text-decoration: none;
}
.ghost:hover { background: var(--card-2); }
.ghost-text { padding: 0 10px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ghost[aria-pressed="true"] { color: var(--tomato-ink); }
#sleepBtn[aria-pressed="true"] .sleep-word { display: none; }

.play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--mustard);
  color: var(--on-accent);
  box-shadow: 3px 3px 0 var(--shadow);
  transition: transform 0.08s, box-shadow 0.08s;
}
.play:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.pp { display: none; }
.pp-play { display: inline-flex; }
[data-state="playing"] .pp-play, [data-state="loading"] .pp-play { display: none; }
[data-state="playing"] .pp-pause { display: inline-flex; }
[data-state="loading"] .spinner { display: inline-block; }
.pp-pause svg { stroke-width: 3; }
.pp-play svg { margin-left: 3px; }
.spinner {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(31, 26, 22, 0.25);
  border-top-color: #1F1A16;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pillbtn {
  height: 40px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-weight: 600;
}

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

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }

/* what Dalga is, in two small words beside the wordmark */
.brand-tag {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 0.5em;
  padding-left: 14px;
  border-left: 2px solid var(--rule);
  font: 700 12px/1.1 var(--f-ui);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.top-nav { display: flex; gap: 8px; }

/* the wordmark: "dalga" means wave, so the letters ride one */
.logo {
  display: inline-flex;
  align-items: flex-end;
  padding: 0.28em 0.08em 0.06em;
  font: 800 46px/1 var(--f-ui);
  letter-spacing: -0.02em;
}
.logo span { display: inline-block; transform: translateY(var(--y)) rotate(var(--r)); }
.logo span:nth-child(1) { --y: 0.06em; --r: -11deg; }
.logo span:nth-child(2) { --y: -0.15em; --r: -7deg; }
.logo span:nth-child(3) { --y: -0.25em; --r: 0deg; }
.logo span:nth-child(4) { --y: -0.15em; --r: 7deg; }
.logo span:nth-child(5) { --y: 0.06em; --r: 11deg; color: var(--teal); }
.brand:hover .logo span { animation: ripple 0.7s ease-in-out; }
.logo span:nth-child(2) { animation-delay: 0.06s; }
.logo span:nth-child(3) { animation-delay: 0.12s; }
.logo span:nth-child(4) { animation-delay: 0.18s; }
.logo span:nth-child(5) { animation-delay: 0.24s; }
@keyframes ripple {
  50% { transform: translateY(calc(var(--y) - 0.1em)) rotate(var(--r)); }
}

/* ---------------------------------------------------------------- the record (shared) */

.disc-svg { width: 100%; height: 100%; }
.disc-svg .vinyl { fill: var(--vinyl); }
.disc-svg .groove { fill: none; stroke: var(--groove); stroke-width: 1; }
.disc-svg .sheen { fill: none; stroke: #FFFFFF; stroke-opacity: 0.12; stroke-width: 5; stroke-linecap: round; }
.disc-svg .hole { fill: var(--paper); }
[data-theme="dark"] .disc-svg .vinyl { stroke: rgba(243, 230, 204, 0.16); stroke-width: 1.5; }
.disc-label { transform-box: fill-box; transform-origin: center; }

/* ---------------------------------------------------------------- player card */

.player {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 30px 34px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 24px;
  box-shadow: 6px 6px 0 var(--shadow);
}
.player .disc { flex: none; width: 200px; height: 200px; }
.player .disc .hole { fill: var(--card); }
.player .disc-label { animation: spin 12s linear infinite; animation-play-state: paused; }
.player[data-state="playing"] .disc-label { animation-play-state: running; }
.player-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}
.player[data-state="playing"] .tag { color: var(--tomato-ink); }
.tag .w1, .tag .w2 { opacity: 0.25; transition: opacity 0.12s; }
.tag[data-lvl="1"] .w1, .tag[data-lvl="2"] .w1, .tag[data-lvl="2"] .w2 { opacity: 1; }

.station-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-width: 0; }
.station {
  margin: 0;
  min-width: 0;
  font: 400 clamp(30px, 4.4vw, 48px)/1.08 var(--f-display);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* favorites are a gold star everywhere: this button, the tab count, the badge on records */
.fav-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px 0 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s;
}
.fav-btn:hover { background: var(--card-2); }
.fav-btn[aria-pressed="true"] { background: var(--mustard); color: #1F1A16; border-color: #1F1A16; }
.fav-btn[aria-pressed="true"]:hover { background: var(--mustard); filter: brightness(1.05); }
#favIcon { display: inline-flex; }
.pop { animation: pop 0.45s ease; }
@keyframes pop { 40% { transform: scale(1.45) rotate(-14deg); } 100% { transform: none; } }

.tab-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 1.5px solid #1F1A16;
  border-radius: 999px;
  background: var(--mustard);
  color: #1F1A16;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.line {
  margin: 0;
  font-size: 21px;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line:empty { display: none; }
.bar { max-width: 520px; height: 8px; margin-top: 6px; border-radius: 4px; background: var(--track); overflow: hidden; }
.bar span { display: block; width: 0; height: 100%; border-radius: 4px; background: var(--tomato); transition: width 0.8s ease; }
.small { margin: 0; font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small:empty { display: none; }

.controls { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 28px; margin-top: 12px; }
.transport { display: flex; align-items: center; gap: 14px; }
.volume { display: flex; align-items: center; gap: 8px; flex: 1 1 180px; max-width: 260px; }
.volume input {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --pct: 80%;
}
.volume input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--ink) 0 var(--pct), var(--track) var(--pct));
}
.volume input::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
.volume input::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--ink); }
.volume input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--tomato);
}
.volume input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); background: var(--tomato); }
#muteBtn[aria-pressed="true"] { color: var(--tomato); }
.extras { display: flex; gap: 2px; margin-left: auto; }

.sleep-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  min-width: 170px;
  padding: 6px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 4px 4px 0 var(--shadow);
}
.menu button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: start;
  font-size: 14px;
  font-weight: 500;
}
.menu button:hover, .menu button:focus-visible { background: var(--card-2); outline: none; }
.menu button[aria-checked="true"] { font-weight: 700; color: var(--tomato-ink); }

/* ---------------------------------------------------------------- browse: tabs, search, categories */

.browse-head { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.tabs { display: flex; gap: 4px; padding: 4px; border: 2px solid var(--line); border-radius: 999px; background: var(--card); }
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.tab:hover { background: var(--card-2); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.head-actions { display: flex; gap: 8px; }
.guide-btn { display: none; }

.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 6px 0 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
}
.searchbar input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; color: var(--ink); font-size: 16px; }
.searchbar input::placeholder { color: var(--ink-2); opacity: 1; }
.searchbar:focus-within { box-shadow: 3px 3px 0 var(--shadow); }

/* the main search: always on screen, beside the tabs, with the same offset shadow as the player card */
.browse-search {
  flex: 1 1 280px;
  max-width: 480px;
  height: 48px;
  margin-left: auto;
  padding-left: 15px;
  color: var(--ink);
  cursor: text;
  box-shadow: 3px 3px 0 var(--shadow);
  transition: box-shadow 0.12s, border-color 0.12s;
}
.browse-search:hover { background: var(--card-2); }
.browse-search:focus-within { border-color: var(--tomato); box-shadow: 3px 3px 0 var(--tomato); background: var(--card); }
.browse-search input { font-size: 15.5px; font-weight: 500; }
.browse-search input::-webkit-search-cancel-button { display: none; }
.search-key { margin-right: 8px; color: var(--ink-2); }
.browse-search:focus-within .search-key,
.browse-search input:not(:placeholder-shown) ~ .search-key { display: none; }
@media (hover: none) { .search-key { display: none; } }

.cats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -6px; }
.cat {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 48px;
  padding: 0 12px 0 6px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
}
.cat:hover { background: var(--card-2); }
.cat-count { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.cat[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.cat[aria-pressed="true"] .cat-count { color: inherit; opacity: 0.7; }
.cat-disc {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #191614;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cat-label {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--lb);
  color: var(--lf);
  box-shadow: inset 0 0 0 1.5px var(--lr, transparent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cat-label svg { stroke-width: 2.8; }
.cat-all { width: 34px; height: 34px; border-radius: 50%; background: var(--paper); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.cat[aria-pressed="true"] .cat-all { background: var(--card); color: var(--ink); }

/* World tab: where in the world. Squarer than the category pills, like index tabs in a record bin. */
.places { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -8px; }
.place {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 13px 0 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.place:hover { background: var(--card-2); }
.place[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.place-all { border-style: dashed; padding-right: 10px; }
.place-here { cursor: default; }   /* the first tab's country: a label, not a button */
.place-here:hover { background: none; }
.tab-home { max-width: 13em; overflow: hidden; text-overflow: ellipsis; }
.cc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 27px;
  height: 19px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
}
.place[aria-pressed="true"] .cc { background: var(--paper); color: var(--ink); }
.flag {
  flex: none;
  width: 22px;
  height: 16.5px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(128, 112, 96, 0.45);   /* keeps white flags (Japan, Finland) visible on paper */
  background: var(--card-2);
}
.place-row .flag { width: 26px; height: 19.5px; }
.pill-n { font-size: 12.5px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.atlas-foot { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 2px 0 6px; text-align: center; font-size: 14px; color: var(--ink-2); }
.atlas-foot p { margin: 0; }
.atlas-foot .pillbtn:disabled { opacity: 0.6; cursor: default; }
.atlas-err { color: var(--tomato-ink); }
.goto-place { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; }
.goto-place:hover { background: var(--card-2); }
.linkbtn { padding: 0; border: 0; background: none; color: var(--tomato-ink); font-weight: 600; text-decoration: underline; }

.place-dialog { width: min(520px, 94vw); height: min(700px, 88vh); padding: 18px 18px 8px; flex-direction: column; gap: 12px; }
.place-dialog[open] { display: flex; }
.place-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.place-dialog h3 { margin: 0; }
.place-search { flex: none; height: 46px; margin-top: 0; }
.place-list { min-height: 180px; margin: 0 -8px; padding: 0 8px 8px; overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; }
.place-row { flex: none; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 10px; background: none; text-align: start; font-size: 15px; }
.place-row:hover, .place-row:focus-visible { background: var(--card-2); outline: none; }
.place-row[aria-current="true"] { font-weight: 700; color: var(--tomato-ink); }
.place-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-row-n { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.place-group { margin: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
.lang-dialog { height: auto; max-height: min(700px, 88vh); }
.lang-row .cc { min-width: 30px; }
.lang-row[aria-current="true"] .cc { background: var(--tomato-ink); }

/* ---------------------------------------------------------------- shelves */

.content { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 36px; align-items: start; margin-top: 4px; }
.list { display: flex; flex-direction: column; gap: 30px; min-width: 0; }
.shelf { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.shelf-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.shelf-dot { flex: none; width: 30px; height: 30px; border-radius: 50%; background: #191614; display: inline-flex; align-items: center; justify-content: center; }
.shelf-dot i { width: 18px; height: 18px; border-radius: 50%; background: var(--lb); box-shadow: inset 0 0 0 2px var(--lr, transparent); }
.shelf-title { margin: 0; font: 400 22px/1.15 var(--f-display); }
.shelf-count { font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.see-all {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 2px 6px 10px;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.see-all:hover { color: var(--tomato-ink); }
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 26px 14px; }
.plank { height: 6px; border-radius: 3px; background: var(--plank); box-shadow: inset 0 -2px 0 rgba(31, 26, 22, 0.18); }

.rec {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px 0 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}
.rec-disc { position: relative; display: block; width: 108px; height: 108px; border-radius: 50%; transition: transform 0.25s ease; }
.rec:hover .rec-disc { transform: rotate(-12deg); }
.rec-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec[aria-current="true"] .rec-disc { box-shadow: 0 0 0 4px var(--paper), 0 0 0 7px var(--tomato); }
.rec-badge {
  position: absolute;
  right: -6px; bottom: -2px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--tomato);
  color: #FFF6EA;
  display: none;
  align-items: center;
  justify-content: center;
}
.rec-badge svg { stroke-width: 3; }
.rec-fav {
  position: absolute;
  top: -2px; right: -4px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid #1F1A16;
  background: var(--mustard);
  color: #1F1A16;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rec:hover .rec-fav { transform: rotate(12deg); }   /* stays upright while the record turns */
.rec-badge .spinner { width: 14px; height: 14px; border-width: 2.5px; border-color: rgba(255, 246, 234, 0.35); border-top-color: #FFF6EA; }
.rec:hover .rec-badge, .rec:focus-visible .rec-badge, .rec[aria-current="true"] .rec-badge { display: flex; }

.empty { margin: 0; padding: 26px 0; color: var(--ink-2); }
.loading-row { padding: 18px 0; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; color: var(--ink-2); text-transform: uppercase; }

/* ---------------------------------------------------------------- guide card */

.guide {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 22px 22px 16px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 20px;
}
.guide-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.guide-title { margin: 0; font: 400 22px/1.1 var(--f-display); }
.daypick {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 34px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}
.daypick > [data-icon] { position: absolute; right: 10px; pointer-events: none; }
.daypick select {
  appearance: none;
  -webkit-appearance: none;
  height: 100%;
  padding: 0 30px 0 13px;
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}
.daypick select option { color: #1F1A16; background: #F6ECD8; }
.seg { display: flex; gap: 4px; padding: 3px; border: 2px solid var(--line); border-radius: 999px; }
.seg-btn { flex: 1; height: 30px; border: 0; border-radius: 999px; background: none; font-size: 13px; font-weight: 600; }
.seg-btn[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.guide-body { overflow-y: auto; min-height: 80px; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; display: flex; flex-direction: column; gap: 6px; }

.now-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--mustard);
  color: #1F1A16;
}
.now-tag { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; }
.now-title { font-size: 17px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.now-sub { font-size: 13px; }
.now-bar { height: 6px; border-radius: 3px; background: rgba(31, 26, 22, 0.18); overflow: hidden; }
.now-bar i { display: block; height: 100%; background: #1F1A16; border-radius: 3px; }
.now-left { font-size: 13px; }

.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
}
.row:last-child { border-bottom: 0; }
.row-time { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.row-title { overflow-wrap: anywhere; }
.row.past { opacity: 0.5; }
.more {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding: 6px 0;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--tomato-ink);
}
.guide-empty { margin: 0; padding: 10px 0; color: var(--ink-2); font-size: 14px; }
.guide-empty b { display: block; margin-bottom: 4px; color: var(--ink); }
.guide-foot { margin: 0; font-size: 12px; color: var(--ink-2); }
.guide-foot a { color: var(--tomato-ink); font-weight: 600; }

/* ---------------------------------------------------------------- footer, toast, dialog, mini */

.foot { margin-top: 10px; font-size: 12.5px; color: var(--ink-2); text-align: center; }
.foot a { color: var(--ink); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(92vw, 460px);
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.dialog {
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 22px 24px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--shadow);
  min-width: 300px;
}
.dialog::backdrop { background: rgba(20, 12, 6, 0.5); }
.dialog h3 { margin: 0 0 14px; font: 400 22px var(--f-display); }
.keys-help { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0 0 18px; }
.keys-help dt { text-align: end; }
.keys-help dd { margin: 0; color: var(--ink-2); }
kbd { display: inline-block; min-width: 26px; padding: 2px 7px; border: 2px solid var(--line); border-radius: 6px; background: var(--paper); font: 600 12px var(--f-ui); text-align: center; }

.mini {
  position: fixed;
  left: 10px; right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 10px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 4px 4px 0 var(--shadow);
}
.mini-disc { width: 46px; height: 46px; flex: none; }
.mini-info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; border: 0; background: none; padding: 0; text-align: start; }
.mini-name { font: 400 16px/1.2 var(--f-display); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-line { font-size: 12.5px; color: var(--ink-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-play { width: 52px; height: 52px; box-shadow: 2px 2px 0 var(--shadow); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .content { grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; }
  .player { gap: 30px; }
  .player .disc { width: 170px; height: 170px; }
}

@media (max-width: 960px) {
  .guide-btn { display: inline-flex; }
  .content { grid-template-columns: minmax(0, 1fr); }
  .content[data-view="list"] .guide,
  .content[data-view="guide"] .list { display: none; }
  .guide { position: static; max-height: none; }
  .guide-body { overflow: visible; }
}

@media (max-width: 760px) {
  .app { gap: 18px; padding-bottom: 100px; }
  .logo { font-size: 38px; }
  .brand { gap: 10px; }
  .brand-tag { padding-left: 10px; font-size: 10.5px; letter-spacing: 0.13em; }
  .player {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 14px 16px;
    padding: 18px;
    border-radius: 22px;
    box-shadow: 5px 5px 0 var(--shadow);
  }
  .player-info { display: contents; }
  .player .disc { grid-column: 1; grid-row: 1 / span 3; width: 104px; height: 104px; align-self: center; }
  .tag { grid-column: 2; font-size: 10px; }
  .station-row { grid-column: 2; }
  .station { font-size: 25px; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .fav-btn { height: 32px; font-size: 13px; }
  .sleep-word { display: none; }
  .line { grid-column: 2; font-size: 16px; }
  .bar, .small, .controls { grid-column: 1 / -1; }
  .bar { max-width: none; margin-top: 2px; }
  .controls { display: grid; grid-template-columns: 44px 1fr 44px; gap: 12px 0; margin-top: 4px; }
  .transport { grid-column: 2; grid-row: 1; justify-content: center; }
  .extras { display: contents; }
  .sleep-wrap { grid-column: 1; grid-row: 1; align-self: center; }
  #siteBtn { grid-column: 3; grid-row: 1; align-self: center; }
  .volume { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .ghost-text { padding: 0; }
  #sleepLabel { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font-size: 11px; }
  .menu { left: 0; right: auto; }
  .tab { padding: 0 14px; }
  .tab-label { display: none; }
  .cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: -4px -16px 0; padding: 2px 16px 4px; }
  .cats::-webkit-scrollbar { display: none; }
  .browse-head { flex-wrap: wrap; }
  .head-actions { margin-left: auto; }
  .browse-search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; height: 50px; }
  .places { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: -4px -16px 0; padding: 2px 16px 2px; }
  .places::-webkit-scrollbar { display: none; }
  .place-dialog { height: 86vh; padding: 16px 14px 6px; }
  .cat { height: 46px; font-size: 14px; padding-right: 15px; }
  .shelf-grid { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 4px 16px 6px; scroll-snap-type: x proximity; scroll-padding-inline: 16px; }
  .shelf-grid::-webkit-scrollbar { display: none; }
  .shelf-grid .rec { flex: none; width: 96px; scroll-snap-align: start; }
  .shelf-grid.wrap { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; margin: 0; padding: 0; gap: 20px 8px; }
  .shelf-grid.wrap .rec { width: auto; }
  .rec-disc { width: 88px; height: 88px; }
  .rec { font-size: 13px; }
  .shelf-title { font-size: 19px; }
  .shelf-head { gap: 9px; }
  .shelf-dot { width: 26px; height: 26px; }
  .shelf-dot i { width: 15px; height: 15px; }
}

/* tiny phones: the wordmark and the two buttons need the whole row */
@media (max-width: 359px) {
  .brand-tag { display: none; }
}

/* phones on their side: wide but only ~400px tall. Keep the player to one compact band
   so the shelves start on the first screen, and stay clear of the notch. */
@media (orientation: landscape) and (max-height: 520px) {
  .app {
    gap: 14px;
    padding-top: 14px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: 96px;
  }
  .logo { font-size: 34px; }
  .round, .round-lg { width: 40px; height: 40px; }
  .round-text { width: auto; }
  .player {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 14px 20px;
    border-radius: 20px;
    box-shadow: 4px 4px 0 var(--shadow);
  }
  .player-info { display: flex; gap: 4px; }
  .player .disc { width: 118px; height: 118px; align-self: center; }
  .station { font-size: 27px; white-space: nowrap; display: block; }
  .line { font-size: 15px; }
  .bar { margin-top: 2px; }
  .controls { display: flex; flex-wrap: nowrap; gap: 12px 18px; margin-top: 6px; }
  .transport { gap: 10px; }
  .play { width: 52px; height: 52px; }
  .extras { display: flex; margin-left: auto; }
  .sleep-wrap, #siteBtn { grid-column: auto; grid-row: auto; }
  #sleepLabel { position: static; transform: none; font-size: 12px; }
  .volume { max-width: 200px; }
  .browse-head { flex-wrap: nowrap; }
  .browse-search { order: 0; flex-basis: 260px; max-width: 420px; margin-left: auto; height: 44px; }
  .head-actions { margin-left: 0; }
  .tab { height: 32px; }
  .place-dialog { height: 92vh; }
  .mini { left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .player .disc-label { animation: none; }
}

/* ---------------------------------------------------------------- right to left (Arabic, Persian)
   The layout mirrors by itself. Media controls keep their direction (play, next and the volume fill
   don't flip), counts like "0 / 10" keep their order, and arrows point the way the text reads. */
[dir="rtl"] :is(.transport-wrap, .volume, .scene-notes) { direction: ltr; }
/* names and titles take their own direction (dir="auto"): a long Latin name in an Arabic page is cut at its own end */
:is(.station, .line, .small, .mini-name, .mini-line) { text-align: left; }
[dir="rtl"] :is(.station, .line, .small, .mini-name, .mini-line) { text-align: right; }
[dir="rtl"] :is(.see-all, .goto-place) svg { transform: scaleX(-1); }
/* joined scripts break apart when letter-spaced (Arabic, Persian, and Hindi's headline) */
:is(:lang(ar), :lang(fa), :lang(hi)) * { letter-spacing: 0 !important; }
