/* ============================================================================
   CROWNFALL — THE VISUAL LANGUAGE
   ----------------------------------------------------------------------------
   ONE source for every surface, corner, shadow, size and state colour the
   interface uses. Seventeen stylesheets used to invent these locally and three
   of them (identity.css v106, heritage.css v111, experience.css) each
   re-declared a different subset at :root, so the live value of --rad, --panel
   and the whole type scale depended on <link> order rather than on intent.
   Those duplicate :root blocks are gone; this is the only one.

   The colours below are the palette AS SHIPPED — measured off the running game
   before this pass, not re-picked. The dark warm gold-and-parchment reading is
   correct and is deliberately unchanged. What changed is that 33 border-radii,
   17 focus outlines and five modal-title sizes collapsed onto the small named
   ramps here, so two panels written two years apart now agree.

   Add a token before you add a literal. If a value is not in this block it
   should be because it is genuinely unique to one component.
   ============================================================================ */
:root {
  /* -- gold ramp: highlight, key, dim, quiet. Every gilt in the game is one
        of these four; there is no fifth gold. -- */
  --gold-hi: #ffe9a8;
  --gold: #f2c94c;
  --gold-dim: #c9a84c;
  --gold-quiet: #c9b184;  /* eyebrows and quiet gilt — 5.4:1 on a header band */

  /* -- parchment / ink neutrals. Measured against the LIGHTEST place each can
        land — #34291b at the top of a plate and #4b381e in a modal header:
        --parch 10.4 / 8.2, --parch-dim 8.0 / 6.3, --muted 6.2 / 4.9. --muted is
        the floor: nothing quieter than it may carry a sentence. The greys it
        replaces (#9a8f74 read 3.5 on a header, #8a7f6a 2.8) did not clear. -- */
  --parch: #e8dcc0;
  --parch-dim: #cfc4a8;
  --muted: #b8ab8a;

  --panel: rgba(22, 17, 12, 0.97); --panel-lt: rgba(40, 31, 22, 0.98);
  --border: #6b5432; --border-lt: #8a6f42;

  /* -- state colours. --red/--green are the legacy names and stay aliased. -- */
  --good: #98c6ab; --warn: #e0a030; --bad: #e6b197;
  --red: #d64545; --green: #5ad76e;

  /* -- surfaces. Every plate, control and card in the game is one of these. -- */
  --surf-plate: linear-gradient(145deg, #34291b, #21190f 70%, #19120c);
  --surf-header: linear-gradient(100deg, #4b381e, #2b2014);
  --surf-footer: #1e160e;
  --surf-ctl: linear-gradient(#493a24, #2b2115 50%, #21170f);
  --surf-gold: linear-gradient(#c9973e, #8d6128 52%, #493015);
  --surf-card: #302316;
  --surf-card-sel: linear-gradient(150deg, #4e3a22, #2b2015 72%);
  /* the names heritage.css introduced, kept as aliases so its rules read on */
  --heritage-panel: var(--surf-plate);
  --heritage-control: var(--surf-ctl);
  --heritage-gold: var(--surf-gold);

  /* -- the one wash: a hover lift on an otherwise transparent control -- */
  --wash-hi: rgba(255, 240, 205, 0.05);

  /* -- corners: five values and 50%. Panels 8, cards 6, controls 4, inlays 2. -- */
  --r-xs: 2px;
  --r-ctl: 4px;
  --r-card: 6px;
  --r-panel: 8px;
  --r-pill: 999px;


  /* -- depth. Four component shadows, three plain drop steps, one selected
        rim. Before this pass css/ held 167 distinct box-shadow values. -- */
  --sh-plate: inset 0 1px #eacb7540, inset 0 0 0 1px #100b08, 0 15px 45px #0009;
  --sh-card: inset 0 1px #d1ad5722, 0 3px 7px #0003;
  --sh-ctl: inset 0 1px #f2d58b24, inset 0 -1px #080603a0, 0 2px 4px #0004;
  --sh-ctl-gold: inset 0 1px #ffe7a352, inset 0 -1px #3c260d, 0 3px 7px #0005;
  --sh-sunken: inset 0 2px 8px #0006;
  --sh-1: 0 2px 6px rgba(0,0,0,0.45);    /* a control off the surface  */
  --sh-2: 0 5px 15px rgba(0,0,0,0.45);   /* a card or popover          */
  --sh-3: 0 15px 45px rgba(0,0,0,0.6);   /* a plate over the world     */
  --sel-ring: inset 0 0 0 1px rgba(235, 205, 143, 0.55);  /* the one 'this one is chosen' */
  --lift: 0 10px 26px rgba(0, 0, 0, 0.55);
  --inlay: inset 0 1px 0 rgba(255, 235, 190, 0.18), inset 0 -1px 0 rgba(0, 0, 0, 0.5);

  /* -- one focus ring. There were 17 outline declarations across css/. -- */
  --focus: #f2d278;
  --focus-ring: 2px solid var(--focus);
  --focus-off: 3px;

  /* -- type. A serif display face for titles and names, a UI face for
        everything that is read rather than announced. Ten steps, and the
        whole game used to hold 64 distinct font sizes. -- */
  --font-head: 'Cinzel', 'Times New Roman', Georgia, serif;
  --font-display: var(--font-head);
  --font-body: 'Source Sans 3', 'Segoe UI', sans-serif;
  --fs-nano: 10px;       /* legends, chip subscripts — the floor for a label */
  --fs-micro: 11px;      /* costs, locks, timestamps */
  --fs-small: 12px;      /* captions, secondary rows */
  --fs-copy: 13px;       /* dense reading inside a panel */
  --fs-body: 14px;       /* the reading size — #ui inherits it */
  --fs-lead: 15px;       /* the one lead paragraph a panel is allowed */
  --fs-h3: 17px;         /* card + section headings */
  --fs-h2: 21px;         /* sub-panel headings */
  --fs-h1: 25px;         /* MODAL TITLE — there used to be five of these */
  --fs-display: 29px;    /* the hero line on an illustrated panel */
  --tr-eyebrow: 0.085em; /* the one letter-spacing an eyebrow is allowed */

  /* -- spacing: 4 / 8 / 12 / 16 / 20 / 24 / 32. Padding and gaps land here. -- */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px;   /* --sp-1 is unused today; the
     scale is kept whole so the next 4px gap has an obvious name to reach for */
  --modal-pad-x: 20px;   /* header, tab strip, body and footer share it so they align */
  --modal-pad-y: 16px;

  /* -- the v106 material names, kept because ~90 rules read them -- */
  --cf-ink: #16110c; --cf-slate: #281f16; --cf-rim: #8a6f42;
  --cf-bronze: #c9a84c; --cf-paper: #e8dcc0; --cf-muted: #c6b899;
  --cf-oak: #342719; --cf-parchment: #e8dcc0;
  --cf-wax: #6b4a22; --cf-wax-light: #84612d;
  --cf-relief: #b2a89e; --cf-pressure: #ce9776;
}
* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0c0a08; }
#game-container { position: absolute; inset: 0; }
#game-container canvas { display: block; }
#ui { position: absolute; inset: 0; pointer-events: none; font-family: var(--font-body); color: var(--parch); }
#ui > * { pointer-events: auto; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
#topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 12px;
  background: linear-gradient(180deg, rgba(14,11,8,0.96), rgba(14,11,8,0.7) 80%, transparent);
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.logo-mini { font-family: var(--font-head); font-weight: 900; font-size: var(--fs-lead); color: var(--gold); letter-spacing: 2px; text-shadow: 0 2px 6px #000; }
.logo-mini span { font-size: var(--fs-copy); }
.tb-spacer { flex: 1; }
#resbar { display: flex; gap: 5px; }
.res {
  display: flex; align-items: center; gap: 4px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 3px 11px 3px 8px;
  font-size: var(--fs-copy); font-weight: 600;
}
.res.capped span:last-child { color: #ff9c6b !important; }
.chip {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 4px 12px;
  font-family: var(--font-head); font-size: var(--fs-small); font-weight: 700; white-space: nowrap;
  color: #f0e6cc;
}
.chip .sub2 { font-family: var(--font-body); font-weight: 400; font-size: var(--fs-nano); color: #cabf9e; }
#popchip { color: #ffe9b8; border-color: #6b5a3a; }
.tic { vertical-align: -6px; margin-right: 2px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.usel-pick { cursor: pointer; transition: all 0.12s; }
.usel-pick:hover { color: var(--gold); transform: translateY(-1px); }
.sp-form { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 4px 0; }
.sp-form-l { font-size: var(--fs-nano); color: var(--muted); }
.form-btn {
  font-size: var(--fs-micro); font-weight: 600;
  padding: 3px 8px; cursor: pointer; transition: all 0.12s;
}
.form-btn:hover { border-color: var(--gold); transform: translateY(-1px); }
.bcard-icon .tic { vertical-align: middle; }

/* research tree — parchment war-table look */
.research-modal .tech {
  transition: all 0.15s;
  background: linear-gradient(180deg, #3a2d1e, #2a2015);
  border-radius: var(--r-card);
}
.research-modal .tech:not(.locked):not(.done):hover {
  transform: translateY(-2px);
  border-color: var(--gold) !important;
  box-shadow: 0 0 14px rgba(242,201,76,0.35);
}
.research-modal .tech.done { box-shadow: inset 0 0 12px rgba(90,215,110,0.15); }
.research-modal h2 { text-shadow: 0 0 18px rgba(242,201,76,0.35); }
.chip .danger { color: #ff8a7a; animation: pulse-red 1.1s infinite; }
@keyframes pulse-red { 50% { text-shadow: 0 0 10px rgba(214,69,69,0.9); } }
.tb-controls { display: flex; gap: 4px; }
.icon-btn {
  width: 33px; height: 33px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-card);
  color: var(--parch); font-size: var(--fs-body); cursor: pointer; transition: all 0.12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--gold-dim); transform: translateY(-1px); color: var(--gold); }
.icon-btn svg { width: 16px; height: 16px; display: block; }
.btab svg { width: 14px; height: 14px; display: block; margin: auto; }
/* icon slots whose emoji was scrubbed collapse cleanly instead of leaving a gap */
.crisis-icon:empty, .dip-icon:empty, .sp-icon:empty, .relic-bal:empty { display: none; }
.pm-ico svg { width: 11px; height: 11px; display: block; }

.hud-btn {
  background: linear-gradient(180deg, #4a3a24, #35281a);
  border: 1px solid var(--border-lt); border-radius: var(--r-card);
  color: var(--parch); font-size: var(--fs-small); font-weight: 600;
  padding: 7px 12px; cursor: pointer; transition: all 0.12s;
}
.hud-btn:hover { border-color: var(--gold); transform: translateY(-1px); }
.hud-btn.gold { background: linear-gradient(180deg, #8a6f2a, #5c4a1c); border-color: var(--gold-dim); color: var(--gold-hi); }
.hud-btn.danger { background: linear-gradient(180deg, #5c2a24, #3a1a16); border-color: #8a4a3a; color: #f0b8a8; }
.hud-btn.disabled { opacity: 0.45; }
#ageup-btn { animation: age-glow 1.6s ease-in-out infinite; }
@keyframes age-glow { 0%,100% { box-shadow: 0 0 4px rgba(242,201,76,0.3); } 50% { box-shadow: 0 0 16px rgba(242,201,76,0.8); } }

/* ---------- build bar ---------- */
#buildbar {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; pointer-events: none;
}
#buildtabs { display: flex; gap: 4px; pointer-events: auto; flex-wrap: wrap; justify-content: center; max-width: 98vw; }
.btab {
  background: var(--panel); border: 2px solid var(--border); border-bottom: none;
  border-radius: var(--r-card) var(--r-card) 0 0; color: #b8ab8a;
  font-family: var(--font-head); font-weight: 700; font-size: var(--fs-small);
  padding: 5px 15px 4px; cursor: pointer; white-space: nowrap;
}
@media (max-width: 560px) { .btab { padding: 5px 9px 4px; font-size: var(--fs-micro); } }
.btab.on { background: var(--panel-lt); color: var(--gold); border-color: var(--border-lt); }
#buildcards {
  display: flex; gap: 6px; pointer-events: auto; flex-wrap: wrap; justify-content: center;
  width: min(96vw, 980px);
  max-height: 34vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel-lt); border: 2px solid var(--border-lt); border-bottom: none;
  border-radius: var(--r-panel) var(--r-panel) 0 0; padding: 8px 10px 10px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.6);
  scrollbar-width: thin; scrollbar-color: #6b5a3a #2a2015;
}
#buildcards::-webkit-scrollbar { width: 9px; }
#buildcards::-webkit-scrollbar-track { background: #241b10; border-radius: var(--r-card); }
#buildcards::-webkit-scrollbar-thumb { background: #6b5a3a; border-radius: var(--r-card); border: 2px solid #241b10; }
#buildcards.folded { display: none; }
.bera {
  flex-basis: 100%; display: flex; align-items: center; gap: 8px;
  font-family: var(--font-head); font-size: var(--fs-nano); font-weight: 700; letter-spacing: 1.5px;
  color: var(--era-c, #c9a84c); text-transform: uppercase;
  margin: 3px 2px 1px;
}
.bera::before, .bera::after { content: ''; height: 1px; background: currentColor; opacity: 0.35; flex: 1; }
.bera.locked { color: var(--muted); }
.bera-lock { font-size: var(--fs-nano); opacity: 0.7; letter-spacing: 1px; }
.btab.bfold { padding: 5px 11px 4px; font-size: var(--fs-nano); min-width: 32px; }
.ric { vertical-align: -2px; margin-right: 1px; }
.bcard {
  position: relative; width: 78px; padding: 6px 3px;
  background: linear-gradient(180deg, #3a2d1e, #2a2015);
  border: 1.5px solid var(--border); border-radius: var(--r-card);
  text-align: center; cursor: pointer; transition: all 0.13s;
}
.bcard:hover { transform: translateY(-4px); border-color: var(--gold-dim); }
.bcard.selected { border-color: var(--gold); box-shadow: 0 0 14px rgba(242,201,76,0.5); transform: translateY(-4px); }
.bcard.locked { opacity: 0.45; filter: grayscale(0.7); }
.bcard-icon { font-size: var(--fs-h2); }
.bcard-name { font-size: var(--fs-nano); font-weight: 700; margin: 2px 0 1px; line-height: 1.1; }
.bcard-cost { font-size: 8.5px; color: #b8ab8a; }
.bcard-lock { font-size: 8.5px; color: var(--muted); }
.bcard-work { position: absolute; top: 2px; right: 3px; font-size: 8.5px; color: #9ba58a; }

body.rally-cursor, body.rally-cursor canvas { cursor: crosshair !important; }

/* ---------- game tooltip: instant parchment ---------- */
#gametip {
  position: fixed; z-index: 10000; pointer-events: none;
  max-width: 300px; padding: 8px 11px;
  background: linear-gradient(180deg, #372b1c 0%, #241b10 100%);
  border: 1.5px solid #6b5a3a; border-radius: var(--r-card);
  box-shadow: 0 6px 22px rgba(0,0,0,0.75), inset 0 1px 0 rgba(255,230,180,0.08);
  color: #e8dcc0; font-family: var(--font-body); font-size: var(--fs-small); line-height: 1.5;
  opacity: 0; transform: translateY(3px); transition: opacity 0.06s, transform 0.06s;
}
#gametip.on { opacity: 1; transform: translateY(0); }
#gametip b { color: var(--gold); }

/* diplomacy depth */
.dip-size { font-size: var(--fs-nano); color: #b8ab8a; margin-left: 8px; }
.dip-blurb { font-size: var(--fs-micro); color: var(--parch-dim); font-style: italic; margin: 3px 0 1px; }
.dip-likes { font-size: var(--fs-micro); color: #a89d80; margin: 2px 0; }
.dip-likes b { color: #d8cba6; font-weight: 600; }
.dip-next { font-size: var(--fs-micro); color: #9ad9ff; margin: 2px 0 4px; }
.dip-log { font-size: var(--fs-nano); line-height: 1.55; background: rgba(0,0,0,0.22); border-radius: var(--r-card); padding: 5px 8px; margin: 3px 0; }
.dip-log .good-t { color: #8fd98a; }
.dip-log .bad-t { color: #e08a7a; }
.dip-relbar { position: relative; }
.dip-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: rgba(232,220,192,0.5); }

/* control-group chips */
#groupbar { position: absolute; left: 12px; bottom: 132px; display: flex; flex-direction: column; gap: 5px; }
.gchip {
  position: relative; display: flex; align-items: center; gap: 5px;
  background: var(--panel); border: 1.5px solid var(--border-lt); border-radius: var(--r-card);
  color: var(--gold); font-family: var(--font-head); font-weight: 800; font-size: var(--fs-body);
  padding: 5px 10px; cursor: pointer; transition: all 0.12s;
}
.gchip:hover { border-color: var(--gold); transform: translateX(2px); }
.gchip .gn { font-family: var(--font-body); font-weight: 600; font-size: var(--fs-micro); color: #cabf9e; }
.gchip .gx { font-size: var(--fs-nano); color: var(--muted); margin-left: 2px; }
.gchip .gx:hover { color: #ff8a7a; }

/* ---------- title screen: a dusk over the realm ---------- */
.title-screen { position: relative; overflow: hidden; border-radius: var(--r-panel); }
.title-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 300' preserveAspectRatio='xMidYMax slice'%3E%3Cpath d='M0 300 L0 240 L60 235 L90 200 L100 235 L180 230 L210 190 L214 165 L222 190 L226 230 L310 236 L330 205 L338 178 L344 150 L352 178 L360 205 L380 236 L470 232 L490 200 L498 232 L560 228 L600 245 L700 238 L740 210 L748 238 L800 242 L800 300 Z' fill='%23150f0a'/%3E%3Cpath d='M330 205 L338 178 L344 150 L352 178 L360 205 Z M210 190 L214 165 L222 190 Z' fill='%231c140c'/%3E%3Ccircle cx='345' cy='190' r='3' fill='%23ffb040' opacity='0.9'/%3E%3Ccircle cx='217' cy='198' r='2.4' fill='%23ffb040' opacity='0.8'/%3E%3Ccircle cx='493' cy='214' r='2.4' fill='%23ffb040' opacity='0.7'/%3E%3C/svg%3E") bottom / cover no-repeat,
    linear-gradient(180deg, #0a0c1c 0%, #1a1430 34%, #3a2438 58%, #7a3c30 82%, #b06038 100%);
}
.title-stars { position: absolute; inset: 0 0 40% 0; z-index: 0; pointer-events: none; opacity: 0.8;
  background-image: radial-gradient(1.2px 1.2px at 12% 24%, #fff8, transparent),
    radial-gradient(1px 1px at 34% 12%, #fff6, transparent),
    radial-gradient(1.4px 1.4px at 58% 30%, #fff9, transparent),
    radial-gradient(1px 1px at 72% 16%, #fff5, transparent),
    radial-gradient(1.2px 1.2px at 88% 26%, #fff7, transparent),
    radial-gradient(1px 1px at 46% 40%, #fff4, transparent),
    radial-gradient(1.3px 1.3px at 22% 45%, #fff6, transparent);
  animation: star-breathe 5s ease-in-out infinite;
}
@keyframes star-breathe { 0%, 100% { opacity: 0.75; } 50% { opacity: 0.45; } }
.title-screen > *:not(.title-bg):not(.title-stars):not(.title-rays):not(.title-clouds):not(.title-mist):not(.title-aura):not(.title-kingdom-vfx):not(.title-foreground):not(.title-vignette):not(.ember-fx) { position: relative; z-index: 3; }
.title-screen { min-width: min(88vw, 720px); min-height: min(80vh, 540px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 28px 34px; }
.title-logo {
  background: linear-gradient(100deg, #a87c1e 0%, #ffe9a8 22%, #f2c94c 40%, #fff6d8 50%, #f2c94c 60%, #a87c1e 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.8));
  position: relative; letter-spacing: 6px;
  animation: logo-shine 5.5s ease-in-out infinite;
}
@keyframes logo-shine { 0%, 25% { background-position: 120% 0; } 60%, 100% { background-position: -60% 0; } }
.title-crest {
  filter: drop-shadow(0 0 26px rgba(242,201,76,0.7));
  animation: crest-float 4.5s ease-in-out infinite;
  font-size: 46px;
}
@keyframes crest-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
/* horizon mist creeping across the silhouette */
.title-mist {
  position: absolute; left: -30%; right: -30%; bottom: 6%; height: 24%;
  z-index: 0; pointer-events: none; opacity: 0.5;
  background: linear-gradient(180deg, transparent 0%, rgba(180,150,190,0.14) 45%, rgba(120,90,110,0.2) 100%);
  filter: blur(6px);
  animation: mist-drift 26s linear infinite alternate;
}
@keyframes mist-drift { 0% { transform: translateX(-6%); } 100% { transform: translateX(6%); } }
/* the crown's aura breathing behind the logo */
.title-aura {
  position: absolute; top: 6%; left: 50%; width: 340px; height: 240px;
  transform: translateX(-50%); z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(242,201,76,0.22) 0%, rgba(242,201,76,0.06) 45%, transparent 70%);
  animation: aura-breathe 6s ease-in-out infinite;
}
@keyframes aura-breathe { 0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); } 50% { opacity: 1; transform: translateX(-50%) scale(1.12); } }
.title-ver { font-size: var(--fs-micro); letter-spacing: 2.5px; color: var(--muted); text-transform: uppercase; margin-top: 6px; }
/* clean section headers in the guide */
.guide-modal .help-body h3 {
  font-family: var(--font-head); font-size: var(--fs-copy); letter-spacing: 2px; color: var(--gold);
  margin: 12px 0 3px; border-bottom: 1px solid var(--border); padding-bottom: 3px; text-transform: uppercase;
}
.guide-modal .help-body { max-height: 62vh; overflow-y: auto; padding-right: 8px; scrollbar-width: thin; scrollbar-color: #6b5a3a #2a2015; }

/* ---------- era ceremony ---------- */
.era-modal { text-align: center; max-width: 560px; border-color: var(--era-c, #c9a84c) !important; }
.era-num {
  font-family: var(--font-head); font-size: 74px; font-weight: 800; line-height: 1;
  color: var(--era-c, #c9a84c); text-shadow: 0 0 30px rgba(242,201,76,0.45), 0 3px 0 rgba(0,0,0,0.5);
  animation: era-pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes era-pop { 0% { transform: scale(0.2); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.era-name { color: var(--era-c, #c9a84c) !important; letter-spacing: 3px; margin: 2px 0 4px; }
.era-desc { color: var(--parch-dim); font-style: italic; margin: 0 0 8px; }
.era-gift { color: var(--gold-hi); font-size: var(--fs-copy); margin: 0 0 8px; }
.era-reel {
  display: flex; flex-wrap: wrap; gap: 5px; justify-content: center;
  max-height: 180px; overflow-y: auto; margin: 4px 0 8px; padding: 6px;
  background: rgba(0,0,0,0.25); border-radius: var(--r-panel);
}
.era-un {
  display: flex; align-items: center; gap: 5px;
  background: #3a2d1e; border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 3px 8px; font-size: var(--fs-micro); font-weight: 600;
  animation: era-pop 0.5s ease both;
}
.era-un-ic { font-size: var(--fs-body); }
.era-un:nth-child(2) { animation-delay: 0.05s; } .era-un:nth-child(3) { animation-delay: 0.1s; }
.era-un:nth-child(4) { animation-delay: 0.15s; } .era-un:nth-child(5) { animation-delay: 0.2s; }
.era-un:nth-child(6) { animation-delay: 0.25s; } .era-un:nth-child(7) { animation-delay: 0.3s; }
.era-un:nth-child(8) { animation-delay: 0.35s; } .era-un:nth-child(9) { animation-delay: 0.4s; }
.era-techs { color: var(--muted); font-size: var(--fs-micro); margin: 0 0 8px; }

/* ---------- spell bar ---------- */
#spellbar { position: absolute; bottom: 132px; left: 50%; transform: translateX(-50%); display: flex; gap: 7px; }
.spell {
  position: relative; width: 54px; height: 66px;
  background: linear-gradient(180deg, rgba(40,32,58,0.96), rgba(22,17,34,0.96));
  border: 2px solid #4a3d6b; border-radius: var(--r-panel);
  cursor: pointer; text-align: center; transition: all 0.13s;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  box-shadow: inset 0 1px 0 rgba(157,123,255,0.14);
}
.spell:hover { transform: translateY(-3px); border-color: #9d7bff; box-shadow: 0 0 14px rgba(157,123,255,0.35); }
.spell.selected { border-color: #d4beff; box-shadow: 0 0 16px rgba(157,123,255,0.8); }
.spell.cooling { opacity: 0.55; }
.spell-icon { width: 30px; height: 30px; }
.spell-icon svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.spell-name { font-size: 8px; color: #c7b8ef; font-family: var(--font-head); letter-spacing: 0.2px; line-height: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spell-cost { font-size: var(--fs-nano); color: #d4c6ff; font-weight: 700; display: flex; align-items: center; gap: 2px; }
.spell-cd { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(10,8,20,0.7); border-radius: var(--r-card); font-family: var(--font-head); font-size: var(--fs-h3); font-weight: 700; color: #fff; }

/* ---------- selection panel ---------- */
#selpanel {
  position: absolute; left: 12px; bottom: 12px; width: 300px;
  max-height: 55vh; overflow-y: auto;
  background: var(--panel); border: 2px solid var(--border-lt); border-radius: var(--r-panel);
  padding: 12px; box-shadow: var(--sh-2);
}
.sp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.sp-icon { font-size: var(--fs-h1); }
.sp-name { font-family: var(--font-head); font-weight: 700; font-size: var(--fs-lead); flex: 1; }
.sp-lv { color: var(--gold); font-size: var(--fs-small); }
.sp-close { background: none; border: none; color: var(--parch); font-size: var(--fs-lead); cursor: pointer; opacity: 0.6; }
.sp-close:hover { opacity: 1; }
.sp-hp { position: relative; height: 15px; background: rgba(0,0,0,0.55); border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--border); margin-bottom: 7px; }
.sp-hpfill { height: 100%; background: linear-gradient(90deg, #3a8a4a, #5ad76e); transition: width 0.3s; }
.sp-hpfill.low { background: linear-gradient(90deg, #8a3a2a, #d64545); }
.sp-hp span { position: absolute; inset: 0; text-align: center; font-size: var(--fs-nano); line-height: 15px; color: #fff; text-shadow: 0 1px 2px #000; }
.sp-row { font-size: var(--fs-small); margin: 4px 0; color: var(--parch-dim); }
.sp-row.muted, .muted { color: var(--muted); font-size: var(--fs-micro); }
.good-t { color: var(--green); } .bad-t { color: #ff8a7a; }
.sp-foot { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.sp-units { display: flex; flex-direction: column; gap: 4px; margin: 5px 0; }
.sp-unit {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; align-items: center;
  background: rgba(60,45,30,0.6); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 5px 8px; cursor: pointer; font-size: var(--fs-micro);
}
.sp-unit:hover { border-color: var(--gold-dim); }
.sp-unit.locked { opacity: 0.5; }
.spu-icon { font-size: var(--fs-lead); }
.spu-cost { font-size: var(--fs-nano); color: #b8ab8a; }
.sp-queue { display: flex; align-items: center; gap: 6px; font-size: var(--fs-micro); margin: 5px 0; }
.sp-qbar { flex: 1; height: 8px; background: rgba(0,0,0,0.5); border-radius: var(--r-ctl); overflow: hidden; }
.sp-qbar div { height: 100%; background: var(--gold); }
.sp-trades { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; margin: 5px 0; }
.sp-trade { background: rgba(60,45,30,0.6); border: 1px solid var(--border); border-radius: var(--r-card); color: var(--parch); padding: 6px 3px; cursor: pointer; font-size: var(--fs-nano); }
.sp-trade:hover { border-color: var(--gold-dim); }
.sp-units-sel { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.usel { background: rgba(60,45,30,0.7); border: 1px solid var(--border); border-radius: var(--r-card); padding: 3px 8px; font-size: var(--fs-micro); }

/* ---------- minimap ---------- */
#minimap-wrap { position: absolute; bottom: 12px; right: 12px; border: 2px solid var(--border-lt); border-radius: var(--r-panel); overflow: hidden; line-height: 0; box-shadow: var(--sh-2); }
#minimap { cursor: pointer; }

/* ---------- toasts, banner ---------- */
#toasts { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; z-index: 60; }
.toast {
  background: var(--panel); border: 1px solid var(--border-lt); border-radius: var(--r-card);
  padding: 7px 16px; font-size: var(--fs-small); font-weight: 600;
  opacity: 0; transform: translateY(-8px); transition: all 0.35s ease;
  max-width: 520px; text-align: center; box-shadow: var(--sh-2);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.good { border-color: #4a8a54; color: #b8e8c0; }
.toast.warn { border-color: #8a6f2a; color: #f0d8a0; }
.toast.bad { border-color: #8a3a2a; color: #f0b0a0; }
.toast.ach { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 18px rgba(242,201,76,0.35); }
#banner { position: absolute; top: 24%; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; z-index: 55; }
#banner-title { font-family: var(--font-head); font-size: 42px; font-weight: 900; letter-spacing: 5px; text-shadow: 0 3px 14px #000, 0 0 40px rgba(242,201,76,0.25); }
#banner-sub { font-family: var(--font-head); font-size: var(--fs-lead); color: var(--parch); margin-top: 5px; text-shadow: 0 2px 8px #000; letter-spacing: 1px; }
#banner.anim #banner-title { animation: banner-in 3.6s ease forwards; }
#banner.anim #banner-sub { animation: banner-in 3.6s 0.15s ease forwards; opacity: 0; }
@keyframes banner-in {
  0% { opacity: 0; transform: scale(0.72) translateY(18px); }
  12% { opacity: 1; transform: scale(1.05) translateY(0); }
  18% { transform: scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.02) translateY(-12px); }
}
#paused-note {
  position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%);
  font-family: var(--font-head); font-size: var(--fs-display); font-weight: 900; letter-spacing: 6px;
  background: rgba(14,10,7,0.75); border: 2px solid var(--border-lt); border-radius: var(--r-panel);
  padding: 12px 34px; pointer-events: none; z-index: 50;
}
#cursor-hint {
  position: absolute; top: 52%; left: 50%; transform: translateX(-50%);
  font-size: var(--fs-copy); color: #ff9c8a; background: rgba(14,10,7,0.8);
  border: 1px solid #8a4a3a; border-radius: var(--r-card); padding: 5px 14px; pointer-events: none;
}

/* ---------- modals ---------- */
/* NO backdrop-filter on the scrim. It sits directly over the WebGL canvas, and a backdrop
   blur there costs a full-frame readback every frame the modal is open AND (in this browser)
   flattens the world behind it to solid black, so the game vanished the instant any panel
   opened and the panel itself came back muddy. A plain scrim plus a soft radial pool reads
   better and costs nothing — see also the two other "NO backdrop-filter" notes below. */
#modal-layer {
  position: absolute; inset: 0; z-index: 100;
  background:
    radial-gradient(ellipse 62% 62% at 50% 46%, rgba(8, 6, 4, 0.62), rgba(4, 3, 2, 0.90) 78%);
  backdrop-filter: none;
  display: flex; align-items: center; justify-content: center;
}
#modal-box { max-height: 94vh; overflow-y: auto; }
.menu-modal, .big-modal, .title-screen {
  /* surface, border and depth come from the one plate rule in heritage.css */
  padding: var(--sp-6) var(--sp-7); text-align: center; min-width: 380px;
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.big-modal { min-width: 620px; max-width: 760px; }
.menu-modal h2, .big-modal h2 { font-family: var(--font-head); font-size: var(--fs-h2); letter-spacing: 2px; color: var(--gold); }
.modal-text { font-size: var(--fs-copy); color: var(--parch-dim); line-height: 1.55; }
.menu-info { font-size: var(--fs-small); color: #b8ab8a; line-height: 1.6; }
.title-btn {
  background: linear-gradient(180deg, #4a3a24, #33271a);
  border: 1.5px solid var(--border-lt); border-radius: var(--r-panel);
  color: var(--parch); font-family: var(--font-head); font-weight: 700; font-size: var(--fs-body);
  letter-spacing: 1px; padding: 11px 22px; cursor: pointer; transition: all 0.15s;
}
.title-btn:hover { border-color: var(--gold); transform: translateY(-2px); }
.title-btn.primary { background: linear-gradient(180deg, #8a6f2a, #5c4a1c); border-color: var(--gold-dim); color: var(--gold-hi); font-size: var(--fs-lead); }
.title-btn.gold { background: linear-gradient(180deg, #7a5f9a, #4a3a66); border-color: #9d7bff; color: #e8dcff; }
.title-btn.danger { border-color: #8a4a3a; color: #f0b8a8; }
.title-btn.small { font-size: var(--fs-micro); padding: 8px 13px; }
.title-row { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }
.title-screen { min-width: 480px; border-color: var(--gold-dim); position: relative; overflow: hidden; }
.title-crest { font-size: 52px; line-height: 1; filter: drop-shadow(0 0 20px rgba(242,201,76,0.5)); }
.title-logo {
  font-family: var(--font-head); font-size: 54px; font-weight: 900; letter-spacing: 11px;
  background: linear-gradient(180deg, #ffe9a8, var(--gold) 55%, #a87c1c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.7));
}
.title-sub { font-family: var(--font-head); font-size: var(--fs-copy); letter-spacing: 3px; color: #b8ab8a; }
.title-stats { font-size: var(--fs-small); color: var(--muted); }

/* Crownfall title: a hilltop view over a finished kingdom */
#modal-layer:has(.title-screen) {
  background: #020506;
  /* NO backdrop-filter: the background above is fully opaque, so a backdrop blur
     is INVISIBLE — but backdrop-filter still forces the browser to re-blur the
     entire viewport every frame the WebGL canvas behind repaints (60+/s). That
     per-frame full-screen blur scales with monitor resolution/refresh, so it
     lagged even high-end PCs on the static title. Must be `none` explicitly, or
     it falls back to #modal-layer's base blur(3px). */
  backdrop-filter: none;
}
#modal-box:has(.title-screen) {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}
.title-screen {
  width: 100vw;
  max-width: none;
  min-width: 0;
  height: 100vh;
  min-height: 0;
  border: 0;
  border-radius: 0;
  justify-content: flex-start;
  gap: 8px;
  padding: clamp(24px, 3.4vh, 38px) clamp(52px, 6vw, 92px) clamp(26px, 4vh, 44px);
  isolation: isolate;
  background: #07110f;
  box-shadow: inset 0 0 140px rgba(0,0,0,0.82);
}
.title-screen::before,
.title-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.title-screen::before {
  z-index: 3;
  border: 1px solid rgba(255,233,168,0.18);
  margin: 18px;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.7),
    inset 0 0 72px rgba(0,0,0,0.66);
}
.title-screen::after {
  z-index: 2;
  opacity: 0.32;
  background:
    linear-gradient(90deg, transparent 0 49.8%, rgba(255,246,204,0.2) 49.95% 50.05%, transparent 50.2%),
    linear-gradient(0deg, transparent 0 49.8%, rgba(255,246,204,0.12) 49.95% 50.05%, transparent 50.2%);
  mask-image: radial-gradient(ellipse at 50% 36%, black 0 14%, transparent 47%);
}
.title-bg {
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2,5,7,0.48) 0%, rgba(2,5,7,0.18) 34%, rgba(4,7,5,0.34) 68%, rgba(0,0,0,0.82) 100%),
    url("../assets/title-kingdom-hd.webp?v=98") center center / cover no-repeat,
    linear-gradient(180deg, #0c2230 0%, #2c4b38 62%, #6c5a32 100%);
  transform: scale(1.052);
  filter: blur(2.4px) saturate(1.02) contrast(1.06) brightness(0.76);
  animation: kingdom-camera 28s ease-in-out infinite alternate;
}
@keyframes kingdom-camera {
  0% { transform: scale(1.052) translate3d(-0.35%, -0.25%, 0); }
  100% { transform: scale(1.078) translate3d(0.45%, 0.25%, 0); }
}
.title-stars {
  inset: 0;
  opacity: 0.7;
  background-image:
    radial-gradient(2px 2px at 44% 55%, #fff4bf, transparent),
    radial-gradient(1.8px 1.8px at 53% 62%, #ffe59b, transparent),
    radial-gradient(1.6px 1.6px at 61% 50%, #fff0aa, transparent),
    radial-gradient(2px 2px at 76% 58%, #fff0aa, transparent),
    radial-gradient(1.8px 1.8px at 23% 72%, #fff0aa, transparent),
    radial-gradient(1.4px 1.4px at 86% 75%, #fff0aa, transparent);
  animation: kingdom-glints 4.2s ease-in-out infinite;
}
@keyframes kingdom-glints { 50% { opacity: 0.28; filter: blur(0.7px); } }
.title-screen > .title-rays {
  position: absolute;
  inset: -18% -8% 0 -8%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.34;
  background:
    conic-gradient(from 128deg at 13% 10%, transparent 0deg, rgba(255,232,159,0.2) 12deg, transparent 25deg, transparent 45deg, rgba(255,232,159,0.14) 58deg, transparent 72deg, transparent 360deg);
  mix-blend-mode: screen;
  animation: rays-drift 13s ease-in-out infinite alternate;
}
@keyframes rays-drift { 100% { transform: translateX(-1.2%) rotate(-1deg); opacity: 0.62; } }
.title-screen > .title-clouds {
  position: absolute;
  inset: -4% -18% 40% -18%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.46;
  background:
    radial-gradient(ellipse at 12% 42%, rgba(255,255,255,0.16) 0 10%, transparent 34%),
    radial-gradient(ellipse at 42% 26%, rgba(255,255,255,0.12) 0 9%, transparent 34%),
    radial-gradient(ellipse at 78% 34%, rgba(255,255,255,0.14) 0 11%, transparent 35%),
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent 70%);
  filter: blur(8px);
  animation: cloud-drift 34s linear infinite alternate;
}
@keyframes cloud-drift { 100% { transform: translateX(8%); } }
.title-screen > .title-aura {
  position: absolute;
  z-index: 1;
  top: 11%;
  left: 50%;
  width: min(68vw, 920px);
  height: 34vh;
  transform: translateX(-50%);
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(255,233,168,0.28) 0%, rgba(124,184,143,0.14) 36%, transparent 72%);
  mix-blend-mode: screen;
  animation: aura-breathe 7s ease-in-out infinite;
}
.title-screen > .title-mist {
  position: absolute;
  z-index: 1;
  left: -20%;
  right: -20%;
  bottom: 16%;
  height: 34%;
  opacity: 0.58;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 28% 72%, rgba(226,234,204,0.19) 0 14%, transparent 38%),
    radial-gradient(ellipse at 72% 62%, rgba(226,234,204,0.14) 0 12%, transparent 34%),
    repeating-linear-gradient(101deg, transparent 0 48px, rgba(232,220,192,0.08) 50px 68px, transparent 70px 128px);
  filter: blur(8px);
  animation: mist-drift 32s linear infinite alternate;
}
.title-screen > .title-kingdom-vfx {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.5;
  background:
    radial-gradient(3px 3px at 49% 42%, rgba(255,240,166,0.58), transparent 62%),
    radial-gradient(3px 3px at 55% 49%, rgba(255,240,166,0.48), transparent 64%),
    radial-gradient(2px 2px at 43% 55%, rgba(255,229,155,0.42), transparent 64%),
    radial-gradient(2px 2px at 62% 59%, rgba(255,229,155,0.38), transparent 64%),
    radial-gradient(2px 2px at 31% 67%, rgba(255,229,155,0.34), transparent 64%),
    radial-gradient(2px 2px at 82% 68%, rgba(255,229,155,0.3), transparent 64%);
  mix-blend-mode: screen;
  animation: lantern-pulse 3.5s ease-in-out infinite;
}
.title-screen > .title-kingdom-vfx::before,
.title-screen > .title-kingdom-vfx::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.title-screen > .title-kingdom-vfx::before {
  opacity: 0.24;
  background:
    linear-gradient(112deg, transparent 31%, rgba(255,246,204,0.15) 43%, rgba(255,211,108,0.08) 48%, transparent 60%);
  mix-blend-mode: screen;
  transform: translateX(-24%);
  animation: kingdom-sweep 8.5s ease-in-out infinite;
}
.title-screen > .title-kingdom-vfx::after {
  opacity: 0.44;
  background:
    radial-gradient(5px 5px at 51% 35%, rgba(255,246,204,0.56), transparent 65%),
    radial-gradient(4px 4px at 47% 47%, rgba(255,211,108,0.5), transparent 66%),
    radial-gradient(4px 4px at 59% 52%, rgba(255,211,108,0.42), transparent 66%),
    radial-gradient(3px 3px at 36% 63%, rgba(255,224,143,0.34), transparent 66%),
    radial-gradient(3px 3px at 71% 64%, rgba(255,224,143,0.32), transparent 66%);
  filter: blur(0.4px);
  animation: castle-sparkle 4.8s ease-in-out infinite;
}
@keyframes lantern-pulse { 50% { opacity: 0.42; filter: blur(1px); } }
@keyframes kingdom-sweep {
  0%, 28% { transform: translateX(-32%); opacity: 0; }
  48% { opacity: 0.42; }
  72%, 100% { transform: translateX(32%); opacity: 0; }
}
@keyframes castle-sparkle {
  0%, 100% { opacity: 0.32; transform: scale(1); }
  45% { opacity: 0.82; transform: scale(1.012); }
}
.title-screen > .title-foreground {
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: 0;
  z-index: 2;
  height: 34%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(10,12,9,0.98) 0%, rgba(6,8,6,0.92) 48%, transparent 74%),
    linear-gradient(180deg, transparent 0%, rgba(3,5,4,0.58) 26%, #020303 100%);
}
.title-screen > .title-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 0 30%, rgba(0,0,0,0.3) 63%, rgba(0,0,0,0.8) 100%),
    linear-gradient(90deg, rgba(0,0,0,0.68), transparent 18% 82%, rgba(0,0,0,0.68)),
    linear-gradient(180deg, rgba(0,0,0,0.42), transparent 20%, rgba(0,0,0,0.2) 58%, rgba(0,0,0,0.76));
}
.title-screen > .title-crest,
.title-screen > .title-logo,
.title-screen > .title-sub,
.title-screen > .title-stats,
.title-screen > .title-menu,
.title-screen > .title-ver {
  position: relative;
  z-index: 4;
}
.title-crest {
  line-height: 0.9;
  margin-top: clamp(6px, 1.5vh, 18px);
}
.title-crest svg {
  width: clamp(76px, 8.5vh, 104px);
  height: auto;
  display: block;
  filter:
    drop-shadow(0 0 20px rgba(242,201,76,0.6))
    drop-shadow(0 7px 16px rgba(0,0,0,0.85));
}
.title-logo {
  font-size: clamp(94px, 9.8vw, 148px);
  letter-spacing: 0.035em;
  line-height: 0.9;
  margin: 0;
  background: linear-gradient(180deg, #fffbe2 0%, #f2c94c 43%, #b57629 76%, #5d381b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter:
    drop-shadow(0 7px 0 rgba(0,0,0,0.58))
    drop-shadow(0 0 24px rgba(242,201,76,0.38))
    drop-shadow(0 0 58px rgba(8,8,6,0.86));
}
.title-logo::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,244,200,0.3);
  transform: translateY(5px);
  z-index: -1;
}
.title-sub {
  margin-top: 6px;
  font-size: clamp(16px, 1.55vw, 22px);
  letter-spacing: 0.08em;
  color: #f0e6cc;
  text-shadow: 0 3px 12px #000, 0 0 18px rgba(0,0,0,0.8);
}
.title-stats {
  min-height: 24px;
  margin: 6px 0 0;
  padding: 6px 16px;
  color: #f0d58d;
  background: rgba(5,7,5,0.48);
  border: 1px solid rgba(255,233,168,0.24);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-2);
}
.title-menu {
  width: min(720px, 58vw);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin-top: clamp(34px, 5.2vh, 58px);
  margin-bottom: 0;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255,246,204,0.08), transparent 18%),
    linear-gradient(180deg, rgba(5,7,6,0.62), rgba(2,3,3,0.76));
  border: 1px solid rgba(255,233,168,0.26);
  border-radius: var(--r-card);
  box-shadow:
    0 26px 70px rgba(0,0,0,0.64),
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 0 36px rgba(242,201,76,0.06);
  /* NO backdrop-filter: a blur(14px) here re-blurred the ambient glow layers
     behind the menu every frame (large kernel = costly). The translucent gradient
     background above already reads as a panel. */
}
.title-screen .title-btn {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-card);
  letter-spacing: 0.04em;
  border: 1px solid rgba(255,233,168,0.52);
  background:
    linear-gradient(180deg, rgba(255,246,204,0.08), transparent 34%),
    linear-gradient(180deg, rgba(42,35,23,0.94), rgba(7,9,8,0.94));
  min-height: 62px;
  padding: 15px 24px;
  font-size: clamp(13px, 1.35vw, 17px);
  text-transform: uppercase;
  line-height: 1.25;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -12px 24px rgba(0,0,0,0.28),
    var(--sh-3);
}
.title-screen .title-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 0%, rgba(255,246,204,0.23) 44%, transparent 72%);
  transition: transform 0.32s ease;
}
.title-screen .title-btn:hover {
  border-color: #fff0aa;
  color: #fff6d8;
  transform: translateY(-3px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.1),
    inset 0 -12px 24px rgba(0,0,0,0.22),
    0 0 28px rgba(242,201,76,0.3),
    var(--sh-3);
}
.title-screen .title-btn:hover::before { transform: translateX(120%); }
.title-screen .title-btn.primary {
  background:
    linear-gradient(180deg, rgba(255,250,216,0.22), transparent 30%),
    linear-gradient(180deg, #c99438 0%, #8a5e21 50%, #251711 100%);
  border-color: #ffe9a8;
  color: #fff7d4;
  font-size: clamp(21px, 1.8vw, 25px);
  min-height: 78px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    inset 0 -16px 28px rgba(37,18,10,0.36),
    0 0 28px rgba(242,201,76,0.18),
    var(--sh-3);
}
.title-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 12px;
}
.title-screen .title-btn.small {
  min-height: 58px;
  padding: 13px 14px;
  font-size: var(--fs-lead);
}
.title-ver {
  margin-top: 12px;
  letter-spacing: 0.08em;
  color: rgba(232,210,150,0.82);
  text-shadow: 0 3px 12px #000;
}
.title-screen .ember-fx {
  z-index: 2;
}
.title-screen .ember-fx span {
  background: #ffcb7b;
  box-shadow: 0 0 12px #ffc05f, 0 0 28px rgba(90,215,110,0.18);
  animation-name: fireflyUp;
}
@keyframes fireflyUp {
  0% { transform: translateY(0) translateX(0) scale(0.6); opacity: 0; }
  10% { opacity: 0.78; }
  58% { opacity: 0.56; transform: translateY(-42vh) translateX(-22px) scale(0.9); }
  100% { transform: translateY(-86vh) translateX(28px) scale(0.35); opacity: 0; }
}
@media (max-height: 760px) {
  .title-screen { padding-top: 20px; padding-bottom: 20px; gap: 5px; }
  .title-crest { font-size: 58px; margin-top: 4px; }
  .title-logo { font-size: clamp(82px, 8.8vw, 112px); }
  .title-sub { font-size: var(--fs-lead); }
  .title-menu { width: min(660px, 58vw); gap: 10px; margin-top: 26px; padding: 12px; }
  .title-screen .title-btn { min-height: 54px; padding: 12px 20px; }
  .title-screen .title-btn.primary { min-height: 68px; font-size: var(--fs-h2); }
  .title-screen .title-btn.small { min-height: 48px; font-size: var(--fs-body); }
  .title-ver { margin-top: 6px; }
}
.ember-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ember-fx span { position: absolute; bottom: -8px; border-radius: 50%; background: #ffb054; box-shadow: 0 0 7px #ff9c3f; opacity: 0; animation: emberUp linear infinite; }
@keyframes emberUp {
  0% { transform: translateY(0); opacity: 0; }
  8% { opacity: 0.85; }
  60% { opacity: 0.6; transform: translateY(-280px) translateX(-14px) scale(0.85); }
  100% { transform: translateY(-500px) translateX(18px) scale(0.4); opacity: 0; }
}
.diff-list { display: flex; flex-direction: column; gap: 7px; }
.diff-btn {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px;
  padding: 11px 16px; cursor: pointer; text-align: left;
  font-family: var(--font-body); transition: all 0.13s;
}
.diff-btn:hover { border-color: var(--gold); transform: translateX(4px); }
.diff-icon { display: flex; align-items: center; justify-content: center; }
.diff-icon svg { width: 30px; height: 30px; }
.diff-info { line-height: 1.45; }
.diff-info b { font-family: var(--font-head); font-size: var(--fs-lead); }
.diff-desc { font-size: var(--fs-micro); color: #b8ab8a; }
.diff-lp { font-size: var(--fs-copy); color: var(--gold-dim); }
.slot-btn {
  background: rgba(50,40,26,0.7); border: 1.5px solid var(--border); border-radius: var(--r-panel);
  padding: 11px 16px; cursor: pointer; text-align: left; color: var(--parch); font-size: var(--fs-small);
}
.slot-btn:hover { border-color: var(--gold); }
.vol-row { display: flex; align-items: center; gap: 10px; justify-content: center; font-size: var(--fs-copy); color: var(--parch-dim); }
.vol-row input[type=range] { flex: 1; max-width: 200px; accent-color: var(--gold); }
.chk-row { font-size: var(--fs-copy); color: var(--parch-dim); display: flex; gap: 8px; align-items: center; justify-content: center; }
.help-body { text-align: left; font-size: var(--fs-small); line-height: 1.6; color: var(--parch-dim); display: flex; flex-direction: column; gap: 7px; max-height: 58vh; overflow-y: auto; }
.help-body b { color: var(--parch); }
.go-stats { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; font-size: var(--fs-small); color: #b8ab8a; }
.gameover-modal { min-width: 480px; max-width: 560px; }
.ruler-title { font-family: var(--font-head); font-size: var(--fs-display); font-weight: 900; color: var(--gold); text-shadow: 0 0 24px rgba(242,201,76,0.45); letter-spacing: 1px; margin: 4px 0 14px; }
.stat-sheet { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 18px; margin: 8px 0 14px; text-align: left; }
.stat-row { display: flex; justify-content: space-between; font-size: var(--fs-small); color: #b8ab8a; border-bottom: 1px solid rgba(120,105,75,0.15); padding: 3px 2px; }
.stat-row b { color: #e8dcc0; }
.ascend-gain { font-family: var(--font-head); font-size: var(--fs-h2); font-weight: 900; color: var(--gold); text-shadow: 0 0 20px rgba(242,201,76,0.5); padding: 6px 0; }
.relic-bal { float: right; font-size: var(--fs-lead); color: var(--gold); }
.art-row { display: flex; gap: 6px; justify-content: center; font-size: var(--fs-h2); }
.art { cursor: help; filter: drop-shadow(0 0 6px rgba(242,201,76,0.4)); }

/* ---------- research/legacy tree ---------- */
.research-modal { max-width: 860px; min-width: 720px; }
.res-cur { font-size: var(--fs-copy); color: #b8e8c0; float: right; }
.tech-branch h3 { font-family: var(--font-head); font-size: var(--fs-copy); color: #b8ab8a; text-align: left; margin: 4px 0 5px; letter-spacing: 1px; }
.tech-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tech {
  display: flex; align-items: center; gap: 6px;
  background: rgba(50,40,26,0.6); border: 1.5px solid var(--border); border-radius: var(--r-card);
  padding: 5px 9px; font-size: var(--fs-micro); cursor: default;
}
.tech.avail { cursor: pointer; border-color: var(--border-lt); }
.tech.avail:hover { border-color: var(--gold); transform: translateY(-2px); }
.tech.done { border-color: #4a8a54; background: rgba(40,70,40,0.35); }
.tech.active { border-color: var(--gold); box-shadow: 0 0 10px rgba(242,201,76,0.4); }
.tech.queued { border-color: #7a5f9a; }
.tech.locked { opacity: 0.42; }
.tech-icon { font-size: var(--fs-lead); }
.tech-name { font-weight: 600; }
.tech-cost { font-size: var(--fs-nano); color: #b8ab8a; }

/* ---------- diplomacy ---------- */
.dip-row { background: rgba(50,40,26,0.55); border: 1.5px solid var(--border); border-radius: var(--r-panel); padding: 12px 16px; text-align: left; }
.dip-row.war { border-color: #8a3a2a; }
.dip-row.allied { border-color: #4a8a54; }
.dip-head { display: flex; align-items: center; gap: 9px; font-family: var(--font-head); font-size: var(--fs-lead); }
.dip-icon { font-size: var(--fs-h2); }
.dip-state { margin-left: auto; font-size: var(--fs-micro); font-family: var(--font-body); color: #b8ab8a; }
.dip-state.allied { color: var(--green); } .dip-state.war, .dip-state.hostile { color: #ff8a7a; } .dip-state.friendly { color: #b8e8c0; }
.dip-relbar { height: 7px; background: rgba(0,0,0,0.5); border-radius: var(--r-ctl); overflow: hidden; margin: 7px 0; }
.dip-relbar div { height: 100%; background: linear-gradient(90deg, #8a3a2a, #c9a84c 50%, #4a8a54); }
.dip-quote { font-size: var(--fs-small); font-style: italic; color: var(--parch-dim); margin: 6px 0; }
.dip-actions { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------- map overlay ---------- */
#mapoverlay {
  position: absolute; inset: 0; background: rgba(9,7,4,.9);
  display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 90;
  overflow: auto;
}
.map-sheet { width: min(760px, calc(100vw - 28px), calc(100vh - 146px)); background: #241c11; border: 1px solid #846536; box-shadow: 0 14px 64px #0009, inset 0 0 0 4px #18130c; padding: 0 7px; }
.map-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 12px 12px; }
.map-kicker { display: block; color: #bca477; font-size: 10px; text-transform: uppercase; letter-spacing: .16em; }
.map-head h2 { margin: 3px 0 0; font-size: clamp(18px, 2.4vh, 26px); color: #ead5a7; line-height: 1.1; }
#map-close { display: grid; place-items: center; width: 32px; height: 32px; min-width: 32px; padding: 4px; margin: 0; font-size: 22px; }
.map-face { border: 1px solid #846536; background: #201b12; }
#bigmap {
  display: block; width: 100%; height: auto; aspect-ratio: 1; cursor: crosshair;
  border: 0; border-radius: 0; image-rendering: auto;
}
#maplegend { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: #cebe9a; line-height: 1.3; padding: 10px 4px 8px; }
#maplegend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
#maplegend .map-threat { color: #db977c; }
.map-foot { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px 11px; border-top: 1px solid #84653655; font-size: 11px; color: #aa9874; }
.map-foot kbd { display: inline-block; margin-left: 12px; padding: 0 4px; border: 1px solid #84653688; border-radius: 2px; font: inherit; color: #e2c88f; }
@media (max-height: 600px) {
  .map-sheet { width: min(calc(100vw - 28px), calc(100vh - 130px)); }
  .map-head { padding: 9px 8px; }
  .map-kicker { display: none; }
  #maplegend { gap: 5px 11px; font-size: 11px; padding: 7px 2px; }
  .map-foot { padding: 6px; font-size: 10px; }
}

/* ---------- people & orders ---------- */
.chip-btn { cursor: pointer; transition: all 0.12s; }
.chip-btn:hover { border-color: var(--gold); transform: translateY(-1px); }
.order-wrap { display: flex; gap: 5px; margin: 6px 0 2px; }
#order-input {
  flex: 1; background: rgba(12,9,6,0.85); border: 1.5px solid var(--border); border-radius: var(--r-card);
  color: var(--parch); font-family: var(--font-body); font-size: var(--fs-small); padding: 7px 10px;
  user-select: text;
}
#order-input:focus { outline: none; border-color: var(--gold-dim); box-shadow: 0 0 8px rgba(242,201,76,0.25); }
#order-input::placeholder { color: var(--muted); font-style: italic; }
.people-list { display: flex; flex-direction: column; gap: 3px; max-height: 38vh; overflow-y: auto; padding-right: 4px; }
.people-row {
  display: grid; grid-template-columns: 14px 26px 90px 1fr auto; gap: 8px; align-items: center;
  background: rgba(50,40,26,0.55); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 5px 10px; cursor: pointer; text-align: left; color: var(--parch); font-size: var(--fs-small);
}
.people-row:hover { border-color: var(--gold-dim); transform: translateX(3px); }
.pr-prof { font-size: var(--fs-lead); }
.pr-name { font-weight: 700; }
.pr-act { color: #b8ab8a; font-size: var(--fs-micro); }
.ppl-h { font-family: var(--font-head); font-size: var(--fs-copy); color: #b8ab8a; letter-spacing: 1px; margin-top: 4px; }
.prof-row { display: flex; flex-wrap: wrap; gap: 4px; }
.prof-btn { font-size: var(--fs-micro); padding: 5px 8px; }

/* ---------- crownfall: clock, meters, council, chat, crisis ---------- */
.res-dot { display: inline-block; width: 9px; height: 9px; border-radius: var(--r-xs); margin-right: 2px; box-shadow: 0 0 4px rgba(0,0,0,0.6), inset 0 -2px 3px rgba(0,0,0,0.35); }
#dayclock { filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
#kingname { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmeter { display: inline-flex; align-items: center; gap: 4px; margin: 0 3px; }
.pmeter i { font-style: normal; font-size: var(--fs-small); color: var(--gold); }
.pbar { display: inline-block; width: 42px; height: 7px; background: rgba(0,0,0,0.55); border-radius: var(--r-ctl); overflow: hidden; border: 1px solid rgba(107,84,50,0.6); }
.pbar span { display: block; height: 100%; }
#infopanel {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 158px;
  max-width: 460px; background: var(--panel); border: 1.5px solid var(--border-lt); border-radius: var(--r-panel);
  padding: 9px 16px; font-size: var(--fs-small); color: var(--parch-dim); text-align: center;
  box-shadow: var(--sh-2); z-index: 40; pointer-events: none;
}
#infopanel b { display: block; font-family: var(--font-head); color: var(--gold); font-size: var(--fs-copy); letter-spacing: 1px; margin-bottom: 2px; }
.kname-field {
  background: rgba(12,9,6,0.85); border: 2px solid var(--gold-dim); border-radius: var(--r-panel);
  color: var(--gold); font-family: var(--font-head); font-weight: 700; font-size: var(--fs-h2); letter-spacing: 2px;
  padding: 12px 16px; text-align: center; user-select: text;
}
.kname-field:focus { outline: none; box-shadow: 0 0 18px rgba(242,201,76,0.35); }
.council-modal { max-width: 700px; }
.meter-block { background: rgba(50,40,26,0.5); border: 1px solid var(--border); border-radius: var(--r-panel); padding: 12px 16px; display: flex; flex-direction: column; gap: 7px; }
.meter-row { display: grid; grid-template-columns: 90px 1fr 34px; gap: 10px; align-items: center; font-size: var(--fs-small); font-family: var(--font-head); font-weight: 700; }
.meter.big { display: block; height: 14px; background: rgba(0,0,0,0.55); border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--border); }
.meter.big span { display: block; height: 100%; transition: width 0.4s; }
.fac-row { display: grid; grid-template-columns: 130px 1fr 44px; gap: 10px; align-items: center; font-size: var(--fs-small); text-align: left; }
.fac-name { font-weight: 700; }
.fac-bar { display: block; height: 10px; background: rgba(0,0,0,0.55); border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--border); }
.fac-bar.sm { width: 90px; height: 8px; }
.fac-bar span { display: block; height: 100%; transition: width 0.4s; }
.fac-val { font-weight: 700; text-align: right; }
.adv-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; text-align: left; font-size: var(--fs-small); background: rgba(50,40,26,0.45); border: 1px solid var(--border); border-radius: var(--r-card); padding: 7px 12px; }
.adv-row.out { opacity: 0.55; }
.adv-icon { font-size: var(--fs-h2); }
.law-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.law-row { background: rgba(50,40,26,0.55); border: 1.5px solid var(--border); border-radius: var(--r-card); padding: 7px 9px; cursor: pointer; color: var(--parch); font-size: var(--fs-micro); text-align: left; display: flex; flex-direction: column; gap: 3px; transition: all 0.12s; }
.law-row:hover { border-color: var(--gold-dim); }
.law-row.on { border-color: var(--gold); background: rgba(90,70,30,0.4); box-shadow: 0 0 8px rgba(242,201,76,0.25); }
.law-row.locked { opacity: 0.5; }
.law-row .law-hint { font-size: var(--fs-nano); color: var(--muted); line-height: 1.25; font-weight: 400; }
.law-fxrow { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 1px; }
.law-fx { font-size: var(--fs-nano); padding: 0 3px; border-radius: var(--r-xs); }
.law-fx.g { color: #7ad88a; background: rgba(90,215,110,0.12); }
.law-fx.b { color: #e08a7a; background: rgba(214,69,69,0.12); }
.law-group-h { grid-column: 1 / -1; font-size: var(--fs-nano); letter-spacing: 2px; text-transform: uppercase; color: #c9a84c; margin: 5px 0 1px; border-bottom: 1px solid rgba(201,168,76,0.2); padding-bottom: 2px; }
.law-slots { font-size: var(--fs-small); color: #c9a84c; font-weight: 700; margin-left: 8px; }
.law-slots.full { color: #e08a7a; }
.law-g { font-size: var(--fs-nano); color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.promise-row { font-size: var(--fs-small); color: var(--parch-dim); text-align: left; }
.crisis-modal { max-width: 460px; border-color: var(--gold-dim); }
.crisis-icon { font-size: 42px; line-height: 1; filter: drop-shadow(0 0 14px rgba(242,201,76,0.35)); }
.crisis-btn {
  font-size: var(--fs-body); padding: 11px 16px; cursor: pointer; transition: all 0.13s; text-align: left;
}
.crisis-btn:hover { border-color: var(--gold); transform: translateX(4px); }
.chat-modal { min-width: 480px; max-width: 540px; }
.chat-log { height: 240px; overflow-y: auto; background: rgba(12,9,6,0.6); border: 1px solid var(--border); border-radius: var(--r-panel); padding: 10px 14px; text-align: left; display: flex; flex-direction: column; gap: 7px; }
.chat-msg { font-size: var(--fs-small); line-height: 1.5; }
.chat-msg.them { color: #d8cba8; font-style: italic; }
.chat-msg.you { color: #9ad9ff; }
#chat-input { flex: 1; background: rgba(12,9,6,0.85); border: 1.5px solid var(--border); border-radius: var(--r-card); color: var(--parch); font-size: var(--fs-small); padding: 8px 10px; user-select: text; }
#chat-input:focus { outline: none; border-color: var(--gold-dim); }
.chat-envoy { font-size: var(--fs-micro); margin: -6px 0 8px; }
.chat-msg.sys { color: var(--gold-dim); font-size: var(--fs-micro); text-align: center; border-top: 1px dashed rgba(201,168,76,0.25); border-bottom: 1px dashed rgba(201,168,76,0.25); padding: 3px 0; }
.chat-opts { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 240px; overflow-y: auto; }
.chat-opt { padding: 8px 14px; font-size: var(--fs-small); }
.bond-hearts { color: #e87ea1; letter-spacing: 2px; }
.btabs-inline { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; }
.squad-row { background: rgba(12,9,6,0.45); border: 1px solid var(--border); border-radius: var(--r-panel); padding: 8px 10px; margin: 6px 0; text-align: left; }
.squad-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.squad-head .hud-btn { margin-left: auto; }
.squad-btns { display: flex; flex-wrap: wrap; gap: 5px; }
.squad-btns .hud-btn { font-size: var(--fs-micro); padding: 5px 9px; }
.people-row .pr-check { width: 14px; color: var(--gold); opacity: 0; flex-shrink: 0; }
.people-row.picked .pr-check { opacity: 1; }
.people-row.picked { border-color: var(--gold-dim); background: rgba(201,168,76,0.10); }
.people-row .pr-go { padding: 2px 7px; border-radius: var(--r-card); color: #9ad9ff; opacity: 0.65; }
.people-row .pr-go:hover { opacity: 1; background: rgba(154,217,255,0.12); }
#regionlabel { position: absolute; top: 15%; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; opacity: 0; z-index: 40; }
#regionlabel.show { animation: rgfade 4.5s ease forwards; }
#regionlabel .rg-name { font-family: var(--font-head); font-size: var(--fs-display); font-weight: 900; letter-spacing: 5px; text-shadow: 0 2px 12px rgba(0,0,0,0.85); }
#regionlabel .rg-desc { font-size: var(--fs-small); color: var(--parch); opacity: 0.85; text-shadow: 0 1px 6px rgba(0,0,0,0.9); margin-top: 2px; }
@keyframes rgfade { 0% { opacity: 0; transform: translateX(-50%) translateY(8px); } 12% { opacity: 1; transform: translateX(-50%) translateY(0); } 75% { opacity: 1; } 100% { opacity: 0; } }

/* ============ multiplayer ============ */
/* (the !important that used to live on .mp-btn is gone — the button variants at the end
   of this file give it its own rank, and !important made every one of them dead code) */
.mp-btn { border-color: #4a9de0; }
.lobby-modal { min-width: 460px; }
.lb-code { margin: 4px 0 10px; }
.lb-codebig { font-size: var(--fs-h2); letter-spacing: 6px; color: var(--gold); }
.lb-players { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.lb-player { display: flex; align-items: center; gap: 8px; background: rgba(12,9,6,0.5); border: 1px solid var(--border); border-radius: var(--r-card); padding: 6px 10px; font-size: var(--fs-small); }
.lb-player.lb-off { opacity: 0.4; }
.lb-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 6px currentColor; }
.lb-tag { font-size: var(--fs-nano); background: var(--gold-dim); color: #1a1408; padding: 1px 6px; border-radius: var(--r-ctl); font-weight: 700; }
.lb-role { font-size: var(--fs-micro); color: var(--gold); }
.lb-ready { margin-left: auto; font-size: var(--fs-nano); color: var(--muted); }
.lb-ready.on { color: #5ad76e; font-weight: 700; }
.lb-roles { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin: 6px 0; }
.lb-roles .hud-btn { font-size: var(--fs-micro); }
.lb-count { font-size: 64px; font-family: var(--font-head); color: var(--gold); }
#mp-bar { position: absolute; left: 50%; transform: translateX(-50%); bottom: 4px; display: flex; gap: 6px; align-items: center; pointer-events: auto; z-index: 30; }
.mpb-players { display: flex; gap: 4px; }
.mpb-p { font-size: var(--fs-nano); border: 1.5px solid; border-radius: var(--r-card); padding: 2px 6px; background: rgba(12,9,6,0.75); color: var(--parch); }
.mpb-ab { font-size: var(--fs-micro); padding: 5px 9px; }
.mpb-cd { color: #ff8a7a; font-weight: 700; }
#wars-panel { position: absolute; right: 10px; top: 120px; width: 190px; background: rgba(18,13,8,0.88); border: 1.5px solid var(--border-lt); border-radius: var(--r-panel); padding: 9px 11px; pointer-events: auto; z-index: 25; font-size: var(--fs-micro); }
#wars-panel .wp-title { font-family: var(--font-head); font-weight: 700; color: #ff8a7a; margin-bottom: 5px; }
#wars-panel .wp-row { margin: 3px 0; display: flex; align-items: center; gap: 6px; }
#wars-panel .wp-bar { flex: 1; height: 7px; background: rgba(0,0,0,0.5); border-radius: var(--r-ctl); overflow: hidden; }
#wars-panel .wp-bar div { height: 100%; background: #d64545; }
#wars-panel .wp-btns { display: flex; gap: 5px; margin-top: 6px; }
#wars-panel .hud-btn { font-size: var(--fs-nano); padding: 4px 7px; }

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-ctl); }

.crisis-icon svg { width: 36px; height: 36px; color: var(--gold); }
.crisis-icon { display: flex; justify-content: center; margin-bottom: 4px; }
.lb-roles .hud-btn svg, .mpb-ab svg, .lb-role svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.dip-icon svg { vertical-align: middle; }
.pr-prof img.tic { display: block; }

.mp-server { margin-top: 10px; text-align: left; font-size: var(--fs-micro); color: var(--muted); }
.mp-server summary { cursor: pointer; letter-spacing: 1px; text-transform: uppercase; font-size: var(--fs-nano); }
.mp-server input { flex: 1; background: rgba(12,9,6,0.85); border: 1px solid var(--border); border-radius: var(--r-card); color: var(--parch); font-size: var(--fs-micro); padding: 7px 9px; user-select: text; }

/* narrow windows: the menu takes the width it needs and labels relax */
@media (max-width: 900px) {
  .title-menu { width: min(94vw, 720px); }
  .title-screen .title-row { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .title-screen .title-btn { letter-spacing: 0.02em; padding: 11px 8px; }
  .title-screen .title-btn.primary { font-size: var(--fs-lead); }
}

/* toasts never eat clicks and stay visible above loading modals */
#toasts { pointer-events: none; z-index: 210; }
#toasts .toast { pointer-events: none; }
/* important toasts read bigger and stay longer */
#toasts .toast { font-size: var(--fs-body); padding: 9px 20px; max-width: 560px; }
#toasts .toast.t-jump, #chronicle .chron-line.t-jump { pointer-events: auto; cursor: pointer; }
#toasts .toast.t-jump:hover { border-color: #c9a84c; }
.t-count { color: #f2c94c; font-weight: 800; margin-left: 4px; }
.imp-g { color: #7ad88a; } .imp-b { color: #e0a17a; }

/* the Chronicle — the realm's small news, an illuminated ledger at the top-left */
#chronicle {
  position: absolute; top: 56px; left: 12px; width: 340px;
  display: flex; flex-direction: column; gap: 4px;
  pointer-events: none; z-index: 55;
}
.chron-line {
  font-size: var(--fs-body); line-height: 1.4; color: #f0e6cc; font-weight: 600;
  font-family: var(--font-head); letter-spacing: 0.3px;
  background: linear-gradient(100deg, rgba(58,44,26,0.96), rgba(34,26,17,0.92));
  border-left: 4px solid var(--gold);
  border-radius: 0 var(--r-card) var(--r-card) 0; padding: 7px 14px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.55), inset 0 1px 0 rgba(242,201,76,0.16);
  opacity: 0; transform: translateX(-14px); transition: all 0.32s ease;
  width: fit-content; max-width: 360px; white-space: normal; overflow-wrap: break-word;
}
.chron-line.show { opacity: 1; transform: translateX(0); animation: chron-pop 0.5s ease; }
@keyframes chron-pop { 0% { box-shadow: 0 0 0 2px rgba(242,201,76,0.55), var(--sh-2); } 100% { box-shadow: 0 3px 12px rgba(0,0,0,0.55), inset 0 1px 0 rgba(242,201,76,0.16); } }
.chron-line.good { border-left-color: var(--green); color: #cfe0b4; }

/* urgent news burns the screen edges */
#urgentedge {
  position: fixed; inset: 0; pointer-events: none; z-index: 205; opacity: 0;
  box-shadow: inset 0 0 130px 24px rgba(214, 69, 69, 0.55);
}
#urgentedge.pulse { animation: urgent-pulse 2.6s ease-out; }
@keyframes urgent-pulse {
  0% { opacity: 0; } 12% { opacity: 1; } 34% { opacity: 0.35; }
  48% { opacity: 0.85; } 100% { opacity: 0; }
}

/* crises are the heart of the game — give them stage presence */
.crisis-modal { min-width: 540px; max-width: 600px; }
.crisis-modal h2 { letter-spacing: 2px; }
.crisis-modal .modal-text { font-size: var(--fs-lead); line-height: 1.65; }
.crisis-btn { display: block; width: 100%; }
.crisis-hint { display: block; font-size: var(--fs-nano); color: var(--muted); font-weight: 400; font-style: italic; margin-top: 2px; }
.crisis-warn { margin-top: 10px; font-size: var(--fs-small); color: #c9a84c; letter-spacing: 0.5px; }
.fx-chips.reveal { justify-content: center; margin: 10px 0 4px; gap: 8px; }
.fx-chips.reveal .fxc { font-size: var(--fs-body); padding: 4px 10px; }
.fx-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.fxc { font-size: var(--fs-nano); padding: 1px 7px; border-radius: var(--r-card); background: rgba(0,0,0,0.38); border: 1px solid var(--border); letter-spacing: 0.3px; display: inline-flex; align-items: center; gap: 3px; }
.fxc.g { color: #8ce09a; }
.fxc.b { color: #ff9c8a; }

/* ============ MEDIEVAL POLISH ============ */
/* The second of three panel skins that used to live in this file alone lived here.
   None of the three ever reached the screen — heritage.css has owned the plate
   since v111 — so keeping them only made the real surface hard to find. The one
   plate is `--surf-plate` + `--sh-plate`; #selpanel keeps its own translucent
   dock surface in identity.css because it sits ON the world, not over it.
   NOTE: don't force position here — #selpanel must stay absolutely anchored. */
.menu-modal, .big-modal, .council-modal, .crisis-modal { position: relative; }
/* (the duplicate #selpanel anchor that used to sit here is folded into the responsive
   dock at the end of this file — one declaration, measured, no fighting copies) */
.menu-modal::before, .big-modal::before, .crisis-modal::before {
  content: ''; position: absolute; inset: 5px; border: 1px solid rgba(201,168,76,0.28);
  border-radius: var(--r-panel); pointer-events: none;
}
/* section headers get engraved flourishes */
.ppl-h {
  font-family: var(--font-head); font-size: var(--fs-small); letter-spacing: 2.5px; color: var(--gold-dim);
  text-transform: uppercase; margin: 12px 0 5px; display: flex; align-items: center; gap: 10px;
}
.ppl-h::before, .ppl-h::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,168,76,0.4), transparent);
}
/* toasts wear a wax-seal stripe  (the !important pass that used to live here is folded
   into the base rules — variants below can finally colour themselves) */
.toast {
  background: linear-gradient(100deg, rgba(44,33,20,0.96), rgba(26,20,13,0.96));
  border-left: 3px solid var(--gold-dim);
  font-family: var(--font-head); letter-spacing: 0.2px;
}
.toast.bad { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--warn); }
.toast.ach, .toast.good { border-left-color: var(--green); }
/* resource + chip bar: burnished bronze */
.res, .chip {
  background: linear-gradient(180deg, rgba(46,35,22,0.95), rgba(28,21,14,0.95));
  box-shadow: inset 0 1px 0 rgba(242,201,76,0.1);
}
/* buttons: hammered metal with a warm sheen on hover */
.title-btn, .hud-btn, .crisis-btn {
  background: linear-gradient(180deg, #4c3b25, #2f2417);
  box-shadow: inset 0 1px 0 rgba(242,201,76,0.14), var(--sh-1);
}
.title-btn:hover, .hud-btn:hover, .crisis-btn:hover {
  background: linear-gradient(180deg, #5c4a2e, #3a2d1c);
  box-shadow: inset 0 1px 0 rgba(242,201,76,0.28), 0 0 14px rgba(242,201,76,0.22);
}

/* ============ PREMIUM UI FEEL ============ */
/* satisfying button press — buttons sink and flash when clicked */
.title-btn:active, .hud-btn:active, .crisis-btn:active, .bcard:active, .btab:active {
  transform: translateY(1px) scale(0.985);
  filter: brightness(1.12);
}
.title-btn, .hud-btn, .crisis-btn { transition: transform 0.09s, filter 0.09s, box-shadow 0.15s, background 0.15s, border-color 0.15s; }
/* build cards lift and glow on hover */
.bcard { transition: transform 0.12s, box-shadow 0.15s, border-color 0.12s; }
.bcard:not(.locked):hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,0.5), 0 0 12px rgba(242,201,76,0.25); border-color: var(--gold-dim); }
/* progress + meter bars get a slow travelling sheen so they feel alive */
.meter span, .fac-bar span, .pbar span, .bcard-prog span { position: relative; overflow: hidden; }
.meter span::after, .fac-bar span::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  transform: translateX(-100%); animation: bar-sheen 3.5s ease-in-out infinite;
}
@keyframes bar-sheen { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }
.meter, .fac-bar, .pbar { overflow: hidden; }
/* selection panel slides up in, framed like a field order */
#selpanel { animation: sel-in 0.2s ease-out; }
@keyframes sel-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
/* resource chips give a tiny pulse when they change (class toggled in JS is optional) */
.res span:last-child { transition: color 0.2s; }
/* modals fade+rise in */
#modal-box > .menu-modal, #modal-box > .big-modal, #modal-box > .crisis-modal { animation: modal-in 0.22s cubic-bezier(0.2,0.8,0.3,1); }
@keyframes modal-in { from { opacity: 0; transform: scale(0.975); } to { opacity: 1; transform: scale(1); } }

/* Loading presentation is owned by loading.css. */

/* ============ CINEMATIC VIGNETTE ============ */
/* soft edge darkening for depth. Uses NORMAL (source-over) compositing on purpose:
   mix-blend-mode over a live WebGL canvas forces a full-viewport re-blend every frame
   and tanks the framerate. A plain translucent radial gradient is the GPU fast-path —
   visually the same edge falloff, essentially free. */
#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 4;
  background:
    radial-gradient(125% 105% at 50% 42%, transparent 58%, rgba(8,6,4,0.30) 88%, rgba(4,3,2,0.62) 100%);
}
/* keep the vignette out from under full-screen menus (title/modal) so they read clean */
#modal-layer:not(.hidden) ~ #vignette, body:has(#modal-box .title-screen) #vignette { opacity: 0.4; }
/* the whole HUD must render ABOVE the vignette so panels stay crisp (vignette only dims the world) */
#ui { z-index: 10; }
/* in-game shareable room code */
.mpb-code { color: var(--gold); font-family: var(--font-head); letter-spacing: 1px; border-color: var(--gold-dim); }
.mpb-code:hover { background: linear-gradient(180deg,#5c4a2e,#3a2d1c) !important; }
/* disabled crisis choices show WHY, dimmed */
.crisis-btn.blocked { opacity: 0.5; cursor: not-allowed; }
.crisis-block { display: block; font-size: var(--fs-nano); color: #e0a17a; font-weight: 400; margin-top: 2px; }

/* ============ TITLE / INTRO PERF ============ */
/* The title stacked an animated full-screen BLURRED background plus several
   animated mix-blend-mode:screen glow layers and animated blur(8px) layers.
   Moving a blurred layer and re-blending the whole viewport every frame crushed
   the compositor — that was the laggy title + intro (the intro overlay renders
   over the title, so it inherited the same cost). Fix: freeze the heavy blur/
   blend layers so they rasterize ONCE and cache, and drop screen-blend to normal
   alpha (near-identical over the dark art). Cheap transform/opacity motion (logo
   shine, crest float, aura breathe, light sweep, sparkle, ray drift) is kept, so
   the screen still feels alive. */
.title-bg { animation: none !important; }                               /* blurred bg + kingdom-camera pan */
.title-clouds, .title-screen > .title-clouds { animation: none !important; }  /* blur(8px) + drift */
.title-mist, .title-screen > .title-mist { animation: none !important; }      /* blur(8px) + drift */
.title-stars { animation: none !important; }                            /* kingdom-glints animated filter:blur */
.title-screen > .title-kingdom-vfx { animation: none !important; }      /* lantern-pulse animated filter:blur */
.title-screen > .title-rays,
.title-screen > .title-aura,
.title-screen > .title-kingdom-vfx,
.title-screen > .title-kingdom-vfx::before { mix-blend-mode: normal !important; }

/* ============ RICH SELECTION PANEL (buildings) ============ */
.sp-bhead { display: flex; align-items: center; gap: 11px; margin-bottom: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.sp-portrait {
  width: 68px; height: 68px; flex: none; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 32%, #4a3c24, #241a10 78%);
  border: 2px solid var(--gold-dim); border-radius: var(--r-panel);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,233,168,0.12), var(--sh-1);
}
.sp-portrait img, .sp-portrait canvas { image-rendering: auto; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.6)); }
.sp-htext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sp-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.sp-tag {
  font-size: var(--fs-nano); font-weight: 700; letter-spacing: 0.4px; padding: 2px 7px; border-radius: var(--r-panel);
  background: linear-gradient(180deg, #4a3a22, #34281a); color: #e8d6a8; border: 1px solid var(--border);
  text-transform: uppercase;
}
.sp-tag.ok { background: linear-gradient(180deg,#2c4a2e,#1e321f); color: #8fe0a0; border-color: #3f6b45; }
.sp-tag.warn { background: linear-gradient(180deg,#4a3620,#33251490); color: #f0c078; border-color: #6b5330; }
.sp-desc { font-size: var(--fs-micro); font-style: italic; color: #c9baa0; line-height: 1.4; margin-bottom: 7px; padding: 0 1px; }

/* ============ RICH DIPLOMACY CREST ============ */
.dip-head { display: flex; align-items: center; gap: 11px; }
.dip-crest {
  width: 52px; height: 52px; flex: none; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, #3a2f1e, #1c150d 80%);
  border: 2px solid var(--gold-dim); border-radius: var(--r-card);
  box-shadow: inset 0 2px 7px rgba(0,0,0,0.55), var(--sh-1);
}
.dip-crest svg { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6)); }
.dip-headtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

/* ============ MARKET HALL DASHBOARD ============ */
.mkt-modal { max-width: 620px; }
.mkt-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.mkt-head h2 { margin: 0; }
.mkt-sub { font-size: var(--fs-small); color: var(--parch-dim); }
.mkt-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.mkt-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.22); border: 1px solid var(--border); border-radius: var(--r-card); padding: 7px 10px; }
.mkt-res { display: flex; align-items: center; gap: 6px; font-size: var(--fs-copy); }
.mkt-own { color: var(--muted); font-size: var(--fs-micro); margin-left: 6px; }
.mkt-sell, .mkt-buy { font-size: var(--fs-micro); white-space: nowrap; }
.mkt-sell[disabled] { opacity: 0.4; cursor: not-allowed; }
.mkt-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.mkt-col h3 { font-family: var(--font-head); font-size: var(--fs-small); letter-spacing: 1.5px; color: var(--gold);
  text-transform: uppercase; margin: 0 0 6px; border-bottom: 1px solid var(--border); padding-bottom: 3px; }
.mkt-pact { font-size: var(--fs-small); color: var(--parch-dim); margin: 3px 0; }
.mkt-goss { font-size: var(--fs-small); font-style: italic; color: #e0d2a8; line-height: 1.5; }
@media (max-width: 560px) { .mkt-cols { grid-template-columns: 1fr; } .mkt-row { grid-template-columns: 1fr; gap: 5px; } }

/* ============ ADVISOR AUDIENCE ============ */
.aud-modal { max-width: 560px; }
.aud-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.aud-head h2 { margin: 0; }
.aud-face { font-size: 42px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6)); }
.aud-sub { font-size: var(--fs-small); color: var(--parch-dim); }
.aud-greet { font-size: var(--fs-body); font-style: italic; color: #e8d6a8; margin: 4px 0 8px; line-height: 1.5; }
.aud-reply { font-size: var(--fs-copy); line-height: 1.5; margin: 6px 0; padding: 8px 10px; border-radius: var(--r-card);
  background: rgba(0,0,0,0.28); border-left: 3px solid var(--gold-dim); color: #e0d2a8; }
.aud-reply.counsel { border-left-color: #8a94b0; font-style: italic; }
.aud-deals { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.aud-deal { background: rgba(0,0,0,0.22); border: 1px solid var(--border); border-radius: var(--r-card); padding: 9px 11px; }
.aud-pitch { font-size: var(--fs-copy); font-style: italic; color: #d8cba8; line-height: 1.45; margin-bottom: 7px; }
.aud-take { width: 100%; text-align: center; }
.aud-hint { display: block; font-size: var(--fs-nano); font-style: normal; color: #f0e0b0; opacity: 0.85; margin-top: 2px; }
.aud-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.adv-row .hud-btn.sm { padding: 3px 8px; font-size: var(--fs-micro); }

/* ============ BUILDING INTERIORS — "Go Inside" ============ */
.interior-modal { position: relative; width: min(1040px, 97vw); max-height: 95vh; min-height: min(640px, 90vh); overflow: hidden;
  border: 2px solid var(--int-accent, var(--gold-dim)); border-radius: var(--r-panel);
  box-shadow: 0 24px 80px rgba(0,0,0,0.7), inset 0 0 0 1px rgba(255,255,255,0.05); }
/* prepared art, LIGHTLY blurred + darkened ONCE (static = cheap) — the "scenario cover" look */
.int-bg { position: absolute; inset: -10px; background-size: cover; background-position: center;
  filter: blur(2px) brightness(0.62) saturate(1.06); transform: scale(1.04); z-index: 0; }
.int-scrim { position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(8,6,4,0.42) 0%, rgba(10,7,4,0.6) 58%, rgba(6,4,3,0.82) 100%); }
.int-content { position: relative; z-index: 2; padding: 22px 26px 24px; max-height: 95vh; overflow-y: auto; }
.int-icon img, .int-card-ic img, .emo { display: inline-block; vertical-align: middle; image-rendering: auto; }
.int-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.int-head h2 { margin: 0; color: #fff; text-shadow: 0 2px 6px #000; }
.int-icon { font-size: 40px; line-height: 1; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.7));
  width: 60px; height: 60px; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, rgba(0,0,0,0.35), rgba(0,0,0,0.6)); border-radius: var(--r-panel);
  border: 1px solid var(--int-accent, var(--gold-dim)); }
.int-htext { flex: 1; min-width: 0; }
.int-status { font-size: var(--fs-small); color: #d8cba8; }
.int-close { background: rgba(20,14,8,0.7); border: 1px solid var(--border); color: var(--parch);
  border-radius: var(--r-card); padding: 6px 12px; cursor: pointer; font-family: var(--font-head); font-size: var(--fs-small); }
.int-close:hover { background: rgba(60,40,20,0.85); }
.int-npc { font-size: var(--fs-copy); color: #f0e2bc; line-height: 1.5; margin: 6px 0; text-shadow: 0 1px 3px #000; }
.int-npc b { color: var(--int-accent, var(--gold)); }
.int-hook { font-size: var(--fs-small); font-style: italic; color: #c9b89a; line-height: 1.5; margin-bottom: 12px; }
.int-sect { font-family: var(--font-head); font-size: var(--fs-micro); letter-spacing: 2px; color: var(--int-accent, var(--gold));
  text-transform: uppercase; margin: 12px 0 7px; border-bottom: 1px solid rgba(255,255,255,0.12); padding-bottom: 3px; }
.int-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.int-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  background: linear-gradient(180deg, rgba(46,36,22,0.92), rgba(26,18,10,0.92)); border: 1px solid var(--border-lt);
  border-radius: var(--r-panel); padding: 9px 11px; cursor: pointer; transition: all 0.13s; color: var(--parch); }
.int-card:hover { transform: translateY(-2px); border-color: var(--int-accent, var(--gold)); box-shadow: var(--sh-2); }
.int-card:active { transform: translateY(0); filter: brightness(1.12); }
.int-card-ic { font-size: var(--fs-h2); }
.int-card-l { font-weight: 700; font-size: var(--fs-copy); }
.int-card-h { font-size: var(--fs-nano); color: #c9a86a; }
.int-activities { display: flex; flex-wrap: wrap; gap: 6px; }
.int-actv { background: rgba(20,14,8,0.7); border: 1px solid var(--border); color: #e8d6a8; border-radius: var(--r-pill);
  padding: 5px 12px; font-size: var(--fs-small); cursor: pointer; transition: all 0.12s; }
.int-actv:hover { background: rgba(60,44,22,0.85); border-color: var(--int-accent, var(--gold)); }
.int-reply { font-size: var(--fs-copy); line-height: 1.5; margin: 8px 0; padding: 9px 12px; border-radius: var(--r-card);
  background: rgba(0,0,0,0.4); border-left: 3px solid var(--int-accent, var(--gold)); color: #ecdcb2; }
.int-prompt { font-weight: 700; margin-bottom: 6px; color: #fff; }
.int-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.int-opt { background: linear-gradient(180deg,#5c4a2e,#3a2d1c); border: 1px solid var(--gold-dim); color: #f0e2bc;
  border-radius: var(--r-card); padding: 5px 12px; font-size: var(--fs-small); cursor: pointer; }
.int-opt:hover { background: linear-gradient(180deg,#6e5836,#463522); }
.int-event { background: rgba(40,20,16,0.82); border: 1px solid #7a4a3a; border-left: 3px solid #d64545;
  border-radius: var(--r-panel); padding: 10px 12px; margin: 6px 0 10px; }
.int-ev-text { font-size: var(--fs-copy); color: #f0d2c0; line-height: 1.5; margin-bottom: 8px; }
.int-ev-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.int-ev-btn { background: linear-gradient(180deg,#6a3a2e,#4a281c); border: 1px solid #a05a44; color: #ffe0c8;
  border-radius: var(--r-card); padding: 6px 13px; font-size: var(--fs-small); cursor: pointer; font-weight: 600; }
.int-ev-btn:hover { background: linear-gradient(180deg,#7e4636,#5a3020); }
@media (max-width: 560px) { .int-actions { grid-template-columns: 1fr; } }
/* (The nine interior MINIGAMES were deleted from interiors.js last pass — the user's verdict
   was "super bad and childish" — and their 40-odd rules stayed behind here, styling markup
   that no file in the tree emits any more. Verified class by class against js/ before removal:
   .mini*, .is-mini, .shell-*, .seq-*, .court-*, .match-* had zero writers.) */
/* cooldown (once-a-day) states */
.int-sect-note { font-family: var(--font-body, inherit); font-size: var(--fs-nano); letter-spacing: 0; color: var(--muted); text-transform: none; font-weight: 400; }
.int-cd { color: #c98f5a; font-size: var(--fs-nano); font-weight: 700; white-space: nowrap; }
.int-card.cd, .int-actv.cd { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.4); }
.int-card.cd:hover, .int-actv.cd:hover { transform: none; border-color: var(--border-lt); box-shadow: none; background: linear-gradient(180deg, rgba(46,36,22,0.92), rgba(26,18,10,0.92)); }
.int-card.cd .int-card-h { color: #c98f5a; }
.int-opts.vert { flex-direction: column; align-items: stretch; }
.int-opts.vert .int-opt { text-align: left; }

/* ---------- LIVING WEATHER chip ---------- */
.wx { display: inline-flex; align-items: center; gap: 4px; }
.wx-ic { width: 13px; height: 13px; vertical-align: -2px; }

/* ---------- THE CROWN AGENDA — a royal writ pinned to the right edge ---------- */
#agenda {
  position: absolute; top: 56px; right: 12px; width: 234px;
  background: linear-gradient(180deg, rgba(26,20,12,0.92), rgba(18,14,9,0.92));
  border: 1px solid var(--border-lt); border-radius: var(--r-panel);
  box-shadow: var(--sh-2);
  z-index: 54; overflow: hidden;
}
.agd-head {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 7px 11px; user-select: none;
  font-family: var(--font-head); font-size: var(--fs-micro); font-weight: 900; letter-spacing: 2px;
  color: var(--gold-dim); background: rgba(242,201,76,0.05);
  border-bottom: 1px solid rgba(242,201,76,0.12);
}
.agd-head:hover { color: var(--gold); }
.agd-title { flex: 1; }
.agd-done-n { font-size: var(--fs-nano); font-weight: 600; letter-spacing: 0.5px; color: var(--muted); font-family: var(--font-body); }
.agd-tgl { font-size: var(--fs-nano); color: var(--muted); }
.agd-body { padding: 6px 10px 9px; display: flex; flex-direction: column; gap: 8px; }
.agd-row { display: flex; flex-direction: column; gap: 3px; }
.agd-row.agd-empty { font-size: var(--fs-micro); color: var(--muted); font-style: italic; padding: 4px 0; }
.agd-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.agd-name { font-size: var(--fs-micro); font-weight: 600; color: #e8ddc0; line-height: 1.25; }
.agd-rew { display: flex; gap: 6px; flex-shrink: 0; }
.agd-rew-i { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-nano); font-weight: 700; color: var(--gold-dim); }
.agd-rew-i .ric { vertical-align: -1px; }
.agd-crn { display: inline-flex; width: 11px; height: 11px; color: var(--gold-dim); }
.agd-crn svg { width: 11px; height: 11px; }
.agd-bar { height: 5px; border-radius: var(--r-xs); background: rgba(255,255,255,0.07); overflow: hidden; border: 1px solid rgba(0,0,0,0.4); }
.agd-bar span { display: block; height: 100%; background: linear-gradient(90deg, #8a6f2a, var(--gold-dim)); border-radius: var(--r-xs); transition: width 0.5s ease; }
.agd-n { font-size: var(--fs-nano); color: var(--muted); text-align: right; }

/* ---------- DEEDS OF THE CROWN — unlock medallion ---------- */
.ach-pop {
  position: absolute; top: 100px; left: 50%; transform: translateX(-50%) translateY(-14px) scale(0.94);
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, rgba(38,29,14,0.97), rgba(24,18,9,0.97));
  border: 1.5px solid var(--gold); border-radius: var(--r-panel);
  padding: 11px 20px 11px 13px; z-index: 220; pointer-events: none;
  box-shadow: 0 6px 30px rgba(0,0,0,0.7), 0 0 34px rgba(242,201,76,0.28);
  opacity: 0; transition: all 0.55s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.ach-pop.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
.ach-pop-medal {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 38% 32%, #6a5322, #3a2d10 70%);
  border: 2px solid var(--gold); box-shadow: inset 0 0 10px rgba(0,0,0,0.6), 0 0 14px rgba(242,201,76,0.4);
}
.ach-pop-kicker { font-family: var(--font-head); font-size: var(--fs-nano); font-weight: 900; letter-spacing: 3px; color: var(--gold-dim); }
.ach-pop-name { font-family: var(--font-head); font-size: var(--fs-h3); font-weight: 900; color: var(--gold); letter-spacing: 1px; margin: 1px 0; }
.ach-pop-desc { font-size: var(--fs-micro); color: #cabf9e; }

/* ---------- DEEDS panel ---------- */
.ach-modal { max-width: 720px; }
.ach-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  max-height: min(56vh, 520px); overflow-y: auto; padding: 4px 6px 4px 2px; margin: 10px 0;
}
.ach-card {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 9px 11px; opacity: 0.55; filter: saturate(0.4);
}
.ach-card.got { opacity: 1; filter: none; border-color: rgba(242,201,76,0.5); background: rgba(242,201,76,0.06); box-shadow: 0 0 12px rgba(242,201,76,0.1); }
.ach-card-ico {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 38% 32%, #4a3d1e, #241b0a 70%);
  border: 1.5px solid var(--border-lt);
}
.ach-card.got .ach-card-ico { border-color: var(--gold-dim); }
.ach-card-body { flex: 1; min-width: 0; }
.ach-card-body b { font-family: var(--font-head); font-size: var(--fs-small); color: #eee3c4; }
.ach-card.got .ach-card-body b { color: var(--gold); }
.ach-card-desc { font-size: var(--fs-nano); color: #b0a586; line-height: 1.35; margin-top: 1px; }
.ach-card-when { font-size: var(--fs-nano); color: #7a9a6e; margin-top: 3px; }
.ach-prog { height: 4px; border-radius: var(--r-xs); background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 5px; }
.ach-prog span { display: block; height: 100%; background: var(--gold-dim); }
.ach-prog-n { font-size: var(--fs-nano); color: var(--muted); margin-top: 2px; }
.ach-ico { image-rendering: auto; }

/* ---------- THE WANDERERS — a traveller at the gates ---------- */
.wander-modal { max-width: 480px; }
.wander-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; text-align: left; }
.wander-head h2 { margin: 0; }
.wander-head .ach-ico {
  flex-shrink: 0; border-radius: 50%; padding: 7px;
  background: radial-gradient(circle at 38% 32%, #4a3d1e, #241b0a 70%);
  border: 1.5px solid var(--gold-dim);
}
.wander-kicker { font-family: var(--font-head); font-size: var(--fs-nano); font-weight: 900; letter-spacing: 3px; color: var(--gold-dim); margin-top: 2px; }
.wander-deal {
  background: rgba(242,201,76,0.06); border: 1px solid rgba(242,201,76,0.25); border-radius: var(--r-card);
  padding: 8px 12px; margin: 10px 0 14px; font-size: var(--fs-copy); color: #eee3c4;
}
.wander-deal .ric { vertical-align: -2px; }
#wd-yes:disabled { opacity: 0.45; cursor: not-allowed; }

/* named veterans: the earned name leads, the trade follows quietly */
.sp-name .sp-sub { font-size: var(--fs-micro); font-weight: 400; color: #cabf9e; letter-spacing: 0; }

/* ---------- THE ETERNAL CROWN — campaign panel & topbar chip ---------- */
#crownchip { color: #ffe9b8; border-color: #6b5a3a; }
#crownchip.crn-hot { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 12px rgba(242,201,76,0.35); animation: pulse-gold 1.4s infinite; }
@keyframes pulse-gold { 50% { box-shadow: 0 0 20px rgba(242,201,76,0.6); } }
.crn-modal { max-width: 560px; }
.crn-step { font-size: var(--fs-small); color: #cabf9e; padding: 4px 10px; border-left: 3px solid var(--border); margin: 3px 0; text-align: left; }
.crn-step.done { color: #7ad88a; border-left-color: #4a8a54; }
.crn-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.crn-row {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--r-card); padding: 7px 10px;
}
.crn-row.got { border-color: rgba(242,201,76,0.5); background: rgba(242,201,76,0.06); }
.crn-ico { flex-shrink: 0; }
.crn-name { flex: 1; font-size: var(--fs-small); color: #eee3c4; line-height: 1.3; }
.crn-sub { font-size: var(--fs-nano); color: var(--muted); }
.crn-st { font-size: var(--fs-nano); color: #cabf9e; max-width: 150px; text-align: right; }
.crn-row.got .crn-st { color: var(--gold); font-weight: 700; }

/* ---------- THE WARDEN''S GUIDE — an illuminated handbook, not a wall of text ---------- */
.guide-modal { max-width: 780px; }
.gd-tabs { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin: 8px 0 12px; }
.gd-tab {
  font-family: var(--font-head); font-size: var(--fs-small); font-weight: 700;
  padding: 5px 12px; cursor: pointer; transition: all 0.12s;
}
.gd-tab:hover { border-color: var(--gold-dim); color: #eee3c4; }
.gd-tab.active { background: rgba(242,201,76,0.1); border-color: var(--gold); color: var(--gold); }
.gd-page { max-height: min(52vh, 480px); overflow-y: auto; text-align: left; padding: 2px 8px 6px 2px; }
.gd-lead { font-size: var(--fs-copy); color: #eee3c4; line-height: 1.5; margin-bottom: 12px; font-style: italic; }
.gd-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.gd-card {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-left: 3px solid var(--gold-dim);
  border-radius: var(--r-card); padding: 9px 12px; font-size: var(--fs-small); color: #cabf9e; line-height: 1.5;
}
.gd-card h4 { margin: 0 0 4px; font-family: var(--font-head); font-size: var(--fs-small); color: #ffe9b8; letter-spacing: 0.4px; }
.gd-card b { color: #eee3c4; }
.gd-tip {
  margin-top: 12px; padding: 8px 12px; border-radius: var(--r-card); font-size: var(--fs-small); line-height: 1.5;
  background: rgba(242,201,76,0.06); border: 1px solid rgba(242,201,76,0.25); color: #e8dcb8;
}
.gd-k {
  display: inline-block; background: rgba(255,255,255,0.08); border: 1px solid var(--border-lt);
  border-bottom-width: 2px; border-radius: var(--r-ctl); padding: 0 6px; font-family: var(--font-head);
  font-size: var(--fs-micro); font-weight: 700; color: #ffe9b8; margin: 0 1px;
}
.gd-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; font-size: var(--fs-small); color: #cabf9e; }
@media (max-width: 720px) { .gd-cards, .gd-keys { grid-template-columns: 1fr; } }


/* ---------- UI POLISH PASS: one coherent, premium skin ---------- */
/* thin gilded scrollbars everywhere a panel scrolls */
.gd-page::-webkit-scrollbar, .ach-grid::-webkit-scrollbar, #buildcards::-webkit-scrollbar,
#modal-box ::-webkit-scrollbar, .dip-log::-webkit-scrollbar, .crn-list::-webkit-scrollbar {
  width: 8px; height: 8px;
}
.gd-page::-webkit-scrollbar-thumb, .ach-grid::-webkit-scrollbar-thumb, #buildcards::-webkit-scrollbar-thumb,
#modal-box ::-webkit-scrollbar-thumb, .dip-log::-webkit-scrollbar-thumb, .crn-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6b5a3a, #4a3d28); border-radius: var(--r-ctl); border: 1px solid rgba(0,0,0,0.4);
}
.gd-page::-webkit-scrollbar-thumb:hover, #buildcards::-webkit-scrollbar-thumb:hover { background: #8a6f42; }
.gd-page::-webkit-scrollbar-track, .ach-grid::-webkit-scrollbar-track, #buildcards::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.25); border-radius: var(--r-ctl);
}

/* the modal box: an illuminated plate — corner gilding, deeper shadow */
#modal-box {
  position: relative;
  box-shadow: 0 12px 50px rgba(0,0,0,0.75), inset 0 1px 0 rgba(255,235,190,0.08);
}
/* NO corner brackets on #modal-box. It is the SCROLL CONTAINER, not the plate: its box can be
   taller or wider than the panel inside it, so a bracket pinned to its top-left and bottom-right
   floated off the panel's corners — and where it did line up it doubled the panel's own gilding,
   leaving two corners ornate and two corners bracketed. The four-corner flourish below
   (.menu-modal::after and friends) is the single owner of modal corners. */

/* buttons press and glow as one family */
.hud-btn, .title-btn, .form-btn, .icon-btn, .gd-tab {
  transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s, color 0.15s, background 0.15s;
}
.hud-btn:hover, .title-btn:hover, .form-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.45), 0 0 10px rgba(242,201,76,0.12);
}
.hud-btn:active, .title-btn:active, .form-btn:active, .icon-btn:active { transform: translateY(1px); box-shadow: none; }

/* the selection panel header gets its gilded rule */
.sp-bhead { border-bottom: 1px solid rgba(242,201,76,0.22); padding-bottom: 6px; }

/* toasts: clearer tier color, softer entrance */
#toasts .toast { border-left-width: 3px; backdrop-filter: none; }

/* build cards lift under the cursor */
.bcard:hover, .gd-card:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.bcard, .gd-card { transition: transform 0.12s, box-shadow 0.15s; }


/* ============================================================================
   WAVE 1c — THE MEASURED HUD  (responsive dock + premium skin)
   ----------------------------------------------------------------------------
   Everything below reads MEASURED custom properties written on #ui by
   HUD.measureLayout(). Nothing here guesses a pixel offset:

     --ui-w / --ui-h    viewport in #ui-LOCAL px (raw px / uiScale). Use these
                        instead of vw/vh: `zoom` does not rescale viewport units,
                        so a vh clamp inside a scaled HUD would be wrong.
     --hud-top          top bar height + 6  (however many rows it wrapped to)
     --hud-bottom       build dock height + 8
     --sel-w / --map-w  the dock's reserved side columns
     --right-w          widest right-edge panel (minimap / agenda / wars panel)
     --right-clear      what the right edge must keep free at the bottom
     --spell-h          spell bar height + 12   (0 when hidden)
     --group-h          LANE 2 height + 12 — the taller of the control-group row and
                        the multiplayer bar (0 when neither is on screen)
     --group-w          control-group lane width (0 when empty)
     --chron-w          chronicle lane width (0 when the ledger is empty)
     --toast-h          live toast stack height, so the chronicle slides under it

   The bottom of the screen is a stack of LANES, each one measured, so no two
   ever touch:  dock -> spell bar -> group chips -> info card.  Verify with
   HUD._layoutAudit() at any size.
   ============================================================================ */

#ui {
  --ui-scale: 1;
  --ui-w: 100vw;
  --ui-h: 100vh;
  --hud-top: 56px;
  --hud-bottom: 132px;
  --sel-w: 0px;
  --map-w: 0px;
  --right-w: 0px;
  --right-clear: 132px;
  --spell-h: 0px;
  --group-h: 0px;
  --group-w: 0px;
  --chron-w: 0px;
  --ledger-h: 0px;
  --toast-h: 0px;
  /* derived lanes, bottom-up */
  --lane-spell: var(--hud-bottom);
  --lane-group: calc(var(--hud-bottom) + var(--spell-h));
  --lane-info: calc(var(--hud-bottom) + var(--spell-h) + var(--group-h));
}
/* The type scale and the shared depth tokens are declared once, at the top of
   this file, on :root — #gametip is mounted on <body>, outside the HUD, and
   still has to read them. (A second copy used to live here with DIFFERENT
   values; experience.css then overrode three of them from a third place. The
   winner was whichever <link> came last, which is not a design decision.) */
/* The UI scale slider uses `zoom` (set inline by HUD.applyUiScale, and only when the
   scale is not 1) so every measurement above stays in honest CSS pixels. The full-screen
   overlays get the inverse inline at the same moment, so the title screen and the world
   map still fill the glass at any HUD size. */

/* ---------------------------------------------------------------- TOP BAR -- */
/* The top bar no longer wraps FREELY: the spacer collapses first, then the chips shrink
   with an ellipsis, and only then does it take a second row — with .tb-controls pinned
   last and right-aligned. It is allowed to wrap because --hud-top is now MEASURED: every
   box below follows it down, so a second row can never cover the controls again. (Forcing
   nowrap instead would just truncate the chips off the right edge between 1100 and 1900px,
   where the full bar wants roughly 1900px of content.) */
#topbar {
  flex-wrap: wrap;
  overflow: visible;
  row-gap: 5px;
  z-index: 70;
}
#topbar > * { flex-shrink: 0; }
.tb-controls { order: 99; }
.tb-spacer { flex: 1 1 0; min-width: 0; }
#topbar .chip, #topbar #kingname, #topbar #ageup-btn {
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
#resbar { flex-shrink: 1; min-width: 0; flex-wrap: nowrap; }
.res { white-space: nowrap; position: relative; }

/* Tier 1 — compact metrics; the controls claim the right edge of whatever row they land on */
#ui.uiw-lt1280 .tb-controls { margin-left: auto; }
#ui.uiw-lt1280 .res { padding: 2px 7px; font-size: var(--fs-small); gap: 3px; }
#ui.uiw-lt1280 .chip { padding: 3px 8px; font-size: var(--fs-micro); }
#ui.uiw-lt1280 #kingname { max-width: 120px; font-size: var(--fs-body); letter-spacing: 1px; }
#ui.uiw-lt1280 #seasonchip .sub2 { display: none; }
#ui.uiw-lt1280 .icon-btn { width: 28px; height: 28px; }
#ui.uiw-lt1280 .icon-btn svg { width: 14px; height: 14px; }
#ui.uiw-lt1280 #dayclock { transform: scale(0.85); transform-origin: center; margin: -3px -6px; }
#ui.uiw-lt1280 #ageup-btn { padding: 5px 9px; font-size: var(--fs-micro); }
#ui.uiw-lt1280 #topbar { padding: 5px 10px; gap: 6px; }

/* Tier 2 — the controls take their own right-aligned row, chips lose their sub-lines */
#ui.uiw-lt1100 .tb-controls { order: 99; flex-basis: 100%; justify-content: flex-end; }
#ui.uiw-lt1100 #popchip .sub2 { display: none; }
#ui.uiw-lt1100 #seasonchip { max-width: 210px; }
#ui.uiw-lt900 #kingname { display: none; }
#ui.uiw-lt900 #seasonchip { max-width: 130px; }

/* --------------------------------------------------------- THE BOTTOM DOCK -- */
/* One grid row across the whole width: [selection panel] [build menu] [minimap].
   The middle column is the only thing that moves when a panel opens, so the build
   cards SHRINK instead of being covered. Side columns are pure spacers. */
#buildbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  top: auto;
  transform: none;
  display: grid;
  grid-template-columns: var(--sel-w, 0px) minmax(0, 1fr) var(--map-w, 0px);
  align-items: end;
  pointer-events: none;
  z-index: 45;
}
.dock-col { min-width: 0; pointer-events: none; }
.dock-mid {
  min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  pointer-events: none;
}
#buildtabs {
  pointer-events: auto;
  max-width: min(100%, 980px);
  padding: 0 6px;
}
#buildcards {
  pointer-events: auto;
  width: 100%;
  max-width: min(100%, 980px);
  max-height: min(calc(0.34 * var(--ui-h)), calc(var(--ui-h) - var(--hud-top) - 200px));
  border-radius: var(--r-panel) var(--r-panel) 0 0;
  padding: 9px 11px 11px;
  background:
    linear-gradient(180deg, rgba(255,240,205,0.05), transparent 22%),
    linear-gradient(180deg, rgba(48,37,24,0.97), rgba(24,18,12,0.985));
  border: 1px solid var(--border-lt);
  border-bottom: none;
  box-shadow: var(--inlay), 0 -10px 30px rgba(0,0,0,0.6);
}
/* short screens: a smaller tray and smaller cards — the `- 200px` guard stays in the min()
   so a tall wrapped top bar can never let the dock reach the chrome above it */
#ui.uih-lt620 #buildcards {
  max-height: min(calc(0.26 * var(--ui-h)), calc(var(--ui-h) - var(--hud-top) - 190px));
  padding: 6px 8px 8px;
}
#ui.uih-lt620 .bcard { width: 64px; padding: 4px 2px; }
#ui.uih-lt620 .bcard-icon { font-size: var(--fs-h3); }
#ui.uih-lt620 .bcard-icon .tic { width: 24px !important; height: 24px !important; }
#ui.uih-lt620 .bcard-name { font-size: var(--fs-nano); }
#ui.uih-lt620 .bera { font-size: var(--fs-nano); margin: 1px 2px 0; }
#ui.uih-lt620 .btab { padding: 4px 11px; font-size: var(--fs-micro); }

/* build tabs: engraved shoulders on the tray */
.btab {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 14px 5px;
  border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--r-panel) var(--r-panel) 0 0;
  background: linear-gradient(180deg, rgba(40,31,20,0.92), rgba(20,15,10,0.92));
  font-size: var(--fs-small); letter-spacing: 0.6px;
  transition: color 0.14s, background 0.14s, border-color 0.14s, transform 0.1s;
}
.btab:hover { color: #f0e2bc; border-color: var(--gold-dim); }
.btab.on {
  background: linear-gradient(180deg, rgba(78,60,34,0.98), rgba(40,30,19,0.98));
  color: var(--gold); border-color: var(--gold-dim);
  box-shadow: 0 -3px 12px rgba(242,201,76,0.16);
}
.btab-ic { display: inline-flex; width: 14px; height: 14px; }
.btab-ic svg { width: 14px; height: 14px; display: block; }
.btab.bfold { padding: 5px 10px; }
.btab.bfold svg { width: 13px; height: 13px; }
#ui.uiw-lt900 .btab-l { display: none; }
#ui.uiw-lt900 .btab { padding: 5px 10px; }

/* --------------------------------------------------------- SELECTION PANEL -- */
#selpanel {
  position: absolute;
  left: 12px; bottom: 12px; top: auto; right: auto;
  width: 300px;
  max-height: calc(var(--ui-h) - var(--hud-top) - 24px);
  overflow-y: auto;
  z-index: 60;
  border-radius: var(--r-panel);
  padding: 12px 13px;
  font-size: var(--fs-body);
  border: 1px solid var(--border-lt);
  box-shadow: var(--inlay), var(--lift);
}
#ui.uiw-lt1200 #selpanel { width: 260px; padding: 10px 11px; }
#ui.uiw-lt900 #selpanel { width: 232px; }

/* ----------------------------------------------------------- RIGHT COLUMN -- */
#minimap-wrap {
  position: absolute; right: 12px; bottom: 12px;
  z-index: 46;
  border: 1px solid var(--border-lt);
  border-radius: var(--r-panel);
  box-shadow: var(--inlay), var(--lift);
}
/* (the minimap canvas is pinned to 168 CSS px inline by HUD._dprCtx for hi-dpi drawing,
   so it is never resized here — --map-w reserves exactly what it takes.) */

#agenda {
  --agd-top: var(--hud-top);
  top: var(--agd-top);
  right: 12px;
  max-height: max(96px, calc(var(--ui-h) - var(--agd-top) - var(--right-clear) - 24px));
  overflow: auto;
  border-radius: var(--r-panel);
  box-shadow: var(--inlay), var(--sh-2);
}
#ui.uih-lt620 #agenda { width: 208px; }
/* the wars panel owns the top-right in Kingdom Wars; the agenda steps below it */
#wars-panel { top: var(--hud-top); right: 12px; border-radius: var(--r-panel); box-shadow: var(--inlay), var(--sh-2); }
#ui:has(#wars-panel) #agenda { --agd-top: calc(var(--hud-top) + 168px); }

/* -------------------------------------------------------------- THE LANES -- */
/* lane 1: the spell bar rides directly on the dock */
#spellbar {
  left: var(--sel-w, 0px);
  right: var(--right-w, 0px);
  bottom: var(--lane-spell);
  transform: none;
  justify-content: center;
  flex-wrap: wrap;
  align-content: flex-end;
  z-index: 44;
}
#ui.uiw-lt1200 .spell { width: 48px; height: 60px; }
#ui.uiw-lt1200 .spell-icon { width: 26px; height: 26px; }

/* lane 2: control groups, a left-anchored row so the spell bar keeps the middle */
#groupbar {
  position: absolute;
  left: calc(var(--sel-w, 0px) + 12px);
  right: auto;
  bottom: var(--lane-group);
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 5px;
  z-index: 47;
  max-width: calc(var(--ui-w) - var(--sel-w) - var(--right-w) - 24px);
  flex-wrap: wrap;
}
.gchip { padding: 4px 9px; font-size: var(--fs-copy); }
.gchip:hover { transform: translateY(-2px); }

/* The click-to-inspect card joins the TOP information column, beside the ledger and under
   the toast stack. At 1093x560 the bottom of the screen is three measured lanes deep
   already; a fourth could not clear them, and this card belongs with the other reading
   matter anyway. It steps right of the chronicle by exactly --chron-w. */
#infopanel {
  top: calc(var(--hud-top) + var(--toast-h, 0px));
  bottom: auto;
  left: calc(var(--sel-w, 0px) + var(--chron-w, 0px) + 12px);
  right: calc(var(--right-w, 0px) + 12px);
  transform: none;
  width: fit-content;
  max-width: min(460px, 100%);
  margin-inline: auto;
  border-radius: var(--r-panel);
  font-size: var(--fs-body);
  box-shadow: var(--inlay), var(--sh-2);
}

/* the multiplayer bar shares the group lane, to the right of the group chips */
#mp-bar {
  left: calc(var(--sel-w, 0px) + var(--group-w, 0px));
  right: var(--right-w, 0px);
  bottom: var(--lane-group);
  transform: none;
  justify-content: center;
  z-index: 43;
}

/* --------------------------------------------------------- THE TOP LANES -- */
/* toasts own the centre; the chronicle slides down under whatever they occupy */
#toasts {
  top: var(--hud-top);
  left: var(--sel-w, 0px);
  right: var(--right-w, 0px);
  transform: none;
  /* no padding: an EMPTY toast stack must measure exactly 0 px tall, or the chronicle
     would be pushed down by a phantom strip and the audit would see a phantom box */
  padding: 0;
}
/* The ledger is clipped as a whole so it can never grow into the bottom lanes. The
   "Ledger" button is FIRST in the DOM, so the clip eats the oldest lines, never the
   only clickable thing in the feed. */
#chronicle {
  top: calc(var(--hud-top) + var(--toast-h, 0px));
  left: 12px;
  width: min(340px, calc(var(--ui-w) - var(--right-w) - 24px));
  max-height: max(0px, calc(var(--ui-h) - var(--hud-top) - var(--toast-h) - var(--lane-info) - 24px));
  overflow: hidden;
  /* NO transition on `top`. The ledger's lane is driven by --hud-top and --toast-h, and an
     eased slide means that for a quarter second after either changes the ledger is sitting
     ON the top bar — which HUD._layoutAudit() correctly reports as an overlap. A guaranteed
     lane beats a 250 ms ease on a deliberately quiet panel. */
  align-items: flex-start;
}
/* Ledger is a fixed navigation control, not part of the moving selection lane.
   Inspection folds only the passive feed; the full log remains one click away.
   The mobile sheet keeps its existing visibility policy in identity.css. */
#ui:not(.uiw-lt700):has(#selpanel:not(.hidden)) #chron-lines { display: none; }
#ui:not(.uiw-lt700):has(#selpanel:not(.hidden)) #chronicle { width: fit-content; max-height: none; }
#ui:not(.uiw-lt700):has(#chron-more:not(.hidden)) #selpanel {
  max-height: calc(var(--ui-h) - var(--hud-top) - var(--toast-h, 0px) - var(--ledger-h, 45px) - 24px);
}
/* newest line on top */
#chron-lines { display: flex; flex-direction: column-reverse; gap: 4px; width: 100%; }
.chron-line { max-width: 100%; }
/* the ledger button: the only clickable thing in the quiet feed */
.chron-more {
  pointer-events: auto;
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 5px; padding: 3px 10px;
  background: linear-gradient(180deg, rgba(48,37,24,0.92), rgba(24,18,12,0.92));
  border: 1px solid var(--border); border-radius: var(--r-pill);
  color: #c2b592; font-family: var(--font-head); font-size: var(--fs-micro);
  font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase;
  cursor: pointer; opacity: 0.6; transition: all 0.15s;
}
.chron-more:hover { opacity: 1; color: var(--gold); border-color: var(--gold-dim); }
.chron-more svg { width: 12px; height: 12px; display: block; }
.chron-log {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  max-height: min(56vh, 500px); overflow-y: auto; margin: 8px 0 12px;
  padding-right: 6px;
}
.chron-log-row {
  display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: baseline;
  font-size: var(--fs-small); line-height: 1.5; color: var(--parch-dim);
  padding: 5px 8px; border-radius: var(--r-card);
  border-left: 2px solid rgba(201,168,76,0.35);
  background: rgba(255,255,255,0.025);
}
.chron-log-row.good { border-left-color: var(--green); }
.chron-log-day { font-family: var(--font-head); font-size: var(--fs-micro); color: var(--muted); letter-spacing: 0.5px; }
.chron-modal { max-width: 660px; }

/* the deed medallion and the region banner clear the measured top bar too */
.ach-pop { top: calc(var(--hud-top) + var(--toast-h, 0px) + 12px); }
#regionlabel { top: max(18%, calc(var(--hud-top) + 10px)); }

/* ============================ PREMIUM SKIN ================================= */
/* Type scale: one ladder, nothing under 10px, clear reading and display roles. */
#ui { font-size: var(--fs-body); }
.sp-row, .modal-text, .menu-info, .help-body, .gd-page, .chat-msg { font-size: var(--fs-body); }
.sp-row.muted, .muted, .sp-desc, .dip-likes, .crn-sub, .agd-name { font-size: var(--fs-small); }
.bcard-cost, .bcard-lock, .spu-cost, .tech-cost, .law-row .law-hint { font-size: var(--fs-micro); }
.menu-modal h2, .big-modal h2 { font-size: var(--fs-h1); letter-spacing: 3px; }
.ppl-h, .mkt-col h3, .int-sect, .guide-modal .help-body h3 { font-size: var(--fs-small); letter-spacing: 2.4px; }
.sp-name { font-size: var(--fs-h3); letter-spacing: 0.6px; }

/* The third panel skin was here (a layered leather over parchment). Also dead,
   also deleted. The corner flourishes below are the part that was actually
   reaching the screen, and they stay — they are inline SVG data URIs, so still
   zero image files. (.interior-modal is deliberately not given them: it wears
   its room's accent border over prepared art, and a shared skin flattens it.) */
/* NOTE: never add `position: relative` to the group above — #selpanel must stay
   absolutely docked. The modals declare it for themselves here. The flourish is skipped
   for #selpanel on purpose: it scrolls, and an absolute corner would scroll away with it. */
.menu-modal, .big-modal, .council-modal, .crisis-modal, .lb-panel, .title-screen { position: relative; }
.menu-modal::after, .big-modal::after, .crisis-modal::after, .title-screen::after {
  content: ''; position: absolute; inset: 4px; pointer-events: none; z-index: 0;
  border-radius: var(--r-card);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34' viewBox='0 0 34 34'%3E%3Cpath d='M1 12V5a4 4 0 0 1 4-4h7M5 5h3.5M5 5v3.5' fill='none' stroke='%23f2c94c' stroke-opacity='.42' stroke-width='1.1' stroke-linecap='round'/%3E%3Ccircle cx='12.6' cy='1.4' r='1' fill='%23f2c94c' fill-opacity='.35'/%3E%3C/svg%3E") top left no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34' viewBox='0 0 34 34'%3E%3Cpath d='M33 12V5a4 4 0 0 0-4-4h-7M29 5h-3.5M29 5v3.5' fill='none' stroke='%23f2c94c' stroke-opacity='.42' stroke-width='1.1' stroke-linecap='round'/%3E%3Ccircle cx='21.4' cy='1.4' r='1' fill='%23f2c94c' fill-opacity='.35'/%3E%3C/svg%3E") top right no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34' viewBox='0 0 34 34'%3E%3Cpath d='M1 22v7a4 4 0 0 0 4 4h7M5 29h3.5M5 29v-3.5' fill='none' stroke='%23f2c94c' stroke-opacity='.42' stroke-width='1.1' stroke-linecap='round'/%3E%3C/svg%3E") bottom left no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34' viewBox='0 0 34 34'%3E%3Cpath d='M33 22v7a4 4 0 0 1-4 4h-7M29 29h-3.5M29 29v-3.5' fill='none' stroke='%23f2c94c' stroke-opacity='.42' stroke-width='1.1' stroke-linecap='round'/%3E%3C/svg%3E") bottom right no-repeat;
}
/* NOT `.title-screen > *`: the title panel owns an absolutely-positioned .title-bg (the blurred
   painted vista behind the buttons), and forcing `position: relative` on it collapsed it to 0x0
   and blanked the backdrop. The title's flourish is lifted over that layer instead. */
.menu-modal > *, .big-modal > *, .crisis-modal > *, #selpanel > * { position: relative; z-index: 1; }
.title-screen::after { z-index: 2; }

/* Buttons: one family, three ranks, real press feedback. */
.title-btn, .hud-btn, .crisis-btn, .form-btn, .icon-btn, .slot-btn, .diff-btn, .gd-tab, .int-card, .chron-more {
  transition: transform 0.1s cubic-bezier(0.2,0.8,0.3,1), box-shadow 0.16s, border-color 0.16s, color 0.16s, background 0.16s, filter 0.1s;
}
.hud-btn, .title-btn, .crisis-btn { border-radius: var(--r-ctl); }
.hud-btn:hover, .title-btn:hover, .crisis-btn:hover, .form-btn:hover {
  transform: translateY(-2px);
  border-color: var(--gold-dim);
  box-shadow: inset 0 1px 0 rgba(255,235,190,0.26), 0 6px 16px rgba(0,0,0,0.5), 0 0 16px rgba(242,201,76,0.2);
}
.hud-btn:active, .title-btn:active, .crisis-btn:active, .form-btn:active, .icon-btn:active, .bcard:active, .btab:active {
  transform: translateY(1px) scale(0.99);
  filter: brightness(1.1);
  box-shadow: var(--sh-sunken);
}
/* rank 1 — the gilded call to action */
.title-btn.primary, .hud-btn.gold, .title-btn.gold {
  background: linear-gradient(180deg, rgba(255,250,216,0.16), transparent 32%), linear-gradient(180deg, #9a7729 0%, #6a5220 55%, #3a2c13 100%);
  border-color: var(--gold-dim);
  color: #fff4cf;
  box-shadow: inset 0 1px 0 rgba(255,246,204,0.34), 0 5px 14px rgba(0,0,0,0.5), 0 0 18px rgba(242,201,76,0.16);
}
.title-btn.primary:hover, .hud-btn.gold:hover, .title-btn.gold:hover {
  border-color: #ffe9a8; color: #fffbe6;
  box-shadow: inset 0 1px 0 rgba(255,246,204,0.44), 0 10px 24px rgba(0,0,0,0.55), 0 0 26px rgba(242,201,76,0.45);
}
/* rank 2 — the shared-realm variant: multiplayer wears BLUED STEEL.
   The old #4a9de0 rim was an electric web-UI blue sitting in a screen made of gold leaf,
   parchment and leather: it read as a control from a different application. Heraldic indigo
   with a pewter rim keeps the rank unmistakable and stays inside the game's palette. */
.title-btn.mp-btn, .hud-btn.mp-btn {
  background: linear-gradient(180deg, rgba(198,220,240,0.10), transparent 32%), linear-gradient(180deg, #223650 0%, #152234 60%, #0a1016 100%);
  border-color: #7492b0; color: #cfdeec;
}
.title-btn.mp-btn:hover, .hud-btn.mp-btn:hover { border-color: #b3cade; color: #eaf3fa; box-shadow: 0 8px 22px rgba(0,0,0,0.55), 0 0 22px rgba(140,175,208,0.34); }
/* rank 3 — the irreversible one */
.title-btn.danger, .hud-btn.danger, .crisis-btn.danger {
  background: linear-gradient(180deg, rgba(255,190,170,0.1), transparent 32%), linear-gradient(180deg, #56241d 0%, #351512 60%, #1c0c0a 100%);
  border-color: #8a4a3a; color: #f4c3b2;
}
.title-btn.danger:hover, .hud-btn.danger:hover {
  border-color: #d06a52; color: #ffe0d2;
  box-shadow: 0 8px 22px rgba(0,0,0,0.55), 0 0 20px rgba(214,69,69,0.36);
}
.hud-btn.disabled, .title-btn.disabled { opacity: 0.45; filter: grayscale(0.4); }
.hud-btn.disabled:hover, .title-btn.disabled:hover { transform: none; box-shadow: none; }
.icon-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(0,0,0,0.5), 0 0 12px rgba(242,201,76,0.22); }

/* Build cards: a 2px gilt edge and a real lift under the cursor. */
.bcard {
  border-width: 1px;
  border-radius: var(--r-panel);
  background:
    linear-gradient(180deg, rgba(255,240,205,0.06), transparent 34%),
    linear-gradient(180deg, #3c2f1f, #241b11);
  box-shadow: inset 0 1px 0 rgba(255,235,190,0.12), var(--sh-1);
  transition: transform 0.13s cubic-bezier(0.2,0.9,0.3,1), box-shadow 0.16s, border-color 0.12s;
}
.bcard:not(.locked):hover {
  transform: translateY(-5px);
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(242,201,76,0.55), 0 10px 20px rgba(0,0,0,0.55), 0 0 18px rgba(242,201,76,0.3);
}
.bcard.selected {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(242,201,76,0.7), 0 0 20px rgba(242,201,76,0.55);
}
.bcard-name { font-size: var(--fs-nano); margin: 3px 0 1px; }
.bcard-cost { font-size: var(--fs-nano); color: #c2b592; }
.bcard-lock { font-size: var(--fs-nano); }
.bcard-work { font-size: var(--fs-nano); top: 3px; right: 4px; }
.bera { font-size: var(--fs-nano); letter-spacing: 2px; margin: 5px 2px 2px; }

/* The tooltip card: the build menu's real datasheet. */
#gametip.card {
  max-width: 320px; padding: 0; overflow: hidden;
  border: 1px solid var(--gold-dim);
  box-shadow: 0 14px 40px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,235,190,0.14);
}
.tipcard { padding: 10px 12px 11px; }
.tip-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tip-ico {
  width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-card); border: 1px solid var(--gold-dim);
  background: radial-gradient(circle at 50% 32%, #4a3c24, #201709 78%);
  box-shadow: var(--sh-sunken);
}
.tip-ico img { image-rendering: auto; }
.tip-h { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tip-h b { font-family: var(--font-head); font-size: var(--fs-body); color: var(--gold); letter-spacing: 0.6px; }
.tip-era { font-size: var(--fs-micro); letter-spacing: 1.4px; text-transform: uppercase; }
.tip-cost {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: var(--fs-small); color: #e4d8b6;
  padding-bottom: 7px; margin-bottom: 7px;
  border-bottom: 1px solid rgba(201,168,76,0.22);
}
.tip-time { color: #b0a488; font-size: var(--fs-small); display: inline-flex; align-items: center; gap: 3px; }
.tip-flavour { font-size: var(--fs-small); font-style: italic; color: #b9ac90; line-height: 1.45; margin-top: 7px; }
.tip-lock { margin-top: 6px; font-size: var(--fs-small); color: #e0a17a; display: flex; align-items: center; gap: 5px; }
.tip-lock svg { width: 12px; height: 12px; }
#gametip .fx-chips { gap: 4px; margin: 0; }
#gametip .fxc { font-size: var(--fs-micro); padding: 2px 7px; }

/* Resource bar: the delta pulse — a real swing floats off the chip. */
.res-delta {
  position: absolute; left: 50%; top: -2px;
  transform: translateX(-50%);
  font-size: var(--fs-micro); font-weight: 800; font-family: var(--font-head);
  pointer-events: none; white-space: nowrap;
  text-shadow: 0 1px 4px #000;
  animation: res-float 0.95s cubic-bezier(0.2,0.8,0.3,1) forwards;
}
.res-delta.up { color: #8fe0a0; }
.res-delta.dn { color: #ff9c8a; }
@keyframes res-float {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.85); }
  22% { opacity: 1; transform: translate(-50%, -4px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -22px) scale(0.95); }
}
.res.res-up { animation: res-flash-g 0.55s ease-out; }
.res.res-dn { animation: res-flash-r 0.55s ease-out; }
@keyframes res-flash-g { 0% { box-shadow: inset 0 0 0 1px rgba(143,224,160,0.8), 0 0 14px rgba(90,215,110,0.4); } 100% { box-shadow: inset 0 1px 0 rgba(242,201,76,0.1); } }
@keyframes res-flash-r { 0% { box-shadow: inset 0 0 0 1px rgba(255,156,138,0.8), 0 0 14px rgba(214,69,69,0.4); } 100% { box-shadow: inset 0 1px 0 rgba(242,201,76,0.1); } }

/* Selection panel: portrait in a gold ring, a real hp bar, tabbed actions when short. */
.sp-portrait {
  width: 64px; height: 64px; border-radius: 50%;
  border: 2px solid var(--gold-dim);
  background: radial-gradient(circle at 50% 30%, #514028, #1e1509 76%);
  box-shadow:
    inset 0 3px 10px rgba(0,0,0,0.7),
    inset 0 0 0 1px rgba(255,233,168,0.18),
    0 0 0 3px rgba(20,14,8,0.85),
    0 0 14px rgba(242,201,76,0.2);
  overflow: hidden;
}
#ui.uiw-lt1200 .sp-portrait { width: 54px; height: 54px; }
.sp-hp {
  height: 16px; border-radius: var(--r-card);
  border: 1px solid rgba(0,0,0,0.7);
  background: linear-gradient(180deg, #100b06, #1d1409);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.8), 0 1px 0 rgba(255,235,190,0.08);
}
.sp-hpfill {
  background: linear-gradient(180deg, #7ce08c 0%, #4aab5c 46%, #2c7a3c 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 0 10px rgba(90,215,110,0.35);
}
.sp-hpfill.low {
  background: linear-gradient(180deg, #ef8072 0%, #c8443c 46%, #7c231d 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.24), 0 0 10px rgba(214,69,69,0.4);
}
.sp-hp span { line-height: 16px; font-size: var(--fs-nano); letter-spacing: 0.4px; }
.sp-tabs { display: none; gap: 4px; margin: 8px 0 6px; }
.sp-tab {
  flex: 1; cursor: pointer;
  background: rgba(255,255,255,0.035); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 5px 8px;
  color: #b6aa8c; font-family: var(--font-head); font-size: var(--fs-small);
  font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  transition: all 0.14s;
}
.sp-tab:hover { color: #e8dcc0; border-color: var(--gold-dim); }
.sp-tab.on { background: rgba(242,201,76,0.1); border-color: var(--gold-dim); color: var(--gold); }
/* :has(.sp-tabs) keeps the split OFF for the unit/villager/camp panels, which render a
   .sp-body but no tab strip — without it a stale data-sptab would blank them */
#ui.uih-lt620 #selpanel .sp-tabs { display: flex; }
#ui.uih-lt620 #selpanel:has(.sp-tabs)[data-sptab="info"] .sp-foot { display: none; }
#ui.uih-lt620 #selpanel:has(.sp-tabs)[data-sptab="act"] .sp-body,
#ui.uih-lt620 #selpanel:has(.sp-tabs)[data-sptab="act"] .sp-desc { display: none; }
.sp-foot { gap: 6px; margin-top: 9px; }
.sp-foot .hud-btn { flex: 1 1 auto; text-align: center; font-size: var(--fs-small); padding: 7px 10px; }
.sp-tag { font-size: var(--fs-micro); padding: 2px 8px; letter-spacing: 0.6px; }

/* Toasts and banners: a clear hierarchy — quiet info, amber warning, pulsing red, gilt deed. */
#toasts .toast { font-size: var(--fs-copy); padding: 8px 18px; border-radius: var(--r-panel); }
.toast.warn { border-color: rgba(224,160,48,0.5); color: #f4dda6; box-shadow: 0 6px 18px rgba(0,0,0,0.55), 0 0 14px rgba(224,160,48,0.18); }
.toast.bad {
  border-color: rgba(214,69,69,0.55); color: #ffbfae;
  animation: toast-alarm 1.4s ease-in-out infinite;
}
@keyframes toast-alarm {
  0%, 100% { box-shadow: 0 6px 18px rgba(0,0,0,0.55), 0 0 0 1px rgba(214,69,69,0.25); }
  50% { box-shadow: 0 6px 18px rgba(0,0,0,0.55), 0 0 0 1px rgba(214,69,69,0.85), 0 0 18px rgba(214,69,69,0.35); }
}
.toast.ach {
  border-color: var(--gold); color: #ffeaa8;
  background: linear-gradient(100deg, rgba(64,49,22,0.97), rgba(30,23,12,0.97));
}
.toast.ach::before {
  content: '';
  display: inline-block; width: 13px; height: 13px; margin-right: 7px; vertical-align: -2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.6l2.3 6.6 6.9.3-5.4 4.3 1.9 6.7L12 15.7 6.3 19.5l1.9-6.7-5.4-4.3 6.9-.3z' fill='%23f2c94c'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: ach-sparkle 1.8s ease-in-out infinite;
}
@keyframes ach-sparkle { 0%, 100% { opacity: 0.7; transform: scale(0.92) rotate(0deg); } 50% { opacity: 1; transform: scale(1.12) rotate(12deg); } }

/* Modals: open and close on a curve, never a jump cut. */
#modal-layer { transition: opacity 0.14s ease; }
#modal-box > .menu-modal, #modal-box > .big-modal, #modal-box > .crisis-modal,
#modal-box > .council-modal, #modal-box > .interior-modal, #modal-box > .lobby-modal {
  animation: modal-rise 0.16s cubic-bezier(0.2,0.9,0.3,1);
}
/* Scale, never translate: #modal-box is the scroll container, and a child translated DOWN
   adds scrollable overflow, so a gilded scrollbar flashed down the right edge of every
   modal for the length of the entrance. A centred scale can never overflow its own box. */
@keyframes modal-rise { from { opacity: 0; transform: scale(0.945); } to { opacity: 1; transform: none; } }
/* the close half of the transition plays on a detached clone (HUD._ghostClose) so no
   `contains('hidden')` check anywhere in the game ever sees a modal that is on its way out */
#ui > .modal-ghost {           /* id-level specificity: #ui > * would re-arm pointer events */
  position: absolute; inset: 0; z-index: 99;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  background: rgba(6,5,3,0.8);
  animation: modal-ghost-out 0.16s ease forwards;
}
.modal-ghost > * { animation: modal-sink 0.16s ease forwards; max-height: 94vh; overflow: hidden; }
@keyframes modal-ghost-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes modal-sink { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px) scale(0.965); } }
#modal-box { max-height: 94vh; }
#modal-box:has(.title-screen) { overflow: auto; }
.settings-modal { min-width: 460px; max-width: 520px; text-align: left; }
.set-scroll { max-height: min(58vh, 560px); overflow-y: auto; padding-right: 8px; display: flex; flex-direction: column; gap: 5px; }
.set-scroll .ppl-h:first-child { margin-top: 0; }
.set-select {
  flex: 1; min-width: 0;
  background: linear-gradient(180deg, #3a2d1e, #241b11); color: #e8d6a8;
  border: 1px solid var(--border); border-radius: var(--r-card); padding: 5px 8px;
  font-family: var(--font-body); font-size: var(--fs-small);
}
.vol-row { justify-content: flex-start; gap: 10px; font-size: var(--fs-body); }
.vol-l { width: 84px; flex: none; color: #b6aa8c; font-size: var(--fs-small); letter-spacing: 0.4px; }
.vol-v { width: 46px; flex: none; text-align: right; color: var(--gold-dim); font-size: var(--fs-small); }
.chk-row { justify-content: flex-start; gap: 9px; padding: 3px 2px; font-size: var(--fs-body); }
.chk-row input[type=checkbox] { accent-color: var(--gold-dim); width: 15px; height: 15px; flex: none; }
.chk-hint { display: block; font-size: var(--fs-micro); color: var(--muted); font-style: italic; }
.set-foot { margin-top: 12px; }

/* ------------------------------------------------------------ TITLE SCREEN -- */
.title-screen > .title-stack {
  position: relative;
  z-index: 4;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  width: 100%;
  transform-origin: top center;
  will-change: transform;
}
/* A slow gold glint travels across the wordmark. The highlight is a SECOND background
   layer on the same background-clip:text stack, so it is clipped to the letters — one
   small repaint on an otherwise static screen, not a full-viewport re-blend. */
.title-logo {
  position: relative;
  background:
    linear-gradient(104deg, transparent 34%, rgba(255,255,255,0.62) 44%, rgba(255,246,204,0.2) 50%, transparent 60%),
    linear-gradient(180deg, #fffbe2 0%, #f2c94c 43%, #b57629 76%, #5d381b 100%);
  background-size: 300% 100%, 100% 100%;
  background-position: -140% 0, 0 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: logo-glint 7.5s ease-in-out infinite;
}
.title-logo .tl-word { display: inline-block; }
@keyframes logo-glint {
  0%, 60% { background-position: -140% 0, 0 0; }
  100% { background-position: 240% 0, 0 0; }
}
/* a very slow drifting vignette so the still frame keeps breathing */
.title-screen > .title-vignette { animation: vig-drift 24s ease-in-out infinite alternate; }
@keyframes vig-drift { 0% { transform: scale(1) translate3d(-0.6%, 0, 0); } 100% { transform: scale(1.03) translate3d(0.6%, -0.4%, 0); } }
@media (max-height: 620px) {
  .title-screen { padding-top: 14px; padding-bottom: 14px; }
  .title-crest svg { width: clamp(56px, 7vh, 72px); }
  .title-logo { font-size: clamp(62px, 7.6vw, 88px); }
  .title-sub { font-size: var(--fs-body); margin-top: 2px; }
  .title-menu { gap: 8px; margin-top: 14px; padding: 10px; width: min(600px, 64vw); }
  .title-screen .title-btn { min-height: 42px; padding: 9px 14px; font-size: var(--fs-copy); }
  .title-screen .title-btn.primary { min-height: 52px; font-size: var(--fs-h3); }
  .title-screen .title-btn.small { min-height: 38px; font-size: var(--fs-small); }
  .title-stats { padding: 4px 12px; font-size: var(--fs-micro); }
  .title-ver { margin-top: 6px; font-size: var(--fs-nano); }
}

/* ------------------------------------------------------- REDUCED MOTION --- */
/* Kills the decorative motion only: presses, hovers and the modal curve remain. */
body.reduce-motion .ember-fx,
body.reduce-motion .title-screen > .title-rays,
body.reduce-motion .title-screen > .title-kingdom-vfx { display: none; }
body.reduce-motion .title-logo,
body.reduce-motion .title-screen > .title-vignette,
body.reduce-motion .title-crest,
body.reduce-motion .title-stars,
body.reduce-motion #ageup-btn,
body.reduce-motion .toast.bad,
body.reduce-motion .toast.ach::before,
body.reduce-motion .chip .danger,
body.reduce-motion #crownchip.crn-hot,
body.reduce-motion .meter span::after,
body.reduce-motion .fac-bar span::after,
body.reduce-motion #selpanel { animation: none !important; }
body.reduce-motion .chron-line { transition: opacity 0.2s ease; transform: none; }

/* ---------------------------------------------------------------- SUNDRY --- */
/* the fold tab and the demolish tab keep a hint of their state at a glance */
.btab.bfold.on { color: #ff9c8a; border-color: #8a4a3a; background: linear-gradient(180deg, rgba(84,38,30,0.95), rgba(38,18,14,0.95)); }
/* scroll shadows so a clipped tray reads as clipped */
#buildcards, .set-scroll, .gd-page, .ach-grid, .chron-log, #selpanel { scrollbar-width: thin; scrollbar-color: #6b5a3a #241b10; }
/* the spell bar's glassy plate */
.spell {
  background:
    linear-gradient(180deg, rgba(190,168,255,0.09), transparent 34%),
    linear-gradient(180deg, rgba(42,34,62,0.96), rgba(18,14,28,0.97));
  border-width: 1px; border-color: #4e4176;
  box-shadow: inset 0 1px 0 rgba(190,168,255,0.2), var(--sh-2);
}
.spell:hover { box-shadow: inset 0 1px 0 rgba(190,168,255,0.3), 0 8px 18px rgba(0,0,0,0.55), 0 0 18px rgba(157,123,255,0.45); }
.spell-name { font-size: var(--fs-nano); }
.spell-cost { font-size: var(--fs-nano); }
/* group chips get the same metal as the rest of the family */
.gchip {
  background: linear-gradient(180deg, rgba(48,37,24,0.95), rgba(24,18,12,0.95));
  border: 1px solid var(--border-lt);
  box-shadow: inset 0 1px 0 rgba(255,235,190,0.14), var(--sh-2);
}
.gchip:hover { border-color: var(--gold); box-shadow: inset 0 1px 0 rgba(255,235,190,0.24), 0 6px 14px rgba(0,0,0,0.5), 0 0 12px rgba(242,201,76,0.24); }

/* ================= WAVE 3: THE GREAT GAME / THE ART OF WAR / THE LAW TREE =================
   kingdoms.js, combat2.js and eras.js render their surfaces with inline fallbacks so they work
   standalone; these rules give them the native chrome. eras.js injects its own <style id="erx-css">
   at load, so nothing here touches .erx-*. */
.kg-modal .kg-choices { margin-top: 10px; }
.kg-modal .kg-choice { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 9px 12px; line-height: 1.35; }
.kg-modal .kg-choice .kg-hint { display: block; font-size: var(--fs-micro); font-weight: 400; opacity: .78; margin-top: 2px; }
.kg-panel table { border-collapse: collapse; font-size: var(--fs-micro); }
.kg-panel table th { padding: 3px 5px; font-weight: 600; color: var(--gold); font-size: var(--fs-nano); letter-spacing: .04em; }
.kg-panel table td { padding: 3px 5px; text-align: center; }

/* the law tree: a statute that stands on another (DATA.LAWS[id].req) */
.law-row .law-req { display: block; font-size: var(--fs-nano); opacity: .6; margin-top: 2px; }
.law-row .law-req.ok { color: #5ad76e; opacity: .85; }

/* combat2.js: the combat card appended to the unit selection panel */
.cbt-card { border-top: 1px solid rgba(255,235,190,0.10); margin-top: 6px; padding-top: 6px; }
.cbt-card [data-cst], .cbt-card [data-cor] { font-size: var(--fs-nano); padding: 3px 7px; }
.cbt-card [data-cst].on { border-color: var(--gold); color: var(--gold); }

/* ================= WAVE 4: the top bar is one line =================
   A raw HUD.SVG glyph pasted into a chip carries no width/height, so the browser lays it out as
   a 300x150 replaced element and the chip becomes 94x88 — the top bar grows a second row and
   every box below it slides down, which the pair-overlap audit cannot see. HUD.glyph(svg, em)
   sets an inline size and still wins over this rule; this is the belt-and-braces guard for the
   next call site that forgets. HUD._layoutAudit() asserts the same thing (HUD.CHIP_MAX_H). */
.chip svg, #topbar > .chip svg { width: 1em; height: 1em; vertical-align: -0.15em; }

/* ============================================================================
   WAVE 5 — THE CHIP BUDGET
   ----------------------------------------------------------------------------
   The top bar was 106 px tall at 1093x560: three wrapped rows, 19% of the glass,
   permanently over the world. HUD._tbFit() now measures the bar against a budget
   (one measured row, or TOPBAR_MAX_FRAC of the viewport height, whichever is
   larger) and hands out two classes. There is not a single breakpoint in the
   engine — these rules only describe what each degradation LOOKS like:

     .tb-min   icon-only: the chip keeps its glyph and its number and drops its
               words, bars, pips and sub-lines
     .tb-off   off the bar entirely; it is listed in the "..." overflow menu

   Verify with HUD._chipAudit() (bar height, budget, and every item's stage) and
   HUD._layoutAudit() (which prints the same summary line).
   ============================================================================ */

/* The budget decides how many rows the bar takes, so the controls no longer need a
   forced row of their own at narrow widths — they simply hug the right of whatever
   row they land on. (The 1100 px rule that used to force one is neutralised here
   rather than deleted upstream, so the intent stays readable.) */
.tb-controls { margin-left: auto; }
#ui.uiw-lt1100 .tb-controls { flex-basis: auto; }

/* ---- stage 1: icon only ---- */
#topbar .tb-min .sub2,
#topbar .tb-min .muted,
#topbar .tb-min .dc-nm, #topbar .tb-min .dc-more, #topbar .tb-min .dc-bar,
#topbar .tb-min .dq-sep,
#topbar .tb-min .erx-yrn, #topbar .tb-min .erx-pips, #topbar .tb-min .erx-yrb,
#topbar .tb-min .erx-more, #topbar .tb-min .erx-gmb, #topbar .tb-min .erx-eraN,
#topbar .tb-min .erx-flag { display: none !important; }
#topbar .tb-min { gap: 3px; padding-left: 8px; padding-right: 8px; }
/* the backstop for a chip whose markup this file does not know: #topbar .chip already
   carries overflow:hidden + text-overflow:ellipsis, so a cap is a clean truncation for a
   text chip and a hard clip for a flex one — and the flex ones have shrunk above anyway.
   Every chip keeps its full reading in the tooltip and in the overflow menu. */
#topbar .chip.tb-min { max-width: 128px; }
#topbar #cbtchip.tb-min span[style] { display: none; }
#topbar #kingname.tb-min { display: none; }
#topbar #seasonchip.tb-min { max-width: 108px; }
#topbar #raidchip.tb-min { max-width: 136px; }
#topbar #polchip.tb-min .pmeter + .pmeter { display: none; }

/* ---- stage 2: off the bar ---- */
#topbar .tb-off { display: none !important; }

/* ---- the "..." chip ---- */
.chip.tb-more {
  display: inline-flex; align-items: center; gap: 4px;
  color: #cfc3a2; cursor: pointer;
}
.chip.tb-more:hover { color: var(--gold); border-color: var(--gold-dim); }
.chip.tb-more.on {
  color: var(--gold); border-color: var(--gold-dim);
  background: linear-gradient(180deg, rgba(90,70,34,0.9), rgba(40,30,19,0.95));
  box-shadow: inset 0 1px 0 rgba(255,235,190,0.2);
}
.chip.tb-more b { font-family: var(--font-body); font-weight: 700; font-size: var(--fs-micro); opacity: 0.9; }

/* ---- the overflow menu: a popover, never a modal (reading the bar must not pause) ---- */
#tbmenu {
  position: absolute;
  top: calc(var(--hud-top) - 2px);
  /* HUD._placeTbMenu() writes the real value inline the moment it opens; this is the
     one-frame default so the popover can never appear at the container's content edge */
  right: 12px;
  z-index: 72;
  width: min(272px, calc(var(--ui-w) - 24px));
  max-height: max(140px, calc(var(--ui-h) - var(--hud-top) - var(--hud-bottom) - 28px));
  overflow-y: auto;
  padding: 7px;
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--border-lt); border-radius: var(--r-panel);
  background:
    linear-gradient(180deg, rgba(255,240,205,0.05), transparent 20%),
    linear-gradient(180deg, rgba(48,37,24,0.985), rgba(23,17,11,0.99));
  box-shadow: var(--inlay), var(--lift);
  animation: tbm-in 0.13s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes tbm-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.tbm-h {
  font-family: var(--font-head); font-size: var(--fs-micro); font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase; color: var(--gold-dim);
  padding: 2px 7px 6px; margin-bottom: 3px;
  border-bottom: 1px solid rgba(107,84,50,0.5);
}
.tbm-row {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6px 8px; border-radius: var(--r-card);
  border: 1px solid transparent; background: transparent;
  color: var(--parch); font-family: inherit; font-size: var(--fs-small);
  text-align: left; cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.tbm-row.static { cursor: default; }
.tbm-row:not(.static):hover { background: rgba(242,201,76,0.09); border-color: rgba(201,168,76,0.45); }
.tbm-v {
  display: inline-flex; align-items: center; gap: 4px;
  flex: 0 1 auto; min-width: 0; max-width: 132px; overflow: hidden;
  white-space: nowrap;
  font-family: var(--font-head); font-weight: 700; font-size: var(--fs-small); color: #f0e6cc;
}
.tbm-n {
  flex: 1 1 auto; min-width: 0; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #b6aa8c; font-size: var(--fs-micro); letter-spacing: 0.04em;
}
.tbm-go { flex: 0 0 auto; display: inline-flex; opacity: 0.4; }
.tbm-row:hover .tbm-go { opacity: 1; color: var(--gold); }
.tbm-empty { padding: 9px 8px; font-size: var(--fs-small); color: var(--muted); font-style: italic; }
#tbmenu::-webkit-scrollbar { width: 8px; }
#tbmenu::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #6b5a3a, #4a3d28); border-radius: var(--r-ctl); }

/* ============================================================================
   WAVE 5 — FOLDED MODULE SKINS
   ----------------------------------------------------------------------------
   districts.js (#dq-css), decree.js (#dc-css), eras.js (#erx-css) and
   expand5.js (#rm-css) each injected a <style> block from JS, because none of
   them owned this file. Every rule they shipped is folded in below, verbatim
   except for the chip-width media queries — the chip budget above owns that job
   now. HUD.init() claims those four <style> ids before HUD emits 'startGame',
   so each module's css() finds its id already present and early-returns: the
   injection is the no-op fallback it should always have been, and the modules
   still stand alone in a page without this stylesheet.

   The UNIFIED PANEL KIT further down is what makes these nine surfaces read as
   one product; it comes after, so it wins where the two disagree.
   ============================================================================ */

/* ---- districts.js: the realm panel (#realmchip, .dq-*) ---- */
.dq-ic { width: 15px; height: 15px; flex: 0 0 auto; vertical-align: -2px; }
#realmchip { display: flex; align-items: center; gap: 4px; }
.dq-sep { width: 1px; height: 11px; background: rgba(232,220,192,0.25); display: inline-block; }
.dq-modal { max-width: min(96vw, 1120px); text-align: left; }
.dq-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.dq-head > .dq-ic { width: 32px; height: 32px; color: var(--gold); }
.dq-head h2 { margin: 0 0 3px; }
.dq-sub { font-size: var(--fs-micro); opacity: 0.82; }
.dq-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 10px; border-bottom: 1px solid rgba(107,84,50,0.5); padding-bottom: 7px; }
.dq-tab { background: rgba(20,15,10,0.5); border: 1px solid rgba(107,84,50,0.55); color: var(--parch); border-radius: var(--r-ctl); padding: 5px 11px; font-size: var(--fs-micro); cursor: pointer; font-family: inherit; }
.dq-tab:hover { background: rgba(60,48,28,0.6); }
.dq-tab.on { background: rgba(90,70,34,0.75); border-color: var(--gold); color: #fff4d0; }
.dq-body { max-height: min(60vh, 540px); overflow-y: auto; overflow-x: hidden; padding-right: 4px; }
.dq-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); gap: 9px; }
.dq-card { background: rgba(20,15,10,0.5); border: 1px solid rgba(107,84,50,0.45); border-radius: var(--r-card); padding: 9px 11px; }
.dq-h3 { font-family: var(--font-head); font-size: var(--fs-small); letter-spacing: 0.05em; color: var(--gold); margin: 0 0 7px; display: flex; align-items: center; gap: 6px; }
.dq-h3 > .dq-ic { width: 16px; height: 16px; }
.dq-note { font-size: var(--fs-micro); opacity: 0.76; line-height: 1.5; margin-top: 6px; }
.dq-story { font-size: var(--fs-small); line-height: 1.6; }
.dq-meter { margin-bottom: 7px; }
.dq-ml { display: flex; justify-content: space-between; font-size: var(--fs-micro); }
.dq-mb { height: 6px; border-radius: var(--r-xs); background: rgba(0,0,0,0.42); overflow: hidden; margin: 3px 0; }
.dq-mb > span { display: block; height: 100%; border-radius: var(--r-xs); }
.dq-mh { font-size: var(--fs-nano); opacity: 0.65; line-height: 1.4; }
.dq-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dq-nums > div { background: rgba(0,0,0,0.26); border-radius: var(--r-ctl); padding: 5px 6px; text-align: center; }
.dq-nums b { display: block; font-family: var(--font-head); font-size: var(--fs-lead); color: var(--gold); line-height: 1.1; }
.dq-nums span { font-size: var(--fs-nano); opacity: 0.7; letter-spacing: 0.03em; }
.dq-kv > div, .dq-kvline { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-micro); padding: 2.5px 0; border-bottom: 1px solid rgba(107,84,50,0.22); }
.dq-kv > div:last-child { border-bottom: 0; }
.dq-kv b { color: #dfe8c8; }
.dq-estates { margin-top: 10px; }
.dq-facs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 7px; }
.dq-fac { background: rgba(20,15,10,0.5); border: 1px solid rgba(107,84,50,0.4); border-left: 3px solid var(--dq-c); border-radius: var(--r-ctl); padding: 6px 8px; }
.dq-fn { font-size: var(--fs-micro); color: var(--dq-c); }
.dq-fm { font-size: var(--fs-nano); opacity: 0.75; }
.dq-prow { display: grid; grid-template-columns: 82px 1fr 62px; grid-template-areas: "n b v" "d d d"; gap: 2px 7px; align-items: center; margin-bottom: 6px; }
.dq-pn { grid-area: n; font-size: var(--fs-micro); }
.dq-pv { grid-area: v; font-size: var(--fs-micro); text-align: right; }
.dq-prow .dq-mb { grid-area: b; margin: 0; }
.dq-pd { grid-area: d; font-size: var(--fs-nano); opacity: 0.6; }
.dq-dists { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 9px; margin-top: 8px; }
.dq-dist { background: rgba(20,15,10,0.5); border: 1px solid rgba(107,84,50,0.45); border-left: 3px solid var(--dq-c); border-radius: var(--r-card); padding: 8px 10px; }
.dq-dist.bad { background: rgba(38,22,12,0.55); }
.dq-dh { display: flex; align-items: center; gap: 6px; color: var(--dq-c); font-size: var(--fs-copy); font-family: var(--font-head); }
.dq-dh > .dq-ic { width: 17px; height: 17px; }
.dq-lv { font-size: var(--fs-micro); opacity: 0.85; letter-spacing: 0.08em; }
.dq-goto { margin-left: auto; font-size: var(--fs-nano); padding: 2px 7px; }
.dq-de { font-size: var(--fs-micro); color: #dfe8c8; margin: 4px 0 2px; line-height: 1.45; }
.dq-dk { font-size: var(--fs-nano); opacity: 0.66; line-height: 1.4; }
.dq-dn { font-size: var(--fs-nano); opacity: 0.8; line-height: 1.4; }
.dq-dx { font-size: var(--fs-nano); opacity: 0.6; font-style: italic; margin-top: 3px; line-height: 1.4; }
.dq-legend { display: flex; align-items: center; gap: 6px; font-size: var(--fs-micro); margin: 4px 0; color: var(--parch); }
.dq-legend > .dq-ic { color: var(--dq-c); width: 15px; height: 15px; }
.dq-goods { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 7px; }
.dq-good { background: rgba(0,0,0,0.26); border-radius: var(--r-ctl); padding: 6px 8px; border-left: 3px solid var(--dq-c); }
.dq-good.off { opacity: 0.42; }
.dq-gh { display: flex; justify-content: space-between; font-size: var(--fs-micro); color: var(--dq-c); }
.dq-lock { font-size: var(--fs-nano); opacity: 0.8; letter-spacing: 0.08em; }
.dq-gv { font-size: var(--fs-nano); opacity: 0.8; }
.dq-gn { font-size: var(--fs-nano); opacity: 0.78; line-height: 1.4; margin-top: 2px; }
.dq-ids { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 9px; }
.dq-idc { background: rgba(20,15,10,0.5); border: 1px solid rgba(107,84,50,0.45); border-left: 3px solid var(--dq-c); border-radius: var(--r-card); padding: 8px 10px; }
.dq-idt { font-size: var(--fs-nano); letter-spacing: 0.14em; opacity: 0.65; margin-bottom: 2px; }
.dq-idc > b { color: var(--dq-c); font-family: var(--font-head); font-size: var(--fs-copy); }
.dq-actions { margin-top: 10px; text-align: center; }
.dq-sel { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-micro); line-height: 1.45; }
.dq-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; margin-top: 4px; }
@media (max-width: 1200px) { .dq-nums { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 980px) { .dq-body { max-height: 56vh; } }

/* ---- decree.js: the Book of Decrees (#decreechip, .dc-*) ---- */
.dc-ic { width: 15px; height: 15px; flex: 0 0 auto; vertical-align: -2px; }
#decreechip { display: flex; align-items: center; gap: 5px; }
.dc-nm { font-size: var(--fs-micro); letter-spacing: 0.02em; }
.dc-bar { display: inline-block; width: 30px; height: 4px; border-radius: var(--r-xs); background: rgba(0,0,0,0.42); overflow: hidden; vertical-align: middle; }
.dc-bar > span { display: block; height: 100%; border-radius: var(--r-xs); }
.dc-bar.wide { display: block; width: 100%; height: 6px; margin: 4px 0; }
.dc-more { opacity: 0.6; font-size: var(--fs-nano); }
.dc-modal { max-width: min(96vw, 1140px); text-align: left; }
.dc-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.dc-head > .dc-ic { width: 32px; height: 32px; color: var(--gold); }
.dc-head h2 { margin: 0 0 3px; }
.dc-sub { font-size: var(--fs-micro); opacity: 0.82; }
.dc-body { max-height: min(62vh, 560px); overflow-y: auto; overflow-x: hidden; padding-right: 4px; }
.dc-h3 { font-family: var(--font-head); font-size: var(--fs-small); letter-spacing: 0.08em; color: var(--gold); margin: 12px 0 7px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid rgba(107,84,50,0.45); padding-bottom: 4px; }
.dc-h3 > .dc-ic { width: 15px; height: 15px; }
.dc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 9px; }
.dc-card { background: rgba(20,15,10,0.55); border: 1px solid rgba(107,84,50,0.5); border-left: 3px solid var(--dc-c); border-radius: var(--r-card); padding: 9px 11px; display: flex; flex-direction: column; }
.dc-card.on { background: rgba(60,48,28,0.6); box-shadow: 0 0 0 1px var(--dc-c); }
.dc-card.cd, .dc-card.off { opacity: 0.5; }
.dc-ch { display: flex; align-items: center; gap: 6px; color: var(--dc-c); font-family: var(--font-head); font-size: var(--fs-copy); }
.dc-ch > .dc-ic { width: 17px; height: 17px; }
.dc-dur { margin-left: auto; font-size: var(--fs-nano); opacity: 0.75; letter-spacing: 0.06em; border: 1px solid rgba(107,84,50,0.6); border-radius: var(--r-xs); padding: 1px 5px; }
.dc-kick { font-size: var(--fs-nano); letter-spacing: 0.15em; opacity: 0.55; margin: 2px 0 5px; }
.dc-t { font-size: var(--fs-micro); line-height: 1.5; opacity: 0.85; margin-bottom: 5px; }
.dc-e { font-size: var(--fs-micro); line-height: 1.5; color: #dfe8c8; border-top: 1px solid rgba(107,84,50,0.45); padding-top: 5px; }
.dc-ests { display: flex; flex-wrap: wrap; gap: 3px; margin: 6px 0 4px; }
.dc-est { font-size: var(--fs-nano); padding: 1px 5px; border-radius: var(--r-xs); background: rgba(0,0,0,0.3); }
.dc-est.up { color: #8fd07a; }
.dc-est.dn { color: #e08a7a; }
.dc-cost { font-size: var(--fs-nano); opacity: 0.72; margin-bottom: 6px; }
.dc-state { font-size: var(--fs-nano); opacity: 0.7; margin-top: auto; padding-top: 3px; font-style: italic; }
.dc-state.on { color: var(--dc-c); font-style: normal; opacity: 1; }
.dc-go { margin-top: auto; width: 100%; }
.dc-force { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 8px; }
.dc-fc { display: flex; gap: 9px; align-items: flex-start; background: rgba(60,48,28,0.5); border: 1px solid var(--dc-c); border-radius: var(--r-card); padding: 8px 10px; }
.dc-fc > .dc-ic { width: 20px; height: 20px; color: var(--dc-c); margin-top: 2px; }
.dc-fc b { color: var(--dc-c); font-family: var(--font-head); font-size: var(--fs-copy); }
.dc-fe { font-size: var(--fs-micro); line-height: 1.45; opacity: 0.88; }
.dc-note { font-size: var(--fs-nano); opacity: 0.72; line-height: 1.4; }
.dc-log { display: flex; flex-wrap: wrap; gap: 5px; font-size: var(--fs-nano); opacity: 0.75; }
.dc-log > span { background: rgba(0,0,0,0.28); border-radius: var(--r-ctl); padding: 2px 7px; }
.dc-log i { opacity: 0.6; font-style: normal; }

/* ---- eras.js: the Almanac, the era and the trades (.erx-*) ---- */
.erx-ic { width: 15px; height: 15px; flex: 0 0 auto; vertical-align: -2px; }
#yearchip, #erachip, #goodschip { display: flex; align-items: center; gap: 5px; }
.erx-yr { display: inline-flex; }
.erx-yrn { font-size: var(--fs-micro); letter-spacing: 0.02em; }
.erx-pips { display: inline-flex; gap: 2px; }
.erx-pip { width: 5px; height: 5px; border-radius: var(--r-xs); display: inline-block; }
.erx-pip.on { box-shadow: 0 0 4px currentColor; }
.erx-yrb { display: inline-block; width: 34px; height: 4px; border-radius: var(--r-xs); background: rgba(0,0,0,0.4); overflow: hidden; vertical-align: middle; }
.erx-yrb > span { display: block; height: 100%; border-radius: var(--r-xs); }
.erx-eraN { font-family: var(--font-head); color: var(--gold); font-size: var(--fs-small); letter-spacing: 0.06em; }
.erx-bang { display: inline-flex; align-items: center; gap: 3px; color: #ffd76e; animation: erxpulse 1.4s ease-in-out infinite; }
@keyframes erxpulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.erx-gm { display: inline-flex; }
.erx-gmb { display: inline-block; width: 16px; height: 4px; border-radius: var(--r-xs); background: rgba(0,0,0,0.4); overflow: hidden; }
.erx-gmb > span { display: block; height: 100%; }
.erx-gd { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-micro); }
.erx-gd b { font-size: var(--fs-micro); }
.erx-full { color: #ffb060; }
.erx-more { opacity: 0.6; font-size: var(--fs-nano); }
.erx-flag { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.erx-modal { max-width: min(94vw, 1020px); }
.erx-h { display: flex; gap: 12px; align-items: flex-start; text-align: left; margin-bottom: 10px; }
.erx-h > .erx-ic { width: 34px; height: 34px; color: var(--gold); }
.erx-h h2 { margin: 0 0 4px; }
.erx-sub { font-size: var(--fs-small); opacity: 0.85; line-height: 1.45; max-width: 70ch; }
.erx-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 8px 0; }
.erx-card { text-align: left; background: rgba(20,15,10,0.62); border: 1px solid var(--erx-c, #6b5432); border-radius: var(--r-card); padding: 11px; color: var(--parch); cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; }
.erx-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.5), 0 0 0 1px var(--erx-c, #6b5432); }
.erx-card-h { display: flex; align-items: center; gap: 7px; color: var(--erx-c, #f2c94c); }
.erx-card-h > .erx-ic { width: 20px; height: 20px; }
.erx-card-n { font-family: var(--font-head); font-size: var(--fs-body); }
.erx-kick { font-size: var(--fs-nano); letter-spacing: 0.16em; opacity: 0.6; margin: 2px 0 6px; }
.erx-card-t { font-size: var(--fs-micro); line-height: 1.5; opacity: 0.88; margin-bottom: 7px; }
.erx-card-e { font-size: var(--fs-micro); line-height: 1.5; color: #dfe8c8; border-top: 1px solid rgba(107,84,50,0.5); padding-top: 6px; }
.erx-foot, .erx-note { font-size: var(--fs-micro); opacity: 0.8; line-height: 1.5; margin-top: 8px; text-align: left; }
.erx-glist { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.erx-grow { display: flex; gap: 9px; align-items: flex-start; text-align: left; border-left: 2px solid var(--erx-c, #6b5432); padding-left: 9px; }
.erx-grow > .erx-ic { width: 20px; height: 20px; color: var(--erx-c); }
.erx-gb { font-size: var(--fs-micro); opacity: 0.75; }
.erx-ge { font-size: var(--fs-micro); color: #dfe8c8; }
.erx-alm { max-width: min(96vw, 1060px); text-align: left; }
.erx-alm-sub { font-size: var(--fs-small); opacity: 0.82; margin-bottom: 10px; }
.erx-h3 { font-family: var(--font-head); font-size: var(--fs-copy); letter-spacing: 0.06em; color: var(--gold); margin: 14px 0 7px; border-bottom: 1px solid rgba(107,84,50,0.5); padding-bottom: 4px; }
.erx-grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.erx-grid5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.erx-seas, .erx-bio { background: rgba(20,15,10,0.5); border: 1px solid rgba(107,84,50,0.5); border-left: 3px solid var(--erx-c); border-radius: var(--r-card); padding: 8px; }
.erx-seas.on, .erx-bio.on { background: rgba(60,48,28,0.55); box-shadow: 0 0 0 1px var(--erx-c); }
.erx-seas-h, .erx-bio-h { display: flex; align-items: center; gap: 6px; color: var(--erx-c); font-size: var(--fs-small); }
.erx-bio-h i { width: 11px; height: 11px; border-radius: var(--r-xs); display: inline-block; }
.erx-now { margin-left: auto; font-size: var(--fs-nano); letter-spacing: 0.12em; opacity: 0.85; }
.erx-seas-d { font-size: var(--fs-micro); opacity: 0.8; margin: 3px 0; line-height: 1.45; }
.erx-seas-n { font-size: var(--fs-micro); opacity: 0.9; line-height: 1.5; }
.erx-stores { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 7px; margin-bottom: 9px; }
.erx-store { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "i n" "b b" "s s" "d d"; gap: 2px 6px; align-items: center; background: rgba(20,15,10,0.5); border: 1px solid rgba(107,84,50,0.45); border-radius: var(--r-card); padding: 7px 9px; font-size: var(--fs-micro); color: var(--erx-c); }
.erx-store.off { opacity: 0.42; }
.erx-store > .erx-ic { grid-area: i; }
.erx-store > b { grid-area: n; }
.erx-store > .erx-yrb { grid-area: b; width: 100%; }
.erx-sn { grid-area: s; opacity: 0.85; color: var(--parch); }
.erx-sd { grid-area: d; opacity: 0.65; font-size: var(--fs-nano); color: var(--parch); line-height: 1.4; }
.erx-chains { display: flex; flex-direction: column; gap: 4px; }
.erx-chain { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(190px, 1.4fr) minmax(150px, 1.2fr); gap: 8px; align-items: center; font-size: var(--fs-micro); padding: 5px 7px; border-radius: var(--r-ctl); background: rgba(20,15,10,0.42); }
.erx-chain.off { opacity: 0.45; }
.erx-cb { display: flex; align-items: center; gap: 6px; }
.erx-cf { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-micro); }
.erx-cf svg { width: 13px; height: 13px; }
.erx-cn { opacity: 0.7; }
.erx-w { display: inline-flex; align-items: center; gap: 3px; }
.erx-track { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.erx-tk { display: flex; gap: 9px; align-items: flex-start; padding: 6px 8px; border-radius: var(--r-ctl); border-left: 3px solid var(--erx-c); background: rgba(20,15,10,0.42); }
.erx-tk.far { opacity: 0.42; }
.erx-tk.now { background: rgba(60,48,28,0.6); box-shadow: 0 0 0 1px var(--erx-c); }
.erx-tkn { font-family: var(--font-head); color: var(--erx-c); min-width: 26px; font-size: var(--fs-body); }
.erx-held, .erx-guilds, .erx-stages { display: flex; flex-direction: column; gap: 7px; }
.erx-guilds { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.erx-heldc, .erx-guild, .erx-demand, .erx-stage { background: rgba(20,15,10,0.5); border: 1px solid rgba(107,84,50,0.5); border-left: 3px solid var(--erx-c); border-radius: var(--r-card); padding: 8px 10px; }
.erx-heldc, .erx-stage { display: flex; gap: 9px; align-items: flex-start; }
.erx-heldc > .erx-ic { width: 22px; height: 22px; color: var(--erx-c); }
.erx-guild-h { display: flex; align-items: center; gap: 6px; color: var(--erx-c); font-size: var(--fs-small); margin-bottom: 4px; }
.erx-guild .erx-yrb, .erx-demand .erx-yrb, .erx-stage .erx-yrb { width: 100%; height: 6px; margin: 4px 0; }
.erx-tier { margin-left: auto; font-size: var(--fs-nano); opacity: 0.85; }
.erx-guild .sbtn, .erx-conf .sbtn { margin-top: 5px; }
.erx-cost { font-size: var(--fs-micro); opacity: 0.9; margin: 4px 0; }
.erx-stage.done { opacity: 0.75; }
.erx-stage.far { opacity: 0.5; }
.erx-conf { margin-top: 7px; font-size: var(--fs-micro); opacity: 0.9; }
.erx-sel { display: block; text-align: left; }
.erx-sel b { display: block; font-size: var(--fs-nano); letter-spacing: 0.1em; opacity: 0.75; margin-bottom: 3px; }
.erx-swatch { width: 10px; height: 10px; border-radius: var(--r-xs); display: inline-block; margin-right: 5px; }
@media (max-width: 1200px) { .erx-chain { grid-template-columns: 1fr; } }

/* ---- expand5.js: patrons and realm styles (.rm-*) ---- */
.rm-ic { width: 15px; height: 15px; flex: 0 0 auto; vertical-align: -2px; }
.rm-modal { max-width: min(96vw, 1100px); }
.rm-h { display: flex; gap: 12px; align-items: flex-start; text-align: left; margin-bottom: 8px; }
.rm-h > .rm-ic { width: 34px; height: 34px; color: var(--gold); }
.rm-h h2 { margin: 0 0 4px; }
.rm-sub { font-size: var(--fs-small); opacity: 0.85; line-height: 1.45; max-width: 74ch; }
.rm-lab { font-size: var(--fs-nano); letter-spacing: 0.16em; opacity: 0.6; text-align: left; margin: 12px 0 5px; }
.rm-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 9px; }
.rm-card { text-align: left; background: rgba(20,15,10,0.6); border: 1px solid rgba(107,84,50,0.55); border-radius: var(--r-card); padding: 10px; color: var(--parch); cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; }
.rm-card:hover { transform: translateY(-2px); }
.rm-card.on { background: rgba(60,48,28,0.7); box-shadow: 0 0 0 2px var(--rm-c); }
.rm-ch { display: flex; align-items: center; gap: 7px; color: var(--rm-c); }
.rm-ch > .rm-ic { width: 20px; height: 20px; }
.rm-cn { font-family: var(--font-head); font-size: var(--fs-body); }
.rm-kick { font-size: var(--fs-nano); letter-spacing: 0.15em; opacity: 0.55; margin: 2px 0 6px; }
.rm-ct { font-size: var(--fs-micro); line-height: 1.5; opacity: 0.86; margin-bottom: 6px; }
.rm-ce { font-size: var(--fs-micro); line-height: 1.5; color: #dfe8c8; border-top: 1px solid rgba(107,84,50,0.5); padding-top: 5px; }
.rm-cu { font-size: var(--fs-nano); line-height: 1.45; opacity: 0.72; margin-top: 5px; }
.rm-styles { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 7px; }
.rm-style { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "w n" "w k" "e e"; gap: 1px 7px; text-align: left; background: rgba(20,15,10,0.55); border: 1px solid rgba(107,84,50,0.5); border-radius: var(--r-card); padding: 7px 9px; color: var(--parch); cursor: pointer; }
.rm-style.on { background: rgba(60,48,28,0.7); box-shadow: 0 0 0 2px var(--rm-c); }
.rm-swatch { grid-area: w; width: 20px; height: 20px; border-radius: var(--r-ctl); border: 2px solid; align-self: center; }
.rm-sn { grid-area: n; font-size: var(--fs-small); color: var(--rm-c); font-family: var(--font-head); }
.rm-sk { grid-area: k; font-size: var(--fs-nano); letter-spacing: 0.1em; opacity: 0.55; }
.rm-se { grid-area: e; font-size: var(--fs-nano); opacity: 0.82; line-height: 1.4; margin-top: 4px; }
.rm-foot { font-size: var(--fs-micro); opacity: 0.7; margin-top: 8px; }
.rm-pal { display: flex; gap: 3px; margin-top: 5px; }
.rm-pal > i { width: 15px; height: 15px; border-radius: var(--r-xs); display: inline-block; border: 1px solid rgba(0,0,0,0.4); }
.rm-sel { font-size: var(--fs-micro); line-height: 1.45; display: flex; gap: 6px; align-items: flex-start; }
.rm-bar { height: 5px; border-radius: var(--r-xs); background: rgba(0,0,0,0.42); overflow: hidden; margin: 3px 0; min-width: 70px; }
.rm-bar > span { display: block; height: 100%; border-radius: var(--r-xs); }
.rm-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; margin-top: 4px; }
@media (max-width: 980px) { .rm-cards { grid-template-columns: 1fr; } }
/* THE PRIMARY ACTION IS NEVER BELOW THE FOLD. Measured in Chrome at 1093x560 - the layout
   audit's own reference size - the founding screen is 707 px tall inside a 526 px scroll box,
   so "Found the realm" sat 181 px under the edge and the FIRST screen of the game asked you to
   scroll before you could start it. It rides the bottom of the scroller instead, with its own
   ground so the cards pass behind it rather than through it. */
#rm-found { position: sticky; bottom: 0; z-index: 3; margin-top: 12px; }
#rm-found::before { content: ""; position: absolute; left: -14px; right: -14px; top: -14px; bottom: -14px;
  background: linear-gradient(180deg, rgba(14,11,8,0) 0%, rgba(14,11,8,0.93) 46%, rgba(14,11,8,0.97) 100%);
  z-index: -1; pointer-events: none; }


/* ============================================================================
   WAVE 5 — THE UNIFIED PANEL KIT
   ----------------------------------------------------------------------------
   Nine modules shipped nine surfaces: the Kingdom panel, districts, decrees,
   The Great Game, The Art of War, the Almanac, the Score, the council door and
   the goods bar. Each was right on its own and each invented its own heading,
   its own card, its own scroll body and its own small button. This section is
   the shared vocabulary they all resolve to, so the game reads as ONE product:

     one HEADING      .ppl-h .dq-h3 .dc-h3 .erx-h3 .rm-lab
     one CARD         every .*-card / .*-dist / .*-store / .*-tk / .*-stage
     one SCROLL BODY  the same height ladder and the same gilded rail
     one SMALL BUTTON .sbtn — which had NO rule in this file at all and was
                      rendering as raw browser chrome in fifteen places
     one ROW          .sel-row — the same: six modules use it, nothing styled it
     one EMPTY STATE  a quiet italic line on a hairline, never a bare sentence

   This comes AFTER the folded module skins on purpose: where the two disagree,
   the shared vocabulary wins. Where a card carries a coloured accent edge or a
   selection ring, that edge and that ring are restored explicitly below — they
   are the card's meaning, not its decoration.
   ============================================================================ */

/* ---------------------------------------------------------------- PRIMITIVES */
/* .sbtn: the small action button inside a panel row. Fifteen call sites across
   kingdoms.js, eras.js, districts.js, score.js and audioui.js asked for it and
   got the browser's default grey chrome, in a screen made of gold leaf. */
.sbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  background: linear-gradient(180deg, #3f3120, #281e13);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  color: var(--parch);
  font-family: var(--font-body); font-size: var(--fs-micro); font-weight: 600;
  letter-spacing: 0.2px;
  padding: 4px 10px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(242,201,76,0.12);
  transition: transform 0.1s cubic-bezier(0.2,0.8,0.3,1), border-color 0.14s, color 0.14s, background 0.14s, box-shadow 0.14s;
}
.sbtn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--gold-dim); color: #ffe9b8;
  background: linear-gradient(180deg, #503e26, #322517);
  box-shadow: inset 0 1px 0 rgba(242,201,76,0.24), var(--sh-2);
}
.sbtn:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--sh-sunken); }
.sbtn:disabled { opacity: 0.4; cursor: default; filter: grayscale(0.35); }
.sbtn.gold { background: linear-gradient(180deg, #7a5f26, #4a3a17); border-color: var(--gold-dim); color: var(--gold-hi); }
.sbtn svg { width: 1em; height: 1em; }
/* the district panel's "Show me" keeps its compact form — it sits in a card header */
.dq-goto { margin-left: auto; font-size: var(--fs-nano); padding: 2px 8px; }

/* .sel-row: the one-line statement inside a panel or a selection body. BLOCK, not
   flex — half its call sites mix bare text with <b> and a button, and a flex row
   turns every text run into its own item with a gap in front of the comma. */
.sel-row {
  display: block;
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--parch-dim);
  margin: 5px 0;
}
.sel-row b { color: #e4d8b6; }
.sel-row.muted { color: var(--muted); }
.sel-row > .sbtn, .sel-row > button { vertical-align: middle; margin: 2px 0 2px 6px; }
.sel-row > .sbtn:first-child, .sel-row > button:first-child { margin-left: 0; }
/* the three rows that are really a dot + a sentence keep the flex their module asked for
   (this file's .sel-row rule is later than the folded skins, so it must hand it back) */
.dq-sel, .rm-sel { display: flex; }

/* ------------------------------------------------------------------ HEADINGS */
/* One engraved rule, one colour, one rhythm. .ppl-h keeps its flourish lines;
   the module headings take the same type over a gilded underscore. */
/* (.int-sect is deliberately absent: the interior panels wear their room's own accent over
   prepared art, and this file already promises not to flatten them with a shared skin.) */
.dq-h3, .dc-h3, .erx-h3, .rm-lab, .mkt-col h3 {
  font-family: var(--font-head);
  font-size: var(--fs-small); font-weight: 700;
  letter-spacing: 2.2px; text-transform: uppercase;
  color: var(--gold-dim);
  opacity: 1;
  margin: 15px 0 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(201,168,76,0.22);
}
.dq-body > .dq-h3:first-child, .dc-body > .dc-h3:first-child,
.erx-alm > .erx-h3:first-child, .rm-modal > .rm-lab:first-child { margin-top: 4px; }
.dq-card > .dq-h3 { margin: 0 0 8px; }
/* the sub-line under a panel title: one voice, never a second heading */
.dq-sub, .dc-sub, .erx-sub, .erx-alm-sub, .rm-sub {
  font-size: var(--fs-small); line-height: 1.55; color: #b0a488; opacity: 1;
}
.dq-head h2, .dc-head h2, .erx-h h2, .rm-h h2 { font-size: var(--fs-h2); letter-spacing: 2.4px; }

/* --------------------------------------------------------------------- CARDS */
/* The same plate everywhere: a warm top light, a hairline, a 9px radius. The
   `border-left` is deliberately left alone — a dozen of these carry a coloured
   accent edge that IS the card's meaning. */
.dq-card, .dq-dist, .dq-idc, .dq-fac,
.dc-card, .dc-fc,
.erx-card, .erx-seas, .erx-bio, .erx-store, .erx-tk, .erx-heldc, .erx-guild, .erx-demand, .erx-stage,
.rm-card, .rm-style, .crn-row, .gd-card {
  background:
    linear-gradient(180deg, rgba(255,240,205,0.038), transparent 30%),
    rgba(20,15,10,0.55);
  border-top: 1px solid rgba(107,84,50,0.5);
  border-right: 1px solid rgba(107,84,50,0.5);
  border-bottom: 1px solid rgba(107,84,50,0.5);
  border-radius: var(--r-card);
  box-shadow: inset 0 1px 0 rgba(255,235,190,0.06);
}
/* two of these carried their accent as a 1px outline all the way round rather than a left
   edge; with the shared plate above they would have lost it almost entirely, so it becomes
   the same 3px left edge every other card in the game uses */
.erx-card, .dc-fc { border-left-width: 3px; }
/* the interactive ones lift; the read-outs do not pretend to */
.erx-card, .rm-card, .rm-style {
  transition: transform 0.12s cubic-bezier(0.2,0.9,0.3,1), box-shadow 0.16s, border-color 0.14s;
}
.erx-card:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--erx-c, #6b5432), var(--sh-2); }
.rm-card:hover, .rm-style:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,235,190,0.14), var(--sh-2); }
/* the chosen one is unmistakable, in whatever accent colour the card carries.
   These restore the rings the shared plate above would otherwise have flattened. */
.dc-card.on, .erx-seas.on, .erx-bio.on, .erx-tk.now, .rm-card.on, .rm-style.on {
  background: linear-gradient(180deg, rgba(255,240,205,0.07), transparent 34%), rgba(62,49,28,0.72);
}
.dc-card.on { box-shadow: 0 0 0 1px var(--dc-c), inset 0 1px 0 rgba(255,235,190,0.1); }
.erx-seas.on, .erx-bio.on, .erx-tk.now { box-shadow: 0 0 0 1px var(--erx-c), inset 0 1px 0 rgba(255,235,190,0.1); }
.rm-card.on, .rm-style.on { border-color: var(--gold-dim); box-shadow: var(--sel-ring), inset 0 1px 0 rgba(255,235,190,0.1); }
/* a district in trouble still reads as trouble */
.dq-dist.bad { background: linear-gradient(180deg, rgba(255,190,160,0.05), transparent 30%), rgba(48,25,14,0.62); }
/* a relic already in hand still glows */
.crn-row.got { border-color: rgba(242,201,76,0.5); background: linear-gradient(180deg, rgba(255,240,205,0.06), transparent 30%), rgba(242,201,76,0.07); }

/* --------------------------------------------------------------- SCROLL BODY */
/* One height ladder for every long panel. These live inside #modal-layer, which
   carries the INVERSE ui zoom, so `vh` is the honest unit here — --ui-h is the
   pre-zoom viewport and would be wrong by exactly the scale factor. */
.dq-body, .dc-body, .gd-page, .set-scroll, .chron-log {
  max-height: min(56vh, 520px);
  overflow-y: auto; overflow-x: hidden;
  padding-right: 7px;
}
/* every scrolling surface in the HUD wears the same gilded rail */
#ui ::-webkit-scrollbar, #tbmenu::-webkit-scrollbar { width: 8px; height: 8px; }
#ui ::-webkit-scrollbar-track { background: rgba(0,0,0,0.26); border-radius: var(--r-ctl); }
#ui ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6b5a3a, #4a3d28);
  border-radius: var(--r-ctl); border: 1px solid rgba(0,0,0,0.4);
}
#ui ::-webkit-scrollbar-thumb:hover { background: #8a6f42; }
#ui * { scrollbar-width: thin; scrollbar-color: #5d4c31 rgba(0,0,0,0.26); }

/* ---------------------------------------------------------------------- TABS */
/* Four tab strips existed (.gd-tab, .dq-tab, .sp-tab, .btab). The build tabs stay
   different — they are shoulders on a tray. The PANEL strips become one pill. */
.dq-tab, .gd-tab {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  color: #cabf9e;
  font-family: var(--font-head); font-size: var(--fs-micro); font-weight: 700;
  letter-spacing: 0.6px;
  padding: 5px 13px;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.14s, color 0.14s, background 0.14s;
}
.dq-tab:hover, .gd-tab:hover { border-color: var(--gold-dim); color: #eee3c4; transform: translateY(-1px); }
.dq-tab.on, .gd-tab.active { background: rgba(242,201,76,0.1); border-color: var(--gold); color: var(--gold); }
.dq-tabs { justify-content: flex-start; margin: 10px 0 12px; }

/* -------------------------------------------------------------- EMPTY STATES */
/* "Nothing yet" is a sentence this game says a lot. It says it the same way now:
   quiet italic on a hairline, never a bare paragraph floating in a panel. */
.dq-note, .dc-note, .erx-note, .rm-foot, .erx-foot, .dq-dx, .tbm-empty {
  font-size: var(--fs-small);
  line-height: 1.55;
  color: var(--muted);
}
.dq-note:only-child, .dc-note:only-child, .erx-note:only-child {
  padding: 9px 12px;
  border-left: 2px solid rgba(201,168,76,0.3);
  background: rgba(255,255,255,0.02);
  border-radius: 0 var(--r-card) var(--r-card) 0;
  font-style: italic;
}

/* ---------------------------------------------------------- MODAL FURNITURE */
/* .big-modal carried a hard 620px floor; below about 700px of glass it pushed
   itself off both edges. It is a floor OR the window, whichever is smaller. */
.big-modal { min-width: min(620px, calc(100vw - 40px)); }
.menu-modal { min-width: min(380px, calc(100vw - 40px)); }
.settings-modal { min-width: min(460px, calc(100vw - 40px)); max-width: min(520px, calc(100vw - 40px)); }
/* the closing button of every panel sits on its own rule, so the eye knows the end */
.big-modal > .title-btn.small:last-child, .menu-modal > .title-btn.small:last-child {
  align-self: center; margin-top: 12px; min-width: 132px;
}
/* short glass: the plate gives back its generous padding before it gives back content */
#ui.uih-lt620 .menu-modal, #ui.uih-lt620 .big-modal { padding: 15px 20px; gap: 7px; }
#ui.uih-lt620 .menu-modal h2, #ui.uih-lt620 .big-modal h2 { font-size: var(--fs-h3); letter-spacing: 2px; }
#ui.uih-lt620 .dq-body, #ui.uih-lt620 .dc-body, #ui.uih-lt620 .gd-page,
#ui.uih-lt620 .set-scroll, #ui.uih-lt620 .chron-log { max-height: 48vh; }
#ui.uih-lt620 .dq-h3, #ui.uih-lt620 .dc-h3, #ui.uih-lt620 .erx-h3, #ui.uih-lt620 .rm-lab { margin: 11px 0 6px; }
#ui.uih-lt620 .gd-cards { grid-template-columns: 1fr; }

/* ------------------------------------------------------- THE COUNCIL DOOR -- */
/* It borrows campaign.js's relic rows, and the borrowed .hud-btn was a full-size
   call to action repeated down a list. One matter, one quiet button. */
.crn-modal .crn-row { gap: 12px; padding: 8px 11px; }
.crn-modal .crn-row .hud-btn { font-size: var(--fs-small); padding: 6px 12px; white-space: nowrap; flex: 0 0 auto; }
.crn-modal .crn-name b { color: #f0e3c0; }

/* --------------------------------------------------------- THE ART OF WAR -- */
/* the combat card at the foot of the unit panel: a section OF the panel, not a
   widget pasted onto it */
.cbt-card { border-top: 1px solid rgba(242,201,76,0.18); margin-top: 9px; padding-top: 8px; }
.cbt-card .sp-form { margin: 6px 0 2px; }
.cbt-card .sp-form-l { width: 100%; letter-spacing: 1.4px; text-transform: uppercase; font-size: var(--fs-micro); color: var(--muted); }
.cbt-card [data-cst], .cbt-card [data-cor] { font-size: var(--fs-micro); padding: 3px 9px; border-radius: var(--r-card); }
.cbt-card [data-cst].on, .cbt-card [data-cor].on { border-color: var(--gold); color: var(--gold); background: rgba(242,201,76,0.1); }

/* -------------------------------------------------------- THE GREAT GAME --- */
/* a real table: gilded header, zebra body, and it scrolls sideways on its own
   instead of stretching the modal past the glass */
.kg-panel table { width: 100%; border-collapse: collapse; font-size: var(--fs-micro); margin: 4px 0 10px; }
.kg-panel table th { padding: 4px 6px; font-weight: 700; font-family: var(--font-head); letter-spacing: 0.6px; border-bottom: 1px solid rgba(201,168,76,0.28); }
.kg-panel table td { padding: 4px 6px; text-align: center; border-bottom: 1px solid rgba(107,84,50,0.2); }
.kg-panel table tr:nth-child(even) td { background: rgba(255,255,255,0.022); }
.kg-modal .kg-choice { border-radius: var(--r-card); }
.kg-modal .kg-choice .kg-hint { color: #a99d82; }

/* ------------------------------------------------------------- THE SCORE --- */
/* score.js and audioui.js render their rehearsal controls as .sel-row strips of .sbtn with
   an inline flex-wrap that had nothing to wrap — .sel-row was never a flex row. These four
   rows are button strips, so they say so. */
#sc-states, #sc-leit, #sc-kit, #ju-states {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  margin: 6px 0 10px;
}
#sc-states > .sbtn, #sc-leit > .sbtn, #sc-kit > .sbtn, #ju-states > .sbtn { margin: 0; }

/* ------------------------------------------------------------ THE TOP BAR -- */
/* every chip on the bar breathes the same amount and presses like a button,
   whichever module built it. NOTE: no `display:flex` here — #seasonchip and
   #raidchip are plain text chips that rely on text-overflow:ellipsis, and a flex
   container cannot ellipsis its anonymous text runs. */
#realmchip, #decreechip, #yearchip, #erachip, #goodschip { gap: 5px; }
#topbar .chip b { font-family: var(--font-head); font-weight: 700; }
#topbar .chip-btn { cursor: pointer; transition: transform 0.1s, border-color 0.14s, color 0.14s, box-shadow 0.14s; }
#topbar .chip-btn:hover { transform: translateY(-1px); border-color: var(--gold-dim); box-shadow: var(--sh-2); }
#topbar .chip-btn:active { transform: translateY(1px); box-shadow: var(--sh-sunken); }

/* a harvester ranging past its stated radius for the last of a seam */
.warn-t { color: #e6b95a; }

/* The pause menu used to draw its icons as emoji, which the #ui scrubber deletes at
   runtime: every button read as a leading space and the title read "GRIMWARD". Inline
   SVG survives the scrubber, so it needs a size — nothing sets one for .title-btn. */
.pause-menu .title-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.pause-menu .title-btn svg { width: 15px; height: 15px; flex: 0 0 auto; opacity: 0.85; }
.pause-menu h2 { display: flex; align-items: center; justify-content: center; gap: 10px; }
.pause-menu h2 svg { width: 22px; height: 22px; }
.pause-menu .menu-info svg { width: 12px; height: 12px; vertical-align: -1px; opacity: 0.8; }
.pause-menu .art-row { font-size: var(--fs-micro); flex-wrap: wrap; }
.pause-menu .art { border: 1px solid var(--border); border-radius: var(--r-card); padding: 2px 7px; color: var(--gold-dim); }
.match-back svg { width: 20px; height: 20px; opacity: 0.75; }
.sp-icon svg { width: 15px; height: 15px; vertical-align: -2px; }

/* ============================================================================
   WAVE 6 — THE LAST COAT
   ----------------------------------------------------------------------------
   The previous five waves built the layout, the panel kit and the skin. This is
   the coat that goes on last: the details that decide whether a UI reads as
   crafted or as assembled. Four things are being fixed here.

   1. THE ICONS THAT WERE NEVER THERE. A sweep of the source turned up 240 lines
      across hud.js, interiors.js, premium.js, campaign.js and the wave-4/5
      modules where an author wrote an icon into a label — a shield on Ranks, a
      scroll on Research, a lamp on every tip card in the Warden's Guide — and
      the #ui emoji scrubber has silently eaten every one of them since the day
      it was written. hud.js now maps them onto this file's own line-drawn glyph
      family and draws them as `span.gi`; the rule below is what makes one an
      icon rather than a 300x150 replaced element.
   2. FOUR SURFACES WITH NO RULES AT ALL. .era-req (the "can I advance an era?"
      checklist — arguably the most consulted screen in the game), .adv-info
      (the council's advisor rows), .sp-ext and .chron-log-t. They were rendering
      as raw browser chrome inside a screen made of gold leaf.
   3. NUMBERS THAT JUMP. Every live figure in the HUD — the resource bar, the
      meters, the stat sheet, the tables — is proportional-figure text, so the
      whole row reshuffles a pixel or two every time a digit changes. Tabular
      figures nail them down.
   4. KEYBOARD AND PRESS FEEDBACK. A real focus ring (there was none anywhere),
      one disabled state, and containment so a bottomed-out panel stops
      scrolling instead of handing the wheel to the world.
   ============================================================================ */

/* --------------------------------------------------------------- THE GLYPH -- */
/* The wrapper the scrubber emits. 17 of the pictorial glyphs carry no intrinsic
   size (they are written for HUD.glyph, which injects one), so the sizing lives
   here and every glyph in the game — injected or interpolated — obeys it. */
.gi { display: inline; }
.gi svg {
  width: 1em; height: 1em;
  vertical-align: -0.15em;
  opacity: 0.92;
  flex: 0 0 auto;
}
/* inside a button the icon sits with the text, not on top of it */
.hud-btn > .gi, .title-btn > .gi, .crisis-btn > .gi, .sbtn > .gi, .btab > .gi { margin-right: 2px; }
/* a heading's icon is quieter than its type, and always the gold of the rule under it */
h2 > .gi svg, h3 > .gi svg, h4 > .gi svg { opacity: 0.85; color: var(--gold-dim); }
/* the top bar is one line: nothing the scrubber injects may change its height */
#topbar .gi svg { width: 0.95em; height: 0.95em; }

/* ------------------------------------------------------ THE ERA CHECKLIST -- */
/* "The realm is not ready" is the game telling you no. It has to say WHY, in a
   list you can read at a glance: one row per condition, a mark, and the two
   states unmistakably different. It had no rules at all. */
.era-reqs {
  display: flex; flex-direction: column; gap: 4px;
  margin: 10px 0 12px;
  text-align: left;
}
.era-req {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 11px;
  border-radius: var(--r-card);
  border: 1px solid rgba(107,84,50,0.42);
  border-left: 3px solid rgba(150,120,70,0.5);
  background: linear-gradient(180deg, rgba(255,240,205,0.03), transparent 40%), rgba(20,15,10,0.5);
  font-size: var(--fs-small);
  line-height: 1.45;
  color: #b6aa8c;
  font-variant-numeric: tabular-nums;
}
.era-req.ok {
  border-left-color: var(--green);
  color: #d7e6c6;
  background: linear-gradient(180deg, rgba(140,220,150,0.06), transparent 40%), rgba(20,26,16,0.5);
}
.era-req-t { min-width: 0; }
/* the mark carries its own inline 1em sizing (HUD.SVG.check / .cross are written for
   interpolation anywhere), so the SIZE is set by giving the slot a font-size, not by a
   rule an inline style would beat */
.era-req-i { display: inline-flex; flex: 0 0 auto; width: 15px; font-size: var(--fs-lead); line-height: 1; color: var(--muted); }
.era-req.ok .era-req-i { color: var(--green); }
.era-req .muted { color: var(--muted); }
.era-modal .era-reqs + .era-techs { margin-top: -4px; }
/* the top-bar button that opens it says whether the answer will be yes */
#ageup-btn.era-ready { box-shadow: inset 0 1px 0 rgba(255,246,204,0.4), 0 0 16px rgba(242,201,76,0.55); }
#ageup-btn:not(.era-ready) { animation: none; opacity: 0.9; }

/* ------------------------------------------------- NOTES AND EMPTY STATES -- */
/* Ten explanatory lines in hud.js carried an inline font-size — 11px, 12px, 13px,
   none of them on the type ladder — because there was no class that meant "a quiet
   line under a heading". There is now, and it is the same one everywhere. */
.note-sm {
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--muted);
}
.note-sm.good-t { color: #8fbf5a; }
.note-sm b { color: #cabf9e; }
.note-gap { margin-bottom: 7px; }
/* "there is nothing here yet" is a sentence this game says in a dozen places. It says
   it one way: quiet italic behind a gilded rule, never a bare grey paragraph. */
.empty-note {
  font-size: var(--fs-small);
  line-height: 1.55;
  font-style: italic;
  color: var(--muted);
  padding: 9px 12px;
  margin: 4px 0;
  border-left: 2px solid rgba(201,168,76,0.3);
  background: rgba(255,255,255,0.02);
  border-radius: 0 var(--r-card) var(--r-card) 0;
  text-align: left;
}
/* the era panel reuses the ceremony's numeral, at the size of a heading rather than
   a curtain call */
.era-num-sm { font-size: 44px; animation: none; }

/* -------------------------------------------------------- THE COUNCIL ROW -- */
/* Name, office and their last word, in three weights on one baseline grid —
   .adv-row laid out a grid and then handed the middle cell unstyled text. */
.adv-info { line-height: 1.5; min-width: 0; }
.adv-info b { font-family: var(--font-head); color: #f0e3c0; letter-spacing: 0.3px; }
.adv-info i { color: #b6aa8c; font-style: normal; font-size: var(--fs-small); }
.adv-info .muted { display: block; margin-top: 2px; font-size: var(--fs-small); font-style: italic; color: var(--muted); }
.adv-row + .adv-row { margin-top: 5px; }
.adv-row .fac-bar.sm { width: 54px; }
.promise-row { padding: 5px 0; border-bottom: 1px solid rgba(107,84,50,0.22); }
.promise-row:last-child { border-bottom: none; }
.promise-row b { color: var(--gold-dim); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------- SELECTION PANEL EXTRAS -- */
/* Other modules append their own block to a building's panel through
   HUD.registerSelBody. Each arrived flush against the last line of the panel. */
.sp-ext { margin-top: 9px; padding-top: 8px; border-top: 1px solid rgba(242,201,76,0.16); }
.sp-ext:empty { display: none; margin: 0; padding: 0; border: none; }
.spu-name { font-weight: 600; color: #e4d8b6; }
.spu-icon { display: inline-flex; align-items: center; }

/* ----------------------------------------------------------- THE LEDGER --- */
.chron-log-t { color: var(--parch-dim); line-height: 1.45; }
.chron-log-t .t-count { color: var(--gold-dim); font-weight: 700; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------- BORROWED ROWS -- */
/* Three more classes that other modules emit and nothing styled. */
.int-reply.int-choice { border-left: 3px solid var(--int-accent, var(--gold-dim)); font-style: normal; }
.ach-pop-txt { min-width: 0; text-align: left; }
/* .mp-vote is a MODIFIER on a .crisis-btn, not a container: it is one choice in a co-op
   council vote. When the vote is cast mp.js disables every button and paints the chosen
   one's border in the player's own colour — so this one gets a gentler disabled state than
   the shared rule below, or the mark that says "you voted for this" goes grey with it. */
#ui .mp-vote:disabled { opacity: 0.5; filter: grayscale(0.2); }
.lb-chatbox { overscroll-behavior: contain; }

/* ----------------------------------------------------------- THE FIGURES -- */
/* Proportional digits in a live read-out make the whole row breathe: the resource
   bar reflows every tick, the meters twitch, the Great Game's table walks. Every
   number the player watches change is nailed to a monospaced figure width. */
#resbar, #popchip, #raidchip, .res-val, .meter-row b, .fac-val, .stat-row,
.tech-cost, .bcard-cost, .spu-cost, .relic-bal, .dip-state, .sel-row b,
.kg-panel table td, .kg-panel table th, .go-stats, .title-stats, .ascend-gain,
.lt-row b, .lt-net b, .law-slots, .chron-log-day, #dq-sub, .agd-name {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ------------------------------------------------------------- THE FOCUS -- */
/* Nothing in the HUD had a focus style, so a keyboard was invisible in a game
   that is otherwise fully navigable. One ring, in the family's own gold, and
   only for actual keyboard focus. */
#ui button:focus-visible, #ui input:focus-visible, #ui select:focus-visible,
#ui [tabindex]:focus-visible {
  outline: var(--focus-ring);
  outline-offset:var(--focus-off);
  border-radius: var(--r-ctl);
}
#ui button:focus:not(:focus-visible) { outline: none; }
.kname-field:focus, .set-select:focus { border-color: var(--gold-dim); }

/* ---------------------------------------------------------- THE DISABLED -- */
/* .disabled (a class the HUD writes) and :disabled (what a button element gets)
   were two different looks. They are one look now, and neither of them lifts. */
#ui button:disabled, .hud-btn.disabled, .title-btn.disabled, .sbtn:disabled, .bcard.locked {
  cursor: default;
  opacity: 0.45;
  filter: grayscale(0.4);
}
#ui button:disabled:hover, .hud-btn.disabled:hover, .title-btn.disabled:hover,
.sbtn:disabled:hover, .bcard.locked:hover {
  transform: none;
  box-shadow: inset 0 1px 0 rgba(255,235,190,0.1);
  border-color: var(--border);
}

/* --------------------------------------------------------- THE SCROLLING -- */
/* A panel that has hit its end must stop, not hand the wheel to the world behind
   it — zooming the map out from under a list you are reading is the single most
   startling thing this HUD did. */
#selpanel, #buildcards, .gd-page, .set-scroll, .chron-log, .dq-body, .dc-body,
.help-body, .ach-grid, #agenda, #tbmenu, .erx-alm, #modal-box {
  overscroll-behavior: contain;
}
/* (A scroll-shadow was tried here and taken out again. The classic four-layer
   technique needs two OPAQUE cover layers in the panel's own colour, and every
   panel in this game is a stack of translucent gradients over the world — the
   covers read as two grey bands. The gilded rail already says "there is more".) */

/* --------------------------------------------------------- THE TITLE CALL -- */
/* One thing on that screen is the thing you came to press. It breathes, slowly,
   and it is where the keyboard lands. */
.title-screen .title-btn.primary { animation: reign-breathe 3.6s ease-in-out infinite; }
@keyframes reign-breathe {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), inset 0 -16px 28px rgba(37,18,10,0.36), 0 0 24px rgba(242,201,76,0.16), var(--sh-3); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.24), inset 0 -16px 28px rgba(37,18,10,0.3), 0 0 40px rgba(242,201,76,0.4), var(--sh-3); }
}
.title-screen .title-btn.primary:hover { animation: none; }
body.reduce-motion .title-screen .title-btn.primary { animation: none; }
/* the hint under the menu that says a key will do it */
.title-key {
  margin-top: 2px;
  font-size: var(--fs-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(232,210,150,0.55);
}
.title-key b {
  font-family: var(--font-head);
  color: rgba(255,233,168,0.9);
  border: 1px solid rgba(255,233,168,0.3);
  border-radius: var(--r-ctl);
  padding: 1px 6px;
  margin: 0 3px;
}

/* --------------------------------------------------------- LAST ALIGNMENT -- */
/* Small, real, and the kind of thing that reads as homemade when it is wrong. */
/* a heading's icon needs its own air; it must NOT turn the heading into a flex row
   (the balance figures in these titles are floated, and a flex context would take
   them out of the first line and left-align every modal title in the game) */
h2 > .gi, h3 > .gi, h4 > .gi { margin-right: 5px; }
/* the balance that rides at the end of a modal title, sized off the title itself */
.big-modal h2 .relic-bal, .menu-modal h2 .relic-bal { font-size: 0.62em; }
.big-modal h2 .res-cur { font-size: 0.58em; }
/* a section rule directly under another one is a double line */
.ppl-h + .ppl-h { margin-top: 4px; }
/* the two-column stat sheet keeps its rows on a grid at every width */
.stat-sheet { gap: 2px 20px; }
.stat-row { gap: 12px; align-items: baseline; }
/* A tip is one paragraph with a lamp in front of it: a HANGING INDENT, so the second
   line clears the icon instead of sliding under it. Deliberately NOT display:flex —
   these lines carry inline <span class="gd-k"> keycaps mid-sentence, and a flex
   context would make every one of them its own item with a gap in front of it. */
.gd-tip { padding-left: 25px; text-indent: -25px; }
.gd-tip > .gi { margin-right: 7px; }
.gd-tab { display: inline-flex; align-items: center; gap: 5px; }

/* ============================================================================
   PASS v83 — THE FIRST TEN MINUTES, AND THE THINGS YOU TOUCH A HUNDRED TIMES
   ----------------------------------------------------------------------------
   Nothing here is a new look. Every rule below is one of five things:
     1. A SPRITE THAT IS NOW A BACKGROUND. hud.js used to paste a 2.1 KB base64
        data URI into the markup once per row (566 KB in the People roll, 643 KB
        in the build dock, rebuilt on every click of a build card). The URI now
        lives in a private stylesheet and the markup is a class.
     2. TWO DIVS THAT BECAME BUTTONS. A build card and a locked-era header are
        things you press; they were <div>s, so a keyboard could not reach either
        of them and the game was not playable end to end without a mouse.
     3. HIT TARGETS. Twenty-seven of the HUD's eighty-seven live controls were
        under 32 px in some direction — the selection panel's close was 12x20.
        Nothing here moves a pixel of the picture; an invisible ::after grows
        the POINTER target instead.
     4. PRESS, AND REFUSAL. There was a hover on everything and a focus ring on
        everything, but almost nothing said "I felt that" when it was pressed.
     5. NUMBERS THAT EXPLAIN THEMSELVES — the card behind a live figure.
   ============================================================================ */

/* ---------------------------------------------- 1. SPRITES AS BACKGROUNDS -- */
.tibg {
  display: inline-block; vertical-align: middle;
  background-repeat: no-repeat; background-position: center bottom; background-size: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
  flex: 0 0 auto;
}
.pr-prof .tibg, .pr-prof img.tic { display: block; }
.bcard-icon .tibg { margin: 0 auto; }

/* --------------------------------------------- 2. THE BUILD DOCK, REBUILT -- */
/* .bcard and .bera are <button>s now: reachable by Tab, pressable by Enter, and
   readable by anything that cares what a control is. They must not inherit a
   browser button's chrome, and the lines inside a card must still stack. */
.bcard {
  display: block; font: inherit; color: var(--parch);
  -webkit-appearance: none; appearance: none;
}
.bcard-icon, .bcard-name, .bcard-cost, .bcard-lock { display: block; }
.bcard-icon { line-height: 1; height: 30px; }
.bcard:active { transform: translateY(-1px); filter: brightness(1.08); }
/* A FUTURE ERA IS ONE ROW UNTIL YOU ASK FOR IT. On day one the Economy tab drew
   fifty cards, forty-two of them locked behind eras hours away, into a tray 38%
   of the viewport tall that you then scrolled to reach the eight you could
   build. The header still names the era and counts what is in it — the promise
   of the game to come is kept; it just no longer eats the world on the first
   morning. */
.bera {
  width: 100%; background: none; border: 0; padding: 0; font-family: var(--font-head);
  text-align: left; cursor: default;
}
/* the CLICKABLE form of the header gets real padding rather than a ::after expander: it is a
   full-width row with build cards directly above and below it, and an invisible 32 px box would
   sit on top of nine pixels of each of them and eat their clicks */
.bera-btn { cursor: pointer; padding: 9px 0; margin-top: 0; }
.bera-btn:hover { color: var(--gold-dim); }
.bera-btn:hover::before, .bera-btn:hover::after { opacity: 0.55; }
.bera-btn:active { opacity: 0.75; }
.bera-btn.open { color: var(--muted); }
.bera .bera-lock { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.bera-btn .bera-lock { color: var(--gold-dim); opacity: 0.8; }
/* the closed form: a pill that flows into the tray's own wrapping row, so four
   sleeping eras cost ONE line between them instead of four */
.bera-mini {
  flex: 0 0 auto; width: auto;
  border: 1px solid rgba(107,84,50,0.55); border-radius: var(--r-panel);
  padding: 8px 13px; margin: 4px 0 0; min-height: 32px;
  background: rgba(20,15,10,0.4);
  font-size: var(--fs-nano); letter-spacing: 1px; gap: 6px;
  align-self: flex-start;
}
.bera-mini::before, .bera-mini::after { display: none; }
.bera-mini:hover { background: rgba(60,48,28,0.6); border-color: var(--gold-dim); }

/* The mode you spend the most time in, said out loud. The other three hints are
   two-second affordances and sit across the middle of the world where you are
   about to click; this one can be up for minutes, so it takes a lane instead —
   the strip above the minimap column, which is measured (--right-w) and is the
   only piece of the bottom glass that neither the selection panel, the build
   dock, the spell bar, the group chips nor the objective card is using. */
#cursor-hint.ch-place {
  top: auto; bottom: calc(var(--lane-info, 140px) + 4px);
  left: auto; right: calc(var(--right-w, 0px) + 12px); transform: none;
  color: var(--gold-hi); border-color: var(--gold-dim); background: rgba(20,15,8,0.9);
  font-size: var(--fs-small); letter-spacing: 0.2px; line-height: 1.4; text-align: right;
  /* It may take everything to the right of the LEFT INFORMATION LANE and not one pixel more.
     That lane holds two things, not one: the objective card (330px at its widest, plus its
     gutter) and the LEDGER, which is up to 340px wide and, on a tall screen, hangs down far
     enough to reach this row. The constant alone was wrong — MEASURED at 1299x1309 with a
     selection panel open and a house on the cursor, #chronicle and this hint overlapped by
     34 x 25 px, which HUD._layoutAudit reports. --chron-w is measured every layout pass (it
     is 0 when the ledger is empty, which is when the 330 fallback is the right answer). */
  max-width: max(150px, min(430px, calc(var(--ui-w, 100vw) - var(--sel-w, 0px) - var(--right-w, 0px)
             - max(330px, var(--chron-w, 0px)) - 24px)));
}

/* --------------------------------------------------- 3. THE HIT TARGETS --- */
/* A chip is 26 px tall and a build tab 27 because the top bar is ONE LINE and
   the budget that keeps it there is measured — growing them would cost the
   glass this HUD spent a whole pass reclaiming. So the picture stays and the
   target grows: a transparent ::after centred on the control, VERTICAL ONLY on
   the bar (a chip must never steal a click from the row above it). */
.chip, .btab, .hud-btn, .icon-btn, .res, .gchip, .chron-more, .sbtn { position: relative; }
.chip::after, .btab::after, .hud-btn::after, .chron-more::after, .sbtn::after, .res::after {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 32px; transform: translateY(-50%); pointer-events: auto;
}
/* two controls that are small in BOTH directions, and both sit in a corner with
   nothing to steal from */
.sp-close, .tut-c-x { position: relative; }
.sp-close::after, .tut-c-x::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 34px; height: 34px; transform: translate(-50%, -50%);
}
.people-row .pr-go {
  min-width: 32px; min-height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ------------------------------------------------ 4. PRESS, AND REFUSAL --- */
/* Every control lifts on hover and rings on focus. Almost none of them said
   anything when actually PRESSED, which is the half of the feedback loop that
   tells you the click landed. One idiom: the lift collapses and the surface
   dims for the length of the press. */
.hud-btn:active:not(:disabled), .title-btn:active:not(:disabled),
.icon-btn:active, .btab:active, .chip-btn:active, .form-btn:active,
.gchip:active, .spell:active, .gd-tab:active,
.chron-more:active, #tut-pip:active {
  transform: translateY(1px) !important;
  filter: brightness(0.92);
}
.people-row:active { transform: translateX(3px); filter: brightness(0.92); }
.res { transition: transform 0.12s, border-color 0.12s; }
/* a resource at its cap is being thrown away — the figure already shouts in
   orange; the border joins in so it reads without being read */
.res.capped { border-color: #a05a2a; }
/* which way is this number going? the one thing a resource bar is for */
.res-tr { font-style: normal; font-size: 8px; line-height: 1; opacity: 0.75; margin-left: 1px; }
.res-tr:empty { display: none; }
.res.trend-up .res-tr { color: #8fd07a; }
.res.trend-dn .res-tr { color: #e08a7a; }
#popchip.chip-full { border-color: #a05a2a; }
body.reduce-motion .hud-btn:active, body.reduce-motion .title-btn:active,
body.reduce-motion .icon-btn:active, body.reduce-motion .btab:active { transform: none !important; }

/* ------------------------------------ 5. THE CARD BEHIND A LIVE NUMBER ---- */
/* Hovering a figure on the top bar now opens an account of it: what it is doing
   per second right now (measured, not guessed), how long until that matters,
   which buildings are making it and what is taking it away. */
.livetip { min-width: 232px; }
.livetip .tip-head { margin-bottom: 4px; }
.lt-net {
  font-size: var(--fs-small); line-height: 1.5; color: #d8cba8;
  padding: 5px 8px; margin: 5px 0 2px; border-radius: var(--r-card);
  background: rgba(0,0,0,0.28); border-left: 2px solid var(--gold-dim);
}
.lt-eta { color: var(--muted); margin-left: 6px; font-size: var(--fs-micro); }
.lt-eta.bad-t { color: #e08a7a; }
.lt-h {
  font-size: var(--fs-nano); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); margin: 8px 0 3px;
}
.lt-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-size: var(--fs-micro); line-height: 1.5; color: #cabf9e;
}
.lt-row i { font-style: normal; color: var(--muted); }
.lt-row b { flex: 0 0 auto; }
.livetip .tip-flavour { margin-top: 7px; font-size: var(--fs-nano); opacity: 0.65; }

/* THE PEOPLE TALLY. What the whole realm is doing, above a roll that only ever
   shows sixty of it — and each figure picks its own set, so "every idle hand"
   still reaches souls whose row was never drawn. */
.ppl-tally-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 6px; margin: 2px 0 8px;
}
.ppl-tally {
  background: rgba(20,15,10,0.5); border: 1px solid var(--border); border-radius: var(--r-panel);
  color: #cabf9e; font: inherit; font-size: var(--fs-micro); padding: 4px 12px; cursor: pointer;
  transition: border-color 0.12s, transform 0.12s, background 0.12s;
  font-variant-numeric: tabular-nums;
}
.ppl-tally b { color: var(--gold); font-size: var(--fs-copy); margin-right: 2px; }
.ppl-tally:hover { border-color: var(--gold-dim); transform: translateY(-1px); background: rgba(60,48,28,0.55); }
.ppl-tally:active { transform: translateY(1px); filter: brightness(0.92); }
.ppl-tally-sep { font-size: var(--fs-micro); color: var(--muted); margin-left: 4px; font-variant-numeric: tabular-nums; }
.ppl-tally-sep b { color: #b6aa8c; }

/* the generated key reference (HUD.KEYS is the one table; see hud.js) */
.gd-keys-h {
  font-family: var(--font-head); font-size: var(--fs-micro); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--gold-dim);
  margin: 12px 0 5px; padding-bottom: 3px; border-bottom: 1px solid rgba(107,84,50,0.4);
}
.gd-keys-h:first-child { margin-top: 2px; }
.gd-key-row { display: flex; align-items: baseline; gap: 10px; line-height: 1.55; }
.gd-key-row > .gd-k { flex: 0 0 88px; text-align: center; }
@media (max-width: 720px) { .gd-key-row > .gd-k { flex-basis: 72px; } }

/* the abandon-the-reign confirmation (it used to be a browser confirm() box) */
.danger-h { color: #e08a7a !important; }

/* A TOAST MUST NOT LAND ON THE LOGO. #toasts is z-index 210 and the title screen
   sits in #modal-layer at 100, so a failed load's warning printed straight
   across the word CROWNFALL. Off the menu, the stack hangs at the bottom. */
#ui:not(.in-game) #toasts, #ui.modal-up #toasts { top: auto; bottom: 16px; }

/* ============================================================================
   THE CITY OVERLAYS — the button that opens them, and the caption while one is up
   ----------------------------------------------------------------------------
   docs/specs/city.md calls the desirability map "a core interface"; it had no
   control at all, only the O key. #btn-city is that control and it is a MODE
   button, so unlike its seven neighbours it has an ON state — the mode is on the
   world, not in a panel you can see is open. #citychip is the caption: it appears
   only while a field is up and names which one, because coloured ground with
   nothing naming the colours is a debug view.
   ============================================================================ */
.icon-btn.on {
  border-color: var(--gold);
  color: var(--gold-hi);
  background: linear-gradient(180deg, rgba(122,98,42,0.85), rgba(74,60,26,0.85));
  box-shadow: inset 0 1px 0 rgba(255,235,190,0.22), 0 0 12px rgba(242,201,76,0.3);
}
.icon-btn.on:hover { border-color: var(--gold); color: #fff3cd; }
/* the ramp the ground is painted from, at chip scale: CITY._colour runs foul red
   through neutral to sought-after green, and _colourCov runs the same way from
   "reaches nothing" to "reaches all seven", so one strip is honest for both modes */
.cl-ramp {
  display: inline-block;
  width: 34px; height: 7px;
  margin: 0 5px 0 3px;
  vertical-align: 0;
  border-radius: var(--r-ctl);
  border: 1px solid rgba(0,0,0,0.45);
  background: linear-gradient(90deg, #d6484a 0%, #e0603c 26%, #5abe6e 62%, #1ef046 100%);
}
#topbar .tb-min .cl-ramp { display: none; }

/* ============================================================================
   THE HIT TARGETS, SECOND PASS — the ones section 3 above could not reach
   ----------------------------------------------------------------------------
   Section 3's invisible ::after grows a short control to 32 px. It is defeated
   in two places, and both are fixed here rather than by weakening that rule.

   1. The TOP BAR. `#topbar .chip` and `#ageup-btn` carry `overflow: hidden` so
      a chip can ellipsise when the budget squeezes it — and that clips the
      expander to the 26 px box. MEASURED: a probe 15 px above #crownchip's
      centre lands on the world canvas; the same probe on a .btab lands on the
      tab. Un-clipping it would be worse than the disease: the bar's row gap is
      5 px and the expander is 6 px, so a wrapped bar's two rows would trade
      clicks. So the chips get REAL height on the one row where it is free —
      HUD.measureLayout writes .tb-1row when the bar has not wrapped, and on one
      row the tallest child is already .tb-controls at 33 px (or the 38 px day
      clock), so a 32 px chip cannot make the bar one pixel taller.
   2. Controls inside MODALS that are not in section 3's list at all. There is
      no row above them to steal from and the panels have the vertical room.
   ============================================================================ */
#topbar.tb-1row > .chip { padding-top: 7px; padding-bottom: 7px; }
#topbar.tb-1row > #ageup-btn { min-height: 32px; }
/* the guide's tab strip, the realm panel's, the People roll's tally figures and
   every <select> in Settings — all 25-26 px, all clicked constantly */
.gd-tab, .dq-tab, .ppl-tally, .set-select { min-height: 32px; }
.gd-tab, .dq-tab, .ppl-tally { display: inline-flex; align-items: center; justify-content: center; }
/* a wrapped tab strip needs a gap wider than nothing now that the rows are taller */
.gd-tabs { gap: 6px; }
/* A settings row is a <label>, so the whole line already toggles its box — it was
   just 23 px of line. The box itself grows too: a 14 px checkbox is a dart board. */
.chk-row { min-height: 32px; }
.chk-row input[type=checkbox] { width: 17px; height: 17px; flex: 0 0 auto; }
/* a slider you have to hit within seven pixels of centre is a slider you fight;
   the track is drawn by accent-color and stays thin, only the grab box grows */
.vol-row input[type=range] { height: 32px; }

/* --------------------------------------------------------- THE SPELL BAR -- */
/* A spell is a <button> now (see HUD.refreshSpells): reachable by Tab, pressable
   by Enter, and it must not wear a browser button's chrome or lose its column. */
.spell { font: inherit; color: inherit; -webkit-appearance: none; appearance: none; padding: 0; }
/* the third state this bar never had: unlocked, off cooldown, and unaffordable.
   It stays clickable on purpose — the click is how it tells you what it wants. */
.spell.poor { border-color: #5a4a4a; filter: saturate(0.45) brightness(0.86); }
.spell.poor .spell-cost { color: #ff8a7a; }
.spell.poor:hover { border-color: #8a5a5a; box-shadow: 0 0 12px rgba(214,69,69,0.28); }

/* ==========================================================================
   THE STRUCK SEAL  —  what stands where a generated face used to
   ==========================================================================
   Three surfaces carried a portrait: the selection panel, the advisor
   audience, and the plate at the top of a building interior. The face is
   gone. What replaces it is not a smaller icon in the same hole — it is a
   struck medal, and it is built the way a medal is: a milled rim, a bevelled
   field, a gloss that only catches one side, and a device cut into it.

   The rim is a real gradient, not a flat border. `border: 3px solid
   transparent` plus two backgrounds — the field clipped to the padding box,
   the metal clipped to the border box — paints a conic-gradient ring in the
   border and the field inside it, with no masks, no extra element and no
   z-index games. Every stop in that conic is a facet of turned gold, so the
   rim brightens and darkens around the circle the way a struck edge does.

   No `filter: blur()` and no canvas here: the bevel is four box-shadows, the
   gloss is one linear-gradient on ::before, and the whole thing is one
   element the browser composites for free.
   ========================================================================== */
.cf-seal, .sp-portrait, .int-icon {
  position: relative;
  flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid transparent;
  border-radius: 50%;
  background-color: transparent;
  background-image:
    radial-gradient(circle at 50% 28%,
      var(--seal-hi, #584627) 0%,
      var(--seal-lo, #201609) 74%,
      #0d0905 100%),
    conic-gradient(from 216deg,
      #6a5326   0deg, #f7e4aa  34deg, #a2823c  72deg, #fff6d2 116deg,
      #7d6229 166deg, #e6c877 212deg, #5c4620 258deg, #f4d894 308deg, #6a5326 360deg);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    inset 0 4px 11px rgba(0,0,0,0.74),          /* the field is sunk, not flat */
    inset 0 -2px 3px rgba(255,238,190,0.09),    /* light bouncing off the lower wall */
    0 2px 7px rgba(0,0,0,0.55),                 /* the medal sits ON the panel */
    0 0 0 3px rgba(13,9,5,0.92),                /* the bezel it is set into */
    0 0 18px rgba(242,201,76,0.13);             /* warm air around gold */
  overflow: hidden;
}
/* the gloss and the engraved inner hairline, in one pseudo-element above the
   content so it glazes the device as well as the field */
.cf-seal::before, .sp-portrait::before, .int-icon::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  pointer-events: none; z-index: 2;
  box-shadow:
    inset 0 0 0 1px rgba(255,236,176,0.22),
    inset 0 0 0 2px rgba(0,0,0,0.42);
  background: linear-gradient(148deg,
    rgba(255,246,214,0.20) 0%, rgba(255,246,214,0.06) 30%,
    rgba(255,246,214,0) 50%, rgba(0,0,0,0.16) 100%);
}
/* whatever is in the middle — a device, a creature sprite, a building sprite,
   an emoji — is centred, capped to the field, and lit from the same sun */
.cf-seal > *, .sp-portrait > *, .int-icon > *,
.cf-seal > img, .sp-portrait > img, .int-icon > img {
  position: relative; z-index: 1;
  max-width: 76%; max-height: 76%;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.75));
}
.cf-seal-dev {
  display: flex; align-items: center; justify-content: center;
  color: #f0dda8;
  /* the device is CUT INTO the metal, not printed on it: a hard black edge
     below and a hairline catch-light above is the whole trick, and it costs
     two drop-shadows with no blur radius at all */
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.75)) drop-shadow(0 -1px 0 rgba(255,244,206,0.17));
}
.cf-seal-dev svg { display: block; }
/* the in-game sprites are small canvases upscaled — nearest-neighbour keeps
   them crisp instead of turning them to soup */
.sp-portrait img, .cf-seal img { image-rendering: auto; }

/* the tinctures, keyed by station. Set on the element by HUD.seal(). */
.cf-seal[data-tinct="gules"]   { --seal-hi: #6d2a22; --seal-lo: #2a0e0b; }
.cf-seal[data-tinct="or"]      { --seal-hi: #6b5220; --seal-lo: #26190a; }
.cf-seal[data-tinct="argent"]  { --seal-hi: #565a66; --seal-lo: #191b22; }
.cf-seal[data-tinct="purpure"] { --seal-hi: #3f2b54; --seal-lo: #170f21; }
.cf-seal[data-tinct="vert"]    { --seal-hi: #215442; --seal-lo: #0a2018; }
.cf-seal[data-tinct="azure"]   { --seal-hi: #27415f; --seal-lo: #0c1622; }
.cf-seal[data-tinct="copper"]  { --seal-hi: #6b4227; --seal-lo: #26140b; }
.cf-seal[data-tinct="earth"]   { --seal-hi: #584627; --seal-lo: #201609; }

/* the interior plate has no markup of mine to hang a tincture on, so it takes
   the one the interior already declares for itself and darkens it to a field */
.int-icon { width: 62px; height: 62px; font-size: var(--fs-display); }
@supports (color: color-mix(in srgb, #000 50%, #fff)) {
  .int-icon { --seal-hi: color-mix(in srgb, var(--int-accent, #c9a84c) 32%, #3a2d18);
              --seal-lo: color-mix(in srgb, var(--int-accent, #c9a84c) 12%, #150f07); }
}
#ui.uiw-lt1200 .sp-portrait, #ui.uiw-lt1200 .cf-seal { width: 52px !important; height: 52px !important; }

/* ---- the type that now carries the identity ----------------------------- */
/* A name set properly is a better portrait than a 58 px picture ever was.
   Station above, in letterspaced gold caps; the name in the display face
   under it. Same lockup in every panel, so the shape itself says "a person". */
.sp-station, .aud-station {
  display: block;
  font-family: var(--font-head); font-size: var(--fs-nano); font-weight: 700;
  letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--gold-dim); opacity: 0.92;
  margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-tag.bad {
  background: linear-gradient(180deg, #4d2321, #331615); color: #ff9c8a; border-color: #7a3b36;
}

/* ---- the advisor audience: the place the game TALKS to you --------------- */
.aud-head { align-items: center; gap: 14px; margin-bottom: 10px; }
.aud-seal { box-shadow:
    inset 0 4px 12px rgba(0,0,0,0.76),
    inset 0 -2px 3px rgba(255,238,190,0.10),
    0 3px 10px rgba(0,0,0,0.6),
    0 0 0 3px rgba(13,9,5,0.92),
    0 0 26px rgba(242,201,76,0.20); }
.aud-htext { flex: 1; min-width: 0; }
.aud-htext h2 { margin: 0 0 2px; line-height: 1.08; }
.aud-passive {
  font-size: var(--fs-small); font-style: italic; color: var(--parch-dim);
  padding-top: 5px; border-top: 1px solid rgba(201,168,76,0.28);
}
/* loyalty was a bare number against no scale. It is a measured thing now. */
.aud-loy { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.aud-loy-l {
  font-family: var(--font-head); font-size: var(--fs-nano); font-weight: 700;
  letter-spacing: 1.6px; text-transform: uppercase; color: var(--gold-dim);
}
.aud-loy-bar {
  flex: 1; min-width: 60px; height: 8px; border-radius: var(--r-ctl);
  background: linear-gradient(180deg, #100b06, #1d1409);
  border: 1px solid rgba(0,0,0,0.7);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.8), 0 1px 0 rgba(255,235,190,0.08);
  overflow: hidden;
}
.aud-loy-bar i {
  display: block; height: 100%; border-radius: var(--r-ctl);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.34);
  transition: width 0.25s ease-out;
}
.aud-loy b { font-size: var(--fs-copy); font-family: var(--font-head); }
.aud-loy-w { font-size: var(--fs-micro); font-style: italic; color: #a99c7e; }
.aud-greet {
  text-align: left;
  padding: 9px 12px 9px 14px; border-radius: var(--r-card);
  background: linear-gradient(180deg, rgba(58,45,30,0.42), rgba(28,21,14,0.42));
  border-left: 3px solid var(--gold-dim);
}

/* the lockup is a lockup: the seal on the left, the type ranged left against
   it. .big-modal centres everything by default, which turned a name-and-
   station pair into two lines floating in the middle of a 560 px box. */
.aud-htext, .aud-loy { text-align: left; }

/* ---- a control whose cost you cannot meet ------------------------------- */
/* Not `disabled`: a disabled button in Chrome swallows its own mouse events,
   so the tooltip explaining WHY would never appear and the click that toasts
   the reason would never fire. Same idiom as .spell.poor — dimmed, cooled,
   still yours to press, and it answers when you do. */
.hud-btn.poor, .title-btn.poor {
  filter: saturate(0.4) brightness(0.82);
  border-color: #5a4a4a;
}
.hud-btn.poor:hover, .title-btn.poor:hover {
  border-color: #8a5a5a; box-shadow: 0 0 12px rgba(214,69,69,0.26); transform: none;
}
.hud-btn.poor .aud-hint { color: #ff9c8a; }

/* ---- the building interior: the speaker gets the same lockup ------------- */
/* interiors.js writes `<b>Name</b> — <i>"their line"</i>` on one run-on line,
   which read as a caption rather than as somebody talking to you. The markup
   is not mine to change, so the CSS restacks it: the parent goes to font-size
   0 (which silently swallows the em-dash between the two elements and nothing
   else — there is no other bare text in this element), the name becomes a
   letterspaced station line, and what they SAY becomes the block, quoted, in
   the same left-ruled well the advisor audience uses. Same shape in both
   places, so "a person is speaking" looks the same wherever it happens. */
.int-npc {
  font-size: 0;
  margin: 10px 0 10px; padding: 9px 13px;
  background: linear-gradient(180deg, rgba(20,14,8,0.5), rgba(10,7,4,0.5));
  border-left: 3px solid var(--int-accent, var(--gold-dim));
  border-radius: 0 var(--r-card) var(--r-card) 0;
}
.int-npc b {
  display: block;
  font-family: var(--font-head); font-size: var(--fs-nano); font-weight: 700;
  letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--int-accent, var(--gold)); margin-bottom: 3px;
}
.int-npc i { display: block; font-size: var(--fs-body); line-height: 1.5; color: #f2e6c6; }
.int-head { gap: 14px; margin-bottom: 10px; }
.int-icon { width: 66px; height: 66px; font-size: var(--fs-display); }
.int-head h2 { letter-spacing: 0.5px; }

/* ==========================================================================
   THE HIT TARGETS, THIRD PASS — three that both earlier passes missed
   ==========================================================================
   Probed with document.elementFromPoint 15 px above and below each control's
   centre, game paused, no modal open, 1440x900, 13 chips on a three-row bar:

     #crownchip   26 px   up MISS  dn MISS
     #idlebtn     26 px   up MISS  dn MISS
     #seasonchip  29 px   up MISS  dn MISS
     .gchip       27 px   up MISS  dn MISS
     #chron-more  21 px   up HIT   dn MISS
     .btab        27 px   up HIT   dn HIT      <- the expander working

   1. THE TOP BAR, ON A BAR THAT WRAPPED. Pass two gave the chips real height
      under `#topbar.tb-1row`, on the reasoning that one row can absorb it for
      free. True — but a mature realm shows THIRTEEN chips, and thirteen chips
      wrap to three rows at 1440 px and never see that rule. Which is to say
      the fix applied to the case the player is almost never in.
      It is free on a wrapped bar too, and for the same reason: every row is
      already sized by its tallest child (.tb-controls 33 px, #dayclock 38),
      so a 32 px chip fits inside a row that is 33 px tall regardless of how
      many rows there are. MEASURED at 1440x900: bar 90 px before, 90 px
      after; 13 chips full before, 13 full after; 10% of the viewport both
      ways; HUD._layoutAudit() [] both ways. The overflow:hidden that clips
      the ::after expander is left exactly where it is — the ellipsis needs it.
   2. THE CONTROL-GROUP CHIPS. `.gchip` is in pass three's `position:
      relative` list and was left out of the `::after` list beside it, so the
      expander it was set up for was never written. One selector.
   3. THE LEDGER BUTTON. #chronicle carries `overflow: hidden` so the feed can
      be clipped to its lane, and that clips .chron-more's expander with it —
      the probe hits above the button and falls through below it. The only
      clickable thing in the quiet feed gets real height instead.
   ========================================================================== */
/* padding AND a floor: #goodschip, #erachip and #yearchip are `display: flex`
   (their own rule, elsewhere), and a flex line is 16 px where a line of text is
   18 — so padding alone left those three at 30 px while every other chip
   reached 32. Measured effective target, elementFromPoint bisected outward
   from each centre: #crownchip 32.6, #goodschip 30.5. */
#topbar > .chip { padding-top: 7px; padding-bottom: 7px; min-height: 32px; }
/* the Era button rides the same bar and was left behind by the same rule for
   the same reason (`#topbar.tb-1row > #ageup-btn`, which a three-row bar never
   matches). Measured effective target 30.5 -> 32.5; bar 90 px both ways. */
#topbar > #ageup-btn { min-height: 32px; }
.gchip::after {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 32px; transform: translateY(-50%); pointer-events: auto;
}
.chron-more { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; }

/* The Legacy panel's perks. `.tech` gets its 32 px in the research tree from
   the card padding there; in Legacy the same class is a 29 px pill, and there
   are twenty-eight of them. Measured effective height 29.0. */
#ui .tech { min-height: 32px; }
/* The guided reign's card scrolls (`overflow-y: auto`), which clips the 34 px
   ::after this file gives its close button: measured effective target 33.9
   wide but 27.7 tall, cut off at the card's own padding edge. A real box
   cannot be clipped. */
.tut-c-x {
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}

#toasts .toast.lesson {
  border-color: #977944; border-left-color: #d5b777; color: #e7dcc5;
  background: linear-gradient(110deg, #362919, #241c13);
}
#toasts .toast.lesson b { color: #edcc83; }
