/* Pi-Squared Daily. Colours taken from the app. */

/* Windows has no flag emojis (it shows "IE", "US"). This font fills in flags only,
   and the browser downloads it only when a flag is on screen. */
@font-face {
  font-family: "Twemoji Country Flags";
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E007F;
  src: url("https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1.8/dist/TwemojiCountryFlags.woff2") format("woff2");
  font-display: swap;
}
:root {
  --yellow: #f9c71b;
  --blue: #2196f3;
  --pink: #e91e63;
  --pink-dark: #c2185b;
  --red: #f33729;
  --green: #05dd63;
  --purple: #6750a4;
  --ink: #111;
  --muted: #6b6470;
  --bg: #fef7ff;
  --card: #fff;
  --grey: #e2e2e2;
  --round: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: "Twemoji Country Flags", "Rubik", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; min-height: 100dvh; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; background: var(--bg); }
@media (min-width: 520px) { #app { box-shadow: 0 0 0 1px #eadff0, 0 20px 60px rgba(60, 20, 80, .08); } }

/* Top bars */
.brand { background: var(--yellow); display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px; }
.brand img { width: 54px; height: auto; }
.brand span { font: 700 40px/1 "Kanit", "Rubik", sans-serif; letter-spacing: -.01em; }
.modebar { background: var(--pink); padding: calc(18px + env(safe-area-inset-top)) 16px 18px; text-align: center; }
.modebar h1 { margin: 0; font: 800 28px/1.1 "Rubik", sans-serif; color: var(--ink); }

.wrap { padding: 18px 16px 40px; }

/* Start screen */
.statbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  background: var(--blue); color: #fff; border-radius: 14px; padding: 12px 18px; box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.statbar div { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.statbar b { font-weight: 800; font-size: 17px; }
.statbar span { font-weight: 700; font-size: 18px; }
.statbar-mid { text-align: center; font-weight: 500; font-size: 14px; opacity: .95; }

.card { margin: 18px 0 0; border-radius: var(--round); padding: 26px 18px 24px; text-align: center; color: #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,.14); }
.card-daily { background: var(--pink); }
.card .icon { width: 76px; height: 76px; display: block; margin: 0 auto 10px; }
.card p { margin: 6px 0 0; font-size: 19px; font-weight: 500; }
.outlined { margin: 0; font: 900 34px/1 "Rubik", sans-serif; letter-spacing: .02em; color: #fff;
  -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill; }

.pitch { text-align: center; font-size: 17px; color: #3b3540; margin: 22px 8px 18px; line-height: 1.45; }
.btn { border: 0; border-radius: 999px; padding: 14px 30px; font-weight: 700; font-size: 20px; color: #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,.18); transition: transform .08s; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.btn-pink { background: var(--pink); }
.btn-big { display: block; width: 100%; padding: 18px; font-size: 24px; }
.link { display: block; margin: 16px auto 0; background: none; border: 0; color: var(--blue); font-weight: 500; font-size: 16px; }

/* Pop-up sheets: help, about you, privacy */
dialog.sheet { border: 0; border-radius: var(--round); padding: 22px 20px 20px; width: min(420px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px); overflow: auto; color: var(--ink); }
dialog.sheet::backdrop { background: rgba(30, 10, 40, .45); }
dialog.sheet h2 { margin: 0 0 8px; font-weight: 800; }
dialog.sheet h3 { margin: 16px 0 8px; font-size: 15px; font-weight: 700; }
dialog.sheet ol, dialog.sheet ul { padding-left: 20px; margin: 0 0 18px; line-height: 1.45; }
dialog.sheet li { margin: 0 0 8px; }
dialog.sheet > .btn { width: 100%; }
.fine { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 6px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 2px solid #e4dbe9; background: #fff; border-radius: 999px; padding: 8px 13px; font-size: 15px; font-weight: 500; color: var(--ink); }
.chips button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.sheet-btns { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 20px; }
.btn-grey { background: #ece6ef; color: var(--ink); box-shadow: 0 4px 0 rgba(0,0,0,.08); }

/* Today's battle */
.battle { margin: 16px 0 18px; background: #fff; border-radius: var(--round); padding: 16px 14px 14px; text-align: center;
  box-shadow: 0 0 0 2px #f2e6f6, 0 4px 0 rgba(0,0,0,.06); }
.battle-tag { margin: 0; font: 800 12px/1 "Rubik", sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--pink); }
.battle h2 { margin: 6px 0 12px; font-size: 24px; font-weight: 800; }
.sides { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.sides-3 { grid-template-columns: repeat(3, 1fr); }
.sides-4 { grid-template-columns: repeat(2, 1fr); }
.sides-5 { grid-template-columns: repeat(6, 1fr); }
.sides-5 button:nth-child(-n+3) { grid-column: span 2; }
.sides-5 button:nth-child(n+4) { grid-column: span 3; }
.sides button { border: 3px solid #ece4f0; background: #faf7fb; border-radius: 16px; padding: 10px 6px 9px; font-weight: 700; font-size: 15px;
  color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .08s; }
.sides button .emo { font-size: 30px; line-height: 1.1; font-weight: 800; }
.sides button.on { border-color: var(--pink); background: #fde7ef; transform: scale(1.03); }
.battle-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.btn:disabled { background: #d9d2dd; color: #fff; box-shadow: none; cursor: default; }
.startlinks { display: flex; justify-content: center; gap: 18px; margin-top: 6px; }
.startlinks .link { margin: 10px 0 0; }

/* 3-2-1 */
.count { display: grid; place-items: center; min-height: 60vh; }
.count-n { font: 900 140px/1 "Rubik", sans-serif; color: var(--pink); }
.pop { animation: pop .4s ease-out; }
@keyframes pop { from { transform: scale(1.5); opacity: .3; } to { transform: scale(1); opacity: 1; } }

/* Play */
.play { display: flex; flex-direction: column; align-items: center; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.timer { font: 500 52px/1 "Rubik", sans-serif; color: var(--red); font-variant-numeric: tabular-nums; margin: 4px 0 18px; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; padding: 0; margin: 0 0 22px; width: 100%; }
.steps li { aspect-ratio: 1; border-radius: 10px; background: var(--grey); color: #fff; display: grid; place-items: center;
  font-size: 22px; font-weight: 500; border: 3px solid transparent; transition: background .15s; }
.steps li.done { background: var(--pink); }
.steps li.now { background: #f1eef3; color: #9c95a2; border-color: var(--blue); }
.question { font: 500 54px/1.1 "Rubik", sans-serif; font-variant-numeric: tabular-nums; margin: 4px 0 16px; text-align: center; }
.answer { width: 100%; height: 72px; border: 3px solid var(--purple); border-radius: 12px; background: #fff;
  font: 700 40px/66px "Rubik", sans-serif; text-align: center; font-variant-numeric: tabular-nums; }
.answer.empty::before { content: "?"; color: #cfc8d4; }
.answer.wrong { border-color: var(--red); background: #fff0ef; color: var(--red); animation: shake .28s; }
.answer.right { animation: flash .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes flash { from { background: #dcfce7; border-color: #16a34a; } to { background: #fff; } }

.keypad { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px;
  background: #d1d4db; padding: 8px; border-radius: 14px; user-select: none; -webkit-user-select: none; }
.keypad button { height: 58px; border: 0; border-radius: 8px; background: #fff; font-size: 28px; font-weight: 500; color: var(--ink);
  box-shadow: 0 1px 0 #8a8d93; }
.keypad button:active { background: #e8e8ec; }
.keypad button[data-k="back"] { background: transparent; box-shadow: none; font-size: 26px; }

/* Results */
.results { text-align: center; }
.eyebrow { margin: 4px 0 0; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.big-time { font: 800 84px/1 "Rubik", sans-serif; color: var(--red); font-variant-numeric: tabular-nums; margin: 8px 0 6px; }
.big-time small { font-size: 40px; margin-left: 2px; }
.squares { font-size: 30px; letter-spacing: 4px; margin: 4px 0 4px; }
.sub { margin: 0 0 20px; color: #3b3540; }
.toast { height: 0; overflow: hidden; color: #16a34a; font-weight: 600; transition: height .2s; }
.toast.show { height: 30px; line-height: 30px; }

.panel { background: var(--card); border-radius: 18px; padding: 16px 16px 14px; margin-top: 18px; text-align: left;
  box-shadow: 0 2px 0 rgba(0,0,0,.06), 0 0 0 1px #efe7f2; }
.panel h2 { margin: 0 0 10px; font-size: 18px; font-weight: 800; }
.muted { color: var(--muted); margin: 4px 0; }
.beat { margin: 0 0 12px; font-size: 16px; }
.beat b { color: var(--pink); font-size: 20px; }
.beat em { color: var(--muted); font-style: normal; font-size: 13px; }
.dist .row { display: grid; grid-template-columns: 74px 1fr 64px; align-items: center; gap: 8px; margin: 5px 0; font-size: 14px; }
.dist .lab { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.dist .bar { height: 20px; background: #f3eff5; border-radius: 6px; overflow: hidden; }
.dist .bar i { display: block; height: 100%; background: #c9c1d0; border-radius: 6px; min-width: 3px; }
.dist .pct { font-variant-numeric: tabular-nums; color: var(--muted); }
.dist .row.mine .bar i { background: var(--pink); }
.dist .row.mine .lab, .dist .row.mine .pct { color: var(--pink); font-weight: 700; }

.team { margin: -4px 0 10px; font-size: 15px; }
.vs-row { display: grid; grid-template-columns: 118px 1fr 92px; align-items: center; gap: 8px; margin: 7px 0; font-size: 14px; }
.vs-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs-num { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.vs .bar { height: 22px; background: #f3eff5; border-radius: 6px; overflow: hidden; }
.vs .bar i { display: block; height: 100%; background: #c9c1d0; border-radius: 6px; }
.vs-row.win .bar i { background: var(--blue); }
.vs-row.mine .vs-name, .vs-row.mine .vs-num { color: var(--pink); font-weight: 700; }
.vs-row.mine .bar i { box-shadow: inset 0 0 0 3px var(--pink); }
.gv { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 6px 0 12px; }
.gv-side { background: #f7f3f9; border-radius: 14px; padding: 10px 8px; text-align: center; border: 2px solid transparent; }
.gv-side span { display: block; font-weight: 600; font-size: 14px; color: var(--muted); }
.gv-side b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.gv-side small { color: var(--muted); font-size: 12px; }
.gv-side.win { border-color: var(--blue); background: #eaf4fe; }
.gv-side.win b { color: var(--blue); }
.gv-mid { font-weight: 800; color: #b9b0bf; }
.mini { margin: 14px 0 6px; font-size: 15px; font-weight: 700; }
.mini span { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 4px; }
.dist .row { grid-template-columns: 74px 1fr 96px; }
.doc { line-height: 1.55; font-size: 16px; }
.doc h1 { font-weight: 800; margin: 8px 0 0; }
.doc h2 { font-size: 18px; font-weight: 800; margin: 22px 0 4px; }
.doc p, .doc li { color: #2d2733; }
.doc ul { padding-left: 20px; }
.doc a:not(.btn) { color: var(--blue); }
.splits { list-style: none; margin: 0; padding: 0; }
.splits li { display: flex; justify-content: space-between; padding: 8px 2px; border-top: 1px solid #f1ebf3; font-size: 17px; font-variant-numeric: tabular-nums; }
.splits li:first-child { border-top: 0; }
.next { margin: 24px 0 0; color: var(--muted); }
.next b { color: var(--ink); font-variant-numeric: tabular-nums; }
