/* ===== Design tokens ===== */
:root {
  --bg: #14161c;
  --surface: #1c2029;
  --surface-raised: #232838;
  --line: #2a2f3b;

  --money: #d4a72c;
  --reputation: #4fd1c5;
  --reach: #e63969;

  --text: #ededf2;
  --text-dim: #8b8fa3;

  --positive: #3ddc84;
  --negative: #e5484d;

  --font-display: 'Unbounded', system-ui, sans-serif;
  --font-body: 'Golos Text', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* subtle noise/grid texture evoking an odds board, kept very quiet */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: calc(12px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  position: relative;
}

.stage::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.06;
  z-index: 0;
}

.stage > * { position: relative; z-index: 1; }

/* ===== Ticker bar — signature element ===== */
.ticker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.ticker__stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.ticker__label {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ticker__value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  transition: color 0.25s ease;
}

.ticker__stat[data-key="money"] .ticker__value { color: var(--money); }
.ticker__stat[data-key="reputation"] .ticker__value { color: var(--reputation); }
.ticker__stat[data-key="reach"] .ticker__value { color: var(--reach); }

.ticker__stat.flash-up { animation: flashUp 0.6s ease; }
.ticker__stat.flash-down { animation: flashDown 0.6s ease; }

@keyframes flashUp {
  0% { background: rgba(61, 220, 132, 0.28); }
  100% { background: var(--surface); }
}
@keyframes flashDown {
  0% { background: rgba(229, 72, 77, 0.28); }
  100% { background: var(--surface); }
}

.ticker__delta {
  position: absolute;
  top: -2px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(0);
}
.ticker__delta.show-up {
  color: var(--positive);
  animation: floatUp 0.9s ease forwards;
}
.ticker__delta.show-down {
  color: var(--negative);
  animation: floatUp 0.9s ease forwards;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(6px); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}

/* ===== Progress ===== */
.progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.progress-track {
  flex: 1;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--reputation), var(--money));
  transition: width 0.4s ease;
}

/* ===== Card ===== */
.card-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  perspective: 1200px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 22px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0.1, 0.2, 1);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}

.card.flip { transform: rotateY(180deg); }

.card__eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.card__title {
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.15;
  color: var(--text-dim);
  margin: 0;
}

.card__question {
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.45;
  margin: 0;
}

.card--sponsor {
  border-color: var(--reach);
  background: linear-gradient(160deg, var(--surface-raised), var(--surface));
}
.card--sponsor .card__eyebrow { color: var(--reach); }

.card__answer {
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
}

.card__answer-stats {
  display: flex;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-top: 6px;
}
.stat-chip {
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
}

/* ===== Buttons ===== */
.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.btn {
  font-family: var(--font-display);
  font-size: 15px;
  padding: 16px 0;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }

.btn--yes { border-color: var(--positive); color: var(--positive); }
.btn--yes:active { background: rgba(61, 220, 132, 0.12); }
.btn--no { border-color: var(--negative); color: var(--negative); }
.btn--no:active { background: rgba(229, 72, 77, 0.12); }

.btn--primary {
  grid-column: 1 / -1;
  border-color: var(--reputation);
  color: var(--bg);
  background: var(--reputation);
  font-weight: 600;
}

.btn--ghost {
  grid-column: 1 / -1;
  background: transparent;
  color: var(--text-dim);
  border-color: var(--line);
}

/* ===== Intro / character screen ===== */
.intro {
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: center;
  flex: 1;
  text-align: center;
}
.intro__logo {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.25;
}
.intro__logo span { color: var(--reach); }
.intro__subtitle {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.5;
}

.char-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  text-align: left;
}
.char-card__name {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0 0 8px;
}
.char-card__bio { font-size: 15px; line-height: 1.5; margin: 0 0 10px; color: var(--text); }
.char-card__weakness {
  font-size: 13px;
  color: var(--text-dim);
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 4px;
}
.char-card__stats {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ===== Joker screen ===== */
.joker-card {
  border-color: var(--money);
  background: linear-gradient(160deg, var(--surface-raised), var(--surface));
}
.joker-card .card__eyebrow { color: var(--money); }

/* ===== Gameover screen ===== */
.gameover {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  justify-content: center;
  text-align: center;
}
.gameover__badge {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.gameover__title {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0;
}
.gameover.win .gameover__title { color: var(--positive); }
.gameover.lose .gameover__title { color: var(--negative); }
.gameover__text {
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.final-stats {
  display: flex;
  justify-content: center;
  gap: 14px;
  font-family: var(--font-mono);
}

@media (max-width: 360px) {
  .card__question { font-size: 17px; }
  .card { padding: 22px 18px; min-height: 240px; }
}
