/* Size Matters has its own look (a game, not the site): deep space navy, mint, gold for the
   clock and combo, green and red for right and wrong. Display type is Audiowide (one weight,
   so emphasis comes from size and colour), matching the logo; numbers are mono with tabular figures. */
:root {
  --space: #070d1f;
  --space-2: #0c1633;
  --surface: rgba(16, 28, 60, 0.86);
  --surface-hi: rgba(26, 42, 86, 0.94);
  --line: rgba(150, 180, 255, 0.2);
  --ink: #eef3ff;
  --muted: #aebbdc;
  --mint: #36e0c4;
  --mint-deep: #22c79c;
  --gold: #ffc94a;
  --good: #3ddc84;
  --bad: #ff5d6c;
  --font-display: "Audiowide", "Arial Black", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 18px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(1200px 700px at 70% -10%, #14234d 0%, transparent 60%),
    radial-gradient(900px 600px at -10% 110%, #0f1d44 0%, transparent 55%), var(--space);
  color: var(--ink);
  font: 500 16px/1.45 var(--font-body);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* A sprinkle of stars, drawn with gradients so there's nothing to load. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 33% 72%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 64%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 56% 40%, #fff4 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 8% 88%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 64% 92%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 44% 8%, #fff5 50%, transparent 51%);
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

/* ---------- the globe ---------- */

.space-globe {
  position: fixed;
  z-index: 0;
  width: min(135vw, 1000px);
  aspect-ratio: 1;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  opacity: 0.32;
  pointer-events: none;
}

.mark {
  display: block;
  height: auto;
}
.mark.mid {
  width: 96px;
}
.mark.small {
  width: 34px;
}

.screen {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

/* ---------- title ---------- */

.title,
.end {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
}

.wordmark {
  margin: 0;
  line-height: 0;
}
.logo {
  display: block;
  width: min(92vw, 460px);
  height: auto;
  filter: drop-shadow(0 0 24px rgba(54, 224, 196, 0.2));
}

.tagline {
  margin: 0;
  max-width: 30ch;
  font-size: 18px;
  color: var(--muted);
}

.modes {
  display: grid;
  gap: 14px;
  width: min(100%, 440px);
  margin-top: 12px;
}

.mode {
  display: grid;
  gap: 2px;
  justify-items: center;
  width: 100%;
  min-height: 76px;
  padding: 14px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background-color 0.12s ease;
}
.mode:active {
  transform: translateY(1px) scale(0.99);
}
.mode-name {
  font: 400 24px/1.1 var(--font-display);
  letter-spacing: 0.01em;
}
.mode-sub {
  font-size: 15px;
  font-weight: 600;
}

.mode.primary {
  border: 0;
  background: linear-gradient(180deg, #7ff7d6, var(--mint) 55%, var(--mint-deep));
  color: #04241c;
  box-shadow:
    0 6px 0 #129373,
    0 12px 32px rgba(95, 240, 200, 0.35);
}
.mode.primary:hover {
  box-shadow:
    0 6px 0 #129373,
    0 14px 40px rgba(95, 240, 200, 0.5);
}
.mode.primary:active {
  box-shadow:
    0 2px 0 #129373,
    0 6px 20px rgba(95, 240, 200, 0.35);
  transform: translateY(4px);
}

.mode.secondary {
  border: 2px solid var(--mint);
  background: var(--surface-hi);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.mode.secondary:hover {
  background: #22386f;
}
.mode.secondary .mode-sub {
  color: var(--muted);
}

.mode.done {
  background: var(--surface-hi);
  color: var(--ink);
  border: 2px solid var(--line);
  box-shadow: none;
}

.mode.small {
  min-height: 56px;
  padding: 10px 18px;
}
.mode.small .mode-name,
.mode.small {
  font: 400 19px/1.1 var(--font-display);
}

.pn {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #04241c;
  color: var(--gold);
  font: 700 12px/1.5 var(--font-mono);
  vertical-align: 2px;
}
.mode.secondary .pn,
.mode.done .pn {
  background: rgba(255, 201, 74, 0.14);
}

.how {
  max-width: 40ch;
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--muted);
}

/* ---------- play ---------- */

.play {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 920px;
  margin: 0 auto;
  padding-top: max(10px, env(safe-area-inset-top));
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 10px 4px 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.brand:hover {
  background: rgba(255, 255, 255, 0.06);
}
.bar-word {
  font: 400 15px/1 var(--font-display);
  text-transform: uppercase;
}

.bar-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.combo {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 201, 74, 0.5);
  color: var(--gold);
  font: 700 15px/1.2 var(--font-mono);
}
.combo.bump {
  animation: bump 0.35s ease;
}

.score {
  font: 700 15px/1.2 var(--font-mono);
}
.score-label {
  color: var(--muted);
  font: 600 13px var(--font-body);
}
.score b {
  font-size: 20px;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-height: 10px;
}
.dots li {
  width: 22px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
}
.dots li.now {
  background: rgba(255, 255, 255, 0.45);
}
.dots li.good {
  background: var(--good);
}
.dots li.bad {
  background: var(--bad);
}

.board {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.board.blur {
  filter: blur(16px) saturate(0.6);
  pointer-events: none;
}

.question {
  margin: 4px 0 0;
  text-align: center;
  font: 400 clamp(20px, 5.4vw, 32px) / 1.2 var(--font-display);
  text-wrap: balance;
}

.clock {
  display: flex;
  align-items: center;
  gap: 12px;
}
.clock-track {
  flex: 1;
  height: 12px;
  border-radius: 6px;
  background: rgba(255, 201, 74, 0.14);
  overflow: hidden;
}
.clock-fill {
  height: 100%;
  width: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #ffb020, var(--gold));
  box-shadow: 0 0 16px rgba(255, 201, 74, 0.55);
  transform-origin: left center;
}
.clock.low .clock-fill {
  background: linear-gradient(90deg, #ff7a3c, #ffa53c);
}
.clock-num {
  min-width: 6.5ch;
  text-align: right;
  color: var(--gold);
  font: 700 22px/1 var(--font-mono);
}
.clock-num small {
  font-size: 12px;
  color: var(--muted);
}

.cards {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.card {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  min-height: 132px;
  padding: 18px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(6px);
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    transform 0.12s ease;
}
.card:hover:not([disabled]) {
  border-color: rgba(95, 240, 200, 0.7);
  background: var(--surface-hi);
}
.card:active:not([disabled]) {
  transform: scale(0.985);
}
.card[disabled] {
  cursor: default;
}
.card-key {
  display: none;
  position: absolute;
  top: 10px;
  left: 12px;
  color: var(--muted);
  font: 600 13px var(--font-mono);
  opacity: 0.7;
}
.card-name {
  font: 400 clamp(19px, 5.2vw, 28px) / 1.15 var(--font-display);
  text-wrap: balance;
}
.card-region {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.card-value {
  min-height: 1.3em;
  color: var(--ink);
  font: 700 clamp(20px, 5.4vw, 28px) / 1.2 var(--font-mono);
}
.card-value small {
  color: var(--muted);
  font-size: 0.55em;
  font-weight: 500;
}
.card-extra {
  min-height: 1.2em;
  color: var(--muted);
  font-size: 13px;
}
.card.win {
  border-color: var(--good);
  background: rgba(20, 70, 52, 0.9);
  box-shadow:
    0 0 0 1px var(--good),
    0 0 28px rgba(61, 220, 132, 0.35);
}
.card.win .card-value {
  color: #b8ffd5;
}
.card.wrong {
  border-color: var(--bad);
  background: rgba(80, 20, 34, 0.9);
}
.card.picked::after {
  content: "Your pick";
  position: absolute;
  bottom: 10px;
  right: 12px;
  font: 700 11px var(--font-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.8;
}

.vs {
  position: relative;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: -32px 0;
  z-index: 2;
  border-radius: 50%;
  background: var(--space);
  border: 2px solid var(--gold);
  color: var(--gold);
  font: 400 15px var(--font-display);
}

.fact {
  min-height: 2.9em;
  margin: 0 auto;
  max-width: 52ch;
  text-align: center;
  color: var(--ink);
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.fact.show {
  opacity: 1;
}

.countdown {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  pointer-events: none;
  font: 400 clamp(120px, 40vw, 220px) / 1 var(--font-display);
  color: var(--gold);
  text-shadow: 0 0 40px rgba(255, 201, 74, 0.5);
}
.countdown:empty {
  display: none;
}
.countdown span {
  animation: count 0.7s ease-out both;
}

/* Floats over the middle of the board, where the VS is, clear of both numbers. */
.verdict {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  translate: -50% -50%;
  padding: 16px 28px;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
  font: 400 clamp(26px, 8vw, 40px) / 1 var(--font-display);
}
.verdict:empty {
  display: none;
}
.verdict.good {
  background: var(--good);
  color: #03230f;
  box-shadow: 0 12px 40px rgba(61, 220, 132, 0.5);
}
.verdict.bad {
  background: var(--bad);
  color: #2a0007;
  box-shadow: 0 12px 40px rgba(255, 93, 108, 0.45);
}
.verdict.pop {
  animation: pop 1.6s ease both;
}

/* ---------- end ---------- */

.end-kicker {
  margin: 0;
  color: var(--mint);
  font: 700 14px var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.end-title {
  margin: 0;
  font: 400 clamp(30px, 9vw, 48px) / 1.05 var(--font-display);
}
.end-score {
  margin: 0;
  font: 700 18px var(--font-mono);
  color: var(--muted);
}
.end-score b {
  display: block;
  color: var(--gold);
  font-size: clamp(48px, 15vw, 72px);
  line-height: 1.05;
}
.end-note {
  margin: 0;
  min-height: 1.4em;
  max-width: 36ch;
}
.grid {
  display: grid;
  grid-template-columns: repeat(5, 30px);
  gap: 6px;
  margin: 4px 0;
  padding: 0;
  list-style: none;
}
.grid:empty {
  display: none;
}
.grid li {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}
.grid li.good {
  background: var(--good);
}
.grid li.bad {
  background: var(--bad);
}
.end-actions {
  display: grid;
  gap: 12px;
  width: min(100%, 360px);
  margin-top: 8px;
}
.link {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--mint);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.share-text {
  width: min(100%, 360px);
  min-height: 110px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--space-2);
  color: var(--ink);
  font: 500 14px/1.4 var(--font-mono);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 10;
  translate: -50% 0;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: #1d2b55;
  border: 1px solid var(--line);
}

/* Anything that counts keeps its width as the digits change (after each font shorthand). */
.clock-num,
.score,
.combo,
.card-value,
.end-score,
.pn {
  font-variant-numeric: tabular-nums;
}

/* ---------- wider screens ---------- */

@media (min-width: 700px) {
  .cards {
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    gap: 0;
  }
  .vs {
    align-self: center;
    margin: 0 -24px;
  }
  .card {
    min-height: 220px;
  }
  .card-key {
    display: block;
  }
  /* Side by side, the numbers sit mid-card: float the verdict across the cards' top edge. */
  .verdict {
    top: 0;
  }
}

@media (min-width: 700px) and (min-height: 700px) {
  .play {
    justify-content: center;
    gap: 18px;
  }
}

/* ---------- motion ---------- */

@keyframes count {
  from {
    opacity: 0;
    transform: scale(1.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes pop {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  12% {
    opacity: 1;
    transform: scale(1.06);
  }
  20% {
    transform: scale(1);
  }
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes bump {
  50% {
    transform: scale(1.25);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
