* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: #0c0e0c;
  --bg2: #131513;
  --text: #e8e8e6;
  --dim: #9a9a96;
  --easy: #1ed760; --medium: #e7c229; --hard: #f2861d; --expert: #e8434a; --impossible: #a955f7;
  --accent: var(--easy);
}
body[data-difficulty="easy"]       { --accent: var(--easy); }
body[data-difficulty="medium"]     { --accent: var(--medium); }
body[data-difficulty="hard"]       { --accent: var(--hard); }
body[data-difficulty="expert"]     { --accent: var(--expert); }
body[data-difficulty="impossible"] { --accent: var(--impossible); }
body[data-difficulty="all"]        { --accent: var(--easy); }
body[data-difficulty="playlist"]   { --accent: var(--easy); }
body[data-difficulty="charts"]     { --accent: var(--hard); }

body {
  font-family: "Poppins", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  transition: --accent .3s;
}

/* ---------- pills ---------- */
.pill {
  font: inherit; font-weight: 600; color: var(--text);
  background: #1c1e1c; border: 1px solid transparent; border-radius: 999px;
  padding: 10px 24px; cursor: pointer;
  transition: transform .15s, box-shadow .3s, background .3s, color .3s;
}
.pill:hover { transform: scale(1.06); }
.pill[data-diff="easy"].active       { background: var(--easy); color: #08290f; box-shadow: 0 0 22px var(--easy); }
.pill[data-diff="medium"].active     { background: var(--medium); color: #2b2404; box-shadow: 0 0 22px var(--medium); }
.pill[data-diff="hard"].active       { background: var(--hard); color: #2e1602; box-shadow: 0 0 22px var(--hard); }
.pill[data-diff="expert"].active     { background: var(--expert); color: #2c0507; box-shadow: 0 0 22px var(--expert); }
.pill[data-diff="impossible"].active { background: var(--impossible); color: #1e0733; box-shadow: 0 0 22px var(--impossible); }
.pill[data-diff="all"].active        { background: var(--text); color: #111; box-shadow: 0 0 22px #fff5; }
.diff-pill[data-diff="medium"]     { color: var(--medium); }
.diff-pill[data-diff="hard"]       { color: var(--hard); }
.diff-pill[data-diff="expert"]     { color: var(--expert); }
.diff-pill[data-diff="impossible"] { color: var(--impossible); text-shadow: 0 0 12px var(--impossible); }
.diff-pill.active { text-shadow: none; }

.rail { display: flex; flex-direction: column; gap: 14px; padding: 40px 24px; }

/* ---------- ambient background ---------- */
.bg-blob {
  position: fixed; z-index: -1; width: 55vmax; height: 55vmax; border-radius: 50%;
  filter: blur(110px); opacity: .14; background: var(--accent);
  animation: drift 26s ease-in-out infinite alternate;
  transition: background 1s;
}
.bg-blob.b1 { top: -20vmax; left: -15vmax; }
.bg-blob.b2 { bottom: -25vmax; right: -12vmax; background: var(--impossible); animation-delay: -13s; animation-duration: 34s; }
@keyframes drift {
  from { transform: translate(-6%, -4%) scale(1); }
  to   { transform: translate(10%, 8%) scale(1.2); }
}
.watermark {
  position: fixed; z-index: -1; right: 1vw; top: 50%; translate: 0 -50%;
  writing-mode: vertical-rl; font-size: 13vh; font-weight: 800; letter-spacing: .08em;
  color: #ffffff08; user-select: none; pointer-events: none;
}

/* ---------- center ---------- */
.center {
  background:
    radial-gradient(70% 45% at 50% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(60% 40% at 50% 110%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 70%),
    var(--bg2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 34px; padding: 40px 60px; min-height: 100vh;
}
.hud { display: flex; gap: 28px; color: var(--dim); font-weight: 600; letter-spacing: .05em; }
#hud-score { color: var(--accent); }
.diff-row { display: flex; gap: 10px; }
.diff-row .pill { padding: 8px 18px; }

.progress-wrap { width: 100%; max-width: 640px; }
.progress { position: relative; height: 30px; border-radius: 6px; background: #2a2c2a; overflow: hidden; }
.progress-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: var(--accent); border-radius: 6px 0 0 6px;
  transition: width .4s cubic-bezier(.2,.8,.3,1), background .3s;
}
#progress-marks span { position: absolute; top: 0; bottom: 0; width: 3px; background: #0c0e0c88; }

/* ---------- disc ---------- */
.stage-row { display: flex; align-items: center; gap: 36px; }
.disc { background: none; border: none; cursor: pointer; border-radius: 50%; }
.disc-face {
  width: 190px; height: 190px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #0c0e0c;
  box-shadow: 0 0 34px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: background .3s, box-shadow .3s, transform .15s;
  position: relative; overflow: hidden;
}
.disc:hover .disc-face { transform: scale(1.04); }
/* vinyl grooves, visible while playing */
.disc-face::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 26%, #0c0e0c 26% 34%, transparent 34%),
    repeating-radial-gradient(circle, #0000 0 7px, #0002 7px 9px);
  opacity: 0; transition: opacity .4s;
}
body.playing .disc-face::before { opacity: 1; }
body.playing .disc-face { animation: spin 1.8s linear infinite, pulse 1.2s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 50%, transparent); }
  50% { box-shadow: 0 0 60px var(--accent); }
}
.stage-col { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 110px; }
.stage-label { font-weight: 700; font-size: 1.3rem; color: var(--accent); font-family: monospace; }
.advance { padding: 8px 16px; font-size: .85rem; }
.advance:disabled { opacity: .4; cursor: default; transform: none; }

/* equalizer */
.eq { display: flex; align-items: flex-end; gap: 4px; height: 40px; min-width: 40px; }
.eq i { width: 5px; height: 6px; background: var(--accent); border-radius: 2px; transition: background .3s; }
body.playing .eq i { animation: eq .6s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: .12s; } .eq i:nth-child(3) { animation-delay: .24s; }
.eq i:nth-child(4) { animation-delay: .36s; } .eq i:nth-child(5) { animation-delay: .48s; }
@keyframes eq { from { height: 6px; } to { height: 38px; } }

/* ---------- guess row ---------- */
.guess-row { display: flex; gap: 14px; width: 100%; max-width: 640px; }
.search-wrap { position: relative; flex: 1; }
.search-icon { position: absolute; left: 16px; top: 50%; translate: 0 -50%; color: var(--dim); }
#search {
  width: 100%; font: inherit; color: var(--text);
  background: #191b19; border: 2px solid var(--accent); border-radius: 14px;
  padding: 15px 18px 15px 44px; outline: none; transition: border-color .3s, box-shadow .2s;
}
#search:focus { box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 40%, transparent); }
#search.shake { animation: shake .4s; border-color: var(--expert); }
@keyframes shake { 25% { translate: -8px 0; } 50% { translate: 8px 0; } 75% { translate: -5px 0; } }

.dropdown {
  position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; z-index: 5;
  background: #f4f2ee; color: #222; border-radius: 12px;
  max-height: 300px; overflow-y: auto; box-shadow: 0 12px 32px #000a;
}
.dropdown div { padding: 10px 16px; cursor: pointer; }
.dropdown div:hover, .dropdown div.sel { background: #e2dfd8; }
.dropdown b { display: block; font-size: .95rem; }
.dropdown small { color: #777; }

.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  background: var(--accent); color: #101210;
  border: none; border-radius: 14px; padding: 15px 30px;
  transition: transform .15s, background .3s, filter .15s;
}
.btn:hover { transform: scale(1.05); filter: brightness(1.1); }
.btn-dim { background: #1c1e1c; color: var(--text); }

/* ---------- right panel ---------- */
.panel { padding: 40px 26px; display: flex; flex-direction: column; gap: 26px; overflow-y: auto; max-height: 100vh; }
.panel h4 { color: var(--dim); letter-spacing: .18em; text-transform: uppercase; font-size: .72rem; margin-bottom: 10px; text-align: center; }
.panel-btn {
  display: block; width: 100%; font: inherit; font-weight: 600; color: var(--text);
  background: #1c1e1c; border: none; border-radius: 999px; padding: 9px; margin-bottom: 8px; cursor: pointer;
  transition: background .3s, color .3s;
}
.panel-btn.active { background: var(--accent); color: #101210; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
  background: #1c1e1c; color: var(--dim); border: none; border-radius: 999px; padding: 6px 13px;
  transition: background .3s, color .3s;
}
.chip.active { background: var(--accent); color: #101210; }
.hint { color: var(--dim); font-size: .75rem; text-align: center; }
#volume { width: 100%; accent-color: var(--accent); }
.board { list-style-position: inside; color: var(--dim); font-size: .88rem; display: flex; flex-direction: column; gap: 5px; }
.board b { color: var(--text); }
.board .pts { float: right; color: var(--accent); font-weight: 700; }

/* ---------- celebration ---------- */
.celebrate {
  position: fixed; inset: 0; z-index: 50;
  background: var(--easy);
  display: flex; align-items: center; justify-content: center;
  animation: takeover .5s ease-out;
}
@keyframes takeover { from { opacity: 0; transform: scale(1.1); } }
.modal { position: fixed; inset: 0; z-index: 50; background: #000c; display: flex; align-items: center; justify-content: center; }
.reveal-card {
  background: #101210; border-radius: 24px; padding: 40px 56px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  box-shadow: 0 24px 80px #0008; text-align: center;
  animation: cardin .45s cubic-bezier(.2,1.4,.4,1);
  max-width: 440px;
}
@keyframes cardin { from { opacity: 0; transform: translateY(50px) scale(.9); } }
.vinyl {
  width: 180px; height: 180px; border-radius: 50%; margin-bottom: 10px;
  background: radial-gradient(circle, #222 0 30%, #111 30%), repeating-radial-gradient(circle, #1a1a1a 0 6px, #0d0d0d 6px 8px);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 40px #0009;
}
.vinyl.spinning { animation: spin 2.4s linear infinite; }
.vinyl img { width: 46%; height: 46%; border-radius: 50%; object-fit: cover; }
.reveal-card h2 { color: var(--easy); }
.reveal-card p { color: var(--dim); }
.reveal-points { font-size: 1.5rem; font-weight: 800; color: var(--text) !important; }
#name-input {
  font: inherit; text-align: center; color: var(--text);
  background: #1c1e1c; border: 2px solid var(--easy); border-radius: 12px; padding: 10px 16px; outline: none;
}

/* ---------- spotify import ---------- */
.import-card { max-width: 520px; gap: 16px; }
.import-card p { color: var(--dim); }
.import-card code { color: var(--easy); font-size: .85em; word-break: break-all; }
.import-card input {
  width: 100%; font: inherit; text-align: center; color: var(--text);
  background: #1c1e1c; border: 2px solid var(--easy); border-radius: 12px; padding: 10px 16px; outline: none;
}
.btn-row { display: flex; gap: 12px; justify-content: center; }
.playlists { max-height: 320px; overflow-y: auto; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.playlists button {
  font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: #1c1e1c; border: none; border-radius: 10px; padding: 10px 16px;
  transition: background .2s;
}
.playlists button:hover { background: #2a2c2a; }
.playlists small { color: var(--dim); float: right; }
.pill[data-diff="playlist"].active { background: var(--easy); color: #08290f; box-shadow: 0 0 22px var(--easy); }
.pill[data-diff="charts"].active   { background: var(--hard); color: #2e1602; box-shadow: 0 0 22px var(--hard); }

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px;
  animation: fall linear infinite;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); }
}

@media (max-width: 1100px) {
  body { grid-template-columns: 1fr; }
  .rail { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 14px 10px; gap: 8px; }
  .rail .pill { padding: 8px 16px; font-size: .9rem; }
  .diff-row { display: none; } /* the rail already has every mode */
  .center { padding: 18px 14px 28px; gap: 22px; min-height: 0; }
  .watermark, .bg-blob { display: none; } /* blur is expensive on mobile GPUs */
  .disc-face { width: 150px; height: 150px; }
  .stage-row { gap: 16px; }
  .eq { display: none; }
  .stage-col { min-width: 0; }
  .guess-row { flex-wrap: wrap; gap: 10px; }
  .search-wrap { flex-basis: 100%; }
  .guess-row .btn { flex: 1; padding: 13px 0; }
  .reveal-card { padding: 26px 20px; max-width: 92vw; }
  .panel { max-height: none; padding: 8px 16px 28px; gap: 20px; }
}
