:root{
  --bg:#0c1012;
  --stone-top:#171a18;
  --stone-bot:#101311;
  --stone-card:#1b1e1c;
  --stone-hi:#222623;
  --stone-inset:#121412;
  --stone-edge:#3d3a30;
  --stone-bevel:#4a463a;
  --stone-mute:#33302a;
  --ink:#e8e4d8;
  --ink-mid:#cfc9b8;
  --ink-soft:#b8b2a0;
  --gold:#d9b25c;
  --gold-hi:#e9c878;
  --gold-pale:#ffe7b4;
  --focus:#ffe0a8;
  --ember:#ff9f8a;
  --crimson:#c84b39;
  --teal:#6fd1b8;
  --moss:#5aa469;
  --role-tank:#8cc9f0;
  --role-heal:#9bddad;
  --role-dps:#f2d27a;
  --role-sup:#f0c778;
  --role-ally:#d8d2c0;
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;scrollbar-width:thin;scrollbar-color:var(--stone-edge) var(--stone-bot)}
*::-webkit-scrollbar{width:8px;height:8px}
*::-webkit-scrollbar-track{background:var(--stone-bot)}
*::-webkit-scrollbar-thumb{background:var(--stone-edge);border-radius:4px}
*::-webkit-scrollbar-thumb:hover{background:var(--gold)}

html,body{margin:0;height:100%;overflow:hidden;background:var(--bg);color:var(--ink);font-family:'IBM Plex Sans',system-ui,-apple-system,sans-serif;user-select:none}
button,input,select{font:inherit;color:inherit}

button{
  cursor:pointer;
  border-radius:8px;
  border:1.5px solid var(--stone-edge);
  background:var(--stone-top);
  color:var(--ink-mid);
  padding:9px 13px;
  min-height:44px;
  font-weight:600;
  box-shadow:inset 0 1px 0 rgba(74,70,58,.55),0 2px 8px rgba(0,0,0,.35);
  transition:transform .12s ease,border-color .15s ease,background-color .15s ease,box-shadow .15s ease,color .15s ease;
}
button:hover:not(:disabled){border-color:var(--gold);color:var(--gold-pale);background:#1f2320}
button:active:not(:disabled){transform:translateY(1px)}
button:disabled{
  cursor:not-allowed;
  background:#141614;
  border-color:var(--stone-mute);
  color:var(--ink-soft);
  box-shadow:none;
}
button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,canvas:focus-visible,a:focus-visible,[tabindex]:focus-visible{
  outline:2px solid var(--focus);
  outline-offset:2px;
}

input,select{
  width:100%;
  min-height:44px;
  padding:9px 12px;
  border-radius:8px;
  border:1.5px solid var(--stone-edge);
  background:var(--stone-inset);
  color:var(--ink);
  box-shadow:inset 0 2px 5px rgba(0,0,0,.45);
  user-select:text;
}
input:hover,select:hover{border-color:var(--stone-bevel)}
select{
  appearance:none;
  -webkit-appearance:none;
  padding-right:36px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3 5.2L7 9.2l4-4' fill='none' stroke='%23d9b25c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 11px center;
  cursor:pointer;
}
select option{background:#121412;color:#e8e4d8}

#app{position:fixed;inset:0;overflow:hidden}
#scene{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;outline:none}

.topbar{
  position:fixed;top:0;left:0;right:0;z-index:12;
  display:flex;justify-content:space-between;align-items:flex-start;gap:12px;
  padding:max(10px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) 10px max(14px,env(safe-area-inset-left));
  background:linear-gradient(180deg,rgba(9,12,13,.88),rgba(9,12,13,.38) 68%,transparent);
  pointer-events:none;
}
.eyebrow{
  display:block;
  font-size:11px;
  letter-spacing:.16em;
  text-transform:uppercase;
  color:var(--gold);
  font-weight:700;
}
h1,h2,h3{
  font-family:'Cormorant Garamond',Georgia,serif;
  font-weight:600;
  margin:0;
  letter-spacing:.01em;
  color:var(--ink);
}
.topbar h1{font-size:clamp(21px,3.2vw,30px);line-height:1;text-shadow:0 2px 12px #000}
.test-tag{
  padding:5px 9px;
  border:1px solid rgba(217,178,92,.48);
  border-radius:8px;
  background:rgba(16,19,17,.9);
  color:var(--gold-pale);
  font-size:10px;
  font-weight:700;
  letter-spacing:.09em;
  text-align:right;
  line-height:1.25;
}
.test-tag small{font-weight:500;letter-spacing:.02em;color:var(--ink-soft)}

/* Carved Stone & Ember Slabs */
.stone-slab{
  background:linear-gradient(180deg,var(--stone-top),var(--stone-bot));
  color:var(--ink);
  border:2px solid var(--stone-edge);
  border-radius:10px;
  box-shadow:inset 0 1px 0 var(--stone-bevel),0 8px 32px rgba(0,0,0,.58);
}

.primary,.trial-cta{
  width:100%;
  background:linear-gradient(180deg,#322c22,#242019);
  color:var(--gold-pale);
  border:2px solid var(--gold);
  padding:12px 15px;
  font-weight:700;
  box-shadow:inset 0 1px 0 rgba(255,231,180,.24),0 6px 18px rgba(0,0,0,.46);
}
.primary:hover:not(:disabled),.trial-cta:hover:not(:disabled){
  border-color:var(--gold-hi);
  background:linear-gradient(180deg,#3b3326,#2a241c);
  color:#fff4d6;
  box-shadow:inset 0 1px 0 rgba(255,231,180,.34),inset 0 -12px 20px -10px rgba(255,159,138,.32),0 6px 20px rgba(217,178,92,.22);
}
.primary span{display:block;font-size:12px;font-weight:500;color:var(--ink-mid);margin-top:2px}

.danger-btn{
  background:#281a17;
  border-color:var(--ember);
  color:#ffd8cf;
}
.danger-btn:hover:not(:disabled){
  background:#34201c;
  border-color:#ffb8a8;
  color:#fff0ec;
}

@keyframes trialPulse{
  0%,100%{box-shadow:inset 0 1px 0 rgba(255,231,180,.24),0 0 0 0 rgba(111,209,184,.36),0 6px 18px rgba(0,0,0,.46)}
  50%{box-shadow:inset 0 1px 0 rgba(255,231,180,.34),0 0 18px 2px rgba(111,209,184,.34),0 6px 18px rgba(0,0,0,.46)}
}
.trial-cta{
  border-color:var(--teal);
  background:linear-gradient(180deg,#1d2e2a,#14211e);
  color:#dffaf2;
  animation:trialPulse 2.4s ease-in-out infinite;
}
.trial-cta:hover:not(:disabled){
  border-color:#93e5d0;
  background:linear-gradient(180deg,#233833,#182925);
  color:#ffffff;
}

/* HUD */
#hud{position:fixed;inset:0;z-index:10;pointer-events:none}
#hud button,#hud a,#campCard,#touchControls{pointer-events:auto}
#statusCol{
  position:fixed;
  top:max(54px,calc(env(safe-area-inset-top) + 42px));
  left:max(14px,env(safe-area-inset-left));
  display:grid;gap:7px;
  width:min(286px,54vw);
}
#sideCol{
  position:fixed;
  top:max(54px,calc(env(safe-area-inset-top) + 42px));
  right:max(14px,env(safe-area-inset-right));
  display:grid;gap:8px;justify-items:end;
  max-width:52vw;
}
#sideCol button,#sideCol canvas{pointer-events:auto}

.vitals,#encounter,.tools button,#campBack{
  background:linear-gradient(180deg,rgba(23,26,24,.94),rgba(16,19,17,.94));
  border:1.5px solid var(--stone-edge);
  box-shadow:inset 0 1px 0 rgba(74,70,58,.5),0 6px 20px rgba(0,0,0,.45);
}
.vitals{padding:8px 11px;border-radius:9px}
.vitals-top{display:flex;justify-content:space-between;align-items:center;gap:6px;flex-wrap:wrap;font-size:13px}
.vitals-meta{display:inline-flex;align-items:center;gap:6px;flex-wrap:wrap;font-variant-numeric:tabular-nums}
#heroLevel{color:var(--gold);font-weight:600;font-size:12px}
.catchup-chip{
  display:inline-flex;align-items:center;
  padding:1px 6px;border-radius:999px;
  font-size:10px;font-weight:700;letter-spacing:.03em;
  background:#152521;border:1px solid var(--teal);color:var(--teal);
  font-variant-numeric:tabular-nums;
}

.health{
  position:relative;height:17px;margin-top:5px;border-radius:6px;
  background:#0d0f0e;overflow:hidden;border:1px solid var(--stone-mute);
  font-variant-numeric:tabular-nums;
}
#hpFill{display:block;height:100%;width:100%;background:linear-gradient(90deg,#3d7b4d,#69b578);transition:width .14s}
.hp-shield{
  position:absolute;top:0;bottom:0;left:0;width:0;
  background:linear-gradient(90deg,rgba(217,178,92,.45),rgba(255,231,180,.72));
  border-right:1.5px solid var(--gold-pale);
  pointer-events:none;transition:width .14s;
}
#hpText{position:absolute;inset:0;display:grid;place-items:center;font-size:11px;font-weight:700;color:#f5f2e9;text-shadow:0 1px 3px #000}

.ammo-pips{display:flex;gap:4px;margin-top:5px;align-items:center}
.ammo-pips i{
  display:block;width:14px;height:6px;border-radius:3px;
  background:#131614;border:1px solid var(--stone-edge);
  transition:background-color .1s,border-color .1s;
}
.ammo-pips i.full{background:var(--gold);border-color:var(--gold-hi);box-shadow:0 0 6px rgba(217,178,92,.35)}
.ammo-pips.reloading i{border-color:var(--ember);background:#2a1915}

#partyVitals{display:grid;gap:4px}
.pf-comp{
  justify-self:start;padding:3px 9px;border-radius:6px;
  background:rgba(18,20,18,.94);border:1px solid var(--stone-edge);
  color:var(--gold);font-size:11px;font-weight:700;letter-spacing:.04em;
  font-variant-numeric:tabular-nums;
}
.pf-comp.bad{color:var(--ember);border-color:rgba(255,159,138,.55)}
.pf{
  display:grid;grid-template-columns:22px minmax(0,1fr) 74px;gap:6px;align-items:center;
  padding:4px 7px;border-radius:8px;
  background:rgba(18,20,18,.92);border:1px solid var(--stone-mute);
  font-size:11px;font-variant-numeric:tabular-nums;
}
.pf.you{border-color:rgba(217,178,92,.62)}
.pf.npc-flame{border-color:rgba(240,199,120,.65);background:rgba(30,24,16,.92)}
.pf.down{background:#181414;border-color:#4b2a25;color:var(--ink-soft)}
.pf b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;color:var(--ink)}
.pf em{font-style:normal;color:var(--gold);font-size:10px;margin-left:3px}
.pf i.buff{
  font-style:normal;display:inline-block;padding:0 5px;margin-left:3px;border-radius:4px;
  background:#152521;border:1px solid rgba(111,209,184,.55);color:var(--teal);font-size:9px;font-weight:700;
}
.pf i.buff.gold{background:#282214;border-color:rgba(217,178,92,.6);color:var(--gold-pale)}
.pf-hp{position:relative;height:13px;border-radius:5px;background:#0d0f0e;overflow:hidden;border:1px solid var(--stone-mute)}
.pf-hp span{display:block;height:100%;background:linear-gradient(90deg,#3d7b4d,#69b578)}
.pf-hp u.pf-shield{
  position:absolute;top:0;bottom:0;left:0;width:0;text-decoration:none;
  background:rgba(233,200,120,.55);border-right:1px solid var(--gold-pale);pointer-events:none;
}
.pf-hp small{position:absolute;inset:0;display:grid;place-items:center;font-size:9px;font-weight:700;color:#f5f2e9;text-shadow:0 1px 2px #000}

/* Role Chips: color + letter + distinct silhouette, >=4.5:1 contrast */
.role,.role-chip{
  display:inline-flex;align-items:center;justify-content:center;gap:4px;
  min-width:20px;height:20px;padding:0 6px;
  font-size:10px;font-weight:700;letter-spacing:.03em;line-height:1;
  white-space:nowrap;
}
.role.tank,.role-chip.tank{
  border-radius:3px 3px 8px 8px;
  background:#13222c;border:1px solid #4c82a6;color:var(--role-tank);
}
.role.healer,.role-chip.healer{
  border-radius:999px;
  background:#132419;border:1px solid #488559;color:var(--role-heal);
}
.role.dps,.role-chip.dps,.role.damage,.role-chip.damage{
  border-radius:2px;
  background:#272010;border:1px solid #b8923a;color:var(--role-dps);
}
.role.support,.role-chip.support{
  border-radius:7px 2px 7px 2px;
  background:#262013;border:1px solid #9d7d3b;color:var(--role-sup);
}
.role.ally,.role-chip.ally{
  border-radius:4px;
  background:#1f1e1a;border:1px solid #6b6556;color:var(--role-ally);
}

#encounter{padding:7px 11px;border-radius:9px;display:grid;gap:2px}
#encounter strong{font-size:13px;color:var(--gold-pale)}
#objective{font-size:12px;color:var(--ink-mid);font-variant-numeric:tabular-nums}
.trial-oath-banner{
  margin-top:4px;padding:5px 8px;border-radius:6px;
  background:#121513;border-left:2px solid var(--gold);
  color:var(--gold-pale);font-family:'Cormorant Garamond',Georgia,serif;font-size:15px;line-height:1.2;
}

.tools{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.tools button,#campBack{font-size:12px;padding:8px 11px;border-radius:8px;color:var(--ink)}
#minimap{width:92px;height:152px;border-radius:8px;background:rgba(12,15,14,.92);border:1.5px solid var(--stone-edge);box-shadow:0 8px 22px rgba(0,0,0,.48)}

.boss-hud{margin-top:6px;padding-top:6px;border-top:1px solid var(--stone-mute);display:grid;gap:5px}
.boss-phase{display:flex;align-items:center;gap:6px;font-size:12px;font-variant-numeric:tabular-nums}
.boss-phase span{min-width:22px;height:20px;display:grid;place-items:center;border-radius:5px;background:#2a2318;color:var(--gold-pale);border:1px solid var(--gold);font-weight:700;font-size:11px}
.boss-phase i{margin-left:auto;font-style:normal;color:var(--ink-soft);font-size:11px}
#bossChecks{list-style:none;padding:0;margin:0;display:grid;gap:3px;font-size:11px;color:var(--ink-soft)}
#bossChecks li::before{content:"◇ ";color:var(--gold)}
#bossChecks li.done{color:#9bddad}
#bossChecks li.done::before{content:"◆ ";color:#9bddad}
#bossTip{margin:0;font-size:11px;line-height:1.3;color:var(--gold-pale);background:#231d15;border-left:2px solid var(--gold);padding:4px 7px;border-radius:4px}

#bossBar{
  position:fixed;top:max(50px,calc(env(safe-area-inset-top) + 38px));left:50%;transform:translateX(-50%);
  width:min(430px,calc(100vw - 300px));z-index:11;padding:6px 10px;border-radius:9px;
  background:linear-gradient(180deg,rgba(23,26,24,.95),rgba(16,19,17,.95));
  border:1.5px solid rgba(217,178,92,.55);box-shadow:0 8px 24px rgba(0,0,0,.55);
  pointer-events:none;font-variant-numeric:tabular-nums;
}
.bb-top{display:flex;align-items:baseline;gap:8px;font-size:12px}
.bb-top b{font-family:'Cormorant Garamond',Georgia,serif;font-size:18px;font-weight:700;color:var(--gold-pale);line-height:1}
#bbPhase{color:var(--gold);font-size:11px;font-weight:700}
#bbState{font-style:normal;padding:1px 6px;border-radius:5px;font-size:10px;font-weight:700;background:#2e1915;border:1px solid var(--ember);color:#ffd5cb}
#bbState.good{background:#14281b;border-color:#6bc484;color:#b8f3c8}
#bbPct{margin-left:auto;font-style:normal;font-size:11px;color:var(--ink-mid);font-weight:700}
.bb-track{position:relative;height:10px;margin-top:4px;border-radius:5px;background:#0d0f0e;overflow:hidden;border:1px solid var(--stone-mute)}
#bbFill{display:block;height:100%;width:100%;background:linear-gradient(90deg,#8f2d22,#d86b43);transition:width .12s}
.bb-track u{position:absolute;top:0;bottom:0;width:2px;background:rgba(232,228,216,.55);text-decoration:none}

/* Camp Staging Gate Card */
#campCard{
  position:fixed;
  left:max(14px,env(safe-area-inset-left));
  bottom:max(14px,env(safe-area-inset-bottom));
  width:min(410px,calc(100vw - 28px));
  max-height:calc(100dvh - 118px);
  overflow-y:auto;
  padding:16px 18px;
  box-shadow:inset 0 1px 0 var(--stone-bevel),inset 0 -40px 60px -40px rgba(217,178,92,.2),0 12px 36px rgba(0,0,0,.62);
}
#campCard h2,.entry-card h2{font-size:clamp(27px,4.4vw,36px);line-height:1.03;margin:3px 0 8px}
.playing-as{display:grid;gap:5px;margin:4px 0 8px}
.playing-pill{
  display:flex;align-items:center;gap:7px;flex-wrap:wrap;
  padding:7px 10px;border-radius:8px;
  background:var(--stone-inset);border:1px solid var(--stone-edge);
  font-size:13px;font-weight:600;color:var(--ink);font-variant-numeric:tabular-nums;
}
.playing-pill b{font-family:'Cormorant Garamond',Georgia,serif;font-size:19px;font-weight:700;color:var(--gold-pale);line-height:1}
.role-changed-chip{
  display:inline-flex;align-items:center;gap:5px;
  padding:4px 9px;border-radius:6px;
  background:#261e12;border:1px solid var(--gold);
  color:var(--gold-pale);font-size:11px;font-weight:600;
}
.intro{margin:0 0 8px;font-size:13.5px;line-height:1.42;color:var(--ink-mid)}
#partyComposition{margin:0 0 10px;color:var(--gold-pale);font-weight:600}
#partyComposition.bad{color:var(--ember)}
.boss-btn{
  width:100%;margin-top:8px;padding:10px 13px;text-align:left;
  background:#171a18;color:var(--ink);border:1.5px solid var(--stone-edge);
}
.boss-btn span{display:block;font-size:11.5px;font-weight:400;color:var(--ink-soft);margin-top:2px}
.requirements{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin:9px 0 2px;font-size:11.5px;font-variant-numeric:tabular-nums}
.requirements span{padding:6px 7px;border-radius:7px;background:var(--stone-inset);border:1px solid var(--stone-mute);color:var(--ink-mid)}
.requirements .ok{border-color:#3e6e4b;color:#9bddad;font-weight:600}
.fine{font-size:11.5px;line-height:1.38;color:var(--ink-soft);margin:9px 0 0}
.subtle-link{display:inline-block;margin-top:7px;font-size:12px;color:var(--gold);text-decoration:underline;text-underline-offset:2px}
.subtle-link:hover{color:var(--gold-hi)}

/* Combat Touch & Key Controls */
#touchControls{
  position:fixed;left:0;right:0;bottom:max(12px,env(safe-area-inset-bottom));
  display:flex;justify-content:space-between;align-items:flex-end;
  padding:0 max(16px,env(safe-area-inset-right)) 0 max(16px,env(safe-area-inset-left));
  pointer-events:none;
}
#stick,#attack,#skill,#guard,#roar,#switchTarget{pointer-events:auto}
#stick{
  width:118px;height:118px;border-radius:50%;
  background:radial-gradient(circle,rgba(28,32,29,.68),rgba(12,15,14,.84));
  border:2px solid rgba(217,178,92,.44);
  position:relative;display:grid;place-items:center;touch-action:none;
  box-shadow:0 8px 24px rgba(0,0,0,.5);
}
#stickKnob{
  width:48px;height:48px;border-radius:50%;
  background:radial-gradient(circle at 35% 30%,#f2d488,#9e7630);
  border:2px solid var(--gold-pale);
  box-shadow:0 6px 16px rgba(0,0,0,.55);
}
#stick small{position:absolute;bottom:8px;font-size:9px;letter-spacing:.14em;color:var(--ink-soft);font-weight:700}
#attack,#skill,#guard{
  width:92px;height:92px;border-radius:50%;
  display:grid;place-content:center;justify-items:center;gap:1px;
  border:2px solid var(--gold);
  background:radial-gradient(circle at 32% 28%,#4b2920,#1c1412);
  color:#f7f2e6;box-shadow:0 10px 26px rgba(0,0,0,.55);touch-action:none;
}
#attack.reloading{border-color:var(--ember);background:radial-gradient(circle at 32% 28%,#3b221c,#161210)}
#skill{
  width:78px;height:78px;margin-left:auto;margin-right:10px;
  background:radial-gradient(circle at 32% 28%,#244838,#121c18);
  border-color:var(--teal);
}
#guard{
  width:70px;height:70px;margin-left:10px;
  background:radial-gradient(circle at 32% 28%,#243b4d,#121920);
  border-color:var(--role-tank);
}
#guard.active{box-shadow:0 0 22px rgba(140,201,240,.65);border-color:#dff2ff}
/* Challenging Roar: third right-side button, stacked above Guard */
#roar{
  position:absolute;right:max(16px,env(safe-area-inset-right));bottom:82px;
  width:66px;height:66px;border-radius:50%;
  display:grid;place-content:center;justify-items:center;gap:1px;
  border:2px solid var(--ember);
  background:radial-gradient(circle at 32% 28%,#5a2c16,#1d120c);
  color:#f7f2e6;box-shadow:0 10px 26px rgba(0,0,0,.55);touch-action:none;
}
#roar.active{box-shadow:0 0 22px rgba(240,140,60,.7);border-color:#ffd2a0}
#roar.cooling{background:#151816;border-color:var(--stone-edge);color:var(--ink-soft)}
#roar span{font-size:20px;line-height:1;font-weight:800}
#roar b{font-size:11px;letter-spacing:.08em}
#roar small{font-size:9px;color:var(--ink-mid);text-align:center;line-height:1.05;font-variant-numeric:tabular-nums}
#skill.cooling,#guard.cooling{background:#151816;border-color:var(--stone-edge);color:var(--ink-soft)}
#attack span,#skill span,#guard span{font-size:20px;line-height:1}
#attack b,#skill b,#guard b{font-size:11px;letter-spacing:.08em}
#attack small,#skill small,#guard small{font-size:9px;color:var(--ink-mid);text-align:center;line-height:1.05;font-variant-numeric:tabular-nums}
#combatHelp{position:fixed;bottom:8px;left:50%;transform:translateX(-50%);margin:0;font-size:11px;color:var(--ink-mid);text-shadow:0 1px 4px #000;white-space:nowrap}
#perf{position:fixed;left:50%;transform:translateX(-50%);top:auto;bottom:4px;white-space:nowrap;opacity:.7;z-index:1;font-size:10px;color:var(--ink-soft);font-variant-numeric:tabular-nums;pointer-events:none}

/* Veils, Entry & Modal Sheets */
.veil{
  position:fixed;inset:0;z-index:20;
  display:grid;place-items:center;
  padding:max(12px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));
  background:radial-gradient(circle at 50% 35%,rgba(22,26,24,.72),rgba(7,9,10,.86));
  backdrop-filter:blur(7px);
}
[hidden],.veil[hidden],#hud[hidden],#campBack[hidden],#toast[hidden],#connection[hidden]{display:none !important}

.entry-card{
  width:min(450px,100%);
  max-height:92dvh;overflow-y:auto;
  padding:20px 22px;display:grid;gap:9px;
  box-shadow:inset 0 1px 0 var(--stone-bevel),inset 0 -36px 56px -36px rgba(217,178,92,.18),0 16px 48px rgba(0,0,0,.72);
}
.entry-intro{display:grid;grid-template-columns:1fr 94px;gap:12px;align-items:center}
.entry-intro p{margin:0;font-size:14px;line-height:1.42;color:var(--ink-mid)}
.entry-hero{
  width:94px;height:94px;object-fit:cover;object-position:50% 18%;
  border-radius:10px;border:1.5px solid var(--gold);
  background:radial-gradient(circle at 50% 35%,#2d261c,#121412);
  box-shadow:0 6px 18px rgba(0,0,0,.5);
}
label{font-size:12px;font-weight:600;color:var(--ink-mid)}
details{border-top:1px solid var(--stone-mute);padding-top:8px}
summary{cursor:pointer;font-size:13px;font-weight:600;color:var(--gold);padding:4px 0}
details button{margin-top:8px;width:100%}
#entryStatus{margin:0;font-size:12px;color:var(--gold-pale);font-weight:600}
#reloadEntry{justify-self:start;background:var(--stone-inset);font-size:11.5px;color:var(--ink-mid);padding:6px 11px;min-height:38px}

.sheet{
  width:min(780px,96vw);
  max-height:min(88dvh,780px);
  display:grid;grid-template-rows:auto minmax(0,1fr);
  padding:14px 16px;
}
.sheet.wide-sheet{width:min(1140px,96vw)}
.sheet-head{
  position:relative;
  display:flex;justify-content:space-between;align-items:flex-start;gap:12px;
  padding-bottom:10px;margin-bottom:10px;
  border-bottom:1px solid #2d2b24;
}
.sheet-head::after{
  content:"◆";
  position:absolute;left:50%;bottom:-7px;transform:translateX(-50%);
  padding:0 8px;background:var(--stone-top);
  color:var(--gold);font-size:10px;line-height:1;
}
.sheet-head h2{font-size:clamp(24px,3.4vw,32px);line-height:1.05}
#closeSheet{
  width:44px;height:44px;padding:0;
  font-size:22px;line-height:1;
  display:grid;place-items:center;
  background:var(--stone-inset);color:var(--ink);
  flex-shrink:0;
}
#sheetBody{overflow-y:auto;overflow-x:hidden;display:grid;gap:10px;padding-right:3px;align-content:start}

/* Sheet Tabs & Rows */
.subtabs{display:flex;gap:6px;flex-wrap:wrap}
.subtabs button{
  flex:1;min-width:92px;min-height:44px;
  background:var(--stone-inset);border:1.5px solid var(--stone-edge);
  color:var(--ink-mid);font-size:13px;
}
.subtabs button.active{
  background:linear-gradient(180deg,#2b261d,#1d1a14);
  border-color:var(--gold);color:var(--gold-pale);
  box-shadow:inset 0 -2px 0 var(--gold),0 4px 12px rgba(0,0,0,.35);
}

.stat-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;font-variant-numeric:tabular-nums}
.stat-row div{padding:8px 9px;border-radius:8px;background:var(--stone-inset);border:1px solid var(--stone-mute);font-size:11.5px;color:var(--ink-soft)}
.stat-row strong{display:block;font-size:16px;color:var(--ink);margin-top:1px}

.item,.slot{
  display:flex;justify-content:space-between;gap:10px;align-items:center;
  padding:10px 12px;border-radius:9px;
  background:var(--stone-card);border:1px solid var(--stone-edge);
}
.item.equipped-row{border-color:rgba(217,178,92,.62);background:#211f19}
.item small,.slot small{display:block;color:var(--ink-soft);font-size:12px;margin-top:2px}
.tag{
  display:inline-block;font-size:10px;text-transform:uppercase;letter-spacing:.08em;
  padding:2px 6px;border-radius:4px;background:var(--stone-inset);border:1px solid var(--stone-mute);
  color:var(--ink-mid);margin-right:5px;font-weight:700;
}
.item small.nft-bonus{color:var(--gold-pale)}
.tag.nft{background:#282113;border-color:rgba(217,178,92,.6);color:var(--gold-pale)}
.tag.usable{background:#14251d;border-color:rgba(111,209,184,.5);color:var(--teal)}
.tag.switch-tag{background:#261f13;border-color:rgba(240,199,120,.55);color:var(--role-sup)}

.code{
  font-size:24px;font-weight:700;letter-spacing:.2em;
  padding:10px;text-align:center;border-radius:8px;
  background:var(--stone-inset);border:1px solid var(--stone-edge);color:var(--gold-pale);
  user-select:text;font-variant-numeric:tabular-nums;
}
.row{display:flex;gap:8px;flex-wrap:wrap}
.row>*{flex:1;min-width:120px}
.key-box{
  padding:9px 11px;border-radius:8px;background:var(--stone-inset);border:1px solid var(--stone-edge);
  color:var(--gold-pale);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;word-break:break-all;user-select:text;
}

/* Sloths -> Character Portrait Cards & Identity */
.sloth-roster{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(172px,1fr));
  gap:10px;
}
.sloth-card{
  position:relative;
  min-width:132px;height:152px;padding:0;overflow:hidden;
  border-radius:10px;border:2px solid var(--stone-edge);
  background-color:#151816;background-size:cover;background-position:50% 20%;background-repeat:no-repeat;
  display:flex;align-items:flex-end;text-align:left;
  box-shadow:0 6px 20px rgba(0,0,0,.48);
}
.sloth-card::before{
  content:"";position:absolute;inset:0;
  background:linear-gradient(180deg,rgba(12,16,18,.04) 38%,rgba(10,13,14,.94) 100%);
}
.sloth-card.selected{
  border-color:var(--gold);
  box-shadow:0 0 18px rgba(217,178,92,.35),inset 0 0 0 1px rgba(255,231,180,.28);
}
.sloth-card-scrim{
  position:relative;z-index:1;width:100%;padding:10px 12px;
  display:grid;gap:2px;
}
.sloth-card-scrim strong{
  font-family:'Cormorant Garamond',Georgia,serif;
  font-size:22px;font-weight:700;line-height:1.05;color:#f5f1e6;
  text-shadow:0 2px 8px #000;
}
.sloth-card-scrim span{
  display:flex;align-items:center;gap:6px;
  font-size:12px;font-weight:600;color:var(--gold-pale);
  font-variant-numeric:tabular-nums;
}
.sloth-card-badge{
  position:absolute;top:8px;right:8px;z-index:1;
  padding:2px 7px;border-radius:999px;
  background:rgba(16,19,17,.88);border:1px solid var(--gold);
  color:var(--gold-pale);font-size:10px;font-weight:700;letter-spacing:.06em;
}

.identity-panel{
  display:flex;gap:10px;align-items:flex-start;
  padding:10px 12px;border-radius:9px;
  background:var(--stone-inset);border:1px solid var(--stone-mute);
}
.identity-crest{
  width:32px;height:32px;border-radius:7px;flex-shrink:0;
  display:grid;place-items:center;
  background:#1f1d17;border:1px solid rgba(217,178,92,.45);color:var(--gold);
}
.identity-rule{margin:0;font-size:12.5px;line-height:1.42;color:var(--ink-mid)}

/* Sloths -> Gear 6-Slot Visual Grid */
.gear-slots{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
}
.gear-slot-tile{
  position:relative;
  display:grid;grid-template-columns:34px minmax(0,1fr);gap:8px;align-items:center;
  padding:9px 10px;border-radius:9px;
  background:var(--stone-card);border:1px solid var(--stone-edge);
  border-top:3px solid #6f6a5b;
  font-variant-numeric:tabular-nums;
}
.gear-slot-tile.rarity-uncommon{border-top-color:var(--teal)}
.gear-slot-tile.rarity-rare{border-top-color:var(--role-tank)}
.gear-slot-tile.rarity-epic{border-top-color:#c89bf0}
.gear-slot-tile.rarity-legendary,.gear-slot-tile.rarity-relic{border-top-color:var(--gold)}
.gear-slot-icon{
  width:34px;height:34px;border-radius:7px;
  display:grid;place-items:center;
  background:var(--stone-inset);border:1px solid var(--stone-mute);color:var(--gold);
}
.gear-slot-icon svg{width:20px;height:20px}
.gear-slot-meta{min-width:0}
.gear-slot-meta span{display:block;font-size:10px;text-transform:uppercase;letter-spacing:.1em;color:var(--ink-soft);font-weight:700}
.gear-slot-meta b{display:block;font-size:12.5px;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gear-slot-meta small{display:block;font-size:11px;color:var(--gold);font-weight:600}

/* Sloths -> Job: 16-Job Tree + Sticky Detail Panel */
.job-workspace{
  display:grid;
  grid-template-columns:minmax(0,1fr) 320px;
  gap:12px;
  align-items:start;
}
#jobTree{
  display:grid;
  grid-template-columns:repeat(5,minmax(144px,1fr));
  gap:9px;
  align-items:stretch;
}
.job-family{
  position:relative;overflow:hidden;
  background:var(--stone-card);
  border:1px solid #312f27;
  border-radius:9px;
  padding:8px;
  display:flex;flex-direction:column;gap:0;
}
.family-watermark{
  position:absolute;top:14px;right:-6px;
  width:72px;height:72px;
  color:var(--gold);opacity:.09;
  pointer-events:none;
}
.family-head{
  position:relative;z-index:1;
  display:flex;justify-content:space-between;align-items:baseline;gap:4px;
  margin-bottom:6px;padding-bottom:4px;
  border-bottom:1px solid #2a2822;
}
.family-head span{
  font-size:10px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:var(--gold);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.family-nodes{position:relative;z-index:1;display:flex;flex-direction:column;gap:0;flex:1}
.tree-connector{
  position:relative;height:16px;display:grid;place-items:center;
}
.tree-connector::before{
  content:"";position:absolute;top:0;bottom:0;left:50%;width:2px;transform:translateX(-50%);
  background:#5d6f66;
}
.tree-connector i{
  position:relative;z-index:1;display:block;
  width:7px;height:7px;background:#5d6f66;border:1px solid var(--stone-card);
  transform:rotate(45deg);
}
.job-family.has-branch .tree-connector::before,.job-family.has-branch .tree-connector i{background:var(--gold)}

.family-branches{display:grid;gap:6px}

.job-tile{
  position:relative;width:100%;min-height:48px;min-width:44px;
  padding:7px 8px 9px;border-radius:7px;
  display:grid;gap:4px;align-content:center;text-align:left;
  background:#1d211f;border:1.5px solid var(--stone-bevel);
  color:var(--ink);
  font-variant-numeric:tabular-nums;
}
.job-tile.starter-tile{
  min-height:60px;
  background:linear-gradient(180deg,#232825,#1a1e1c);
  border-color:#595343;
}
.job-tile[data-state="locked"]{
  background:var(--stone-inset);
  border-color:var(--stone-mute);
  color:var(--ink-soft);
}
.job-tile[data-state="trial_open"]{
  background:linear-gradient(180deg,#162521,#121d1a);
  border:2px solid var(--teal);
  color:#e9faf5;
  box-shadow:0 0 14px rgba(111,209,184,.18);
}
.job-tile[data-equipped="true"]{
  background:linear-gradient(180deg,#2b261c,#1e1b14);
  border:2px solid var(--gold);
  color:#fff6df;
  box-shadow:0 0 16px rgba(217,178,92,.28);
}
.job-tile[data-equipped="true"]::before{
  content:"";position:absolute;inset:2px;pointer-events:none;
  background:
    linear-gradient(var(--gold),var(--gold)) top left/5px 5px no-repeat,
    linear-gradient(var(--gold),var(--gold)) top right/5px 5px no-repeat,
    linear-gradient(var(--gold),var(--gold)) bottom left/5px 5px no-repeat,
    linear-gradient(var(--gold),var(--gold)) bottom right/5px 5px no-repeat;
}
.job-tile[aria-selected="true"]:not([data-equipped="true"]){
  box-shadow:inset 0 0 0 1.5px var(--focus),0 4px 12px rgba(0,0,0,.4);
  border-color:var(--focus);
}
.job-tile[aria-selected="true"][data-equipped="true"]{
  box-shadow:inset 0 0 0 1.5px var(--focus),0 0 18px rgba(217,178,92,.36);
}

.tile-top{display:flex;justify-content:space-between;align-items:center;gap:4px;min-width:0}
.tile-name{
  font-size:13px;font-weight:700;line-height:1.15;
  white-space:nowrap;overflow:visible;
}
.starter-tile .tile-name{font-family:'Cormorant Garamond',Georgia,serif;font-size:17px;font-weight:700}
.tile-meta{display:flex;justify-content:space-between;align-items:center;gap:4px;font-size:10.5px}
.tile-state{
  display:inline-flex;align-items:center;gap:3px;
  font-size:10.5px;font-weight:600;color:var(--ink-soft);white-space:nowrap;
}
.job-tile[data-state="unlocked"] .tile-state{color:var(--ink-mid)}
.job-tile[data-state="trial_open"] .tile-state{color:var(--teal);font-weight:700}
.job-tile[data-equipped="true"] .tile-state{color:var(--gold-pale);font-weight:700}
.tile-lock{width:11px;height:11px;flex-shrink:0}
.tile-xp{
  position:absolute;left:5px;right:5px;bottom:3px;height:2.5px;
  border-radius:2px;background:#0e100f;overflow:hidden;
}
.tile-xp i{display:block;height:100%;background:var(--gold)}

/* Job Detail Panel */
#jobDetail{
  position:sticky;top:0;
  background:var(--stone-inset);
  border:1.5px solid var(--stone-edge);
  border-radius:10px;
  padding:13px 14px;
  display:grid;gap:8px;
  box-shadow:inset 0 1px 0 rgba(74,70,58,.4);
  font-variant-numeric:tabular-nums;
}
.jd-head{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.jd-head h3{font-size:26px;font-weight:700;line-height:1;color:var(--gold-pale)}
.jd-family{font-size:12px;color:var(--ink-soft);font-weight:600}
.jd-progress{display:grid;gap:5px;padding:8px 10px;border-radius:8px;background:var(--stone-card);border:1px solid var(--stone-mute)}
.jd-lv-row{display:flex;justify-content:space-between;align-items:baseline;gap:6px;font-size:12.5px;font-weight:700;color:var(--ink)}
.jd-xp-track{height:7px;border-radius:4px;background:#0c0e0d;border:1px solid var(--stone-mute);overflow:hidden}
.jd-xp-track i{display:block;height:100%;background:linear-gradient(90deg,#9b7832,var(--gold-hi))}
.jd-catchup{font-size:11.5px;font-weight:600;color:var(--teal);margin:0}
.jd-fantasy{margin:0;font-size:13px;line-height:1.4;color:var(--ink)}
.jd-kit{display:grid;gap:5px;padding:8px 10px;border-radius:8px;background:var(--stone-card);border:1px solid var(--stone-mute);font-size:12px;line-height:1.36}
.jd-kit div strong{color:var(--gold-pale)}
.jd-weapon{font-size:12px;color:var(--ink-mid);margin:0}
.jd-weapon.warn{color:var(--role-sup)}
.jd-trial{
  padding:9px 10px;border-radius:8px;
  background:#161b19;border:1px solid #354740;
  display:grid;gap:3px;
}
.jd-trial b{font-family:'Cormorant Garamond',Georgia,serif;font-size:18px;color:var(--gold-pale);line-height:1.1}
.jd-trial small{font-size:11.5px;color:var(--ink-soft)}
.jd-trial q{font-family:'Cormorant Garamond',Georgia,serif;font-size:15px;color:var(--teal);quotes:"“" "”"}
.jd-actions{display:grid;gap:6px}
.jd-d3-note{margin:2px 0 0;font-size:11px;line-height:1.35;color:var(--ink-soft);border-top:1px solid var(--stone-mute);padding-top:7px}

/* Tester Tools */
#testerTools{
  margin-top:4px;padding:9px 11px;border-radius:9px;
  background:var(--stone-inset);border:1px dashed var(--stone-edge);
}
#testerTools summary{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--gold)}
.tester-grid{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:8px}
.tester-lv-btns{display:flex;gap:5px;flex-wrap:wrap}
.tester-lv-btns button{min-width:48px;padding:7px 10px;font-size:12px}
.tester-check{
  display:inline-flex;align-items:center;gap:8px;
  padding:7px 10px;border-radius:8px;min-height:44px;
  background:var(--stone-card);border:1px solid var(--stone-edge);
  font-size:12px;color:var(--ink);cursor:pointer;
}
.tester-check input{width:18px;height:18px;min-height:18px;margin:0;accent-color:var(--gold)}

/* Role-Change Confirm, Migration Picker & Trial Result Sheets */
.confirm-card,.trial-result-card{
  display:grid;gap:10px;
  padding:12px 14px;border-radius:9px;
  background:var(--stone-inset);border:1px solid var(--stone-edge);
}
.switch-banner{
  display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;
  padding:10px 12px;border-radius:8px;
  background:var(--stone-card);border:1px solid var(--stone-edge);
}
.switch-side{display:flex;align-items:center;gap:7px}
.switch-side strong{font-family:'Cormorant Garamond',Georgia,serif;font-size:22px;color:var(--gold-pale)}
.switch-arrow{color:var(--gold);font-size:18px;font-weight:700}
.role-callout{
  padding:10px 12px;border-radius:8px;
  background:#231e14;border:1.5px solid var(--gold);
  color:var(--gold-pale);font-size:13px;font-weight:600;line-height:1.4;
}
.role-callout.same{background:#161b18;border-color:var(--stone-edge);color:var(--ink-mid)}
.role-conflict{
  padding:10px 12px;border-radius:8px;
  background:#2a1815;border:1.5px solid var(--ember);
  color:#ffd8cf;font-size:13px;font-weight:600;line-height:1.4;
}
.party-after-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.party-after-slot{
  display:flex;align-items:center;gap:7px;
  padding:7px 9px;border-radius:7px;
  background:var(--stone-card);border:1px solid var(--stone-mute);
  font-size:12px;
}
.party-after-slot.you{border-color:rgba(217,178,92,.65)}
.party-after-slot small{margin-left:auto;color:var(--ink-soft);font-size:11px}

.migration-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.migration-option{
  padding:14px;border-radius:10px;
  background:var(--stone-card);border:2px solid var(--stone-edge);
  display:grid;gap:8px;align-content:space-between;
}
.migration-option h3{font-size:26px;color:var(--gold-pale)}
.migration-option p{margin:0;font-size:13px;line-height:1.4;color:var(--ink-mid)}

.trial-oath-quote{
  margin:0;padding:10px 14px;border-radius:8px;
  background:#151917;border-left:3px solid var(--gold);
  font-family:'Cormorant Garamond',Georgia,serif;font-size:20px;color:var(--gold-pale);
}
.trial-tip-box{
  padding:10px 12px;border-radius:8px;
  background:#17221f;border:1px solid var(--teal);
  color:#dff8f1;font-size:13px;line-height:1.4;
}

.lore-page p{margin:0;line-height:1.52;color:var(--ink)}

#toast,#connection{
  position:fixed;left:50%;transform:translateX(-50%);z-index:30;
  padding:9px 15px;border-radius:8px;
  background:rgba(16,19,17,.96);color:var(--gold-pale);
  border:1.5px solid var(--gold);font-size:13px;font-weight:600;
  box-shadow:0 8px 24px rgba(0,0,0,.6);
}
#toast{top:max(94px,calc(env(safe-area-inset-top) + 84px))}
#connection{bottom:138px;border-color:var(--ember);color:#ffd5cb}

/* Phone / Compact Landscape (e.g. 844x390, 740x360) */
@media (orientation:landscape) and (max-width:1023px),(orientation:landscape) and (max-height:540px){
  .topbar{padding-top:max(4px,env(safe-area-inset-top));padding-bottom:4px}
  .topbar h1{font-size:19px}
  .eyebrow{font-size:9.5px}
  .test-tag{font-size:9px;padding:3px 7px}
  #statusCol{top:max(36px,calc(env(safe-area-inset-top) + 28px));width:min(242px,42vw);gap:4px}
  #sideCol{top:max(36px,calc(env(safe-area-inset-top) + 28px));gap:5px}
  .vitals{padding:5px 8px}
  .vitals-top{font-size:11.5px}
  .health{height:13px;margin-top:3px}
  .pf{padding:3px 6px;font-size:10px;grid-template-columns:20px minmax(0,1fr) 62px}
  .pf-hp{height:11px}
  #encounter{padding:4px 8px}
  #encounter strong,#objective{font-size:11px}
  .boss-hud{display:none}
  #bossBar{top:max(34px,calc(env(safe-area-inset-top) + 26px));width:min(340px,calc(100vw - 380px));padding:4px 8px}
  .bb-top b{font-size:15px}
  .tools button,#campBack{padding:6px 9px;font-size:11px;min-height:40px}
  #minimap{width:68px;height:112px}
  #campCard{
    top:max(40px,calc(env(safe-area-inset-top) + 32px));
    bottom:max(8px,env(safe-area-inset-bottom));
    width:min(370px,54vw);max-height:none;padding:10px 13px;
  }
  #campCard h2{font-size:22px;margin:1px 0 4px}
  .playing-pill{padding:5px 8px;font-size:12px}
  .playing-pill b{font-size:16px}
  .intro,#campCard .fine,.subtle-link{font-size:11px;margin-top:4px}
  .primary{padding:9px 11px;font-size:13px}
  .boss-btn{padding:7px 10px;margin-top:5px;font-size:12px}
  .requirements{margin:5px 0 0;font-size:10px}
  #stick{width:94px;height:94px}
  #stickKnob{width:38px;height:38px}
  #attack{width:76px;height:76px}
  #skill{width:66px;height:66px}
  #guard{width:60px;height:60px}
  #combatHelp{display:none}

  .veil{padding:5px max(8px,env(safe-area-inset-right)) 5px max(8px,env(safe-area-inset-left))}
  .entry-card{
    width:min(650px,96vw);max-height:94dvh;padding:11px 15px;
    grid-template-columns:1.1fr 1fr;gap:5px 14px;align-items:center;
  }
  .entry-card>.eyebrow,.entry-card>h2,.entry-card>.entry-intro{grid-column:1}
  .entry-card>label,.entry-card>#testerName,.entry-card>#begin,.entry-card>details,.entry-card>.fine,.entry-card>#entryStatus,.entry-card>#reloadEntry{grid-column:2}
  .entry-card h2{font-size:25px;margin:0}
  .entry-hero{width:68px;height:68px}

  .sheet{width:min(760px,98vw);max-height:95dvh;padding:8px 11px}
  .sheet.wide-sheet{width:min(1100px,98vw)}
  .sheet-head{padding-bottom:6px;margin-bottom:6px}
  .sheet-head h2{font-size:21px}
  .subtabs button{min-height:44px;padding:6px 10px;font-size:12px}

  .sloth-card{height:118px}
  .gear-slots{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}

  /* Side-by-side ~62% tree / ~38% detail at 740x360 and 844x390 */
  .job-workspace{
    grid-template-columns:minmax(0,1.72fr) minmax(212px,1fr);
    gap:7px;
  }
  #jobTree{
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:4px;
    overflow-x:auto;
    padding-bottom:2px;
  }
  .job-family{padding:4px;border-radius:7px}
  .family-head{margin-bottom:4px;padding-bottom:3px}
  .family-head span{font-size:8px;letter-spacing:.05em}
  .tree-connector{height:10px}
  .family-branches{gap:4px}
  .job-tile{
    min-height:44px;
    padding:4px 4px 5px;
    gap:2px;
  }
  .job-tile.starter-tile{min-height:46px}
  .tile-name,.starter-tile .tile-name{
    font-family:'IBM Plex Sans',system-ui,sans-serif;
    font-size:10.5px;font-weight:700;letter-spacing:-.02em;
  }
  .tile-meta{font-size:9px;gap:2px}
  .tile-meta .role-word{display:none}
  .job-tile .role-chip{height:15px;min-width:15px;padding:0 3px;font-size:8.5px}
  .tile-state{font-size:9px;white-space:nowrap}
  #jobDetail{padding:9px 10px;gap:6px}
  .jd-head h3{font-size:21px}
  .jd-fantasy,.jd-kit{font-size:11.5px}
}

/* Narrow Portrait Phones & Small Screens (e.g. 390x844) */
@media (max-width:760px) and (orientation:portrait){
  #minimap,.boss-hud{display:none}
  #statusCol{width:min(228px,58vw)}
  #bossBar{top:auto;bottom:136px;width:min(360px,calc(100vw - 28px))}
  .pf{grid-template-columns:20px minmax(0,1fr) 58px}
  #stick{width:100px;height:100px}
  #attack{width:82px;height:82px}
  #skill{width:70px;height:70px}
  #guard{width:62px;height:62px}
  #combatHelp{bottom:122px;font-size:10px}

  .sheet,.sheet.wide-sheet{width:96vw;max-height:91dvh;padding:12px}
  .stat-row{grid-template-columns:repeat(2,minmax(0,1fr))}
  .sloth-roster{grid-template-columns:repeat(2,minmax(0,1fr))}
  .sloth-roster.single-sloth{grid-template-columns:minmax(0,1fr)}
  .gear-slots{grid-template-columns:repeat(2,minmax(0,1fr))}
  .party-after-list,.migration-grid{grid-template-columns:1fr}

  .job-workspace{grid-template-columns:1fr;gap:10px}
  #jobTree{grid-template-columns:1fr;gap:8px}
  .family-nodes{
    display:grid;
    grid-template-columns:minmax(94px,1.05fr) 16px minmax(0,2.4fr);
    align-items:center;gap:4px;
  }
  .tree-connector{height:100%;width:16px}
  .tree-connector::before{top:50%;bottom:auto;left:0;right:0;width:100%;height:2px;transform:translateY(-50%)}
  .family-branches{
    grid-template-columns:repeat(auto-fit,minmax(88px,1fr));
    gap:5px;
  }
  .job-tile,.job-tile.starter-tile{min-height:48px;padding:6px 7px 8px}
  .tile-name,.starter-tile .tile-name{
    font-family:'IBM Plex Sans',system-ui,sans-serif;
    font-size:11.5px;font-weight:700;letter-spacing:-.01em;
  }
  .tile-meta .role-word{display:none}
  #jobDetail{position:static}
}

/* Reduced Motion */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
    scroll-behavior:auto !important;
  }
  .trial-cta{animation:none !important}
}

/* ---- v16 Ossuary run HUD: compact, unobstructed playfield (body.run16 is set only during hall runs) ---- */
.menu-btn{font-size:12px;padding:6px 12px;border-radius:8px;color:var(--ink);min-height:34px;
  background:linear-gradient(180deg,rgba(23,26,24,.9),rgba(16,19,17,.9));border:1.5px solid var(--stone-edge);box-shadow:0 4px 14px rgba(0,0,0,.45)}
body.run16 .topbar,body.run16 #perf,body.run16 #combatHelp,body.run16 .pf-comp{display:none}
body.run16 #statusCol{top:max(8px,calc(env(safe-area-inset-top) + 6px));left:max(8px,env(safe-area-inset-left));width:min(188px,48vw);gap:3px}
body.run16 .vitals{display:none}
body.run16 .vitals:has(#ammoPips:not([hidden])){display:block;padding:3px 7px}
body.run16 .vitals:has(#ammoPips:not([hidden])) .vitals-top,body.run16 .vitals:has(#ammoPips:not([hidden])) .health{display:none}
body.run16 #partyVitals{gap:2px}
body.run16 .pf{grid-template-columns:15px minmax(0,1fr) 52px;gap:5px;padding:2px 6px;border-radius:6px;font-size:10.5px;
  background:rgba(12,14,13,.6);border-color:rgba(61,58,48,.55)}
body.run16 .pf.you{border-color:rgba(217,178,92,.7);background:rgba(20,18,12,.7)}
body.run16 .pf .role{min-width:15px;height:15px;padding:0;font-size:8.5px}
body.run16 .pf em{font-size:8.5px;opacity:.75}
body.run16 .pf i.buff{font-size:8px;padding:0 3px}
body.run16 .pf-hp{height:8px;border-radius:4px}
body.run16 .pf-hp small{display:none}
body.run16 .pf.down .pf-hp{outline:1px solid #6b6556}
body.run16 #encounter{padding:4px 8px;border-radius:7px;gap:1px;background:rgba(12,14,13,.6);border-color:rgba(61,58,48,.55);box-shadow:none}
body.run16 #encounter strong{font-size:11px}
body.run16 #objective{font-size:10.5px;line-height:1.3;white-space:normal;overflow:visible;overflow-wrap:anywhere}
body.run16 #statusCol{max-width:calc(100vw - 96px)}
body.run16 .boss-hud{display:none}
body.run16 #sideCol{top:max(8px,calc(env(safe-area-inset-top) + 6px));right:max(8px,env(safe-area-inset-right));gap:5px}
body.run16 .tools,body.run16 #campBack{display:none}
body.run16.menu16 .tools{display:flex;flex-direction:column;align-items:stretch;gap:4px}
body.run16.menu16 #campBack:not([hidden]){display:block}
body.run16 .tools button,body.run16 #campBack{font-size:11px;padding:6px 10px;min-height:34px}
body.run16 #minimap{width:62px;height:104px;opacity:.9}
body.run16.menu16 #minimap{display:none}
body.run16:not(.menu16) #phaseJump{display:none !important}
body.run16 #bossBar{top:max(8px,calc(env(safe-area-inset-top) + 6px));width:min(320px,calc(100vw - 300px));padding:4px 8px}
body.run16 #stick{width:104px;height:104px}
body.run16 #stickKnob{width:42px;height:42px}
body.run16 #attack{width:82px;height:82px}
body.run16 #skill{width:66px;height:66px;margin-right:8px}
body.run16 #guard{width:60px;height:60px;margin-left:8px}
body.run16 #roar{width:58px;height:58px;bottom:72px;right:calc(max(16px,env(safe-area-inset-right)) + 1px)}
body.run16 #touchControls{opacity:.92}
@media (orientation:landscape) and (max-height:540px){
  body.run16 #statusCol{width:min(176px,24vw)}
  body.run16 #encounter{max-width:176px}
  body.run16 #stick{width:92px;height:92px}
  body.run16 #attack{width:70px;height:70px}
  body.run16 #skill{width:58px;height:58px}
  body.run16 #guard{width:52px;height:52px}
  body.run16 #roar{width:50px;height:50px;bottom:62px}
  body.run16 #attack small,body.run16 #skill small,body.run16 #guard small,body.run16 #roar small{display:none}
  body.run16 #touchControls{bottom:max(6px,env(safe-area-inset-bottom))}
  body.run16 #bossBar{width:min(300px,calc(100vw - 420px))}
}
@media (max-width:760px) and (orientation:portrait){
  body.run16 #minimap{display:block;width:54px;height:92px}
  body.run16 #bossBar{top:auto;bottom:118px;width:min(320px,calc(100vw - 40px))}
  /* tanks have the Roar button stacked above Guard: lift the boss bar clear of it */
  body:has(#roar:not([hidden])) #bossBar{bottom:152px}
  body.run16 #attack small,body.run16 #skill small,body.run16 #guard small,body.run16 #roar small{font-size:8px}
}
@media (orientation:landscape) and (max-height:540px){#perf{display:none}}

/* G58: PlayStation-style diamond on the right thumb. Left thumb = move stick only.
   Bottom (X) = Attack, left (Square) = job skill, right (Circle) = Guard, top (Triangle) = Roar.
   Positions stay fixed per job, so muscle memory carries across jobs; unused slots are simply empty. */
#touchControls{--a:84px;--b:70px;--o:70px;--edge:max(16px,env(safe-area-inset-right));
  --cx:calc(var(--edge) + var(--o) + var(--b) / 2);--cy:calc(var(--o) + var(--b) / 2)}
#touchControls #attack,#touchControls #skill,#touchControls #guard,#touchControls #roar{position:absolute;margin:0}
#touchControls #attack{width:var(--a);height:var(--a);right:calc(var(--cx) - var(--a) / 2);bottom:calc(var(--cy) - var(--o) - var(--a) / 2 + 4px)}
#touchControls #skill{width:var(--b);height:var(--b);right:calc(var(--cx) + var(--o) - var(--b) / 2);bottom:calc(var(--cy) - var(--b) / 2)}
#touchControls #guard{width:var(--b);height:var(--b);right:calc(var(--cx) - var(--o) - var(--b) / 2);bottom:calc(var(--cy) - var(--b) / 2)}
#touchControls #roar{width:var(--b);height:var(--b);right:calc(var(--cx) - var(--b) / 2);bottom:calc(var(--cy) + var(--o) - var(--b) / 2)}
body.run16 #touchControls{--a:72px;--b:62px;--o:62px}
@media (orientation:landscape) and (max-height:540px){
  body.run16 #touchControls{--a:62px;--b:54px;--o:54px}
}
@media(max-width:350px) and (orientation:portrait){
  body.run16 #touchControls{--a:64px;--b:56px;--o:56px}
}
@media (max-width:760px) and (orientation:portrait){
  /* keep the boss bar above the diamond */
  body.run16 #bossBar,body:has(#roar:not([hidden])) #bossBar{bottom:220px}
}

/* G62: no phone zoom. 16px inputs stop iOS focus-zoom; manipulation stops double-tap zoom. */
html,body{touch-action:manipulation;-webkit-text-size-adjust:100%;text-size-adjust:100%}
input,select,textarea{font-size:16px !important}

/* G64 Switch Target: small button tucked in the top-left corner of the action diamond (like a shoulder button). */
#switchTarget{
  position:absolute;margin:0;border-radius:50%;padding:0;
  display:grid;place-content:center;justify-items:center;gap:0;
  border:2px solid var(--gold);
  background:radial-gradient(circle at 32% 28%,#3a3220,#15120c);
  color:#f7f2e6;box-shadow:0 8px 20px rgba(0,0,0,.5);touch-action:none;
  --t:calc(var(--b) * .74);--k:calc(var(--o) * 1.14);
  width:var(--t);height:var(--t);
  right:calc(var(--cx) + var(--k) - var(--t) / 2);bottom:calc(var(--cy) + var(--k) - var(--t) / 2);
}
#switchTarget span{font-size:18px;line-height:1;font-weight:800}
#switchTarget b{font-size:8.5px;letter-spacing:.06em}
#switchTarget:active{border-color:#ffe7a8;box-shadow:0 0 16px rgba(217,178,92,.7)}

/* G65 full screen: fill the real visible screen (phones in landscape hide/show bars) */
html,body{height:100%;height:100dvh}

/* G67 Enemy list: small, under the minimap. Gold border = your target; blue diamond = tank's target. */
#enemyList{display:flex;flex-direction:column;gap:2px;width:118px;margin-top:6px;pointer-events:auto;align-self:flex-end}
#enemyList[hidden]{display:none}
#enemyList .el{display:grid;grid-template-columns:10px minmax(0,1fr);grid-template-rows:auto 4px;column-gap:3px;row-gap:1px;align-items:center;
  padding:2px 5px 3px;border-radius:5px;border:1px solid rgba(255,255,255,.08);background:rgba(12,10,8,.66);color:var(--ink);text-align:left;
  font:600 9.5px/1.1 'IBM Plex Sans',system-ui,sans-serif;min-height:0;box-shadow:none;touch-action:none;cursor:pointer}
#enemyList .el b{grid-column:2;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#enemyList .el .tk{grid-row:1/3;font-style:normal;color:#8cc9f0;font-size:10px;line-height:1;text-align:center}
#enemyList .el .eb{grid-column:2;height:4px;border-radius:2px;background:#2a1612;overflow:hidden}
#enemyList .el .eb u{display:block;height:100%;background:#d8574a;text-decoration:none}
#enemyList .el.big b{color:var(--gold-pale)}
#enemyList .el.mine{border-color:var(--gold);background:rgba(40,32,16,.82);box-shadow:0 0 8px rgba(217,178,92,.35)}
body.run16.menu16 #enemyList{display:none}
@media (orientation:landscape) and (max-height:540px){#enemyList{width:104px;margin-top:4px}#enemyList .el{font-size:9px;padding:1px 4px 2px}}

/* G69: right column is Menu, then the enemy list (well above the action buttons).
   The minimap moves out to the left of that column, level with the Menu button. */
body.run16 #menuBtn{order:0}
body.run16 .tools{order:1}
body.run16 #enemyList{order:2;margin-top:0}
body.run16 #campBack{order:4}
body.run16 #sideCol{position:fixed}
body.run16 #minimap{order:3;position:absolute;top:0;right:calc(100% + 6px)}
body.run16 #sideCol:has(#enemyList[hidden]) #minimap{right:calc(100% + 6px)}
@media (max-width:359px) and (orientation:portrait){
  body.run16 #minimap{position:static}   /* very narrow phones: no room beside the party list, so it stacks under the list */
}

/* G72 healers: Ally button in the Guard slot (right of the diamond), green. Party rows show the picked ally. */
#switchAlly{pointer-events:auto;display:grid;place-content:center;justify-items:center;gap:2px;border-radius:50%;padding:0;
  border:3px solid #7fd69a;background:radial-gradient(circle at 32% 28%,#24452f,#0e1a12);color:#f3fbf5;box-shadow:0 8px 20px rgba(0,0,0,.5);touch-action:none}
#switchAlly span{font-size:20px;line-height:1}
#switchAlly b{font-size:11px;letter-spacing:.08em}
#switchAlly small{font-size:9px;color:#cfe9d6;text-align:center;line-height:1.05}
#switchAlly.active{box-shadow:0 0 18px rgba(127,214,154,.6)}
#touchControls #switchAlly{position:absolute;margin:0;width:var(--b);height:var(--b);right:calc(var(--cx) - var(--o) - var(--b) / 2);bottom:calc(var(--cy) - var(--b) / 2)}
#partyVitals .pf.heal-pick{outline:2px solid #7fd69a;outline-offset:-1px;box-shadow:0 0 10px rgba(127,214,154,.45)}
#partyVitals .pf[data-pid]{cursor:pointer}
@media (orientation:landscape) and (max-height:540px){ body.run16 #switchAlly small{display:none} }
#partyVitals{pointer-events:auto}

/* Chest loot pop (follows the chest on screen; bound items never show a rarity word or colour) */
.loot-pop{position:fixed;left:0;top:0;z-index:4;pointer-events:none;display:flex;align-items:center;gap:8px;
  max-width:min(250px,calc(100vw - 16px));padding:7px 10px;border-radius:9px;background:var(--stone-card);
  border:1px solid rgba(217,178,92,.62);box-shadow:0 6px 18px rgba(0,0,0,.45);color:var(--ink);
  animation:lootPopIn .25s ease-out,lootPopOut .5s ease-in 3.7s forwards}
.loot-pop-icon{flex:0 0 30px;width:30px;height:30px;color:var(--gold-pale)}
.loot-pop-icon svg{width:30px;height:30px}
.loot-pop-meta{min-width:0}
.loot-pop-meta strong{display:block;font-size:13px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.loot-pop-meta small{display:block;color:var(--ink-soft);font-size:11.5px;margin-top:1px}
.loot-pop .tag{font-size:9px;padding:1px 5px}
.loot-pop.none{border-color:var(--stone-edge)}
.loot-pop.none strong{color:var(--ink-soft);font-weight:600}
@keyframes lootPopIn{from{opacity:0;scale:.85}to{opacity:1;scale:1}}
@keyframes lootPopOut{to{opacity:0}}
@media (prefers-reduced-motion:reduce){.loot-pop{animation:lootPopOut .5s ease-in 3.7s forwards}}
/* G107: Attack becomes Open / Read / Light / Use / Enter while an object is targeted */
#attack.interact{border-color:#ffd25a;background:radial-gradient(circle at 32% 28%,#4a3e1e,#1a150b);box-shadow:0 0 0 2px rgba(255,210,90,.3),0 0 18px rgba(255,200,80,.5)}
#attack.interact b{color:#fff3d2}
/* G107 target frame: top centre, under the Warden's bar when it shows. Enemy colours; objects gold, name only */
#targetFrame{position:fixed;left:50%;transform:translateX(-50%);top:max(8px,calc(env(safe-area-inset-top) + 6px));z-index:6;pointer-events:none;
  width:min(190px,calc(100vw - 420px));min-width:136px;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:6px;row-gap:3px;
  padding:4px 9px 5px;border-radius:7px;border:2px solid #e0563a;background:linear-gradient(180deg,rgba(52,16,12,.9),rgba(26,10,8,.9));
  box-shadow:0 4px 14px rgba(0,0,0,.5),0 0 10px rgba(224,86,58,.25);font:600 11px/1.15 'IBM Plex Sans',system-ui,sans-serif;color:#fde9dc}
#targetFrame[hidden]{display:none}
#targetFrame b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:700}
#targetFrame small{font-size:9px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;color:#ffb48a}
#targetFrame .tf-bar{grid-column:1/3;height:6px;border-radius:3px;background:#2a1210;overflow:hidden;box-shadow:inset 0 0 0 1px rgba(0,0,0,.4)}
#targetFrame .tf-bar u{display:block;height:100%;background:linear-gradient(90deg,#c8402e,#ff7a4a);text-decoration:none;transition:width .2s}
#targetFrame.big{border-color:#ff8a3a}
#targetFrame.object{border-color:#e8bf5a;background:linear-gradient(180deg,rgba(48,38,16,.9),rgba(24,19,9,.9));color:#fff3d2;box-shadow:0 4px 14px rgba(0,0,0,.5),0 0 10px rgba(232,191,90,.25)}
#targetFrame.object small{color:var(--gold-pale)}
#bossBar.band{padding:4px 8px}#bossBar.band .bb-top{gap:5px;font-size:10.5px}#bossBar.band .bb-top b{font-size:15px}
body.run16.menu16 #targetFrame{display:none}
@media (prefers-reduced-motion:reduce){#targetFrame .tf-bar u{transition:none}}
/* G107 "On you" list (#enemyList): caption, threat pips, gold border + arrow on your target's row */
#enemyList:not([hidden])::before{content:'ON YOU';font:800 8px/1 'IBM Plex Sans',system-ui,sans-serif;letter-spacing:.1em;color:#ff9a7a;text-align:right;padding:0 2px 1px}
#enemyList .el{grid-template-columns:10px minmax(0,1fr) auto}
#enemyList .el .eb{grid-column:2/4}
#enemyList .el .th{grid-column:3;grid-row:1;display:flex;gap:1px;align-items:flex-end;height:8px}
#enemyList .el .th s{display:block;width:3px;background:rgba(255,120,90,.25);text-decoration:none;border-radius:1px}
#enemyList .el .th s:nth-child(1){height:4px}#enemyList .el .th s:nth-child(2){height:6px}#enemyList .el .th s:nth-child(3){height:8px}
#enemyList .el .th[data-n="1"] s:nth-child(1),#enemyList .el .th[data-n="2"] s:nth-child(-n+2),#enemyList .el .th[data-n="3"] s{background:#ff6a45}
#enemyList .el.mine{border:2px solid var(--gold);background:rgba(48,36,14,.9);box-shadow:0 0 0 1px rgba(0,0,0,.5),0 0 10px rgba(255,210,90,.55)}
#enemyList .el.mine .tk{color:#ffd25a;font-size:9px}
#enemyList .el.mine b{color:#fff3d2}
html.big-screen #targetFrame{position:absolute;top:6px;width:220px}
html.big-screen body:has(#bossBar:not([hidden])) #targetFrame{top:66px}
