/* =========================================================
   BASE / GLOBAL
   Notes:
   - Prefer one definition per selector to avoid “who wins?” bugs.
   - You had multiple duplicates of: .hidden, .hint, .screen.active,
     and many .ra-* blocks (with conflicting sizes/opacity/layout).
   ========================================================= */
@font-face {
  font-family: "Bebas Neue";
  src: url("/static/assets/bebasneue.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  /* Prevent pull-to-refresh (Android Chrome) and bounce-scroll (iOS Safari)
     from interrupting gameplay. Both browsers respect this. */
  overscroll-behavior: none;
  background: #0e1322;
  color: #fff;
}

body {
  /* Safe area insets (iPhone notch / home bar) */
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);

  /* Touch optimisation + typography */
  touch-action: manipulation;
  font-family: "Bebas Neue", sans-serif;
}

button, input, textarea, select {
  font-family: inherit;
}

input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

#app {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  /* Prevent accidental text selection anywhere in the game */
  user-select: none;
  -webkit-user-select: none;
}

.hidden { display: none !important; }

h1 { margin: 0 0 0.625rem; }

/* Default subtitle style (some screens override it intentionally) */
.subtitle {
  opacity: 0.85;
  margin: 0 0 0.875rem;
}

.row {
  display: flex;
  gap: 0.625rem;
  align-items: center;
}

input {
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
  border: 1px solid #333;
  background: #1b1b1b;
  color: #eee;
}

button {
  padding: 0.625rem 0.875rem;
  border-radius: 0.625rem;
  border: 0;
  cursor: pointer;
  font-size: clamp(1.0rem, 1.4vw, 1.2rem);
}

button.secondary {
  background: #2a2a2a;
  color: #eee;
}

button:not(.secondary):not(.hotspot):not(.splash-button-1):not(.splash-button-2) {
  background: #e5e5e5;
  color: #111;
}

.error { color: #ffb3b3; }

/* =========================================================
   ROOT TOKENS (CSS variables)
   REVIEW:
   - Your comment says “DO NOT ADD SELECTORS INSIDE :root”.
     That’s fine, but you also had a non-var (font-family) inside.
     Not invalid, but it breaks the “vars only” rule-of-thumb.
   ========================================================= */

:root {
  /* END ROOT VARS BELOW — DO NOT ADD SELECTORS INSIDE :root */

  /* Award presentation — fallback defaults only; JS sets these from CONFIG.AWARD at runtime */
  --award-bg-fade-sec: 0.8s;        /* fallback; set by JS from CONFIG.AWARD.BACKGROUND_FADE_DURATION_SEC */
  --award-awarder-dur-sec: 2.1s;    /* CONFIG.AWARD.AWARDER_SLIDE_DURATION_SEC */
  --award-awarder-maxw: 16.25rem;   /* CONFIG.AWARD.AWARDER_MAX_WIDTH_PX (260px) */
  --award-awarder-vw: 40vw;         /* CONFIG.AWARD.AWARDER_WIDTH_VW */
  --award-awarder-bottom-vh: 2vh;         /* fallback for Safari < 15.4 */
  --award-awarder-bottom-vh: 2dvh;        /* CONFIG.AWARD.AWARDER_BOTTOM_VH */
  --award-confetti-dur: 2.6s;       /* CONFIG.AWARD.CONFETTI_DURATION_SEC */

}

@media (max-width: 900px) {
  :root {
    /* shrink awarder on phones */
    --award-awarder-vw: 28vw;
    --award-awarder-maxw: 11.25rem;  /* ~180px */
  }
}

/* =========================================================
   TOP BAR / NAV
   ========================================================= */

.topbar {
  height: 3.375rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(10, 14, 26, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  /* Prevent children from overflowing and getting clipped on mobile */
  overflow: hidden;
  min-width: 0;
}

/* Game screens and office: topbar padding deferred to .game-hud */
#screen-game .topbar,
#screen-office .topbar {
  padding: 0;
}

.topbar .label { font-size: clamp(0.75rem, 1.2vw, 0.875rem); opacity: 0.75; padding-right: 0.625rem;}
.topbar .value { font-size: clamp(0.875rem, 1.5vw, 1.125rem); font-weight: 600; padding-right: 0.625rem; color: #f5a623; }
.topbar-actions { margin-left: auto; }

.topbar .title {
  font-size: clamp(1rem, 2vw, 1.375rem);
  font-weight: 800;
  letter-spacing: 0.3px;
}

.topbar .right {
  display: flex;
  gap: 0.625rem;
  align-items: center;
}

.btn {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  padding: 0.625rem 0.75rem;
  border-radius: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.btn:hover { background: rgba(255, 255, 255, 0.14); }
.btn:active { transform: translateY(1px); }

.btn.primary { background: rgba(80, 170, 255, 0.22); }
.btn.primary:hover { background: rgba(80, 170, 255, 0.28); }

/* Single consolidated .hint (you had multiple) */

.hint{
  flex: 0 0 auto;
  text-align: center;
}

/* =========================================================
   SCREENS / STAGE
   REVIEW:
   - You defined .screen.active multiple times.
     Keep ONE, and keep dvh behavior here.
   ========================================================= */

.screen {
  display: none;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.screen.active{
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;   /* fallback for browsers without dvh */
  height: 100dvh;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

/* =========================================================
   OFFICE SCREEN
   ========================================================= */

/* Office screen: topbar + hint fixed, office stage fills the rest */
#screen-office {
  min-height: 0;
  width: 100%;
}

#screen-office .stage { padding: 0; }

#officeStage{
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;

  display: grid;
  place-items: center;
}


#officeFit{
  position: relative;

  /* JS sets explicit pixel width/height */
  flex: 0 0 auto;

  /* safety */
  max-width: 100%;
  max-height: 100%;

  /* rounded corners — overflow:hidden clips the image */
  border-radius: 14px;
  overflow: hidden;
}

#officeFit > #officeImage{
  width: 100%;
  height: 100%;
  display: block;
}


/* Hotspots are now relative to the displayed image box */
 .hotspot, #whiteboard{
  position: absolute;
}


.office-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}


.hotspot {
  border-radius: 14px;
  pointer-events: auto;
  cursor: pointer;
  background: rgba(255, 255, 255, 0);
  outline: 2px solid rgba(255, 255, 255, 0);
}

/* Debug only */
body.debug-hotspots .hotspot { outline-color: rgba(255, 0, 255, 0.25); }

.hotspot:hover,
.hotspot:focus {
  outline-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

/* =========================================================
   SPRITE HOTSPOTS
   Transparent WebP <img> sprites positioned over the office
   background. The <img> IS the button - no invisible overlay
   needed. drop-shadow follows the cut-out alpha shape
   (unlike box-shadow which hugs the bounding rectangle).
   ========================================================= */

.hotspot-sprite {
  position: absolute;
  display: block;
  cursor: pointer;
  height: auto;          /* width set by setHotspot(); height follows natural ratio */
  pointer-events: auto;
  background: transparent;
  outline: none;
  border: none;
  padding: 0;
  transition: filter 0.2s ease;
  /* animation creates a stacking context; set z-index so labels (z-index:20) paint above */
  z-index: 10;
}

/* Hover/focus: boost the glow rather than replacing it with plain brightness */
#officeFit:not(.hotspot-beacon-off) .hotspot-sprite.game-hotspot:not(.hotspot-done):hover,
#officeFit:not(.hotspot-beacon-off) .hotspot-sprite.game-hotspot:not(.hotspot-done):focus-visible {
  animation: none;
  filter: brightness(1.15)
          drop-shadow(0 0 6px  rgba(0,230,255,1.00))
          drop-shadow(0 0 14px rgba(0,200,255,0.90))
          drop-shadow(0 0 24px rgba(0,180,255,0.60));
}

/* Tap/click confirmed feedback — scale-down + brightness burst on :active.
   Fires on touch (mobile) and mouse-down (desktop). Fast transition so it
   feels snappy rather than laggy. */
.hotspot-sprite:active {
  transform: scale(1.07) !important;
  transition: transform 0.08s ease !important;
  animation: none !important;
}

.hotspot:active {
  transform: scale(1.07) !important;
  transition: transform 0.08s ease !important;
}

/* Fallback hover for done sprites (no glow, just brightness) */
.hotspot-sprite.hotspot-done:hover,
.hotspot-sprite.hotspot-done:focus-visible {
  filter: brightness(1.12);
}

@keyframes sprite-glow-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 2px rgba(0,230,255,0.90))
            drop-shadow(0 0 5px rgba(0,200,255,0.60));
  }
  50% {
    filter: drop-shadow(0 0 3px rgba(80,240,255,1.00))
            drop-shadow(0 0 7px rgba(0,200,255,0.85));
  }
}

/* Glow ON: beacon active and this game not yet played */
#officeFit:not(.hotspot-beacon-off) .hotspot-sprite.game-hotspot:not(.hotspot-done) {
  animation: sprite-glow-pulse 2.0s ease-in-out infinite;
}

/* Stagger so sprites do not all pulse in unison */
#officeFit:not(.hotspot-beacon-off) #hsPapers.hotspot-sprite   { animation-delay: 0s;    }
#officeFit:not(.hotspot-beacon-off) #hsComputer.hotspot-sprite  { animation-delay: 0.65s; }
#officeFit:not(.hotspot-beacon-off) #hsBrazil.hotspot-sprite    { animation-delay: 1.3s;  }

/* Glow OFF: game completed - transition handles the fade-out */
#officeFit .hotspot-sprite.hotspot-done {
  filter: none;
  animation: none;
}

/* =========================================================
   LIGHTS SWITCH — hidden hotspot + office dimmer overlay
   ========================================================= */

/* Override .hotspot defaults: no cursor, no hover highlight */
.hs-lights,
.hs-lights:hover,
.hs-lights:focus {
  cursor: default !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

#officeDimmer {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 0.6s ease;
  z-index: 7; /* below hotspot buttons (z-index 8+) so clicks still register */
  border-radius: inherit;
}

#officeDimmer.lights-out {
  background: rgba(0, 0, 0, 0.92);
}

/* Dim sprites (which sit above the dimmer overlay) to match */
#officeFit .hotspot-sprite {
  transition: filter 0.6s ease;
}
#officeFit.lights-out .hotspot-sprite {
  filter: brightness(0.08) !important;  /* !important overrides the glow-pulse animation filter */
  animation: none !important;           /* stop beacon pulse so it can't fight the dim */
}

/* Dim play labels and glint overlay to match the lights-out state */
#officeFit .hs-play-label {
  transition: opacity 0.6s ease;
}
#officeFit.lights-out .hs-play-label {
  opacity: 0 !important;
  animation: none !important;
}
#officeFit.lights-out #eggGlint {
  opacity: 0 !important;
  animation: none !important;
}

/* =========================================================
   OFFICE CONFETTI (easter egg) — reuses .award-confetti .c pieces
   ========================================================= */

#officeConfetti {
  z-index: 20;     /* above dimmer + hotspot sprites */
  overflow: hidden; /* clip to officeFit bounds */
}

/* =========================================================
   POWER STRIP SPARK EFFECT
   ========================================================= */

#sparkHost {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30; /* above dimmer (7), hotspot sprites (10), confetti (20) */
  overflow: hidden;
  border-radius: inherit;
}

.spark {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  animation: spark-fly var(--dur, 0.4s) ease-out forwards;
}

@keyframes spark-fly {
  0%   { transform: translate(var(--sx), var(--sy)) scale(1.6); opacity: 1; }
  55%  { opacity: 1; }
  100% { transform: translate(var(--ex), var(--ey)) scale(0);   opacity: 0; }
}

/* =========================================================
   SPLASH / NAME ENTRY SCREEN
   ========================================================= */

#screen-name.screen.active {
  /* Center the card in the viewport */
  display: flex; /* overrides .screen.active display:flex anyway; ok to be explicit */
  align-items: center;
  justify-content: center;

  /* Background image */
  background: url("/static/assets/splash.webp") center / cover no-repeat;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
}

/* Fade ONLY the background (overlay behind the card) */
#screen-name.screen.active::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 0;
  pointer-events: none;
}

/* Foreground card (bright) */
#screen-name .splash-card {
  position: relative;
  z-index: 1;
  width: min(45rem, calc(100vw - 2rem));
  padding: 1.75rem 1.5rem;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  text-align: center;
  backdrop-filter: blur(6px);
}

#screen-name h1 {
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0 0 0.375rem;
  color: #ffffff;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.70);
}

#screen-name .subtitle {
  opacity: 1; /* IMPORTANT: do not fade the subtitle on splash */
  color: rgba(255, 255, 255, 0.92);
  font-size: 1rem;
  line-height: 1.35;
  margin: 0 0 1.125rem;
}

#screen-name .row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.625rem;
  flex-wrap: wrap;
}

#screen-name input {
  width: min(20rem, 70vw);
  height: 2.875rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: max(1rem, 16px);
  outline: none;
}

#screen-name input::placeholder { color: rgba(255, 255, 255, 0.65); }

#screen-name button:not(.secondary):not(.hotspot):not(.lang-btn) {
  height: 2.875rem;
  border-radius: 12px;
  padding: 0.625rem 1.125rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  background: rgba(245, 245, 245, 0.98);
  color: #111;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
}

#screen-name button:not(.secondary):not(.hotspot):not(.lang-btn):hover { filter: brightness(1.05); }
#screen-name .error { margin-top: 0.75rem; }

/* Start button loading/spinner state */
@keyframes btn-spin { to { transform: rotate(360deg); } }

.btn-spinner {
  display: none;
  width: 1em;
  height: 1em;
  margin-left: 0.5em;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-top-color: #111;
  border-radius: 50%;
  vertical-align: middle;
  animation: btn-spin 0.7s linear infinite;
}

#screen-name button.loading {
  cursor: wait;
  opacity: 0.85;
}

#screen-name button.loading .btn-spinner {
  display: inline-block;
}

/* =========================================================
   LEADERBOARD SCREEN
   ========================================================= */

#screen-leaderboard{
  min-height: 0;
  width: 100%;
}

#leaderboardStage{
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;

  display: grid;
  place-items: center;
}

/* This becomes the scaled whiteboard rectangle */
#leaderboardFit{
  position: relative;
  container-type: inline-size;

  /* JS sets explicit pixel width/height */
  flex: 0 0 auto;

  /* safety */
  max-width: 100%;
  max-height: 100%;

  /* rounded corners */
  border-radius: 14px;
  overflow: hidden;
}

/* Image fills the fit box */
#leaderboardFit > #leaderboardImage{
  width: 100%;
  height: 100%;
  display: block;
}

/* List is constrained to the fit box, starting below the leaderboard sign */
#leaderboardFullList{
  position: absolute;
  left: 14%;
  right: 14%;
  /* Tune --lb-top-offset to push the list below the blue sign in your image */
  top: var(--lb-top-offset, 18%);
  bottom: 14%;

  margin: 0;
  padding: 0;
  list-style: none;

  overflow: auto;
  -webkit-overflow-scrolling: touch;
}



/* =========================================================
   OFFICE WHITEBOARD LEADERBOARD OVERLAY
   REVIEW:
   - #whiteboard has pointer-events:none (good: hotspot clicks pass through),
     but that also means the list can’t be interacted with (probably desired).
   ========================================================= */

#whiteboard {
  position:absolute;

  /* Position is set by JS (placeHotspots) from CONFIG.HOTSPOTS.leaderboard */

  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.1875rem;

  pointer-events: none;

  color: rgba(62, 114, 171, 0.95);
  overflow: hidden;

  /* Enable container queries so child cqw units scale with the whiteboard width */
  container-type: inline-size;

  /* Scale font with whiteboard width; clamp prevents illegibly small/large text */
  font-size: clamp(0.45rem, 3.5cqw, 0.95rem);
}


/* OFFICE / MINI LEADERBOARD */
#leaderboardList li{
  display: grid;

  /* rank(fixed) | medal(fixed) | name(flexible, truncates) | score(shrinks to content) */
  /* All sizing in cqw so columns scale proportionally with the whiteboard container.    */
  grid-template-columns: 7cqw 7cqw 1fr max-content;

  grid-auto-flow: row;
  align-items: center;

  /* Tight gap between rank/medal; slightly more before name and score */
  column-gap: 1cqw;
  margin: 0.09rem 0;
  padding: 0.09rem 2cqw;

  border-radius: 6px;
}


/* Column placement */
#leaderboardList li .wb-rank{ grid-column: 1; text-align: center; }
#leaderboardList li::after{ grid-column: 2; }          /* medal slot */
#leaderboardList li .wb-name{
  grid-column: 3;
  min-width: 0;        /* allows 1fr column to shrink below content size */
  overflow: hidden;
  padding-left: 1cqw;
}
#leaderboardList li .wb-score{
  grid-column: 4;
  text-align: right;
  justify-self: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; /* score never wraps before it can be considered overflowed */
}

/* Name truncates via the inner span — name column always fills leftover 1fr space */
#leaderboardList li .wb-nameText{
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Collapse medal column to zero when whiteboard is too narrow */
#whiteboard.hide-medals #leaderboardList li {
  grid-template-columns: 7cqw 0px 1fr max-content;
}
#whiteboard.hide-medals #leaderboardList li::after {
  content: "" !important;
  display: none;
}

/* FULL LEADERBOARD SCREEN */
/* FULL LEADERBOARD — em fallback for browsers without cqw support */
#leaderboardFullList li{
  display: grid;
  grid-template-columns: 2em 2.5em 1fr 8em;
  grid-auto-flow: row;
  align-items: center;
  column-gap: 0.4em;
  margin: 0.2em 0;
  padding: 0.4em 1em;
  border-radius: 0.7em;
  color: rgba(30, 60, 100, 0.95);
  font-size: clamp(1.1rem, 2.8vw, 3rem);
}

@supports (width: 1cqw) {
  #leaderboardFullList li{
    grid-template-columns: 3cqw 3.5cqw 1fr 12cqw;
    column-gap: 0.6cqw;
    margin: 0.2cqw 0;
    padding: 0.4cqw 1.5cqw;
    border-radius: 1cqw;
    font-size: clamp(1.1rem, 4.2cqw, 3rem);
  }
}

/* Column placement */
#leaderboardFullList li .wb-rank{ grid-column: 1; text-align: center; }
#leaderboardFullList li::after{ grid-column: 2; }      /* medal slot */
#leaderboardFullList li .wb-name{ grid-column: 3; min-width: 0; margin-left: 1.5em; }
@supports (width: 1cqw) {
  #leaderboardFullList li .wb-name{ margin-left: 2.5cqw; }
}
#leaderboardFullList li .wb-score{
  grid-column: 4;
  text-align: right;
  justify-self: end;
  font-variant-numeric: tabular-nums;
}

/* Truncate long names (optional on full, but still useful) */
#leaderboardFullList li .wb-nameText{
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Clickable name on full leaderboard (Superior Honor replay) */
#leaderboardFullList li .wb-nameText--clickable {
  cursor: pointer;
  /*text-decoration: underline dotted;
  text-underline-offset: 2px;
  transition: opacity 0.15s;*/
}
#leaderboardFullList li .wb-nameText--clickable:hover,
#leaderboardFullList li .wb-nameText--clickable:focus-visible {
  opacity: 0.75;
  outline: none;
}

/* Pinned row color inheritance */
#leaderboardList li.is-pinned, #leaderboardFullList li.is-pinned { color: #c89c00; }
#leaderboardList .wb-list li.is-pinned, #leaderboardFullList .wb-list li.is-pinned * { color: inherit; }

#leaderboardList li::after,
#leaderboardFullList li::after{
  grid-row: 1;
  justify-self: center;
  align-self: center;
  line-height: 1;
  display: block;
}

#leaderboardList li.is-pinned::after,
#leaderboardFullList li.is-pinned::after{ content: "🥇"; }

#leaderboardList li.is-superior-honor:not(.is-pinned)::after,
#leaderboardFullList li.is-superior-honor:not(.is-pinned)::after{ content: "🥈"; }

#leaderboardList li.is-found-egg,
#leaderboardFullList li.is-found-egg { color: #838281; }

/* Easter-egg discovery bonus toast — floats up from the hotspot on the office screen */
.egg-bonus-toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  pointer-events: none;
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.1rem, 2.8vw, 2rem);
  color: #ffd700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.85), 0 0 18px rgba(255,215,0,0.6);
  white-space: nowrap;
  opacity: 1;
  animation: eggBonusRise 2.2s ease-out forwards;
  z-index: 20;
}
@keyframes eggBonusRise {
  0%   { opacity: 1;   transform: translateX(-50%) translateY(0); }
  70%  { opacity: 1;   transform: translateX(-50%) translateY(-60px); }
  100% { opacity: 0;   transform: translateX(-50%) translateY(-90px); }
}

/* ── Easter-egg corkboard glint ─────────────────────────────────────────────
   A small div positioned over the hotspot. Normally invisible.
   When JS adds .glinting, a diagonal highlight sweeps across and fades —
   like light catching a thumbtack or pin on the corkboard.
   The element is sized larger than the hotspot so the sweep is perceptible. */
#eggGlint {
  position: absolute;
  pointer-events: none;
  z-index: 9;
  border-radius: 50%;
  overflow: hidden;
  opacity: 0;
}

#eggGlint::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 15%,
    rgba(255, 248, 220, 0.0) 35%,
    rgba(255, 248, 220, 0.55) 48%,
    rgba(255, 255, 255, 0.80) 52%,
    rgba(255, 248, 220, 0.0) 65%,
    transparent 80%
  );
  transform: translateX(-150%);
}

#eggGlint.glinting {
  animation: eggGlintFade 2.2s ease-out forwards;
}

#eggGlint.glinting::after {
  animation: eggGlintSweep 1.4s ease-in-out forwards;
}

@keyframes eggGlintSweep {
  from { transform: translateX(-150%); }
  to   { transform: translateX(200%); }
}

@keyframes eggGlintFade {
  0%   { opacity: 1; }
  55%  { opacity: 0.9; }
  100% { opacity: 0; }
}

/* Remove default <ol> indentation so rows don't shift right */
#leaderboardList,
#leaderboardFullList {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* =========================================================
   GAME SCREEN COMMON
   ========================================================= */

.game-canvas-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* HUD lines: force bottom placement ONLY for the HUD ids */
#lineHud.subtitle,
#paperHud.subtitle {
  position: static;   /* key: prevents overlay */
  flex: 0 0 auto;
  width: 100%;
  text-align: center;
  opacity: 0.85;
  pointer-events: none;
}

/* Responsive full-height game screen fix */
#screen-game.screen.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden; /* prevent canvas bleed on iOS Safari */
  position: relative; /* anchor for #instructionsOverlay */
}

#screen-game .gameArea {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}

/* ── Landscape phone: move HUD to right side so the canvas gets full height ── */
@media (orientation: landscape) and (max-height: 500px) {
  #screen-game.screen.active {
    flex-direction: row;
  }

  /* HUD becomes a narrow right-side strip */
  #screen-game .topbar {
    flex: 0 0 auto;
    width: 3.75rem;
    height: 100%;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: none;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    order: 2;
    overflow: visible;
  }

  /* Stack metrics vertically */
  #screen-game .game-hud {
    flex-direction: column;
    height: 100%;
    width: 100%;
    padding: 0.25rem 0;
    justify-content: space-evenly;
    align-items: center;
    gap: 0;
  }

  #screen-game .game-hud .cashMetric {
    flex: 0 0 auto;
    align-items: center;
  }

  /* Labels: small, centred, wrap rather than overflow the strip */
  #screen-game .game-hud .cashLabel {
    display: block;
    font-size: clamp(0.5rem, 2vh, 0.65rem);
    white-space: normal;
    text-align: center;
    line-height: 1.1;
  }

  /* Value font scales to strip width */
  #screen-game .game-hud .cashValue {
    font-size: clamp(0.8rem, 3.5vh, 1.25rem);
  }

  #screen-game .game-hud .hud-score .cashValue {
    font-size: clamp(0.9rem, 4vh, 1.375rem);
  }

  /* Buttons stack at bottom of strip */
  #screen-game .game-hud .endGameBtn {
    margin-left: 0;
    margin-top: 0.25rem;
    padding: 0.3rem 0.25rem;
    font-size: 0.7rem;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    width: 90%;
  }

  #screen-game .muteBtn {
    margin-left: 0;
    font-size: 1rem;
  }

  /* Canvas area fills all height on the left */
  #screen-game .gameArea {
    flex: 1 1 auto;
    order: 1;
    height: 100%;
    min-width: 0;
  }
}

/* .game-hud — unified HUD styles for all screens */

#screen-intro,
#screen-results {
  background: #000;
  justify-content: flex-start;
  align-items: stretch;
  overflow: hidden;
}

/* Stage: fills all available space and centres the fit box — same pattern as #officeStage */
#introStage,
#resultsStage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* Fit box: gets explicit px dimensions from fitStageToImage() — same pattern as #officeFit */
#introFit,
#resultsFit {
  position: relative;
  flex: 0 0 auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 14px;
  overflow: hidden;
}

/* splash-stage is now the interior of the fit box (replaces old full-viewport stage) */
#screen-intro .splash-stage,
#screen-results .splash-stage {
  width: 100%;
  height: 100%;
  position: relative;
  padding: 6% 8%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  overflow: hidden;
}

/* Portrait: allow content to scroll if it overflows */
@media (orientation: portrait) {
  #screen-intro .splash-stage,
  #screen-results .splash-stage {
    overflow-y: auto;
  }
}

/* Prevent iOS double-tap zoom on all background/stage images.
   touch-action:none blocks the native pinch/double-tap zoom gesture;
   user-select:none prevents the long-press selection callout. */
#officeImage,
#leaderboardImage,
.splash-bg-img,
.award-bg-img {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Background image for intro/results splash screens.
   object-fit: fill matches the old background-size:100% 100% stretch behaviour. */
.splash-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  z-index: 0;
}

/* Stack all sibling content above the bg img */
#screen-intro .splash-stage > :not(.splash-bg-img),
#screen-results .splash-stage > :not(.splash-bg-img) {
  position: relative;
  z-index: 1;
}

#screen-intro .screen-middle,
#screen-results .screen-middle {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: clamp(0.3rem, 1vh, 0.75rem);
  gap: clamp(0.3rem, 1dvh, 0.75rem);
  width: 100%;
}

/* Vertically center content on intro screen when there's only one card */
#screen-intro .screen-middle.screen-middle--centered {
  justify-content: center;
}

#screen-intro .screen-bottom,
#screen-results .screen-bottom {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: clamp(0.625rem, 2vw, 1.25rem);
   margin-bottom: -2%;
   margin-top: auto;
}

/* Typography — screen-intro has two h1s so scope carefully */

/* Game title on the intro screen — larger than the topbar h1 and viewport-centered */
#introTitle,
#resultsTitle {
  font-size: clamp(1.625rem, 4vw, 3rem);
  text-align: center;
  width: 100%;
  margin: 0;
}

#screen-intro .topbar,
#screen-results .topbar {
  justify-content: center;
  height: auto;
  min-height: 3.375rem;
  overflow: visible;
  padding: 0.5rem 1rem;
}

/* #introFit / #resultsFit clip their contents; the stage scrolls if needed in portrait */

.results-card {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  box-shadow: 0 2px 8px rgba(60, 40, 10, 0.18);
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

/* Fun fact card — title + fact grouped together on parchment */
.fact-card {
  background: linear-gradient(135deg, rgba(255,200,60,0.18) 0%, rgba(255,255,255,0.22) 100%);
  border-radius: 10px;
  border-left: 4px solid #e8a020;
  padding: 0.65rem 1.1rem;
  box-shadow: 0 3px 14px rgba(60, 40, 10, 0.22), inset 0 1px 0 rgba(255,255,255,0.35);
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.results-card-title {
  font-size: clamp(1.0625rem, 2.8vw, 1.625rem);
  letter-spacing: 0.08em;
  color: #1a3a5c;
  margin: 0;
  text-transform: uppercase;
}


.fact-card-title {
  font-size: clamp(0.7rem, 1.6vw, 0.9rem);
  letter-spacing: 0.12em;
  color: #b06000;
  margin: 0;
  text-transform: uppercase;
  font-weight: 800;
}

/* Fun fact text — italic quote style */
#introFact,
#outroFact {
  font-style: italic;
  font-size: clamp(1rem, 2.1vw, 1.375rem);
  font-weight: 500;
  color: #2a1a0e;
  text-align: center;
  margin: 0;
  white-space: pre-wrap;
}

/* Results summary */
#resultsSummary {
  font-size: clamp(0.9375rem, 1.9vw, 1.3125rem);
  font-weight: 600;
  color: #2a1a0e;
  text-align: center;
  margin: 0;
  white-space: pre-wrap;
}

/* Primary action: Start / Play Again */
.splash-button-1 {
  background: #1a3a5c;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.splash-button-1:hover { background: #244d7a; }
.splash-button-1:active { transform: scale(0.97); }

/* Secondary action: Back to office */
.splash-button-2 {
  background: transparent;
  color: #3d2b1f;
  border: 2px solid #3d2b1f;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.splash-button-2:hover {
  background: rgba(61, 43, 31, 0.10);
}

/* =========================================================
   GAME INSTRUCTIONS OVERLAY
   Shown over the game canvas before the game starts.
   Injected into .canvas-game-wrap by JS so it sizes to
   the canvas exactly. position:relative is set on the wrap
   by JS at inject time.
   ========================================================= */

#instructionsOverlay {
  position: absolute;
  /* left/top/width/height set by JS to match canvas dimensions exactly */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;   /* each zone manages its own overflow */
  background: rgba(0, 0, 0, 0.72);
  border-radius: 14px;
  z-index: 100;
}

#instructionsOverlay.hidden {
  display: none !important;
}

/* ── Zone 1: title — fixed at top ── */
.overlay-instructions-title {
  flex: 0 0 auto;
  width: 100%;
  color: #fff;
  font-size: max(1.54rem, 4.4vmin);
  font-weight: 700;
  text-align: center;
  margin: 0;
  padding: clamp(0.5rem, 1.5vmin, 0.875rem) clamp(0.75rem, 2vw, 1.5rem);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

/* ── Zone 2: scrollable body — fills all remaining space ── */
.overlay-instructions-body {
  flex: 1 1 auto;
  min-height: 0;           /* required: lets flex child shrink below content size */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Always reserve space for the scrollbar so content doesn't shift when it appears */
  scrollbar-gutter: stable;
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.55) rgba(255, 255, 255, 0.08);
  color: #e8e8e8;
  font-size: max(1.21rem, 3.3vmin);
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  padding: clamp(0.5rem, 1.5vmin, 0.875rem) clamp(0.75rem, 2vw, 1.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Webkit (Chrome, Safari, Android WebView, iOS Safari) */
.overlay-instructions-body::-webkit-scrollbar {
  width: 6px;
}
.overlay-instructions-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}
.overlay-instructions-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
}
.overlay-instructions-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.80);
}

.overlay-instructions-body ul {
  margin: 0;
  padding-left: 1.4em;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: fit-content;
  max-width: 100%;
}

.overlay-instructions-body li {
  line-height: 1.55;
}

.overlay-instructions-body strong {
  color: #fff;
}

/* ── Zone 3: Start button — fixed at bottom, centered like other buttons ── */
#overlayStartBtn {
  flex: 0 0 auto;
  margin: clamp(0.5rem, 1.5vmin, 0.875rem) auto;
  border-radius: 0.625rem;   /* match base button */
  padding: 0.625rem 0.875rem;
  border-top: none;
  width: auto;
  box-sizing: border-box;
}

/* Desktop (mouse/trackpad): boost instructions overlay fonts by 20% */
@media (pointer: fine) {
  .overlay-instructions-title {
    font-size: max(1.848rem, 5.28vmin);
  }
  .overlay-instructions-body {
    font-size: max(1.452rem, 3.96vmin);
  }
}

/* "About This Work" card — blue accent to distinguish from the amber fun fact card */
#outroContextCard {
  background: linear-gradient(135deg, rgba(60,130,255,0.14) 0%, rgba(255,255,255,0.22) 100%);
  border-left-color: #2060c8;
}

#outroContextCard .fact-card-title {
  color: #1a3a5c;
}

/* Per-game real-world context text inside its own fact-card */
.outro-context-text {
  font-size: clamp(0.9375rem, 1.75vw, 1.25rem);
  color: #2a1a0e;
  text-align: center;
  width: 100%;
  margin: 0;
  font-style: italic;
  line-height: 1.55;
}
.outro-context-text p {
  margin: 0;
}

/* Per-game real-world context (results screen) */
.outro-context {
  font-size: clamp(0.8125rem, 1.5vw, 1.0625rem);
  color: #2a1a0e;
  text-align: center;
  max-width: none;
  width: 100%;
  margin: 0;
  font-style: italic;
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: clamp(0.5rem, 1.2vh, 0.875rem) clamp(0.75rem, 2vw, 1.25rem);
  padding: clamp(0.5rem, 1.2dvh, 0.875rem) clamp(0.75rem, 2vw, 1.25rem);
  box-shadow: 0 2px 8px rgba(60, 40, 10, 0.18);
}
.outro-context p {
  margin: 0;
}

.screen-top,
.screen-bottom {
  flex: 0 0 auto;        /* collapses to content height */
  width: 100%;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.screen-middle {
  flex: 1 1 auto;        /* fills remaining space */
  width: 100%;
  min-height: 0;         /* prevents overflow in some browsers */

  /* optional: center content inside the middle zone */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}




/* =========================================================
   CANVAS-LIKE GAMES (KEEP IN LINE / PAPER FLOW)
   ========================================================= */

.canvas-game-root {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.canvas-game-wrap{
  /* CRITICAL: allows the play area to actually receive height */
  flex: 1 1 auto;
  min-height: 0;

  width: 100%;
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: center;

  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  touch-action: none; /* prevents scroll/pinch before canvas is ready */
}

.canvas-game-wrap canvas{
  display: block;
  touch-action: none; /* prevents scroll/pinch interfering with touch drag */
  border-radius: 14px;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  -webkit-touch-callout: none;
  user-select: none;
  /* fitWorldCanvasToArea sets explicit width/height; these guard against overflow */
  max-width: 100%;
  max-height: 100%;
}

/* Tighten radius on small/portrait screens where canvas fills edge-to-edge */
@media (max-width: 600px), (max-height: 480px) {
  .canvas-game-wrap canvas {
    border-radius: 6px;
  }
}

.canvas-fitcontainer {
  position: relative;   /* required: absolutely-positioned children (consulates, cannon, etc.) anchor here */
  border-radius: 14px;
  overflow: hidden;
  touch-action: none;
}


/* Prevent iOS from treating the background image as a zoomable/tappable target.
   Scoped to #cashBg only — other <img> elements (consulates, blockers, etc.) must
   remain interactive so pointer events reach them on desktop. */
#cashBg {
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  -webkit-touch-callout: none;
}



.pf-root { height: 100%; width: 100%; }

.pf-playArea {
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
}

.pf-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.28;
}

.pf-inbox {
  position: absolute;
  bottom: 1.125rem;
  left: 50%;
  transform: translateX(-50%);
  width: 8.75rem;
  height: 7.5rem;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.35));
}

.pf-paper {
  position: absolute;
  width: 3.5rem;
  height: 3.5rem;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}

/* =========================================================
   RESOURCE ALLOCATION MINI-GAME (KEEP ONLY ONE LAYOUT)
   REVIEW:
   - You had at least THREE conflicting RA layouts:
     1) absolute-positioned posts with nth-child top/bottom rules
     2) another absolute variant with different sizes/opacity
     3) the final “PATCH: Resource Allocation …” grid-based UI
   - The final block below is the most coherent and matches your stated
     design goals (sprites only, no faded containers, scalable).
   ========================================================= */

/* RA root wrapper */
.ra-root {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ra-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

/* Play area */
.ra-playArea {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 16px;
}

.ra-bg {
  position: absolute;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover; /* REVIEW: you had cover in earlier blocks; keep it */
  /* REVIEW: remove opacity here unless you truly want faded background.
     If background should be visible like other games, keep opacity: 1. */
  opacity: 1;
}

/* UI overlay */
.ra-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  gap: 0.625rem;
  pointer-events: none; /* enable only on interactive children */
  z-index: 10;
}

/* Bank bills row */
.ra-bank {
  display: flex;
  gap: 0.625rem;
  justify-content: center;
  pointer-events: auto;
}

/* Bill button: sprite-only (no container backgrounds) */
.ra-bill {
  user-select: none;
  touch-action: none;
  cursor: grab;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  backdrop-filter: none;
  border-radius: 0;
}

.ra-bill:active { cursor: grabbing; }

.ra-bill-img {
  pointer-events: none;
  user-select: none;
  display: block;
  width: clamp(4.5rem, 12vw, 8.75rem);
  height: auto;
}

/* Drag ghost */
.ra-drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-9999px, -9999px);
  z-index: 9999;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  backdrop-filter: none;
  border-radius: 0;
}

/* Posts grid */
.ra-posts {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.625rem;
  align-content: stretch;
  pointer-events: auto;
}

@media (max-width: 700px) {
  .ra-posts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Individual post card */
.ra-post {
  position: relative;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 7.5rem;
}

.ra-post.is-closed { filter: grayscale(0.6) brightness(0.85); }

.ra-post .ra-post-top { padding: 0.625rem 0.625rem 0.375rem; }

.ra-post-name { font-weight: 800; letter-spacing: 0.3px; }

.ra-request-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.625rem;
  margin-top: 0.25rem;
}

.ra-request-amt { font-size: 1.375rem; font-weight: 900; }
.ra-request-amt.negative { color: #ff5c5c; }

.ra-timer {
  height: 0.375rem;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.ra-timer > .ra-timer-fill {
  height: 100%;
  width: 100%;
  background: rgba(255, 255, 255, 0.65);
  transform-origin: left center;
}

/* Consulate sprite area */
.ra-post .ra-post-sprite {
  height: 4rem;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  margin: 0 0.5rem 0.625rem;
  opacity: 0.95;
}

/* Government shutdown overlay */
.ra-gov-shutdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto; /* blocks play area interactions */
  z-index: 40;
  background: rgba(0, 0, 0, 0.35);
}

.ra-gov-shutdown img {
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
}

/* =========================================================
   AWARDS / CONFETTI + SUPERIOR HONOR SCREEN
   REVIEW:
   - You had both .award-bg/.award-popup AND #screen-award animations.
     That’s fine; they serve different award presentation patterns.
   ========================================================= */


.award-popup {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--award-awarder-bottom-vh);
  width: var(--award-awarder-vw);
  max-width: var(--award-awarder-maxw);
  background: rgba(10, 14, 26, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 0.875rem 1rem;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
}

.award-popup.show {
  opacity: 1;
  pointer-events: none;
  animation: awardIn var(--award-awarder-dur-sec) ease both;
}

.award-popup .title {
  font-size: 1.625rem;
  letter-spacing: 2px;
  margin-bottom: 0.25rem;
}

.award-popup .body {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
}

@keyframes awardIn {
  from { transform: translateX(-50%) translateY(14px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* =========================================================
   AWARD SCREEN
   Same pattern as the office screen:
   - #awardStage fills available space, centres #awardFit
   - JS (fitStageToImage) sets explicit px width/height on
     #awardFit to match the bg image's natural aspect ratio
   - Everything inside #awardFit is position:absolute and
     sized/positioned as % of the fit box
   ========================================================= */

#screen-award.screen.active {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  background-color: #000;
  overflow: hidden;
}

#awardStage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
  container-type: size;
}

#awardFit {
  position: relative;
  flex: 0 0 auto;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  border-radius: 14px;
}

/* Background fills the fit box exactly — same pattern as #officeFit > #officeImage. */
.award-bg-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--award-bg-fade-sec) ease;
}
.award-bg-img.visible { opacity: 1; }

/* ── Inner pair: just a positioning wrapper ── */
.award-pair {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* ── Text: left of centre, floor-aligned ── */
#screen-award .award-content {
  pointer-events: auto;
  position: absolute;
  bottom: 28%;
  left: 24%;
  width: 28%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0;
}

/* ── Awarder: right of text, feet on stage floor ── */
.awarder-wrap {
  position: absolute;
  bottom: 16%;
  right: 20%;
  width: 22cqw;
  height: 72cqh;
  pointer-events: none;
  overflow: visible;
}

.awarder-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom;        /* feet always at bottom of wrap = stage floor */
  display: block;
  transform: translateX(0);
  will-change: transform;
}

/* Slide-in animation */
#screen-award.pre-awarder .awarder-img {
  transform: translateX(120vw);
}
#screen-award.pre-awarder.play-awarder .awarder-img {
  animation: awarderSlideInBounce var(--award-awarder-dur-sec)
    cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes awarderSlideInBounce {
  0%   { transform: translateX(120vw); }
  72%  { transform: translateX(-6px); }
  86%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

/* ── Text styles — all sized relative to fit box width ──── */
.award-title {
  display: block;
  margin: 0;
  font-size: clamp(0.6rem, 3.8cqw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0,0,0,0.5), 0 1px 4px rgba(0,0,0,0.65);
}
.award-text {
  display: block;
  margin: 0.3em 0 0;
  font-size: clamp(0.4rem, 1.4cqw, 1.05rem);
  color: #fff;
  opacity: 0.85;
  text-shadow: 0 1px 8px rgba(0,0,0,0.7);
}
.award-name {
  display: block;
  margin: 0.2em 0 0;
  font-size: clamp(0.6rem, 3cqw, 2.5rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.03em;
  color: #ffd24a;
  text-shadow: 0 2px 16px rgba(0,0,0,0.7), 0 1px 4px rgba(0,0,0,0.9);
}
.award-thankyou {
  display: block;
  margin: 0.4em 0 0;
  font-size: clamp(0.4rem, 1.5cqw, 1.1rem);
  line-height: 1.4;
  color: #fff;
  opacity: 0.92;
  text-shadow: 0 1px 8px rgba(0,0,0,0.7);
}
.award-score {
  display: block;
  margin: 0.3em 0 0;
  font-size: clamp(0.5rem, 1.6cqw, 1.15rem);
  color: #fff;
  opacity: 0.85;
  text-shadow: 0 1px 8px rgba(0,0,0,0.7);
}

.award-score-value {
  color: #ffd24a;
}

.award-bonus {
  display: block;
  margin: 0.4em 0 0.1em;
  font-size: clamp(0.5rem, 1.6cqw, 1.15rem);
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 12px rgba(255, 200, 0, 0.7), 0 1px 4px rgba(0,0,0,0.8);
  letter-spacing: 0.04em;
}
#screen-award .award-content button {
  margin-top: 1.2em;
}

/* Award screen: on narrow portrait phones the 16:9 fit box is short, making the
   fixed-percentage content column (~28% wide) too narrow to read. Widen it. */
@media (orientation: portrait), (max-width: 520px) {
  #screen-award .award-content {
    left: 8%;
    width: 50%;
  }
}

/* Landscape phones: fit box is wide but short — content column needs to be
   wider and positioned higher so text doesn't overflow the bottom edge. */
@media (orientation: landscape) and (max-height: 500px) {
  #screen-award .award-content {
    left: 4%;
    width: 46%;
    bottom: 18%;
  }
}

/* Confetti burst */
.award-confetti {
  position: absolute;
  inset: 0;
  overflow: visible; /* #awardFit clips the outer boundary; hidden here would cut pieces near the edges */
  pointer-events: none;
  z-index: 1;
}

.award-confetti .c {
  position: absolute;
  width: 0.625rem;
  height: 0.375rem;
  border-radius: 0.125rem;
  opacity: 0;
  will-change: transform, opacity;
  animation: confettiPop var(--award-confetti-dur) ease-out forwards;
}

@keyframes confettiPop {
  0%   { opacity: 0; transform: translate3d(var(--sx), var(--sy), 0) rotate(var(--r0)); }
  10%  { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--ex), var(--ey), 0) rotate(var(--r1)); }
}

/* =========================================================
   ORIENTATION OVERLAY
   Simple portrait-only overlay — no CSS rotation, no transforms,
   no sizing math. Works correctly on iOS Safari because:
   - position:fixed on the overlay itself (not inside a transformed ancestor)
   - inset:0 fills the viewport regardless of address bar state
   - No rotation means no broken fixed/transform interaction
   Show/hide is toggled by JS (shouldForceLandscape → updateOrientationOverlay).
   ========================================================= */

#orientationOverlay {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  color: #fff;
  font-family: inherit;
  text-align: center;
  padding: 2rem;
}

#orientationOverlay.hidden {
  display: none;
}

#orientationOverlay .rotate-icon {
  font-size: 4rem;
  animation: rotate-hint 1.5s ease-in-out infinite alternate;
}

#orientationOverlay .rotate-message {
  font-size: 1.25rem;
  line-height: 1.5;
  max-width: 260px;
}

@keyframes rotate-hint {
  from { transform: rotate(-15deg); }
  to   { transform: rotate( 15deg); }
}

/* Prevent game content underneath from scrolling while overlay is shown */
body.orientation-locked {
  overflow: hidden;
}

/* =========================================================
   LEADERBOARD SCREEN WRAP
   ========================================================= */

.leaderboard-wrap {
  width: min(56.25rem, 94vw);
  margin: 0 auto;
  padding: 0.625rem 0.75rem;
}

/* =========================================================
   SMALL SCREENS
   ========================================================= */

/* Phones — portrait or small landscape */
@media (max-width: 520px) {
  .topbar { height: 3.125rem; }
  .btn { padding: 9px 10px; border-radius: 12px; }

  /* Tighter HUD on narrow phones */
  .game-hud { padding: 0 0.25rem; gap: 0; }
  .game-hud .cashMetric { gap: 0; }

  /* Splash card fills more width */
  #screen-name .splash-card { padding: 1.25rem 1rem; }
  #screen-name h1 { font-size: clamp(2rem, 8vw, 3rem); }
}

/* Very small height (landscape phone) — compress topbar and hints */
@media (max-height: 420px) {
  .topbar:not(#screen-game .topbar) { height: 2.5rem; }
  .hint { display: none; }
  .screen-bottom { margin-top: 0.25rem; }
}

/* Tablets and up — restore comfortable spacing */
@media (min-width: 768px) {
  .canvas-game-root { gap: 0; }
}

/* =========================================================
   LEGACY RA RULES (DISABLED)
   REVIEW:
   - These were duplicates that conflict with the grid RA layout.
   - Keep them only if you intentionally switch back to absolute-post layout.
   ========================================================= */

/*
.ra-post.top:nth-child(1) { left: 3%; top: 4%; }
.ra-post.top:nth-child(2) { left: 50%; top: 4%; transform: translateX(-50%); }
.ra-post.top:nth-child(3) { right: 3%; top: 4%; }
.ra-post.bottom:nth-child(4) { left: 14%; bottom: 4%; }
.ra-post.bottom:nth-child(5) { right: 14%; bottom: 4%; }

.ra-money { width: 5.375rem; height: 6.875rem; }
@media (max-width: 600px) {
  .ra-post { width: 46vw; }
  .ra-money { width: 4.625rem; height: 3rem; }
}
*/


/* =====================================================================
   CASH ALLOCATION (3rd mini-game) - scoped styles only
   ===================================================================== */

#cashRoot{
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(0.375rem, 1.2vh, 0.75rem);
  gap: clamp(0.375rem, 1.2dvh, 0.75rem);
  min-height: 0;
}

/* =========================================================
   UNIFIED GAME HUD (topbar — all three games)
   ========================================================= */

.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  width: 100%;
  gap: 0;
  padding: 0 clamp(0.5rem, 1.5vw, 1rem);
}

.game-hud .cashMetric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex: 1 1 0;
  min-width: 0;
}

.game-hud .cashLabel {
  font-size: clamp(0.75rem, 1.2vw, 0.8125rem);
  opacity: 0.70;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.game-hud .cashValue {
  font-size: clamp(0.875rem, 2.0vw, 1.375rem);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

/* Flashing "0" during Reply-All Storm clearing phase */
@keyframes hud-time-flash {
  0%, 49% { opacity: 1;   color: #ff4444; }
  50%, 99% { opacity: 0.15; color: #ff4444; }
}
.hud-time-flashing {
  animation: hud-time-flash 0.6s step-start infinite;
}

/* Score metric: brighter and slightly larger to stand out */
.game-hud .hud-score .cashLabel {
  opacity: 0.90;
  color: #7dd4fc;
}
.game-hud .hud-score .cashValue {
  font-size: clamp(1rem, 2.4vw, 1.625rem);
  color: #7dd4fc;
}

/* =========================================================
   SCORE NUMBER COLOR TOKENS
   --score-main : amber gold  — total / hero score
   --score-stat : sky blue    — per-game / secondary scores
   These two classes are applied to <span> wrappers around
   numeric values wherever scores appear.
   ========================================================= */
.score-num--main { color: #f5a623; }
.score-num--stat { color: rgba(62, 114, 171, 0.95); }

/* End game button sits at the far right, doesn't flex-grow or shrink */
.game-hud .endGameBtn {
  flex: 0 0 auto;
  margin-left: clamp(0.25rem, 1.5vw, 1rem);
  /* Prevent overflow clipping on narrow phones */
  min-width: 0;
  white-space: nowrap;
}

/* Mute button — sits next to End Game / Restart in both HUDs */
.muteBtn {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: clamp(0.9rem, 2vw, 1.25rem);
  line-height: 1;
  padding: 0.25rem 0.35rem;
  margin-left: 0.25rem;
  opacity: 0.75;
  transition: opacity 0.15s;
  border-radius: 4px;
}
.muteBtn:hover { opacity: 1; }
.muteBtn:active { transform: scale(0.9); }

/* On narrow phones: tighten button padding so it stays visible */
@media (max-width: 480px) {
  .game-hud .endGameBtn {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
  }
  /* Let metrics compress gracefully before squeezing out the button */
  .game-hud .cashMetric {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
  }
  .game-hud .cashLabel,
  .game-hud .cashValue {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
}

/* Hide old bottom-of-canvas HUDs — metrics are now in the topbar */
#lineHud, #paperHud {
  display: none !important;
}



#cashBg{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}





/* Consulate sprites: sized by JS via setPercentStyle; no CSS scale needed */
.cash-consulate{
  position: absolute;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;

  transform-origin: center center;
  transition: transform 0.06s ease, filter 0.18s ease;
}

.cash-consulate-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6%;      /* just inside the bottom of the sprite */
  pointer-events: none;

  font-size: clamp(0.75rem, 1.6vw, 1.15rem);
  font-weight: 900;
  color: #fff;
  text-align: center;
  line-height: 1.15;
  white-space: nowrap;

  /* Strong dark outline: stacked shadows in all 8 directions */
  text-shadow:
    -2px -2px 0 rgba(0,0,0,0.95),
     0px -2px 0 rgba(0,0,0,0.95),
     2px -2px 0 rgba(0,0,0,0.95),
    -2px  0px 0 rgba(0,0,0,0.95),
     2px  0px 0 rgba(0,0,0,0.95),
    -2px  2px 0 rgba(0,0,0,0.95),
     0px  2px 0 rgba(0,0,0,0.95),
     2px  2px 0 rgba(0,0,0,0.95),
     0 3px 8px rgba(0,0,0,0.8);
}

/* --- Name badge --- */
.cash-consulate-name{
  position: absolute;

  /* centered near top of sprite */
  left: 50%;
  top: 4%;
  transform: translateX(-50%);

  /* readable sizing across devices */
  font-size: clamp(0.5rem, 1.05vw, 1rem);
  font-weight: 700;
  line-height: 1.15;

  /* badge look */
  padding: 0.125rem 0.5rem;
  border-radius: 999px;

  background: rgba(0, 0, 0, 0.55);
  color: rgba(255,255,255,0.96);

  /* readability */
  text-shadow: 0 1px 2px rgba(0,0,0,0.65);
  white-space: nowrap;

  /* keep game interaction clean */
  pointer-events: none;
  user-select: none;

  /* slight depth */
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}

.cash-consulate.hit-impact{
  transform: scale(1.14);
}

.cash-consulate.hit-glow{
  filter: drop-shadow(0 0 12px rgba(255,230,120,0.85));
  transform: scale(1.08);
}

.cash-consulate img{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}

.cash-consulate.is-offline{
  filter: grayscale(1) brightness(0.85);
  opacity: 0.75;
}

.cash-bar{
  position: absolute;
  left: 0;
  width: 100%;
  top: calc(-1 * clamp(0.4375rem, 1.1vh, 0.6875rem));
  top: calc(-1 * clamp(0.4375rem, 1.1dvh, 0.6875rem));
  height: clamp(0.4375rem, 1.1vh, 0.6875rem);
  height: clamp(0.4375rem, 1.1dvh, 0.6875rem);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0,0,0,0.22);
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset;
}

.cash-bar-fill{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #ffffff;
  transition: width 80ms linear, background-color 160ms linear;
}

/* $$$ label above the funding bar */
.cash-consulate::after {
  content: "$$$";
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + clamp(0.4375rem, 1.1vh, 0.6875rem) + 2px);
  bottom: calc(100% + clamp(0.4375rem, 1.1dvh, 0.6875rem) + 2px);
  text-align: center;
  font-size: clamp(0.6rem, 1.3vw, 0.95rem);
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
  color: #ffffff;
  pointer-events: none;
  text-shadow:
    -2px -2px 0 rgba(0,0,0,0.95),
     0px -2px 0 rgba(0,0,0,0.95),
     2px -2px 0 rgba(0,0,0,0.95),
    -2px  0px 0 rgba(0,0,0,0.95),
     2px  0px 0 rgba(0,0,0,0.95),
    -2px  2px 0 rgba(0,0,0,0.95),
     0px  2px 0 rgba(0,0,0,0.95),
     2px  2px 0 rgba(0,0,0,0.95),
     0 3px 8px rgba(0,0,0,0.8);
}

/* Grey out the cannon during a government shutdown */
.cannon-shutdown {
  filter: grayscale(1) brightness(0.65);
  transition: filter 0.3s ease;
}

#cashCannonWrap {
  width: clamp(3.5rem, 12vw, 8rem);
  height: clamp(3.5rem, 12vw, 8rem);
}

#cashCannon{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}

#cashAmmoBar {
  position: absolute;
  /* left/top set by JS to match cannon centre; translate shifts bar left of the sprite */
  transform: translate(calc(-50% - clamp(2.2rem, 7vw, 5rem)), -50%);
  width: clamp(0.35rem, 0.8vw, 0.55rem);
  height: clamp(1.3rem, 4.5vw, 3rem);  /* fixed height -- not relative to cannonWrap */
  background: rgba(0,0,0,0.45);
  border-radius: 999px;
  overflow: hidden;
  pointer-events: none;
  z-index: 9;
  display: flex;
  align-items: flex-end;
}

#cashAmmoBarFill {
  width: 100%;
  height: 100%;
  background: linear-gradient(0deg, #00c4ff, #00eeff);
  border-radius: 999px;
  transition: height 0.12s ease-out, opacity 0.2s ease;
  box-shadow: 0 0 6px rgba(0, 200, 255, 0.7);
  transform-origin: bottom;
}

.cash-bag{
  position: absolute;
  /* transform is set entirely by JS each frame: translate(-50%,-50%) rotate(angleRad) */
  width: clamp(1.5rem, 4.2vw, 3rem);
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Projectile layer: sits above all other fit children (last in DOM order).
   pointer-events:none so consulate/blocker hit areas remain interactive. */
#cashProjectileLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cash-reloader {
  position: absolute;
  transform: translate(-50%, -50%);
  width: clamp(6rem, 18vw, 12rem);
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 10;
}

#cashShutdown{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(72%, 35rem);
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.35));
  z-index: 15;
}

#cashShutdown.shutdown-spinning {
  animation-name: shutdownSpin;
  animation-duration: var(--shutdown-spin-dur, 1.2s);
  animation-timing-function: linear;
  animation-iteration-count: var(--shutdown-spin-count, 2);
  animation-fill-mode: forwards;
  transform-origin: center center;
}

@keyframes shutdownSpin {
  0%   { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}


.blocker-hit-count {
  position: absolute;
  transform: translate(-50%, -100%);
  font-size: clamp(1rem, 2.8vw, 1.6rem);
  font-weight: 900;
  color: #00d4ff;
  text-shadow: 0 0 8px rgba(0, 180, 255, 1.0), 0 0 16px rgba(0, 120, 255, 0.8), 0 2px 4px rgba(0,0,0,0.9);
  pointer-events: none;
  user-select: none;
  z-index: 20;
  animation: blocker-hit-count-pop 0.15s ease-out;
}

@keyframes blocker-hit-count-pop {
  from { transform: translate(-50%, -100%) scale(1.6); opacity: 0.6; }
  to   { transform: translate(-50%, -100%) scale(1.0); opacity: 1.0; }
}


/* =========================================================
   RELOADER HIT BONUS (confetti + score popup)
   ========================================================= */

.reloader-confetti-host {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  overflow: hidden;
}

.reloader-confetti-piece {
  position: absolute;
  width: 0.625rem;
  height: 0.375rem;
  border-radius: 0.125rem;
  opacity: 0;
  will-change: transform, opacity;
  animation: reloaderConfettiPop 1.5s ease-out forwards;
}

@keyframes reloaderConfettiPop {
  0%   { opacity: 0; transform: translate3d(var(--sx), var(--sy), 0) rotate(var(--r0)); }
  10%  { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--ex), var(--ey), 0) rotate(var(--r1)); }
}

.reloader-bonus-popup {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: clamp(1rem, 3vw, 2rem);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7), 0 0 18px rgba(255,220,0,0.9);
  pointer-events: none;
  z-index: 21;
  animation: reloaderBonusPopup 4s ease-out forwards;
}

@keyframes reloaderBonusPopup {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  8%   { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  20%  { opacity: 1; transform: translate(-50%, -60%) scale(1.0); }
  75%  { opacity: 1; transform: translate(-50%, -80%) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(0.85); }
}

/* =========================================================
   BLOCKER WANDERER
   ========================================================= */

.cash-blocker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: clamp(5rem, 13vw, 10rem);
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 8;
}

@media (max-width: 600px), (max-height: 500px) {
  .cash-blocker {
    width: clamp(5.5rem, 16vmin, 11rem);
  }
}

/* Tier 0 — calm (blue) */
.cash-blocker.cash-blocker-hit {
  animation: blockerHit 0.3s ease-out forwards;
  filter: drop-shadow(0 0 8px rgba(0, 180, 255, 0.9)) drop-shadow(0 0 16px rgba(0, 120, 255, 0.6));
}
@keyframes blockerHit {
  0%   { transform: translate(-50%, -50%) scale(1)    rotate(0deg);    }
  20%  { transform: translate(-50%, -50%) scale(1.10) rotate(-2deg);   }
  60%  { transform: translate(-50%, -50%) scale(0.98) rotate(1.5deg);  }
  100% { transform: translate(-50%, -50%) scale(1)    rotate(0deg);    }
}

/* Tier 1 — warn (yellow) */
.cash-blocker.cash-blocker-hit-warn {
  animation: blockerHitWarn 0.35s ease-out forwards;
  filter: drop-shadow(0 0 10px rgba(255, 220, 0, 0.95)) drop-shadow(0 0 20px rgba(255, 160, 0, 0.7));
}
@keyframes blockerHitWarn {
  0%   { transform: translate(-50%, -50%) scale(1)    rotate(0deg);    }
  20%  { transform: translate(-50%, -50%) scale(1.13) rotate(-3deg);   }
  55%  { transform: translate(-50%, -50%) scale(0.97) rotate(2deg);    }
  75%  { transform: translate(-50%, -50%) scale(1.02) rotate(-1deg);   }
  100% { transform: translate(-50%, -50%) scale(1)    rotate(0deg);    }
}

/* Tier 2 — danger (orange) */
.cash-blocker.cash-blocker-hit-danger {
  animation: blockerHitDanger 0.4s ease-out forwards;
  filter: drop-shadow(0 0 12px rgba(255, 120, 0, 1.0)) drop-shadow(0 0 24px rgba(255, 60, 0, 0.8));
}
@keyframes blockerHitDanger {
  0%   { transform: translate(-50%, -50%) scale(1)    rotate(0deg);    }
  15%  { transform: translate(-50%, -50%) scale(1.16) rotate(-4deg);   }
  40%  { transform: translate(-50%, -50%) scale(0.96) rotate(3deg);    }
  65%  { transform: translate(-50%, -50%) scale(1.04) rotate(-2deg);   }
  85%  { transform: translate(-50%, -50%) scale(0.99) rotate(1deg);    }
  100% { transform: translate(-50%, -50%) scale(1)    rotate(0deg);    }
}

/* Tier 3 — critical (red) */
.cash-blocker.cash-blocker-hit-critical {
  animation: blockerHitCritical 0.45s ease-out forwards;
  filter: drop-shadow(0 0 14px rgba(255, 30, 30, 1.0)) drop-shadow(0 0 28px rgba(200, 0, 0, 0.9));
}
@keyframes blockerHitCritical {
  0%   { transform: translate(-50%, -50%) scale(1)    rotate(0deg);    }
  12%  { transform: translate(-50%, -50%) scale(1.20) rotate(-5deg);   }
  30%  { transform: translate(-50%, -50%) scale(0.94) rotate(4deg);    }
  50%  { transform: translate(-50%, -50%) scale(1.08) rotate(-3deg);   }
  70%  { transform: translate(-50%, -50%) scale(0.97) rotate(2deg);    }
  85%  { transform: translate(-50%, -50%) scale(1.02) rotate(-1deg);   }
  100% { transform: translate(-50%, -50%) scale(1)    rotate(0deg);    }
}
/* =========================================================
   "CLICK TO PLAY" OVERLAY LABELS
   Siblings of the sprite <img>s, absolutely positioned inside
   #officeFit via JS (same coordinate space as the sprites).
   ========================================================= */

.hs-play-label {
  position: absolute;
  z-index: 20;
  /* left/top set by setHotspot() in main.js */
  white-space: normal;
  max-width: 4.5em;
  text-align: center;
  pointer-events: none;

  background: transparent;
  color: rgba(255, 255, 255, 0.95);
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(0.7rem, 1.4vw, 1.05rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.18em 0.55em 0.14em;
  border-radius: 4px;
  text-shadow:
    0 0 6px rgba(0,0,0,0.9),
    0 1px 3px rgba(0,0,0,0.95),
    0 2px 8px rgba(0,0,0,0.8);

  /* Gentle pulse so the eye is drawn to it */
  animation: hsLabelPulse 2.2s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

@keyframes hsLabelPulse {
  0%, 100% { opacity: 0.60; }
  50%       { opacity: 0.95; }
}

/* Hide the label once the game has been played */
.hs-play-label.label-hidden {
  opacity: 0 !important;
  pointer-events: none;
  animation: none;
}

/* =========================================================
   LANGUAGE SELECTOR — name/splash screen
   ========================================================= */

.lang-selector {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.75rem 0 0.25rem;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.3em 0.75em;
  border-radius: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.80);
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(0.75rem, 1.3vw, 0.95rem);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  backdrop-filter: blur(4px);
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.38);
  color: #fff;
}

.lang-btn.lang-active {
  background: rgba(0, 229, 255, 0.10);
  border-color: #00e5ff;
  color: #00e5ff;
  font-weight: 600;
  cursor: default;
  box-shadow: 0 0 18px 6px rgba(0, 229, 255, 0.40), 0 0 0 1px rgba(0, 229, 255, 0.25);
}

.lang-btn.lang-active:hover {
  background: rgba(0, 229, 255, 0.10);
  border-color: #00e5ff;
  color: #00e5ff;
  box-shadow: 0 0 18px 6px rgba(0, 229, 255, 0.40), 0 0 0 1px rgba(0, 229, 255, 0.25);
}

.lang-btn .lang-flag {
  font-size: 1.1em;
  line-height: 1;
}