:root {
  --bg: #080b10;
  --panel: rgba(18, 24, 34, .86);
  --panel-solid: #121822;
  --card: rgba(255, 255, 255, .06);
  --card-strong: rgba(255, 255, 255, .1);
  --border: rgba(255,255,255,.12);
  --text: #eff6ff;
  --muted: #9aa7ba;
  --accent: #7dd3fc;
  --accent-2: #a78bfa;
  --spotify: #1ed760;
  --danger: #fb7185;
  --good: #86efac;
  --shadow: 0 24px 80px rgba(0,0,0,.38);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 20%, rgba(30, 215, 96, .16), transparent 30rem),
    radial-gradient(circle at 86% 8%, rgba(167, 139, 250, .16), transparent 30rem),
    linear-gradient(135deg, #070a0f, #0c1019 52%, #111827);
}

a { color: inherit; }
button, input, select { font: inherit; }
button {
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--spotify), var(--accent));
  color: #04130b;
  font-weight: 850;
  padding: 12px 16px;
  box-shadow: 0 14px 32px rgba(30, 215, 96, .18);
}
button:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}
input, select {
  width: 100%;
  background: rgba(255,255,255,.08);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}
select option { color: #0f172a; }
input:focus, select:focus { border-color: rgba(125, 211, 252, .72); box-shadow: 0 0 0 3px rgba(125, 211, 252, .12); }
label { display: grid; gap: 8px; color: var(--muted); }
code {
  color: #dbeafe;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 6px;
}

.game-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.brand, .top-nav nav {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand { text-decoration: none; }
.brand span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--spotify), var(--accent-2));
  color: #06101f;
  font-weight: 950;
}
.top-nav nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}
.top-nav nav a:hover { color: var(--text); }

.hero-card, .panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  gap: 26px;
  padding: clamp(22px, 4vw, 42px);
  margin-bottom: 24px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--spotify);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .76rem;
  font-weight: 900;
}
h1, h2, p { margin-top: 0; }
h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(2.35rem, 6vw, 5.2rem);
  letter-spacing: -.065em;
  line-height: .95;
}
h2 { margin-bottom: 10px; }
.hero-text, .setup-card p, .notice-card p, .status-line { color: var(--muted); line-height: 1.65; }
.hero-actions, .playlist-actions, .answer-actions, .game-status-row, .panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.setup-card {
  border-radius: 24px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.055);
  padding: 22px;
}
.redirect-uri {
  display: block;
  margin: 14px 0;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
details {
  margin-top: 16px;
  color: var(--muted);
}
summary { cursor: pointer; font-weight: 800; color: var(--text); }
details label { margin-top: 12px; }
.small-button { margin-top: 10px; padding: 10px 12px; border-radius: 12px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.panel { padding: 24px; }
.panel-head { justify-content: space-between; margin-bottom: 18px; }
.ghost-button, .secondary-button {
  color: var(--text);
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  box-shadow: none;
}
.secondary-button { background: linear-gradient(135deg, rgba(125,211,252,.16), rgba(167,139,250,.16)); }
.inline { padding: 9px 12px; border-radius: 12px; }

#playlistSearchInput { margin-bottom: 10px; }
.playlist-list {
  display: grid;
  gap: 8px;
  max-height: 330px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.04);
  -webkit-overflow-scrolling: touch;
}
.playlist-option {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text);
  background: rgba(255,255,255,.055);
  cursor: pointer;
  user-select: none;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.playlist-option:hover {
  background: rgba(255,255,255,.09);
  border-color: rgba(125, 211, 252, .32);
}
.playlist-option.selected {
  border-color: rgba(30, 215, 96, .5);
  background: linear-gradient(135deg, rgba(30, 215, 96, .18), rgba(125, 211, 252, .12));
}
.playlist-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--spotify);
}
.playlist-option-main { min-width: 0; }
.playlist-option-main strong, .playlist-option-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.playlist-option-main strong { color: var(--text); font-size: .96rem; }
.playlist-option-main span { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.playlist-empty {
  margin: 0;
  padding: 12px;
  color: var(--muted);
  text-align: center;
}
.playlist-select-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.playlist-hint {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
}

.playlist-actions { margin: 16px 0 20px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.stat-card, .notice-card, .mode-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
}
.stat-card span { color: var(--muted); display: block; font-size: .82rem; }
.stat-card strong { display: block; margin-top: 4px; font-size: 1.8rem; }
.mode-card {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
}
.mode-card .eyebrow { margin-bottom: -2px; }
.mode-hint {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
}
.notice-card { margin-top: 16px; }
.notice-card strong { color: var(--good); }

.game-panel {
  min-height: 560px;
  display: grid;
  gap: 20px;
}
.game-status-row { justify-content: space-between; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(30, 215, 96, .12);
  border: 1px solid rgba(30, 215, 96, .28);
  color: #bbf7d0;
  font-size: .9rem;
  font-weight: 800;
}
.muted-pill { background: rgba(255,255,255,.07); border-color: var(--border); color: var(--muted); }
.cover-wrap {
  justify-self: center;
  width: min(100%, 330px);
  aspect-ratio: 1;
  border-radius: 34px;
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(255,255,255,.1), rgba(255,255,255,.03)),
    radial-gradient(circle at 25% 20%, rgba(30, 215, 96, .25), transparent 12rem),
    radial-gradient(circle at 80% 80%, rgba(167, 139, 250, .22), transparent 12rem);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.cover-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-placeholder {
  font-size: 8rem;
  font-weight: 950;
  color: rgba(255,255,255,.45);
}
.answer-area { display: grid; gap: 12px; }
.autocomplete-wrap { position: relative; }
.suggestion-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 5;
  max-height: 280px;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #111827;
  box-shadow: var(--shadow);
}
.suggestion-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  color: var(--text);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}
.suggestion-item:hover, .suggestion-item.active { background: rgba(255,255,255,.08); }
.suggestion-item strong, .suggestion-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggestion-item span { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.result-card {
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  background: var(--card-strong);
}
.result-card.correct { border-color: rgba(134, 239, 172, .45); }
.result-card.wrong { border-color: rgba(251, 113, 133, .42); }
.result-card h3 { margin: 0 0 8px; }
.result-card p { color: var(--muted); line-height: 1.55; margin-bottom: 0; }

@media (max-width: 860px) {
  .hero-card, .dashboard-grid { grid-template-columns: 1fr; }
  .top-nav { align-items: flex-start; }
  .top-nav nav { justify-content: flex-end; flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .game-shell { width: min(100% - 20px, 1180px); padding-top: 12px; }
  .hero-card, .panel { border-radius: 22px; padding: 18px; }
  .stats-grid { grid-template-columns: 1fr; }
  h1 { font-size: 2.45rem; }
  .top-nav { display: grid; }
  .answer-actions button, .playlist-actions button { width: 100%; }
  .playlist-list { max-height: 260px; }
  .playlist-select-actions button { flex: 1 1 auto; }
}
