:root {
  --bg: #0e0f12;
  --card: #171923;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg); color: var(--text);
}
.container { max-width: 960px; margin: 0 auto; padding: 24px; }
h1 { margin: 0 0 16px; }
.subtitle { color: var(--muted); margin-top: 4px; }

.panel { padding: 16px 0; border-bottom: 1px solid #20212b; }

button {
  background: var(--accent); color: #08110b;
  border: none; padding: 10px 16px; border-radius: 8px; font-weight: 700;
  cursor: pointer; box-shadow: 0 2px 0 #168a41;
}
button:disabled { opacity: .6; cursor: not-allowed; }

label { display: block; margin: 8px 0; }
input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #2a2c38; background: #0f1119; color: var(--text); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.qr { width: 160px; height: 160px; background: white; padding: 8px; border-radius: 8px; }
.back { color: var(--muted); text-decoration: none; }
.success { color: var(--accent); }
.hidden { display: none !important; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.small { font-size: 12px; }
.controls { display: flex; gap: 8px; margin-top: 8px; }
.controls-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; padding: 0; display:flex; align-items:center; justify-content:center; font-size: 18px; }
.secondary { background: #0f1119; color: var(--text); border: 1px solid #2a2c38; box-shadow: none; }
.danger { border-color: var(--danger); color: var(--danger); }
.topbar { display:flex; align-items:center; gap: 12px; margin-bottom: 16px; }
.topbar .spacer { flex: 1; }
.player-name { width: 200px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid #242634; }
td.points-cell { position: relative; }
td.points-cell { white-space: nowrap; }

/* Progress */
.progress { margin-top: 8px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.progress-bar { width: 100%; height: 8px; background: #1f2230; border-radius: 999px; overflow: hidden; }
#progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.2s linear; }

/* Timeline */
.timeline { display: flex; gap: 12px; min-height: 180px; padding: 8px 0; position: relative; overflow-x: auto; align-items: center; }
.card-chip { background: #121421; border: 1px solid #23263a; border-radius: 12px; padding: 10px; display: inline-flex; flex-direction: column; align-items: center; gap: 8px; cursor: grab; width: 140px; text-align: center; }
.chip-year { color: var(--muted); font-size: 12px; }
.cover { width: 96px; height: 96px; border-radius: 8px; background: #222533; object-fit: cover; }
.chip-meta { display:flex; flex-direction: column; align-items: center; }
.chip-title { font-weight: 600; }
.chip-artist { color: var(--muted); font-size: 12px; }

/* Layout */
.layout { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.main { min-width: 0; }
.side { min-width: 0; }

/* Drop indicator */
.drop-indicator { width: 2px; background: var(--accent); height: 36px; align-self: center; }

/* Reveal animations */
@keyframes revealExactWin {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34,197,94,0.0); }
  20% { transform: scale(1.06); box-shadow: 0 0 0 10px rgba(34,197,94,0.18); }
  60% { transform: scale(1.02); box-shadow: 0 0 0 6px rgba(34,197,94,0.12); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34,197,94,0.0); }
}
@keyframes revealClose {
  0% { transform: translateY(0); }
  25% { transform: translateY(-6px); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}
@keyframes revealFail {
  10% { transform: translateX(-6px) rotate(-1deg); }
  20% { transform: translateX(6px) rotate(1deg); }
  30% { transform: translateX(-5px) rotate(-1deg); }
  40% { transform: translateX(5px) rotate(1deg); }
  50% { transform: translateX(-3px); }
  60% { transform: translateX(3px); }
  70% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
  90% { transform: translateX(-1px); }
  100% { transform: translateX(0); }
}
.reveal-exact {
  outline: 2px solid var(--accent);
  background: rgba(34,197,94,0.08);
  box-shadow: 0 0 0 4px rgba(34,197,94,0.12) inset, 0 0 0 0 rgba(34,197,94,0.0);
  animation: revealExactWin 520ms ease;
}
.reveal-close {
  outline: 2px dashed var(--warning);
  background: rgba(245,158,11,0.08);
  box-shadow: 0 0 0 4px rgba(245,158,11,0.12) inset;
  animation: revealClose 520ms ease;
}
.reveal-fail {
  outline: 2px solid var(--danger);
  background: rgba(239,68,68,0.08);
  box-shadow: 0 0 0 4px rgba(239,68,68,0.12) inset;
  animation: revealFail 520ms ease;
}

/* Just-revealed chip highlight */
.just-revealed {
  box-shadow: 0 0 0 2px var(--accent) inset;
}
/* Outcome-specific overrides for just-revealed chip */
.just-revealed-exact { box-shadow: 0 0 0 2px var(--accent) inset; }
.just-revealed-close { box-shadow: 0 0 0 2px var(--warning) inset; }
.just-revealed-fail { box-shadow: 0 0 0 2px var(--danger) inset; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display:flex; align-items:center; justify-content:center; }
.modal-content { background: var(--card); border:1px solid #20212b; border-radius:12px; padding:16px; width: min(520px, 92vw); }

@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}

/* Input feedback animations for title/artist guesses */
@keyframes inputGlowGreen {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
  40% { box-shadow: 0 0 0 8px rgba(34,197,94,0.18); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
@keyframes inputGlowRed {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  40% { box-shadow: 0 0 0 8px rgba(239,68,68,0.18); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
.guess-correct {
  border-color: var(--accent) !important;
  animation: inputGlowGreen 900ms ease;
}
.guess-wrong {
  border-color: var(--danger) !important;
  animation: inputGlowRed 900ms ease;
}

/* Confetti */
.confetti-container { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.confetti-piece { position: absolute; width: 8px; height: 14px; opacity: 0.9; border-radius: 2px; will-change: transform, opacity; }
@keyframes confettiFall {
  0%   { transform: translate3d(var(--x,0), -10vh, 0) rotate(var(--r,0deg)); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translate3d(var(--x,0), 110vh, 0) rotate(calc(var(--r,0deg) + 360deg)); opacity: 0; }
}

/* Score delta animation */
.score-delta {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-weight: 800;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.4);
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 12px;
  pointer-events: none;
  animation: scoreDeltaFloat 5000ms ease forwards;
}

@keyframes scoreDeltaFloat {
  0% { opacity: 0; transform: translate(8px, -50%) scale(0.8); }
  10% { opacity: 1; transform: translate(0, -50%) scale(1); }
  70% { opacity: 1; transform: translate(0, -70%) scale(1); }
  100% { opacity: 0; transform: translate(0, -90%) scale(0.95); }
}

.points-value {
  display: inline-block;
}
@keyframes pointsPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.points-pop {
  animation: pointsPop 280ms ease;
}
