@font-face { font-family: 'Barlow Condensed'; font-weight: 800; font-display: block; src: url(../fonts/barlow-condensed-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: block; src: url(../fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: block; src: url(../fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: block; src: url(../fonts/inter-latin-700-normal.woff2) format('woff2'); }

:root {
  --bg: #0d0c0e;
  --surface: #1a181c;
  --line: #2c2830;
  --red: #e0182d;
  --red-dark: #9e0f1f;
  --text: #f4f1ec;
  --muted: #9c969f;
  --card: #f3efe7;
  --ink: #141214;
  --display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; display: flex; flex-direction: column; overscroll-behavior: none; }
main { flex: 1; width: 100%; max-width: 460px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px 8px; display: flex; flex-direction: column; }
.red { color: var(--red); }

.btn {
  font: 600 16px/1.2 var(--body); color: var(--text); background: transparent; border: 1.5px solid var(--line);
  border-radius: 12px; padding: 14px 16px; cursor: pointer; touch-action: manipulation; transition: transform .08s, background .15s, border-color .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--red); border-color: var(--red); font: 800 22px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.btn.primary:hover { background: #f02238; }
.btn.big { width: 100%; padding: 18px; }
.btn:not(.primary).big { font: 800 20px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; }

/* Intro */
.screen { flex: 1; display: flex; flex-direction: column; }
#intro { justify-content: center; }
.intro-body { display: flex; flex-direction: column; align-items: stretch; text-align: center; gap: 24px; padding: 0 4px; }
.wordmark { font: 800 clamp(84px, 27vw, 132px)/.86 var(--display); margin: 0; letter-spacing: -.01em; }
.intro-line { font: 500 20px/1.45 var(--body); margin: 0 auto; color: #e6e1da; max-width: 30ch; text-wrap: balance; }
.intro-line b { color: var(--text); }

/* HUD */
.hud { display: flex; flex-direction: column; gap: 10px; }
.hud-top { display: flex; justify-content: space-between; align-items: flex-end; }
.hud-pts { font: 800 58px/.85 var(--display); }
.hud-pts .of { font-size: 22px; color: var(--muted); margin-left: 4px; letter-spacing: .04em; }
.hud-pts.bump #pts { display: inline-block; animation: bump .45s ease-out; color: var(--red); }
.hud-meta { text-align: right; font: 600 17px/1.25 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hud-meta b { color: var(--text); font-weight: 800; font-size: 20px; }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }

.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.meter { position: relative; background: var(--surface); border-radius: 12px; padding: 14px 10px 9px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text); }
.meter svg { width: 26px; height: 26px; }
.meter .bar { width: 100%; height: 6px; border-radius: 3px; background: #2e2a31; overflow: hidden; }
.meter .bar b { display: block; height: 100%; width: 50%; background: var(--text); border-radius: 3px; transition: width .5s cubic-bezier(.2,.8,.2,1), background .3s; }
.meter .lbl { font: 600 13px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.meter.low .bar b { background: var(--red); }
.meter.low svg { color: var(--red); animation: pulse 1s infinite; }
.meter.up { animation: glowUp .7s; }
.meter.down { animation: glowDown .7s; }
.meter.dead { animation: shake .5s; background: var(--red-dark); }
@keyframes glowUp { 30% { box-shadow: 0 0 0 2px var(--text); } }
@keyframes glowDown { 30% { box-shadow: 0 0 0 2px var(--red); } }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.meter .hint { position: absolute; top: 5px; left: 50%; width: 0; height: 0; border-radius: 50%; background: var(--text); transform: translateX(-50%); transition: width .15s, height .15s; }
.meter .hint.s { width: 7px; height: 7px; }
.meter .hint.l { width: 12px; height: 12px; top: 3px; }

.next { margin: 14px 2px 0; font: 600 15px/1.3 var(--display); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); min-height: 20px; }
.next b { color: var(--text); font-weight: 800; }

/* Card */
.stage { position: relative; flex: 1 1 0; min-height: 270px; margin: 12px 0; perspective: 900px; }
/* The card takes the height the screen leaves (up to 480px), so the picture gets the room. */
.card {
  position: absolute; inset: 0; margin: auto; width: min(100%, 360px); height: min(100%, 480px); background: var(--card); color: var(--ink);
  border-radius: 20px; padding: 24px 22px 16px; display: flex; flex-direction: column; justify-content: flex-start; gap: 12px;
  box-shadow: 0 18px 40px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06); touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab; will-change: transform; outline: none; overflow: hidden;
}
.card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 10px; background: var(--red); }
.card:active { cursor: grabbing; }
.card.enter { animation: deal .38s cubic-bezier(.2,.9,.25,1.15); }
@keyframes deal { from { transform: translateY(28px) scale(.92) rotate(-2deg); opacity: 0; } }
.card-tag { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; margin-top: 4px; font: 800 14px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--red); }
.card-tag::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(224,24,45,.18); }
/* The picture takes whatever the text leaves; app.js sizes the emoji to fill it. */
.card-icon { flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.card-icon img { display: block; width: 96px; height: 96px; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.card-text { font: 700 clamp(21px, 6vw, 25px)/1.28 var(--body); margin: 0; letter-spacing: -.01em; }
.card-foot { font: 600 14px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: #7d767f; }
.choice {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 22px 20px; background: var(--ink); border-top: 3px solid var(--red);
  color: var(--text); font: 800 24px/1.05 var(--display); letter-spacing: .02em; text-transform: uppercase; opacity: 0; pointer-events: none;
}
/* The label sits on the edge that stays on screen: swiping left shows it on the right. */
.choice.left { text-align: right; }
.choice.right { text-align: left; }

.swipe-tip { text-align: center; color: var(--muted); font-size: 14px; margin: -4px 0 10px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-bottom: 6px; }
.choice-btn { min-height: 64px; font-size: 15px; line-height: 1.25; }
#btnL { text-align: left; }
#btnR { text-align: right; }
.choice-btn:hover, .choice-btn:focus-visible { border-color: var(--text); }
.choice-btn .arr { color: var(--red); font-weight: 700; }

/* Flash */
.flash { position: fixed; inset: 0; z-index: 20; background: rgba(8,7,9,.94); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: pointer; animation: fadeIn .15s; }
@keyframes fadeIn { from { opacity: 0; } }
.flash-inner { width: 100%; max-width: 440px; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.flash-kicker { font: 600 17px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.flash-match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.team { font: 800 24px/1.05 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.team.us { color: var(--text); }
.team.them { color: #c9c3cc; }
.flash-match .team:first-child { text-align: right; }
.flash-match .team:last-child { text-align: left; }
.score { font: 800 92px/.9 var(--display); letter-spacing: -.02em; min-width: 2.4ch; }
.score.slam { animation: slam .42s cubic-bezier(.15,1.2,.3,1) both; }
@keyframes slam { 0% { transform: scale(2.6); opacity: 0; } 55% { opacity: 1; } 100% { transform: scale(1); } }
.flash-inner.hit { animation: hit .3s .3s; }
@keyframes hit { 30% { transform: translateY(5px); } }
.flash-verdict { justify-self: center; align-self: center; margin: 0 auto; font: 800 22px/1 var(--display); letter-spacing: .14em; padding: 8px 16px; border-radius: 8px; text-transform: uppercase; opacity: 0; }
.flash-verdict.show { opacity: 1; animation: pop .3s .35s both; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.flash-verdict.W { background: var(--red); color: #fff; }
.flash-verdict.D { background: #3a363d; color: var(--text); }
.flash-verdict.L { background: transparent; color: var(--muted); border: 1.5px solid #3a363d; }
.flash-mod { font: 500 14px/1.3 var(--body); color: var(--muted); min-height: 18px; }
.flash-pts { font: 800 34px/1 var(--display); letter-spacing: .04em; color: var(--muted); }
.flash-pts span { color: var(--text); display: inline-block; }
.flash-pts span.tick { animation: bump .45s; color: var(--red); }

/* End */
#end { justify-content: center; }
.end-body { display: flex; flex-direction: column; gap: 16px; padding: 0 0 8px; text-align: center; }
.end-line { text-wrap: balance; }
.end-kicker { font: 800 20px/1 var(--display); letter-spacing: .16em; color: var(--red); text-transform: uppercase; }
.end-line { font: 800 clamp(38px, 11vw, 54px)/.98 var(--display); margin: 0; text-transform: uppercase; letter-spacing: -.005em; }
.end-pts { font: 800 96px/.85 var(--display); color: var(--red); }
.end-pts small { font-size: 28px; color: var(--muted); margin-left: 6px; letter-spacing: .06em; }
.end-chart { width: 100%; height: auto; background: var(--surface); border-radius: 14px; }
.end-actions { display: grid; gap: 10px; margin-top: 4px; }
.x-link { text-align: center; color: var(--muted); font: 600 15px/1 var(--body); padding: 6px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.end-body.enter > * { animation: rise .5s both; }
.end-body.enter > *:nth-child(2) { animation-delay: .08s; }
.end-body.enter > *:nth-child(3) { animation-delay: .16s; }
.end-body.enter > *:nth-child(4) { animation-delay: .24s; }
.end-body.enter > *:nth-child(n+5) { animation-delay: .32s; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--text); color: var(--ink); font: 600 15px/1.3 var(--body); padding: 12px 18px; border-radius: 10px; z-index: 30; max-width: 90vw; text-align: center; }

.foot { text-align: center; padding: 18px 16px max(18px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; line-height: 1.7; }
.foot a { color: var(--text); text-underline-offset: 3px; }
body.playing .foot { display: none; }
/* Home and the ending: the content and the footer as one block, centred top to bottom. */
body.centred { justify-content: center; }
body.centred main { flex: 0 0 auto; padding-top: max(24px, env(safe-area-inset-top)); }
body.centred .foot { padding-top: 28px; }

@media (max-height: 700px) {
  main { padding-top: max(8px, env(safe-area-inset-top)); }
  .hud { gap: 8px; }
  .hud-pts { font-size: 46px; }
  .hud-pts .of { font-size: 19px; }
  .meter { padding: 10px 8px 7px; gap: 4px; }
  .meter svg { width: 22px; height: 22px; }
  .next { margin-top: 10px; }
  .stage { margin: 8px 0; min-height: 250px; }
  .card { padding: 18px 18px 12px; gap: 9px; }
  .card-text { font-size: 19px; line-height: 1.25; }
  .swipe-tip { margin: -2px 0 6px; font-size: 13px; }
}
@media (max-width: 380px) {
  .choice-btn { padding: 12px 12px; font-size: 14.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
