/* ══════════════════════════════════════════════════════════════
   BANDLE — Warm Audiophile / Vinyl Bar Aesthetic
   Fonts: Playfair Display (display) · Instrument Sans (body)
          JetBrains Mono (time)
   ══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Background palette ── */
  --bg:        #0C0B09;
  --bg2:       #151310;
  --bg3:       #1D1A15;
  --card:      rgba(255, 247, 230, 0.04);
  --card-h:    rgba(255, 247, 230, 0.07);
  --border:    rgba(255, 247, 230, 0.09);
  --border-h:  rgba(255, 247, 230, 0.18);

  /* ── Text ── */
  --text:      #F5F0E8;
  --text2:     rgba(245, 240, 232, 0.55);
  --text3:     rgba(245, 240, 232, 0.30);

  /* ── Accent (warm gold) ── */
  --gold:      #C9933A;
  --gold-lt:   #E3AE5A;
  --gold-glow: rgba(201, 147, 58, 0.22);

  /* ── Instrument stem colours ── */
  --drums:  #D95F4B;
  --bass:   #C8743E;
  --guitar: #6BA84F;
  --piano:  #4A87C6;
  --other:  #9A72BB;
  --vocals: #C45F8A;

  /* ── Misc ── */
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 8px 32px rgba(0,0,0,.55);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Instrument Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-h); border-radius: 2px; }

/* ── Base ────────────────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient warm noise-like gradient */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(201,147,58,.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(217,95,75,.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── App shell ───────────────────────────────────────────────── */
.app {
  position: relative;
  z-index: 1;
  max-width: 660px;
  margin: 0 auto;
  padding: 0 18px 100px;
}

/* ── Header ──────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.logo-note {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--gold);
}

.logo-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-lt) 0%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
}

.round-badge {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(201,147,58,.1);
  border: 1px solid rgba(201,147,58,.25);
  border-radius: 999px;
  padding: 4px 14px;
  transition: all .3s;
}

.round-badge.final {
  background: rgba(217,95,75,.12);
  border-color: rgba(217,95,75,.35);
  color: #E07060;
  animation: pulse-badge 1.5s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%,100% { opacity: 1; }
  50%      { opacity: .6; }
}

/* ── Screens ─────────────────────────────────────────────────── */
.screen { display: block; }
.screen.hidden { display: none !important; }

/* ── Start Screen ────────────────────────────────────────────── */
.start-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 72vh;
}

.start-card {
  text-align: center;
  padding: 52px 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  max-width: 420px;
  width: 100%;
}

/* Vinyl decoration */
.start-vinyl {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 28px;
}

.vinyl-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid;
}
.vinyl-ring.r1 { border-color: rgba(201,147,58,.5); animation: spin 12s linear infinite; }
.vinyl-ring.r2 { inset: 12px; border-color: rgba(201,147,58,.3); animation: spin 18s linear infinite reverse; }
.vinyl-ring.r3 { inset: 24px; border-color: rgba(201,147,58,.15); }

@keyframes spin { to { transform: rotate(360deg); } }

.vinyl-label {
  position: absolute;
  inset: 36px;
  background: radial-gradient(circle, var(--gold) 0%, #8B6020 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #1a1208;
}

.start-card h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 900;
  margin-bottom: 14px;
  color: var(--text);
}

.start-card p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text2);
  margin-bottom: 32px;
}

.no-songs {
  font-size: 13px;
  color: #E07060;
  margin-top: 16px;
  margin-bottom: 0;
}

/* ── Library status indicator ────────────────────────────────── */
.lib-status {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.lib-status-bar-wrap {
  width: 100%;
  height: 4px;
  background: rgba(255,247,230,.08);
  border-radius: 999px;
  overflow: hidden;
}

.lib-status-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-lt) 100%);
  border-radius: 999px;
  transition: width .6s ease;
}

.lib-status-text {
  font-size: 12px;
  color: var(--text3);
  font-family: var(--font-mono);
}

.lib-status-text.all-ready {
  color: #6BA84F;
}

/* ── Processing Overlay ──────────────────────────────────────── */
.processing-overlay {
  position: fixed; inset: 0;
  background: rgba(12, 11, 9, .94);
  backdrop-filter: blur(10px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.processing-overlay.hidden { display: none !important; }

.processing-inner { text-align: center; padding: 40px; }

.proc-rings {
  position: relative;
  width: 72px; height: 72px;
  margin: 0 auto 24px;
}

.proc-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--gold);
  animation: spin 1.2s linear infinite;
}
.proc-ring:nth-child(2) { inset: 10px; border-top-color: var(--gold-lt); animation-duration: 1.8s; animation-direction: reverse; }
.proc-ring:nth-child(3) { inset: 20px; border-top-color: rgba(201,147,58,.4); animation-duration: 2.4s; }

.processing-inner h3 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  margin-bottom: 10px;
}
.processing-inner p { font-size: 14px; color: var(--text2); line-height: 1.6; margin-bottom: 4px; }
.proc-subtitle { font-size: 12px; color: var(--text3); margin-top: 8px; font-family: var(--font-mono); }

/* ── Game Screen ─────────────────────────────────────────────── */
#game-screen {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
}

/* ── Stem Blocks ─────────────────────────────────────────────── */
.stems-panel {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

@media (max-width: 500px) {
  .stems-panel { grid-template-columns: repeat(3, 1fr); }
}

.stem-block {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1.5px solid;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: default;
  user-select: none;
  transition: box-shadow .4s, border-color .4s, background .4s, transform .2s;
}

.stem-block:hover { transform: translateY(-2px); }

.stem-icon { font-size: 22px; line-height: 1; transition: filter .4s, opacity .4s; }
.stem-name { font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

/* Locked state */
.stem-block.locked {
  background: rgba(255,247,230,.02);
  border-color: rgba(255,247,230,.07);
  color: var(--text3);
}
.stem-block.locked .stem-icon { filter: grayscale(1); opacity: .25; }

/* Unlocked states */
.stem-block.drums.unlocked  { background: rgba(217,95,75,.12);  border-color: var(--drums);  color: var(--drums);  box-shadow: 0 0 18px rgba(217,95,75,.2); }
.stem-block.bass.unlocked   { background: rgba(200,116,62,.12); border-color: var(--bass);   color: var(--bass);   box-shadow: 0 0 18px rgba(200,116,62,.2); }
.stem-block.guitar.unlocked { background: rgba(107,168,79,.12); border-color: var(--guitar); color: var(--guitar); box-shadow: 0 0 18px rgba(107,168,79,.2); }
.stem-block.piano.unlocked  { background: rgba(74,135,198,.12); border-color: var(--piano);  color: var(--piano);  box-shadow: 0 0 18px rgba(74,135,198,.2); }
.stem-block.other.unlocked  { background: rgba(154,114,187,.12);border-color: var(--other);  color: var(--other);  box-shadow: 0 0 18px rgba(154,114,187,.2); }
.stem-block.vocals.unlocked { background: rgba(196,95,138,.12); border-color: var(--vocals); color: var(--vocals); box-shadow: 0 0 18px rgba(196,95,138,.2); }

.stem-block.fresh {
  animation: stem-pop .55s cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes stem-pop {
  0%   { transform: scale(.6); opacity: 0; }
  60%  { transform: scale(1.12); }
  100% { transform: scale(1);  opacity: 1; }
}

/* ── Player Card ─────────────────────────────────────────────── */
.player-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
}

.waveform {
  display: block;
  width: 100%;
  height: 72px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.play-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold) 0%, #A8700F 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--gold-glow);
  transition: transform .15s, box-shadow .15s;
}
.play-btn:hover  { transform: scale(1.06); box-shadow: 0 4px 22px rgba(201,147,58,.4); }
.play-btn:active { transform: scale(.94); }

.play-icon { width: 18px; height: 18px; fill: #1a1208; stroke: none; }

.progress-wrap {
  flex: 1;
  cursor: pointer;
  padding: 12px 0;
}

.progress-track {
  position: relative;
  height: 4px;
  background: rgba(255,247,230,.1);
  border-radius: 999px;
  overflow: visible;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-lt) 100%);
  border-radius: 999px;
  transition: width .1s linear;
}

.progress-dot {
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gold-lt);
  box-shadow: 0 0 8px var(--gold-glow);
  opacity: 0;
  transition: opacity .2s;
}
.progress-wrap:hover .progress-dot { opacity: 1; }

.time-display {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text3);
  min-width: 38px;
  text-align: right;
}

/* ── Guesses Section ─────────────────────────────────────────── */
.guesses-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
}

.guesses-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 220px;
  overflow-y: auto;
}

.guess-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  animation: slide-in .25s ease;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.guess-item.correct  { background: rgba(107,168,79,.1);  border: 1px solid rgba(107,168,79,.25); color: #7FC55E; }
.guess-item.wrong    { background: rgba(217,95,75,.07);  border: 1px solid rgba(217,95,75,.15);  color: var(--text2); }
.guess-item.skipped  { background: rgba(255,247,230,.03); border: 1px solid var(--border); color: var(--text3); font-style: italic; }

.guess-icon { font-size: 15px; flex-shrink: 0; }

/* ── Input Section ───────────────────────────────────────────── */
.input-section { display: flex; flex-direction: column; gap: 10px; }

.input-wrap { position: relative; }

.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 18px; color: var(--text3); pointer-events: none;
  font-family: var(--font-display);
}

.guess-input {
  width: 100%;
  padding: 14px 44px 14px 42px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.guess-input:focus {
  border-color: rgba(201,147,58,.45);
  box-shadow: 0 0 0 3px rgba(201,147,58,.08);
}

.guess-input::placeholder { color: var(--text3); }

.clear-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text3); cursor: pointer;
  font-size: 14px; padding: 4px; border-radius: 4px;
  transition: color .2s;
}
.clear-btn:hover { color: var(--text); }

/* Suggestions dropdown */
.suggestions {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0;
  background: #1E1B16;
  border: 1px solid var(--border-h);
  border-radius: var(--radius);
  z-index: 50;
  overflow: hidden;
  max-height: 260px; overflow-y: auto;
  box-shadow: var(--shadow);
}

.suggestion-item {
  padding: 11px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,247,230,.04);
  transition: background .12s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover,
.suggestion-item.active { background: rgba(201,147,58,.1); }

.sugg-title  { font-size: 14px; font-weight: 600; color: var(--text); }
.sugg-artist { font-size: 12px; color: var(--text2); }

.action-row {
  display: flex;
  gap: 10px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  padding: 13px 26px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--gold) 0%, #A8700F 100%);
  color: #1a1208;
  box-shadow: 0 4px 18px var(--gold-glow);
}
.btn-primary:hover { box-shadow: 0 4px 26px rgba(201,147,58,.4); }

.btn-skip {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
}
.btn-skip:hover { border-color: var(--border-h); color: var(--text); }

.btn-guess {
  flex: 2;
  background: linear-gradient(135deg, var(--gold) 0%, #A8700F 100%);
  color: #1a1208;
  box-shadow: 0 4px 14px var(--gold-glow);
}
.btn-guess:disabled {
  opacity: .35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Result Screen ───────────────────────────────────────────── */
.result-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72vh;
}

.result-card {
  text-align: center;
  padding: 52px 36px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  max-width: 440px;
  width: 100%;
}

.result-emoji {
  font-size: 60px;
  margin-bottom: 14px;
  animation: bounce-in .55s cubic-bezier(.34,1.56,.64,1);
}

@keyframes bounce-in {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.result-heading {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 900;
  margin-bottom: 24px;
}

.result-song-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 22px;
}

.result-song-title  { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.result-song-artist { font-size: 15px; color: var(--text2); margin-bottom: 4px; }
.result-song-album  { font-size: 12px; color: var(--text3); }

/* Guess trail dots */
.guess-trail {
  display: flex;
  gap: 7px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.trail-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  border: 1.5px solid;
  animation: bounce-in .4s cubic-bezier(.34,1.56,.64,1) both;
}

.trail-dot.correct { background: rgba(107,168,79,.15); border-color: rgba(107,168,79,.4); }
.trail-dot.wrong   { background: rgba(217,95,75,.1);   border-color: rgba(217,95,75,.3); }
.trail-dot.skipped { background: rgba(255,247,230,.04); border-color: var(--border); }
