/* Round screens (reading + question) — cake design, 2 Nov 2026.
   All sizes are in --u = 1% of the design frame width. The frame keeps the mockup's
   proportions (941×1672) and is as wide as the phone; team panels stick to the top,
   buttons to the bottom, and the cake sits centred between them. Nothing on the page
   scrolls — only the text inside the cake. */
@property --ft { syntax: '<length>'; inherits: true; initial-value: 0px; }
@property --fb { syntax: '<length>'; inherits: true; initial-value: 0px; }

body.round-ui {
  --fw: min(100vw, calc(100dvh * 0.5628));
  --u: calc(var(--fw) / 100);
  --x0: calc(50vw - var(--fw) / 2);
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --ink: #3a1d0c;
  --ink-soft: #7a5530;
  --gold: #d8a63c;
  height: 100dvh;
  overflow: hidden;
  background: #f6e8d0 url(assets/round/background.jpg) center top / cover no-repeat;
}
body.round-ui > header,
body.round-ui > footer,
body.round-ui .spotlights,
body.round-ui .curtain,
body.round-ui .round-status,
body.round-ui .read-progress,
body.round-ui .legacy-clock,
body.round-ui .stage-clock-placeholder { display: none !important; }
body.round-ui #app { position: static; padding: 0; margin: 0; max-width: none; }
body.round-ui .game-area { position: static; padding: 0; margin: 0; }

/* ---------- team panels ---------- */
body.round-ui .game-scoreboard {
  position: fixed; z-index: 5; margin: 0;
  top: calc(var(--st) + 2.6 * var(--u));
  left: calc(var(--x0) + 1.5 * var(--u));
  width: calc(97 * var(--u));
  display: grid; grid-template-columns: 1fr 1fr; gap: calc(5.3 * var(--u));
}
body.round-ui .game-score {
  height: calc(16.5 * var(--u)); min-height: 0; margin: 0;
  display: flex; align-items: center; justify-content: space-between; gap: calc(2 * var(--u));
  padding: 0 calc(4 * var(--u)) 0 calc(3 * var(--u));
  border-radius: calc(6 * var(--u));
  background: linear-gradient(#fffaf0, #f4e3c3);
  border: calc(0.55 * var(--u)) solid var(--gold);
  box-shadow: inset 0 calc(0.5 * var(--u)) 0 #fff, 0 calc(0.8 * var(--u)) calc(2 * var(--u)) rgba(120, 80, 20, .25);
  color: var(--ink);
  transition: box-shadow .3s, transform .3s;
}
body.round-ui .game-score.active {
  border-color: #e9b640;
  box-shadow: inset 0 calc(0.5 * var(--u)) 0 #fff, 0 0 calc(3.2 * var(--u)) rgba(255, 196, 70, .85);
  transform: translateY(calc(-0.3 * var(--u)));
}
body.round-ui .game-team-name {
  font-size: calc(5.2 * var(--u)); font-weight: 800; line-height: 1.08; text-align: right;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-width: 0; flex: 1;
}
body.round-ui .team-difficulty { display: none; }
body.round-ui .game-team-score { display: flex; align-items: center; gap: calc(1.2 * var(--u)); flex: none; }
body.round-ui .game-team-score b { font-size: calc(9 * var(--u)); line-height: 1; color: var(--ink); }
body.round-ui .team-candle { height: calc(10 * var(--u)); width: auto; display: block; }

/* ---------- cake, level candle and the text box ---------- */
body.round-ui #theater-stage {
  position: fixed; z-index: 1; margin: 0; padding: 0;
  width: calc(131 * var(--u)); height: calc(174.6 * var(--u));
  left: calc(50vw - 65.5 * var(--u));
  /* centre of the cake face halfway between the team panels and the next button */
  top: calc((var(--st) + 100dvh - var(--sb)) / 2 - 89.8 * var(--u));
  background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible;
  min-height: 0; max-height: none;
}
body.round-ui #theater-stage::before,
body.round-ui #theater-stage::after { display: none; }
body.round-ui .round-cake {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; user-select: none;
}
body.round-ui .round-level-candle {
  position: absolute; left: 19%; bottom: 18.6%; height: 26%; width: auto; z-index: 2;
  transform: translateX(-50%); transform-origin: 50% 100%;
  filter: drop-shadow(0 0 calc(2 * var(--u)) rgba(255, 190, 80, .55));
  animation: candle-glow 2.6s ease-in-out infinite;
  pointer-events: none; user-select: none;
}
@keyframes candle-glow {
  0%, 100% { filter: drop-shadow(0 0 calc(1.6 * var(--u)) rgba(255, 190, 80, .45)); }
  50% { filter: drop-shadow(0 0 calc(3 * var(--u)) rgba(255, 200, 90, .8)); }
}
body.round-ui #central-card {
  position: absolute; margin: 0; padding: 0;
  left: 24.5%; width: 56%; top: 40.6%; height: 32.3%;
  min-height: 0; max-height: none;
  background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible;
  transition: --ft .25s ease, --fb .25s ease;
}
body.round-ui #central-card::before,
body.round-ui #central-card::after { display: none; }
body.round-ui #central-card.fade-top { --ft: calc(9 * var(--u)); }
body.round-ui #central-card.fade-bottom { --fb: calc(9 * var(--u)); }
body.round-ui .stage-scroll,
body.round-ui .stage-answer-scroll {
  position: absolute; inset: 0; margin: 0;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
  padding: calc(1.5 * var(--u)) calc(1.5 * var(--u)) calc(1.5 * var(--u)) calc(2.5 * var(--u));
  max-height: none; background: none; border: 0; box-shadow: none;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--ft), #000 calc(100% - var(--fb)), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 var(--ft), #000 calc(100% - var(--fb)), transparent 100%);
}
body.round-ui .stage-scroll::-webkit-scrollbar,
body.round-ui .stage-answer-scroll::-webkit-scrollbar { display: none; }
/* short text sits in the middle of the cake; long text starts at the top and scrolls */
body.round-ui .stage-scroll > :first-child,
body.round-ui .stage-answer-scroll > :first-child { margin-top: auto; }
body.round-ui .stage-scroll > :last-child,
body.round-ui .stage-answer-scroll > :last-child { margin-bottom: auto; }
body.round-ui .sentence {
  margin: 0; max-width: none; text-align: right;
  font-size: calc(5.3 * var(--u)); line-height: 1.5; font-weight: 700; color: var(--ink);
  background: none; padding: 0;
}
body.round-ui .scroll-rail {
  position: absolute; left: calc(-1.6 * var(--u)); top: 12%; bottom: 12%; width: calc(0.6 * var(--u));
  border-radius: 99px; background: rgba(160, 110, 40, .16);
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
body.round-ui .can-scroll .scroll-rail { opacity: 1; }
body.round-ui .scroll-rail i {
  position: absolute; top: 0; left: 0; width: 100%; display: block; border-radius: 99px;
  background: linear-gradient(#e7b84f, #a8711c);
  box-shadow: 0 0 calc(0.8 * var(--u)) rgba(200, 140, 40, .5);
}

/* question content inside the cake */
body.round-ui .stage-question { margin: 0 0 calc(2.5 * var(--u)); background: none; padding: 0; text-align: right; }
body.round-ui .question-number {
  margin: 0 0 calc(1 * var(--u)); font-size: calc(3 * var(--u)); font-weight: 600; color: var(--ink-soft); opacity: .8;
}
body.round-ui .question-box {
  margin: 0; font-size: calc(5.6 * var(--u)); line-height: 1.35; font-weight: 800; color: var(--ink); text-align: right;
}
body.round-ui .voice-panel { margin: 0; padding: 0; background: none; border: 0; text-align: right; }
body.round-ui .voice-instruction { margin: 0; font-size: calc(4.4 * var(--u)); font-weight: 700; color: var(--ink-soft); }
body.round-ui .host-answer { display: grid; gap: calc(0.6 * var(--u)); background: none; border: 0; padding: 0; text-align: right; }
body.round-ui .host-answer-label { font-size: calc(3.4 * var(--u)); color: var(--ink-soft); font-weight: 700; }
body.round-ui .host-answer strong { font-size: calc(6 * var(--u)); color: #8a3c0a; line-height: 1.25; }
body.round-ui .choices { display: grid; gap: calc(1.8 * var(--u)); margin: 0; }
body.round-ui .choices .choice {
  width: 100%; min-height: 0; margin: 0;
  padding: calc(1.8 * var(--u)) calc(3 * var(--u));
  border-radius: calc(4 * var(--u));
  background: linear-gradient(#fffdf7, #f6e7ca);
  border: calc(0.45 * var(--u)) solid var(--gold);
  box-shadow: inset 0 calc(0.4 * var(--u)) 0 #fff, 0 calc(0.5 * var(--u)) calc(1.2 * var(--u)) rgba(110, 70, 20, .2);
  color: var(--ink); font-size: calc(4.3 * var(--u)); font-weight: 800; line-height: 1.3; text-align: right;
}
body.round-ui .choices .choice:active { transform: scale(.98); }

/* ---------- next button + pause ---------- */
body.round-ui .paper-stage-action {
  position: fixed; z-index: 5; margin: 0; padding: 0; background: none;
  left: calc(var(--x0) + 4.3 * var(--u)); width: calc(92.4 * var(--u));
  bottom: calc(var(--sb) + 16.2 * var(--u)); height: calc(16 * var(--u));
  display: flex; align-items: center; gap: calc(4.8 * var(--u));
}
body.round-ui .round-controls {
  flex: 1; height: 100%; min-width: 0; margin: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
body.round-ui .round-controls > .primary,
body.round-ui .host-verdict > button {
  width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0 calc(4 * var(--u));
  border-radius: 999px;
  background: linear-gradient(#fffdf6 0%, #f7e7c7 100%);
  border: calc(0.7 * var(--u)) solid var(--gold);
  box-shadow: inset 0 calc(0.6 * var(--u)) 0 #fff, inset 0 calc(-0.8 * var(--u)) calc(1.5 * var(--u)) rgba(190, 140, 60, .35), 0 calc(1 * var(--u)) calc(2.4 * var(--u)) rgba(110, 70, 20, .3);
  color: var(--ink); font-size: calc(6.4 * var(--u)); font-weight: 800; text-shadow: none;
}
body.round-ui .round-controls > .primary:active,
body.round-ui .host-verdict > button:active { transform: scale(.98); }
body.round-ui .host-verdict { display: flex; gap: calc(3 * var(--u)); width: 100%; height: 100%; }
body.round-ui .host-verdict > .yes { color: #2f6b2a; }
body.round-ui .host-verdict > .no { color: #9a2a1a; }
body.round-ui .choice-time-bar {
  width: var(--time-left, 100%); height: calc(1.6 * var(--u)); border-radius: 99px;
  background: linear-gradient(90deg, #e7b84f, #b67d22); align-self: center; transition: width .2s linear;
}
body.round-ui .art-button {
  padding: 0; margin: 0; border: 0; background: none; box-shadow: none; min-height: 0; border-radius: 0;
  line-height: 0; cursor: pointer;
}
body.round-ui .art-button img { display: block; width: 100%; height: auto; pointer-events: none; user-select: none; }
body.round-ui .art-button:active { transform: scale(.96); }
body.round-ui .round-pause { width: calc(15 * var(--u)); height: calc(15 * var(--u)); flex: none; border-radius: 50%; }

/* ---------- bottom tools ---------- */
body.round-ui .game-tools {
  position: fixed; z-index: 5; margin: 0; padding: 0;
  left: calc(var(--x0) + 5.3 * var(--u)); width: calc(92 * var(--u));
  bottom: calc(var(--sb) + 2.3 * var(--u)); height: calc(10.5 * var(--u));
  display: flex; align-items: center; gap: calc(2.7 * var(--u));
}
body.round-ui .game-tools .tool-save,
body.round-ui .game-tools .tool-map { flex: 1; min-width: 0; }
body.round-ui .game-tools .game-sound { width: calc(10.5 * var(--u)); flex: none; border-radius: 50%; }

/* ---------- answer mode toggle (question screen) ---------- */
body.round-ui .mode-toggle {
  position: fixed; z-index: 5; margin: 0; padding: 0;
  width: calc(54 * var(--u)); aspect-ratio: 760 / 211;
  left: calc(50vw - 27 * var(--u));
  bottom: calc(var(--sb) + 34 * var(--u));
  display: flex; direction: ltr; gap: 0;
  background: url(assets/round/toggle-voice.png) center / contain no-repeat;
  border: 0; box-shadow: none; border-radius: 99px;
}
body.round-ui .mode-toggle.mode-choice { background-image: url(assets/round/toggle-choice.png); }
body.round-ui .mode-toggle button {
  flex: 1; height: 100%; margin: 0; padding: 0; min-height: 0;
  background: none; border: 0; box-shadow: none; border-radius: 99px;
  color: transparent; font-size: 0; cursor: pointer;
}
body.round-ui .mode-toggle button:disabled { cursor: default; }
body.round-ui .mode-toggle:has(button:disabled) { opacity: .55; }
body.round-ui .mode-toggle button:focus-visible { outline: calc(.6 * var(--u)) solid #fff; outline-offset: calc(-1 * var(--u)); }

/* keyboard focus stays visible on artwork buttons */
body.round-ui .art-button:focus-visible,
body.round-ui .round-controls > .primary:focus-visible { outline: calc(.6 * var(--u)) solid #8a5a14; outline-offset: calc(.5 * var(--u)); }

/* ---------- overrides of the older stage styles ---------- */
body.round-ui .game-score,
body.round-ui .game-score.second {
  direction: rtl !important;
  background: linear-gradient(#fffaf0, #f4e3c3) !important;
  color: var(--ink) !important;
}
body.round-ui .round-controls > .primary,
body.round-ui .paper-stage.has-timer .round-controls > .primary {
  position: relative; isolation: isolate; overflow: hidden;
  background: linear-gradient(#fffdf6 0%, #f7e7c7 100%) !important;
  border: calc(0.7 * var(--u)) solid var(--gold) !important;
  color: var(--ink) !important;
  white-space: nowrap;
}
/* time left: a soft gold fill that shrinks inside the button (was orange) */
body.round-ui .paper-stage.has-timer .round-controls > .primary::before {
  background: linear-gradient(90deg, rgba(236, 190, 90, .28), rgba(236, 190, 90, .5)) !important;
}
body.round-ui .round-controls > .primary .timed-label { position: relative; z-index: 1; color: var(--ink); }
body.round-ui .paper-stage .choice-time-bar {
  width: 100%; height: calc(1.8 * var(--u)); min-height: 0; padding: 0;
  background: rgba(160, 110, 40, .18) !important; border: 0 !important; box-shadow: none !important;
}
body.round-ui .paper-stage .choice-time-bar::before { background: linear-gradient(90deg, #e7b84f, #b67d22) !important; }
body.round-ui .game-score,
body.round-ui .game-score.second { border-color: var(--gold) !important; }
body.round-ui .game-score.active { border-color: #e9b640 !important; }
body.round-ui .game-team-name { word-break: normal; overflow-wrap: normal; hyphens: none; }
body.round-ui .choices { grid-template-columns: 1fr !important; }

/* ---------- artwork buttons and team candles on the other game screens (result etc.) ---------- */
body.game-screen .team-candle { height: 1.7em; width: auto; display: inline-block; vertical-align: middle; }
body.game-screen .game-tools { display: flex; align-items: center; gap: 10px; }
body.game-screen .game-tools .art-button { padding: 0; margin: 0; border: 0; background: none; box-shadow: none; min-height: 0; border-radius: 0; line-height: 0; }
body.game-screen .game-tools .art-button img { display: block; width: 100%; height: auto; }
body.game-screen .game-tools .tool-save,
body.game-screen .game-tools .tool-map { flex: 1; min-width: 0; }
body.game-screen .game-tools .game-sound { width: 44px; flex: none; border-radius: 50%; }
body.game-screen .round-pause.art-button { padding: 0; border: 0; background: none; box-shadow: none; }
body.game-screen .round-pause.art-button img { display: block; width: 100%; height: auto; }

/* ---------- curtain background: loading, opening screen, team names ---------- */
body.is-loading,
body.curtain-ui {
  min-height: 100dvh;
  background: #3a0d1c url(assets/round/curtain.jpg) center top / cover no-repeat;
}
body.is-loading .spotlights, body.is-loading .curtain,
body.curtain-ui .spotlights, body.curtain-ui .curtain { display: none; }
body.is-loading > header, body.is-loading > footer { visibility: hidden; }
body.curtain-ui .wordmark { color: #f6dca0; text-shadow: 0 0 14px rgba(255, 190, 90, .45); }
body.curtain-ui .wordmark b, body.curtain-ui .wordmark span { color: #ffe6ad; }
body.curtain-ui .icon-button { background: rgba(60, 10, 25, .45); color: #f6dca0; border-color: rgba(246, 220, 160, .55); }
body.curtain-ui > footer { color: rgba(255, 228, 185, .75); }
body.curtain-ui .home-bottom .text-link,
body.curtain-ui .team-setup > .text-link,
body.curtain-ui .reset-button,
body.curtain-ui .home-actions > .note { color: #f6dca0; }

/* loader */
.loader {
  min-height: 78dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; text-align: center; color: #f8e6c0; padding: 24px;
}
.loader-mark { font-size: 46px; font-weight: 800; color: #f3cf7a; letter-spacing: .02em; text-shadow: 0 0 22px rgba(255, 190, 90, .6); }
.loader-mark b { color: #ffe3a0; }
.loader-title { font-size: 22px; font-weight: 700; }
.loader-bar {
  width: min(70vw, 280px); height: 9px; border-radius: 99px; overflow: hidden; margin-top: 8px;
  background: rgba(255, 220, 170, .16); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .4), 0 0 0 1px rgba(246, 210, 140, .35);
}
#loader-fill {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, #f6d48a, #d9962e); box-shadow: 0 0 12px rgba(255, 200, 100, .7);
  transition: width .25s ease;
}
.loader-text { margin: 0; font-size: 16px; opacity: .85; }
.loader-text span { font-variant-numeric: tabular-nums; }

/* ---------- fade between screens ---------- */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .5s; animation-timing-function: ease; }
#app.screen-in { animation: screen-in .45s ease both; }
@keyframes screen-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #app.screen-in { animation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* "תשובות לבחירה": simple button that scrolls with the text, right under the question */
body.round-ui .stage-answer-scroll .show-choices {
  position: static; display: block; flex: none; z-index: auto;
  margin: calc(2.5 * var(--u)) auto 0; transform: none;
  width: calc(46 * var(--u)); height: calc(10 * var(--u)); min-height: 0; padding: 0;
  border-radius: 999px;
  background: linear-gradient(#fffdf7, #f6e7ca) !important;
  border: calc(0.5 * var(--u)) solid var(--gold) !important;
  box-shadow: inset 0 calc(0.4 * var(--u)) 0 #fff, 0 calc(0.6 * var(--u)) calc(1.4 * var(--u)) rgba(110, 70, 20, .25) !important;
  color: var(--ink) !important; font-size: calc(4.6 * var(--u)); font-weight: 800; line-height: 1;
}
body.round-ui .stage-answer-scroll .show-choices:active { transform: scale(.97); }


/* ---------- result screens inside the cake (success, failure, last-candle check, penalty, victory) ---------- */
body.round-ui .stage-result-scroll {
  position: absolute; inset: 0; margin: 0;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; text-align: right;
  padding: calc(1.5 * var(--u)) calc(1.5 * var(--u)) calc(1.5 * var(--u)) calc(2.5 * var(--u));
  max-height: none; background: none; border: 0; box-shadow: none; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--ft), #000 calc(100% - var(--fb)), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 var(--ft), #000 calc(100% - var(--fb)), transparent 100%);
}
body.round-ui .stage-result-scroll::-webkit-scrollbar { display: none; }
body.round-ui .stage-result-scroll > :first-child { margin-top: auto; }
body.round-ui .stage-result-scroll > :last-child { margin-bottom: auto; }
body.round-ui #central-card.result-card { background: none !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; }
body.round-ui .stage-result-copy { margin: 0; padding: 0; background: none; text-align: right; }
body.round-ui .stage-result-copy h1 {
  margin: 0 0 calc(1.5 * var(--u)); font-size: calc(7.2 * var(--u)); line-height: 1.15; font-weight: 800;
  color: #8a5a10; text-align: right;
}
body.round-ui .stage-failure .stage-result-copy h1 { color: #9a2a1a; }
body.round-ui .stage-result-copy p { margin: 0 0 calc(1.5 * var(--u)); font-size: calc(4.6 * var(--u)); line-height: 1.45; font-weight: 700; color: var(--ink); }
body.round-ui .stage-result-copy .revealed-answer {
  font-size: calc(6 * var(--u)); font-weight: 800; color: var(--ink); margin-bottom: calc(1.8 * var(--u));
}
body.round-ui .stage-result-scroll details { margin: calc(1 * var(--u)) 0 0; border: 0; background: none; padding: 0; }
body.round-ui .stage-result-scroll summary {
  font-size: calc(3.6 * var(--u)); font-weight: 700; color: var(--ink-soft); cursor: pointer;
  padding: calc(1.2 * var(--u)) 0; border-bottom: calc(.3 * var(--u)) solid rgba(200, 150, 70, .35);
}
body.round-ui .stage-result-scroll details p,
body.round-ui .stage-result-scroll details h3,
body.round-ui .stage-result-scroll .audit-item { font-size: calc(3.6 * var(--u)); line-height: 1.45; color: var(--ink); }
body.round-ui .stage-result-scroll details h3 { font-size: calc(3.8 * var(--u)); margin: calc(2 * var(--u)) 0 calc(.8 * var(--u)); }
/* the text pops in gently; a wrong answer gives the cake text a small shake */
body.round-ui .stage-success .stage-result-copy { animation: result-pop .55s cubic-bezier(.2, 1.4, .4, 1) both; }
body.round-ui .stage-failure .stage-result-copy { animation: result-shake .5s ease both; }
@keyframes result-pop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@keyframes result-shake {
  0% { opacity: 0; transform: translateX(0); } 20% { opacity: 1; transform: translateX(calc(-1.5 * var(--u))); }
  40% { transform: translateX(calc(1.2 * var(--u))); } 60% { transform: translateX(calc(-.8 * var(--u))); }
  80% { transform: translateX(calc(.4 * var(--u))); } 100% { opacity: 1; transform: none; }
}
/* hide the old full-screen effects on these screens */
body.round-ui > .fireworks, body.round-ui #app > .fireworks { display: none; }

/* ---------- fireworks around the candle ---------- */
body.round-ui .cake-fireworks { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
body.round-ui .cake-fireworks .burst { position: absolute; left: var(--x); top: var(--y); width: 0; height: 0; }
body.round-ui .cake-fireworks .burst::before {
  content: ''; position: absolute; left: calc(-6 * var(--u)); top: calc(-6 * var(--u));
  width: calc(12 * var(--u)); height: calc(12 * var(--u)); border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 245, 200, .95), rgba(255, 200, 90, 0) 70%);
  opacity: 0; animation: burst-flash 2.2s ease-out var(--d) infinite;
}
body.round-ui .cake-fireworks i {
  position: absolute; left: calc(-1 * var(--u)); top: calc(-1 * var(--u));
  width: calc(2 * var(--u)); height: calc(2 * var(--u)); border-radius: 50%;
  background: var(--c); box-shadow: 0 0 calc(1.6 * var(--u)) var(--c), 0 0 calc(.6 * var(--u)) #fff;
  opacity: 0; animation: spark 2.2s cubic-bezier(.12, .75, .3, 1) var(--d) infinite;
}
@keyframes burst-flash { 0% { opacity: 0; transform: scale(.3); } 6% { opacity: 1; } 30% { opacity: 0; transform: scale(1.4); } 100% { opacity: 0; } }
@keyframes spark {
  0% { opacity: 0; transform: translate(0, 0) scale(.5); }
  5% { opacity: 1; }
  55% { opacity: 1; transform: translate(var(--dx), var(--dy)) scale(1); }
  80% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 3 * var(--u))) scale(.4); }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 3 * var(--u))) scale(.4); }
}
@media (prefers-reduced-motion: reduce) {
  body.round-ui .cake-fireworks { display: none; }
  body.round-ui .stage-success .stage-result-copy, body.round-ui .stage-failure .stage-result-copy { animation: none; }
}

/* ---------- team scoreboard bar (artwork): circles hold "score/80", names in the two halves ---------- */
body.round-ui .game-scoreboard {
  display: block; height: calc(16.84 * var(--u));
  background: url(assets/round/scorebar.png) center / 100% 100% no-repeat;
}
body.round-ui .game-scoreboard .game-score,
body.round-ui .game-scoreboard .game-score.second {
  position: static; display: contents;
  background: none !important; border: 0 !important; box-shadow: none !important; transform: none !important;
}
/* names: team A (first) on the right half, team B on the left half, either side of the gold divider */
body.round-ui .game-scoreboard .game-team-name {
  position: absolute; top: 18%; height: 64%; width: 34.5%;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: calc(4.5 * var(--u)); font-weight: 800; line-height: 1.12; color: var(--ink);
  -webkit-line-clamp: unset; overflow: hidden; opacity: .62; transition: opacity .3s;
}
body.round-ui .game-scoreboard .game-team-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; padding-top: calc(1.2 * var(--u)); }
body.round-ui .game-scoreboard .game-score:not(.second) .game-team-name { right: 14.3%; }
body.round-ui .game-scoreboard .game-score.second .game-team-name { left: 14.3%; }
body.round-ui .game-scoreboard .game-score.active .game-team-name { opacity: 1; }
/* score discs sit exactly over the artwork's circles (measured: 11.91% wide, 16.9% from the top) */
body.round-ui .game-scoreboard .game-team-score {
  position: absolute; top: 16.9%; width: calc(11.55 * var(--u)); height: calc(11.55 * var(--u));
  display: flex; align-items: center; justify-content: center; gap: 0;
  border-radius: 50%; direction: ltr; white-space: nowrap;
  background: radial-gradient(circle at 42% 32%, #fffbf3 0%, #f8ecd6 55%, #edd8b2 100%);
  box-shadow: inset 0 calc(.3 * var(--u)) calc(.8 * var(--u)) rgba(150, 100, 30, .3);
  color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.04em;
  transition: box-shadow .3s;
}
body.round-ui .game-scoreboard .game-score:not(.second) .game-team-score { left: 86.53%; }
body.round-ui .game-scoreboard .game-score.second .game-team-score { left: 1.47%; }
/* sized so that "80/80" (and "81/80" at the win) fits inside the circle */
body.round-ui .game-scoreboard .game-team-score b { font-size: calc(3.5 * var(--u)); font-weight: 900; line-height: 1; color: var(--ink); }
body.round-ui .game-scoreboard .score-of { font-size: calc(3.5 * var(--u)); font-weight: 900; line-height: 1; }
body.round-ui .game-scoreboard .game-score.active .game-team-score {
  box-shadow: inset 0 calc(.3 * var(--u)) calc(.8 * var(--u)) rgba(150, 100, 30, .3),
              0 0 0 calc(.45 * var(--u)) #ffd56a, 0 0 calc(2.6 * var(--u)) rgba(255, 190, 60, .95);
}
body.round-ui .game-scoreboard .game-score::before,
body.round-ui .game-scoreboard .game-score::after,
body.round-ui .game-scoreboard .game-team-name::before,
body.round-ui .game-scoreboard .game-team-name::after { display: none !important; content: none !important; }

/* ---------- level candle: lights up / burns / goes out (layers share one canvas, 260×1089; wick at 33.7%) ---------- */
body.round-ui .level-candle {
  position: absolute; left: 19%; bottom: 18.4%;
  /* explicit size (27% of the 174.6u cake box; canvas 260×1089) — no aspect-ratio, so Safari never collapses it */
  height: calc(47.14 * var(--u)); width: calc(11.25 * var(--u));
  transform: translateX(-50%); z-index: 2; pointer-events: none;
}
body.round-ui .level-candle img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; max-width: none; user-select: none; }
body.round-ui .level-candle .lc-wick,
body.round-ui .level-candle .lc-smoke { opacity: 0; }
body.round-ui .level-candle .lc-flame {
  transform-origin: 50% 33%;
  filter: drop-shadow(0 0 calc(2.2 * var(--u)) rgba(255, 180, 60, .75));
  animation: flame-flicker 2.4s ease-in-out infinite;
}
@keyframes flame-flicker {
  0%, 100% { transform: scale(1, 1) rotate(0deg); }
  25% { transform: scale(.97, 1.03) rotate(-1.5deg); }
  50% { transform: scale(1.02, .97) rotate(1deg); }
  75% { transform: scale(.98, 1.02) rotate(-.6deg); }
}
/* round starts: white wick, then the flame catches */
body.round-ui .level-candle.state-ignite .lc-wick { animation: wick-burn 1s ease .5s both; opacity: 1; }
body.round-ui .level-candle.state-ignite .lc-flame { animation: flame-ignite 1.1s cubic-bezier(.2, 1.5, .4, 1) .45s both, flame-flicker 2.4s ease-in-out 1.6s infinite; }
@keyframes wick-burn { from { opacity: 1; } to { opacity: 0; } }
@keyframes flame-ignite {
  0% { opacity: 0; transform: scale(.05, .05); filter: drop-shadow(0 0 0 rgba(255, 180, 60, 0)); }
  35% { opacity: 1; transform: scale(.55, .8); filter: drop-shadow(0 0 calc(4 * var(--u)) rgba(255, 210, 90, 1)); }
  100% { opacity: 1; transform: scale(1, 1); filter: drop-shadow(0 0 calc(2.2 * var(--u)) rgba(255, 180, 60, .75)); }
}
/* the team lost: the flame shrinks away, the wick chars and smoke drifts up */
body.round-ui .level-candle.state-out .lc-flame { animation: flame-out .6s ease-in .35s both; }
body.round-ui .level-candle.state-out .lc-smoke { animation: smoke-rise 3.4s ease-out .75s both; }
@keyframes flame-out {
  0% { opacity: 1; transform: scale(1, 1); }
  40% { opacity: 1; transform: scale(.75, 1.15) rotate(-6deg); }
  100% { opacity: 0; transform: scale(.05, .2); }
}
@keyframes smoke-rise {
  0% { opacity: 0; transform: translateY(2%); }
  20% { opacity: 1; }
  70% { opacity: .85; }
  100% { opacity: .55; transform: translateY(-2.5%); }
}
@media (prefers-reduced-motion: reduce) {
  body.round-ui .level-candle img { animation: none !important; }
  body.round-ui .level-candle.state-out .lc-flame { opacity: 0; }
  body.round-ui .level-candle.state-out .lc-smoke { opacity: .8; }
}

/* loader phrase fades in each time it changes */
#loader-phrase { display: inline-block; }
#loader-phrase.phrase-in { animation: phrase-in .5s ease both; }
@keyframes phrase-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* "תשובות לבחירה" close under the question */
body.round-ui .stage-answer-scroll .stage-question { margin-bottom: calc(1 * var(--u)); }
body.round-ui .stage-answer-scroll .voice-panel:empty { display: none; }
/* the button is part of the text: it scrolls together with the question (no sticking) */
body.round-ui .stage-answer-scroll .show-choices { position: static; margin: calc(1.5 * var(--u)) auto 0; }

/* ---------- team-name screen: fits one phone screen, game styling for dice and button ---------- */
body.curtain-ui:has(.team-setup) { height: 100dvh; overflow: hidden; }
body.curtain-ui:has(.team-setup) > footer { display: none; }
body.curtain-ui .team-setup {
  box-sizing: border-box; width: min(92vw, 460px); margin: 1.5dvh auto 0;
  max-height: calc(100dvh - 118px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  padding: clamp(10px, 2.2dvh, 22px) clamp(14px, 4vw, 24px);
  display: flex; flex-direction: column; justify-content: center; gap: clamp(4px, 1.1dvh, 12px);
}
body.curtain-ui .team-setup .eyebrow { margin: 0; font-size: clamp(12px, 1.7dvh, 15px); }
body.curtain-ui .team-setup .title { margin: 0; font-size: clamp(24px, 4.2dvh, 36px); line-height: 1.1; }
body.curtain-ui .team-setup .small-copy { margin: 0; font-size: clamp(14px, 2dvh, 17px); }
body.curtain-ui .team-name-field { margin: clamp(2px, 0.8dvh, 10px) 0 0; font-size: clamp(17px, 2.5dvh, 21px); color: #5a3214; }
body.curtain-ui .team-name-row { margin-top: clamp(4px, 0.8dvh, 8px); gap: 10px; }
body.curtain-ui .team-name-row input {
  min-height: 0; height: clamp(46px, 6.6dvh, 58px); padding: 0 14px; font-size: clamp(18px, 2.7dvh, 22px);
  border: 2px solid #d8a63c; border-radius: 999px; background: linear-gradient(#fffdf7, #fbf0da); color: #3a1d0c;
  box-shadow: inset 0 2px 4px rgba(120, 80, 20, .12);
}
body.curtain-ui .team-name-row input:focus { outline: none; border-color: #c8952e; box-shadow: 0 0 0 3px rgba(232, 182, 64, .35); }
body.curtain-ui .name-dice {
  flex: 0 0 clamp(46px, 6.6dvh, 58px); height: clamp(46px, 6.6dvh, 58px); padding: 0; font-size: 0;
  display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(#fffdf6, #f7e7c7); border: 2.5px solid #d8a63c;
  box-shadow: inset 0 2px 0 #fff, 0 3px 8px rgba(110, 70, 20, .3);
}
body.curtain-ui .name-dice svg { width: 64%; height: 64%; transition: transform .35s ease; }
body.curtain-ui .name-dice:active { transform: scale(.94); box-shadow: inset 0 2px 0 #fff, 0 1px 4px rgba(110, 70, 20, .3); }
body.curtain-ui .name-dice:active svg { transform: rotate(90deg); }
body.curtain-ui .team-name-error { margin: 0; min-height: 0; font-size: 14px; }
body.curtain-ui .team-setup > .primary {
  margin: clamp(4px, 1dvh, 12px) 0 0; min-height: 0; height: clamp(50px, 7dvh, 62px); padding: 0 20px;
  border-radius: 999px; border: 3px solid #d8a63c !important;
  background: linear-gradient(#fffdf6 0%, #f7e7c7 100%) !important; border-image: none !important;
  color: #3a1d0c !important; font-size: clamp(19px, 2.9dvh, 24px); font-weight: 800; text-shadow: none;
  box-shadow: inset 0 3px 0 #fff, inset 0 -4px 8px rgba(190, 140, 60, .35), 0 4px 12px rgba(110, 70, 20, .3);
}
body.curtain-ui .team-setup > .primary:active { transform: scale(.98); }
body.curtain-ui .team-setup > .text-link { margin: 0 auto; color: #8a5a10; font-size: 15px; }
html:has(body.curtain-ui .team-setup) { overflow: hidden; height: 100dvh; }

/* ---------- team-name screen: the team label is already in the box ---------- */
body.curtain-ui .team-name-field { font-size: 0; margin-top: clamp(4px, 1dvh, 12px); }
body.curtain-ui .team-name-field .team-name-row { margin-top: 0; }

/* ---------- "כל הרמות ברצף": the cake screen without the rules ---------- */
body.round-ui .sequence-view { position: static; margin: 0; padding: 0; max-width: none; background: none; }
body.round-ui .seq-head {
  position: fixed; z-index: 5; top: calc(var(--st) + 2.6 * var(--u)); left: calc(var(--x0) + 4 * var(--u)); width: calc(92 * var(--u));
  box-sizing: border-box; padding: calc(2 * var(--u)) calc(4 * var(--u)); border-radius: calc(6 * var(--u));
  background: linear-gradient(#fffaf0, #f4e3c3); border: calc(.55 * var(--u)) solid var(--gold);
  box-shadow: inset 0 calc(.5 * var(--u)) 0 #fff, 0 calc(.8 * var(--u)) calc(2 * var(--u)) rgba(120, 80, 20, .25);
  display: grid; gap: calc(.4 * var(--u)); text-align: center; color: var(--ink);
}
body.round-ui .seq-head b { font-size: calc(5 * var(--u)); line-height: 1.1; }
body.round-ui .seq-head span { font-size: calc(3.6 * var(--u)); font-weight: 700; color: var(--ink-soft); }
body.round-ui .seq-head small { font-size: calc(3.2 * var(--u)); color: var(--ink-soft); opacity: .85; }
body.round-ui .sequence-view .round-controls > .primary { width: 100%; }
body.round-ui .seq-tools {
  position: fixed; z-index: 5; left: calc(var(--x0) + 4 * var(--u)); width: calc(92 * var(--u));
  bottom: calc(var(--sb) + 3 * var(--u)); display: flex; gap: calc(2.5 * var(--u));
}
body.round-ui .seq-tools > button {
  flex: 1; min-height: 0; height: calc(10.5 * var(--u)); padding: 0 calc(2 * var(--u)); margin: 0;
  border-radius: 999px; background: linear-gradient(#fffdf6, #f7e7c7) !important; border: calc(.5 * var(--u)) solid var(--gold) !important;
  color: var(--ink) !important; font-size: calc(4 * var(--u)); font-weight: 800; box-shadow: inset 0 calc(.4 * var(--u)) 0 #fff, 0 calc(.6 * var(--u)) calc(1.4 * var(--u)) rgba(110, 70, 20, .25) !important;
}
body.round-ui .sequence-view .paper-stage-action { bottom: calc(var(--sb) + 16.2 * var(--u)); }
body.round-ui .choices .choice.sequence-correct { border-color: #4f8a3c !important; background: linear-gradient(#f4fbe9, #dcefc6) !important; }
body.round-ui .choices .choice.sequence-incorrect { border-color: #b8432c !important; background: linear-gradient(#fff1ec, #f6d3c8) !important; }
body.round-ui .choices .choice:disabled { opacity: 1; }
body.round-ui .sequence-reveal { display: block; margin: calc(2 * var(--u)) auto 0; color: #8a5a10; font-size: calc(3.8 * var(--u)); }
body.round-ui .sequence-answer { margin: calc(2 * var(--u)) 0 0; text-align: right; font-size: calc(4.4 * var(--u)); color: var(--ink); }
body.round-ui .sequence-view #central-card { right: auto; inset-inline-end: auto; left: 24.5%; }
body.round-ui .seq-tools > button { white-space: nowrap; font-size: calc(3.8 * var(--u)); }

/* formula map: clear, high-contrast buttons with the level colour */
.lv-1{--lc:#3f9d6f}.lv-2{--lc:#d9a21b}.lv-3{--lc:#e07a1f}.lv-4{--lc:#c93c3c}.lv-5{--lc:#7d4cc4}
.map-group .formula-button{background:#fffdf6;color:#321a27;border:2px solid var(--lc,#c99a3c);border-inline-start-width:9px;border-radius:16px;box-shadow:0 3px 0 #0000001f;font-weight:800;line-height:1.25;padding:12px 10px}
.map-group .formula-button:hover,.map-group .formula-button:focus-visible{background:#fff1cf}
.map-group .formula-button:active{transform:translateY(2px);box-shadow:0 1px 0 #0000001f}
.map-group .formula-button .formula-weight{color:#5b4350;opacity:1;font-size:12px;font-weight:700}
.map-group .politics-source{background:#fffdf6;color:#321a27;border:2px solid var(--lc,#c99a3c);border-inline-start-width:9px;border-radius:16px;padding:12px 14px;box-shadow:0 3px 0 #0000001f;margin:10px 0}
.map-group .politics-source summary{color:#321a27;font-size:19px;font-weight:800;line-height:1.3}
.map-group .politics-source[open]{background:#fff8e6}
.map-group .politics-source p,.map-group .politics-source .note{color:#3d2a35}
.map-group .politics-source .formula-weight{color:#5b4350;opacity:1;font-size:12px;font-weight:700}
.map-group h3{color:#321a27}
.formula-weight span{white-space:nowrap}

/* ---------- opening screen: one phone screen, no scoreboard, buttons in the curtain's gold ---------- */
html:has(.home-screen), body.curtain-ui:has(.home-screen) { height: 100dvh; overflow: hidden; }
body.curtain-ui:has(.home-screen) > footer { display: none; }
.home-screen {
  box-sizing: border-box; width: min(92vw, 460px); margin: 0 auto;
  height: calc(100dvh - 96px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; justify-content: center; gap: clamp(18px, 4dvh, 40px);
}
.home-screen .hero { margin: 0; padding: clamp(16px, 3.4dvh, 30px) 18px; }
.home-screen .hero h1 { font-size: min(clamp(34px, 6.3dvh, 60px), 11.5vw); line-height: 1.05; margin: clamp(4px, 1dvh, 10px) 0; }
.home-screen .hero .eyebrow { font-size: clamp(13px, 1.9dvh, 16px); }
.home-screen .hero .tag { font-size: clamp(16px, 2.4dvh, 20px); margin: 0; }
.home-screen .home-actions { margin: 0; width: 100%; display: flex; flex-direction: column; gap: clamp(10px, 1.8dvh, 16px); }
body.curtain-ui .home-screen .home-start {
  display: block; width: 100%; margin: 0; min-height: 0; height: clamp(54px, 7.6dvh, 66px); padding: 0 20px;
  border-radius: 999px; border: 2px solid #ffe2a0; border-image: none;
  background: linear-gradient(#f9dd8f 0%, #e3ac45 55%, #c98a2c 100%);
  color: #3b1408; font-size: clamp(21px, 3.1dvh, 26px); font-weight: 900; text-shadow: 0 1px 0 rgba(255, 240, 200, .6);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .55), 0 6px 18px rgba(0, 0, 0, .35), 0 0 22px rgba(255, 190, 90, .25);
}
body.curtain-ui .home-screen .button-row { margin: 0; gap: 10px; display: flex; }
body.curtain-ui .home-screen .home-option {
  flex: 1; min-width: 0; min-height: 0; height: clamp(50px, 7dvh, 60px); margin: 0; padding: 0 6px;
  border-radius: 999px; border: 1.5px solid rgba(246, 220, 160, .8); border-image: none;
  background: rgba(55, 8, 22, .58); color: #f9e3b0; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  font-size: clamp(14px, 2.1dvh, 17px); font-weight: 800; line-height: 1.15; box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
}
body.curtain-ui .home-screen .home-start:active, body.curtain-ui .home-screen .home-option:active { transform: scale(.97); }
body.curtain-ui .home-screen .home-option:hover { background: rgba(85, 16, 34, .7); }
body.curtain-ui .home-screen .reset-button { margin: 0 auto; padding: 4px 10px; min-height: 0; font-size: 15px; background: none; border: 0; }

/* a new candle, ready to be lit: white wick, no flame (lights only on a right answer) */
body.round-ui .level-candle.state-new .lc-wick { opacity: 1; }
body.round-ui .level-candle.state-new .lc-flame { opacity: 0; animation: none; }
/* team-name screen: the box sits in the middle of the stage */
body.curtain-ui:has(.team-setup) > main {
  display: flex; align-items: center; justify-content: center;
  height: calc(100dvh - 96px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); margin-top: 0; margin-bottom: 0;
}
body.curtain-ui:has(.team-setup) .team-setup { margin: 0 auto; }
/* topics map: one button per cluster, each opens a page with its formulas */
.cluster-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 14px 0 22px; }
.cluster-button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 108px; padding: 14px 10px; border-radius: 20px; cursor: pointer;
  background: #fffdf6; color: #321a27; border: 2px solid #d6a336; box-shadow: 0 4px 0 #b88a3a55, 0 6px 14px rgba(60, 20, 10, .12);
  font: inherit; text-align: center;
}
.cluster-button b { font-size: 20px; line-height: 1.2; }
.cluster-button small { font-size: 14px; color: #6b5160; font-weight: 700; }
.cluster-button:hover, .cluster-button:focus-visible { background: #fff1cf; }
.cluster-button:active { transform: translateY(2px); box-shadow: 0 2px 0 #b88a3a55; }
.cluster-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.cluster-chip { font-size: 12px; font-weight: 800; padding: 1px 7px; border-radius: 99px; border: 1.5px solid var(--lc); background: #fff; color: #321a27; }
.map-cluster-page { margin-top: 10px; }
.map-back-bottom { margin-top: 18px; }
/* question, choices, answer and right/wrong screens: centred text */
body.round-ui .stage-question,
body.round-ui .question-number,
body.round-ui .question-box,
body.round-ui .voice-panel,
body.round-ui .voice-instruction,
body.round-ui .host-answer,
body.round-ui .choices .choice,
body.round-ui .stage-result-scroll,
body.round-ui .stage-result-copy,
body.round-ui .stage-result-copy h1,
body.round-ui .stage-result-copy p,
body.round-ui .sequence-answer { text-align: center; }
body.round-ui .host-answer { justify-items: center; }
body.round-ui .choices .choice { justify-content: center; }
body.round-ui .stage-result-scroll summary, body.round-ui .stage-result-scroll details { text-align: center; }
body.round-ui .paper-stage .stage-answer-scroll .stage-question .question-box,
body.round-ui .paper-stage .stage-answer-scroll .choices .choice,
body.round-ui .paper-stage .stage-answer-scroll .voice-panel { text-align: center; }

/* ---------- text on the cake: out, then in (not a cross-fade), a little slower ---------- */
body.round-ui #central-card.card-leave > :not(.scroll-rail) { animation: card-out .6s ease both; }
body.round-ui #central-card.card-arrive > :not(.scroll-rail) { animation: card-in .75s ease both; }
@keyframes card-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes card-in { from { opacity: 0; } to { opacity: 1; } }
/* each sentence comes in from the right side of the cake to the middle */
body.round-ui .stage-scroll .sentence.sentence-fade { animation: sentence-slide-in .9s cubic-bezier(.2, .75, .25, 1) both; }
@keyframes sentence-slide-in { from { opacity: 0; transform: translateX(45%); } 60% { opacity: 1; } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  body.round-ui #central-card.card-leave > *, body.round-ui #central-card.card-arrive > *, body.round-ui .stage-scroll .sentence.sentence-fade { animation: none; }
}

/* ---------- level candle: stands on the middle of the cake top, in front of the team bar ---------- */
body.round-ui .level-candle {
  /* --cb: where the candle stands (top of the cake); --cf: middle of the team bar, where the flame sits */
  --cb: calc((var(--st) + 100dvh - var(--sb)) / 2 - 38.1 * var(--u));
  --cf: calc(var(--st) + 11.02 * var(--u));
  --ch: calc((var(--cb) - var(--cf)) / 0.789);
  position: fixed; z-index: 6; left: 50vw; bottom: auto;
  top: calc(var(--cb) - var(--ch)); height: var(--ch); width: calc(var(--ch) * 0.23875);
  transform: translateX(-50%); pointer-events: none;
}

/* ---------- right answer → next turn: the lit candle flies to the score, a new one rises ---------- */
body.round-ui .game-scoreboard .game-team-score { overflow: visible; }
body.round-ui .game-scoreboard .game-team-score.score-bump { animation: score-bump .6s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes score-bump {
  0% { transform: scale(1); filter: none; }
  40% { transform: scale(1.35); filter: drop-shadow(0 0 calc(2.5 * var(--u)) rgba(255, 190, 70, .95)); }
  100% { transform: scale(1); filter: none; }
}
body.round-ui .score-plus {
  position: absolute; left: 50%; top: 100%; z-index: 7; pointer-events: none;
  font-size: calc(5 * var(--u)); font-weight: 900; color: #c47a12; text-shadow: 0 1px 0 #fff, 0 0 calc(1.5 * var(--u)) rgba(255, 200, 90, .9);
  animation: score-plus .8s ease-out both;
}
@keyframes score-plus { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 25% { opacity: 1; transform: translate(-50%, 10%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, 70%) scale(1); } }
/* the new candle comes up out of the cake top (hidden below its base line while rising) */
body.round-ui .level-candle.candle-rise { animation: candle-rise-up .9s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes candle-rise-up {
  from { transform: translateX(-50%) translateY(62%); clip-path: inset(0 0 62% 0); }
  to { transform: translateX(-50%) translateY(0); clip-path: inset(0 0 0 0); }
}
@media (prefers-reduced-motion: reduce) { body.round-ui .level-candle.candle-rise, body.round-ui .score-bump, body.round-ui .score-plus { animation: none; } }
/* every card on the cake starts at the top of the text area: sentence, question, answer and right/wrong screens */
body.round-ui .stage-scroll > :first-child,
body.round-ui .stage-answer-scroll > :first-child,
body.round-ui .stage-result-scroll > :first-child { margin-top: 0; }
body.round-ui .stage-scroll > :last-child,
body.round-ui .stage-answer-scroll > :last-child,
body.round-ui .stage-result-scroll > :last-child { margin-bottom: 0; }
body.round-ui .stage-scroll, body.round-ui .stage-answer-scroll, body.round-ui .stage-result-scroll { justify-content: flex-start; }
body.round-ui .stage-answer-scroll .stage-question { height: auto; flex: none; justify-content: flex-start; overflow: visible; }
body.round-ui .stage-answer-scroll .voice-panel { margin-top: calc(2 * var(--u)); }

/* between the two sentences: a short fade out and a quicker slide in */
body.round-ui #central-card.card-leave-fast > :not(.scroll-rail) { animation: card-out .25s ease both; }
body.round-ui .stage-scroll .sentence.sentence-fade { animation-duration: .55s; }
@media (prefers-reduced-motion: reduce) { body.round-ui #central-card.card-leave-fast > * { animation: none; } }

/* team names: the dice sits on the right side of the box; the default names are faded (75% transparent) */
body.curtain-ui .team-name-row .name-dice { order: -1; }
body.curtain-ui .team-name-row input::placeholder { color: #3a1d0c; opacity: .25; }

/* ---------- team bar, 5 Nov 2026: one gold-framed cream pill, at the very top.
   Right to left: "score/80" · team A | team B · "score/80" (each score on its own outer edge) ---------- */
body.round-ui .game-scoreboard {
  top: calc(var(--st) + 0.8 * var(--u));
  height: calc(15 * var(--u)); display: flex; align-items: center; direction: rtl; gap: 0;
  padding: 0 calc(2.6 * var(--u));
  border: calc(1.6 * var(--u)) solid transparent; border-radius: calc(5.5 * var(--u));
  background:
    linear-gradient(180deg, #fff7ea 0%, #fbe9d0 55%, #f6dfbf 100%) padding-box,
    linear-gradient(180deg, #fff1b8 0%, #f6c548 22%, #d99a1e 52%, #f3c64f 78%, #b97a12 100%) border-box;
  box-shadow:
    inset 0 0 0 calc(0.35 * var(--u)) #fff6dc,
    inset 0 0 0 calc(0.75 * var(--u)) #e4a832,
    inset 0 calc(0.6 * var(--u)) calc(1.4 * var(--u)) rgba(160, 105, 25, .22),
    0 0 calc(2.4 * var(--u)) rgba(255, 196, 70, .75),
    0 calc(0.6 * var(--u)) calc(1.6 * var(--u)) rgba(110, 70, 10, .3);
}
body.round-ui .game-scoreboard::after { content: none; display: none; }  /* no divider in the middle (5 Nov 2026) */
body.round-ui .game-scoreboard .game-score,
body.round-ui .game-scoreboard .game-score.second {
  display: flex !important; position: relative; flex: 1 1 0; min-width: 0; height: 100%;
  align-items: center; gap: calc(1.2 * var(--u)); padding: 0 !important;
}
body.round-ui .game-scoreboard .game-score:not(.second) { padding-left: calc(2.2 * var(--u)) !important; }
body.round-ui .game-scoreboard .game-score.second { padding-right: calc(2.2 * var(--u)) !important; }
body.round-ui .game-scoreboard .game-score:not(.second) .game-team-score { order: -1; }
body.round-ui .game-scoreboard .game-team-name,
body.round-ui .game-scoreboard .game-score:not(.second) .game-team-name,
body.round-ui .game-scoreboard .game-score.second .game-team-name {
  position: static; inset: auto; width: auto; height: auto; flex: 1 1 auto; min-width: 0; padding: 0;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  text-align: center; font-size: calc(4.1 * var(--u)); font-weight: 800; line-height: 1.08;
  color: var(--ink); opacity: .55;
}
body.round-ui .game-scoreboard .game-score.active .game-team-name { opacity: 1; }
body.round-ui .game-scoreboard .game-team-score,
body.round-ui .game-scoreboard .game-score:not(.second) .game-team-score,
body.round-ui .game-scoreboard .game-score.second .game-team-score {
  position: static; left: auto; top: auto; width: auto; height: auto; flex: none;
  background: none; box-shadow: none; border-radius: calc(2 * var(--u)); padding: 0;
  direction: ltr; white-space: nowrap; color: var(--ink); opacity: .55; transition: opacity .3s, text-shadow .3s;
}
body.round-ui .game-scoreboard .game-team-score b,
body.round-ui .game-scoreboard .score-of { font-size: calc(4.8 * var(--u)); font-weight: 900; letter-spacing: -0.02em; }
body.round-ui .game-scoreboard .game-score.active .game-team-score {
  opacity: 1; box-shadow: none; text-shadow: 0 0 calc(1.6 * var(--u)) rgba(255, 190, 60, .9);
}

/* 6 Nov 2026: temporary formula label + new-formula marks */
.formula-tag{display:block;font-size:11px;line-height:1.3;opacity:.7;margin:0 0 4px;font-weight:600;letter-spacing:.01em}
.new-badge{display:inline-block;background:#d62828;color:#fff;font-size:11px;font-weight:700;border-radius:999px;padding:1px 8px;line-height:1.5;vertical-align:middle}
.cluster-button.has-new{border-color:#d62828!important;box-shadow:0 0 0 2px #d62828}
.formula-button.is-new{border-color:#d62828!important;color:#b00020!important;box-shadow:0 0 0 2px #d62828;font-weight:700}
details.is-new{border:2px solid #d62828!important;border-radius:12px}
details.is-new>summary{color:#b00020}

/* ---------- 7 Nov 2026: urgency while the answer clock runs ---------- */
body.round-ui #theater-stage.urg-1.has-timer .round-controls > .primary::before { background: linear-gradient(90deg, rgba(245, 150, 40, .45), rgba(245, 120, 30, .7)) !important; }
body.round-ui #theater-stage.urg-1 .choice-time-bar::before { background: linear-gradient(90deg, #f5a03a, #e0701c) !important; }
body.round-ui #theater-stage.urg-2.has-timer .round-controls > .primary::before { background: linear-gradient(90deg, rgba(235, 70, 40, .55), rgba(210, 35, 30, .8)) !important; }
body.round-ui #theater-stage.urg-2 .choice-time-bar::before { background: linear-gradient(90deg, #f05a3a, #c81e1e) !important; }
body.round-ui #theater-stage.urg-3.has-timer .round-controls > .primary::before { background: linear-gradient(90deg, rgba(220, 20, 30, .75), rgba(160, 0, 20, .95)) !important; }
body.round-ui #theater-stage.urg-3 .choice-time-bar::before { background: linear-gradient(90deg, #e3122a, #8f0010) !important; }
body.round-ui #theater-stage.urg-2 .round-controls > .primary { border-color: #d8401f !important; animation: urg-pulse 1s ease-in-out infinite; }
body.round-ui #theater-stage.urg-3 .round-controls > .primary { border-color: #c4001a !important; animation: urg-pulse .5s ease-in-out infinite; }
body.round-ui #theater-stage.urg-2 .choice-time-bar,
body.round-ui #theater-stage.urg-3 .choice-time-bar { animation: urg-bar .5s ease-in-out infinite; }
@keyframes urg-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 40, 30, 0); transform: scale(1); } 50% { box-shadow: 0 0 calc(3.5 * var(--u)) calc(.6 * var(--u)) rgba(230, 40, 30, .75); transform: scale(1.03); } }
@keyframes urg-bar { 0%, 100% { filter: none; } 50% { filter: brightness(1.35) drop-shadow(0 0 calc(1.4 * var(--u)) rgba(230, 30, 30, .9)); } }
/* the edges of the screen glow red in the last 10 seconds, faster in the last 5 */
body.round-ui:has(#theater-stage.urg-2)::after,
body.round-ui:has(#theater-stage.urg-3)::after {
  content: ""; position: fixed; inset: 0; z-index: 4; pointer-events: none;
  box-shadow: inset 0 0 12vmin 2vmin rgba(200, 20, 20, .55);
  animation: urg-vignette 1s ease-in-out infinite;
}
body.round-ui:has(#theater-stage.urg-3)::after { animation-duration: .5s; box-shadow: inset 0 0 16vmin 3vmin rgba(200, 10, 10, .7); }
@keyframes urg-vignette { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* ---------- 7 Nov 2026: celebration on every right answer ---------- */
.celebrate-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.celebrate-back { z-index: 0; }
.celebrate-front { z-index: 60; }
.cel-burst { position: absolute; left: var(--x); top: var(--y); width: 0; height: 0; transform: scale(var(--s, 1)); }
.cel-burst::before { content: ""; position: absolute; left: -40px; top: -40px; width: 80px; height: 80px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 245, 200, .95), rgba(255, 200, 90, 0)); opacity: 0; animation: cel-flash 1.1s ease-out var(--d) 2 both; }
.cel-burst i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--c);
  box-shadow: 0 0 8px 2px var(--c); opacity: 0; animation: cel-spark 1.3s cubic-bezier(.15, .7, .3, 1) var(--d) 2 both; }
@keyframes cel-flash { 0% { opacity: 0; transform: scale(.2); } 15% { opacity: 1; } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes cel-spark { 0% { opacity: 0; transform: translate(0, 0) scale(1); } 10% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 40px)) scale(.4); } }
.celebrate-front i { position: absolute; top: -30px; left: var(--x); width: var(--w); height: var(--h); background: var(--c);
  opacity: 0; animation: confetti-fall var(--t) cubic-bezier(.25, .4, .5, 1) var(--d) both; }
@keyframes confetti-fall {
  0% { opacity: 1; transform: translate(0, -5vh) rotate(0deg) rotateY(0deg); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--drift), 110vh) rotate(var(--r)) rotateY(720deg); }
}
@media (prefers-reduced-motion: reduce) {
  body.round-ui #theater-stage.urg-2 .round-controls > .primary, body.round-ui #theater-stage.urg-3 .round-controls > .primary,
  body.round-ui #theater-stage .choice-time-bar, body.round-ui:has(#theater-stage.urg-2)::after, body.round-ui:has(#theater-stage.urg-3)::after { animation: none; }
}
