/* ============================================================
   Top bar — HUD with money / day / reputation / level / end-day.
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 var(--sp-4);
  background: linear-gradient(180deg, var(--bg-hud-top), var(--bg-hud-bottom));
  border-bottom: 2px solid var(--bg-hud-edge);
  box-shadow: 0 2px 0 rgba(0,0,0,0.4);
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.brand .logo {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(79,195,247,0.12);
  color: var(--accent);
  border-radius: var(--r-sm);
}
.brand .logo svg { width: 18px; height: 18px; }
.brand .title {
  font-weight: var(--fw-bold);
  letter-spacing: 0.5px;
  font-size: var(--fs-lg);
}

.hud {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  /* `flex: 1` (instead of `margin-left: auto`) makes the hud occupy the
     full row to the right of the brand. The .hud-spacer below soaks up
     the slack, so the core 4 stats stay pinned at a stable left position
     even when optional chips (holiday/event/at-risk/rival/prestige) pop
     in and out. Without this, the whole hud was right-anchored and any
     chip appearing in the middle shoved the core stats sideways. */
  flex: 1;
  margin-left: var(--sp-4);
  min-width: 0;
}
/* Stretches between the core stats and the optional chip cluster. All
   chip-driven width variance is absorbed here, so Day/Cash/Rep/Workshop
   don't shift when a holiday or event chip appears. */
.hud-spacer {
  flex: 1 1 var(--sp-3);
  min-width: var(--sp-3);
}
.hud-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--sp-1) var(--sp-3);
  background: rgba(255,255,255,0.04);
  border-radius: var(--r-md);
  min-width: 80px;
  border: 1px solid var(--border);
  /* Never let the optional chip cluster squeeze the core stats. The
     spacer takes the slack; on very tight widths the responsive rule
     below relaxes min-width, but these never shrink mid-layout. */
  flex-shrink: 0;
}
.hud-label {
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  font-weight: var(--fw-semi);
}
.hud-value {
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
  transition: color var(--dur-mid) var(--ease),
              transform var(--dur-mid) var(--ease);
}
.hud-item.money .hud-value { color: var(--money); }

.hud-item.rep { min-width: 150px; }
.rep-text {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.rep-track {
  width: 100%;
  height: 4px;
  margin-top: var(--sp-1);
  background: rgba(0,0,0,0.4);
  border-radius: 2px;
  overflow: hidden;
}
.rep-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--bad), var(--money), var(--good));
  transition: width var(--dur-slow) var(--ease);
  width: 50%;
}

/* value-change flash */
.hud-value.flash-up {
  animation: flashUp 600ms ease;
}
.hud-value.flash-down {
  animation: flashDown 600ms ease;
}
@keyframes flashUp {
  0%   { color: var(--good); transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes flashDown {
  0%   { color: var(--bad); transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* HUD cash-bounce — triggered ~500ms after particles spawn so the
   money HUD reads as "absorbing" the incoming sale. */
.cash-bounce {
  animation: cashBounce 320ms ease-out;
}
@keyframes cashBounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.22); color: var(--good); }
  70%  { transform: scale(0.94); }
  100% { transform: scale(1); }
}

/* Money particles spawned by Anim.moneyParticles. Lives on the body
   in fixed coords; transform-only animation so it's GPU-accelerated. */
.money-particle {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  font-weight: 800;
  font-size: 22px;
  color: var(--good);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5),
               0 0 8px rgba(76, 175, 80, 0.45);
  will-change: transform, opacity;
  user-select: none;
}
/* Deduction variant — same shape, red tint. Spawned by Anim.moneyFlyOut
   when the player loses money (part purchase, rent, repair fee, etc). */
.money-particle.money-particle-out {
  color: var(--bad);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5),
               0 0 8px rgba(232, 80, 58, 0.45);
}
/* Floating "-$X" pill that drifts up out of the HUD on deduction. Sits
   above the spray so the amount stays legible during the burst. */
.money-pill {
  position: fixed;
  z-index: 201;
  pointer-events: none;
  user-select: none;
  font-weight: 800;
  font-size: 14px;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  /* Cap width so very large amounts (-$12,345) can't extend off-screen.
     JS also clamps the centerpoint after measuring, so this is a belt-
     and-braces second guard if the viewport changes mid-flight. */
  max-width: calc(100vw - 16px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  will-change: transform, opacity;
}
.money-pill.money-pill-out {
  background: rgba(232, 80, 58, 0.18);
  border: 1px solid rgba(232, 80, 58, 0.55);
  color: #ffb4a8;
}
/* HUD red-flash on a deduction — mirrors .cash-bounce but in the
   warning tone so the chip reads as "ouch, you just paid". */
.cash-deduct {
  animation: cashDeduct 320ms ease-out;
}
@keyframes cashDeduct {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.10); color: var(--bad); }
  70%  { transform: scale(0.96); }
  100% { transform: scale(1); }
}

/* ============================================================
   Celebrate moments — achievement unlocks, workshop level-ups,
   marquee sales. Driven by Anim.celebrate(el, {tier}).
   ============================================================ */

/* Gold ★ / ✨ glyph particles spawned by Anim.celebrate. Body-
   positioned in fixed coords; same GPU-friendly shape as money. */
.celebrate-particle {
  position: fixed;
  z-index: 220;
  pointer-events: none;
  font-weight: 800;
  font-size: 18px;
  color: #f0c63a;
  text-shadow: 0 0 6px rgba(240, 198, 58, 0.6),
               0 1px 2px rgba(0, 0, 0, 0.5);
  will-change: transform, opacity;
  user-select: none;
}

/* Source-element pulse from Anim.celebrate — a brief scale + gold
   halo that fires alongside the particle burst. */
.celebrate-pulse {
  animation: celebratePulse var(--dur-overlay, 800ms) var(--ease-glide, ease-out);
}
@keyframes celebratePulse {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(240,198,58, 0.7); }
  30%  { transform: scale(1.12); box-shadow: 0 0 0 12px rgba(240,198,58, 0.0); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(240,198,58, 0); }
}

/* Achievement banner — slides down from the top, holds, slides up.
   Stacks queued unlocks via the JS scheduler in anim.js. */
.achievement-banner {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 300;
  transform: translate(-50%, -120%);
  background: linear-gradient(180deg, #2d2a1a 0%, #1a1610 100%);
  border: 1px solid #6a5818;
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 10px 22px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: min(90vw, 480px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55),
              inset 0 1px 0 rgba(240, 198, 58, 0.35);
  pointer-events: none;
  transition: transform 380ms var(--ease-bounce);
}
.achievement-banner.show {
  /* !important to force the slide-in past any future cascade
     surprises — there's no good reason for another rule to override
     this, but the banner is a high-stakes signal we don't want a
     CSS regression to silently kill. */
  transform: translate(-50%, 0) !important;
}
.achievement-banner::before {
  content: "🏅";
  font-size: 28px;
  filter: drop-shadow(0 0 4px rgba(240, 198, 58, 0.5));
}
.achievement-banner .ab-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.achievement-banner .ab-label {
  font-size: 11px;
  font-weight: 700;
  color: #f0c63a;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.achievement-banner .ab-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 8px rgba(240, 198, 58, 0.4);
}

/* Workshop level-up curtain — full-width sweep, holds longer than
   day-flash, with content. */
.levelup-curtain {
  position: fixed;
  inset: 0;
  z-index: 290;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(180deg,
    rgba(20, 30, 45, 0.0) 0%,
    rgba(20, 30, 45, 0.65) 50%,
    rgba(20, 30, 45, 0.0) 100%);
  transition: opacity 320ms var(--ease-soft);
}
.levelup-curtain.show { opacity: 1; }
.levelup-curtain .lc-card {
  background: linear-gradient(180deg, rgba(240, 198, 58, 0.08), rgba(20, 30, 45, 0.92));
  border: 1px solid rgba(240, 198, 58, 0.55);
  border-radius: var(--r-md);
  padding: 18px 32px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6),
              0 0 32px rgba(240, 198, 58, 0.18);
  transform: scale(0.9);
  transition: transform 380ms var(--ease-bounce);
}
.levelup-curtain.show .lc-card { transform: scale(1); }
.levelup-curtain .lc-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #f0c63a;
  text-transform: uppercase;
  margin-bottom: 6px;
  text-shadow: 0 0 6px rgba(240, 198, 58, 0.4);
}
.levelup-curtain .lc-title {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}
.levelup-curtain .lc-sub {
  font-size: 13px;
  color: #cbd4e1;
}

/* Market-event HUD chip — appears between workshop-level and the rival
   chip. Mirrors .hud-rival in shape but uses an accent colour, and renders
   as a static div (no click target, just tooltip-driven info). */
.hud-market {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--sp-2);
  background: rgba(76, 175, 80, 0.14);
  border: 1px solid rgba(76, 175, 80, 0.45);
  border-radius: var(--r-sm);
  color: #c8e6c9;
  font-size: var(--fs-sm);
  cursor: help;
}
/* The HTML hidden attribute sets display:none implicitly, but our explicit
   display:inline-flex above wins specificity-wise. This restores the
   normal "hide me" behaviour when ui.js toggles `hidden = true`. */
.hud-market[hidden] { display: none; }
.hud-market-icon { font-size: 14px; line-height: 1; }
.hud-market-text { font-weight: var(--fw-semi); }

/* Sale-at-risk HUD chip — pending buyer-returns counter. Same shape
   as .hud-market but in a warning tone. */
.hud-atrisk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--sp-2);
  background: rgba(232, 80, 58, 0.14);
  border: 1px solid rgba(232, 80, 58, 0.45);
  border-radius: var(--r-sm);
  color: #f0b4a8;
  font-size: var(--fs-sm);
  cursor: help;
}
.hud-atrisk[hidden] { display: none; }
.hud-atrisk-icon { font-size: 14px; line-height: 1; }
.hud-atrisk-text { font-weight: var(--fw-semi); }

/* Holiday HUD chip — same shape as .hud-market, warmer accent so the
   two are visually distinct when both are active. */
.hud-holiday {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--sp-2);
  background: rgba(255, 179, 0, 0.16);
  border: 1px solid rgba(255, 179, 0, 0.55);
  border-radius: var(--r-sm);
  color: #ffe0a3;
  font-size: var(--fs-sm);
  cursor: help;
}
.hud-holiday[hidden] { display: none; }
.hud-holiday-icon { font-size: 14px; line-height: 1; }
.hud-holiday-text { font-weight: var(--fw-semi); }

/* Payroll-due HUD chip — green when comfortably affordable, amber when
   payroll is within 2 days and cash is borderline. */
.hud-payroll {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--sp-2);
  background: rgba(76, 175, 80, 0.14);
  border: 1px solid rgba(76, 175, 80, 0.45);
  border-radius: var(--r-sm);
  color: #c8e6c9;
  font-size: var(--fs-sm);
  cursor: help;
}
.hud-payroll[hidden] { display: none; }
.hud-payroll.tight {
  background: rgba(255, 179, 0, 0.16);
  border-color: rgba(255, 179, 0, 0.55);
  color: #ffe0a3;
}
.hud-payroll-icon { font-size: 14px; line-height: 1; }
.hud-payroll-text { font-weight: var(--fw-semi); }

/* Pending-payments HUD chip — paperwork-delayed sales (Insurance /
   Dental archetypes). Cyan-toned to distinguish from payroll's green
   (money OUT) and the atrisk pill's amber (machine OUT). */
.hud-pending {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--sp-2);
  background: rgba(79, 195, 247, 0.14);
  border: 1px solid rgba(79, 195, 247, 0.45);
  border-radius: var(--r-sm);
  color: #b9defb;
  font-size: var(--fs-sm);
  cursor: help;
}
.hud-pending[hidden] { display: none; }
.hud-pending-icon { font-size: 14px; line-height: 1; }
.hud-pending-text { font-weight: var(--fw-semi); }

/* Rival shop HUD chip — appears between workshop-level and end-day. */
.hud-rival {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--sp-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.hud-rival[hidden] { display: none; }
.hud-rival:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }
.hud-rival-icon  { font-size: 14px; line-height: 1; }
.hud-rival-text  { font-weight: var(--fw-semi); }
/* When pressuring (rival rep > player rep), warn-color the chip. */
.hud-rival.pressuring {
  background: rgba(232,80,58,0.15);
  border-color: rgba(232,80,58,0.55);
  color: #f0b4a8;
}
.hud-rival.pressuring:hover { background: rgba(232,80,58,0.22); }

/* Rival popover anchored beneath the HUD chip. */
.rival-popover {
  position: fixed;
  width: 280px;
  background: var(--bg-panel);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  padding: var(--sp-3);
  z-index: 160;
  font-size: var(--fs-sm);
  color: var(--text);
}
.rival-popover .rival-head {
  font-size: var(--fs-md);
  margin-bottom: 4px;
}
.rival-popover .rival-stats {
  color: var(--text-dim);
  font-size: var(--fs-xs);
  margin-bottom: var(--sp-2);
  line-height: 1.4;
}
.rival-popover .rival-pressure {
  color: var(--bad);
  font-size: var(--fs-xs);
  font-style: italic;
  margin-bottom: var(--sp-2);
}
.rival-popover .rival-buyout {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--fs-sm);
}
.rival-popover .rival-buyout:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Counter-move panel inside the rival popover. Each button stacks
   a label + a live state line (cost / cooldown / active). */
.rival-popover .rival-counter-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--sp-2);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}
.rival-popover .rival-counter {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.rival-popover .rival-counter:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}
.rival-popover .rival-counter:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.rival-popover .rival-counter .rc-name {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
}
.rival-popover .rival-counter .rc-state {
  font-size: var(--fs-xs);
  color: var(--text-dim);
}

.end-day {
  margin-left: var(--sp-2);
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  font-weight: var(--fw-bold);
  padding: 9px var(--sp-4);
  box-shadow: var(--sh-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.end-day:hover {
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
}
.end-day svg { width: 13px; height: 13px; }

/* ---------- in-game menu (gear icon + dropdown) ----------
   Sits at the far right of the HUD next to End Day. The dropdown is
   absolutely positioned and toggled via `hidden`. */
.hud-menu {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 50%, rgba(79, 195, 247, 0.18) 0%, rgba(79, 195, 247, 0) 65%),
    var(--bg-card);
  border: 1px solid rgba(79, 195, 247, 0.40);
  border-radius: 50%;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  margin-left: 8px;
  position: relative;
  box-shadow:
    0 0 0 1px rgba(79, 195, 247, 0.10) inset,
    0 0 14px rgba(79, 195, 247, 0.18);
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}
/* The gear glyph itself sits inside the button; slow lazy spin draws
   the eye without being annoying. The button doesn't rotate — only
   the inner glyph via a pseudo-element so layout/hit-area stays put.
   Mask-image lets the SVG cog inherit `color` via currentColor, so
   hover transitions still tint it. */
.hud-menu::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;   /* center bypassing flex layout */
  transform-origin: 50% 50%;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z'/></svg>");
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-size: contain;
          mask-size: contain;
  filter: drop-shadow(0 0 6px rgba(79, 195, 247, 0.35));
  animation: hudMenuSpin 9s linear infinite;
}
@keyframes hudMenuSpin {
  to { transform: rotate(360deg); }
}
.hud-menu:hover {
  background:
    radial-gradient(circle at 50% 50%, rgba(79, 195, 247, 0.32) 0%, rgba(79, 195, 247, 0) 60%),
    var(--bg-card-hover);
  border-color: rgba(79, 195, 247, 0.80);
  color: #ffffff;
  box-shadow:
    0 0 0 1px rgba(79, 195, 247, 0.30) inset,
    0 0 22px rgba(79, 195, 247, 0.55);
  transform: scale(1.04);
}
.hud-menu:hover::before {
  animation-duration: 2.4s;   /* spins up under the cursor */
}
.hud-menu[aria-expanded="true"] {
  /* Open-state: ring stays bright so the player can find it again. */
  border-color: rgba(79, 195, 247, 0.85);
  color: #ffffff;
  box-shadow:
    0 0 0 1px rgba(79, 195, 247, 0.35) inset,
    0 0 26px rgba(79, 195, 247, 0.65);
}
.hud-menu[aria-expanded="true"]::before {
  animation-duration: 2s;
}
@media (prefers-reduced-motion: reduce) {
  .hud-menu::before { animation: none; }
}
.game-menu {
  position: fixed;
  top: 56px;
  right: 12px;
  min-width: 200px;
  z-index: 200;
  background: var(--bg-elev, var(--bg-card));
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--r-sm);
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.game-menu[hidden] { display: none; }
.game-menu .gm-item {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 8px 12px;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.game-menu .gm-item:hover {
  background: var(--bg-card-hover, rgba(255,255,255,0.06));
}
.game-menu .gm-item.gm-danger { color: var(--bad, #f0b4a8); }
.game-menu .gm-item.gm-danger:hover {
  background: rgba(232,80,58,0.15);
  color: var(--bad, #f0b4a8);
}

/* Developer section — hidden by default; only rendered when ?dev=1 has
   been set (persists in localStorage). The divider gives a clear visual
   break from the user-facing menu items above. */
.game-menu .gm-dev-divider {
  margin: 6px 4px 2px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 179, 0, 0.85);
  border-top: 1px solid rgba(255, 179, 0, 0.25);
}
.game-menu .gm-item.gm-dev {
  font-size: var(--fs-xs, 11px);
  color: rgba(255, 215, 130, 0.9);
  font-family: "Courier New", monospace;
}
.game-menu .gm-item.gm-dev:hover {
  background: rgba(255, 179, 0, 0.12);
  color: rgba(255, 215, 130, 1);
}

/* Toggle row inside the game menu — gets a small left-aligned check
   indicator that flips on click. The aria-checked attribute drives
   the visual state for assistive tech; the .is-on class drives the
   visual state for sighted users. */
.game-menu .gm-item.gm-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}
.game-menu .gm-toggle-check {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border, #4a5664);
  background: rgba(0,0,0,0.25);
  flex-shrink: 0;
  position: relative;
  transition: background var(--dur-fast, 120ms) var(--ease, ease),
              border-color var(--dur-fast, 120ms) var(--ease, ease);
}
.game-menu .gm-item.gm-toggle.is-on .gm-toggle-check {
  background: var(--accent, #4fc3f7);
  border-color: var(--accent, #4fc3f7);
}
.game-menu .gm-item.gm-toggle.is-on .gm-toggle-check::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #0a1419;
  line-height: 1;
}

/* ---------- responsive ----------
   The topbar is a fixed-height non-wrapping flex row; without these the
   HUD's fixed min-widths push it wider than the viewport on smaller
   screens, clipping items and forcing a horizontal page scrollbar. */
@media (max-width: 1000px) {
  .topbar  { padding: 0 var(--sp-2); }
  .hud     { gap: var(--sp-2); }
  .hud-item     { min-width: 0; padding: var(--sp-1) var(--sp-2); }
  .hud-item.rep { min-width: 104px; }
}
@media (max-width: 760px) {
  .brand .title   { display: none; }   /* logo alone is enough */
  .hud-label      { display: none; }   /* values are self-explanatory */
  .hud-rival-text  { display: none; }   /* keep just the 🏢 icon */
  .hud-market-text  { display: none; }   /* keep just the event icon */
  .hud-holiday-text { display: none; }   /* keep just the holiday icon */
  .hud-atrisk-text  { display: none; }   /* keep just the package icon */
  .end-day        { padding: 9px var(--sp-2); }
}
