:root {
  --cream: #fbf3e2;
  --paper: #fffaf0;
  --red: #7a1f1a;
  --red-2: #9b2a22;
  --gold: #e8a634;
  --wood: #5a3a22;
  --ink: #2e2118;
  --muted: #7c6a58;
  --line: #e7d6b8;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- Hero ---------- */
.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 16px 0;
}
.hero img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(90, 58, 34, .25);
  max-height: 44vh;
  min-height: 200px;
  object-fit: cover;
  object-position: center 42%;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Player ---------- */
.stage {
  margin-top: 18px;
  background: var(--wood);
  background-image: linear-gradient(180deg, #6a4529 0%, #4b2f1b 100%);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 10px 30px rgba(90, 58, 34, .25);
  scroll-margin-top: 10px;
}

.screen {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #1d130c;
}
.screen iframe,
.screen #player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--cream);
  background: radial-gradient(circle at 50% 40%, #3a2516 0%, #1d130c 70%);
  z-index: 2;
}
.placeholder img { width: clamp(90px, 22vw, 160px); height: auto; }
.placeholder p { margin: 4px 0 6px; opacity: .85; }
.stage.active .placeholder { display: none; }

.deck {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 4px 2px;
  color: var(--cream);
}
.now { min-width: 0; }
.now .label {
  display: block;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.now .title {
  display: block;
  font-family: "Bitter", Georgia, serif;
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.controls { display: flex; gap: 8px; }
.options {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px 14px;
  font-size: .9rem;
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  background: var(--gold);
  color: #3a2410;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.96); }
.btn:focus-visible, .card:focus-visible, .chip:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn-big { font-size: 1.05rem; padding: 12px 22px; }
.btn.icon {
  width: 46px; height: 46px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 46px;
  background: rgba(255, 250, 240, .12);
  color: var(--cream);
}
.btn.icon.play { background: var(--gold); color: #3a2410; width: 54px; height: 54px; line-height: 54px; font-size: 1.3rem; }

.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.switch input { accent-color: var(--gold); width: 18px; height: 18px; }
.yt { color: var(--cream); opacity: .8; text-decoration: none; font-weight: 600; }
.yt:hover { opacity: 1; text-decoration: underline; }

.resume {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 250, 240, .1);
  color: var(--cream);
  font-size: .95rem;
}
.resume span { flex: 1; min-width: 0; }
.resume[hidden] { display: none; }
.link { background: none; border: 0; color: var(--cream); opacity: .7; cursor: pointer; font-size: 1rem; padding: 6px; }

/* ---------- Categories ---------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 18px 2px 2px;
  scrollbar-width: none;
}
.chips[hidden] { display: none; }
.chip {
  flex: 0 0 auto;
  font: inherit;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  border: 2px solid var(--red);
  background: transparent;
  color: var(--red);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--red); color: var(--cream); }

/* ---------- Library ---------- */
.category { margin: 26px 0 8px; }
.category h2 {
  font-family: "Yellowtail", cursive;
  font-weight: 400;
  font-size: 2.3rem;
  line-height: 1.1;
  color: var(--red);
  margin: 0;
}
.category .blurb { margin: 2px 0 14px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(90, 58, 34, .08);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(90, 58, 34, .16); }
.thumb { position: relative; aspect-ratio: 16 / 9; background: #2b1c11; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .badge {
  position: absolute;
  right: 10px; bottom: 10px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(232, 166, 52, .95);
  color: #3a2410;
  display: grid; place-items: center;
  font-size: 1.1rem;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
}
.card .meta { padding: 12px 14px 14px; }
.card h3 { font-family: "Bitter", Georgia, serif; font-size: 1.08rem; margin: 0; line-height: 1.25; }
.card .note { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }

.card.playing { border-color: var(--red); box-shadow: 0 0 0 2px var(--red), 0 10px 22px rgba(90, 58, 34, .16); }
.card.playing .badge { background: var(--red); color: var(--cream); }
.card.playing .badge::after { content: "♪"; }
.card.playing .badge span { display: none; }

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px 16px 28px;
  color: var(--muted);
  font-size: .9rem;
}

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .hero { padding: 0; }
  .hero img { border-radius: 0; box-shadow: none; }
  main { padding: 0 12px; }
  .stage { padding: 10px; margin-top: 12px; }
  .deck { grid-template-columns: 1fr auto; gap: 10px; }
  .options { grid-column: 1 / -1; justify-content: space-between; }
  .category h2 { font-size: 2rem; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card .meta { padding: 10px 11px 12px; }
  .card h3 { font-size: .98rem; }
  .thumb .badge { width: 36px; height: 36px; font-size: .95rem; right: 8px; bottom: 8px; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
}
