/* ═══ Onbox Sorting Rush ═══════════════════════════════════
   Booth kiosk styling. Sizes use vmin/clamp so one build fills
   any screen the exhibition hall gives us without re-tuning.
   ═════════════════════════════════════════════════════════ */

:root {
  --brand:        #1649ff;
  --brand-dark:   #0d35cc;
  --brand-glow:   #4d7cff;
  --accent:       #FF8C42;
  --accent-dark:  #e07330;
  --navy:         #0a1733;
  --navy-light:   #0f2050;
  --persian-blue: #1c3f94;
  --ink:          #ffffff;
  --ink-dim:      rgba(255, 255, 255, 0.62);
  --ink-faint:    rgba(255, 255, 255, 0.28);
  --good:         #22d38a;
  --bad:          #ff4d5e;
  --line:         rgba(255, 255, 255, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Several elements below set display:flex, which would otherwise beat
   the UA rule for [hidden] and leave them permanently on screen. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--navy);
  color: var(--ink);
  font-family: 'YekanBakh', system-ui, sans-serif;
  /* Kiosk: nothing here is meant to be selected or dragged. */
  user-select: none;
  -webkit-user-select: none;
  cursor: none;
}

body {
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(22, 73, 255, 0.30), transparent 70%),
    radial-gradient(ellipse 70% 50% at 50% 110%, rgba(28, 63, 148, 0.35), transparent 70%),
    var(--navy);
}

/* ── screens ─────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.is-active { display: flex; }

/* ── shared bits ─────────────────────────────────────── */
.key {
  display: inline-block;
  min-width: 2.2em;
  padding: 0.18em 0.55em;
  border: 2px solid var(--ink-faint);
  border-bottom-width: 4px;
  border-radius: 0.4em;
  background: rgba(255, 255, 255, 0.07);
  font-weight: 700;
  font-size: 0.9em;
  text-align: center;
  direction: ltr;
}
.key--wide { min-width: 6em; letter-spacing: 0.1em; }

.logo {
  font-weight: 900;
  font-size: clamp(20px, 2.6vmin, 34px);
  letter-spacing: 0.34em;
  color: var(--ink);
  direction: ltr;
}
.logo::after {
  content: '';
  display: block;
  width: 100%;
  height: 3px;
  margin-top: 0.5em;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

.storage-warning {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  padding: 0.6vmin 2vmin;
  background: var(--bad);
  color: #fff;
  font-size: clamp(11px, 1.5vmin, 18px);
  font-weight: 700;
  text-align: center;
}

/* ═══ ATTRACT ═════════════════════════════════════════ */
.attract {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4vmin;
  z-index: 2;
}
.attract__brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1.4vmin; }
.attract__title {
  font-weight: 900;
  font-size: clamp(38px, 9vmin, 130px);
  line-height: 1;
  background: linear-gradient(180deg, #fff 40%, var(--brand-glow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.attract__sub { font-size: clamp(14px, 2.3vmin, 30px); color: var(--ink-dim); }

.attract__cta {
  display: flex;
  align-items: center;
  gap: 1.4vmin;
  font-size: clamp(14px, 2.2vmin, 28px);
  font-weight: 700;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* drifting background packages */
.drift { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.drift span {
  position: absolute;
  display: block;
  border-radius: 0.8vmin;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
  animation: drift linear infinite;
}
@keyframes drift {
  from { transform: translateX(-20vw) rotate(0deg); }
  to   { transform: translateX(120vw) rotate(180deg); }
}

/* ── leaderboard ─────────────────────────────────────── */
.board {
  width: min(62vw, 720px);
  padding: 2.4vmin 2.8vmin;
  border: 1px solid var(--line);
  border-radius: 2vmin;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 2.4vmin 6vmin rgba(0, 0, 0, 0.4);
}
.board__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.4vmin;
  margin-bottom: 1vmin;
  border-bottom: 1px solid var(--line);
}
.board__title { font-weight: 700; font-size: clamp(14px, 2.1vmin, 26px); }
.board__dots { display: flex; gap: 0.7vmin; }
.board__dots i {
  width: 0.9vmin; height: 0.9vmin; min-width: 6px; min-height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
}
.board__dots i.on { background: var(--accent); }

.board__list { list-style: none; }
.board__row {
  display: grid;
  grid-template-columns: 3.4em 1fr auto;
  align-items: center;
  gap: 1vmin;
  padding: 0.85vmin 0;
  font-size: clamp(13px, 1.95vmin, 24px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.board__row:last-child { border-bottom: 0; }
.board__rank { font-weight: 900; color: var(--ink-faint); text-align: center; }
.board__row--1 .board__rank { color: #ffd85e; }
.board__row--2 .board__rank { color: #d8e2f5; }
.board__row--3 .board__rank { color: var(--accent); }
.board__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board__score { font-weight: 900; font-variant-numeric: tabular-nums; }
.board__empty { padding: 2vmin 0; text-align: center; color: var(--ink-dim); }

.board__row--me {
  background: linear-gradient(90deg, rgba(22, 73, 255, 0.35), transparent);
  border-radius: 0.8vmin;
  box-shadow: inset 0 0 0 1px rgba(77, 124, 255, 0.5);
}

/* ═══ REGISTER ════════════════════════════════════════ */
.panel {
  width: min(58vw, 640px);
  padding: 4vmin;
  border: 1px solid var(--line);
  border-radius: 2.4vmin;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 2.4vmin 6vmin rgba(0, 0, 0, 0.45);
}
.panel__title {
  font-size: clamp(20px, 3.4vmin, 44px);
  font-weight: 900;
  text-align: center;
  margin-bottom: 2.4vmin;
}
.panel__hint {
  display: flex;
  justify-content: center;
  gap: 3vmin;
  margin-top: 2.4vmin;
  font-size: clamp(12px, 1.7vmin, 20px);
  color: var(--ink-dim);
}

.target {
  padding: 1.6vmin;
  margin-bottom: 2.4vmin;
  border-radius: 1.2vmin;
  background: rgba(255, 140, 66, 0.12);
  border: 1px solid rgba(255, 140, 66, 0.35);
  text-align: center;
  font-size: clamp(13px, 2vmin, 24px);
  line-height: 1.7;
}
.target b { color: var(--accent); font-weight: 900; }

.field { display: block; margin-bottom: 1.8vmin; }
.field__label {
  display: block;
  margin-bottom: 0.7vmin;
  font-size: clamp(12px, 1.7vmin, 20px);
  color: var(--ink-dim);
}
.field__input {
  width: 100%;
  padding: 1.3vmin 1.6vmin;
  border: 2px solid var(--line);
  border-radius: 1.1vmin;
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(16px, 2.6vmin, 32px);
  font-weight: 700;
  outline: none;
  cursor: text;
}
.field__input:focus { border-color: var(--brand-glow); box-shadow: 0 0 0 0.5vmin rgba(22, 73, 255, 0.22); }
.field__input--ltr { direction: ltr; text-align: left; letter-spacing: 0.08em; }
.field__input::placeholder { color: var(--ink-faint); font-weight: 400; }
.field__error {
  min-height: 1.4em;
  text-align: center;
  color: var(--bad);
  font-size: clamp(12px, 1.7vmin, 20px);
  font-weight: 700;
}

/* ═══ COUNTDOWN ═══════════════════════════════════════ */
.countdown {
  font-size: clamp(90px, 34vmin, 460px);
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 0 8vmin rgba(77, 124, 255, 0.75);
  animation: countPop 0.85s ease-out;
}
@keyframes countPop {
  0%   { transform: scale(2.1); opacity: 0; }
  35%  { transform: scale(1);   opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.75; }
}
.countdown__hint { font-size: clamp(14px, 2.4vmin, 30px); color: var(--ink-dim); }

/* ═══ PLAYING ═════════════════════════════════════════ */
[data-screen="playing"] { justify-content: flex-start; padding: 2.5vmin 3vmin; gap: 0; }

.hud {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 2.1fr 1fr;
  align-items: center;
  gap: 2vmin;
  width: 100%;
}
.hud__score, .hud__timer { display: flex; flex-direction: column; align-items: center; }
.hud__label { font-size: clamp(11px, 1.5vmin, 18px); color: var(--ink-dim); }
.hud__value {
  font-size: clamp(30px, 6.4vmin, 88px);
  font-weight: 900;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.hud__timer.is-low .hud__value { color: var(--bad); animation: tick 0.5s ease-in-out infinite; }
@keyframes tick { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.16); } }

/* ── tug of war vs the champion ghost ────────────────── */
.tug {
  direction: ltr;               /* knob moves right as you pull ahead */
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.6vmin;
}
.tug__side { display: flex; flex-direction: column; align-items: center; min-width: 9vmin; }
.tug__name {
  font-size: clamp(11px, 1.5vmin, 18px);
  color: var(--ink-dim);
  max-width: 16vmin;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tug__score { font-size: clamp(15px, 2.5vmin, 32px); font-weight: 900; font-variant-numeric: tabular-nums; }
.tug__side--you .tug__score { color: var(--brand-glow); }

.tug__track {
  position: relative;
  height: 2.4vmin;
  min-height: 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.tug__fill {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-glow));
  transition: left 0.25s ease, width 0.25s ease;
}
.tug__fill.is-behind { background: linear-gradient(90deg, var(--accent-dark), var(--accent)); }
.tug__mid { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: rgba(255, 255, 255, 0.35); }
.tug__knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.9vmin; height: 2.9vmin;
  min-width: 20px; min-height: 20px;
  margin: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 2.4vmin rgba(255, 255, 255, 0.75);
  transform: translate(-50%, -50%);
  transition: left 0.25s ease;
}

/* ── combo ───────────────────────────────────────────── */
.combo {
  margin-top: 1.4vmin;
  font-size: clamp(20px, 4.6vmin, 62px);
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 3vmin rgba(255, 140, 66, 0.6);
}
.combo.bump { animation: comboBump 0.35s ease-out; }
@keyframes comboBump {
  0%   { transform: scale(1.9) rotate(-6deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ── conveyor belt ───────────────────────────────────── */
.belt {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
}
.belt__rail {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 24vmin;
  max-height: 260px;
  transform: translateY(-50%);
  border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  background:
    repeating-linear-gradient(90deg,
      rgba(255, 255, 255, 0.045) 0 3vmin,
      transparent 3vmin 6vmin),
    rgba(0, 0, 0, 0.25);
  animation: beltRoll 1.1s linear infinite;
}
@keyframes beltRoll { to { background-position: -6vmin 0, 0 0; } }

/* The scan window: where the active package must be read.
   Sits left of centre because packages arrive from the right (RTL) —
   centring it would strand the tail of the queue off-screen. */
.belt__scan {
  position: absolute;
  left: 26%;
  top: 50%;
  width: 19vmin;
  height: 26vmin;
  max-width: 210px;
  max-height: 280px;
  transform: translate(-50%, -50%);
  border: 3px solid var(--brand-glow);
  border-radius: 1.8vmin;
  box-shadow: 0 0 4vmin rgba(77, 124, 255, 0.45), inset 0 0 3vmin rgba(77, 124, 255, 0.18);
}
.belt__inner { position: absolute; inset: 0; }

.pkg {
  position: absolute;
  left: 26%;   /* must match .belt__scan */
  top: 50%;
  width: 17vmin;
  height: 22vmin;
  max-width: 190px;
  max-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8vmin;
  border-radius: 1.5vmin;
  background: linear-gradient(165deg, #d9a86a, #b97f42);
  box-shadow: 0 1.6vmin 3.4vmin rgba(0, 0, 0, 0.45), inset 0 -0.7vmin 0 rgba(0, 0, 0, 0.16);
  color: #23150a;
  /* --x (vmin) and --s (scale) come from syncBelt, which walks the queue
     accumulating a shrinking step so spacing compresses with distance.
     The negative Y lift sends the far end toward a vanishing point. */
  transform: translate(-50%, -50%)
             translateX(calc(var(--x, 0) * 1vmin))
             translateY(calc(var(--x, 0) * -0.1vmin))
             scale(var(--s, 1));
  transition: transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.22s;
  will-change: transform;
}
.pkg::before {
  /* packing tape */
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 2.6vmin;
  background: rgba(255, 255, 255, 0.22);
}
.pkg__city {
  position: relative;
  font-size: clamp(15px, 3.1vmin, 40px);
  font-weight: 900;
  text-align: center;
  padding: 0 0.4em;
}
.pkg__tag {
  position: relative;
  font-size: clamp(9px, 1.3vmin, 15px);
  letter-spacing: 0.18em;
  opacity: 0.55;
  direction: ltr;
}
/* Scale already signals distance now, so this only needs a light touch.
   Dimming the tail as hard as the flat version did would cost players
   the read-ahead that the queue exists to give them. */
.pkg--far { opacity: 0.72; }
.pkg--express {
  background: linear-gradient(165deg, #ffc46b, var(--accent));
  box-shadow: 0 1.6vmin 3.4vmin rgba(255, 140, 66, 0.45), inset 0 -0.7vmin 0 rgba(0, 0, 0, 0.16);
  animation: expressGlow 0.9s ease-in-out infinite;
}
@keyframes expressGlow {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.22); }
}
.pkg--fly { z-index: 60; pointer-events: none; }

/* ── loading bays ────────────────────────────────────── */
.bays {
  position: relative;
  z-index: 1;
  direction: ltr;               /* 1-2-3-4 must match the physical keycaps */
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2vmin;
  width: 100%;
  margin-top: 1vmin;
}
.bay { display: flex; flex-direction: column; gap: 0.7vmin; }

/* Holds the van and clips it out of frame as it drives off. */
.bay__stage {
  position: relative;
  height: 11vmin;
  min-height: 72px;
  overflow: hidden;
}

/* The destination is painted on the BAY, never on the van. A player has
   to be able to read where a package goes while its van is away. */
.bay__sign {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2vmin;
  padding: 1.1vmin 1vmin;
  border: 2px solid var(--line);
  border-radius: 1.4vmin;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  transition: transform 0.12s, background 0.12s, border-color 0.12s;
}
.bay__key {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5vmin; height: 5vmin;
  min-width: 34px; min-height: 34px;
  border-radius: 1vmin;
  border: 2px solid var(--ink-faint);
  border-bottom-width: 5px;
  background: rgba(0, 0, 0, 0.32);
  font-size: clamp(16px, 2.8vmin, 36px);
  font-weight: 900;
  direction: ltr;
}
.bay__city {
  font-size: clamp(15px, 3vmin, 40px);
  font-weight: 900;
  direction: rtl;
}

.bay__fill {
  height: 0.9vmin;
  min-height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.bay__fill i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--good);
  transition: width 0.25s ease, background 0.25s;
}
.bay__fill i.is-nearly { background: var(--accent); }

.bay.is-hit .bay__sign {
  transform: translateY(0.9vmin) scale(0.97);
  border-color: var(--good);
  background: rgba(34, 211, 138, 0.22);
}
.bay.is-wrong .bay__sign {
  border-color: var(--bad);
  background: rgba(255, 77, 94, 0.25);
  animation: chuteShake 0.3s;
}
@keyframes chuteShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-1.2vmin); }
  75%      { transform: translateX(1.2vmin); }
}
.bay.is-target .bay__sign { border-color: var(--good); box-shadow: 0 0 3vmin rgba(34, 211, 138, 0.5); }

.bay__city.is-swapping { animation: citySwap 0.5s ease; }
@keyframes citySwap {
  0%   { transform: translateY(0)       ; opacity: 1; }
  45%  { transform: translateY(-2.4vmin); opacity: 0; }
  55%  { transform: translateY(2.4vmin) ; opacity: 0; }
  100% { transform: translateY(0)       ; opacity: 1; }
}

/* ── the Onbox van ───────────────────────────────────── */
.van {
  position: absolute;
  left: 50%;
  bottom: 0.4vmin;
  width: 86%;
  height: 8.2vmin;
  min-height: 54px;
  transform: translateX(-50%);
  transition: transform 0.85s cubic-bezier(0.45, 0, 0.55, 1), opacity 0.85s;
}
.van__body {
  position: absolute;
  right: 0; bottom: 20%;
  width: 63%; height: 72%;
  border-radius: 0.5vmin 1vmin 0.4vmin 0.4vmin;
  background: linear-gradient(180deg, var(--brand-glow), var(--brand));
  box-shadow: inset 0 -0.6vmin 0 rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}
.van__mark {
  font-size: clamp(7px, 1.2vmin, 15px);
  font-weight: 900;
  letter-spacing: 0.16em;
  color: #fff;
  opacity: 0.92;
  direction: ltr;
}
.van__stripe {
  position: absolute;
  right: 0; bottom: 30%;
  width: 63%; height: 11%;
  background: var(--accent);
  opacity: 0.9;
}
.van__cab {
  position: absolute;
  left: 0; bottom: 20%;
  width: 39%; height: 53%;
  border-radius: 1.1vmin 0.3vmin 0.4vmin 0.4vmin;
  background: linear-gradient(180deg, #2f5cff, var(--brand-dark));
}
.van__glass {
  position: absolute;
  left: 14%; top: 18%;
  width: 58%; height: 42%;
  border-radius: 0.3vmin;
  background: rgba(255, 255, 255, 0.42);
}
.van__wheel {
  position: absolute;
  bottom: 0;
  width: 2.3vmin; height: 2.3vmin;
  min-width: 15px; min-height: 15px;
  border-radius: 50%;
  background: #0d1220;
  border: 0.35vmin solid #7c8db5;
}
.van__wheel--f { left: 13%; }
.van__wheel--r { right: 11%; }
.van__wheel::after {
  /* one spoke, so the spin actually reads */
  content: '';
  position: absolute;
  left: 50%; top: 14%;
  width: 2px; height: 72%;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.45);
}
.van__lamp {
  position: absolute;
  left: -0.4vmin; bottom: 38%;
  width: 1.3vmin; height: 0.55vmin;
  min-width: 8px;
  border-radius: 999px;
  background: rgba(255, 220, 150, 0);
  transition: background 0.2s, box-shadow 0.2s;
}

.van.is-leaving { transform: translateX(-200%); opacity: 0; }
.van.is-leaving .van__lamp {
  background: rgba(255, 220, 150, 0.95);
  box-shadow: 0 0 2.4vmin 0.8vmin rgba(255, 220, 150, 0.45);
}
.van.is-leaving .van__wheel { animation: wheelSpin 0.2s linear infinite; }
@keyframes wheelSpin { to { transform: rotate(360deg); } }

.van.is-arriving { animation: vanArrive 0.85s cubic-bezier(0.2, 0.7, 0.3, 1); }
@keyframes vanArrive {
  from { transform: translateX(170%); }
  to   { transform: translateX(-50%); }
}

/* ── parallax depot ──────────────────────────────────── */
.depot { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.depot > div { position: absolute; left: -30%; width: 160%; }

.depot__lamps {
  top: 4%; height: 9%;
  background: repeating-linear-gradient(90deg,
    transparent 0 12vmin,
    rgba(255, 220, 150, 0.05) 12vmin 13vmin,
    rgba(255, 220, 150, 0.16) 13.5vmin 15vmin,
    rgba(255, 220, 150, 0.05) 15.5vmin 16.5vmin,
    transparent 16.5vmin 30vmin);
  animation: driftLamps 46s linear infinite;
}
.depot__racks {
  top: 15%; height: 27%;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 0.5vmin, transparent 0.5vmin 7vmin),
    repeating-linear-gradient(0deg,  rgba(255, 255, 255, 0.04) 0 0.4vmin, transparent 0.4vmin 6vmin);
  animation: driftRacks 34s linear infinite;
}
.depot__floor {
  bottom: 0; height: 32%;
  background: repeating-linear-gradient(90deg,
    rgba(255, 255, 255, 0.035) 0 0.4vmin, transparent 0.4vmin 12vmin);
  animation: driftFloor 17s linear infinite;
}
/* Each layer shifts by exactly one tile, so the loop is seamless. */
@keyframes driftLamps { to { transform: translateX(-30vmin); } }
@keyframes driftRacks { to { transform: translateX(-7vmin); } }
@keyframes driftFloor { to { transform: translateX(-12vmin); } }

/* ── floating score popups ───────────────────────────── */
.pop {
  position: fixed;
  z-index: 70;
  font-size: clamp(18px, 3.4vmin, 44px);
  font-weight: 900;
  color: var(--good);
  text-shadow: 0 0.3vmin 1vmin rgba(0, 0, 0, 0.6);
  pointer-events: none;
  animation: popUp 0.75s ease-out forwards;
}
.pop--bad { color: var(--bad); }
@keyframes popUp {
  0%   { transform: translate(-50%, 0) scale(0.7);      opacity: 0; }
  25%  { transform: translate(-50%, -1.6vmin) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -9vmin) scale(1);   opacity: 0; }
}

/* ── feedback overlays ───────────────────────────────── */
.flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; }
.flash.is-bad { background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 77, 94, 0.55)); animation: flashOut 0.32s; }
@keyframes flashOut { from { opacity: 1; } to { opacity: 0; } }

.shuffle-warn {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 80;
  padding: 2vmin 5vmin;
  border-radius: 1.6vmin;
  background: var(--accent);
  color: #23150a;
  font-size: clamp(22px, 5.4vmin, 74px);
  font-weight: 900;
  box-shadow: 0 2vmin 6vmin rgba(0, 0, 0, 0.55);
  animation: warnPulse 0.55s ease-in-out infinite alternate;
}
@keyframes warnPulse {
  from { transform: translate(-50%, -50%) scale(0.96); }
  to   { transform: translate(-50%, -50%) scale(1.05); }
}

/* ═══ RESULT ══════════════════════════════════════════ */
.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.4vmin;
  width: min(72vw, 900px);
}
.result__score { display: flex; flex-direction: column; align-items: center; }
.result__label { font-size: clamp(14px, 2.2vmin, 28px); color: var(--ink-dim); }
.result__value {
  font-size: clamp(56px, 15vmin, 200px);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(180deg, #fff 45%, var(--brand-glow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.result__meta { font-size: clamp(12px, 1.9vmin, 23px); color: var(--ink-dim); margin-top: 0.8vmin; }

.result__ranks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6vmin; width: 100%; }
.rank-card {
  padding: 1.8vmin 1vmin;
  border: 1px solid var(--line);
  border-radius: 1.4vmin;
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
}
.rank-card__title { font-size: clamp(11px, 1.6vmin, 19px); color: var(--ink-dim); }
.rank-card__rank { font-size: clamp(24px, 5vmin, 64px); font-weight: 900; line-height: 1.15; }
.rank-card--top .rank-card__rank { color: var(--accent); }
.rank-card--top { border-color: rgba(255, 140, 66, 0.5); background: rgba(255, 140, 66, 0.1); }

.result__banner {
  width: 100%;
  padding: 1.8vmin;
  border-radius: 1.4vmin;
  background: linear-gradient(90deg, rgba(255, 140, 66, 0.28), rgba(255, 140, 66, 0.08));
  border: 1px solid rgba(255, 140, 66, 0.5);
  text-align: center;
  font-size: clamp(14px, 2.2vmin, 28px);
  font-weight: 700;
  animation: bannerIn 0.5s ease-out;
}
@keyframes bannerIn {
  from { transform: translateY(2vmin) scale(0.96); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.result__prize { font-size: clamp(15px, 2.5vmin, 32px); font-weight: 900; color: var(--good); text-align: center; }

/* ═══ ADMIN ═══════════════════════════════════════════ */
.admin {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 9, 22, 0.88);
  cursor: default;
}
.admin__box {
  width: min(80vw, 860px);
  padding: 3vmin;
  border: 1px solid var(--line);
  border-radius: 1.8vmin;
  background: var(--navy-light);
  display: flex;
  flex-direction: column;
  gap: 1.6vmin;
}
.admin__box h3 { font-size: clamp(16px, 2.6vmin, 30px); }
.admin__stats { display: flex; flex-wrap: wrap; gap: 2vmin; font-size: clamp(12px, 1.8vmin, 20px); color: var(--ink-dim); }
.admin__stats b { color: var(--ink); }
.admin__actions { display: flex; flex-wrap: wrap; gap: 1vmin; }
.admin__actions button {
  padding: 1vmin 1.8vmin;
  border: 1px solid var(--line);
  border-radius: 0.9vmin;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(12px, 1.7vmin, 19px);
  font-weight: 700;
  cursor: pointer;
}
.admin__actions button:hover { background: var(--brand); border-color: var(--brand-glow); }
.admin__actions button.danger:hover { background: var(--bad); border-color: var(--bad); }
.admin__out {
  height: 22vmin;
  min-height: 140px;
  padding: 1.2vmin;
  border: 1px solid var(--line);
  border-radius: 0.9vmin;
  background: rgba(0, 0, 0, 0.4);
  color: var(--ink);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  direction: ltr;
  resize: none;
  user-select: text;
  -webkit-user-select: text;
}
