:root{
  --ink:#0c0b09;
  --ink2:#1a1814;
  --paper:#d8c9a3;
  --paper-dim:#b9a780;
  --parchment:#e8dcc0;
  --ember:#c74f1e;
  --ember-hi:#ff8a3d;
  --ember-glow:rgba(255,138,61,.45);
  --verdigris:#3f8f7f;
  --verdigris-dim:#2a5e55;
  --linen:#5c5341;
  --line:#3a332a;
  --cool-rim:#9fd8e8;
  --disabled:#4a443a;
  --danger:#a4202a;
  --gold-ink:#e7b94e;
  font:16px/1.35 system-ui,-apple-system,"Segoe UI",sans-serif;
  color-scheme:dark;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;min-height:100vh;color:var(--paper);
  background:radial-gradient(120% 80% at 50% -10%, #26221a 0%, #151208 60%, #0b0a07 100%);
  font-family:Georgia,'Times New Roman',serif;
}
.app{height:100vh;max-height:100vh;min-height:100vh;display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;grid-template-columns:1fr;grid-template-areas:
  "hud" "vista" "rail" "hint";
  position:relative;overflow:hidden}
.muted{color:var(--paper-dim)}
.hint{color:var(--paper-dim);font-family:system-ui,sans-serif;font-size:.8rem}

/* ---------- Sky & atmosphere ---------- */
.sky{grid-area:hud; /* overlay behind vista via negative index */ }
.hud{grid-area:hud;display:flex;align-items:center;justify-content:space-between;
  gap:1rem;padding:1rem 1.4rem;background:linear-gradient(180deg,#171410,#0f0d0a);
  border-bottom:1px solid var(--line);z-index:5}
.hud h1{margin:0;font-size:1.25rem;letter-spacing:.04em;color:var(--parchment)}
.hud small{color:var(--paper-dim);font-weight:normal;font-size:.85rem}
.stocks{display:flex;gap:.9rem;flex-wrap:wrap;font-family:system-ui,sans-serif;font-size:.85rem}
.stocks b{color:var(--gold-ink)}
.stocks .heir{color:var(--verdigris)}
.stocks .heir::first-letter{color:var(--verdigris)}

/* ---------- Vista ground ---------- */
.vista{
  grid-area:vista;position:relative;z-index:2;min-height:58vh;overflow:hidden;
  background:
    radial-gradient(90% 120% at 50% 110%, rgba(199,79,30,.16), transparent 60%),
    linear-gradient(180deg, #191206 0%, #241b10 30%, #171006 100%);
  /* the "vista" sky band */
}
.vista::before{content:"";position:absolute;inset:0 0 46% 0;
  background:linear-gradient(180deg,#0c1420 0%,#12222c 55%,#1d1a12 100%);
  z-index:-1}
.skyline{position:absolute;left:0;right:0;top:0;height:58%;z-index:0;
  background:
    linear-gradient(180deg, rgba(12,20,32,.9), rgba(16,20,16,.6)),
    repeating-linear-gradient(90deg, #0d0c0a 0 6px, #17120c 6px 9px, #0a0908 9px 15px),
    linear-gradient(180deg,#000 0%,#000 1px,transparent 1px) 0 0/40px 8px;
  -webkit-mask-image:linear-gradient(180deg,#000 60%,transparent);
  mask-image:linear-gradient(180deg,#000 60%,transparent);
  opacity:.85}
.moon{position:absolute;top:12%;right:16%;width:9vw;height:9vw;border-radius:50%;
  background:radial-gradient(circle at 35% 35%, #f7ecd0, #cfc08e 55%, #9d844e);
  box-shadow:0 0 60px 20px rgba(247,236,208,.18), inset -8px -10px 30px rgba(90,70,30,.5);
  z-index:1;opacity:.95}
.stars{position:absolute;top:4%;left:0;right:0;height:40%;z-index:0;
  background-image:
    radial-gradient(1px 1px at 12% 22%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 32% 12%, #ffe9b0, transparent),
    radial-gradient(1px 1px at 55% 30%, #cfd8ff, transparent),
    radial-gradient(1.5px 1.5px at 72% 15%, #fff, transparent),
    radial-gradient(1px 1px at 88% 24%, #ffd9a0, transparent);
  opacity:.7}
.plaza{position:absolute;left:0;right:0;bottom:0;height:54%;
  background:
    repeating-linear-gradient(0deg, #14100a 0 26px, #1a140c 26px 28px),
    linear-gradient(180deg,#1f1810,#120e08);
  box-shadow:inset 0 30px 40px -20px rgba(0,0,0,.9)}

/* torch falloff pools */
/* central focal anchor + cobblestone paths (fragile-foothold focal composition) */
.paths{position:absolute;inset:0;width:100%;height:100%;z-index:1;pointer-events:none}
.paths .road{fill:none;stroke:#1c1710;stroke-width:5;stroke-linecap:round;opacity:.85;
  filter:drop-shadow(0 1px 0 rgba(0,0,0,.6))}
.paths .road:nth-child(2n){stroke-dasharray:3 7;stroke:#241d12;stroke-width:3}
.focal{position:absolute;left:50%;transform:translateX(-50%);z-index:1;pointer-events:none;
  display:flex;flex-direction:column;align-items:center;filter:drop-shadow(0 8px 6px rgba(0,0,0,.6))}
.focal .pyxis{font-size:0;position:relative;width:56px;height:88px;
  filter:drop-shadow(0 0 14px var(--ember-glow))}
.focal .pyxis::before{content:"";position:absolute;bottom:0;left:4px;width:48px;height:10px;
  background:linear-gradient(180deg,#2a2318,#171006);border:2px solid var(--line);box-shadow:0 4px 8px rgba(0,0,0,.6)}
.focal .pyxis::after{content:"";position:absolute;bottom:8px;left:50%;transform:translateX(-50%);
  width:34px;height:46px;background:linear-gradient(180deg,#22201875,#14110b);
  border:2px solid var(--line);border-radius:2px;
  background-image:linear-gradient(90deg,transparent 46%,#0c0b09 46% 54%,transparent 54%),
    linear-gradient(180deg,transparent 60%,#0c0b09 60% 68%,transparent 68%)}
.focal .pyxis b{content:"";position:absolute;left:50%;transform:translateX(-50%);bottom:54px;
  width:6px;height:22px;background:#241c12;border-radius:2px}
.focal .pyxis i{position:absolute;left:50%;transform:translateX(-50%);bottom:76px;
  width:16px;height:16px;border-radius:50%;background:var(--ember-hi);
  box-shadow:0 0 18px 10px var(--ember-glow),0 0 40px 26px rgba(255,138,61,.16);
  animation:flicker 1.8s infinite alternate}
.focal .pyxis span{position:absolute;left:50%;transform:translateX(-50%);bottom:92px;
  width:34px;height:4px;background:linear-gradient(90deg,transparent,#c8b98c 40% 60%,transparent);opacity:.7}
.focal .pyxis span::before{content:"";position:absolute;left:-28px;bottom:-1px;width:90px;height:2px;
  background:linear-gradient(90deg,transparent,var(--ember-glow) 50%,transparent)}

.torch-l,.torch-r{position:absolute;bottom:6%;z-index:3}
.torch-l{left:3%}.torch-r{right:3%}
.torch{width:10px;height:22px;background:#2b2115;border-radius:3px 3px 0 0}
.torch i{width:14px;height:14px;border-radius:50%;background:var(--ember-hi);
  box-shadow:0 0 18px 10px var(--ember-glow),0 0 46px 30px rgba(255,138,61,.18);
  display:block;margin:-6px auto 0;animation:flicker 1.8s infinite alternate}
@keyframes flicker{from{transform:scale(1);opacity:.9}to{transform:scale(1.15);opacity:1}}

/* ---------- Buildings ---------- */
.bld{position:absolute;bottom:8%;width:clamp(150px,9.5vw,210px);
  display:flex;flex-direction:column;align-items:center;gap:.4rem;
  background:none;border:none;padding:0;cursor:pointer;color:inherit;
  transform-origin:50% 100%;transition:transform .18s ease, filter .18s ease}
.bld .glyph{width:100%;display:block;filter:drop-shadow(0 10px 6px rgba(0,0,0,.55))}
.bld .glyph svg{width:100%;height:auto;display:block}
.bld .tag{position:relative;font-family:"Arial Black",system-ui,sans-serif;
  text-transform:uppercase;letter-spacing:.14em;font-size:.78rem;color:var(--paper-dim);
  text-shadow:0 2px 0 #000}
.bld .tag b{display:block;font-family:Georgia,serif;text-transform:none;
  letter-spacing:.02em;color:var(--parchment);font-size:.95rem;text-shadow:0 0 8px rgba(0,0,0,.9)}
.bld .badge{position:absolute;top:-1.2rem;right:-0.6rem;width:1.9rem;height:1.9rem;
  display:none;align-items:center;justify-content:center;border-radius:50%;
  background:radial-gradient(circle at 35% 30%, var(--paper), #7b6a44 70%);
  color:#000;box-shadow:0 2px 6px rgba(0,0,0,.7);border:2px solid var(--ink)}
.bld .badge svg{width:70%;height:70%}

/* cool rim on hover/focus */
.bld:focus-visible,.bld.focused{outline:none}
.bld:focus-visible .glyph,.bld.focused .glyph{
  filter:drop-shadow(0 0 10px var(--ember-glow)) drop-shadow(-1px -1px 0 var(--cool-rim)) drop-shadow(1px 1px 0 rgba(0,0,0,.9))}
.bld:focus-visible .tag, .bld.focused .tag{color:var(--ember-hi)}
.bld:focus-visible .tag b, .bld.focused .tag b{color:#fff;text-shadow:0 0 12px var(--ember-glow)}
.bld:focus-visible,.bld.focused{transform:translateY(-6px) scale(1.03)}
.bld.back{width:clamp(130px,8vw,180px)!important;opacity:.92;filter:saturate(.9) brightness(.9)}
.bld.back .tag{font-size:.66rem}
.bld.back .tag b{font-size:.8rem}

/* state: available (default warm) */
.bld.st-available .glyph svg .fill{fill:var(--ink2)}
.bld.st-available .badge{display:flex}

/* state: focused -> ember rim */
.bld.focused .badge{display:flex}

/* state: locked */
.bld.st-locked .glyph svg .fill{fill:#2a2520;filter:grayscale(.6)}
.bld.st-locked .tag{color:var(--disabled)}
.bld.st-locked .tag b{color:#8b817a;text-shadow:none}
.bld.st-locked .badge{display:flex;background:radial-gradient(circle at 35% 30%, #6b675f, #3a352e);color:var(--disabled);border-color:#000}
.bld.st-locked{opacity:.82}

/* state: occupied (a hero is inside / capacity used) -> ember glow */
.bld.st-occupied .glyph svg .fill{fill:var(--ink2)}
.bld.st-occupied .badge{display:flex;background:radial-gradient(circle at 35% 30%, var(--ember-hi), #7a2c0c);color:#fff}
.bld.st-occupied .glyph{filter:drop-shadow(0 0 8px var(--ember-glow))}
.bld.st-occupied .tag{color:var(--ember-hi)}

/* state: afflicted / diseased / plague -> verdigris badge + cool tint */
.bld.st-afflicted .glyph svg .fill{fill:#16201c}
.bld.st-afflicted .glyph{filter:drop-shadow(0 0 8px rgba(63,143,127,.7))}
.bld.st-afflicted .badge{display:flex;background:radial-gradient(circle at 35% 30%, var(--verdigris), #17382f);color:#d9fff5}
.bld.st-afflicted .tag{color:var(--verdigris)}
.bld.st-afflicted .tag b{color:#bfeee2}

/* state: disabled (interaction forbidden this turn) */
.bld.st-disabled{opacity:.45;pointer-events:none;filter:grayscale(.5)}

/* roster rail — full-width bottom strip */
.rail{grid-area:rail;padding:.8rem 1.4rem;background:linear-gradient(180deg,#141210,#0f0d0a);
  border-top:1px solid var(--line);display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr) auto;gap:1.4rem;
  align-items:start;position:relative;z-index:5}
.rail h2{margin:0 0 .4rem;font-size:.9rem;letter-spacing:.06em;color:var(--parchment);border-bottom:1px solid var(--line);padding-bottom:.3rem;text-transform:uppercase}
.rail .col{min-width:0}
.roster{display:flex;flex-direction:column;gap:.35rem;max-height:24vh;overflow-y:auto}
.hero{background:linear-gradient(90deg,#211d16,#191512);border-left:4px solid var(--ember);
  padding:.35rem .6rem;border-radius:2px;box-shadow:inset 0 0 0 1px #2b261d}
.hero .hname{display:flex;justify-content:space-between;gap:.5rem;font-family:Georgia,serif;color:var(--parchment);font-size:.85rem}
.hero .hname b{font-weight:600}
.hero .hmeta{display:flex;flex-wrap:wrap;gap:.3rem .6rem;font-family:system-ui,sans-serif;font-size:.7rem;color:var(--paper-dim)}
.hero .aff{color:var(--verdigris)}
.hero .bad{color:#d9896f}
.hero.afflicted{border-left-color:var(--verdigris)}
.hero.afflicted .hname b{color:var(--verdigris)}
.hero.locked{border-left-color:#8b817a;opacity:.7}
.hero.occupied{border-left-color:var(--ember-hi)}

.log{margin:0;padding-left:1.2rem;max-height:24vh;overflow-y:auto;color:var(--paper-dim);font-size:.8rem;font-family:system-ui,sans-serif}
.log li{margin:.15rem 0}
.render{color:var(--paper-dim)}
.savebar{display:flex;flex-direction:column;gap:.5rem}
.savebar button,.facility button,#advance,#openSave{
  font-family:system-ui,sans-serif;background:linear-gradient(180deg,#3a3122,#2a2318);
  color:var(--parchment);border:2px solid var(--line);padding:.55rem .8rem;border-radius:3px;
  cursor:pointer;font-size:.82rem;letter-spacing:.02em;white-space:nowrap}
.savebar button:hover,.savebar button:focus,.facility button:hover,.facility button:focus,
#advance:hover,#advance:focus,#openSave:hover,#openSave:focus{outline:4px solid var(--ember-glow);outline-offset:1px;background:linear-gradient(180deg,#4a3f2b,#33291c)}
#openSave.btn-ember,.savebar #openSave{background:linear-gradient(180deg,#7a2c0c,#501b06);border-color:#8a3b12}
#advance{background:linear-gradient(180deg,#2c3a30,#1b2a1f);border-color:#224033}

.hintbar{grid-area:hint;padding:.5rem 1.4rem;background:rgba(10,9,7,.92);
  border-top:1px solid var(--line);z-index:6;text-align:center}

/* JEE-1306 M5-VD-03: last-input glyph switching. The footer shows exactly ONE
   control scheme at a time, toggled by <body data-input-mode="kbm|gamepad"> set
   from the last actual input source. Keyboard (default) and gamepad never render
   together, and silent-mode dynamic hints inherit the same filter. */
.input-hint{display:none;align-items:center;justify-content:center;gap:.45rem}
.input-hint kbd{display:inline-block;min-width:1.55rem;padding:.05rem .38rem;border:1px solid var(--line);
  border-bottom-width:2px;border-radius:4px;background:#221e16;color:var(--parchment);
  font:600 .72rem/1.35 system-ui,sans-serif;text-align:center;box-shadow:inset 0 1px 0 rgba(255,255,255,.06)}
.input-hint kbd.gp{background:#1c2a24;border-color:#2d5c4c;color:#bfe6d9}
body[data-input-mode="gamepad"] .input-hint[data-mode="gamepad"],
body[data-input-mode="kbm"] .input-hint[data-mode="kbm"],
body:not([data-input-mode]) .input-hint[data-mode="kbm"]{display:inline-flex}
.hint[data-mode]{display:none}
body[data-input-mode="gamepad"] .hint[data-mode="gamepad"],
body[data-input-mode="kbm"] .hint[data-mode="kbm"],
body:not([data-input-mode]) .hint[data-mode="kbm"]{display:inline}
.hint > span[data-mode]{display:none}
body[data-input-mode="gamepad"] .hint > span[data-mode="gamepad"],
body[data-input-mode="kbm"] .hint > span[data-mode="kbm"],
body:not([data-input-mode]) .hint > span[data-mode="kbm"]{display:inline}


/* ---------- Facility dialog ---------- */
.facility{width:min(900px,94vw);max-height:92vh;border:6px solid #3a2f1d;border-radius:4px;
  background:linear-gradient(180deg,#17150f,#0f0d09);color:var(--paper);padding:0;overflow:auto;
  box-shadow:0 0 80px 20px rgba(0,0,0,.85),0 0 0 2px #0b0a07}
.facility::backdrop{background:rgba(0,0,0,.78)}
.facility form{margin:0;position:sticky;top:0;z-index:3;background:linear-gradient(180deg,#17150f,#17150f);display:flex;justify-content:flex-end;padding:.5rem}
.close{background:#3b3021;color:var(--parchment);border:2px solid var(--line);width:2.2rem;height:2.2rem;border-radius:50%;font-size:1.2rem;cursor:pointer}
.fachead{display:flex;gap:1rem;align-items:center;padding:.4rem 1.4rem 1rem;border-bottom:1px solid var(--line);margin-bottom:1rem}
.fachead h2{margin:0;font-size:1.4rem;color:var(--parchment);letter-spacing:.03em}
.fachead p{margin:.2rem 0 0}
.facicon{width:64px;height:64px;flex:0 0 auto;filter:drop-shadow(0 0 12px var(--ember-glow))}
.facility .cols{display:grid;grid-template-columns:1fr 1fr;gap:.8rem 1.2rem;padding:0 1.4rem 1.4rem}
.facility .full{grid-column:1/-1}
.facility h3{grid-column:1/-1;margin:.6rem 0 .2rem;font-size:.95rem;letter-spacing:.08em;
  text-transform:uppercase;color:var(--ember-hi);border-bottom:1px solid var(--line);padding-bottom:.3rem}
.panel-actions{display:flex;flex-direction:column;gap:.5rem;padding:0 1.4rem 1.4rem}
.row{display:flex;align-items:center;justify-content:space-between;gap:.6rem;
  background:#191510;border:1px solid #2b261d;padding:.5rem .7rem;border-radius:2px}
.row .lbl{font-family:system-ui,sans-serif;font-size:.82rem;color:var(--paper-dim)}
.row .btn-group{display:flex;gap:.35rem;flex-wrap:wrap}
button.danger{background:linear-gradient(180deg,#5a151d,#3a0d12)!important;border-color:#7a2c1e!important}
.facility button:disabled{background:#221f1a!important;color:var(--disabled);border-color:#2a251d;cursor:not-allowed}
.facility button:disabled:hover{outline:none}

/* slabs / cards inside facility screens */
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:.6rem}
.card{background:linear-gradient(180deg,#211c15,#17130d);border:2px solid #2d271c;
  padding:.6rem;border-radius:3px;display:flex;flex-direction:column;gap:.3rem}
.card .cname{font-family:Georgia,serif;color:var(--parchment)}
.card .cmeta{font-family:system-ui,sans-serif;font-size:.72rem;color:var(--paper-dim)}
.card button{font-size:.72rem;padding:.3rem .5rem}
.card.locked{opacity:.6;border-style:dashed}
.card.afflicted{border-color:var(--verdigris)}
.card.afflicted .cname{color:var(--verdigris)}
.card.occupied{border-color:var(--ember-hi)}
.queuebar{display:flex;flex-direction:column;gap:.5rem}
.qitem{display:flex;align-items:center;gap:.7rem;background:#1b1711;border:1px solid #2d271c;
  padding:.5rem .7rem;border-radius:2px}
.qitem .qdot{width:.9rem;height:.9rem;border-radius:50%;background:var(--ember-hi);
  box-shadow:0 0 8px var(--ember-glow)}
.qitem .qdot.done{background:var(--verdigris);box-shadow:0 0 8px rgba(63,143,127,.7)}
.qitem .qmeta{font-family:system-ui,sans-serif;font-size:.78rem;color:var(--paper-dim);flex:1}
.qitem.afflicted{border-color:var(--verdigris)}

/* save screen slots */
.savelist{display:flex;flex-direction:column;gap:.6rem;padding:1rem 1.4rem 1.4rem}
.slot{display:flex;align-items:center;justify-content:space-between;gap:.6rem;background:#191510;
  border:2px solid #2b261d;padding:.7rem .9rem;border-radius:3px}
.slot .sname{font-family:Georgia,serif;color:var(--parchment)}
.slot .sstate{font-family:system-ui,sans-serif;font-size:.75rem;color:var(--paper-dim)}
.slot .btn-group{display:flex;gap:.35rem}
.slot.occupied{border-color:var(--ember-hi)}
.slot.occupied .sname{color:var(--ember-hi)}

/* empty states */
.empty{font-family:system-ui,sans-serif;color:var(--paper-dim);font-style:italic;padding:.8rem;border:1px dashed var(--line);border-radius:3px}

/* M4 embark shell (system skeleton — no final art) */
.tiers{display:flex;gap:.4rem;flex-wrap:wrap}
.tier{font-family:system-ui,sans-serif;font-size:.72rem;padding:.2rem .5rem;border:1px solid var(--line);border-radius:3px;color:var(--paper-dim)}
.tier.open{color:var(--ember-hi);border-color:var(--ember-hi)}
.tier.locked{opacity:.55}
.row .tiers{flex:1;justify-content:flex-end}
#embarkDialog .facicon{color:var(--ember-hi)}

@media (max-width:900px){
  .app{grid-template-rows:auto auto auto auto}
  .vista{min-height:48vh}
  .rail{grid-template-columns:1fr;gap:.8rem}
  .facility .cols{grid-template-columns:1fr}
}
@media (min-width:1500px){:root{font-size:18px}}

/* ======================================================================
   M4 region-aware visual foundation (JEE-1261)
   Mesh/geometry-heavy-black linocut scenes + DD-style state chrome.
   --racc = the region's single controlled palette accent (set inline per surface).
   ====================================================================== */

/* ---- Region select: one distinct silhouette + palette accent per row ---- */
.region-select{display:flex;flex-direction:column;gap:.6rem}
.region-row{background:linear-gradient(180deg,#1b1713,#140f0b);
  border:2px solid #2b261d;padding:.5rem .8rem;border-radius:3px;
  box-shadow:inset 0 0 0 2px rgba(0,0,0,.4)}
.region-row .region-thumb{width:74px;height:46px;flex:0 0 auto;overflow:hidden;
  border:1px solid #000;border-radius:2px;background:linear-gradient(180deg,#2a2318,#171006);
  filter:drop-shadow(0 4px 4px rgba(0,0,0,.6))}
.region-row .region-thumb svg{width:100%;height:100%;display:block}
.region-row .region-thumb svg .path{fill:var(--ink2)}
.region-row .lbl{display:flex;flex-direction:column;gap:.1rem;flex:1;min-width:0}
.region-row .lbl b{font-size:1rem;color:var(--parchment)}
.region-row .region-mood{font-family:system-ui,sans-serif;font-size:.72rem;
  color:var(--paper-dim);letter-spacing:.02em}
.region-row .tiers{flex:0 0 auto}
.region-row [data-region]{border-color:var(--racc,var(--ember))}
.region-row [data-region]:not(:disabled){color:var(--racc,var(--ember-hi));border-color:var(--racc,var(--ember))}

/* ---- M5 Veteran tier bar on the embark region select (JEE-1306) ---- */
.embark-tiers{display:flex;gap:.5rem;margin-bottom:.9rem;flex-wrap:wrap}
.embark-tiers .tier{font-family:Georgia,serif;font-size:.9rem;letter-spacing:.04em;padding:.42rem .9rem;
  border:2px solid #2b261d;border-radius:3px;background:linear-gradient(180deg,#1b1713,#140f0b);
  color:var(--paper-dim);cursor:pointer;text-transform:uppercase}
.embark-tiers .tier:not(.open){border-top-color:var(--verdigris)}
.embark-tiers .tier.open{border-color:var(--ember);color:var(--ember-hi);outline:2px solid var(--ember-glow)}
.embark-tiers .tier:disabled{opacity:.5;cursor:not-allowed;border-style:dashed;border-top-color:var(--disabled)}
.region-row .vet-progress{font-family:system-ui,sans-serif;font-size:.72rem;color:var(--verdigris);
  letter-spacing:.02em}

/* ---- Region scene head on the quest-select surface (mesh-first foundation) ---- */
.quest-scene-head{display:flex;align-items:center;gap:1rem;padding:.5rem .9rem 1rem;
  border-bottom:1px solid var(--line);margin-bottom:.6rem}
.quest-scene{width:150px;height:90px;flex:0 0 auto;overflow:hidden;border:2px solid #000;
  border-radius:3px;background:linear-gradient(180deg,#2a2318,#120d08);
  filter:drop-shadow(0 6px 6px rgba(0,0,0,.55));box-shadow:inset 0 0 0 2px var(--racc,transparent)}
.quest-scene svg{width:100%;height:100%;display:block}
.quest-scene-caption{font-family:Georgia,serif;color:var(--parchment);font-size:.95rem;letter-spacing:.03em}
.quest-scene-caption b{color:var(--racc,var(--ember-hi))}

/* ---- Boss quest cards: spatial lair thumbnail + pre-action stage read ---- */
.boss-card{border-color:var(--racc,#2d271c)}
.boss-card .boss-thumb{width:100%;height:96px;overflow:hidden;border:2px solid #000;border-radius:3px;
  background:linear-gradient(180deg,#221b13,#120d08);margin-bottom:.3rem;
  filter:drop-shadow(0 5px 5px rgba(0,0,0,.5))}
.boss-card .boss-thumb svg{width:100%;height:100%;display:block}
.boss-card[data-boss-card] .cname{color:var(--racc,var(--ember-hi))}
.boss-card button{border-color:var(--racc,#3a332a);color:var(--racc,var(--ember-hi))}

/* ---- Expedition run: region scene foundation ---- */
.exp-scene{display:block}
.region-scene-strip{display:flex;align-items:center;gap:.8rem;padding:.4rem .8rem;margin-bottom:.6rem;
  background:linear-gradient(90deg,#181410,#120d08);border:1px solid var(--line);
  border-left:4px solid var(--racc,var(--ember));border-radius:2px}
.region-scene-art{width:120px;height:64px;flex:0 0 auto;overflow:hidden;border:1px solid #000;border-radius:2px;
  background:linear-gradient(180deg,#241c12,#120d08)}
.region-scene-art svg{width:100%;height:100%;display:block}
.region-scene-name{font-family:Georgia,serif;color:var(--racc,var(--parchment));font-size:.95rem;letter-spacing:.04em}

/* ---- Boss-lair staging (mesh/geometry first) ---- */
.lair-stage{position:relative;border:1px solid var(--line);border-radius:3px;overflow:hidden;
  background:radial-gradient(120% 120% at 50% 130%, rgba(199,79,30,.14), transparent 60%),
    linear-gradient(180deg,#130f0a,#0a0806);
  box-shadow:inset 0 0 0 2px var(--racc,rgba(255,138,61,.25))}
.lair-stage-svg{width:100%;height:220px;overflow:hidden}
.lair-stage-svg svg{width:100%;height:100%;display:block}
.lair-meta{padding:.5rem .8rem;border-top:1px solid var(--line);
  display:flex;flex-direction:column;gap:.2rem;background:#0d0a08}
.lair-meta .boss-focal{font-family:"Arial Black",system-ui,sans-serif;text-transform:uppercase;
  letter-spacing:.12em;font-size:.82rem;color:var(--racc,var(--ember-hi))}
.lair-meta .boss-read{font-family:Georgia,serif;font-style:italic;color:var(--paper);font-size:.82rem}
.boss-state-marker{display:inline-block;margin-top:.35rem;padding:.3rem .6rem;border-radius:2px;
  font-family:"Arial Black",system-ui,sans-serif;text-transform:uppercase;letter-spacing:.08em;font-size:.72rem}
.boss-state-marker.slain{color:#fff;background:#7a1f1f;border:1px solid #c0421f}
.boss-state-marker.finale{color:#1b0f06;background:var(--ember-hi,#f4a25c);border:1px solid #ffd08a}

/* ---- Objective plate with state semantics ---- */
.obj-plate{display:flex;align-items:center;gap:.6rem;padding:.5rem .8rem;margin-bottom:.6rem;
  border:1px solid var(--line);border-left:5px solid var(--ember);border-radius:2px;
  background:linear-gradient(90deg,#1b1711,#13100b)}
.obj-plate .obj-shape{width:1.6rem;height:1.6rem;flex:0 0 auto;display:flex;align-items:center;justify-content:center;
  border-radius:50%;background:var(--ember);color:#fff;font-size:.95rem;
  box-shadow:0 0 10px var(--ember-glow)}
.obj-plate .obj-text{color:var(--paper);font-size:.85rem}
.obj-plate .obj-text b{color:var(--parchment)}
.obj-plate.st-active{--accent:var(--ember);}
.obj-plate.st-active .obj-shape{background:var(--ember)}
.obj-plate.st-complete{--accent:var(--verdigris);border-left-color:var(--verdigris)}
.obj-plate.st-complete .obj-shape{background:var(--verdigris);box-shadow:0 0 10px rgba(63,143,127,.7)}
.obj-plate.st-afflicted{--accent:var(--ember);border-left-color:var(--ember)}
.obj-plate.st-afflicted .obj-shape{background:var(--ember)}

/* ---- DD-style action chrome: explicit colour+shape state semantics ---- */
.exp-actions button{border-left:4px solid var(--line)}
.exp-actions button.st-available{border-left-color:var(--verdigris)}
.exp-actions button.st-available::before{content:"▸ ";color:var(--verdigris)}
.exp-actions button.st-here{border-left-color:var(--ember-hi)}
.exp-actions button.st-here::before{content:"◆ ";color:var(--ember-hi)}
.exp-actions button.st-locked{opacity:.55;border-left-color:var(--disabled)}
.exp-actions button.st-locked::before{content:"🔒 "}
.exp-actions button.st-focus{outline:3px solid var(--ember-glow)}

/* ---- Provision screen chrome ---- */
.provision-screen,.camp-screen{display:block}
.provision-head,.camp-head{display:flex;align-items:center;justify-content:space-between;gap:.6rem;
  padding:.5rem .8rem;margin-bottom:.6rem;background:linear-gradient(90deg,#1b1711,#120d08);
  border:1px solid var(--line);border-left:4px solid var(--racc,var(--ember));border-radius:2px}
.provision-head b,.camp-head b{color:var(--parchment)}
.provision-head span,.camp-head span{font-family:system-ui,sans-serif;font-size:.72rem;
  padding:.15rem .5rem;border:1px solid var(--line);border-radius:3px}
.provision-head span.st-available,.camp-head span.st-available{color:var(--verdigris);border-color:var(--verdigris)}
.provision-head span.st-locked,.camp-head span.st-locked{color:var(--disabled)}
.provision-head span.st-focused,.camp-head span.st-focused{color:var(--ember-hi);border-color:var(--ember-hi)}
.provision-row{border-left:3px solid var(--racc,transparent)}
.provision-row button.st-available{border-left-color:var(--verdigris)}
.provision-row button.st-focused{border-left-color:var(--ember-hi)}
.provision-row button.st-locked{opacity:.55}
.provision-row button.st-disabled{opacity:.4}

/* ---- Curio chrome ---- */
.curio-btn{font-family:system-ui,sans-serif;text-align:left;background:linear-gradient(180deg,#211c15,#17130d);
  border:2px solid #2d271c;color:var(--paper);padding:.5rem .6rem;border-radius:3px;cursor:pointer;font-size:.78rem}
.curio-btn.st-available{border-color:var(--verdigris)}
.curio-btn.st-disabled{opacity:.4}
.curio-btn:focus,.curio-btn:hover{outline:3px solid var(--ember-glow);border-color:var(--ember-hi)}
.curios-grid{grid-template-columns:repeat(auto-fill,minmax(170px,1fr))}

/* ---- Camp screen (readable state, not a single button) ---- */
.camp-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:.6rem;margin-bottom:.6rem}
.camp-card{display:flex;flex-direction:column;gap:.2rem;padding:.6rem;border:2px solid #2d271c;border-radius:3px;
  background:linear-gradient(180deg,#1f1a14,#151109);border-top:4px solid #4a443a}
.camp-card.available{border-top-color:var(--verdigris)}
.camp-card.focused{border-color:var(--racc,var(--ember));outline:2px solid var(--ember-glow);transform:translateY(-2px)}
.camp-card.locked{opacity:.55;border-top-color:var(--disabled);border-style:dashed}
.camp-cost{font-family:system-ui,sans-serif;font-size:.72rem;align-self:flex-start;
  padding:.1rem .4rem;border-radius:3px;border:1px solid var(--line)}
.camp-cost.available{color:var(--verdigris);border-color:var(--verdigris)}
.camp-cost.locked{color:var(--disabled)}
.camp-name{font-family:Georgia,serif;color:var(--parchment)}
.camp-effect{font-family:system-ui,sans-serif;font-size:.7rem;color:var(--paper-dim)}
.camp-party{flex-direction:row;flex-wrap:wrap;gap:.4rem;margin-bottom:.6rem}
.camp-party .hero{flex:1 1 180px;border-left-color:var(--racc,var(--ember))}
.camp-state{padding:.2rem .5rem;border-radius:3px;font-size:.72rem;border:1px solid var(--line)}
.camp-state.st-available{color:var(--verdigris);border-color:var(--verdigris)}
.camp-state.st-disabled{color:var(--disabled)}

/* ---- Narrator plate (chapter 1-2 chrome) ---- */
.narrator-plate{margin-top:.7rem;padding:.5rem .8rem;border:1px solid var(--line);
  border-left:4px solid var(--gold-ink);border-radius:2px;background:linear-gradient(90deg,#17130e,#100d08)}
.narrator-plate h3{margin:0 0 .3rem;font-size:.72rem;color:var(--gold-ink)}
.narr-log{margin:0;padding-left:1.2rem;max-height:8vh;overflow-y:auto}
.narr-log .nar{color:var(--paper-dim);font-style:italic;font-family:Georgia,serif;font-size:.8rem}
.narr-log .nar.nar-new{color:var(--parchment)}
.narr-log .nar.nar-new::before{content:"— "}

/* ---- JEE-1286 atlas sprite surfaces (authored W2 frame crops) ---- */
.atlas-loading{display:inline-block;width:32px;height:32px;opacity:.4}
.missing-art{display:block;max-width:100%;border-radius:2px}
.atlas-hero,.atlas-enemy,.atlas-boss,.atlas-hamlet,.atlas-facicon,
.atlas-hero-chip,.atlas-hero-party,.atlas-enemy-band{display:block;image-rendering:auto}
.atlas-ui-stat,.atlas-ui-pt{display:inline-block;vertical-align:middle}
.atlas-facicon{width:180px;height:120px;border:1px solid var(--line);border-radius:3px;background:#14110c}

/* Party-select hero chips now carry an authored portrait crop. */
.hero-chip{display:inline-flex;flex-direction:column;align-items:center;gap:.3rem;
  padding:.4rem .5rem .5rem;border:1px solid var(--line);border-radius:3px;
  background:linear-gradient(180deg,#1c1812,#120f0b);color:var(--parchment);
  font-family:system-ui,sans-serif;font-size:.72rem;cursor:pointer}
.hero-chip:hover{border-color:var(--ember)}
.hero-chip.on{border-color:var(--ember);box-shadow:0 0 0 1px var(--ember)}
.hero-chip[aria-disabled="true"]{opacity:.45;cursor:not-allowed}
.hero-chip-art{width:64px;height:64px}
.hero-chip-art svg{width:64px;height:64px;display:block}

/* Run-surface party + enemy bands. */
.party-zone{margin-top:.4rem}
.party{display:flex;gap:.5rem;flex-wrap:wrap}
.party .hero{display:flex;align-items:center;gap:.5rem;flex:1 1 240px;min-width:0}
.party .hero .hero-art{width:96px;height:96px;flex:0 0 96px}
.party .hero .hero-art svg{width:96px;height:96px;display:block}
.party .hero .hero-info{display:flex;flex-direction:column;min-width:0}
.enemy-band{margin:.3rem 0 .5rem;padding:.4rem .6rem;border:1px solid var(--line);
  border-left:4px solid var(--danger);border-radius:2px;background:linear-gradient(90deg,#1a1210,#100c0a)}
.enemy-band-label{display:block;font-family:system-ui,sans-serif;font-size:.68rem;
  color:var(--danger);letter-spacing:.04em;text-transform:uppercase;margin-bottom:.3rem}
.enemy-band-row{display:flex;gap:.6rem;flex-wrap:wrap}
.enemy-unit{display:flex;flex-direction:column;align-items:center;gap:.15rem}
.enemy-unit-art{width:96px;height:96px}
.enemy-unit-art svg{width:96px;height:96px;display:block}
.enemy-unit-count{font-family:system-ui,sans-serif;font-size:.68rem;color:var(--paper-dim)}

/* ---- JEE-1286: vista + roster + curio/panel/portrait authored-frame layout ---- */
.atlas-hamlet-vista{width:100%;height:auto;display:block;filter:drop-shadow(0 10px 6px rgba(0,0,0,.55))}
.atlas-hero-roster{width:96px;height:96px;display:block;flex:0 0 96px}
.atlas-hero-recr{width:64px;height:64px;display:block;flex:0 0 64px}
.atlas-ui-curio{display:inline-block;vertical-align:middle;image-rendering:auto}
.atlas-ui-panel{display:block}
.atlas-ui-panel-pf{display:block;width:56px;height:68px}
.atlas-ui-panel-obj{display:block;width:120px;height:76px}

/* Main roster cards (M3 #roster) now carry hero art instead of text-only. */
#roster .hero{display:flex;align-items:center;gap:.6rem}
#roster .hero .hero-art{width:96px;height:96px;flex:0 0 96px}
#roster .hero .hero-art svg{width:96px;height:96px;display:block}
#roster .hero .hero-cols{display:flex;flex-direction:column;min-width:0;gap:.1rem}
#roster .hero .hero-portrait{flex:0 0 auto;position:relative;display:flex;align-items:center;justify-content:center}
#roster .hero .hero-portrait .atlas-ui-panel-pf{position:absolute;inset:0}
#roster .hero .hero-portrait .hero-pt-crop{position:relative;z-index:1;width:44px;height:56px;overflow:hidden;display:flex}
#roster .hero .hero-portrait .hero-pt-crop svg{width:44px;height:56px;display:block}

/* Recruit/full-roster cards in the Stage Coach facility. */
.cards .card{display:flex;align-items:center;gap:.5rem}
.cards .card .hero-art{flex:0 0 auto}
.cards .card .hero-art svg{width:64px;height:64px;display:block}

/* Party band portrait frame module. */
.party .hero .hero-portrait{flex:0 0 auto;position:relative;display:flex;align-items:center;justify-content:center;width:56px;height:68px}
.party .hero .hero-portrait .atlas-ui-panel-pf{position:absolute;inset:0}
.party .hero .hero-portrait .hero-pt-crop{position:relative;z-index:1;width:44px;height:56px;overflow:hidden;display:flex}
.party .hero .hero-portrait .hero-pt-crop svg{width:44px;height:56px;display:block}

/* Curio buttons now mount the authored W2c curio cell. */
.curio-btn{display:flex;align-items:center;gap:.4rem}
.curio-btn .curio-lbl{flex:1;min-width:0}
.curio-btn .atlas-ui-curio{flex:0 0 auto}

/* Objective plaque carries the authored ui:panel objective-plaque module. */
.obj-plate{position:relative;overflow:hidden}
.obj-plate .obj-plaque-art{position:absolute;inset:0;opacity:.9;pointer-events:none}
.obj-plate .obj-plaque-art svg{width:100%;height:100%;object-fit:cover}
.obj-plate .obj-shape,.obj-plate .obj-text{position:relative;z-index:1}

/* JEE-1314 — reference-driven Hamlet rebuild. The home surface deliberately
   bypasses the legacy hamlet atlas cropper: each building maps to one unique
   cell in the new original component sheet, eliminating duplicated coaches. */
body{background:#080706}
.app{grid-template-rows:64px minmax(0,1fr) 42px;grid-template-columns:minmax(0,1fr) 330px;
  grid-template-areas:"hud hud" "vista rail" "hint rail";background:#090807}
.hud{padding:.55rem 1.2rem;border-bottom:3px solid #3e2a1c;background:linear-gradient(#171310,#090807)}
.hud h1{font-family:Georgia,serif;font-size:1.35rem;text-transform:uppercase;letter-spacing:.11em}
.hud h1::first-line{color:#eadab5}.stocks{align-items:center;background:#0a0907;border:1px solid #493623;padding:.38rem .7rem}
.stocks b{font-size:1rem}.stocks b,.stocks .heir{display:flex;align-items:center;gap:.3rem}.stocks .heir{color:#c7b792;border-left:1px solid #493623;padding-left:.6rem}
.stocks .resource-art{width:29px;height:29px;flex:0 0 29px;background-image:var(--component);background-size:contain;background-position:center;background-repeat:no-repeat;filter:drop-shadow(0 2px 2px #000)}
.vista{min-height:0;background:#100d0b url('public/estate/hamlet-rebuild/hamlet-environment.png') center/cover no-repeat;border-right:4px solid #261b13}
.vista::before{display:none}.plaza,.torch{display:none!important}
/* visible cobblestone approaches from the central plaza rise to every gate */
#paths{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1;overflow:visible}
#paths .road{fill:none;stroke:#2b2016;stroke-width:14;stroke-linecap:round;opacity:.18}
#paths .road:nth-child(2n){stroke:#1d1510;stroke-width:8;opacity:.22}
.bld{gap:.15rem;filter:drop-shadow(0 10px 8px rgba(0,0,0,.62));transition:transform .18s ease,filter .18s ease}
.bld.back{filter:drop-shadow(0 5px 4px rgba(0,0,0,.5)) saturate(.8) brightness(.8)}
.bld .glyph{aspect-ratio:1.45/1;display:block;background:transparent;filter:drop-shadow(0 10px 6px rgba(0,0,0,.55))}
.bld .tag{opacity:0;transform:translateY(5px);transition:.18s;background:#0b0907e8;border:1px solid #8d4a24;padding:.18rem .4rem;color:#e4c99b}
.bld:hover .tag,.bld:focus-visible .tag,.bld.focused .tag{opacity:1;transform:none}
.bld .badge{width:1.45rem;height:1.45rem;top:-.3rem;right:-.2rem}.bld .tag b{font-size:.72rem}.bld .tag{font-size:.62rem}
.hamlet-component{display:block;width:100%;height:100%;background-image:url('public/estate/hamlet-rebuild/hamlet-components.png');background-size:500% 400%;background-repeat:no-repeat}
.component-0{background-position:0 0}.component-1{background-position:25% 0}.component-2{background-position:50% 0}.component-3{background-position:75% 0}.component-4{background-position:100% 0}
.component-5{background-position:0 33.333%}.component-6{background-position:25% 33.333%}.component-7{background-position:50% 33.333%}.component-8{background-position:75% 33.333%}.component-9{background-position:100% 33.333%}
.component-10{background-position:0 66.666%}.component-11{background-position:25% 66.666%}.component-13{background-position:75% 66.666%}.component-14{background-position:100% 66.666%}
.bld{z-index:3}.bld.back{z-index:1}.focal{z-index:2}
.focal{left:50%;transform:translateX(-50%);width:158px;height:236px;background-image:url('public/estate/hamlet-rebuild/hamlet-components.png');background-size:500% 400%;background-position:50% 66.666%;background-repeat:no-repeat;filter:drop-shadow(0 14px 12px rgba(0,0,0,.75)) sepia(.18)}
.focal .pyxis{display:none}
.scene-prop{position:absolute;z-index:3;pointer-events:none;filter:drop-shadow(0 8px 7px #000)}
.prop-dead-tree{left:1%;bottom:7%;width:14%;height:47%}.prop-market-stall{right:2%;bottom:7%;width:17%;height:28%}
.prop-lantern-post{left:43%;bottom:8%;width:7%;height:29%}.prop-crates-signpost{right:18%;bottom:7%;width:12%;height:22%}
.rail{padding:0;background:linear-gradient(90deg,#0b0907,#17120e);border:0;display:flex;flex-direction:column;gap:0;overflow:hidden;box-shadow:-10px 0 30px #000}
.rail .col{padding:.65rem .8rem}.rail .weekly-col{order:3;border-top:1px solid #38291e}.rail .action-col{order:2;padding:.5rem .8rem}
.rail h2{font-size:.72rem;letter-spacing:.14em;color:#d9c49c;border-color:#4a3425}
.roster-tabs{display:grid;grid-template-columns:1fr 1fr;margin:-.65rem -.8rem .6rem}
.roster-tabs button{padding:.7rem;border:0;border-bottom:2px solid #3b2a20;background:#0c0a08;color:#857866;text-transform:uppercase;letter-spacing:.12em}
.roster-tabs .active{color:#f0d9ad;background:#211710;border-bottom-color:#a74321}
.roster{max-height:none;overflow:auto}.roster .hero{min-height:88px;padding:.25rem;background:linear-gradient(90deg,#241a13,#0e0c09);border-left:0;border-bottom:1px solid #3a2b20}
#roster .hero .hero-art{width:68px;height:76px;flex-basis:68px;overflow:hidden;border:2px solid #473226;background:#090807}
#roster .hero .hero-cols{font-size:.82rem}.hero-bust{background-position:100% 100%}
#roster .hero>.hero-portrait{display:none}.savebar{display:grid;grid-template-columns:1fr 1fr;gap:.35rem}.savebar #openEmbark{grid-column:1/-1;font-size:1.55rem;font-weight:900;letter-spacing:.18em;padding:.95rem 1rem;background:radial-gradient(circle at 50% 0,#ff9a3d,#ba4e21 60%,#4a1508);border:3px double #ffb066;box-shadow:0 0 30px #d24a1477,inset 0 -8px 18px rgba(0,0,0,.45);text-shadow:0 2px 3px rgba(0,0,0,.7);animation:embarkPulse 2.2s ease-in-out infinite}
@keyframes embarkPulse{0%,100%{box-shadow:0 0 24px #d24a1477,inset 0 -8px 18px rgba(0,0,0,.45)}50%{box-shadow:0 0 44px #ff7a2a99,inset 0 -8px 18px rgba(0,0,0,.45)}}
.savebar #openEmbark:hover,.savebar #openEmbark:focus-visible{filter:brightness(1.15);transform:translateY(-1px)}
.savebar #openEmbark::before{content:"⚔ ";color:#ffe0ae}.savebar button{white-space:normal;font-size:.68rem;padding:.4rem}.weekly-col .log{max-height:80px;font-size:.68rem}
.hintbar{font-size:.65rem;padding:.35rem;background:#090807;border-top:1px solid #33251c}
@media(max-width:1400px){.app{grid-template-columns:minmax(0,1fr) 286px}.hud h1{font-size:1rem}.stocks{font-size:.7rem}.rail .weekly-col{display:none}}

/* ---- BOARD DIRECTIVE 2026-08-30: blending & placement self-check ----
   Ground contact, roads to gates, lighting consistency, scale consistency. */

/* 1. Planted contact shadow under every building so nothing floats in the air. */
.bld::after{content:"";position:absolute;left:8%;right:8%;bottom:-8px;height:18px;
  background:radial-gradient(ellipse 50% 100% at 50% 100%, rgba(0,0,0,.6), rgba(0,0,0,0) 72%);
  filter:blur(3px);pointer-events:none;z-index:-1}

/* 2. Hill/mound footing + contact shadow for the raised back tier: the silhouette
      now stands on a ridge instead of hanging in the sky. */
.bld.back{filter:drop-shadow(0 5px 4px rgba(0,0,0,.5)) saturate(.8) brightness(.78)}
.bld.back::before{content:"";position:absolute;left:18%;right:18%;bottom:-46%;height:70%;
  background:radial-gradient(ellipse 50% 55% at 50% 100%, rgba(13,16,12,.92), rgba(13,16,12,0) 72%);
  pointer-events:none;z-index:-2}
.bld.back::after{left:14%;right:14%;bottom:-10px;height:22px;
  background:radial-gradient(ellipse 55% 100% at 50% 100%, rgba(0,0,0,.55), rgba(0,0,0,0) 74%)}

/* 3. Lighting consistency: dim the left forest-edge prop that reads as a glow
      source with no emitter, and keep scene props range-checked to the dark gothic tone. */
.scene-prop{filter:drop-shadow(0 8px 7px #000) saturate(.92) brightness(.94)}
.prop-dead-tree{filter:drop-shadow(0 8px 7px #000) saturate(.82) brightness(.66)}
.prop-market-stall{filter:drop-shadow(0 8px 7px #000) saturate(.9) brightness(.9)}
.prop-crates-signpost{filter:drop-shadow(0 8px 7px #000) saturate(.9) brightness(.88)}
.prop-lantern-post{filter:drop-shadow(0 8px 7px #000) saturate(.95) brightness(.98)}

/* ---------- Character sheet (JEE-1374) ---------- */
/* Roster rail heroes become full-row buttons that open the DD-style sheet. */
#roster .hero{width:100%;text-align:left;font:inherit;color:inherit;cursor:pointer;
  display:flex;align-items:center;gap:.6rem}
#roster .hero:hover,#roster .hero:focus-visible{
  border-left-color:var(--gold-ink);outline:1px solid var(--gold-ink);
  box-shadow:inset 0 0 0 1px var(--gold-ink)}
#roster .hero .hname,#roster .hero .hmeta{pointer-events:none}

.dialog.charsheet,.facility.charsheet{width:min(1080px,96vw)}
.cs-header{display:flex;align-items:center;gap:1.2rem;padding:.4rem 1.4rem 1rem}
.cs-id{display:flex;flex-direction:column;align-items:flex-start;gap:.2rem;min-width:0}
.cs-id h2{margin:.1rem 0 0;font-family:Georgia,serif;color:var(--parchment);font-size:1.6rem;letter-spacing:.02em}
.cs-id p{margin:.1rem 0 0}
.cs-shield{width:44px;height:52px;position:relative;flex:0 0 44px;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(180deg,#42200c,#2a1306);border:3px solid var(--gold-ink);border-radius:6px;overflow:hidden}
.cs-shield .cs-shield-emblem{position:absolute;inset:0;display:block}
.cs-shield .cs-shield-emblem svg{width:100%;height:100%;display:block;object-fit:cover}
.cs-shield .cs-shield-letter{position:relative;z-index:1;color:#0c0804;font-family:Georgia,serif;font-size:1.5rem;font-weight:700;
  text-shadow:0 0 3px rgba(212,175,55,.8),0 1px 2px rgba(0,0,0,.6)}
.cs-vitals{margin-left:auto;display:flex;flex-direction:column;gap:.35rem;font-family:system-ui,sans-serif;font-size:.85rem;color:var(--paper-dim)}
.cs-vitals b{color:var(--parchment);font-weight:600}
.cs-vitals .cs-v{display:flex;justify-content:space-between;gap:1rem}

/* Authored three-column grid (JEE-1375): left portrait/gear/trinkets, center
   quirks/stats, right pref/skills/resists/mods — 1-to-1 with the DD reference. */
.cs-cols{display:grid;grid-template-columns:minmax(0,236px) minmax(0,1fr) minmax(0,1fr);gap:1.1rem 1.4rem;padding:0 1.4rem}
.cs-col{min-width:0;display:flex;flex-direction:column;gap:.55rem}
.cs-section{margin:.15rem 0 .1rem;font-size:.78rem;letter-spacing:.08em;text-transform:uppercase;color:var(--gold-ink);border-bottom:1px solid var(--line);padding-bottom:.2rem}
.cs-col .cs-section:first-child{margin-top:0}

/* Left column — full-body portrait + equipment + trinkets */
.cs-col-left .cs-portrait{width:100%;aspect-ratio:5/6;flex:0 0 auto;overflow:hidden;border:3px solid var(--line);border-radius:3px;background:#0b0a07}
.cs-col-left .cs-portrait svg{width:100%;height:100%;display:block;object-fit:cover}
.cs-equip{display:flex;align-items:center;gap:.55rem;padding:.3rem .4rem;border:1px solid var(--line);border-radius:3px;background:linear-gradient(180deg,#1d1812,#16120b)}
.cs-equip-slot{position:relative;flex:0 0 44px;width:44px;height:44px;display:flex;align-items:center;justify-content:center}
.cs-equip-slot .atlas-ui-cs-equip{position:absolute;inset:0;width:100%;height:100%;display:block}
.cs-equip-badge{flex:0 0 auto;min-width:30px;text-align:right;font-family:Georgia,serif;color:var(--parchment);font-weight:700}
.cs-equip-badge .atlas-ui-cs-level{width:26px;height:26px;display:inline-block;vertical-align:middle}
.cs-equip-main{display:flex;flex-direction:column;gap:.1rem;flex:1;min-width:0}
.cs-equip-main b{color:var(--parchment);font-family:Georgia,serif;font-size:.95rem}
.cs-equip-main .muted{font-family:system-ui,sans-serif;font-size:.72rem}
.cs-trinks{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem;align-items:start}
.cs-trink{display:flex;flex-direction:column;align-items:center;gap:.25rem;padding:.35rem .3rem;border:1px solid var(--line);border-radius:3px;background:linear-gradient(180deg,#1d1812,#16120b)}
.cs-trink-slot{position:relative;width:48px;height:48px;display:flex;align-items:center;justify-content:center}
.cs-trink-slot .atlas-ui-cs-trinket-slot,.cs-trink-slot .atlas-ui-cs-trinket-empty{position:absolute;inset:0;width:100%;height:100%;display:block}
.cs-trink-icon{position:relative;z-index:1}
.cs-trink-icon svg{width:32px;height:32px;display:block}
.cs-trink-name{font-family:system-ui,sans-serif;font-size:.66rem;color:var(--paper);text-align:center;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cs-trink-empty{opacity:.75}
.cs-trink-empty .muted{font-family:system-ui,sans-serif;font-size:.64rem}

/* Center column — quirks + base-stats grid */
.cs-quirks{display:flex;flex-direction:column;gap:.4rem}
.cs-quirk{position:relative;min-height:40px;display:flex;align-items:center;gap:.5rem;padding:.35rem .4rem;border-radius:3px}
.cs-quirk-art{position:absolute;inset:0;width:100%;height:100%;display:block}
.cs-quirk-art .atlas-ui-cs-quirk{width:100%;height:100%;display:block}
.cs-quirk-txt{position:relative;z-index:1;display:flex;flex-direction:column;gap:.05rem;min-width:0}
.cs-quirk-txt b{font-family:Georgia,serif;font-size:.9rem}
.cs-quirk-positive .cs-quirk-txt b{color:var(--gold-ink)}
.cs-quirk-negative .cs-quirk-txt b{color:#e05252}
.cs-quirk-txt .muted{font-family:system-ui,sans-serif;font-size:.68rem;color:var(--paper-dim)}
.cs-quirks .cs-quirk:has(> .muted){justify-content:center;color:var(--paper-dim)}
.cs-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.45rem}
.cs-stat{display:flex;align-items:center;gap:.5rem;padding:.35rem .4rem;border:1px solid var(--line);border-radius:3px;background:linear-gradient(180deg,#1d1812,#16120b)}
.cs-stat-icon{flex:0 0 34px;width:34px;height:34px;display:flex;align-items:center;justify-content:center}
.cs-stat-icon svg{width:34px;height:34px;display:block}
.cs-stat-bdy{display:flex;flex-direction:column;gap:.05rem;min-width:0}
.cs-stat-label{font-family:system-ui,sans-serif;font-size:.62rem;letter-spacing:.05em;color:var(--paper-dim);text-transform:uppercase}
.cs-stat-bdy b{font-family:Georgia,serif;color:var(--parchment);font-size:1.05rem;white-space:nowrap}

/* Right column — preferred position/target aggregates + skills + resists + mods */
.cs-pref{display:flex;flex-direction:column;gap:.3rem;padding:.5rem .6rem;border:1px solid var(--line);border-radius:3px;background:linear-gradient(180deg,#1d1812,#16120b)}
.cs-pref-row{display:flex;align-items:center;gap:.5rem;font-family:system-ui,sans-serif;font-size:.72rem;color:var(--paper)}
.cs-skills{display:flex;flex-direction:column;gap:.45rem}
.cs-skill{display:flex;flex-direction:row;gap:.55rem;padding:.45rem .6rem;background:linear-gradient(180deg,#201b14,#171309);border:1px solid var(--line);border-radius:3px;text-align:left;font:inherit;color:inherit;cursor:pointer}
.cs-skill:hover{border-color:var(--gold-ink)}
.cs-skill-icon{flex:0 0 40px;width:40px;height:40px;display:flex;align-items:center;justify-content:center}
.cs-skill-icon svg{width:40px;height:40px;display:block}
.cs-skill-main{display:flex;flex-direction:column;gap:.12rem;min-width:0}
.cs-skill-name{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem}
.cs-skill-name b{color:var(--parchment);font-family:Georgia,serif;font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cs-skill-tier{font-family:system-ui,sans-serif;font-size:.68rem}
.cs-skill-effect{font-family:system-ui,sans-serif;font-size:.7rem;color:var(--verdigris);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cs-skill-pos,.cs-skill-tgt{display:flex;align-items:center;gap:.4rem;font-family:system-ui,sans-serif;font-size:.66rem;color:var(--paper-dim)}
.cs-dots{display:inline-flex;gap:3px}
.cs-dot-label{min-width:48px}
.dot{width:10px;height:10px;display:inline-block;border-radius:50%;border:1px solid var(--line);background:transparent;font-style:normal}
.dot.pos.on{background:var(--gold-ink);border-color:var(--gold-ink)}
.dot.tgt.on{background:var(--danger);border-color:var(--danger)}

.cs-res-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.2rem .8rem}
.cs-res{display:flex;justify-content:space-between;gap:1rem;padding:.22rem 0;font-family:system-ui,sans-serif;font-size:.76rem;border-bottom:1px dashed #2b261d}
.cs-res b{color:var(--parchment);font-weight:600}
.cs-mods{margin:.1rem 0 0;padding-left:1.2rem;font-family:system-ui,sans-serif;font-size:.76rem;color:var(--paper);display:flex;flex-direction:column;gap:.25rem}
.cs-mods b{color:var(--parchment);font-weight:600}
.cs-close-row{display:flex;justify-content:center;padding:1rem 1.4rem 1.4rem}
.cs-close{padding:.6rem 1.6rem}
@media (max-width:860px){.cs-cols{grid-template-columns:1fr}.cs-vitals{margin-left:0}}

/* Character sheet skill tooltip (custom component on the atlas tooltip frame). */
.cs-skill{position:relative}
.cs-skill:focus-visible{outline:2px solid var(--gold-ink);outline-offset:1px}
.cs-skill .cs-tooltip{position:absolute;left:50%;bottom:calc(100% + 6px);transform:translateX(-50%);
  min-width:250px;max-width:300px;z-index:20;pointer-events:none;opacity:0;visibility:hidden;
  transition:opacity .12s ease}
.cs-skill:hover .cs-tooltip,.cs-skill:focus .cs-tooltip,.cs-skill:focus-visible .cs-tooltip{opacity:1;visibility:visible}
.cs-skill .cs-tooltip .atlas-ui-panel-tooltip{position:absolute;inset:0;width:100%;height:100%;display:block}
.cs-skill .cs-tip-inner{position:relative;z-index:1;display:flex;flex-direction:column;gap:.2rem;padding:.6rem .8rem;
  font-family:system-ui,sans-serif;font-size:.74rem;color:var(--paper);min-width:0}
.cs-skill .cs-tip-inner b{font-family:Georgia,serif;color:var(--parchment);font-size:.9rem}
.cs-skill .cs-tip-inner .cs-tip-line{font-size:.74rem}
.cs-skill .cs-tip-inner .muted{font-size:.68rem;line-height:1.25}

/* Character sheet window-kit frame (JEE-1373 atlas) as a backdrop layer over the
   CSS sheet; contents sit above it on the authored parchment. */
.cs-window{position:relative}
.cs-window .atlas-ui-cs-window{position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none}
.cs-window-inner{position:relative;z-index:1}
