/* ============================================================
   Player / projector view — KH-7 brand, dark racing canvas
   (white official logo needs a dark backdrop to pop)
   ============================================================ */

/* Dark theme: solid deep navy backdrop, no gradients/blobs.
   Light theme keeps the shared light .bg-fx defined in styles.css. */
html.theme-dark .bg-fx {
  background: #00093d;
}
html.theme-dark .bg-fx::before,
html.theme-dark .bg-fx::after {
  display: none;
}

/* Dark theme: white headings / podium scores for contrast on navy. */
html.theme-dark .lobby h1 {
  color: #fff;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
html.theme-dark .finished h1 {
  color: #fff;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
html.theme-dark .finished h1 em {
  color: var(--kh-orange);
}
html.theme-dark .podium-col .pts {
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}

/* Logo swaps with the theme: white logo on dark, dark logo on light.
   Theme-scoped on both sides so specificity is consistent and neither
   logo leaks into the other theme. */
html.theme-dark .topbar .logo-dark {
  display: block;
}
html.theme-dark .topbar .logo-light {
  display: none;
}
html.theme-light .topbar .logo-dark {
  display: none;
}
html.theme-light .topbar .logo-light {
  display: block;
}

/* Top-right cluster (theme toggle + connection pill). */
.top-right {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.top-right .conn {
  position: static;
  top: auto;
  right: auto;
}
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 32px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.12s ease, background 0.2s ease;
}
.theme-toggle:hover {
  transform: translateY(-1px);
  background: #fff;
}
.theme-toggle:active {
  transform: translateY(0);
}
/* Show the icon for the theme you'd switch TO. */
html.theme-dark .theme-toggle .ico-dark {
  display: none;
}
html.theme-light .theme-toggle .ico-light {
  display: none;
}

.stage {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(16px, 2.2vw, 34px);
  gap: clamp(14px, 1.8vw, 26px);
}

/* ---------- Top bar ---------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.topbar .logo {
  grid-column: 2;
  height: clamp(58px, 7vw, 116px);
  width: auto;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.55));
}
.qcount {
  grid-column: 3;
  justify-self: end;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(0.95rem, 1.7vw, 1.5rem);
  color: var(--muted);
  letter-spacing: 0.02em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  box-shadow: var(--shadow-sm);
  min-width: 5.5ch;
  text-align: center;
}
.qcount b {
  color: var(--kh-blue);
}
/* No question number to show (e.g. lobby): hide the empty pill entirely. */
.qcount:empty {
  display: none;
}

/* ---------- Main area ---------- */
.main {
  min-height: 0;
  display: grid;
  place-items: center;
}
.center-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(18px, 3vw, 40px);
}

/* ----- Lobby ----- */
.lobby h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(3rem, 8.5vw, 8rem);
  line-height: 0.9;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--kh-blue);
}
.lobby h1 .flag {
  display: inline-block;
  background: var(--kh-orange);
  color: #fff;
  padding: 0 0.16em;
  transform: skew(-7deg);
  box-shadow: var(--shadow-md);
}
.lobby .sub {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1rem, 1.9vw, 1.5rem);
  color: var(--ink-soft);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.lobby-teams {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(10px, 1.4vw, 20px);
  width: min(1500px, 96%);
}
.lobby-team {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  text-align: left;
  box-shadow: var(--shadow-md);
  animation: cardIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.lobby-team:nth-child(1) { animation-delay: 0.05s; }
.lobby-team:nth-child(2) { animation-delay: 0.13s; }
.lobby-team:nth-child(3) { animation-delay: 0.21s; }
.lobby-team:nth-child(4) { animation-delay: 0.29s; }
.lobby-team .bottle {
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 18%, #fff), color-mix(in srgb, var(--tc) 34%, #fff));
  border-bottom: 6px solid var(--tc);
  padding: clamp(16px, 2vw, 30px);
  height: clamp(240px, 46vh, 520px);
}
.lobby-team .bottle img {
  max-height: 100%;
  max-width: 85%;
  object-fit: contain;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.3));
  animation: bottleBob 3s ease-in-out infinite;
}
.lobby-team .bottle span {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1rem, 1.5vw, 1.55rem);
  color: var(--tc);
}
.lobby-team ul {
  list-style: none;
  display: grid;
  gap: 2px;
  font-size: clamp(0.72rem, 0.95vw, 0.96rem);
  color: var(--ink-soft);
  padding: clamp(10px, 1.2vw, 16px) clamp(12px, 1.4vw, 20px);
}
.lobby-team li {
  padding: 2px 0;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(26px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ----- Question ----- */
.question-wrap {
  width: min(1620px, 100%);
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.2vw, 32px);
}
.qbadge {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(0.85rem, 1.3vw, 1.2rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  background: var(--kh-orange);
  padding: 8px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
}
.qcard {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  padding: clamp(22px, 3vw, 48px);
  position: relative;
  overflow: hidden;
}
.qcard::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 7px;
  background: linear-gradient(90deg, var(--kh-blue), var(--kh-orange) 60%, var(--kh-green));
}
.qtext {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.7rem, 3.8vw, 3.6rem);
  line-height: 1.06;
  text-align: center;
  color: var(--kh-blue);
  text-wrap: balance;
}
.options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(12px, 1.6vw, 22px);
  margin-top: clamp(18px, 2.4vw, 34px);
}
.option {
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.6vw, 24px);
  background: var(--surface-2);
  border: 2px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: clamp(14px, 1.7vw, 24px) clamp(16px, 2vw, 28px);
  font-size: clamp(1.05rem, 1.95vw, 1.9rem);
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.5s ease, border-color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
  animation: optIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.options .option:nth-child(1) { animation-delay: 0.05s; }
.options .option:nth-child(2) { animation-delay: 0.12s; }
.options .option:nth-child(3) { animation-delay: 0.19s; }
.options .option:nth-child(4) { animation-delay: 0.26s; }
@keyframes optIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.option .key {
  flex: 0 0 auto;
  width: clamp(40px, 3.4vw, 64px);
  height: clamp(40px, 3.4vw, 64px);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.2rem, 2.1vw, 2.1rem);
  border-radius: 12px;
  background: var(--kh-blue);
  color: #fff;
}
.option.correct {
  border-color: var(--kh-green);
  background: linear-gradient(180deg, rgba(101, 188, 70, 0.18), rgba(101, 188, 70, 0.06));
  box-shadow: 0 0 0 3px var(--kh-green), 0 18px 40px -12px rgba(101, 188, 70, 0.6);
  transform: scale(1.02);
}
.option.correct .key {
  background: var(--kh-green);
}
.option.correct .label::after {
  content: "✓";
  margin-left: 12px;
  color: var(--kh-green-600);
  font-weight: 900;
}
.option.dim {
  opacity: 0.4;
  filter: grayscale(0.4);
}
.option.eliminated {
  border-color: var(--kh-orange);
  background: linear-gradient(180deg, rgba(255, 80, 0, 0.1), rgba(255, 80, 0, 0.03));
  opacity: 0.85;
  animation: strikeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.option.eliminated .label {
  text-decoration: line-through;
  text-decoration-color: var(--kh-orange);
  text-decoration-thickness: 3px;
  color: var(--muted);
}
.option.eliminated .key {
  background: var(--kh-orange);
  position: relative;
}
/* Replace the letter with a big cross on eliminated options */
.option.eliminated .key::after {
  content: "✗";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--kh-orange);
  color: #fff;
  border-radius: inherit;
}
.option.correct.eliminated .label {
  text-decoration: none;
  color: var(--ink);
}
@keyframes strikeIn {
  from { transform: scale(1.03); }
  to { transform: scale(1); }
}

/* ---------- Scoreboard strip ---------- */
.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(10px, 1.2vw, 18px);
}
.score-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: clamp(10px, 1.1vw, 16px) clamp(14px, 1.4vw, 20px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
}
.score-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--tc);
}
.score-card.leader {
  box-shadow: 0 0 0 2px var(--kh-orange), var(--shadow-md);
  transform: translateY(-4px);
}
.score-card .rank {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.2rem, 1.8vw, 2rem);
  color: var(--muted-dim);
  width: 1.6ch;
  text-align: center;
}
.score-card.leader .rank {
  color: var(--kh-orange);
}
.score-card .info {
  min-width: 0;
}
.score-card .tname {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(0.95rem, 1.35vw, 1.45rem);
  color: var(--tc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.score-card .tmeta {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.score-card .pts {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.6rem, 2.8vw, 3rem);
  line-height: 1;
  color: var(--kh-blue);
  font-variant-numeric: tabular-nums;
}
.pts.bump {
  animation: bump 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes bump {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); color: var(--kh-orange); }
  100% { transform: scale(1); }
}

/* ---------- Finished / podium ---------- */
.finished h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.4rem, 6vw, 6rem);
  text-transform: uppercase;
  color: var(--kh-blue);
}
.finished h1 em {
  color: var(--kh-orange);
  font-style: normal;
}
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(12px, 1.8vw, 34px);
  width: min(1320px, 97%);
}
.podium-col {
  position: relative;
  flex: 1 1 0;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.podium-col .podium-bottle {
  height: clamp(80px, 11vh, 130px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.podium-col.slot-0 .podium-bottle {
  height: clamp(105px, 15vh, 168px);
}
.podium-col .podium-bottle img {
  height: 100%;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
  animation: bottleBob 2.8s ease-in-out infinite;
}
@keyframes bottleBob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-7px) rotate(1.5deg); }
}
.podium-col .tname {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1rem, 1.5vw, 1.7rem);
  color: var(--tc);
  text-align: center;
  line-height: 1.05;
}
.podium-col .pts {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.5rem, 2.6vw, 2.8rem);
  color: var(--kh-blue);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.podium-col .bar {
  width: 100%;
  background: linear-gradient(180deg, var(--tc), color-mix(in srgb, var(--tc) 55%, #000));
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  padding-top: 12px;
  color: #fff;
  height: 0;
  transition: height 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.podium-col .bar .medal {
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1;
}
.podium-col .bar .ord {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1rem, 1.5vw, 1.5rem);
  letter-spacing: 0.04em;
}
@keyframes grow {
  to { height: var(--h); }
}

/* ----- Live podium score-change effects ----- */
.delta-pop {
  position: absolute;
  left: 50%;
  top: 28%;
  transform: translate(-50%, 0);
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  padding: 4px 16px;
  border-radius: 999px;
  color: #fff;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  animation: deltaPop 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.delta-pop.plus {
  background: linear-gradient(180deg, #65bc46, #3f9e2c);
}
.delta-pop.minus {
  background: linear-gradient(180deg, #ff5b4d, #d23a2c);
}
.rest-team .delta-pop {
  top: -10px;
  font-size: 1.4rem;
}
@keyframes deltaPop {
  0% { opacity: 0; transform: translate(-50%, 14px) scale(0.6); }
  18% { opacity: 1; transform: translate(-50%, -6px) scale(1.18); }
  35% { transform: translate(-50%, -14px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -90px) scale(1); }
}
.scorebump {
  animation: scoreBump 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.scorebump .pts,
.scorebump .rpts {
  animation: ptsFlash 0.7s ease;
}
@keyframes scoreBump {
  0% { transform: scale(1); }
  30% { transform: scale(1.06); filter: drop-shadow(0 0 18px color-mix(in srgb, var(--tc) 60%, transparent)); }
  100% { transform: scale(1); }
}
@keyframes ptsFlash {
  0% { transform: scale(1); }
  30% { transform: scale(1.5); color: var(--kh-orange); }
  100% { transform: scale(1); }
}
.rest-list {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 1.05rem;
}
.rest-team {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--tc);
  border-radius: 14px;
  padding: 10px 18px 10px 12px;
  box-shadow: var(--shadow-sm);
}
.rest-team img {
  height: clamp(40px, 6vh, 64px);
  width: auto;
  object-fit: contain;
}
.rest-team .rrank {
  font-size: 1.4rem;
  color: var(--tc);
}
.rest-team .rname {
  color: var(--ink);
  font-size: 1.3rem;
}
.rest-team .rpts {
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--kh-blue);
  margin-left: 6px;
}

.reveal-anim > * {
  animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Confetti */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  top: -12vh;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  opacity: 0.9;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(118vh) rotate(720deg); opacity: 0.9; }
}

/* ============================================================
   Chronometer overlay — big & fun, F1 / GRAND PRIX flavour
   ============================================================ */
.timer-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 50% -10%, rgba(91, 108, 214, 0.35), transparent 60%),
    linear-gradient(160deg, var(--kh-blue) 0%, #0a1247 55%, #05082b 100%);
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}
.timer-overlay.show {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* animated sheen */
.timer-overlay .timer-fx {
  position: absolute;
  inset: -30%;
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.05) 0deg 10deg, transparent 10deg 20deg);
  animation: timerspin 26s linear infinite;
  opacity: 0.5;
}
@keyframes timerspin { to { transform: rotate(360deg); } }

/* checkered flags on the sides */
.timer-flag {
  position: absolute;
  top: 0;
  bottom: 0;
  width: clamp(40px, 7vw, 110px);
  background-image:
    linear-gradient(45deg, #fff 25%, transparent 25%),
    linear-gradient(-45deg, #fff 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #fff 75%),
    linear-gradient(-45deg, transparent 75%, #fff 75%);
  background-size: 38px 38px;
  background-position: 0 0, 0 19px, 19px -19px, -19px 0;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0.18;
  mix-blend-mode: overlay;
}
.timer-flag-l { left: 0; }
.timer-flag-r { right: 0; }

/* spinning bottles in each corner — a fun quality detail */
.timer-bottle {
  position: absolute;
  width: clamp(90px, 13vw, 220px);
  height: auto;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.45));
  pointer-events: none;
  z-index: 1;
  transform-origin: 50% 50%;
}
.timer-bottle.tl { top: clamp(10px, 3vh, 48px); left: clamp(10px, 3vw, 48px); animation: bottlespin 7s linear infinite; }
.timer-bottle.tr { top: clamp(10px, 3vh, 48px); right: clamp(10px, 3vw, 48px); animation: bottlespin 8.5s linear infinite reverse; }
.timer-bottle.bl { bottom: clamp(10px, 3vh, 48px); left: clamp(10px, 3vw, 48px); animation: bottlespin 9s linear infinite reverse; }
.timer-bottle.br { bottom: clamp(10px, 3vh, 48px); right: clamp(10px, 3vw, 48px); animation: bottlespin 7.8s linear infinite; }
@keyframes bottlespin {
  to { transform: rotate(360deg); }
}

.timer-card {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: clamp(20px, 4vw, 56px) clamp(28px, 6vw, 90px);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}
.timer-label {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: clamp(1rem, 2.4vw, 2rem);
  color: var(--kh-orange);
  margin-bottom: clamp(6px, 1.2vw, 14px);
}
.timer-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  line-height: 0.9;
  color: #fff;
  text-shadow: 0 8px 40px rgba(101, 188, 70, 0.45);
}
.timer-main {
  font-family: var(--display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: clamp(5rem, 26vw, 22rem);
  background: linear-gradient(180deg, #ffffff 0%, #cfe8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: transform 0.12s ease;
}
.timer-main.beat { transform: scale(1.045); }
.timer-cs {
  font-family: var(--display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.6rem, 7vw, 6rem);
  color: var(--kh-green);
  margin-left: 0.12em;
}
.timer-pill {
  display: inline-block;
  margin-top: clamp(10px, 1.8vw, 22px);
  padding: 0.4em 1.4em;
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.2em;
  font-size: clamp(0.9rem, 1.8vw, 1.4rem);
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.12);
  color: #cdd6ff;
}
.timer-pill.running {
  background: var(--kh-green);
  color: #fff;
}
.timer-pill.timesup {
  background: var(--kh-orange);
  color: #fff;
}

/* danger: countdown last seconds */
.timer-overlay.danger .timer-main {
  background: linear-gradient(180deg, #ff7a4d 0%, #ff2d2d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: timershake 0.5s ease-in-out infinite;
}
.timer-overlay.danger .timer-cs { color: #ff8a8a; }
@keyframes timershake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-8px) rotate(-1.5deg); }
  75% { transform: translateX(8px) rotate(1.5deg); }
}

/* time's up flash */
.timer-overlay.times-up {
  animation: timesupflash 0.6s ease-in-out infinite alternate;
}
.timer-overlay.times-up .timer-main {
  background: linear-gradient(180deg, #fff 0%, #ffd24d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@keyframes timesupflash {
  from { background-color: transparent; }
  to { box-shadow: inset 0 0 0 2000px rgba(255, 80, 0, 0.12); }
}

@media (max-width: 760px) {
  .options,
  .lobby-teams {
    grid-template-columns: 1fr;
  }
  .scoreboard {
    grid-template-columns: repeat(2, 1fr);
  }
}
