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

:root {
  --bg: #0b0f1a;
  --surface: #161c2b;
  --surface-2: #1f2738;
  --border: #2d3650;
  --border-light: #3b4660;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --rail: #475569;
  --tie: #3b4660;
  --pull: #f59e0b;
  --pull-light: #fbbf24;
  --pull-dark: #b45309;
  --dont: #38bdf8;
  --dont-light: #7dd3fc;
  --dont-dark: #0284c7;
  --red: #ef4444;
  --green: #10b981;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
}

/* ── Top Bar ── */
.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.back-link {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.back-link:hover { color: var(--text); }

.level-pill {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--pull-light);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

/* ── Header ── */
.game-header {
  text-align: center;
  padding: 2rem 1.5rem 1rem;
}

.game-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  background: linear-gradient(135deg, #f1f5f9 0%, var(--pull-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.game-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 580px;
  margin: 0.6rem auto 0;
  line-height: 1.65;
}

/* ── Main ── */
.game-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

.scenario-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem 1.5rem;
  animation: fadeUp 0.4s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.level-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--pull-light);
  text-align: center;
  margin-bottom: 0.75rem;
}

.scenario-desc {
  font-size: 1rem;
  color: var(--text);
  text-align: center;
  max-width: 640px;
  margin: 0 auto 1.5rem;
  line-height: 1.7;
}

/* ── Illustration ── */
.illustration-wrap {
  background: linear-gradient(180deg, #0c111c 0%, #0b0f1a 100%);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem;
  margin: 0 auto 1.5rem;
  max-width: 640px;
  overflow-x: auto;
}

.illustration-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* ── Trolley animation ── */
#trolley {
  transition: none;
}

.trolley-body {
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes trolley-shake {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-3px) rotate(-2deg); }
  50% { transform: translateY(2px) rotate(2deg); }
  75% { transform: translateY(-1px) rotate(-1deg); }
}

/* ── Lever handle ── */
#lever-handle {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Item knock-away ── */
.track-item .item-inner {
  transform-box: fill-box;
  transform-origin: center;
  transition: none;
}

.track-item.knocked .item-inner {
  animation: knocked 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes knocked {
  0% {
    transform: translate(0, 0) rotate(0) scale(1);
    opacity: 1;
  }
  20% {
    transform: translate(-4px, -8px) rotate(-30deg) scale(1.05);
    opacity: 1;
  }
  100% {
    transform: translate(60px, -55px) rotate(540deg) scale(0.3);
    opacity: 0;
  }
}

/* ── Vote Buttons ── */
.vote-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
  max-width: 640px;
  margin: 0 auto;
}

.vote-btn {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.25rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.18s ease;
  color: var(--text);
  font-family: inherit;
}

.vote-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.vote-btn--pull:hover {
  border-color: var(--pull);
  background: rgba(245, 158, 11, 0.08);
}

.vote-btn--dont:hover {
  border-color: var(--dont);
  background: rgba(56, 189, 248, 0.08);
}

.vote-btn:active { transform: translateY(0); }

.vote-btn__icon {
  font-size: 1.8rem;
  line-height: 1;
}

.vote-btn__label {
  font-size: 1rem;
  font-weight: 700;
}

.vote-btn__sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (max-width: 540px) {
  .vote-buttons { grid-template-columns: 1fr; }
  .scenario-stage { padding: 1.25rem 1rem; }
}

/* ── Results Panel ── */
.results-panel {
  max-width: 640px;
  margin: 0 auto;
  animation: fadeUp 0.35s ease;
}

.your-choice {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.your-choice strong {
  color: var(--text);
  font-weight: 700;
}

.result-bars {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.result-row__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.result-row__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.result-row__pct {
  font-size: 1.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.result-row--pull .result-row__pct { color: var(--pull-light); }
.result-row--dont .result-row__pct { color: var(--dont-light); }

.result-bar {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.result-bar__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.result-bar__fill--pull {
  background: linear-gradient(90deg, var(--pull-dark), var(--pull-light));
}

.result-bar__fill--dont {
  background: linear-gradient(90deg, var(--dont-dark), var(--dont-light));
}

.result-row.is-yours .result-row__label::after {
  content: ' ← you';
  color: var(--green);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.result-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
  margin: 1rem 0 1.25rem;
  font-style: italic;
}

.next-btn {
  display: block;
  margin: 0 auto;
  background: linear-gradient(135deg, var(--pull-dark), var(--pull-light));
  border: none;
  color: #1a1206;
  padding: 0.75rem 2rem;
  border-radius: 0.625rem;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  transition: all 0.2s;
  font-family: inherit;
}

.next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.35);
}

/* ── Summary Panel ── */
.summary-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  animation: fadeUp 0.4s ease;
}

.summary-emoji {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
}

.summary-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--pull-light);
  margin-bottom: 0.5rem;
}

.summary-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.875rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem 0.75rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--pull-light);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.4;
}

.alignment-desc {
  font-size: 0.92rem;
  color: var(--text);
  max-width: 540px;
  margin: 0 auto 1.75rem;
  line-height: 1.7;
}

.restart-btn {
  background: linear-gradient(135deg, var(--pull-dark), var(--pull-light));
  border: none;
  color: #1a1206;
  padding: 0.75rem 2rem;
  border-radius: 0.625rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  transition: all 0.2s;
  font-family: inherit;
}

.restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.4);
}
