/* Family Business — HUD / UI styles (owner: ui builder).
   Cream-paper cards, dark ink outlines, hard offset shadows; brass-gold glow on actionable things,
   money green for cash, oxblood for danger. System fonts only (see src/art/theme.css). */
@import url('./src/art/theme.css');

:root {
  --money: #2f6b2a;
  --money-hi: #9cc48a;
  --hud-ink: #1c1411;
  --hud-paper: #efe4cf;
  --hud-paper-2: #e2d3b6;
  --hud-paper-3: #d6c6a6;
  --hud-gold: #c99a3e;
  --hud-gold-2: #efd28a;
  --hud-blood: #8e2a24;
  --hud-blood-2: #c2463a;
}
/* v0.6.4: the CrazyGames app (src/platform.js: SDK user.systemInfo.applicationType = google_play_store / apple_store; ?cgapp=1
   on a debug / local page) draws a ~28 px bar (Exit, sound, report) at the top: the HUD, the tutorial card and the guidebook
   start under it (+ 6 px) — docs resources/crazygames-app "add padding to important UI" */
html.cg-app { --app-top: 34px; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;          /* no double-tap zoom; panels can still scroll (pan-y) */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
canvas { display: block; touch-action: none; outline: none; }

/* ------------------------------------------------------------------ root */
.fb-hud {
  --pad: 14px;
  --top: calc(env(safe-area-inset-top, 0px) + var(--app-top, 0px) + var(--pad));
  --left: calc(env(safe-area-inset-left, 0px) + var(--pad));
  --right: calc(env(safe-area-inset-right, 0px) + var(--pad));
  --bottom: calc(env(safe-area-inset-bottom, 0px) + var(--pad));
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  pointer-events: none;
  font-family: var(--font-body);
  color: var(--hud-ink);
  line-height: 1.2;
}
.fb-hud .fb-block, .fb-hud button { pointer-events: auto; }
.fb-hud [hidden] { display: none !important; }
:where(.fb-hud) button {
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s;
}
:where(.fb-hud) button:focus { outline: none; }
.fb-hud button:focus-visible { outline: 3px solid var(--hud-gold-2); outline-offset: 3px; }
.fb-hud svg { display: block; }

@keyframes hud-glow {
  0%, 100% { box-shadow: 4px 4px 0 var(--hud-ink), 0 0 0 3px rgba(239, 210, 138, 0.9), 0 0 12px 3px rgba(201, 154, 62, 0.55); }
  50%      { box-shadow: 4px 4px 0 var(--hud-ink), 0 0 0 4px rgba(255, 232, 160, 1),   0 0 26px 10px rgba(201, 154, 62, 0.85); }
}

/* ------------------------------------------------------------------ money card (top-left): BANK + CARRY */
/* v0.4: the left column = money card, tribute chips (vassal streets), family button — stacked, so chips push it down */
.hud-left {
  position: absolute; top: var(--top); left: var(--left);
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  pointer-events: none;
}
.hud-cash { position: relative; }
.cash-in {
  display: flex; flex-direction: column; gap: 3px;
  padding: 5px 14px 7px 7px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--hud-ink);
}
.cash-row {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 1px 6px 1px 2px;
  border-radius: 9px;
  transition: background 0.2s, box-shadow 0.2s;
  transform-origin: 20% 50%;
}
.cash-ico { position: relative; flex: none; display: grid; place-items: center; width: 46px; line-height: 0; }
.cash-ico svg { filter: drop-shadow(2px 2px 0 rgba(28, 20, 17, 0.35)); }
.cash-tag {
  position: absolute; left: 50%; bottom: -5px;
  transform: translateX(-50%);
  padding: 2px 5px 0;
  border-radius: 5px;
  background: var(--hud-ink);
  color: var(--hud-paper);
  font-family: var(--font-display);
  font-style: normal;
  font-size: 11px;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.cash-num, .carry-num {
  font-family: var(--font-display);
  line-height: 1;
  color: var(--money);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cash-num { font-size: 42px; padding-top: 5px; min-width: 3.2ch; }
/* rolling numbers: while a number counts up it swells a touch and glows green; counting down (paying) glows gold */
.cash-num, .carry-num, .carry-cap { display: inline-block; transform-origin: 0% 70%; transition: scale 0.12s ease-out, color 0.12s, text-shadow 0.12s; }
.roll-up { scale: 1.07; color: #3f8f35; text-shadow: 0 0 10px rgba(156, 220, 120, 0.95), 0 0 2px #fff; }
.carry-num.roll-up { scale: 1.035; }
.carry-txt { gap: 4px; }
.roll-down { color: #9a7428; text-shadow: 0 0 8px rgba(239, 210, 138, 0.9); }
.cash-carry.paying { background: rgba(239, 210, 138, 0.5); box-shadow: 0 0 0 2px var(--hud-gold-2); }
.cash-carry.cap-up .carry-bar { animation: cap-up 0.9s ease-out; }
@keyframes cap-up {
  0%   { box-shadow: 0 0 0 0 rgba(239, 210, 138, 0); }
  25%  { box-shadow: 0 0 0 4px rgba(239, 210, 138, 1), 0 0 18px 6px rgba(201, 154, 62, 0.8); transform: scaleY(1.5); }
  100% { box-shadow: 0 0 0 0 rgba(239, 210, 138, 0); }
}
.cash-carry {
  display: grid;
  grid-template-columns: 46px auto 1fr;
  grid-template-rows: auto 9px;
  column-gap: 8px; row-gap: 3px;
  align-items: end;
  padding-bottom: 3px;
}
.cash-carry .cash-ico { grid-row: 1 / span 2; grid-column: 1; align-self: center; }
.cash-carry .cash-ico svg { width: 36px; height: 36px; }
.carry-txt { grid-row: 1; grid-column: 2; display: flex; align-items: baseline; gap: 2px; white-space: nowrap; }
.carry-num { font-size: 29px; padding-top: 3px; }
.carry-cap { font-family: var(--font-display); font-size: 18px; line-height: 1; color: var(--muted-paper); font-variant-numeric: tabular-nums; }
.carry-full {
  grid-row: 1; grid-column: 3; justify-self: start; align-self: center;
  display: none;
  margin-left: 4px;
  padding: 3px 7px 0;
  border-radius: 6px;
  border: 2px solid var(--hud-ink);
  background: linear-gradient(#fbe7a8, var(--hud-gold));
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.05;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: badge-pop 0.9s ease-in-out infinite;
}
.carry-bar {
  grid-row: 2; grid-column: 2 / span 2;
  position: relative;
  min-width: 96px; height: 9px;
  box-sizing: border-box;
  border: 2px solid var(--hud-ink);
  border-radius: 5px;
  background: var(--hud-paper-3);
  overflow: hidden;
}
.carry-bar b { display: block; height: 100%; width: 0; background: linear-gradient(#b6dca3, var(--cash)); transition: width 0.12s linear; }
/* money states */
.cash-bank.hot { background: rgba(156, 196, 138, 0.45); box-shadow: 0 0 0 2px var(--money-hi), 0 0 18px 6px rgba(95, 143, 82, 0.55); }
.cash-bank.hint { animation: cash-hint 0.8s ease-in-out infinite; }
@keyframes cash-hint {
  0%, 100% { background: rgba(239, 210, 138, 0.25); box-shadow: 0 0 0 2px rgba(239, 210, 138, 0.8); }
  50%      { background: rgba(239, 210, 138, 0.7);  box-shadow: 0 0 0 3px var(--hud-gold), 0 0 18px 6px rgba(201, 154, 62, 0.7); }
}
.cash-bank.robbed { animation: cash-robbed 0.7s ease-out; }
@keyframes cash-robbed {
  0%   { background: rgba(217, 70, 59, 0.75); transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(5px); }
  60%  { transform: translateX(-3px); }
  100% { background: transparent; transform: translateX(0); }
}
.cash-bank.robbed .cash-num { color: #b3261e; }
.cash-carry.full { background: rgba(239, 210, 138, 0.55); }
.cash-carry.full .carry-full { display: inline-block; }
.cash-carry.full .carry-bar b { background: linear-gradient(#f9e39c, var(--hud-gold)); }
/* standing on a price box with $0 carried: the CARRY row shakes red */
.cash-carry.broke { animation: cash-broke 0.3s ease-in-out infinite; background: rgba(217, 70, 59, 0.18); box-shadow: 0 0 0 2px #d9463b; }
.cash-carry.broke .carry-num { color: #d9463b; }
@keyframes cash-broke { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ------------------------------------------------------------------ rank badge (top-centre) */
.hud-rank { position: absolute; top: calc(var(--top) + var(--rk-dy, 0px)); left: var(--rk-cx, 50%); transform: translateX(-50%); }
/* v0.6.4: the rank card + mute (+ chapter 2's ammo card and family strip, moved in by hud_ch2.js) share one box; on a
   computer / landscape it adds nothing (each child keeps its own absolute place); on phones upright it is the right
   column (below). --rk-cx / --rk-dy / --hp-y / --ts-y / --am-y are set by the layout guard (src/ui/hud.js fitHud) */
.hud-right { display: contents; }
.rank-in {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 5px 5px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--hud-ink);
  transform-origin: 30% 50%;
}
.hud-rank.celebrate .rank-in { animation: hud-glow 0.8s ease-in-out infinite; }
.rank-portrait {
  width: 58px; height: 58px; flex: none;
  border: 3px solid var(--hud-ink);
  border-radius: 9px;
  overflow: hidden;
  background: #261d18;
}
.rank-portrait svg { width: 100%; height: 100%; }
.rank-title {
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding-top: 3px;
  white-space: nowrap;
}
.rank-title.long { font-size: 22px; letter-spacing: 0.03em; }
.rank-bar { display: flex; gap: 3px; margin: 5px 0 5px; }
.rank-bar i {
  position: relative;
  width: 30px; height: 11px;
  border: 2px solid var(--hud-ink);
  border-radius: 6px;
  background: var(--hud-paper-3);
  overflow: hidden;
}
.rank-bar b {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(#f6dc8e, var(--hud-gold));
  transition: width 0.35s ease-out;
}
.rank-next { font-size: 12.5px; font-weight: 800; color: var(--muted-paper); white-space: nowrap; }
.rank-next.free { color: #b3261e; }
.rank-burst {
  position: absolute;
  left: -50px; top: -50px;
  width: 180px; height: 180px;
  opacity: 0;
  pointer-events: none;
}
.rank-burst svg { width: 100%; height: 100%; }

/* ------------------------------------------------------------------ mute (top-right) */
.hud-sq {
  position: absolute;
  top: var(--top); right: var(--right);
  width: 48px; height: 48px;
  padding: 0;
  display: grid; place-items: center;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--hud-ink);
}
.hud-sq.off { background: var(--hud-paper-3); }
.fb-hud .hud-sq:active, .fb-hud .hud-round:active, .fb-hud .big-btn:active, .fb-hud .panel-x:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--hud-ink);
}

/* ------------------------------------------------------------------ hp (under the rank badge) */
.hud-hp {
  position: absolute;
  top: var(--hp-y, calc(var(--top) + 84px));
  left: var(--rk-cx, 50%);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  opacity: 0;
  transition: opacity 0.25s;
}
.hud-hp.on { opacity: 1; }
.hp-heart { filter: drop-shadow(2px 2px 0 var(--hud-ink)); }
.hud-hp[data-tone="low"] .hp-heart { animation: hp-beat 0.5s ease-in-out infinite; }
@keyframes hp-beat { 50% { transform: scale(1.25); } }
.hp-bar {
  position: relative;
  width: 200px; height: 16px;
  background: #3a2a22;
  border: 3px solid var(--hud-ink);
  border-radius: 9px;
  overflow: hidden;
  box-shadow: 3px 3px 0 var(--hud-ink);
}
.hp-ghost, .hp-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; }
.hp-ghost { background: #f4eee1; }
.hp-fill { background: linear-gradient(#b6dca3, var(--cash)); }
.hud-hp[data-tone="mid"] .hp-fill { background: linear-gradient(#f6dc8e, var(--hud-gold)); }
.hud-hp[data-tone="low"] .hp-fill { background: linear-gradient(#e87466, var(--hud-blood)); }
.hp-ticks i { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: rgba(28, 20, 17, 0.45); }

/* ------------------------------------------------------------------ side buttons (left) */
.hud-side {
  position: relative;
  margin-top: 4px;
  display: flex; flex-direction: row; align-items: center;
  gap: 14px;
}
/* v0.6.4 the "?" guidebook button: next to FAMILY (under it on phones upright), a size smaller, a fat "?" */
.hud-round.hud-book { width: 56px; height: 56px; }
.hud-book .book-q {
  font-family: var(--font-display); font-size: 40px; line-height: 1; padding-top: 6px;
  color: var(--hud-ink); text-shadow: 2px 2px 0 rgba(239, 210, 138, 0.9);
}
.hud-book .round-lbl { font-size: 13px; bottom: -15px; }
/* v0.6.5 round 5 (spec_r5 A): the gold x2 button after the "?" (under it on phones upright) — the one entrance to the
   "income x2" card. The video badge is the button's own child (never inside the face: the face hops, the layout guard
   measures the button + its label + the badge, and nothing it measures ever moves) */
.hud-round.hud-x2 { width: 56px; height: 56px; background: radial-gradient(circle at 35% 28%, #fff4c6, var(--hud-gold-2) 45%, var(--hud-gold)); }
.hud-x2 .x2-face { display: grid; place-items: center; line-height: 1; }
.hud-x2 .x2-m { font-family: var(--font-display); font-weight: normal; font-size: 30px; line-height: 1; padding-top: 5px; letter-spacing: 0;
  color: var(--hud-ink); text-shadow: 2px 2px 0 rgba(255, 244, 198, 0.9); }
.hud-x2 .x2-vid { position: absolute; top: -7px; right: -9px; display: grid; place-items: center; width: 24px; height: 24px; box-sizing: border-box;
  border-radius: 50%; border: 2px solid var(--hud-ink); background: #fff4c6; font-style: normal; line-height: 0; pointer-events: none; }
.hud-x2 .x2-vid svg { width: 15px; height: 15px; }
.hud-x2 .round-lbl { font-size: 13px; bottom: -15px; }
/* money is short: it glows (box-shadow: the box does not grow) and the "×2" hops inside it */
.hud-round.hud-x2.short { animation: hud-glow 1.1s ease-in-out infinite; }
.hud-x2.short .x2-face { animation: x2-hop 1.1s ease-in-out infinite; }
@keyframes x2-hop {
  0%, 56%, 100% { transform: none; }
  18% { transform: translateY(-7px) scale(1.14) rotate(-7deg); }
  34% { transform: translateY(1px) scale(0.95); }
  45% { transform: translateY(-3px) scale(1.05) rotate(3deg); }
}
/* x2 / x3 running: a steady ring and "×2 ON" / "×3 ON" (no countdown — the pill under the money card has it) */
.hud-round.hud-x2.on { box-shadow: 4px 4px 0 var(--hud-ink), 0 0 0 3px rgba(255, 232, 160, 0.95), 0 0 14px 4px rgba(255, 196, 64, 0.7); }
.hud-round.hud-x2.on.x3 { background: radial-gradient(circle at 35% 28%, #ffd98a, #ff8a3a 55%, #e2442c);
  box-shadow: 4px 4px 0 var(--hud-ink), 0 0 0 3px rgba(255, 196, 120, 0.95), 0 0 16px 5px rgba(255, 90, 40, 0.75); }
.hud-x2.on.x3 .x2-m { color: #fff6e6; text-shadow: 0 2px 0 var(--hud-ink); }
.hud-x2.on .round-lbl { background: #8a5a10; }
.hud-x2.on.x3 .round-lbl { background: #b8401c; }
/* an ad blocker / no SDK (CrazyGames: never a rewarded button that does nothing): grey + a short line under it; a press only
   repeats that line as a toast */
.hud-round.hud-x2.off { background: radial-gradient(circle at 35% 28%, #f4efe6, #cfc6b8 60%, #a9a093); cursor: default; }
.hud-x2.off .x2-m { color: #7d7468; text-shadow: none; }
.hud-x2.off .x2-vid { background: #d8d0c4; border-color: #6f665b; }
.hud-x2.off .x2-vid svg { filter: grayscale(1); opacity: 0.7; }
.hud-x2.off .round-lbl { background: #6f665b; letter-spacing: 0.02em; }
.fb-hud .hud-round.hud-x2.off:active { transform: none; box-shadow: 4px 4px 0 var(--hud-ink); }
html[lang|="zh"] .hud-x2 .round-lbl { letter-spacing: 0; }
@media (prefers-reduced-motion: reduce) { .hud-round.hud-x2.short, .hud-x2.short .x2-face { animation: none; } }

/* ------------------------------------------------------------------ tribute chips (v0.4): streets that pay a family */
.hud-tribute { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.trib-chip {
  --fam: #a8322a;
  position: relative;
  display: flex; align-items: center; gap: 6px;
  padding: 2px 10px 0 4px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink);
  border-left: 9px solid var(--fam);
  border-radius: 9px;
  box-shadow: 3px 3px 0 var(--hud-ink);
  font-family: var(--font-display);
  line-height: 1.1;
  white-space: nowrap;
}
.trib-ico { display: grid; place-items: center; line-height: 0; margin-top: -2px; }
.trib-name { font-size: 17px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); padding-top: 1px; }
.trib-amt { font-weight: normal; font-size: 21px; color: #b3261e; font-variant-numeric: tabular-nums; padding-top: 1px; }
.trib-chip.paid { background: #f7d3cc; }
/* fixer v4: the invasion chip — red, and its background fills as the flag's capture bar fills */
.trib-chip.inv { --cap: 0; background: linear-gradient(90deg, #f3b3a8 calc(var(--cap) * 100%), var(--hud-paper) calc(var(--cap) * 100%)); animation: inv-chip 0.9s ease-in-out infinite alternate; }
.trib-chip.inv .trib-ico { font-size: 20px; color: #b3261e; width: 14px; line-height: 1; margin-top: 0; }
.trib-chip.inv .trib-amt { font-size: 17px; letter-spacing: 0.03em; text-transform: uppercase; }
@keyframes inv-chip { from { box-shadow: 3px 3px 0 var(--hud-ink); } to { box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 3px rgba(179, 38, 30, 0.45); } }
.trib-chip.norate .trib-amt { font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase; }
.trib-chip.paid .trib-amt { color: #fff; text-shadow: -1px -1px 0 #b3261e, 1px -1px 0 #b3261e, -1px 1px 0 #b3261e, 1px 1px 0 #b3261e; }
.hud-round {
  position: relative;
  width: 78px; height: 78px;
  padding: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 3px solid var(--hud-ink);
  background: radial-gradient(circle at 35% 28%, #fff8e6, var(--hud-paper) 55%, var(--hud-paper-3));
  box-shadow: 4px 4px 0 var(--hud-ink);
}
.hud-round.gold { background: radial-gradient(circle at 35% 28%, #fff4c6, var(--hud-gold-2) 45%, var(--hud-gold)); }
.hud-round.lit, .hud-round.news { animation: hud-glow 1.3s ease-in-out infinite; }
.hud-round.active { background: radial-gradient(circle at 35% 28%, #fff, var(--hud-gold-2)); }
.round-in { display: block; line-height: 0; }
.round-lbl {
  position: absolute;
  bottom: -17px; left: 50%;
  transform: translateX(-50%);
  padding: 2px 7px 0;
  border-radius: 6px;
  background: var(--hud-ink);
  color: var(--hud-paper);
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.hud-badge {
  position: absolute;
  top: -6px; right: -8px;
  min-width: 28px; height: 28px;
  padding: 0 6px;
  box-sizing: border-box;
  display: grid; place-items: center;
  border-radius: 14px;
  border: 3px solid var(--hud-ink);
  background: var(--cash);
  color: #fff8e6;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
  padding-top: 3px;
  animation: badge-pop 0.9s ease-in-out infinite;
}
.hud-badge.ink { background: var(--hud-ink); color: var(--hud-gold-2); border-color: var(--hud-paper); animation: none; }
@keyframes badge-pop { 50% { transform: scale(1.18); } }

/* ------------------------------------------------------------------ panels */
.hud-panel {
  position: absolute;
  left: calc(var(--left) + 104px);
  top: calc(var(--top) + 128px);
  width: 372px;
  max-height: calc(100% - var(--top) - 128px - var(--bottom));
  display: flex; flex-direction: column;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink);
  border-radius: 14px;
  box-shadow: 6px 6px 0 var(--hud-ink);
  overflow: hidden;
  touch-action: pan-y;
}
.hud-panel.tree { width: 492px; top: calc(var(--top) + 128px); max-height: calc(100% - var(--top) - 128px - var(--bottom)); }
.panel-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 6px 16px;
  background: var(--hud-ink);
  color: var(--hud-gold-2);
}
.panel-head h2 {
  margin: 0;
  padding-top: 4px;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: normal;
}
.panel-x {
  width: 42px; height: 42px;
  padding: 0;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 3px solid var(--hud-paper);
  background: var(--hud-paper);
  box-shadow: 2px 2px 0 #000;
}
.panel-body { flex: 1 1 auto; min-height: 0; padding: 6px 12px 12px; }   /* v0.6.4: scrolls with .fb-scroll (the panel itself never does) */

/* family tree */
.tree-you { display: flex; align-items: center; gap: 14px; padding: 10px 0 0 6px; }
.tree-you-txt { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.tree-you-name { font-family: var(--font-display); font-size: 30px; line-height: 1; letter-spacing: 0.05em; text-transform: uppercase; }
.tree-you-rank {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
  padding: 4px 12px 1px;
  border-radius: 7px;
  background: var(--hud-gold-2);
  border: 2.5px solid var(--hud-ink);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.tree-trunk { position: relative; margin: 2px 0 0 26px; padding: 6px 0 2px 18px; border-left: 3px solid var(--hud-ink); }
.tree-branch { position: relative; margin: 8px 0 12px; }
.tree-branch::before { content: ''; position: absolute; left: -18px; top: 12px; width: 14px; border-top: 3px solid var(--hud-ink); }
.tree-branch:last-child::after { content: ''; position: absolute; left: -21px; top: 15px; bottom: -14px; width: 6px; background: var(--hud-paper); }
.tree-head { display: flex; align-items: center; gap: 6px; }
.tree-head span {
  display: inline-block;
  padding: 3px 10px 0;
  border-radius: 6px;
  background: var(--hud-ink);
  color: var(--hud-gold-2);
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.tree-head em { font-style: normal; font-family: var(--font-display); font-size: 20px; color: var(--muted-paper); padding-top: 3px; }
.tree-branch.crew .tree-head span { background: var(--hud-blood); color: #fff1dc; }
.tree-branch.crew .tree-group { min-width: 150px; }
.tree-branch.crew .tree-group.fighters { border-color: rgba(142, 42, 36, 0.55); }
.tree-branch.crew .tree-group.runners { border-color: rgba(95, 143, 82, 0.7); }
.tree-pays {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px 0 4px;
  border: 2px solid var(--hud-ink); border-left: 7px solid var(--fam, var(--hud-blood));
  border-radius: 6px;
  background: #f7d3cc;
  font-family: var(--font-display); font-weight: normal; font-size: 14px; letter-spacing: 0.05em; text-transform: uppercase;
  color: #b3261e; white-space: nowrap;
}
.tree-branch.vassal .tree-head span { box-shadow: inset 0 -4px 0 var(--fam, var(--hud-blood)); }
.tree-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 8px; margin-top: 8px; }
.tree-none { align-self: center; font-size: 14px; font-weight: 700; color: var(--muted-paper); padding: 0 4px 18px; }
.tt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 44px; }
.tt-face {
  position: relative;
  line-height: 0;
  border: 2.5px solid var(--hud-ink);
  border-radius: 9px;
  background: #261d18;
  box-shadow: 2px 2px 0 var(--hud-ink);
}
.tt-face > svg { border-radius: 6px; }
.tt.you .tt-face { border-width: 3px; box-shadow: 0 0 0 3px var(--hud-gold-2), 4px 4px 0 3px var(--hud-ink); }
.tt.capo .tt-face { box-shadow: 0 0 0 3px var(--hud-gold), 3px 3px 0 3px var(--hud-ink); }
.tt.empty .tt-face { opacity: 0.6; box-shadow: none; border-style: dashed; }
.tt.you, .tt.capo { gap: 9px; }
.tt-lbl { font-family: var(--font-display); font-size: 16px; font-weight: normal; line-height: 1; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.tt-badge {
  position: absolute;
  right: -9px; top: -9px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--hud-ink);
  background: var(--hud-paper);
}
/* gun chip on every person: fist = no gun, then pistol / shotgun / tommy (warmer chip = better gun) */
.tt-gun {
  position: absolute;
  right: -10px; bottom: -8px;
  width: 30px; height: 22px;
  display: grid; place-items: center;
  box-sizing: border-box;
  border-radius: 7px;
  border: 2px solid var(--hud-ink);
  background: var(--hud-paper);
  box-shadow: 1px 1px 0 var(--hud-ink);
}
.tt-gun svg { width: 22px; height: 22px; }
.tt-gun.g-none { background: var(--hud-paper-3); }
.tt-gun.g-knife { background: #e8e2d6; }
.tt-gun.g-bag { background: #d8ecc8; }
.tt-gun.g-bag svg { width: 18px; height: 18px; }
.tt-gun.g-shotgun { background: #f3dfb0; }
.tt-gun.g-tommy { background: linear-gradient(#fbe7a8, var(--hud-gold)); }
.tt.you .tt-gun { width: 40px; height: 30px; right: -14px; bottom: -10px; border-radius: 9px; }
.tt.you .tt-gun svg { width: 30px; height: 30px; }
.tt.small { margin: 0 8px 6px 0; }
.tree-group {
  display: flex; flex-direction: column; gap: 4px;
  padding: 3px 6px 4px;
  border: 2px dashed rgba(28, 20, 17, 0.3);
  border-radius: 10px;
  min-width: 70px;
}
.tg-head { display: flex; align-items: baseline; gap: 6px; }
.tg-ico { display: grid; place-items: center; line-height: 0; font-style: normal; align-self: center; }
.tg-head span { font-family: var(--font-display); font-size: 15px; line-height: 1.1; letter-spacing: 0.06em; text-transform: uppercase; padding-top: 2px; }
.tg-head em { font-style: normal; font-family: var(--font-display); font-size: 15px; color: var(--muted-paper); font-variant-numeric: tabular-nums; }
.tg-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 2px; }
.tree-group .tree-none { padding: 2px 2px 6px; font-size: 12.5px; }
.tt-more { align-self: center; font-family: var(--font-display); font-size: 18px; color: var(--muted-paper); padding: 0 6px 8px 0; }

/* ------------------------------------------------------------------ big alert */
.hud-alert {
  position: absolute;
  top: 24%;
  left: 50%;
  transform: translate(-50%, 0);
  width: max-content;
  max-width: 96vw;
  pointer-events: none;
}
.alert-in { position: relative; display: flex; flex-direction: column; align-items: center; opacity: 0; }
.alert-band {
  position: absolute;
  z-index: -1;
  left: -34px; right: -34px;
  top: 2px; height: 82px;
  border: 3px solid var(--hud-ink);
  box-shadow: 6px 6px 0 var(--hud-ink);
  background: repeating-linear-gradient(-45deg, #251a15 0 18px, #3a2a22 18px 36px);
  transform: scaleX(0);
}
.hud-alert[data-tone="danger"] .alert-band { background: repeating-linear-gradient(-45deg, var(--hud-blood) 0 18px, #6b1d18 18px 36px); }
.hud-alert[data-tone="cash"] .alert-band { background: repeating-linear-gradient(-45deg, var(--cash) 0 18px, #4d7a42 18px 36px); }
/* INVASION! / TAKEN!: stripes in the attacking family's colour, darkened every other stripe */
.hud-alert[data-tone="invade"] .alert-band {
  background: repeating-linear-gradient(-45deg, var(--fam, var(--hud-blood)) 0 18px, color-mix(in srgb, var(--fam, var(--hud-blood)) 62%, #000) 18px 36px);
}
.hud-alert[data-tone="invade"][data-fam="f4"] .alert-band { border-color: #c8ccd2; box-shadow: 6px 6px 0 var(--hud-ink), 0 0 0 3px var(--hud-ink); }
.hud-alert[data-tone="invade"] .alert-main { color: #fff3de; }
.hud-alert[data-tone="invade"] .alert-sub { background: var(--hud-paper); border-left: 10px solid var(--fam, var(--hud-blood)); }
.alert-main {
  padding: 8px 20px 0;
  font-family: var(--font-display);
  font-size: 78px;
  line-height: 1;
  letter-spacing: 0.05em;
  white-space: nowrap;
  color: var(--hud-gold-2);
  position: relative;
}
/* ink outline + hard shadow drawn by a stroked copy of the text underneath (crisp at any DPR) */
.alert-main::before, .hud-float::before {
  content: attr(data-text);
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  padding: inherit;
  z-index: -1;
  color: var(--hud-ink);
  -webkit-text-stroke: 9px var(--hud-ink);
  text-shadow: 5px 6px 0 var(--hud-ink);
}
.hud-alert[data-tone="danger"] .alert-main, .hud-alert[data-tone="cash"] .alert-main { color: #fff3de; }
.hud-alert[data-tone="cash"] .alert-main { color: #f9e39c; }
.alert-sub {
  margin-top: 12px;
  padding: 4px 14px 1px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--hud-ink);
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ street banner + toasts (stacked under the rank badge) */
.hud-topstack {
  position: absolute;
  top: var(--ts-y, calc(var(--top) + 118px));
  left: var(--rk-cx, 50%);
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.hud-toasts { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hud-street { --fam: var(--hud-gold); }
.hud-street[data-owner="f1"] { --fam: #a8322a; }
.hud-street[data-owner="f2"] { --fam: #6c4aa0; }
.hud-street[data-owner="f3"] { --fam: #c8652a; }
.hud-street[data-owner="f4"] { --fam: #34343a; }
.hud-street.vassal .street-sub { background: #f7d3cc; color: #b3261e; }
.street-in { display: flex; flex-direction: column; align-items: center; transform-origin: 50% 0; opacity: 0; }
.street-plate {
  position: relative;
  padding: 7px 22px 2px;
  background: #2f6f47;
  border: 3px solid var(--hud-ink);
  border-radius: 9px;
  box-shadow: inset 0 0 0 2px #f4eee1, inset 0 0 0 4px #2f6f47, 4px 4px 0 var(--hud-ink);
}
.street-plate::before, .street-plate::after {
  /* the two bolts */
  content: ''; position: absolute; top: 50%; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: #cfd6cf; border: 1.5px solid var(--hud-ink);
}
.street-plate::before { left: 8px; }
.street-plate::after { right: 8px; }
.street-name {
  display: block;
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #f7f3e6;
  text-shadow: 2px 2px 0 rgba(20, 40, 28, 0.6);
}
.street-sub {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px;
  padding: 3px 11px 1px 7px;
  background: var(--hud-paper);
  border: 2.5px solid var(--hud-ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--hud-ink);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.street-sub::before { content: ''; width: 11px; height: 11px; margin-top: -2px; border-radius: 50%; background: var(--fam); border: 2px solid var(--hud-ink); }
.hud-street[data-owner="f4"] .street-sub::before { box-shadow: inset 0 0 0 2px #c8ccd2; }
.hud-toast {
  padding: 4px 16px 1px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--hud-ink);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.hud-toast.gold { background: linear-gradient(#fbe7a8, #e6bf68); }
.hud-toast.danger { background: var(--hud-blood); color: #fff3de; }


/* ------------------------------------------------------------------ flying coins / floaters / vignette */
.hud-fly { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fly-coin { position: absolute; left: 0; top: 0; margin: -12px 0 0 -12px; will-change: transform; filter: drop-shadow(2px 2px 0 rgba(28, 20, 17, 0.6)); }
.hud-float {
  position: absolute; left: 0; top: 0;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 38px;
  line-height: 1;
  white-space: nowrap;
  color: #c6f0a8;
}
.hud-float::before { -webkit-text-stroke: 8px var(--hud-ink); text-shadow: 3px 4px 0 var(--hud-ink); }
.hud-float > span { position: relative; }
.hud-float.deny { color: #ff6b5e; font-size: 44px; }
.hud-float.loss { color: #ff7b6e; }
.hud-float.small { font-size: 30px; }
/* the live "+$X" (grows while money keeps coming): tier 1 green .. tier 4 = a full bag, gold with a glow */
.hud-float.live { will-change: transform; }
.hud-float.live > span { display: inline-block; }
.hud-float.live[data-tier="2"] { color: #d9ffb8; }
.hud-float.live[data-tier="3"] { color: #fbe7a8; }
.hud-float.live[data-tier="4"] { color: #ffe27a; }
.hud-float.live[data-tier="4"] > span { text-shadow: 0 0 10px rgba(255, 214, 90, 0.85); }
.fly-coin.rain { margin: -17px 0 0 -17px; z-index: 1; }
.hud-vignette {
  position: absolute; inset: 0;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(142, 42, 36, 0) 52%, rgba(142, 42, 36, 0.5) 82%, rgba(92, 20, 16, 0.9) 100%);
}

/* ------------------------------------------------------------------ modals: offline + end */
.hud-modal {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(20, 14, 11, 0.58);
  pointer-events: auto;
  z-index: 5;
  touch-action: none;
}
.modal-card {
  position: relative;
  box-sizing: border-box;
  width: min(360px, calc(100vw - 36px));
  padding: 20px 20px 22px;
  text-align: center;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink);
  border-radius: 16px;
  box-shadow: 8px 8px 0 var(--hud-ink);
}
.off-portrait { display: flex; justify-content: center; }
.off-portrait svg, .end-portrait svg { border: 3px solid var(--hud-ink); border-radius: 12px; }
.off-title { margin: 10px 0 2px; font-family: var(--font-display); font-size: 36px; line-height: 1; font-weight: normal; letter-spacing: 0.05em; text-transform: uppercase; }
.off-body { font-size: 16px; font-weight: 700; color: var(--muted-paper); }
.off-where { display: flex; align-items: center; justify-content: center; gap: 6px; margin: -8px 0 16px; font-size: 14px; font-weight: 800; color: var(--muted-paper); }
.off-where em { font-style: normal; }
.off-amount { margin: 6px 0 16px; font-family: var(--font-display); font-size: 68px; line-height: 1; color: var(--money); font-variant-numeric: tabular-nums; }
.big-btn {
  min-width: 210px; height: 64px;
  padding: 5px 22px 0;
  border-radius: 14px;
  border: 3px solid var(--hud-ink);
  box-shadow: 4px 4px 0 var(--hud-ink);
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.big-btn.gold { background: linear-gradient(#f9e39c, var(--hud-gold)); animation: hud-glow 1.3s ease-in-out infinite; }
.hud-modal.end { background: radial-gradient(ellipse at center, rgba(40, 28, 20, 0.5), rgba(14, 10, 8, 0.85)); }
.end .modal-card { width: min(420px, calc(100vw - 32px)); padding-top: 34px; }
.end-rain { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.end-crown { position: absolute; top: -40px; left: 50%; transform: translateX(-50%) rotate(-8deg); filter: drop-shadow(3px 3px 0 var(--hud-ink)); }
.end-portrait { display: flex; justify-content: center; }
.end-portrait svg { box-shadow: 0 0 0 4px var(--hud-gold-2); }
.end-rank {
  display: inline-block;
  margin: -4px 0 14px;
  padding: 4px 14px 1px;
  border-radius: 8px;
  background: var(--hud-gold-2);
  border: 2.5px solid var(--hud-ink);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.end-title { margin: 14px 0 12px; font-family: var(--font-display); font-size: 54px; line-height: 0.95; font-weight: normal; letter-spacing: 0.04em; }
.end-stats { display: flex; justify-content: center; gap: 8px; margin-bottom: 18px; }
.end-stats > div { flex: 1 1 0; min-width: 0; max-width: 118px; padding: 6px 8px 4px; background: var(--hud-paper-2); border: 3px solid var(--hud-ink); border-radius: 10px; }
.end-k { display: block; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-paper); }
.end-v { display: block; font-family: var(--font-display); font-size: 36px; line-height: 1.05; font-weight: normal; }
.cash-text { color: var(--money); }

/* ------------------------------------------------------------------ onboarding hand */
.onb {
  position: absolute;
  left: 50%; top: 67%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s;
}
.onb.on { opacity: 1; }
.onb-stage { position: relative; width: 0; height: 0; --dx: 0px; --dy: -50px; }
.onb-base {
  position: absolute; left: -52px; top: -52px;
  width: 104px; height: 104px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 3px solid rgba(28, 20, 17, 0.8);
  background: rgba(239, 228, 207, 0.35);
  opacity: 0;
}
.onb-knob {
  position: absolute; left: -22px; top: -22px;
  width: 44px; height: 44px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 3px solid var(--hud-ink);
  background: radial-gradient(circle at 35% 30%, #fff6dc, var(--hud-gold-2) 55%, var(--hud-gold));
  opacity: 0;
}
.onb-hand { position: absolute; left: -24.75px; top: -3.4px; width: 72px; height: 72px; transform-origin: 34% 5%; opacity: 0; filter: drop-shadow(3px 4px 0 rgba(28, 20, 17, 0.45)); }
.onb-stage.run .onb-hand { animation: onb-hand 2.2s ease-in-out infinite; }
.onb-stage.run .onb-knob { animation: onb-knob 2.2s ease-in-out infinite; }
.onb-stage.run .onb-base { animation: onb-base 2.2s ease-in-out infinite; }
@keyframes onb-hand {
  0%       { transform: translate(22px, 30px) scale(1.12); opacity: 0; }
  12%      { transform: translate(0, 0) scale(1.1); opacity: 1; }
  22%      { transform: translate(0, 0) scale(0.94); opacity: 1; }
  62%      { transform: translate(var(--dx), var(--dy)) scale(0.94); opacity: 1; }
  74%      { transform: translate(var(--dx), var(--dy)) scale(1.08); opacity: 1; }
  88%,100% { transform: translate(var(--dx), var(--dy)) scale(1.08); opacity: 0; }
}
@keyframes onb-knob {
  0%, 18%  { transform: translate(0, 0) scale(0.6); opacity: 0; }
  24%      { transform: translate(0, 0) scale(1); opacity: 1; }
  62%, 74% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 1; }
  86%,100% { transform: translate(0, 0) scale(1); opacity: 0; }
}
@keyframes onb-base {
  0%, 18%  { transform: scale(0.6); opacity: 0; }
  24%, 74% { transform: scale(1); opacity: 1; }
  88%,100% { transform: scale(1); opacity: 0; }
}
.onb-label {
  margin-top: 84px;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 14px 3px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--hud-ink);
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
/* v0.4.3 desktop: ONLY the W A S D keycaps (inverted T) under the hero; no hand, no text (src/ui/onboarding.js 'keys') */
.onb.keys .onb-keys {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: 44px 44px;
  gap: 6px;
  margin-top: 40px;
}
.onb.keys kbd {
  display: grid; place-items: center;
  padding-top: 4px;
  box-sizing: border-box;
  border: 3px solid var(--hud-ink);
  border-radius: 9px;
  background: #fff8e6;
  box-shadow: 2px 3px 0 var(--hud-ink);
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  color: var(--hud-ink);
}
.onb.keys .k-w { grid-column: 2; grid-row: 1; }
.onb.keys .k-a { grid-column: 1; grid-row: 2; }
.onb.keys .k-s { grid-column: 2; grid-row: 2; }
.onb.keys .k-d { grid-column: 3; grid-row: 2; }
/* not moved 5 s after the hint showed: the keys hop in turn with a gold glow (repeats every 3 s until the first move) */
.onb-keys.flash kbd { animation: onb-key-flash 1.1s ease-out both; }
.onb-keys.flash .k-a { animation-delay: 0.1s; }
.onb-keys.flash .k-s { animation-delay: 0.2s; }
.onb-keys.flash .k-d { animation-delay: 0.3s; }
@keyframes onb-key-flash {
  0%       { transform: none; }
  16%      { transform: translateY(-10px) scale(1.14); background: #ffd75e; box-shadow: 2px 3px 0 var(--hud-ink), 0 0 16px 6px rgba(255, 206, 64, 0.9); }
  34%      { transform: translateY(2px) scale(0.95); background: #ffd75e; box-shadow: 1px 1px 0 var(--hud-ink), 0 0 12px 4px rgba(255, 206, 64, 0.7); }
  52%      { transform: translateY(-3px) scale(1.04); }
  72%,100% { transform: none; }
}

/* ------------------------------------------------------------------ joystick (src/ui/input.js) */
#joystick { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 30; pointer-events: none; opacity: 0; transition: opacity 0.1s; }
#joystick.on { opacity: 1; }
#joystick .joy-base {
  position: absolute; left: -56px; top: -56px;
  width: 112px; height: 112px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 3px solid rgba(28, 20, 17, 0.75);
  background: rgba(239, 228, 207, 0.28);
  box-shadow: inset 0 0 0 6px rgba(239, 228, 207, 0.3);
}
#joystick .joy-knob {
  position: absolute; left: -25px; top: -25px;
  width: 50px; height: 50px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 3px solid var(--hud-ink);
  background: radial-gradient(circle at 35% 30%, #fff6dc, var(--hud-gold-2) 55%, var(--hud-gold));
  box-shadow: 2px 3px 0 var(--hud-ink);
}

/* ------------------------------------------------------------------ phone portrait */
@media (max-width: 600px) {
  .fb-hud { --pad: 10px; }
  /* money card stays top-left, compact */
  .cash-in { padding: 3px 9px 5px 4px; gap: 2px; border-radius: 12px; }
  .cash-row { gap: 5px; padding: 1px 4px 1px 1px; }
  .cash-ico { width: 34px; }
  .cash-bank .cash-ico svg { width: 31px; height: 31px; }
  .cash-tag { font-size: 9px; padding: 1px 4px 0; bottom: -4px; }
  .cash-num { font-size: 31px; padding-top: 4px; min-width: 2.6ch; }
  .cash-carry { grid-template-columns: 34px auto 1fr; column-gap: 5px; row-gap: 2px; grid-template-rows: auto 8px; }
  .cash-carry .cash-ico svg { width: 27px; height: 27px; }
  .carry-num { font-size: 22px; padding-top: 2px; }
  .carry-cap { font-size: 14px; }
  .carry-bar { min-width: 70px; height: 8px; }
  .carry-full { font-size: 11px; padding: 2px 5px 0; margin-left: 2px; }

  /* rank badge moves to the top-right. v0.6.4: the right column (.hud-right) = rank card, (ch2) ammo card, mute,
     (ch2) family strip — stacked 8 px apart, so a rank card that grows (a 3-line "Next:", a wider font) pushes the rest
     down instead of running into the mute button (was: mute at a fixed top + 80 px). Layout guard: --rk-dy drops it */
  .hud-right {
    position: absolute; top: calc(var(--top) + var(--rk-dy, 0px)); right: var(--right);
    display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none;
  }
  .hud-right > .hud-rank, .hud-right > .hud-sq, .hud-right > .c2-ammo, .hud-right > .c2-fams { position: relative; top: auto; left: auto; right: auto; transform: none; }
  .hud-right > .c2-fams { margin-top: 10px; }   /* (its status badges hang 9 px above the first card) */
  .hud-rank { left: auto; right: var(--right); transform: none; }
  .rank-in { gap: 6px; padding: 3px 8px 3px 3px; border-radius: 11px; }
  .rank-portrait { width: 44px; height: 44px; border-width: 2.5px; border-radius: 8px; }
  .rank-title { font-size: 20px; }
  .rank-title.long { font-size: 15px; }
  .rank-bar { margin: 3px 0 3px; gap: 2px; }
  .rank-bar i { width: 19px; height: 9px; }
  .rank-next { font-size: 10.5px; line-height: 1.12; max-width: 118px; white-space: normal; }   /* wraps to 2 lines */
  .rank-burst { left: -54px; top: -54px; width: 160px; height: 160px; }

  .hud-sq { width: 42px; height: 42px; border-radius: 11px; }
  .hud-sq svg { width: 22px; height: 22px; }

  .hud-hp { top: var(--hp-y, calc(var(--top) + 98px)); left: 50%; }
  /* (v0.6.4) narrower on small phones: the bar stays clear of the FAMILY / ? column (320 wide: 100 px) */
  .hp-bar { width: clamp(96px, calc(100vw - 220px), 150px); height: 14px; }
  /* (integrator) phones upright: the HP bar under the rank card reaches the left column at chip height, so the
     tribute chips go BELOW the Family button there (money card, Family, chips) */
  .hud-side { order: 1; }
  .hud-tribute { order: 2; margin-top: 12px; }   /* (v0.6.4: 4 -> 12 px, clear of the "?" label above) */

  .hud-left { gap: 6px; }
  .hud-side { flex-direction: column; gap: 28px; margin-top: 2px; }
  .hud-round.hud-book { width: 46px; height: 46px; }
  .hud-book .book-q { font-size: 32px; padding-top: 5px; }
  .hud-book .round-lbl { font-size: 12px; bottom: -14px; }
  .hud-round.hud-x2 { width: 46px; height: 46px; }   /* (round 5: under the "?") */
  .hud-x2 .x2-m { font-size: 25px; padding-top: 4px; }
  .hud-x2 .x2-vid { width: 20px; height: 20px; top: -6px; right: -8px; }
  .hud-x2 .x2-vid svg { width: 12px; height: 12px; }
  .hud-x2 .round-lbl { font-size: 12px; bottom: -14px; }
  .trib-chip { gap: 4px; padding: 1px 7px 0 3px; border-width: 2.5px; border-left-width: 7px; border-radius: 8px; }
  .trib-ico svg { width: 16px; height: 16px; }
  .trib-name { font-size: 13px; }
  .trib-amt { font-size: 16px; }
  .hud-round { width: 62px; height: 62px; }
  .hud-round .round-in svg { width: 36px; height: 36px; }
  .round-lbl { font-size: 13px; bottom: -15px; }
  .hud-badge { min-width: 24px; height: 24px; font-size: 17px; top: -6px; right: -7px; border-width: 2.5px; }

  .hud-panel, .hud-panel.tree {
    left: 8px; right: 8px; top: auto;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    width: auto;
    max-height: min(46%, var(--sheet-max, 46%));   /* (round 5 review: --sheet-max from hud.js placePanel — its top stays 10 px under the side buttons) */
    border-radius: 16px;
  }
  .panel-head h2 { font-size: 26px; }
  .tree-trunk { margin-left: 30px; }

  .hud-alert { top: 31%; }
  .alert-main { font-size: 54px; padding: 6px 14px 0; }
  .alert-band { height: 60px; left: -12px; right: -12px; }
  .alert-sub { font-size: 21px; margin-top: 10px; }

  .hud-topstack { top: var(--ts-y, calc(var(--top) + 128px)); left: 50%; }
  .street-name { font-size: 28px; }
  .street-plate { padding: 6px 20px 1px; }
  .street-sub { font-size: 14px; }
  .hud-toast { font-size: 19px; }
  .hud-float { font-size: 32px; }
  .hud-float.small { font-size: 26px; }

  .off-amount { font-size: 58px; }
  .end-title { font-size: 46px; }
  .end-v { font-size: 30px; }
  .onb { top: 68%; }
  .onb-label { font-size: 21px; }
}

/* short landscape phones */
@media (max-height: 460px) and (min-width: 601px) {
  .fb-hud { --pad: 8px; }
  .cash-in { padding: 3px 10px 4px 4px; gap: 1px; }
  .cash-ico { width: 36px; }
  .cash-bank .cash-ico svg { width: 30px; height: 30px; }
  .cash-num { font-size: 30px; }
  .cash-carry { grid-template-columns: 36px auto 1fr; grid-template-rows: auto 7px; }
  .cash-carry .cash-ico svg { width: 26px; height: 26px; }
  .carry-num { font-size: 21px; }
  .carry-cap { font-size: 14px; }
  .carry-bar { height: 7px; min-width: 80px; }
  .rank-in { padding: 3px 10px 3px 3px; gap: 7px; }
  .rank-portrait { width: 40px; height: 40px; }
  .rank-title { font-size: 19px; padding-top: 2px; }
  .rank-title.long { font-size: 16px; }
  .rank-bar { margin: 2px 0 2px; }
  .rank-bar i { width: 22px; height: 7px; }
  .rank-next { font-size: 10.5px; }
  .hud-left { gap: 5px; }
  .hud-side { gap: 22px; margin-top: 0; }
  .trib-chip { padding: 0 7px 0 3px; }
  .trib-name { font-size: 13px; }
  .trib-amt { font-size: 16px; }
  .hud-round { width: 52px; height: 52px; }
  .hud-round .round-in svg { width: 32px; height: 32px; }
  .round-lbl { font-size: 13px; letter-spacing: 0.05em; bottom: -15px; }
  .hud-round.hud-book { width: 44px; height: 44px; }
  .hud-book .book-q { font-size: 30px; padding-top: 5px; }
  .hud-book .round-lbl { font-size: 12px; bottom: -14px; }
  .hud-round.hud-x2 { width: 44px; height: 44px; }   /* (round 5) */
  .hud-x2 .x2-m { font-size: 24px; padding-top: 4px; }
  .hud-x2 .x2-vid { width: 20px; height: 20px; top: -6px; right: -8px; }
  .hud-x2 .x2-vid svg { width: 12px; height: 12px; }
  .hud-x2 .round-lbl { font-size: 12px; bottom: -14px; }
  .hud-hp { top: var(--hp-y, calc(var(--top) + 60px)); }
  .hp-bar { height: 13px; }
  /* (v0.6.4: only the panel's body scrolls — the panel itself used to scroll too, two scrollbars) */
  .hud-panel, .hud-panel.tree { top: calc(var(--top) + 64px); max-height: calc(100% - var(--top) - 64px - var(--bottom)); left: calc(var(--left) + 76px); }
  .hud-alert { top: 25%; }
  .alert-main { font-size: 52px; }
  .alert-band { height: 58px; }
  .hud-topstack { top: var(--ts-y, calc(var(--top) + 86px)); gap: 4px; }
  .street-name { font-size: 26px; }
}

/* v0.6.5 round 5: a short landscape phone this narrow (568 x 320) — with the x2 button the FAMILY / ? / x2 column ran off the
   bottom (x2 at y 304-361 of 320): the three go in a row, as on wider landscape screens. Only while the x2 button shows
   (chapter 1 after the tutorial: .has-x2 from hud.js) — chapter 2 and the tutorial keep the column */
@media (max-width: 600px) and (max-height: 460px) {
  .hud-side.has-x2 { flex-direction: row; gap: 14px; margin-top: 2px; }
}

/* very small phones (320 px): the money card and the rank badge must not touch */
@media (max-width: 360px) {
  .cash-in { padding: 2px 6px 4px 3px; }
  .cash-ico { width: 28px; }
  .cash-bank .cash-ico svg { width: 26px; height: 26px; }
  .cash-num { font-size: 25px; }
  .cash-carry { grid-template-columns: 28px auto 1fr; }
  .cash-carry .cash-ico svg { width: 22px; height: 22px; }
  .carry-num { font-size: 18px; }
  .carry-cap { font-size: 12px; }
  .carry-bar { min-width: 56px; }
  .rank-in { gap: 4px; padding: 2px 6px 2px 2px; }
  .rank-portrait { width: 36px; height: 36px; }
  .rank-title { font-size: 16px; }
  .rank-title.long { font-size: 12.5px; }
  .rank-bar i { width: 15px; height: 8px; }
  .rank-next { font-size: 9.5px; max-width: 92px; }
}

/* ------------------------------------------------------------------ v0.6.4 HUD layout guard (src/ui/hud.js fitHud)
   It measures the top HUD and picks the first level where nothing touches (6 px apart): phones upright
   0 as is · 1 .fit-tight (the 320-px sizes for the money + rank cards) · 2 + --rk-dy (the right column drops below the money
   card) · 3 + .fit-nosq (chapter 2: the ammo card's squad line folds away) · 4 + .fit-min (last resort: the rank card keeps its
   face + bar); computer / landscape
   0 as is · 1 .fit-tight (the short-landscape sizes) · 2 + --rk-cx (the rank card, with the HP bar / banners / ammo under it,
   moves right of the money card) · 3 + .fit-nosq (chapter 2: the ammo card's squad line folds away) · 4 + --rk-dy (that
   column drops below the money card) */
@media (max-width: 600px) {
  .fb-hud.fit-tight .cash-in { padding: 2px 6px 4px 3px; }
  .fb-hud.fit-tight .cash-ico { width: 28px; }
  .fb-hud.fit-tight .cash-bank .cash-ico svg { width: 26px; height: 26px; }
  .fb-hud.fit-tight .cash-num { font-size: 25px; }
  .fb-hud.fit-tight .cash-carry { grid-template-columns: 28px auto 1fr; }
  .fb-hud.fit-tight .cash-carry .cash-ico svg { width: 22px; height: 22px; }
  .fb-hud.fit-tight .carry-num { font-size: 18px; }
  .fb-hud.fit-tight .carry-cap { font-size: 12px; }
  .fb-hud.fit-tight .carry-bar { min-width: 56px; }
  .fb-hud.fit-tight .rank-in { gap: 4px; padding: 2px 6px 2px 2px; }
  .fb-hud.fit-tight .rank-portrait { width: 36px; height: 36px; }
  .fb-hud.fit-tight .rank-title { font-size: 16px; }
  .fb-hud.fit-tight .rank-title.long { font-size: 12.5px; }
  .fb-hud.fit-tight .rank-bar i { width: 15px; height: 8px; }
  .fb-hud.fit-tight .rank-next { font-size: 9.5px; max-width: 92px; }
}
@media (min-width: 601px) {
  .fb-hud.fit-tight .cash-in { padding: 3px 10px 4px 4px; gap: 1px; }
  .fb-hud.fit-tight .cash-ico { width: 36px; }
  .fb-hud.fit-tight .cash-bank .cash-ico svg { width: 30px; height: 30px; }
  .fb-hud.fit-tight .cash-num { font-size: 30px; }
  .fb-hud.fit-tight .cash-carry { grid-template-columns: 36px auto 1fr; grid-template-rows: auto 7px; }
  .fb-hud.fit-tight .cash-carry .cash-ico svg { width: 26px; height: 26px; }
  .fb-hud.fit-tight .carry-num { font-size: 21px; }
  .fb-hud.fit-tight .carry-cap { font-size: 14px; }
  .fb-hud.fit-tight .carry-bar { height: 7px; min-width: 80px; }
  .fb-hud.fit-tight .rank-in { padding: 3px 10px 3px 3px; gap: 7px; }
  .fb-hud.fit-tight .rank-portrait { width: 40px; height: 40px; }
  .fb-hud.fit-tight .rank-title { font-size: 19px; padding-top: 2px; }
  .fb-hud.fit-tight .rank-title.long { font-size: 16px; }
  .fb-hud.fit-tight .rank-bar { margin: 2px 0 2px; }
  .fb-hud.fit-tight .rank-bar i { width: 22px; height: 7px; }
  .fb-hud.fit-tight .rank-next { font-size: 10.5px; }
}
@media (min-width: 601px) and (max-height: 460px) {
  /* short landscape is compact already: "tight" there = the 320-px phone sizes */
  .fb-hud.fit-tight .cash-num { font-size: 25px; }
  .fb-hud.fit-tight .carry-num { font-size: 18px; }
  .fb-hud.fit-tight .carry-cap { font-size: 12px; }
  .fb-hud.fit-tight .cash-ico { width: 28px; }
  .fb-hud.fit-tight .cash-bank .cash-ico svg { width: 26px; height: 26px; }
  .fb-hud.fit-tight .cash-carry { grid-template-columns: 28px auto 1fr; }
  .fb-hud.fit-tight .cash-carry .cash-ico svg { width: 22px; height: 22px; }
  .fb-hud.fit-tight .rank-portrait { width: 36px; height: 36px; }
  .fb-hud.fit-tight .rank-title { font-size: 16px; }
  .fb-hud.fit-tight .rank-title.long { font-size: 12.5px; }
}
.fb-hud.fit-min .rank-next, .fb-hud.fit-min .c2-squad, .fb-hud.fit-nosq .c2-squad { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .hud-round.lit, .hud-round.news, .big-btn.gold, .hud-badge, .carry-full, .cash-bank.hint { animation: none; }
  .roll-up { scale: 1; }
}

/* ------------------------------------------------------------------ v0.6.4 one scrollbar for the whole game (CrazyGames
   Full Launch QA reject 1: "default browser scrollbar" on the FAMILY panel). EVERY element that can scroll carries
   .fb-scroll (tests/v064_ui.test.mjs lists them): the FAMILY panel body, Welcome back, both end cards, the boat question,
   the KO card, Privacy, Start over, the tutorial card's text, the guidebook. A gold thumb with an ink edge on a faint
   paper track, like the HUD's bars; thinner on touch screens (there you scroll by dragging the content). */
.fb-scroll { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.fb-scroll::-webkit-scrollbar { width: 12px; height: 12px; }
.fb-scroll::-webkit-scrollbar-track { background: rgba(28, 20, 17, 0.10); border-radius: 8px; margin: 6px 0; }
.fb-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #f9e39c, var(--hud-gold, #c99a3e));
  border: 2.5px solid var(--hud-ink, #1c1411); border-radius: 8px; min-height: 44px;
}
.fb-scroll::-webkit-scrollbar-thumb:hover, .fb-scroll::-webkit-scrollbar-thumb:active { background: var(--hud-gold-2, #efd28a); }
.fb-scroll::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.fb-scroll::-webkit-scrollbar-corner { background: transparent; }
@media (pointer: coarse) { .fb-scroll::-webkit-scrollbar { width: 8px; } }
/* Firefox only: Chrome 121+ drops the ::-webkit-scrollbar look as soon as it sees scrollbar-color / scrollbar-width */
@supports not selector(::-webkit-scrollbar) {
  .fb-scroll { scrollbar-width: thin; scrollbar-color: var(--hud-gold, #c99a3e) rgba(28, 20, 17, 0.12); }
}
/* a modal whose card is taller than the screen scrolls (its top stays reachable: safe centring) */
.hud-modal.fb-scroll { place-items: center; place-items: safe center; touch-action: pan-y; }

/* ------------------------------------------------------------------ Chinese (dev reference): CJK glyphs are much wider */
html[lang|="zh"] .alert-main { font-size: 62px; letter-spacing: 0.02em; }
html[lang|="zh"] .alert-sub { font-size: 22px; }
html[lang|="zh"] .hud-toast { font-size: 19px; }
html[lang|="zh"] .cash-tag { font-size: 12px; letter-spacing: 0; }
html[lang|="zh"] .street-name { letter-spacing: 0.02em; }
@media (max-width: 600px) {
  html[lang|="zh"] .alert-main { font-size: 40px; }
  html[lang|="zh"] .alert-band { height: 50px; }
  html[lang|="zh"] .alert-sub { font-size: 18px; }
}

/* ================================================================== CHAPTER 2 — Family War (CONTRACTS ch2 §9.3)
   Everything below is scoped to .c2 (the chapter-2 HUD root) or to new .c2-* elements, except the chapter-1 end
   screen's chapter-2 line (.c2-line, v0.5.1), which only exists when main.js offers it. */
:root { --c2-ferrara: #3e8a3a; --c2-russo: #c8342c; --c2-esposito: #2f6fb5; --c2-bianchi: #a3a7b1; }

/* (v0.5.1) chapter-1 end card: the line to Italy over the gold LET'S GO (= the KEEP PLAYING button, relabelled) */
.end .c2-line {
  margin: -4px 0 16px; padding: 10px 14px;
  font-family: var(--font-body); font-size: 16px; font-weight: 800; line-height: 1.3; color: var(--hud-ink);
  background: var(--hud-paper-2); border: 3px solid var(--hud-ink); border-radius: 10px;
}
.end .end-keep.c2-go { min-width: 200px; }
/* v0.6.1 Start over (owner 10-05): a small text button under the big one on both end cards (chapter 1 #end and the
   chapter-2 .c2-end); it opens the confirm dialog (src/restart.js) */
.end .end-restart { display: block; margin: 12px auto 0; padding: 4px 10px; border: 0; background: transparent; font: 700 14px/1.2 var(--font-body); color: rgba(28, 20, 17, 0.62); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; touch-action: manipulation; }
.end .end-restart[hidden] { display: none; }
.end .end-restart:hover, .end .end-restart:focus-visible { color: var(--hud-ink); }
/* (v0.5.1) short landscape phones (344-460 px tall): the end card was ~550 px, so its only button (KEEP PLAYING, now
   LET'S GO) sat below the screen and nothing could close the card — the player was stuck (since v0.4). Compact card
   (no portrait, smaller title / stats / line) + the overlay scrolls if it still does not fit (the crown is not clipped). */
@media (max-height: 460px) and (min-width: 601px) {
  .hud-modal.end { place-items: safe center; overflow-y: auto; touch-action: pan-y; }
  .end .modal-card { width: min(560px, calc(100vw - 32px)); padding: 24px 18px 14px; margin: 26px 0 8px; }
  .end-crown { top: -30px; }
  .end-crown svg { width: 44px; height: 44px; }
  .end-portrait { display: none; }
  .end-title { margin: 2px 0 6px; font-size: 34px; }
  .end-rank { margin: 0 0 8px; font-size: 16px; }
  .end-stats { margin-bottom: 8px; }
  .end-stats > div { padding: 3px 8px 2px; }
  .end-k { font-size: 10px; }
  .end-v { font-size: 22px; }
  .end .c2-line { margin: 0 0 10px; padding: 6px 12px; font-size: 13.5px; }
}

/* rank card: 4 segments = streets taken on each arm, in the family colours */
.fb-hud.c2 .rank-bar i:nth-child(5) { display: none; }
.fb-hud.c2 .rank-bar i { width: 36px; }
.fb-hud.c2 .rank-bar i:nth-child(1) b { background: linear-gradient(#9fd88e, var(--c2-ferrara)); }
.fb-hud.c2 .rank-bar i:nth-child(2) b { background: linear-gradient(#f59a8e, var(--c2-russo)); }
.fb-hud.c2 .rank-bar i:nth-child(3) b { background: linear-gradient(#a8cdf2, var(--c2-esposito)); }
.fb-hud.c2 .rank-bar i:nth-child(4) b { background: linear-gradient(#ffffff, #c9ccd3); }

/* the hero's ammo sits under the rank card; HP + street banner + toasts move down one row */
.fb-hud.c2 .hud-hp { top: var(--hp-y, calc(var(--top) + 152px)); }        /* fix ch2: was +146, the ammo card's squad line sat 4px under the heart */
.fb-hud.c2 .hud-topstack { top: var(--ts-y, calc(var(--top) + 182px)); }
/* fix ch2: the big banner over the family cards (they come later in the DOM; on phones they covered the banner's end) */
.fb-hud.c2 .hud-alert { z-index: 2; }
.c2-layer { position: absolute; inset: 0; pointer-events: none; }
.c2-ammo {
  position: absolute; top: var(--am-y, calc(var(--top) + 84px)); left: var(--rk-cx, 50%); transform: translateX(-50%);
  width: max-content;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.c2-ammo-row {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  padding: 2px 10px 2px 4px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink);
  border-radius: 11px;
  box-shadow: 3px 3px 0 var(--hud-ink);
}
.c2-ammo-gun { position: relative; display: grid; place-items: center; width: 40px; height: 32px; }
.c2-ammo-gun > svg { width: 38px; height: 38px; }
.c2-ammo.empty .c2-ammo-gun > svg { opacity: 0.45; }
.c2-ammo.dim { opacity: 0; transition: opacity 0.15s; }
.c2-ammo-swap { position: absolute; left: -6px; bottom: -8px; width: 24px; height: 24px; border-radius: 50%; background: #e8e2d6; border: 2px solid var(--hud-ink); display: grid; place-items: center; }
.c2-ammo-swap svg { width: 18px; height: 18px; }
.c2-ammo-num { font-family: var(--font-display); font-weight: normal; font-size: 27px; line-height: 1; padding-top: 3px; min-width: 2.2ch; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c2-ammo-max { font-size: 16px; color: var(--muted-paper); }
.c2-ammo-bar { position: relative; width: 84px; height: 12px; border: 2.5px solid var(--hud-ink); border-radius: 7px; background: #3a2a22; overflow: hidden; }
.c2-ammo-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: linear-gradient(#f9e39c, #c9973e); transition: width 0.15s; }
.c2-ammo[data-tone="low"] .c2-ammo-bar i { background: linear-gradient(#f39a8c, var(--hud-blood-2)); }
.c2-ammo[data-tone="low"] .c2-ammo-num { color: var(--hud-blood-2); }
.c2-ammo.empty .c2-ammo-row { background: #f3c7bf; animation: c2-empty 0.5s ease-in-out infinite alternate; }
.c2-ammo.empty .c2-ammo-num { color: var(--hud-blood); }
@keyframes c2-empty { from { box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 0 rgba(217, 70, 59, 0); } to { box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 4px rgba(217, 70, 59, 0.8); } }
.c2-knife {
  position: absolute; left: 50%; top: -15px; transform: translateX(-50%) rotate(-4deg);
  padding: 2px 9px 0; border: 2.5px solid var(--hud-ink); border-radius: 7px; background: var(--hud-blood); color: #fff3de;
  font-family: var(--font-display); font-style: normal; font-size: 17px; letter-spacing: 0.06em; line-height: 1.1; white-space: nowrap;
  animation: c2-knife 0.45s ease-in-out infinite alternate;
}
@keyframes c2-knife { from { transform: translateX(-50%) rotate(-4deg) scale(1); } to { transform: translateX(-50%) rotate(-1deg) scale(1.12); } }
.c2-ammo-vest { position: relative; display: grid; place-items: center; margin-left: -2px; }
.c2-ammo-vest svg { width: 26px; height: 26px; }
.c2-ammo-vest b { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); font-size: 13px; line-height: 1; color: var(--hud-gold); text-shadow: 1px 1px 0 var(--hud-ink); letter-spacing: -1px; }
.c2-ammo.pop-reload .c2-ammo-row { animation: c2-pop 0.45s ease-out; background: #dff0cf; }
.c2-ammo.pop-empty .c2-ammo-row { animation: c2-shake 0.35s ease-in-out; }
@keyframes c2-pop { 0% { transform: scale(1); } 35% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes c2-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.c2-squad {
  display: flex; align-items: center; gap: 6px;
  padding: 1px 9px 0;
  background: rgba(28, 20, 17, 0.72); color: #f4eee1;
  border-radius: 999px;
  font-size: 13px; font-weight: 800; line-height: 1.5; white-space: nowrap;
}
.c2-sq-bar { position: relative; width: 44px; height: 7px; border-radius: 4px; background: #5a4a40; overflow: hidden; }
.c2-sq-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: #e6c46a; }
.c2-squad[data-tone="low"] .c2-sq-bar i { background: #ef7a6c; }
.c2-sq-empty { color: #ff9a8c; }

/* family strip (right side): ↑ Ferrara / → Russo / ↓ Esposito / ← Bianchi */
.c2-fams {
  position: absolute; top: calc(var(--top) + 68px); right: var(--right);   /* (v0.6.4: 60 -> 68 px, its BOSS / OUT badges 6 px clear of mute) */
  display: flex; flex-direction: column; align-items: flex-end; gap: 7px;
}
.c2-fam {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  width: 168px; box-sizing: border-box;
  padding: 3px 30px 3px 4px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink); border-left: 8px solid var(--fam);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--hud-ink);
}
.c2-fam-crest { position: relative; flex: none; line-height: 0; }
.c2-fam-crest svg { width: 32px; height: 32px; }
.c2-fam-dir {
  position: absolute; left: -12px; top: -7px; width: 17px; height: 17px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--hud-ink); color: var(--hud-paper); font-style: normal; font-size: 12px; line-height: 1; font-weight: 900;
}
.c2-fam-txt { display: flex; flex-direction: column; min-width: 0; }
.c2-fam-name { font-family: var(--font-display); font-weight: normal; font-size: 18px; line-height: 1; letter-spacing: 0.05em; text-transform: uppercase; padding-top: 2px; white-space: nowrap; }
.c2-fam-nums { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.c2-fam-nums em { font-style: normal; display: inline-flex; align-items: center; gap: 2px; }
.c2-fam-str svg { width: 14px; height: 14px; }
.c2-fam-str[data-tone="strong"] { color: #b3261e; }
.c2-fam-str[data-tone="weak"] { color: var(--money); }
.c2-fam-bank { color: var(--money); }
.c2-fam-st { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--hud-paper-2); border: 2px solid var(--hud-ink); }
.c2-fam-st svg { width: 18px; height: 18px; }
.c2-fam[data-status="raid"] .c2-fam-st, .c2-fam[data-status="attack"] .c2-fam-st, .c2-fam[data-status="counter"] .c2-fam-st, .c2-fam[data-status="war"] .c2-fam-st {
  background: #f3b3a8; animation: c2-alarm 0.6s ease-in-out infinite alternate;
}
@keyframes c2-alarm { from { box-shadow: 0 0 0 0 rgba(217, 70, 59, 0); } to { box-shadow: 0 0 0 4px rgba(217, 70, 59, 0.75); } }
.c2-fam[data-status="raid"], .c2-fam[data-status="attack"], .c2-fam[data-status="counter"] { background: #f7dcd5; }
.c2-fam[data-status="overlord"] { background: linear-gradient(#fbe7a8, #ecc76e); box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 3px var(--hud-gold-2), 0 0 14px 3px rgba(201, 154, 62, 0.6); }
.c2-fam[data-status="overlord"] .c2-fam-st { background: var(--hud-gold-2); }
.c2-fam-boss {
  position: absolute; right: -6px; top: -11px;
  padding: 1px 6px 0; border: 2px solid var(--hud-ink); border-radius: 6px;
  background: var(--hud-gold-2); font-family: var(--font-display); font-style: normal; font-size: 13px; letter-spacing: 0.08em; line-height: 1.1;
}
.c2-fam[data-status="out"] { opacity: 0.62; filter: grayscale(0.85); }
.c2-fam[data-status="out"] .c2-fam-boss { background: var(--hud-blood); color: #fff3de; }
.c2-fam[data-status="out"] .c2-fam-st { background: var(--hud-blood); }
.c2-x { color: #fff3de; font-size: 15px; line-height: 1; }

/* chips under the money card: VASSAL −30% → Russo, counter-attack / raid countdowns */
.c2-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.c2-chips:empty { display: none; }
.c2-chip {
  --fam: #8e2a24;
  display: flex; align-items: center; gap: 5px;
  padding: 1px 9px 0 4px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink); border-left: 9px solid var(--fam);
  border-radius: 9px;
  box-shadow: 3px 3px 0 var(--hud-ink);
  font-family: var(--font-display); font-size: 19px; line-height: 1.25; letter-spacing: 0.04em; white-space: nowrap;
}
.c2-chip-ico { font-style: normal; line-height: 0; }
.c2-chip-ico svg { width: 20px; height: 20px; }
.c2-chip.danger .c2-chip-ico { font-size: 20px; line-height: 1; color: #b3261e; }
.c2-chip-crest { line-height: 0; }
.c2-chip-crest svg { width: 20px; height: 20px; }
.c2-chip-tag { padding: 1px 5px 0; border-radius: 5px; background: var(--hud-ink); color: var(--hud-paper); font-weight: normal; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.1; }
.c2-chip.vassal .c2-chip-txt, .c2-chip.vassal .c2-chip-sh { color: #b3261e; }
/* (v0.6.4 review r2) layout guard L5 / L6: the short text (narrow landscape, chapter 2) */
.c2-chip-sh { display: none; }
.fb-hud.fit-chipmin .c2-chip { font-size: 16px; padding-right: 7px; gap: 4px; }
.fb-hud.fit-chipmin .c2-chip-txt { display: none; }
.fb-hud.fit-chipmin .c2-chip-sh { display: inline; }
.c2-chip.danger { background: #f7d3cc; animation: inv-chip 0.9s ease-in-out infinite alternate; }
.c2-chip.paid { background: #f7d3cc; }

/* family tree: vest badge + ammo bar on each fighter */
.c2-tvest { position: absolute; left: -9px; bottom: -8px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; border: 2px solid var(--hud-ink); background: var(--hud-paper); }
.c2-tvest svg { width: 15px; height: 15px; }
.c2-tvest.l3 { background: var(--hud-gold-2); }
.c2-tammo { position: absolute; left: 3px; right: 3px; top: -7px; height: 5px; border: 1.5px solid var(--hud-ink); border-radius: 3px; background: #3a2a22; overflow: hidden; }
.c2-tammo i { display: block; height: 100%; background: #e6c46a; }
.c2-tammo.low i { background: #ef7a6c; }
.c2-tammo.empty { background: #b3261e; }

/* one-time tips (chapter 2 has no tutorial) */
.c2-tip {
  position: absolute; left: 50%; bottom: calc(var(--bottom) + 18px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  width: max-content; max-width: min(560px, calc(100vw - 40px)); box-sizing: border-box;
  padding: 7px 16px 7px 8px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink); border-radius: 14px;
  box-shadow: 4px 4px 0 var(--hud-ink), 0 0 0 3px var(--hud-gold-2);
  font-size: 19px; font-weight: 800; line-height: 1.2;
}
.c2-tip-ico { flex: none; line-height: 0; }
.c2-tip-ico svg { width: 34px; height: 34px; }
.c2-floatx { position: absolute; left: 0; top: 0; font-family: var(--font-display); font-size: 24px; line-height: 1; white-space: nowrap; color: #f9e39c; -webkit-text-stroke: 1.2px var(--hud-ink); text-shadow: 2px 2px 0 var(--hud-ink); }
.c2-fly { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

/* arrival cutscene card */
.c2-card { position: absolute; inset: 0; display: grid; place-items: end center; padding-bottom: 9vh; pointer-events: none; z-index: 4; }
.c2-card[data-kind="title"] { place-items: center; padding-bottom: 0; }
.c2-card-in { display: flex; align-items: center; gap: 16px; transform: rotate(-2deg); }
.c2-card[data-kind="title"] .c2-card-in { flex-direction: column; gap: 8px; }
.c2-card-don { position: relative; line-height: 0; }
.c2-card-don > svg { width: 132px; height: 132px; border: 4px solid var(--hud-ink); border-radius: 16px; box-shadow: 6px 6px 0 var(--hud-ink), 0 0 0 4px var(--fam); }
.c2-card-crest { position: absolute; right: -22px; bottom: -18px; filter: drop-shadow(3px 3px 0 var(--hud-ink)); }
.c2-card-txt { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.c2-card-dir, .c2-card-don-name, .c2-card-ch, .c2-card-money, .c2-card-skip {
  padding: 3px 12px 1px; background: var(--hud-paper); border: 3px solid var(--hud-ink); border-radius: 8px; box-shadow: 3px 3px 0 var(--hud-ink);
  font-family: var(--font-display); font-size: 22px; letter-spacing: 0.07em; text-transform: uppercase; line-height: 1.1; white-space: nowrap;
}
.c2-card-dir { border-left: 10px solid var(--fam); }
.c2-card-name, .c2-card-title {
  position: relative; font-family: var(--font-display); font-size: 92px; line-height: 0.95; letter-spacing: 0.04em; white-space: nowrap;
  color: var(--fam); padding: 6px 4px 0;
}
.c2-card-name::before, .c2-card-title::before {
  content: attr(data-text); position: absolute; inset: 0; padding: inherit; z-index: -1;
  color: var(--hud-ink); -webkit-text-stroke: 10px var(--hud-ink); text-shadow: 6px 7px 0 var(--hud-ink);
}
.c2-card-title { color: var(--hud-gold-2); font-size: 104px; }
.c2-card-ch { background: var(--hud-gold-2); font-size: 26px; }
.c2-card-crests { display: flex; gap: 12px; margin: 4px 0; filter: drop-shadow(3px 3px 0 var(--hud-ink)); }
.c2-card-money { color: var(--money); font-size: 30px; }
.c2-card-skip { position: absolute; right: calc(var(--right) + 4px); bottom: calc(var(--bottom) + 4px); font-size: 16px; opacity: 0.85; }

/* boat question (chapter 1, Docks) */
.c2-sail .modal-card { width: min(400px, calc(100vw - 32px)); }
.c2-sail-ico { display: flex; justify-content: center; margin-top: -54px; filter: drop-shadow(4px 4px 0 var(--hud-ink)); }
.c2-sail-title { margin: 6px 0 6px; font-family: var(--font-display); font-weight: normal; font-size: 40px; line-height: 1; letter-spacing: 0.04em; text-transform: uppercase; }
.c2-sail-body { margin-bottom: 16px; font-size: 17px; font-weight: 700; color: var(--muted-paper); }
.c2-sail-btns { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.c2-sail-no { min-width: 0; height: 44px; font-size: 22px; background: var(--hud-paper-2); }

/* chapter-2 end screen (re-uses the .end card) */
.c2-end-dons { display: flex; justify-content: center; gap: 8px; margin: -4px 0 12px; }
.c2-end-don { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.c2-end-don svg { width: 54px; height: 54px; border: 2.5px solid var(--hud-ink); border-radius: 9px; box-shadow: 0 0 0 2px var(--fam); }
.c2-end-don i { font-style: normal; font-family: var(--font-display); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.c2-end-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-bottom: 16px; }
.c2-end-stats > div { grid-column: span 2; min-width: 0; padding: 5px 6px 3px; background: var(--hud-paper-2); border: 3px solid var(--hud-ink); border-radius: 10px; }
.c2-end-stats > div.c2-es-conquered { grid-column: 2 / span 2; }
.c2-end-stats .end-v { font-size: 30px; }
.c2-end .end-title { font-size: 50px; }

/* the Italian families on the street banner + alerts */
.hud-street[data-owner="ferrara"] { --fam: var(--c2-ferrara); }
.hud-street[data-owner="russo"] { --fam: var(--c2-russo); }
.hud-street[data-owner="esposito"] { --fam: var(--c2-esposito); }
.hud-street[data-owner="bianchi"] { --fam: var(--c2-bianchi); }

@media (max-width: 600px) {
  .fb-hud.c2 .hud-hp { top: var(--hp-y, calc(var(--top) + 150px)); }
  .fb-hud.c2 .hud-topstack { top: var(--ts-y, calc(var(--top) + 184px)); }
  .fb-hud.c2 .rank-bar i { width: 23px; }
  .c2-ammo { top: calc(var(--top) + 96px); }
  .c2-ammo-row { gap: 5px; padding: 1px 7px 1px 3px; border-width: 2.5px; }
  .c2-ammo-gun { width: 32px; height: 26px; }
  .c2-ammo-gun > svg { width: 30px; height: 30px; }
  .c2-ammo-num { font-size: 22px; }
  .c2-ammo-max { font-size: 13px; }
  .c2-ammo-bar { width: 56px; height: 10px; }
  .c2-ammo-vest svg { width: 22px; height: 22px; }
  .c2-squad { font-size: 11.5px; gap: 4px; padding: 0 7px; }
  .c2-sq-bar { width: 30px; }
  .c2-fams { top: calc(var(--top) + 132px); gap: 10px; }
  .c2-fam { width: auto; min-width: 64px; padding: 2px 4px; border-width: 2.5px; border-left-width: 6px; gap: 3px; }   /* (v0.6.4: auto — a 3-digit power used to stick out of the 64-px card to the left) */
  .c2-fam-crest svg { width: 24px; height: 24px; }
  .c2-fam-dir { left: -10px; top: -6px; width: 14px; height: 14px; font-size: 10px; }
  .c2-fam-name, .c2-fam-nums .c2-fam-bank { display: none; }
  .c2-chips { order: 3; margin-top: 12px; max-width: calc(100vw - 104px); }   /* (v0.6.4: clear of the family strip in the right column) */
  .c2-chip { white-space: normal; }   /* like the tribute chips: below the Family button on phones (fix ch2: 4 -> 9px, clear of the hp bar) */
  .c2-fam-nums { font-size: 14px; }
  .c2-fam-str svg { display: none; }
  .c2-fam-st { right: -9px; top: -9px; transform: none; width: 18px; height: 18px; }
  .c2-fam-st svg { width: 13px; height: 13px; }
  .c2-fam-boss { top: auto; bottom: -10px; right: -4px; font-size: 10px; }
  .c2-chip { font-size: 15px; border-width: 2.5px; border-left-width: 7px; padding: 0 7px 0 3px; }
  .c2-chip-ico svg, .c2-chip-crest svg { width: 16px; height: 16px; }
  .c2-chip-tag { font-size: 10px; }
  .c2-tip { bottom: 19%; font-size: 16px; padding: 6px 12px 6px 6px; }
  .c2-tip-ico svg { width: 28px; height: 28px; }
  .c2-card-in { flex-direction: column; gap: 10px; }
  .c2-card-txt { align-items: center; }
  .c2-card-don > svg { width: 104px; height: 104px; }
  .c2-card-name { font-size: 58px; }
  .c2-card-title { font-size: 62px; }
  .c2-card-dir, .c2-card-don-name, .c2-card-ch, .c2-card-money { font-size: 18px; }
  .end .c2-line { font-size: 14.5px; padding: 8px 12px; }
  .c2-end-stats .end-v { font-size: 24px; }
  .c2-end .end-title { font-size: 40px; }
}
@media (max-height: 460px) and (min-width: 601px) {
  /* (v0.6.4) long chips ("Russo hits back: 40 s") wrap instead of reaching under the rank column */
  .c2-chips { max-width: 240px; }
  .c2-chip { white-space: normal; }
  .fb-hud.c2 .hud-hp { top: var(--hp-y, calc(var(--top) + 104px)); }
  .fb-hud.c2 .hud-topstack { top: var(--ts-y, calc(var(--top) + 130px)); }
  .c2-ammo { top: var(--am-y, calc(var(--top) + 56px)); }
  .c2-ammo-gun > svg { width: 30px; height: 30px; }
  .c2-ammo-num { font-size: 22px; }
  .c2-fams { top: calc(var(--top) + 66px); gap: 4px; }
  .c2-fam { width: 150px; padding-top: 1px; padding-bottom: 1px; }
  .c2-fam-crest svg { width: 24px; height: 24px; }
  .c2-fam-name { font-size: 15px; }
  .c2-fam-nums { font-size: 11.5px; }
}
html[lang|="zh"] .c2-fam-name { letter-spacing: 0; font-size: 16px; }
html[lang|="zh"] .c2-card-name { font-size: 76px; }

/* ------------------------------------------------------------------ v0.5 WALK IN tag (no guide arrow) */
/* sits above the glowing box of light on the opening's first spots (main.js walkTag); bobs gently */
.walkin-tag { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 4; opacity: 0; transition: opacity 0.2s ease; will-change: transform; }
.walkin-tag.on { opacity: 1; }
.walkin-in {
  position: absolute; left: 0; bottom: 0; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--font-display); font-size: 21px; line-height: 1; letter-spacing: 0.06em; text-transform: uppercase;
  color: #ffdf7a; background: var(--ink); padding: 7px 13px 5px; border-radius: 999px;
  border: 2px solid #f5b82e; box-shadow: 0 0 14px 3px rgba(255, 210, 63, 0.75), 3px 3px 0 rgba(28, 20, 17, 0.55);
  animation: walkin-bob 0.7s ease-in-out infinite alternate;
}
.walkin-tag.below .walkin-in { bottom: auto; top: 0; }
@keyframes walkin-bob { from { translate: 0 0; } to { translate: 0 -9px; } }
@media (max-width: 600px) { .walkin-in { font-size: 18px; padding: 6px 11px 4px; } }
@media (prefers-reduced-motion: reduce) { .walkin-in { animation: none; } }

/* ------------------------------------------------------------------ chapter 2 hints (10-03: new things obvious, no arrow) */
/* the ammo bar blinks red when low / empty */
.c2-ammo[data-tone="low"] .c2-ammo-bar, .c2-ammo[data-tone="empty"] .c2-ammo-bar { animation: c2-lowbar 0.45s ease-in-out infinite alternate; }
@keyframes c2-lowbar { from { border-color: var(--hud-ink); box-shadow: 0 0 0 0 rgba(217, 70, 59, 0); } to { border-color: var(--hud-blood); box-shadow: 0 0 0 3px rgba(217, 70, 59, 0.85), 0 0 10px 2px rgba(255, 90, 70, 0.7); } }
/* NEW card (in the tip slot): teal glow like the box glowing in the world */
.c2-tip.new { box-shadow: 4px 4px 0 var(--hud-ink), 0 0 0 3px #52ecd6, 0 0 18px 4px rgba(82, 236, 214, 0.65); padding-left: 6px; }
.c2-tip.new .c2-tip-ico svg { width: 44px; height: 44px; }
.c2-new-badge {
  display: inline-block; margin-right: 7px; padding: 1px 6px 0; border: 2px solid var(--hud-ink); border-radius: 6px;
  background: #52ecd6; color: var(--hud-ink); font-family: var(--font-display); font-weight: normal; font-size: 14px; letter-spacing: 0.08em;
  vertical-align: 3px; line-height: 1.15; transform: rotate(-5deg);
}
.c2-new-k { font-family: var(--font-display); font-weight: normal; font-size: 22px; letter-spacing: 0.04em; }
.c2-new-line { white-space: normal; }
/* a vest = a shield on the hero's HP bar */
.c2-hpvest { position: relative; display: grid; place-items: center; line-height: 0; filter: drop-shadow(2px 2px 0 var(--hud-ink)); }
.c2-hpvest svg { width: 22px; height: 22px; }
.c2-hpvest b { position: absolute; right: -6px; bottom: -5px; font-size: 12px; line-height: 1; color: var(--hud-gold); text-shadow: 1px 1px 0 var(--hud-ink), -1px -1px 0 var(--hud-ink); }
.c2-hpvest[hidden] { display: none; }
@media (max-width: 600px) {
  .c2-tip.new .c2-tip-ico svg { width: 34px; height: 34px; }
  .c2-new-k { font-size: 18px; }
  .c2-new-badge { font-size: 12px; }
  .c2-hpvest svg { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) { .c2-ammo .c2-ammo-bar { animation: none; } }

/* ================================================================== v0.7.0 CHAPTER 1 — the dons run a business
   (设计-第一章-敌人会经营.md). Same look as chapter 2's family cards / chips / end card: cream paper, ink outline, a
   family-colour edge, hard offset shadow. Everything here only exists in the chapter-1 HUD (src/ui/hud.js, !CH2). */
/* boss card (top right, under the mute button): face, name, ARMY x/cap bar, bank, what he does, the help he gets.
   v0.6.5: the element sits in .hud-right after #btn-mute — on a computer / landscape .hud-right adds no box (display:
   contents), so it keeps this absolute place; on phones upright it flows in the right column (below) */
.hud-boss {
  --fam: #a8322a;
  position: absolute; top: var(--bs-y, calc(var(--top) + 60px)); right: var(--right);   /* v0.6.5: --bs-y = under the mute button (layout guard) */
  display: flex; flex-direction: column; align-items: flex-end; gap: 7px;
  perspective: 600px;
}
.boss-in {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  width: 222px; box-sizing: border-box;
  padding: 4px 8px 4px 4px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink); border-left: 9px solid var(--fam);
  border-radius: 11px;
  box-shadow: 3px 3px 0 var(--hud-ink);
  transform-origin: 50% 0;
}
.boss-face { flex: none; width: 50px; height: 50px; border: 2.5px solid var(--hud-ink); border-radius: 8px; overflow: hidden; line-height: 0; background: #261d18; }
.boss-face svg { width: 100%; height: 100%; animation: boss-breathe 2.8s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes boss-breathe { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-1.5px) scale(1.025); } }
.boss-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.boss-name { font-family: var(--font-display); font-size: 17px; line-height: 1; letter-spacing: 0.05em; text-transform: uppercase; padding: 2px 52px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.boss-army { display: flex; align-items: center; gap: 4px; border-radius: 6px; }
.boss-army-lbl { font-family: var(--font-display); font-size: 13px; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); padding-top: 2px; }
.boss-army-bar { --n: 6; position: relative; flex: 1; min-width: 50px; height: 12px; border: 2.5px solid var(--hud-ink); border-radius: 7px; background: #3a2a22; overflow: hidden; }
.boss-army-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(#f39a8c, var(--fam)); transition: width 0.35s ease-out; }
/* one notch per man (up to 18): you can count his squad */
.boss-army-bar.ticks::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent calc(100% - 1.5px), rgba(28, 20, 17, 0.6) calc(100% - 1.5px)); background-size: calc(100% / var(--n)) 100%; background-repeat: repeat-x; }
.boss-army-n { font-family: var(--font-display); font-weight: normal; font-size: 17px; line-height: 1; padding-top: 2px; font-variant-numeric: tabular-nums; min-width: 2.6ch; text-align: right; display: inline-block; }
.boss-st { font-size: 12px; font-weight: 800; line-height: 1.1; color: var(--muted-paper); white-space: nowrap; }
.boss-bank { position: absolute; right: 7px; top: 4px; font-style: normal; font-family: var(--font-display); font-size: 15px; line-height: 1; color: var(--money); display: inline-block; }
.boss-flag { position: absolute; left: -15px; top: -13px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--hud-paper); border: 2px solid var(--hud-ink); animation: boss-wave 0.5s ease-in-out infinite alternate; }
@keyframes boss-wave { from { transform: rotate(-10deg); } to { transform: rotate(10deg) scale(1.08); } }
.hud-boss[data-status="full"] .boss-army-bar { animation: boss-full 0.7s ease-in-out infinite alternate; }
.hud-boss[data-status="full"] .boss-st, .hud-boss[data-status="attack"] .boss-st { color: #b3261e; }
.hud-boss[data-status="attack"] .boss-in { background: #f7dcd5; animation: boss-alarm 0.6s ease-in-out infinite alternate; }
.hud-boss[data-status="home"] .boss-st { color: var(--ink-soft); }
@keyframes boss-full { from { box-shadow: 0 0 0 0 rgba(217, 70, 59, 0); } to { box-shadow: 0 0 0 3px rgba(217, 70, 59, 0.85), 0 0 10px 2px rgba(255, 90, 70, 0.6); } }
@keyframes boss-alarm { from { box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 0 rgba(217, 70, 59, 0); } to { box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 4px rgba(217, 70, 59, 0.75); } }
.boss-army.recruit .boss-army-bar { animation: boss-recruit 0.6s ease-out; }
.boss-army.upgrade .boss-army-bar { animation: boss-upgrade 0.6s ease-out; }
@keyframes boss-recruit { 0% { transform: scale(1); } 30% { transform: scale(1.12, 1.4); box-shadow: 0 0 0 3px rgba(239, 210, 138, 0.95); } 100% { transform: scale(1); } }
@keyframes boss-upgrade { 0% { filter: none; } 30% { filter: brightness(1.6); box-shadow: 0 0 0 3px rgba(239, 210, 138, 0.95); } 100% { filter: none; } }
.boss-help {
  --hfam: #6c4aa0;
  display: flex; align-items: center; gap: 5px;
  padding: 2px 9px 1px 3px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink); border-left: 8px solid var(--hfam);
  border-radius: 9px;
  box-shadow: 3px 3px 0 var(--hud-ink);
  font-family: var(--font-display); font-size: 15px; line-height: 1.1; letter-spacing: 0.04em; white-space: nowrap;
}
.boss-help-face { line-height: 0; }
.boss-help-face svg { width: 26px; height: 26px; border: 2px solid var(--hud-ink); border-radius: 5px; }
.boss-help-txt { padding-top: 2px; color: #b3261e; }
.hud-float.boss { color: #f9e39c; }
.hud-float.boss.small { font-size: 21px; }
.hud-float.boss::before { -webkit-text-stroke: 5px var(--hud-ink); text-shadow: 2px 3px 0 var(--hud-ink); }

/* the Corner under attack: its chip is louder (losing it ends the game) */
.trib-chip.inv.corner {
  background: linear-gradient(90deg, #ec8a7c calc(var(--cap) * 100%), #f7d3cc calc(var(--cap) * 100%));
  animation: corner-chip 0.45s ease-in-out infinite alternate;
}
.trib-chip.inv.corner .trib-amt { font-size: 19px; }
@keyframes corner-chip { from { box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 0 rgba(217, 70, 59, 0); transform: scale(1); } to { box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 4px rgba(217, 70, 59, 0.85), 0 0 16px 4px rgba(255, 80, 60, 0.55); transform: scale(1.04); } }

/* the reinforcement dialog: the helping don + one line (bottom centre, never pauses the game; only OK takes taps) */
.hud-say { position: absolute; left: 0; right: 0; bottom: calc(var(--bottom) + 11vh); display: flex; justify-content: center; pointer-events: none; z-index: 4; }
.say-in {
  --fam: #6c4aa0;
  display: flex; align-items: center; gap: 12px;
  max-width: min(600px, calc(100vw - 24px)); box-sizing: border-box;
  padding: 8px 10px 8px 8px;
  background: var(--hud-paper);
  border: 3px solid var(--hud-ink); border-left: 10px solid var(--fam);
  border-radius: 14px;
  box-shadow: 5px 5px 0 var(--hud-ink);
  transform: rotate(-1deg);
}
.say-face { flex: none; width: 78px; height: 78px; border: 3px solid var(--hud-ink); border-radius: 11px; overflow: hidden; line-height: 0; background: #261d18; }
.say-face svg { width: 100%; height: 100%; transform-origin: 50% 100%; animation: say-talk 0.42s ease-in-out infinite alternate; }
@keyframes say-talk { from { transform: translateY(0) rotate(-1deg); } to { transform: translateY(-2px) rotate(1.5deg) scale(1.02); } }
.say-bubble { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.say-who { font-family: var(--font-display); font-weight: normal; font-size: 16px; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.say-who::before { content: ''; display: inline-block; width: 10px; height: 10px; margin: -2px 6px 0 0; vertical-align: middle; border-radius: 50%; background: var(--fam); border: 2px solid var(--hud-ink); }
.say-line { font-family: var(--font-display); font-size: 26px; line-height: 1.08; letter-spacing: 0.03em; }
.fb-hud .say-ok {
  pointer-events: auto; flex: none; align-self: center;
  height: 44px; min-width: 66px; padding: 4px 12px 0;
  border: 3px solid var(--hud-ink); border-radius: 11px; box-shadow: 3px 3px 0 var(--hud-ink);
  background: linear-gradient(#f9e39c, var(--hud-gold));
  font-family: var(--font-display); font-size: 22px; line-height: 1; letter-spacing: 0.06em; text-transform: uppercase;
}
.fb-hud .say-ok:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--hud-ink); }

/* the lose page (RED LINE: no package without it) — the end card's shape, in blood red */
.hud-modal.lose { background: radial-gradient(ellipse at center, rgba(70, 18, 14, 0.55), rgba(20, 6, 5, 0.9)); }
.lose .modal-card { padding-top: 22px; }
.lose-faces { display: flex; justify-content: center; align-items: flex-end; }
.lose-faces > span { line-height: 0; }
.lose-faces svg { border: 3px solid var(--hud-ink); border-radius: 12px; }
.lose-don svg { width: 96px; height: 96px; box-shadow: 0 0 0 3px var(--hud-blood-2); transform: rotate(-4deg); animation: boss-breathe 2.8s ease-in-out infinite; }
.lose-hero { margin-left: -12px; }
.lose-hero svg { width: 78px; height: 78px; filter: grayscale(0.4); transform: rotate(6deg) translateY(10px); }
.lose-title { margin: 16px 0 4px; font-family: var(--font-display); font-weight: normal; font-size: 58px; line-height: 0.95; letter-spacing: 0.04em; color: var(--hud-blood); }
.lose-line { margin-bottom: 12px; font-size: 17px; font-weight: 800; }
.lose-far { margin: -6px 0 16px; font-size: 14.5px; font-weight: 700; line-height: 1.3; color: var(--muted-paper); }
.fb-hud .big-btn.lose-restart { background: linear-gradient(#d8574a, var(--hud-blood)); color: #fff6e6; animation: hud-glow 1.3s ease-in-out infinite; }

@media (max-width: 600px) {
  /* phones upright: a compact card under the mute button (face + bar + x/cap; the colour / pulse says the rest).
     v0.6.5: it flows in the right column (.hud-right, after #btn-mute) like chapter 2's family strip — the column grows
     with the rank card (2-line "Next:", --rk-dy), so a fixed top + 132 px ran into it; the layout guard measures it ('boss') */
  .hud-right > .hud-boss { position: relative; top: auto; right: auto; gap: 5px; }
  .boss-in { width: auto; gap: 4px; padding: 2px 5px 2px 2px; border-width: 2.5px; border-left-width: 6px; }
  .boss-face { width: 34px; height: 34px; border-width: 2px; border-radius: 6px; }
  .boss-name, .boss-bank, .boss-st, .boss-army-lbl { display: none; }
  .boss-army-bar { min-width: 44px; width: 44px; height: 10px; border-width: 2px; }
  .boss-army-n { font-size: 15px; }
  .boss-flag { left: -11px; top: -11px; width: 22px; height: 22px; }
  .boss-help { font-size: 12px; padding: 1px 6px 0 2px; border-width: 2.5px; border-left-width: 6px; }
  .boss-help-face svg { width: 20px; height: 20px; }
  .hud-say { bottom: calc(var(--bottom) + 15vh); }
  .say-in { gap: 8px; padding: 6px 8px 6px 6px; }
  .say-face { width: 56px; height: 56px; }
  .say-line { font-size: 19px; }
  .say-who { font-size: 13px; }
  .fb-hud .say-ok { height: 40px; min-width: 52px; font-size: 19px; }
  .lose-title { font-size: 46px; }
  .lose-don svg { width: 80px; height: 80px; }
  .lose-hero svg { width: 64px; height: 64px; }
}
@media (max-height: 460px) and (min-width: 601px) {
  .hud-boss { top: var(--bs-y, calc(var(--top) + 54px)); }
  .boss-in { width: 200px; padding-top: 2px; padding-bottom: 2px; }
  .boss-face { width: 38px; height: 38px; }
  .boss-st { display: none; }
  .hud-say { bottom: calc(var(--bottom) + 6vh); }
  .say-face { width: 56px; height: 56px; }
  .say-line { font-size: 20px; }
  .lose .modal-card { padding-top: 14px; }
  .lose-faces svg { width: 56px !important; height: 56px !important; }
  .lose-title { margin: 6px 0 2px; font-size: 36px; }
  .lose-line { margin-bottom: 6px; font-size: 14px; }
  .lose-far { margin: 0 0 8px; font-size: 13px; }
}
/* v0.6.5 (design_amend 17): the layout guard's L1b+ (landscape, chapter 1): the boss card goes compact under the mute button,
   like the phone-upright one — the rank column keeps its place on a 640 x 360 screen */
@media (min-width: 601px) {
  .fb-hud.fit-bossmin .hud-boss { gap: 5px; }
  .fb-hud.fit-bossmin .boss-in { width: auto; gap: 4px; padding: 2px 5px 2px 2px; border-width: 2.5px; border-left-width: 6px; }
  .fb-hud.fit-bossmin .boss-face { width: 34px; height: 34px; border-width: 2px; border-radius: 6px; }
  .fb-hud.fit-bossmin .boss-name, .fb-hud.fit-bossmin .boss-bank, .fb-hud.fit-bossmin .boss-st, .fb-hud.fit-bossmin .boss-army-lbl { display: none; }
  .fb-hud.fit-bossmin .boss-army-bar { min-width: 44px; width: 44px; height: 10px; border-width: 2px; }
  .fb-hud.fit-bossmin .boss-army-n { font-size: 15px; }
  .fb-hud.fit-bossmin .boss-flag { left: -11px; top: -11px; width: 22px; height: 22px; }
  .fb-hud.fit-bossmin .boss-help { font-size: 12px; padding: 1px 6px 0 2px; border-width: 2.5px; border-left-width: 6px; }
  .fb-hud.fit-bossmin .boss-help-face svg { width: 20px; height: 20px; }
}
/* v0.6.5 (design_amend 4): a compact boss card still says where his squad goes ("→ Market!") — announced or attacking */
@media (max-width: 600px) {
  .hud-boss[data-status="warn"] .boss-st, .hud-boss[data-status="attack"] .boss-st { display: block; font-size: 11px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
}
@media (min-width: 601px) {
  .fb-hud.fit-bossmin .hud-boss[data-status="warn"] .boss-st, .fb-hud.fit-bossmin .hud-boss[data-status="attack"] .boss-st { display: block; font-size: 11px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
}
.hud-boss[data-status="warn"] .boss-st { color: #b3261e; }
.hud-boss[data-status="warn"] .boss-in { background: #f7dcd5; animation: boss-alarm 0.45s ease-in-out infinite alternate; }

/* ================================================================== v0.6.5 income x2 + the attack warning in the FAMILY panel
   (design B.4.4 / B.4.7 / B.4.8 + design_amend 4). Chapter 1 only (src/ui/hud.js). */
/* the x2 pill: under the money card (the money doubles — it sits by the money), gold, breathing; the last 15 s it blinks */
.hud-boost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px 0 3px;
  background: linear-gradient(#ffe9a3, var(--hud-gold));
  border: 3px solid var(--hud-ink); border-radius: 999px;
  box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 0 rgba(255, 214, 102, 0);
  font-family: var(--font-display); line-height: 1; color: var(--hud-ink);
  animation: bst-glow 1.8s ease-in-out infinite;
}
.hud-boost[hidden] { display: none !important; }
.bst-x { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 2px 5px 0; box-sizing: border-box; border-radius: 999px; background: var(--hud-ink); color: #ffe08a; font-size: 18px; letter-spacing: 0.02em; }
.bst-t { font-size: 22px; padding-top: 2px; font-variant-numeric: tabular-nums; }
.hud-boost.end { animation: bst-end 0.7s ease-in-out infinite alternate; }
@keyframes bst-glow {
  0%, 100% { box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 0 rgba(255, 214, 102, 0); }
  50%      { box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 3px rgba(255, 232, 160, 0.95), 0 0 16px 4px rgba(255, 196, 64, 0.75); }
}
@keyframes bst-end { 0% { opacity: 1; } 100% { opacity: 0.35; } }
@media (max-width: 600px) {
  .hud-boost { padding: 1px 8px 0 2px; gap: 4px; border-width: 2.5px; }
  .bst-x { min-width: 26px; height: 22px; font-size: 15px; }
  .bst-t { font-size: 18px; }
}
@media (max-height: 460px) and (min-width: 601px) {
  .bst-x { height: 22px; font-size: 15px; }
  .bst-t { font-size: 18px; }
}
/* round 3 (spec_r3 B): the knock-out card's x3 — the same pill (same size), fiery orange-red and a quicker beat; while it
   runs with x2 waiting, a small "+x2 6:00" segment after the time. The edge glow: gold breathing (x2), orange-red flicker (x3) */
.hud-boost.x3 { background: linear-gradient(#ffd98a, #ff8a3a 55%, #e2442c); color: #fff6e6; animation: bst-glow3 0.8s ease-in-out infinite; }
.hud-boost.x3 .bst-x { color: #ffb070; }
.hud-boost.x3 .bst-t { text-shadow: 0 2px 0 var(--hud-ink); }
.hud-boost.x3.end { animation: bst-end 0.7s ease-in-out infinite alternate; }
/* (no transform: the layout guard measures the pill's box — a scaled / turned pill touched the FAMILY button at 640 x 360) */
@keyframes bst-glow3 {
  0%, 100% { box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 0 rgba(255, 120, 50, 0); filter: brightness(1); }
  45%      { box-shadow: 3px 3px 0 var(--hud-ink), 0 0 0 3px rgba(255, 196, 120, 0.95), 0 0 20px 6px rgba(255, 90, 40, 0.8); filter: brightness(1.12); }
}
.bst-q[hidden] { display: none !important; }
/* (the queued segment never makes the pill taller: the same height as the x badge — the layout guard measured the pill
   2-4 px taller and the FAMILY button under it touched it at 640 x 360) */
.bst-q { display: inline-flex; align-items: center; gap: 3px; margin: -2px 0 0 2px; height: 22px; box-sizing: border-box; padding: 2px 6px 0 4px; border-radius: 999px;
  background: linear-gradient(#ffe9a3, var(--hud-gold)); border: 2px solid var(--hud-ink); color: var(--hud-ink); font-size: 14px; line-height: 1; text-shadow: none; }
.bst-q::before { content: '+'; font-size: 14px; }
.bst-q i { font-style: normal; font-size: 13px; color: #8a5a10; }
.bst-q b { font-weight: normal; font-variant-numeric: tabular-nums; }
.hud-boostglow { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.6s ease;
  background: radial-gradient(ellipse at center, rgba(255, 210, 90, 0) 60%, rgba(255, 200, 70, 0.22) 82%, rgba(255, 176, 40, 0.5) 100%);
  box-shadow: inset 0 0 26px 6px rgba(255, 206, 80, 0.55), inset 0 0 0 3px rgba(255, 226, 140, 0.55); }
.hud-boostglow[hidden] { display: none !important; }
.hud-boostglow.on { opacity: 1; animation: bglow2 1.8s ease-in-out infinite; }
.hud-boostglow i { position: absolute; inset: 0; opacity: 0;
  background: linear-gradient(90deg, rgba(255, 236, 160, 0.55), rgba(255, 236, 160, 0) 7%, rgba(255, 236, 160, 0) 93%, rgba(255, 236, 160, 0.55)),
              linear-gradient(0deg, rgba(255, 236, 160, 0.45), rgba(255, 236, 160, 0) 9%, rgba(255, 236, 160, 0) 91%, rgba(255, 236, 160, 0.45)); }
.hud-boostglow.on i { animation: bglow-edge 1.8s ease-in-out infinite; animation-delay: -0.9s; }
.hud-boostglow.x3 { background: radial-gradient(ellipse at center, rgba(255, 110, 40, 0) 56%, rgba(255, 96, 40, 0.28) 80%, rgba(226, 50, 70, 0.6) 100%);
  box-shadow: inset 0 0 34px 10px rgba(255, 96, 40, 0.65), inset 0 0 0 4px rgba(255, 170, 90, 0.7); }
.hud-boostglow.x3.on { animation: bglow3 0.7s ease-in-out infinite; }
.hud-boostglow.x3 i { background: linear-gradient(90deg, rgba(255, 150, 70, 0.6), rgba(255, 150, 70, 0) 8%, rgba(255, 150, 70, 0) 92%, rgba(255, 150, 70, 0.6)),
                      linear-gradient(0deg, rgba(255, 90, 60, 0.55), rgba(255, 90, 60, 0) 10%, rgba(255, 90, 60, 0) 90%, rgba(255, 90, 60, 0.55)); }
.hud-boostglow.x3.on i { animation: bglow-edge 0.7s ease-in-out infinite; animation-delay: -0.35s; }
@keyframes bglow2 { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes bglow3 { 0%, 100% { opacity: 0.6; } 30% { opacity: 1; } 55% { opacity: 0.75; } 75% { opacity: 1; } }
@keyframes bglow-edge { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
.hud-alert[data-tone="fire"] .alert-band { background: repeating-linear-gradient(-45deg, #e2442c 0 18px, #b8301e 18px 36px); }
.hud-alert[data-tone="fire"] .alert-main { color: #ffe27a; }
@media (max-width: 600px) { .bst-q { height: 19px; font-size: 12px; padding: 1px 5px 0 3px; } .bst-q i { font-size: 10px; } }
@media (max-height: 460px) and (min-width: 601px) { .bst-q { height: 19px; font-size: 12px; padding: 1px 5px 0 3px; } .bst-q i { font-size: 10px; } }
/* the FAMILY panel: the red bar of an attack announced / under way (visible with the panel open — design_amend 4) */
.tree-warn {
  --fam: #a8322a;
  flex: none; display: flex; align-items: center; gap: 8px;
  margin: 0; padding: 6px 12px 4px;
  background: linear-gradient(90deg, #b3261e, #d8463a);
  border-bottom: 3px solid var(--hud-ink); border-left: 10px solid var(--fam);
  color: #fff1dc; font-family: var(--font-display); font-size: 18px; line-height: 1.1; letter-spacing: 0.04em;
  animation: tw-pulse 0.6s ease-in-out infinite alternate;
}
.tree-warn[hidden] { display: none !important; }
.tree-warn b { font-weight: normal; }
.tw-ico { flex: none; line-height: 0; animation: boss-wave 0.5s ease-in-out infinite alternate; }
@keyframes tw-pulse { from { filter: brightness(1); } to { filter: brightness(1.22); } }
.tree-branch.warned .tree-head span { background: #b3261e; color: #fff1dc; box-shadow: 0 0 0 3px rgba(217, 70, 59, 0.6); animation: tw-pulse 0.6s ease-in-out infinite alternate; }
.tree-branch.warned .tree-row { border-radius: 8px; background: rgba(217, 70, 59, 0.12); box-shadow: 0 0 0 2px rgba(217, 70, 59, 0.45); }
/* (round 5: the FAMILY panel's x2 row is gone — the HUD's gold x2 button is the one entrance) */
html[lang|="zh"] .tree-warn { letter-spacing: 0; }
@media (prefers-reduced-motion: reduce) {
  .hud-boost.x3, .hud-boostglow.on, .hud-boostglow.on i, .hud-boostglow.x3.on, .hud-boostglow.x3.on i,
  .hud-boost, .hud-boost.end, .tree-warn, .tw-ico, .tree-branch.warned .tree-head span, .hud-boss[data-status="warn"] .boss-in { animation: none; }
}
html[lang|="zh"] .boss-name { letter-spacing: 0; }
html[lang|="zh"] .say-line { font-size: 23px; letter-spacing: 0; }
html[lang|="zh"] .lose-title { letter-spacing: 0.02em; }
@media (prefers-reduced-motion: reduce) {
  .boss-face svg, .say-face svg, .lose-don svg, .boss-flag, .hud-boss[data-status] .boss-army-bar, .hud-boss[data-status] .boss-in, .trib-chip.inv.corner { animation: none; }
}
