/* Contestant page — built for phones */
html, body { height: 100%; }
body.contestant {
  min-height: 100dvh;
  overflow-x: hidden;
}
.bg {
  position: fixed;
  inset: 0;
  background: url("/img/bg-portrait.jpg") center 30% / cover no-repeat;
  z-index: -2;
}
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 20, 30, 0.15) 0%, rgba(10, 20, 30, 0.35) 45%, rgba(10, 15, 20, 0.7) 100%);
}

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 40px) 14px 8px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  font-weight: 800;
  color: var(--white);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}
.team-chip {
  margin-left: auto;
  background: var(--green);
  color: var(--white);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.35em 0.8em;
  border-radius: 999px;
  max-width: 45vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.team-chip[hidden] + .lang-toggle { margin-left: auto; }

main#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: calc(env(safe-area-inset-top) + 92px) 16px calc(env(safe-area-inset-bottom) + 24px);
}

.panel {
  padding: 26px 20px 24px;
  animation: pop 0.25s ease;
}
.panel h1 {
  margin: 0 0 6px;
  font-size: 1.7rem;
  line-height: 1.15;
  color: var(--green-dark);
}
.panel h2 { margin: 0 0 12px; font-size: 1.2rem; color: var(--green-dark); }
.panel p { margin: 6px 0; line-height: 1.4; }

.big-text {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--white);
  text-align: center;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.8);
  padding: 0 8px;
}
.big-text small { display: block; font-size: 1rem; font-weight: 600; margin-top: 10px; opacity: 0.9; }
.big-emoji { font-size: 3.4rem; text-align: center; margin-bottom: 8px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5)); }

/* join */
.join input {
  font-size: 1.5rem;
  font-weight: 700;
  padding: 0.7em 0.7em;
  text-align: center;
  margin: 14px 0 12px;
}
.join .notice {
  background: #fde8ea;
  color: var(--red-dark);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  margin-top: 12px;
}

/* question header */
.qhead {
  color: var(--white);
  text-align: center;
  margin-bottom: 12px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}
.qhead .round { font-size: 0.9rem; font-weight: 600; opacity: 0.9; }
.qhead .qnum { font-size: 1.6rem; font-weight: 800; }

.saved {
  margin-top: 12px;
  text-align: center;
  font-weight: 700;
  color: var(--green);
  min-height: 1.4em;
}
.saved .hint { display: block; font-weight: 500; font-size: 0.85rem; color: var(--muted); margin-top: 2px; }

/* free text */
.answer-text { font-size: 1.3rem; padding: 0.8em; margin-bottom: 12px; }

/* multiple choice */
.choices { display: grid; gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px 14px;
  border-radius: 14px;
  border: 3px solid transparent;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 0 #cfc9bf;
  cursor: pointer;
}
.choice .letter {
  flex: 0 0 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--white);
  font-size: 1.2rem;
}
.choice:nth-child(1) .letter { background: var(--red); }
.choice:nth-child(2) .letter { background: var(--green); }
.choice:nth-child(3) .letter { background: var(--orange); }
.choice:nth-child(4) .letter { background: var(--brown); }
.choice.selected { border-color: var(--green); background: #e7f4ea; box-shadow: 0 3px 0 var(--green); }

/* number inputs (year + scale) */
.numbox { text-align: center; }
.numbox .value {
  font-size: 3.2rem;
  font-weight: 800;
  color: var(--green-dark);
  line-height: 1.1;
}
.numbox .unit { font-size: 1.2rem; font-weight: 700; color: var(--muted); margin-left: 6px; }
.numbox .range { color: var(--muted); font-size: 0.9rem; margin: 4px 0 14px; }
.numbox input[type="number"] {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 12px;
}
.stepper { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.stepper .btn { min-width: 64px; font-size: 1.3rem; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  padding: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--orange), var(--red));
  border: none;
  margin: 10px 0 18px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--white);
  border: 4px solid var(--green-dark);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
input[type="range"]::-moz-range-thumb {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--white);
  border: 4px solid var(--green-dark);
}

/* buzzer */
.buzzer-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.buzzer {
  width: min(72vw, 320px);
  height: min(72vw, 320px);
  border-radius: 50%;
  border: 10px solid #2a2a2a;
  font-family: var(--font);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #2a2a2a;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.12s, box-shadow 0.12s, transform 0.05s;
  background: radial-gradient(circle at 35% 30%, #777, #444 70%);
  box-shadow: 0 10px 0 #111, 0 18px 30px rgba(0, 0, 0, 0.5);
}
.buzzer:active { transform: translateY(6px); box-shadow: 0 4px 0 #111, 0 8px 18px rgba(0, 0, 0, 0.5); }
.buzzer.disabled, .buzzer.off, .buzzer.locked { color: #9a9a9a; cursor: default; }
.buzzer.disabled:active, .buzzer.off:active, .buzzer.locked:active { transform: none; }
.buzzer.ready {
  background: radial-gradient(circle at 35% 30%, #fff3a6, var(--buzz-yellow) 55%, #c79a00);
  box-shadow: 0 10px 0 #8a6a00, 0 0 40px rgba(245, 197, 24, 0.7), 0 18px 30px rgba(0, 0, 0, 0.5);
  animation: pulse 1.2s ease-in-out infinite;
}
.buzzer.winner, .buzzer.correct {
  background: radial-gradient(circle at 35% 30%, #b9ffc4, var(--buzz-green) 55%, #138a24);
  box-shadow: 0 10px 0 #0d5e18, 0 0 60px rgba(46, 204, 64, 0.85), 0 18px 30px rgba(0, 0, 0, 0.5);
  color: #0b3d12;
}
.buzzer.off, .buzzer.locked {
  background: radial-gradient(circle at 35% 30%, #3a3a3a, #1d1d1d 70%);
}
.buzzer-status {
  color: var(--white);
  font-size: 1.3rem;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  min-height: 3em;
}

/* place the pin */
body.map-mode main#app { padding: 0; justify-content: flex-start; }
body.map-mode .topbar, body.map-mode .garland { display: none; }
.mapview { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; background: #dfe7ec; }
.mapview .map { flex: 1; }
.mapbar {
  position: absolute;
  left: 10px; right: 10px;
  top: calc(env(safe-area-inset-top) + 10px);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(21, 21, 21, 0.85);
  color: var(--white);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 700;
  box-shadow: var(--shadow);
}
.mapbar .count {
  margin-left: auto;
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  color: var(--gold-light);
}
.mapbar .count.urgent { color: #ff6b6b; }
.timebar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--gold); border-radius: 0 0 14px 14px; transition: width 0.25s linear; }

/* results */
.standing { text-align: center; }
.standing .rank { font-size: 4rem; font-weight: 900; color: var(--green-dark); line-height: 1; }
.standing .of { color: var(--muted); font-weight: 600; }
.standing .pts { font-size: 1.6rem; font-weight: 800; margin-top: 8px; }
.standing .round-pts { color: var(--green); font-weight: 700; }
.standing.winner .rank { color: var(--gold); text-shadow: 0 2px 0 var(--brown); }

.breakdown { margin-top: 18px; }
.breakdown h3 { margin: 18px 0 8px; font-size: 1rem; color: var(--red-dark); text-transform: uppercase; letter-spacing: 0.04em; }
.bq {
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 6px solid #bbb;
}
.bq.right { border-left-color: var(--green); }
.bq.wrong { border-left-color: var(--red); }
.bq .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.bq .qt { font-size: 0.9rem; color: var(--muted); margin: 2px 0 6px; }
.bq .row { font-size: 0.95rem; }
.bq .row b { display: inline-block; min-width: 6.5em; color: var(--muted); font-weight: 600; }
.bq .pts { white-space: nowrap; color: var(--green-dark); }

.conn {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  transform: translateX(-50%);
  background: var(--orange);
  color: var(--black);
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  z-index: 900;
  box-shadow: var(--shadow);
}
