/* Phone — thumb-driven: buttons ≥ 64px, no scrolling during a round, no typing where avoidable. */

.phone {
  position: relative;
  max-width: 480px; margin: 0 auto;
  height: 100dvh;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  overflow: hidden;
}
.stage { flex: 1; min-height: 0; position: relative; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 20px 20px 24px; overflow: hidden; }
.screen.enter { animation: enter .45s var(--ease-out) both; }
@keyframes enter { from { opacity: 0; transform: translateY(14px) scale(.985); } }

/* ---------- top bars ---------- */
.netbar {
  background: var(--c-bad); color: #fff; text-align: center; font-weight: 600;
  padding: 8px 12px; font-size: 15px; animation: pulse-bg 1.4s ease-in-out infinite;
}
@keyframes pulse-bg { 50% { filter: brightness(1.15); } }

.station { padding: 12px 20px 10px; border-bottom: 1px solid var(--c-line); background: color-mix(in srgb, var(--c-bg) 60%, transparent); backdrop-filter: blur(8px); }
.station-label { font-size: 14px; font-weight: 600; color: var(--c-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { position: relative; height: 4px; margin: 12px 14px 4px; border-radius: 4px; background: var(--c-line); }
.track-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: inherit; background: linear-gradient(to left, var(--c-primary), var(--c-opt-2)); transition: width 1.2s var(--ease-out); }
.track .dot { position: absolute; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: var(--c-surface); border: 1.5px solid var(--c-line); transform: translateX(50%); }
.track .dot.on { background: var(--c-primary); border-color: var(--c-primary); }
.rocket {
  position: absolute; top: 50%; font-size: 17px; line-height: 1;
  /* RTL: the ship travels leftwards, so flip the emoji to face the way it flies */
  transform: translate(50%, -55%) scaleX(-1) rotate(-45deg);
  transition: inset-inline-start 1.2s var(--ease-out);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c-primary) 70%, transparent));
}

.paused {
  position: absolute; inset-inline: 16px; bottom: 16px; z-index: 5;
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 14px;
  padding: 12px 16px; text-align: center; font-weight: 600; color: var(--c-primary);
}

/* ---------- type ---------- */
.title { font-size: 30px; font-weight: 900; line-height: 1.1; margin: 0; letter-spacing: -.01em; }
.big-text { font-size: 32px; font-weight: 800; line-height: 1.15; margin: 0; text-wrap: balance; }
.huge { font-size: 44px; font-weight: 900; margin: 0; line-height: 1; }
.question { font-size: 26px; font-weight: 800; line-height: 1.2; margin: 6px 0 18px; text-wrap: balance; }
.sub { color: var(--c-text-dim); font-size: 17px; margin: 0; line-height: 1.4; }
.label { font-size: 15px; font-weight: 600; color: var(--c-text-dim); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .06em; color: var(--c-text-dim); font-weight: 600; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; align-self: center;
  padding: 7px 14px; border-radius: 99px; font-size: 14px; font-weight: 700;
  background: color-mix(in srgb, var(--c-primary) 14%, transparent); color: var(--c-primary);
  border: 1px solid color-mix(in srgb, var(--c-primary) 35%, transparent);
}
.badge.glow { box-shadow: 0 0 24px color-mix(in srgb, var(--c-primary) 45%, transparent); }
.error { color: var(--c-bad); font-weight: 600; min-height: 1.4em; margin: 0; font-size: 16px; }

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

/* ---------- buttons & fields ---------- */
.btn { min-height: 64px; border-radius: var(--radius); font-weight: 800; font-size: 20px; padding: 0 24px; transition: transform .12s ease, filter .2s, opacity .2s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--c-primary); color: var(--c-on-primary); box-shadow: 0 8px 28px color-mix(in srgb, var(--c-primary) 30%, transparent), inset 0 -3px 0 rgba(0,0,0,.12); }
.btn:disabled { opacity: .35; box-shadow: none; }
.btn.big { width: 100%; }

.field {
  width: 100%; min-height: 64px; padding: 0 18px; border-radius: var(--radius);
  background: var(--c-glass); border: 1.5px solid var(--c-line); font-size: 22px; font-weight: 600;
  outline: none; transition: border-color .2s, background .2s;
}
.field:focus { border-color: var(--c-primary); background: rgba(255,255,255,.09); }
.field::placeholder { color: color-mix(in srgb, var(--c-text-dim) 60%, transparent); font-weight: 500; }
.field-wrap { position: relative; }
.count { position: absolute; inset-inline-end: 16px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--c-text-dim); font-variant-numeric: tabular-nums; }
.code-field { text-align: center; letter-spacing: .3em; font-size: 34px; font-weight: 800; direction: ltr; }

.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- code & join ---------- */
.form-screen { overflow-y: auto; gap: 14px; justify-content: center; }
.form-screen .logo { width: 120px; align-self: center; margin-bottom: 10px; }
.form-screen > .title, .form-screen > .sub { text-align: center; }
.join { justify-content: flex-start; padding-top: 28px; }
.join .title { margin-bottom: 8px; }
.kicker { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--c-opt-4); }
.blink { width: 8px; height: 8px; border-radius: 50%; background: var(--c-opt-4); box-shadow: 0 0 10px var(--c-opt-4); animation: blink 1.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* Astronaut builder: live preview + tabs (suit, skin, hair, glasses, jewelry) */
.builder { display: flex; flex-direction: column; gap: 12px; }
.builder-preview { position: relative; align-self: center; width: 150px; height: 150px; }
.builder-preview img { width: 100%; height: 100%; filter: drop-shadow(0 14px 30px rgba(0,0,0,.45)); }
.builder-preview img.bump { animation: bump .35s var(--ease-spring); }
.builder-preview img.spin { animation: spin-in .6s var(--ease-spring); }
@keyframes bump { 40% { transform: scale(1.08) rotate(-3deg); } }
@keyframes spin-in { from { transform: rotate(-200deg) scale(.6); } }
.dice {
  position: absolute; bottom: 0; inset-inline-end: -64px; padding: 8px 12px; border-radius: 99px;
  background: var(--c-surface); border: 1px solid var(--c-line); font-size: 14px; font-weight: 700; white-space: nowrap;
}
.dice:active { transform: scale(.95); }
.builder-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.builder-tabs::-webkit-scrollbar { display: none; }
.builder-tabs button { flex: 1 1 0; padding: 10px 4px; border-radius: 99px; font-size: 15px; font-weight: 700; color: var(--c-text-dim); background: var(--c-glass); border: 1px solid transparent; }
.builder-tabs button[aria-selected="true"] { color: var(--c-on-primary); background: var(--c-primary); }
.builder-panel { min-height: 96px; padding: 12px; border-radius: var(--radius); background: var(--c-glass); border: 1px solid var(--c-line); }
.sublabel { font-size: 13px; font-weight: 700; color: var(--c-text-dim); margin: 12px 0 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; background: var(--sw); border: 3px solid transparent; box-shadow: inset 0 -4px 0 rgba(0,0,0,.18); transition: transform .2s var(--ease-spring); }
.swatch.on { border-color: #fff; transform: scale(1.12); box-shadow: 0 0 0 3px var(--c-primary); }
.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.look { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 8px; border-radius: 14px; border: 2px solid transparent; background: rgba(255,255,255,.03); }
.look-pic { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; }
.look-pic img { width: 100%; height: 100%; transform: scale(1.5) translateY(10%); }
.look span { font-size: 13px; font-weight: 700; color: var(--c-text-dim); }
.look.on { border-color: var(--c-primary); background: color-mix(in srgb, var(--c-primary) 14%, transparent); }
.look.on span { color: var(--c-text); }

/* ---------- lobby / waiting ---------- */
.hero-avatar { width: 168px; height: 168px; filter: drop-shadow(0 18px 40px rgba(0,0,0,.45)); }
.hero-avatar img { width: 100%; height: 100%; }
.float { animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-10px) rotate(-3deg); } }
.name { font-size: 36px; font-weight: 900; margin: 0; }
.waiting { color: var(--c-text-dim); font-size: 18px; margin: 12px 0 0; }
.dots i { display: inline-block; width: 5px; height: 5px; margin-inline-start: 4px; border-radius: 50%; background: currentColor; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { opacity: .2; } 30% { opacity: 1; } }

/* ---------- look up ---------- */
.chevrons { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 18px; }
.chevrons i { width: 34px; height: 34px; border-top: 6px solid var(--c-primary); border-left: 6px solid var(--c-primary); transform: rotate(45deg); border-radius: 4px; opacity: .2; animation: chev 1.5s infinite; }
.chevrons i:nth-child(1) { animation-delay: .3s; } .chevrons i:nth-child(2) { animation-delay: .15s; }
@keyframes chev { 30% { opacity: 1; } 60% { opacity: .2; } }
.mini-me { position: absolute; bottom: 20px; display: flex; align-items: center; gap: 8px; color: var(--c-text-dim); font-weight: 600; }
.mini-me img { width: 32px; height: 32px; }

/* ---------- map ---------- */
.ship-mini {
  position: absolute; top: 50%; width: 40px; height: auto;
  /* RTL: the ship travels leftwards, so it faces left */
  transform: translate(50%, -50%) scaleX(-1);
  transition: inset-inline-start 1.2s var(--ease-out);
  filter: drop-shadow(0 0 6px rgba(255, 190, 80, .6));
}
.flight { position: relative; width: 260px; height: 190px; margin-bottom: 4px; }
.flight .planet { position: absolute; width: 90px; height: 90px; inset: auto; left: 0; bottom: 0; }
.ship-big { position: absolute; width: 210px; right: 0; top: 10px; transform: scaleX(-1) rotate(-12deg); animation: cruise 2.6s ease-in-out infinite; filter: drop-shadow(0 0 20px rgba(255, 190, 80, .4)); }
@keyframes cruise { 50% { translate: -8px -10px; } }

.orbit { position: relative; width: 150px; height: 150px; margin-bottom: 6px; }
.planet { position: absolute; inset: 35px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff9b6b, #c2462a 60%, #7a2414); box-shadow: 0 0 40px #ff6a3d55; }
.ship { position: absolute; inset: 0; font-size: 26px; animation: orbit 3.2s linear infinite; transform-origin: 75px 75px; }
@keyframes orbit { to { transform: rotate(-360deg); } }
.stops { display: flex; gap: 10px; list-style: none; padding: 0; margin: 10px 0 0; }
.stops li { width: 14px; height: 14px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--c-text) 70%, transparent); }
.stops li.done { background: var(--c-primary); border-color: var(--c-primary); }
.stops li.skipped { background: transparent; border-color: var(--c-primary); opacity: .6; }
.stops li.next { border-color: var(--c-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-primary) 25%, transparent); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--c-primary) 0%, transparent); } }

/* ---------- option colors (shared) ---------- */
.opt-1 { --opt: var(--c-opt-1); } .opt-2 { --opt: var(--c-opt-2); }
.opt-3 { --opt: var(--c-opt-3); } .opt-4 { --opt: var(--c-opt-4); }

/* ---------- profile ---------- */
.profile { flex: 1; display: flex; flex-direction: column; }
.progress { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; color: var(--c-text-dim); }
.pips { display: flex; gap: 6px; }
.pips i { width: 22px; height: 6px; border-radius: 6px; background: var(--c-line); transition: background .3s; }
.pips i.done { background: var(--c-primary); }
.pips i.now { background: color-mix(in srgb, var(--c-primary) 50%, transparent); }
.tiles { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 12px; max-height: 420px; }
.tile {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  background: color-mix(in srgb, var(--opt) 14%, var(--c-bg-2));
  border: 2px solid color-mix(in srgb, var(--opt) 45%, transparent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px;
  transition: transform .15s ease, background .2s;
}
.tile:active, .tile.pressed { transform: scale(.95); background: color-mix(in srgb, var(--opt) 40%, var(--c-bg-2)); }
.tile-icon { position: relative; font-size: 46px; line-height: 1; }
.tile-icon img { position: absolute; inset: -12px; width: calc(100% + 24px); height: calc(100% + 24px); object-fit: cover; border-radius: 16px; }
.tile-icon em { font-style: normal; }
.tile-label { font-size: 19px; font-weight: 700; line-height: 1.2; text-wrap: balance; }

/* ---------- ID card ---------- */
.card-screen { flex: 1; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.card-top { text-align: center; }
.card-top .title { font-size: 26px; }
.idcard {
  position: relative; border-radius: 24px; padding: 18px;
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--c-accent) 60%, transparent), transparent 60%),
    linear-gradient(160deg, #2b1857, #160c2c);
  border: 1.5px solid color-mix(in srgb, var(--c-primary) 45%, transparent);
  box-shadow: 0 24px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.12);
  animation: card-in .7s var(--ease-spring) both;
  overflow: hidden;
}
.idcard::after { /* holographic sheen */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.14) 45%, transparent 55%);
  transform: translateX(-100%); animation: sheen 3.5s 1s ease-in-out infinite;
}
@keyframes sheen { 60%, 100% { transform: translateX(100%); } }
@keyframes card-in { from { opacity: 0; transform: translateY(30px) rotate(-3deg) scale(.92); } }
.idcard-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px dashed var(--c-line); }
.idcard-logo { height: 26px; width: auto; }
.idcard-title { text-align: end; line-height: 1.15; }
.idcard-title b { display: block; font-size: 18px; font-weight: 900; color: var(--c-primary); }
.idcard-title span { font-size: 12px; color: var(--c-text-dim); font-weight: 600; letter-spacing: .04em; }
.idcard-who { display: flex; align-items: center; gap: 14px; padding: 14px 0 10px; }
.hex { width: 84px; height: 92px; flex: none; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--c-primary); display: grid; place-items: center; }
.hex img { width: 76px; height: 76px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--c-bg-2); }
.idcard-name { font-size: 28px; font-weight: 900; line-height: 1.05; word-break: break-word; }
.idcard-no { margin-top: 6px; font-size: 13px; color: var(--c-text-dim); font-weight: 600; }
.idcard-no b { color: var(--c-text); letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.idcard-rows { margin: 0; display: grid; gap: 6px; }
.idcard-rows div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.05); }
.idcard-rows dt { font-size: 13px; color: var(--c-text-dim); font-weight: 600; white-space: nowrap; }
.idcard-rows dd { margin: 0; font-size: 16px; font-weight: 700; text-align: end; }
.idcard-rows dd span { margin-inline-end: 6px; }
.idcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 11px; letter-spacing: .14em; color: var(--c-text-dim); font-weight: 700; direction: ltr; }
.barcode { flex: 1; height: 18px; opacity: .5; background: repeating-linear-gradient(90deg, #fff 0 2px, transparent 2px 4px, #fff 4px 5px, transparent 5px 8px, #fff 8px 11px, transparent 11px 13px); }
.idcard.compact { padding: 14px; }
.idcard.compact .idcard-rows div { padding: 5px 10px; }

/* ---------- trivia ---------- */
.trivia { flex: 1; display: flex; flex-direction: column; }
.trivia-head { display: flex; align-items: center; justify-content: space-between; }
.trivia-head .badge { align-self: auto; }
.answers { flex: 1; display: flex; flex-direction: column; gap: 10px; justify-content: flex-end; }
.answer {
  min-height: 72px; flex: 1; max-height: 104px;
  display: flex; align-items: center; gap: 14px; padding: 10px 16px; text-align: start;
  border-radius: var(--radius); background: var(--opt); color: var(--c-on-primary);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.15);
  transition: transform .12s ease, filter .2s;
}
.answer:active, .answer.pressed { transform: scale(.97); filter: brightness(1.08); }
.answer:disabled:not(.pressed) { opacity: .45; }
.letter { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; font-size: 20px; background: rgba(0,0,0,.14); }
.answer-text { font-size: 21px; font-weight: 800; line-height: 1.15; }
.answer .opt-art { margin-inline-start: auto; flex: none; }
.opt-art { display: inline-grid; place-items: center; width: 46px; height: 46px; font-size: 30px; line-height: 1; white-space: nowrap; }
img.opt-art { object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0,0,0,.25)); }
.chosen .opt-art { width: 40px; height: 40px; font-size: 26px; }

.timer { --frac: 1; position: relative; width: 52px; height: 52px; display: grid; place-items: center; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer circle { fill: none; stroke: var(--c-line); stroke-width: 4; }
.timer .arc { stroke: var(--c-primary); stroke-linecap: round; stroke-dasharray: 106.8; stroke-dashoffset: calc(106.8 * (1 - var(--frac))); transition: stroke-dashoffset .15s linear, stroke .3s; }
.timer b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer.low .arc { stroke: var(--c-bad); }
.timer.low b { color: var(--c-bad); animation: tick 1s infinite; }
@keyframes tick { 0% { transform: scale(1.2); } 30% { transform: scale(1); } }
.sent .timer { position: absolute; top: 20px; inset-inline-end: 20px; }

.check, .result-mark { width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; font-size: 54px; font-weight: 900; }
.check { background: color-mix(in srgb, var(--c-good) 20%, transparent); color: var(--c-good); border: 3px solid var(--c-good); }
.chosen {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 20px; border-radius: var(--radius);
  background: var(--opt); color: var(--c-on-primary); font-size: 20px; font-weight: 800; max-width: 100%;
}
.reveal.good .result-mark { background: var(--c-good); color: #0b2a19; box-shadow: 0 0 60px color-mix(in srgb, var(--c-good) 55%, transparent); }
.reveal.good .huge { color: var(--c-good); }
.reveal.bad .result-mark { background: color-mix(in srgb, var(--c-bad) 18%, transparent); color: var(--c-bad); border: 3px solid var(--c-bad); }
.points { font-size: 56px; font-weight: 900; color: var(--c-primary); font-variant-numeric: tabular-nums; text-shadow: 0 0 30px color-mix(in srgb, var(--c-primary) 50%, transparent); }
.score-line { display: flex; gap: 18px; margin-top: 10px; color: var(--c-text-dim); font-size: 16px; }
.score-line b { color: var(--c-text); }

.pop { animation: pop .55s var(--ease-spring) both; }
.pop-late { animation: pop .55s .2s var(--ease-spring) both; }
@keyframes pop { from { opacity: 0; transform: scale(.4); } }
.shake { animation: shake .5s ease both; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.msg-icon { font-size: 64px; }

.countdown-ring { width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--c-line); border-top-color: var(--c-primary); animation: spin 1s linear infinite; margin-top: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loader { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--c-line); border-top-color: var(--c-primary); animation: spin .8s linear infinite; }

/* ---------- standings ---------- */
.rank-big { font-size: 120px; font-weight: 900; line-height: .9; color: var(--c-primary); font-variant-numeric: tabular-nums; text-shadow: 0 0 50px color-mix(in srgb, var(--c-primary) 40%, transparent); animation: pop .6s var(--ease-spring) both; }
.score-pill { margin-top: 10px; padding: 12px 20px; border-radius: 99px; background: var(--c-glass); border: 1px solid var(--c-line); font-size: 17px; color: var(--c-text-dim); text-align: center; }
.score-pill b { color: var(--c-text); font-variant-numeric: tabular-nums; }
.medal { font-size: 84px; line-height: 1; }

/* ---------- build ---------- */
.build { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.rule { text-align: center; padding: 12px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--c-primary) 12%, transparent); border: 1.5px solid color-mix(in srgb, var(--c-primary) 40%, transparent); }
.rule-title { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.2; }
.rule-title b { color: var(--c-primary); font-weight: 900; font-size: 1.25em; padding: 0 2px; }
.rule-hint { margin: 4px 0 0; font-size: 14px; color: var(--c-text-dim); line-height: 1.35; }
.cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; margin-inline: -20px; padding-inline: 20px; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: none; display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 99px; background: var(--c-glass); border: 1px solid var(--c-line); font-size: 14px; font-weight: 700; color: var(--c-text-dim); white-space: nowrap; }
.cat span { font-size: 18px; }
.cat.on { background: var(--c-primary); color: var(--c-on-primary); border-color: var(--c-primary); }
.emoji-grid {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; align-content: start;
  padding: 8px; border-radius: var(--radius); background: var(--c-glass); border: 1px solid var(--c-line);
}
.emoji { aspect-ratio: 1; font-size: 30px; line-height: 1; border-radius: 12px; display: grid; place-items: center; transition: transform .15s var(--ease-spring), background .15s; }
.emoji:active { transform: scale(.9); }
.emoji.on { background: color-mix(in srgb, var(--c-primary) 30%, transparent); box-shadow: inset 0 0 0 2.5px var(--c-primary); transform: scale(1.08); }
.send-bar { flex: none; display: flex; gap: 10px; align-items: center; }
.send-pick { flex: none; width: 64px; height: 64px; border-radius: var(--radius); display: grid; place-items: center; font-size: 38px; background: var(--c-glass); border: 1.5px dashed var(--c-line); color: var(--c-text-dim); }
.send-pick.pop { animation: pop .4s var(--ease-spring); border-style: solid; border-color: var(--c-primary); }
.send-bar .btn { flex: 1; }
.build.launching .send-pick { animation: launch .8s cubic-bezier(.5, 0, .75, 0) forwards; }
@keyframes launch { 20% { transform: translateY(6px) scale(1.1); } 100% { transform: translateY(-120vh) scale(.6); } }
.landing-icon { font-size: 96px; animation: land .9s var(--ease-spring) both; }
@keyframes land { from { transform: translateY(-60vh) scale(.5); opacity: 0; } }
.landed .huge { color: var(--c-primary); }

/* ---------- report ---------- */
.report { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.report .title { text-align: center; font-size: 26px; }

@media (max-height: 640px) {
  .question { font-size: 22px; margin-bottom: 12px; }
  .answer { min-height: 64px; }
  .hero-avatar { width: 128px; height: 128px; }
  .idcard-who { padding: 10px 0 8px; }
  .idcard-rows div { padding: 5px 10px; }
  .tile-icon { font-size: 38px; }
  .rank-big { font-size: 96px; }
}

/* Repeated icons (e.g. 12 moons in 2 rows of 6) */
.opt-art.art-grid { display: grid; grid-template-columns: repeat(var(--cols), auto); gap: 0; width: auto; height: auto; font-size: calc(40px / var(--cols) + 6px); }

.timer.big { width: 150px; height: 150px; margin-top: 10px; }
.timer.big b { font-size: 36px; direction: ltr; }
.timer.long b { font-size: 15px; }
.timer.big.long b { font-size: 34px; }
.art-grid > span { display: block; width: 1.3em; text-align: center; }

.points.pending { opacity: .5; animation: blink-soft 1s infinite; }
@keyframes blink-soft { 50% { opacity: .25; } }

/* ---------- battle of minds ---------- */
.btn.ghost { background: var(--c-glass); border: 1.5px solid var(--c-line); color: var(--c-text); font-size: 17px; min-height: 52px; }
.btn.small { min-height: 48px; font-size: 15px; padding: 0 12px; flex: 1; }
.btn.danger { border-color: var(--c-bad); color: var(--c-bad); }
.team { flex: 1; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.team > .title, .team > .sub { text-align: center; }
.code-card { text-align: center; padding: 18px; border-radius: var(--radius-lg); background: color-mix(in srgb, var(--c-primary) 12%, transparent); border: 1.5px solid color-mix(in srgb, var(--c-primary) 45%, transparent); }
.team-code { font-size: 76px; font-weight: 900; letter-spacing: .18em; color: var(--c-primary); line-height: 1.1; font-variant-numeric: tabular-nums; }
.code-hint { font-size: 14px; color: var(--c-text-dim); }
.my-team { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; font-size: 15px; font-weight: 700; color: var(--c-text-dim); }
.mate { display: inline-flex; align-items: center; gap: 4px; color: var(--c-text); }
.mate img { width: 28px; height: 28px; }
.join-team { display: flex; flex-direction: column; gap: 8px; }
.join-row { display: flex; gap: 8px; }
.join-row .field { flex: 1; text-align: center; letter-spacing: .3em; font-size: 26px; }
.join-row .btn { flex: none; }
.team-avatars { display: flex; justify-content: center; }
.team-avatars img { width: 96px; height: 96px; margin-inline: -10px; filter: drop-shadow(0 8px 16px rgba(0,0,0,.4)); }
.team-joined .btn { margin-top: 10px; }

.riddle { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.riddle-head { display: flex; align-items: center; justify-content: space-between; }
.riddle-head .badge { align-self: auto; }
.riddle-pips { justify-content: center; }
.riddle-pips i.revealed { background: var(--c-opt-2); }
.riddle-art { display: grid; place-items: center; font-size: 84px; line-height: 1; min-height: 110px; }
.riddle-art img { max-height: 160px; border-radius: 18px; }
.riddle-q { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.3; text-align: center; text-wrap: balance; }
.riddle-form { display: flex; gap: 8px; }
.riddle-form .field { flex: 1; font-size: 20px; }
.riddle-form .btn { flex: none; }
.riddle-feedback { margin: 0; min-height: 1.4em; text-align: center; font-size: 22px; font-weight: 900; }
.riddle-feedback.good { color: var(--c-good); }
.riddle-feedback.bad { color: var(--c-primary); }
.hint-box, .reveal-box { padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--c-opt-3) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c-opt-3) 40%, transparent); font-size: 17px; line-height: 1.4; }
.reveal-box { font-size: 22px; font-weight: 900; text-align: center; background: color-mix(in srgb, var(--c-opt-2) 16%, transparent); border-color: color-mix(in srgb, var(--c-opt-2) 45%, transparent); }
.help-row { display: flex; gap: 8px; margin-top: auto; }

/* ---- riddles game: own background, white riddle cards, celebrations ---- */
/* The background's logo sits at its top: shown a little smaller and lower, so it's never cut off */
body.game-bg .space { background: #07040f; }
body.game-bg .space::after { display: none; }
body.game-bg .space::before {
  content: ''; display: block; position: absolute; inset: 0; animation: none; opacity: 1;
  background: var(--game-bg) center 58px / 82% auto no-repeat;
  /* the picture's edges melt into the dark background instead of showing a rectangle */
  -webkit-mask-image: linear-gradient(to right, transparent 9%, #000 19%, #000 81%, transparent 91%);
  mask-image: linear-gradient(to right, transparent 9%, #000 19%, #000 81%, transparent 91%);
}
/* leave the logo at the top of the background visible; long riddles (with a hint) may scroll */
/* content starts just under the logo (the logo is the top 28% of the picture, which is 82vw wide) */
body.game-bg .stage .screen { padding-top: calc(46px + 82vw * 1.777 * .27); overflow-y: auto; }
body.game-bg .station { background: transparent; border-bottom: 0; }
.gate .story { font-size: 17px; line-height: 1.55; padding: 14px 16px; border-radius: var(--radius); background: rgba(10,6,24,.72); border: 1px solid var(--c-line); }
.gate-form { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.answer-field { background: #fff; color: #1b1026; border-color: #fff; font-weight: 800; text-align: center; letter-spacing: .08em; }
.answer-field::placeholder { color: #8d84a3; letter-spacing: 0; }
.answer-field:focus { background: #fff; border-color: var(--c-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-primary) 50%, transparent); }
.riddle-card { background: #fff; border-radius: 18px; padding: 10px; display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.riddle-card img { max-height: 24vh; width: auto; max-width: 100%; object-fit: contain; }
.riddle-card.large img { max-height: 44vh; }
.riddle-title { text-align: center; font-size: 20px; font-weight: 900; color: var(--c-primary); }
.riddle .riddle-q { font-size: 18px; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.help-row small { font-size: 12px; opacity: .7; margin-inline-start: 4px; }
.celebrate { position: relative; }
.celebrate-text { margin: 0; font-size: 19px; line-height: 1.4; color: var(--c-text); max-width: 320px; }
.celebrate .btn { margin-top: 10px; }
.confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 30; }

/* Revealing an answer costs minutes: the second tap is a big, unmistakable confirm */
.help-row.confirm { flex-direction: column; gap: 8px; }
.btn.reveal-confirm {
  min-height: 58px; font-size: 17px; font-weight: 900; color: #fff; background: var(--c-bad); border: 0;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-bad) 30%, transparent); animation: pop .35s var(--ease-spring) both;
}
.help-row.confirm .btn.small { flex: none; }

/* Battle of minds: tight lines (almost touching), slightly smaller text, everything centred */
body.game-bg .btn { line-height: 1.08; padding-block: 8px; text-align: center; text-wrap: balance; }
body.game-bg .btn.reveal-confirm { font-size: 15px; }
body.game-bg .btn small { display: inline-block; }
body.game-bg .gate .story { font-size: 16px; line-height: 1.2; text-align: center; }
body.game-bg .label { text-align: center; }
body.game-bg .riddle .riddle-q { font-size: 17px; line-height: 1.15; }
body.game-bg .riddle-title { line-height: 1.1; }
body.game-bg .hint-box, body.game-bg .reveal-box { font-size: 16px; line-height: 1.2; text-align: center; }
body.game-bg .reveal-box { font-size: 20px; }
body.game-bg .celebrate-text { font-size: 17px; line-height: 1.2; text-align: center; }
body.game-bg .big-text { line-height: 1.1; text-align: center; }
body.game-bg .sub { line-height: 1.2; text-align: center; }
body.game-bg .riddle-feedback { font-size: 20px; line-height: 1.1; }

/* The team's own stopwatch in the battle of minds */
.stopwatch { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 99px; background: rgba(10, 6, 24, .75); border: 1.5px solid var(--c-primary); font-weight: 900; }
.stopwatch b { font-size: 20px; color: var(--c-primary); font-variant-numeric: tabular-nums; }

/* Brand bar: the event's logo (start) and the Quala logo (end), on every page */
.brandbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 18px 0; }
.brandbar[hidden] { display: none; }
.brand-event { height: 60px; width: auto; filter: drop-shadow(0 4px 10px rgba(0,0,0,.5)); }
.brand-name { font-size: 16px; font-weight: 900; }
.brand-quala { height: 22px; width: auto; opacity: .95; }
/* the battle of minds already shows the event's logo big in its background: only the Quala logo stays,
   floating in the top corner without taking any height */
body.game-bg .brand-event { display: none; }
body.game-bg .brandbar { position: absolute; top: 12px; left: 18px; padding: 0; z-index: 5; pointer-events: none; }
body.game-bg .phone { position: relative; }

/* --- Up on stage */
body.stage-picked { background: var(--c-hot); }
body.stage-picked .space { display: none; }
body.stage-picked .station { background: transparent; border-bottom: 0; }
.stage-pick { gap: 14px; text-align: center; color: #fff; }
.pick-title { margin: 0; font-size: clamp(56px, 18vw, 84px); font-weight: 900; line-height: 1.05; text-shadow: 0 4px 0 rgba(0,0,0,.2); }
.pick-text { margin: 0 0 12px; font-size: 26px; font-weight: 900; line-height: 1.15; }
.btn.pick-yes { width: 100%; padding: 20px; font-size: 26px; font-weight: 900; background: #fff; color: var(--c-hot); border-radius: var(--radius); }
.btn.pick-no { width: 100%; padding: 14px; font-size: 17px; font-weight: 700; background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.7); border-radius: var(--radius); }
.pick-timer { margin: 0; font-weight: 700; color: rgba(255,255,255,.88); font-variant-numeric: tabular-nums; }

/* --- Battle of minds: choosing a phone */
.team > .btn { width: 100%; }
.team-code { text-transform: uppercase; }
.code-input { text-transform: uppercase; letter-spacing: .2em; text-align: center; font-weight: 900; }
.team-joined .score-pill { margin-top: 6px; }

/* --- The origami throw */
.launch-phone { gap: 14px; }
.launch-n { font-size: 170px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: var(--c-primary); }
.launch-done { margin: 0; font-size: 76px; font-weight: 900; color: var(--c-primary); animation: pop .6s var(--ease-spring) both; }

/* The team's code, readable from the next chair */
.code-head { align-self: center; padding: 2px 12px; border-radius: 12px; font-size: 30px; font-weight: 900; letter-spacing: .12em; line-height: 1.2; color: var(--c-primary); background: color-mix(in srgb, var(--c-primary) 14%, transparent); text-transform: uppercase; }

/* The personal ending */
.final { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 22px 4px 36px; width: 100%; max-width: 460px; margin: 0 auto; text-align: center; position: relative; }
.final > * { flex-shrink: 0; }
.final-head .title { margin: 0; }
.final-head .sub { margin: 4px 0 0; }
.final-result { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 16px; border-radius: var(--radius-lg); background: color-mix(in srgb, var(--c-primary) 12%, transparent); border: 1.5px solid color-mix(in srgb, var(--c-primary) 45%, transparent); }
.final-medal { font-size: 96px; line-height: 1; }
.final-win { font-size: 28px; font-weight: 900; color: var(--c-primary); }
.final-who { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 800; }
.final-who img { width: 72px; height: 72px; }
.final-who b { word-break: break-word; }
.final-place { font-size: 26px; font-weight: 800; }
.final-score { font-size: 44px; font-weight: 900; line-height: 1.1; color: var(--c-primary); font-variant-numeric: tabular-nums; }
.final-parts { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; font-size: 14px; font-weight: 600; color: var(--c-text-dim); }
.final-parts i { font-style: normal; }
.final-line { margin: 0; font-size: 19px; font-weight: 700; }
.stage-call { width: 100%; padding: 18px 12px; border-radius: 18px; font-size: 24px; font-weight: 900; color: var(--c-on-primary); background: var(--c-primary); animation: stage-call 1s ease-in-out infinite; }
@keyframes stage-call { 50% { opacity: .55; transform: scale(.97); } }
.final .idcard { width: 100%; }
.save-card { width: 100%; }
.final-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 6px; }
.final-foot p { margin: 0; font-size: 19px; font-weight: 700; }
.final-foot img { height: 34px; width: auto; }
