
  :root{
    --bg:#0d0b14;--panel:#171320;--panel2:#1f1929;--ink:#e8e0d0;--dim:#8a7f95;
    --gold:#d9a441;--blood:#9e2b34;--sp:#4fb8d9;--hp:#c0473e;--enemy:#b5485a;
    --line:#2e2638;--green:#5aa86a;--xp:#c08fe0;
  }
  *{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent;}
  html,body{height:100%;overflow:hidden;}
  body{background:var(--bg);font-family:'Shippori Mincho',serif;color:var(--ink);
    display:flex;flex-direction:column;height:100dvh;user-select:none;}

  #stage{flex:0 0 auto;height:42dvh;min-height:280px;position:relative;
    background:radial-gradient(ellipse 80% 60% at 50% 30%, #2a2238 0%, #120e1c 70%),
      repeating-linear-gradient(180deg, transparent 0 38px, rgba(0,0,0,.18) 38px 40px);
    border-bottom:2px solid var(--line);overflow:hidden;padding:env(safe-area-inset-top) 0 0 0;}
  #stage::before{content:"";position:absolute;inset:0;
    background:radial-gradient(circle at 50% 120%, rgba(217,164,65,.10), transparent 55%);pointer-events:none;}
  .floorbadge{position:absolute;top:10px;left:12px;z-index:5;font-family:'Cinzel',serif;
    font-size:12px;letter-spacing:2px;color:var(--gold);background:rgba(0,0,0,.35);
    padding:4px 10px;border:1px solid var(--line);border-radius:3px;}
  .goldbadge{position:absolute;top:10px;right:54px;z-index:5;font-size:13px;color:var(--gold);
    background:rgba(0,0,0,.35);padding:4px 10px;border:1px solid var(--line);border-radius:3px;}
  #muteBtn{position:absolute;top:10px;right:12px;z-index:6;font-size:15px;line-height:1;
    background:rgba(0,0,0,.35);color:var(--ink);border:1px solid var(--line);border-radius:3px;padding:5px 8px;}
  #muteBtn:active{filter:brightness(1.3);}

  /* シーン絵 (敵 or ノードアイコン) */
  #sceneZone{position:absolute;top:7%;left:0;right:0;display:flex;justify-content:center;}
  .enemy{text-align:center;transition:transform .15s, opacity .3s;}
  .enemy .sprite{font-size:54px;line-height:1;filter:drop-shadow(0 6px 10px rgba(0,0,0,.6));
    animation:bob 2.4s ease-in-out infinite;}
  @keyframes bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-7px)}}
  .enemy.hit{animation:shake .3s;}
  .enemy.hit-strong{animation:shakebig .42s;}
  @keyframes shake{0%,100%{transform:translateX(0)}25%{transform:translateX(-9px)}75%{transform:translateX(9px)}}
  @keyframes shakebig{0%,100%{transform:translateX(0) scale(1)}15%{transform:translateX(-16px) scale(1.06)}40%{transform:translateX(14px) scale(1.04)}65%{transform:translateX(-10px) scale(1.02)}85%{transform:translateX(7px)}}
  .enemy.dead{opacity:0;transform:scale(.5) rotate(15deg);}
  .ename{font-family:'Cinzel',serif;font-size:13px;color:var(--enemy);letter-spacing:1px;margin-top:1px;}
  .ebar-wrap{width:124px;margin:4px auto 0;}
  .ebar-bg{height:7px;background:#000;border:1px solid var(--line);border-radius:4px;overflow:hidden;}
  .ebar-fill{height:100%;background:linear-gradient(90deg,var(--enemy),#e06b7d);width:100%;transition:width .35s;}
  .ehp-txt{font-size:10px;color:var(--dim);margin-top:2px;}
  .intent{font-size:11px;color:var(--gold);margin-top:3px;min-height:14px;}
  .intent.danger{color:#ff8a8a;font-weight:700;animation:dangerpulse 1.1s infinite;}
  @keyframes dangerpulse{0%,100%{opacity:.7}50%{opacity:1}}
  .esp{display:flex;gap:3px;justify-content:center;margin-top:3px;}
  .epip{width:8px;height:8px;border-radius:50%;border:1px solid var(--enemy);background:transparent;}
  .epip.on{background:var(--enemy);box-shadow:0 0 4px var(--enemy);}
  .scene-icon{text-align:center;}
  .scene-icon .big{font-size:60px;animation:bob 3s ease-in-out infinite;filter:drop-shadow(0 6px 10px rgba(0,0,0,.6));}
  .scene-icon .lab{font-family:'Cinzel',serif;font-size:14px;color:var(--gold);letter-spacing:2px;margin-top:6px;}
  .scene-icon .sub{font-size:11px;color:var(--dim);margin-top:3px;max-width:260px;}

  #playerStatus{position:absolute;bottom:8px;left:10px;right:10px;background:rgba(8,6,14,.72);
    border:1px solid var(--line);border-radius:6px;padding:7px 10px;backdrop-filter:blur(2px);}
  .pname{font-family:'Cinzel',serif;font-size:12px;letter-spacing:1px;color:var(--ink);
    margin-bottom:4px;display:flex;justify-content:space-between;align-items:center;}
  .pname .shield{color:var(--sp);font-size:11px;}
  .bar{display:flex;align-items:center;gap:7px;margin-bottom:3px;}
  .bar label{width:26px;font-family:'Cinzel',serif;font-size:10px;color:var(--dim);}
  .track{flex:1;height:10px;background:#000;border:1px solid var(--line);border-radius:6px;overflow:hidden;position:relative;}
  .fill-hp{height:100%;background:linear-gradient(90deg,#7a241f,var(--hp));transition:width .35s;}
  .fill-sp{height:100%;background:linear-gradient(90deg,#1e6b82,var(--sp));transition:width .35s;}
  .fill-xp{height:100%;background:linear-gradient(90deg,#6b4a82,var(--xp));transition:width .35s;}
  .bar .num{width:56px;text-align:right;font-size:10px;color:var(--ink);}
  #spPips{display:flex;gap:4px;margin-top:2px;}
  .pip{width:12px;height:12px;border-radius:50%;border:1px solid var(--sp);background:transparent;transition:background .2s,box-shadow .2s;}
  .pip.on{background:var(--sp);box-shadow:0 0 6px var(--sp);}

  #log{flex:0 0 auto;height:54px;overflow-y:auto;background:var(--panel);
    border-bottom:1px solid var(--line);padding:6px 12px;font-size:12px;line-height:1.5;color:var(--dim);}
  #log .l-dmg{color:#e58a8a;} #log .l-heal{color:var(--green);}
  #log .l-sys{color:var(--gold);} #log .l-sp{color:var(--sp);} #log .l-xp{color:var(--xp);}
  #log .l-crit{color:#ffd54a;font-weight:700;text-shadow:0 0 6px rgba(255,170,40,.7);}

  #menu{flex:1 1 auto;overflow-y:auto;-webkit-overflow-scrolling:touch;
    background:linear-gradient(180deg,var(--panel2),var(--bg));
    padding:10px 12px calc(14px + env(safe-area-inset-bottom));}
  .menu-head{font-family:'Cinzel',serif;font-size:11px;letter-spacing:3px;color:var(--dim);
    text-transform:uppercase;margin:2px 0 8px;display:flex;justify-content:space-between;align-items:center;}
  .menu-head .turn{color:var(--gold);}
  .subhead{font-size:11px;color:var(--dim);letter-spacing:1px;margin:12px 0 6px;border-top:1px solid var(--line);padding-top:8px;}

  .skill{display:flex;align-items:center;gap:10px;background:var(--panel);border:1px solid var(--line);
    border-left:3px solid var(--gold);border-radius:7px;padding:10px 11px;margin-bottom:8px;
    transition:transform .08s,background .15s,opacity .2s;position:relative;overflow:hidden;}
  .skill:active{transform:scale(.985);}
  .skill .icon{font-size:26px;width:34px;text-align:center;}
  .skill .info{flex:1;min-width:0;}
  .skill .sname{font-size:14px;font-weight:700;color:var(--ink);}
  .skill .sdesc{font-size:11px;color:var(--dim);margin-top:2px;line-height:1.35;}
  .skill .cost{flex:0 0 auto;text-align:center;min-width:50px;}
  .skill .cost .c-sp{font-family:'Cinzel',serif;font-size:13px;color:var(--sp);}
  .skill .cost .c-ct{font-size:10px;color:var(--dim);}
  .skill.instant{border-left-color:#5fd0b8;}
  .skill.disabled{opacity:.4;border-left-color:#444;}
  .skill.cooling{opacity:.55;border-left-color:var(--blood);}
  .skill .cdbadge{position:absolute;right:8px;bottom:6px;font-size:10px;color:var(--blood);}
  .skill.item-row{border-left-color:var(--green);}
  .skill .price{flex:0 0 auto;text-align:right;min-width:58px;font-family:'Cinzel',serif;font-size:13px;color:var(--gold);}
  .skill.cant{opacity:.45;}

  .choice{display:block;width:100%;text-align:left;background:var(--panel);border:1px solid var(--gold);
    border-radius:7px;padding:13px 14px;margin-bottom:9px;color:var(--ink);
    font-family:'Shippori Mincho',serif;font-size:14px;transition:transform .08s,background .15s;}
  .choice:active{transform:scale(.985);background:var(--panel2);}
  .choice .c-sub{display:block;font-size:11px;color:var(--dim);margin-top:3px;}
  .choice.rare,.choice.r-rare{border-color:#a86fd9;border-left:3px solid #a86fd9;}
  .choice.r-normal{border-color:#e0b34a;border-left:3px solid #e0b34a;}
  .choice.r-epic{border-color:#e06a6a;border-left:3px solid #e06a6a;box-shadow:0 0 8px rgba(224,106,106,.35);}
  .choice.mode-explore{border-color:#5aa86a;border-left:3px solid #5aa86a;}
  .choice.mode-build{border-color:#bf8fe0;border-left:3px solid #bf8fe0;}
  .enemy.elite-foe .sprite{filter:hue-rotate(-35deg) saturate(1.35) brightness(0.92) drop-shadow(0 0 8px rgba(192,70,143,.6));}
  .choice .c-ico{font-size:20px;margin-right:6px;}

  .endpass{width:100%;background:var(--blood);border:none;color:#fff;padding:14px;border-radius:8px;
    font-family:'Cinzel',serif;font-size:14px;letter-spacing:2px;margin-top:4px;transition:transform .08s,filter .15s;}
  .endpass:active{transform:scale(.98);filter:brightness(1.15);}
  .endpass.flee{background:#3a3346;} .endpass.go{background:#2e5b3a;}

  .floater{position:absolute;font-family:'Cinzel',serif;font-weight:700;font-size:22px;pointer-events:none;
    z-index:20;animation:float 1s ease-out forwards;text-shadow:0 2px 4px #000;}
  @keyframes float{0%{opacity:1;transform:translateY(0)}100%{opacity:0;transform:translateY(-46px)}}
  .floater.critnum{font-size:40px;color:#ffd54a;font-weight:900;-webkit-text-stroke:1.5px #7a3b00;
    text-shadow:0 0 10px rgba(255,180,40,.9),0 3px 6px #000;transform-origin:center;
    animation:critpop 1.1s ease-out forwards;}
  @keyframes critpop{0%{opacity:0;transform:translate(-50%,0) scale(.4)}18%{opacity:1;transform:translate(-50%,-6px) scale(1.35)}34%{transform:translate(-50%,-10px) scale(1)}100%{opacity:0;transform:translate(-50%,-52px) scale(1)}}
  .floater.critlabel{font-size:20px;color:#fff3c4;letter-spacing:2px;font-weight:900;
    text-shadow:0 0 8px #ff8c2e,0 2px 4px #000;transform:translateX(-50%);
    animation:critlab 1.1s ease-out forwards;}
  @keyframes critlab{0%{opacity:0;transform:translateX(-50%) scale(.6)}20%{opacity:1;transform:translateX(-50%) scale(1.1)}80%{opacity:1}100%{opacity:0;transform:translateX(-50%) translateY(-14px)}}
  .critflash{position:absolute;inset:0;z-index:18;pointer-events:none;
    background:radial-gradient(circle at 50% 32%,rgba(255,200,60,.55),rgba(255,160,30,0) 60%);
    animation:critfl .32s ease-out forwards;}
  @keyframes critfl{0%{opacity:0}25%{opacity:1}100%{opacity:0}}
  .floater.doomnum{font-size:40px;color:#c77bff;font-weight:900;-webkit-text-stroke:1.5px #3a0a4a;
    text-shadow:0 0 12px rgba(180,60,220,.95),0 3px 6px #000;transform-origin:center;
    animation:critpop 1.1s ease-out forwards;}
  .floater.doomlabel{font-size:20px;color:#e7c4ff;letter-spacing:2px;font-weight:900;
    text-shadow:0 0 8px #a33bff,0 2px 4px #000;transform:translateX(-50%);
    animation:critlab 1.1s ease-out forwards;}
  .doomflash{position:absolute;inset:0;z-index:18;pointer-events:none;
    background:radial-gradient(circle at 50% 32%,rgba(170,50,220,.5),rgba(90,20,140,0) 62%);
    animation:critfl .36s ease-out forwards;}

  #overlay{position:fixed;inset:0;z-index:50;display:none;background:rgba(6,4,10,.92);
    flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:30px;
    overflow-y:auto;}
  #overlay.show{display:flex;}
  #overlay.win{justify-content:flex-start;padding-top:24px;padding-bottom:24px;}
  #overlay h1{font-family:'Cinzel',serif;font-size:30px;letter-spacing:3px;margin-bottom:12px;}
  #overlay .ov-sub{color:var(--dim);font-size:14px;line-height:1.7;margin-bottom:24px;max-width:340px;}
  #overlay button{background:var(--gold);color:#1a140a;border:none;padding:14px 36px;border-radius:8px;
    font-family:'Cinzel',serif;font-size:15px;letter-spacing:2px;}
  #overlay button:active{filter:brightness(1.1);}
  .win h1{color:var(--gold);} .lose h1{color:var(--blood);}

  /* 道具コマンドボタン */
  .itemcmd{width:100%;display:flex;align-items:center;justify-content:center;gap:8px;
    background:var(--panel);border:1px solid var(--green);border-radius:8px;color:var(--ink);
    padding:12px;margin-bottom:8px;font-family:'Cinzel',serif;font-size:14px;letter-spacing:1px;
    transition:transform .08s,background .15s;}
  .itemcmd:active{transform:scale(.985);background:var(--panel2);}
  .itemcmd .badge{background:var(--green);color:#0d1a10;border-radius:10px;font-size:11px;padding:1px 8px;font-family:'Shippori Mincho',serif;}
  .itemcmd.empty{opacity:.5;border-color:var(--line);}

  /* 道具パネル（ボトムシート） */
  #itemPanel{position:fixed;inset:0;z-index:60;display:none;background:rgba(6,4,10,.6);
    align-items:flex-end;}
  #itemPanel.show{display:flex;animation:fade .15s;}
  @keyframes fade{from{opacity:0}to{opacity:1}}
  .ip-card{width:100%;max-height:70dvh;overflow-y:auto;background:var(--panel2);
    border-top:2px solid var(--green);border-radius:14px 14px 0 0;
    padding:14px 14px calc(20px + env(safe-area-inset-bottom));animation:slideup .2s ease-out;}
  @keyframes slideup{from{transform:translateY(40px)}to{transform:translateY(0)}}
  .ip-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;
    font-family:'Cinzel',serif;font-size:15px;letter-spacing:2px;color:var(--green);
    position:sticky;top:0;z-index:2;background:var(--panel2);
    padding:6px 2px 8px;margin-top:-4px;border-bottom:1px solid var(--line);}
  #ipClose{background:transparent;border:1px solid var(--line);color:var(--dim);border-radius:6px;
    font-size:14px;padding:4px 11px;}
  #ipClose:active{filter:brightness(1.4);}
  .ip-empty{color:var(--dim);font-size:13px;text-align:center;padding:18px 0;}

  /* スキルツリー コマンド */
  .treecmd{width:100%;display:flex;align-items:center;justify-content:center;gap:8px;
    background:var(--panel);border:1px solid var(--xp);border-radius:8px;color:var(--ink);
    padding:12px;margin-bottom:8px;font-family:'Cinzel',serif;font-size:14px;letter-spacing:1px;
    transition:transform .08s,background .15s;}
  .treecmd:active{transform:scale(.985);background:var(--panel2);}
  .treecmd .badge{background:var(--xp);color:#1a1024;border-radius:10px;font-size:11px;padding:1px 8px;font-family:'Shippori Mincho',serif;}
  .treecmd.glow{box-shadow:0 0 10px rgba(192,143,224,.5);animation:pulse 1.6s infinite;}
  .passcmd{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;
    background:rgba(122,95,160,.09);border:1px solid rgba(122,95,160,.28);border-radius:8px;color:var(--ink);
    padding:7px 12px;margin:2px 0 8px;font-family:'Cinzel',serif;font-size:12px;letter-spacing:.5px;
    transition:transform .08s,background .15s;}
  .passcmd:active{transform:scale(.985);background:rgba(122,95,160,.18);}
  .passcmd .badge{border-radius:10px;font-size:11px;padding:1px 8px;font-family:'Shippori Mincho',serif;}
  @keyframes pulse{0%,100%{box-shadow:0 0 6px rgba(192,143,224,.3)}50%{box-shadow:0 0 14px rgba(192,143,224,.7)}}

  /* ツリーパネル */
  #treePanel{position:fixed;inset:0;z-index:60;display:none;background:rgba(6,4,10,.6);align-items:flex-end;}
  #treePanel.show{display:flex;animation:fade .15s;}
  .tp-card{width:100%;max-height:82dvh;overflow-y:auto;background:var(--panel2);
    border-top:2px solid var(--xp);border-radius:14px 14px 0 0;
    padding:14px 12px calc(20px + env(safe-area-inset-bottom));animation:slideup .2s ease-out;}
  .tp-skp{text-align:center;font-size:12px;color:var(--xp);margin-bottom:10px;letter-spacing:1px;}
  .tree-page2-head{text-align:center;font-family:'Cinzel',serif;font-size:13px;letter-spacing:2px;color:var(--gold);margin:18px 0 10px;padding-top:14px;border-top:1px dashed var(--line);}
  .tree-tabs{display:flex;gap:8px;margin-bottom:12px;}
  .tree-tab{flex:1;background:var(--panel2);border:1px solid var(--line);color:var(--dim);font-family:'Cinzel',serif;font-size:13px;letter-spacing:1px;padding:9px 0;border-radius:8px;cursor:pointer;}
  .tree-tab.on{background:var(--gold);color:#1a1206;border-color:var(--gold);font-weight:bold;}
  .tree-col{margin-bottom:14px;}
  .tree-title{font-family:'Cinzel',serif;font-size:13px;letter-spacing:2px;margin-bottom:8px;
    display:flex;align-items:center;gap:7px;padding-bottom:5px;border-bottom:1px solid var(--line);}
  .tnode{display:flex;align-items:center;gap:10px;border:1px solid var(--line);border-radius:8px;
    padding:9px 11px;margin-bottom:6px;position:relative;background:var(--panel);transition:transform .08s;}
  .tnode:active{transform:scale(.99);}
  .tnode .ti{font-size:22px;width:30px;text-align:center;}
  .tnode .tinfo{flex:1;min-width:0;}
  .tnode .tn{font-size:13px;font-weight:700;}
  .tnode .td{font-size:11px;color:var(--dim);margin-top:1px;}
  .tnode .tstat{font-size:11px;font-family:'Cinzel',serif;flex:0 0 auto;}
  .tnode.owned{opacity:.85;border-left:3px solid var(--green);}
  .tnode.owned .tstat{color:var(--green);}
  .tnode.available{border-left:3px solid var(--xp);box-shadow:0 0 8px rgba(192,143,224,.25);}
  .tnode.available .tstat{color:var(--xp);}
  .tnode.locked{opacity:.4;border-left:3px solid #3a3346;}
  .tnode.locked .tstat{color:var(--dim);}

:root{--dungeon-image:url("/games/lantern/assets/50c3da44b3.webp");--enemy-atlas:url("/games/lantern/assets/c4653e8b57.webp");--scene-atlas:url("/games/lantern/assets/d7f0831ffe.webp");}
/* THE LAST LANTERN — presentation layer, edition 3 */
:root {
  color-scheme: dark;
  --bg: #0b1118;
  --panel: #121a23;
  --panel2: #17212c;
  --ink: #ede7d9;
  --dim: #a1a9b3;
  --gold: #c8aa71;
  --blood: #bf7370;
  --enemy: #c07874;
  --sp: #8db8c4;
  --hp: #b9766c;
  --green: #86b4a2;
  --xp: #b1a5ca;
  --line: #2b3642;
  --ember: #d98b52;
  --display: 'Yu Mincho', 'Hiragino Mincho ProN', 'Shippori Mincho', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif;
  --latin: Georgia, 'Times New Roman', serif;
  --focus: #e5c68c;
}

html { height: 100%; background: var(--bg); }
body {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  color: var(--ink);
  background: radial-gradient(ellipse at 20% 0%, #1a242d, transparent 65%), #090e14;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled, [aria-disabled="true"] { cursor: default; }
button:focus-visible, [role="button"]:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
button, [data-act] { -webkit-tap-highlight-color: rgba(200, 170, 113, .12); }
svg { display: inline-block; width: 22px; height: 22px; flex: 0 0 auto; vertical-align: middle; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
* { scrollbar-width: thin; scrollbar-color: #465160 transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: #465160; border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* One coherent frame: illustration, command desk, and journal. */
#appFrame {
  width: min(1440px, calc(100% - 80px));
  height: calc(100dvh - 64px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(155, 170, 184, .16);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: 0 24px 90px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .025) inset;
}
#appHeader {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 76px;
  min-height: 76px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: #111820;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 13px; padding: 0; min-height: 44px; background: transparent; border: 0; text-align: left; }
.brand-mark { width: 35px; height: 44px; color: var(--gold); }
.brand-mark svg { width: 31px; height: 38px; }
.brand-type { display: flex; flex-direction: column; gap: 2px; }
.brand-type b { font-family: var(--display); font-size: 19px; font-weight: 600; letter-spacing: .14em; }
.brand-type small { font-family: var(--latin); font-size: 9px; letter-spacing: .2em; color: var(--gold); }
.journey-meta { display: flex; align-items: center; gap: 16px; margin-left: auto; color: var(--dim); font-size: 12px; letter-spacing: .035em; }
.save-indicator { display: flex; align-items: center; gap: 5px; color: var(--green); font-size: 10px; white-space: nowrap; }
.save-indicator svg { width: 12px; height: 12px; }
.header-tools { display: flex; gap: 5px; }
.tool-btn, #muteBtn {
  position: static;
  display: inline-flex;
  width: 44px;
  height: 44px;
  padding: 10px;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.tool-btn svg, #muteBtn svg { width: 20px; height: 20px; }
.tool-btn:hover, #muteBtn:hover { color: var(--ink); border-color: var(--line); background: rgba(255, 255, 255, .035); }
.tool-btn[aria-pressed="true"] { color: var(--gold); }
#gameShell { display: grid; grid-template-columns: minmax(0, 1fr) 410px; grid-template-rows: minmax(0, 1fr) 88px; flex: 1; min-height: 0; }
#stage {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 0;
  isolation: isolate;
  overflow: hidden;
  border: 0;
  background: linear-gradient(180deg, rgba(7, 12, 18, .1) 15%, rgba(7, 12, 18, .15) 55%, rgba(7, 12, 18, .72)), var(--dungeon-image, none) center center / cover;
}
#stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, transparent 25%, rgba(5, 10, 16, .34) 100%), linear-gradient(90deg, rgba(10, 16, 23, .1), transparent 25%, transparent 75%, rgba(10, 16, 23, .2));
}
#stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: .1;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255, 255, 255, .075) 3px, transparent 4px);
  mix-blend-mode: soft-light;
}
.stage-atmosphere { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.stage-atmosphere i { position: absolute; bottom: 5%; left: 20%; width: 2px; height: 2px; background: #eab56e; border-radius: 50%; opacity: 0; box-shadow: 0 0 8px 1px rgba(225, 158, 77, .6); animation: ember-rise 10s linear infinite; }
.stage-atmosphere i:nth-child(2) { left: 33%; animation-delay: -3s; animation-duration: 12s; }
.stage-atmosphere i:nth-child(3) { left: 74%; animation-delay: -5s; animation-duration: 14s; }
.stage-atmosphere i:nth-child(4) { left: 12%; animation-delay: -7s; animation-duration: 11s; }
.stage-atmosphere i:nth-child(5) { left: 65%; animation-delay: -2s; animation-duration: 13s; }
.stage-atmosphere i:nth-child(6) { left: 83%; animation-delay: -9s; animation-duration: 15s; }
.stage-atmosphere i:nth-child(7) { left: 45%; animation-delay: -6s; animation-duration: 12s; }
.stage-atmosphere i:nth-child(8) { left: 56%; animation-delay: -4s; animation-duration: 10s; }
@keyframes ember-rise { 0% { transform: translate(0, 0); opacity: 0; } 15%, 75% { opacity: .4; } 100% { transform: translate(20px, -290px); opacity: 0; } }
.stage-top { position: absolute; top: 22px; left: 24px; right: 24px; display: flex; align-items: center; justify-content: space-between; z-index: 4; }
.floorbadge, .goldbadge { position: static; display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; color: var(--ink); border: 1px solid rgba(191, 201, 212, .2); border-radius: 5px; background: rgba(10, 16, 23, .63); backdrop-filter: blur(8px); font-family: var(--sans); font-size: 12px; letter-spacing: .1em; }
.floorbadge span { color: var(--dim); font-size: 10px; }
.goldbadge { color: var(--gold); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.goldbadge svg { width: 16px; height: 16px; }
#stageCaption { position: absolute; bottom: 25px; left: 20px; right: 20px; color: #d6c9ae; font-family: var(--latin); font-size: 10px; letter-spacing: .35em; text-align: center; opacity: 0; pointer-events: none; }
#sceneZone { position: absolute; top: 61px; bottom: 139px; left: 0; right: 0; z-index: 2; display: flex; align-items: center; justify-content: center; }

/* Title: let the cathedral breathe around the typography. */
body[data-view="title"] #playerStatus, body[data-view="title"] .stage-top { display: none; }
body[data-view="title"] #stageCaption { opacity: .7; }
body[data-view="title"] #sceneZone { top: 0; bottom: 0; padding: 24px; }
body[data-view="title"] #stage { background-position: 50% 50%; }
body[data-view="title"] #stage::before { background: linear-gradient(180deg, rgba(7, 13, 19, .08), rgba(7, 13, 19, .28)), radial-gradient(ellipse at 50% 46%, rgba(7, 12, 18, .1), rgba(7, 12, 18, .28)); }
.title-scene { position: relative; max-width: 650px; margin-top: -15px; text-align: center; text-shadow: 0 2px 18px rgba(0, 0, 0, .85); }
.title-scene .kicker { color: #d5bd93; font-family: var(--latin); font-size: 11px; letter-spacing: .38em; margin-bottom: 18px; }
.title-scene h1 { color: #f3eddf; font-family: var(--display); font-weight: 500; font-size: clamp(34px, 4.5vw, 54px); letter-spacing: .13em; line-height: 1.4; white-space: nowrap; }
.title-scene .subtitle { font-family: var(--latin); font-size: 14px; letter-spacing: .28em; color: #d4bc90; margin-top: 9px; }
.title-flourish { display: flex; align-items: center; justify-content: center; gap: 16px; color: var(--gold); margin: 24px auto 20px; }
.title-flourish::before, .title-flourish::after { content: ''; width: 58px; height: 1px; background: linear-gradient(90deg, transparent, rgba(200, 170, 113, .7)); }
.title-flourish::after { transform: rotate(180deg); }
.title-flourish svg { width: 26px; height: 32px; }
.title-tagline { font-family: var(--display); font-size: 14px; letter-spacing: .12em; color: #e1d8c5; line-height: 1.8; }
.panel-heading { margin: 4px 0 26px; }
.eyebrow { color: var(--gold); font-family: var(--latin); font-size: 10px; line-height: 1.4; letter-spacing: .18em; margin-bottom: 10px; }
.panel-title { font-family: var(--display); font-size: 24px; font-weight: 500; letter-spacing: .1em; line-height: 1.5; }
.panel-description { color: var(--dim); font-size: 13px; line-height: 1.8; margin-top: 10px; }
.mode-choice { position: relative; display: block; width: 100%; padding: 19px 44px 19px 60px; margin: 0 0 12px; border: 1px solid #3c4753; border-radius: 8px; color: var(--ink); background: linear-gradient(115deg, #202a34, #16202a); text-align: left; transition: border-color .2s, background .2s, transform .15s; }
.mode-choice .mode-icon { position: absolute; top: 23px; left: 19px; color: var(--gold); }
.mode-choice .mode-icon svg { width: 24px; height: 24px; }
.mode-choice .mode-name { display: block; font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.mode-choice .mode-text { display: block; color: #b0b7bd; font-size: 12px; line-height: 1.6; margin-top: 6px; }
.mode-choice .mode-arrow { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--dim); }
.mode-choice .mode-arrow svg { width: 17px; height: 17px; }
.mode-choice.primary { border-color: #c3a676; background: linear-gradient(115deg, #d2b584, #bea06c); color: #1d211f; box-shadow: 0 4px 20px rgba(0, 0, 0, .15); }
.mode-choice.primary .mode-icon, .mode-choice.primary .mode-arrow { color: #3c3b2d; }
.mode-choice.primary .mode-text { color: #4a4638; }
.mode-choice:hover { border-color: #aaa18a; background: #26313b; transform: translateY(-1px); }
.mode-choice.primary:hover { background: linear-gradient(115deg, #ddc395, #c7ac7b); border-color: #e1c995; }
.mode-choice:active { transform: translateY(1px); }
.mode-choice.continue { border-color: rgba(134, 180, 162, .45); }
.mode-choice.continue .mode-icon { color: var(--green); }
.title-note { display: flex; align-items: center; gap: 7px; margin: 15px 0 24px; color: var(--dim); font-size: 11px; }
.title-note svg { width: 14px; height: 14px; color: var(--green); }
.title-records { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0 21px; padding: 19px 0 0; border-top: 1px solid var(--line); }
.title-records div { display: flex; flex-direction: column; gap: 5px; }
.title-records small, .record-label { font-size: 11px; color: var(--dim); }
.title-records b { font-family: var(--latin); font-size: 23px; color: var(--ink); font-weight: 400; }
.title-records b span { font-family: var(--sans); font-size: 11px; color: var(--dim); margin-left: 3px; }
.secondary-links { display: flex; gap: 18px; margin-top: 18px; }
.secondary-links button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; padding: 0; color: var(--dim); border: 0; background: transparent; font-size: 12px; }
.secondary-links button:hover { color: var(--ink); }
.secondary-links svg { width: 15px; height: 15px; }

/* Creatures use the painted atlas; motion stays quiet until a hit. */
#sceneZone > .enemy { position: relative; width: min(100%, 500px); display: flex; flex-direction: column; align-items: center; text-align: center; transition: transform .15s, opacity .35s; }
.enemy-kicker { color: #cabbab; font-family: var(--latin); font-size: 9px; letter-spacing: .24em; margin-bottom: 4px; text-shadow: 0 2px 9px #000; }
.ename { order: 0; font-family: var(--display); color: var(--ink); font-size: 21px; font-weight: 600; letter-spacing: .09em; margin: 0; line-height: 1.4; text-shadow: 0 2px 15px #000; }
.enemy .sprite { position: relative; order: 1; display: flex; align-items: center; justify-content: center; font-size: inherit; line-height: 0; margin: 0; animation: creature-breathe 5s ease-in-out infinite; filter: drop-shadow(0 14px 20px rgba(0, 0, 0, .8)); }
.enemy-art { width: clamp(200px, 28dvh, 340px); background-image: var(--enemy-atlas, none); background-size: 400% 300%; background-repeat: no-repeat; display: block; filter: drop-shadow(0 0 20px rgba(40, 53, 61, .2)); }
.enemy.elite-foe .sprite { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .85)) drop-shadow(0 0 15px rgba(178, 116, 72, .2)); }
.enemy.boss-foe .enemy-kicker, .enemy.elite-foe .enemy-kicker { color: #d5ad76; }
@keyframes creature-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.ebar-wrap { order: 2; width: 260px; max-width: calc(100% - 50px); margin: 1px auto 0; }
.ebar-bg { height: 5px; border: 0; background: rgba(5, 9, 13, .9); border-radius: 3px; overflow: hidden; box-shadow: 0 1px 0 rgba(255, 255, 255, .12); }
.ebar-fill { height: 100%; background: linear-gradient(90deg, #99625e, #c18479); transition: width .4s; }
.ehp-txt { font-family: var(--sans); font-size: 10px; color: #d1c8bc; margin-top: 5px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 6px #000; }
.enemy-status { display: flex; gap: 5px; align-items: center; justify-content: center; min-height: 0; margin-top: 5px; }
.enemy-status:empty { display: none; }
.enemy-status span { display: inline-flex; align-items: center; gap: 3px; color: #e0c39b; background: rgba(10, 16, 23, .85); border: 1px solid rgba(167, 182, 195, .22); border-radius: 4px; padding: 2px 6px; font-size: 10px; }
.enemy-status svg { width: 12px; height: 12px; }
.esp { gap: 4px; margin-top: 6px; }
.epip { width: 5px; height: 5px; border: 1px solid #b87970; border-radius: 1px; transform: rotate(45deg); }
.epip.on { background: #ca8b7e; box-shadow: none; }
.intent { order: 3; display: flex; align-items: center; gap: 9px; min-height: 42px; max-width: calc(100% - 32px); margin: 12px 0 0; padding: 9px 13px; background: rgba(10, 16, 23, .88); color: #dbd0b9; border: 1px solid rgba(192, 164, 117, .32); border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, .22); font-family: var(--sans); font-size: 12px; line-height: 1.45; text-align: left; backdrop-filter: blur(8px); }
.intent > svg { width: 19px; height: 19px; color: var(--gold); }
.intent-title { font-weight: 500; }
.intent-value { color: #e1aa94; font-weight: 600; margin-left: 5px; font-variant-numeric: tabular-nums; }
.intent.danger { color: #edc1ae; border-color: rgba(217, 139, 82, .5); font-weight: 400; animation: none; background: rgba(46, 27, 25, .9); }
.intent.danger > svg { color: var(--ember); }
.intent.idle { border-color: rgba(134, 180, 162, .3); color: #bed2c7; }
.enemy.hit { animation: shake .3s; }
.enemy.hit-strong { animation: shakebig .42s; }
.enemy.dead { opacity: 0; transform: translateY(8px) scale(.96); }
.scene-icon { display: flex; flex-direction: column; align-items: center; max-width: 410px; padding: 22px; text-align: center; color: var(--gold); }
.scene-icon .big { display: flex; align-items: center; justify-content: center; width: 125px; height: 125px; margin: 0 0 17px; border: 1px solid rgba(200, 170, 113, .24); border-radius: 50%; background: radial-gradient(ellipse, rgba(19, 29, 38, .8), rgba(10, 16, 22, .3)); font-size: inherit; animation: creature-breathe 6s ease-in-out infinite; filter: drop-shadow(0 8px 20px #000); box-shadow: 0 0 0 9px rgba(200, 170, 113, .03); }
.scene-icon .big svg { width: 65px; height: 65px; }
.scene-icon .lab { font-family: var(--display); font-size: 28px; color: var(--ink); letter-spacing: .12em; margin: 0; line-height: 1.5; text-shadow: 0 2px 12px #000; }
.scene-icon .sub { max-width: 340px; color: #c2c0b8; font-size: 13px; line-height: 1.75; margin-top: 10px; text-shadow: 0 2px 8px #000; }

/* The player's resources are a fixed visual anchor. */
#playerStatus { position: absolute; bottom: 16px; left: 24px; right: 24px; z-index: 4; padding: 14px 16px 11px; background: rgba(12, 19, 27, .89); border: 1px solid rgba(159, 176, 190, .27); border-radius: 9px; backdrop-filter: blur(15px); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.pname { display: flex; justify-content: space-between; align-items: center; font-family: var(--sans); font-size: 12px; letter-spacing: .035em; margin-bottom: 11px; }
.player-name { display: flex; align-items: center; gap: 7px; }
.player-name svg { width: 14px; height: 17px; color: var(--gold); }
.player-name b { color: var(--gold); font-family: var(--latin); font-size: 11px; font-weight: 400; margin-left: 5px; }
.pname .shield { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: #bed0d4; }
.shield svg { width: 13px; height: 13px; }
.status-meters { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 22px; }
.bar { gap: 8px; margin: 0; }
.status-meters .hp-bar { grid-column: 1 / -1; }
.bar label { width: 28px; font-family: var(--sans); font-size: 10px; color: #b3bbc0; white-space: nowrap; }
.track { border: 0; height: 5px; border-radius: 3px; background: #080d13; }
.hp-bar .track { height: 7px; }
.fill-hp { background: linear-gradient(90deg, #8f5c54, #bd8b76); }
.fill-sp { background: linear-gradient(90deg, #668b99, #9cc0c5); }
.fill-xp { background: linear-gradient(90deg, #7b728f, #b0a5c3); }
.bar .num { width: 62px; font-size: 10px; font-variant-numeric: tabular-nums; color: #dddacf; }
.sp-row { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; min-height: 12px; }
#spPips { gap: 5px; margin: 0 0 0 36px; }
.pip { width: 8px; height: 8px; border: 1px solid #658392; border-radius: 2px; background: transparent; transform: rotate(45deg); }
.pip.on { background: #a1c1c9; box-shadow: 0 0 8px rgba(149, 192, 207, .22); }
.sp-recovery { font-size: 9px; letter-spacing: .03em; color: var(--dim); }

/* The journal and command panel form the quieter half of the screen. */
#logWrap { grid-column: 1; grid-row: 2; display: flex; align-items: stretch; min-width: 0; min-height: 0; border-top: 1px solid var(--line); background: #0f1720; }
.journal-label { flex: 0 0 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: #939b9e; font-size: 10px; border-right: 1px solid rgba(161, 169, 179, .12); }
.journal-label svg { width: 16px; height: 16px; }
#log { flex: 1; min-width: 0; height: auto; border: 0; padding: 11px 16px; overflow-y: auto; color: #b3bbc0; font-size: 12px; line-height: 1.7; background: transparent; }
#log .l-dmg { color: #dd9d92; }
#log .l-heal { color: #a4c9b8; }
#log .l-sys { color: #d8bf92; }
#log .l-sp { color: #abd0d9; }
#log .l-xp { color: #c1b6d5; }
#log .l-crit { color: #e6c588; font-weight: 600; text-shadow: none; }
#commandPanel { grid-column: 2; grid-row: 1 / -1; min-height: 0; min-width: 0; border-left: 1px solid var(--line); background: #111922; }
#menu { height: 100%; min-height: 0; padding: 26px 25px 24px; overflow-y: auto; overscroll-behavior: contain; background: linear-gradient(135deg, rgba(31, 42, 54, .18), transparent 50%); }
.menu-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 17px; font-family: var(--sans); color: var(--ink); font-size: 14px; letter-spacing: .04em; font-weight: 500; }
.menu-head > span:first-child { display: flex; align-items: center; gap: 7px; }
.menu-head svg { width: 17px; height: 17px; color: var(--gold); }
.menu-head .turn { color: var(--gold); font-family: var(--latin); font-size: 11px; white-space: nowrap; letter-spacing: .08em; }
.subhead { margin: 21px 0 10px; border-top: 1px solid var(--line); padding-top: 15px; color: #b9bfc2; font-size: 12px; letter-spacing: .04em; line-height: 1.7; }
.subhead:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.panel-tip { display: flex; align-items: flex-start; gap: 7px; margin: 14px 0 0; font-size: 11px; line-height: 1.7; color: var(--dim); }
.panel-tip svg { width: 14px; height: 14px; margin-top: 2px; color: var(--gold); }
.skill-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
.skill { width: 100%; display: flex; align-items: center; gap: 11px; min-height: 82px; margin-bottom: 9px; padding: 13px 12px; color: var(--ink); text-align: left; font-family: var(--sans); border: 1px solid #33404e; border-left: 2px solid #a58c61; border-radius: 7px; background: linear-gradient(120deg, #1b2531, #151f2a); overflow: hidden; transition: border-color .15s, background .15s, transform .1s, opacity .2s; }
.skill-grid .skill { margin: 0; }
.skill .icon { display: flex; align-items: center; justify-content: center; flex: 0 0 34px; width: 34px; height: 40px; color: #c3af8c; font-size: 0; }
.skill .icon svg { width: 29px; height: 29px; }
.skill .info { flex: 1; min-width: 0; }
.skill .sname { display: block; font-family: var(--sans); font-size: 13px; color: var(--ink); font-weight: 600; line-height: 1.6; }
.skill .sdesc { display: block; color: #b1bbc3; font-size: 12px; line-height: 1.65; margin-top: 3px; }
.skill .cost { min-width: 43px; flex: 0 0 auto; align-self: center; text-align: right; }
.skill .cost .c-sp { display: block; color: #acccd3; font-family: var(--sans); font-size: 12px; font-weight: 500; white-space: nowrap; }
.skill .cost .c-ct { display: block; color: #a1abb5; font-size: 9px; margin-top: 3px; }
.skill .price { color: var(--gold); min-width: 50px; font-family: var(--sans); font-size: 12px; }
.skill .cdbadge { position: static; display: block; color: #cf9690; margin-top: 3px; font-size: 10px; }
.skill-key { position: absolute; bottom: 4px; left: 5px; min-width: 13px; color: #82909d; font-family: var(--sans); font-size: 8px; line-height: 1.5; }
.skill.instant { border-left-color: #7caa98; }
.skill.instant .icon { color: #9bbcab; }
.instant-tag { display: inline-block; color: #a0cbb8; margin-left: 4px; font-weight: 400; font-size: 9px; }
.skill:hover:not(.disabled):not(.cooling):not(.cant):not(:disabled) { background: #25313e; border-color: #687279; }
.skill:active:not(:disabled) { transform: translateY(1px); }
.skill.disabled, .skill.cooling { opacity: .54; border-left-color: #54616e; background: #141d26; }
.skill.cooling { border-left-color: #9d6864; }
.skill.item-row { border-left-color: var(--green); }
.skill.item-row .icon { color: #a4cbb7; }
.skill.cant { opacity: .52; }
.battle-tools { display: flex; gap: 9px; margin-top: 15px; }
.itemcmd, .treecmd { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 44px; margin: 0 0 9px; padding: 10px; border: 1px solid #354350; border-radius: 6px; font-family: var(--sans); font-size: 11px; color: #d1d4ce; letter-spacing: 0; background: rgba(26, 38, 49, .6); transition: background .15s, border-color .15s; }
.itemcmd svg, .treecmd svg { width: 16px; height: 16px; color: #a2bcb0; }
.treecmd svg { color: #b5abca; }
.itemcmd .badge, .treecmd .badge, .passcmd .badge { display: inline-flex; align-items: center; justify-content: center; padding: 1px 6px; border-radius: 4px; color: #cbd6d0; background: #2d403d; font-family: var(--sans); font-size: 9px; line-height: 1.5; white-space: nowrap; }
.treecmd .badge { color: #d2c8e3; background: #383345; }
.itemcmd:hover, .treecmd:hover { background: #24313d; border-color: #61716e; }
.itemcmd.empty { opacity: .5; border-color: #354350; }
.treecmd.glow { box-shadow: none; border-color: #9787b2; animation: none; }
.passcmd { min-height: 44px; display: flex; justify-content: space-between; align-items: center; gap: 7px; padding: 10px 12px; margin: 10px 0; border: 1px solid #343343; border-radius: 6px; background: rgba(57, 49, 69, .22); color: #d1cbdc; font-family: var(--sans); font-size: 11px; letter-spacing: 0; }
.passcmd > span { display: inline-flex; gap: 5px; align-items: center; }
.passcmd svg { width: 15px; height: 15px; }
.passcmd:hover { border-color: #776a8a; background: rgba(57, 49, 69, .45); }
.endpass { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin: 11px 0 0; padding: 13px; border: 1px solid #6f6b5a; border-radius: 7px; color: #eee6d5; background: #3b4140; font-family: var(--sans); font-size: 13px; letter-spacing: .04em; transition: background .15s, border-color .15s, transform .1s; }
.endpass svg { width: 17px; height: 17px; }
.endpass.flee { background: #1e2934; border-color: #3e4a55; color: #c5ccd0; }
.endpass.go { background: #334b43; border-color: #587a65; color: #e1eade; }
.endpass:hover:not(:disabled) { filter: none; background: #4d5450; border-color: #9a9174; }
.endpass.go:hover { background: #405e52; }
.endpass.flee:hover { background: #2b3945; border-color: #627180; }
.endpass:active { transform: translateY(1px); filter: none; }
.endpass:disabled, .endpass.busy { color: #a4aea9; border-color: #354350; background: #1d2930; }
.endpass.busy svg { animation: thinking-turn 1s linear infinite; }
@keyframes thinking-turn { to { transform: rotate(360deg); } }

/* Choices and the branching route share a single restrained card system. */
.choice { display: block; width: 100%; min-height: 56px; padding: 15px 15px; margin-bottom: 10px; border: 1px solid #3a4651; border-radius: 7px; color: var(--ink); background: linear-gradient(120deg, #1c2732, #151f29); font-family: var(--sans); font-size: 13px; text-align: left; line-height: 1.6; transition: transform .1s, border-color .15s, background .15s; }
.choice .c-sub { font-size: 12px; color: #b2bcc4; line-height: 1.65; margin-top: 5px; }
.choice .c-ico { display: inline-flex; align-items: center; justify-content: center; color: var(--gold); margin: 0 8px 0 0; font-size: 0; vertical-align: middle; }
.choice .c-ico svg { width: 20px; height: 20px; }
.choice:hover { border-color: #7a858a; background: #263340; }
.choice:active { transform: translateY(1px); background: #263340; }
.choice.rare, .choice.r-rare { border-color: #65586f; border-left: 2px solid #a392b7; box-shadow: none; }
.choice.r-normal { border-color: #494c42; border-left: 2px solid #b49d70; box-shadow: none; }
.choice.r-epic { border-color: #755a4a; border-left: 2px solid #d39867; box-shadow: none; }
.choice.mode-explore, .choice.mode-build { border-color: #3b4b48; border-left: 2px solid #85a995; }
.choice.mode-build { border-color: #4c4559; border-left-color: #a697ba; }
.choice.card-rich { padding: 17px 15px; }
.choice-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink); font-size: 14px; }
.choice-head > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.choice-head svg { width: 20px; height: 20px; color: var(--gold); }
.choice-meta { display: flex; gap: 8px; margin-top: 8px; color: var(--dim); font-size: 10px; }
.rarity-tag { display: inline-block; border: 1px solid rgba(155, 166, 175, .3); border-radius: 3px; padding: 0 4px; margin-left: 5px; font-size: 8px; font-weight: 400; letter-spacing: .01em; line-height: 1.7; vertical-align: 1px; color: #b8c2c8; }
.rarity-tag.rare { color: #c7b6df; border-color: #695976; }
.rarity-tag.epic { color: #e6ba88; border-color: #856044; }
.rarity-tag.common { color: #b1b9bd; }
.route-progress { display: flex; align-items: center; justify-content: space-between; position: relative; margin: 20px 0 25px; padding: 0 8px; }
.route-progress::before { content: ''; position: absolute; top: 12px; left: 18px; right: 18px; height: 1px; background: #34414c; }
.route-stop, .route-progress > span { position: relative; z-index: 1; display: flex; align-items: center; flex-direction: column; gap: 6px; color: #9cabb4; font-size: 9px; }
.route-stop i, .route-progress .pip { display: flex; width: 24px; height: 24px; justify-content: center; align-items: center; border: 1px solid #3c4955; border-radius: 50%; background: #121c26; transform: none; box-shadow: none; font-style: normal; }
.route-stop.current, .route-progress .current { color: #dfc696; }
.route-stop.current i, .route-progress .current .pip { border-color: var(--gold); color: #e0c391; background: #373328; }
.route-stop.done i { color: #bed2c5; border-color: #647c72; background: #253a34; }
.route-stop.boss i { color: #d19b82; border-color: #705346; }
.route-stop svg, .route-progress svg { width: 12px; height: 12px; }
.route-card { display: flex; flex-direction: row; align-items: center; width: 100%; min-height: 94px; gap: 14px; border: 1px solid #3a4853; border-radius: 8px; padding: 16px; margin-bottom: 12px; color: var(--ink); background: linear-gradient(110deg, #1c2733, #14202a); text-align: left; transition: transform .15s, background .15s, border-color .15s; }
.route-number { display: flex; flex: 0 0 38px; align-items: center; justify-content: center; height: 43px; color: #c0b296; font-family: var(--latin); font-size: 24px; border-right: 1px solid #3a4650; padding-right: 13px; }
.route-content { flex: 1; min-width: 0; }
.route-content b { display: flex; gap: 6px; align-items: center; font-size: 14px; font-weight: 500; }
.route-content svg { width: 17px; height: 17px; color: var(--gold); }
.route-content small { display: block; margin-top: 4px; color: var(--dim); font-size: 11px; line-height: 1.6; }
.route-arrow { color: #9caaaF; flex: 0 0 15px; }
.route-arrow svg { width: 15px; height: 15px; }
.route-card.elite { border-color: #66543f; background: linear-gradient(110deg, #2b2822, #1b2329); }
.route-card.elite .route-number { color: #deb38a; }
.route-card:hover { transform: translateX(2px); background: #273440; border-color: #7f8a8f; }
.route-card.elite:hover { background: #36302a; border-color: #b39971; }

/* Overlays are framed reading surfaces, with room for full descriptions. */
#itemPanel, #treePanel { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; padding: 28px; background: rgba(4, 9, 15, .76); backdrop-filter: blur(9px); }
#itemPanel.show, #treePanel.show { display: flex; }
.ip-card, .tp-card { width: min(760px, 100%); max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain; padding: 23px 26px 26px; background: #141f2a; border: 1px solid #44515b; border-radius: 12px; box-shadow: 0 24px 100px rgba(0, 0, 0, .6); animation: panel-arrive .2s ease-out; }
@keyframes panel-arrive { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.ip-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -3px 0 17px; padding: 0 0 14px; position: sticky; top: -24px; background: #141f2a; border-bottom: 1px solid #35424d; color: var(--ink); font-family: var(--display); font-size: 18px; letter-spacing: .08em; z-index: 4; }
.ip-head > span { display: inline-flex; align-items: center; gap: 8px; }
.ip-head svg { width: 20px; height: 20px; color: var(--gold); }
#ipClose, #tpClose { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; background: #192633; color: #bdc4c8; border: 1px solid #3c4955; border-radius: 7px; font-family: var(--sans); font-size: 22px; letter-spacing: 0; }
#ipClose:hover, #tpClose:hover { background: #2b3a48; color: var(--ink); }
.ip-empty { padding: 45px 10px; color: var(--dim); font-size: 13px; }
.tp-skp { margin: 0 0 16px; font-family: var(--sans); font-size: 12px; color: #c8c0d5; letter-spacing: 0; line-height: 1.8; }
.tree-tabs { display: flex; gap: 8px; margin-bottom: 21px; }
.tree-tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; flex: 1; padding: 10px 8px; border: 1px solid #3d4956; border-radius: 6px; background: #17232f; color: #aebac2; font-family: var(--sans); font-size: 12px; letter-spacing: 0; }
.tree-tab svg { width: 16px; height: 16px; }
.tree-tab.on { background: #c4a974; color: #212a29; border-color: #c4a974; font-weight: 600; }
.tree-col { margin: 0 0 23px; }
.tree-title { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid #35424e; font-family: var(--sans); font-size: 13px; letter-spacing: .04em; }
.tree-title svg { width: 18px; height: 18px; }
.tree-page2-head { padding-top: 20px; margin: 20px 0 15px; border-top: 1px solid #35424d; font-family: var(--sans); font-size: 13px; letter-spacing: .04em; }
.tnode { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 76px; padding: 13px 14px; margin-bottom: 8px; border: 1px solid #36444f; border-radius: 7px; background: #182430; font-family: var(--sans); text-align: left; }
.tnode .ti { display: flex; align-items: center; justify-content: center; width: 32px; flex: 0 0 32px; color: #b5a3ca; font-size: 0; }
.tnode .ti svg { width: 26px; height: 26px; }
.tnode .tinfo { min-width: 0; }
.tnode .tn { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.tnode .td { display: block; font-size: 12px; line-height: 1.7; color: #aebac3; margin-top: 4px; }
.tnode .tstat { color: #b5a5cf; font-family: var(--sans); font-size: 11px; line-height: 1.6; min-width: 38px; text-align: right; }
.tnode.owned { opacity: 1; border-left: 2px solid #82b09a; }
.tnode.owned .tstat { color: #a2cbb6; }
.tnode.available { border-left: 2px solid #a595bd; box-shadow: none; cursor: pointer; }
.tnode.available:hover { background: #253344; border-color: #847294; }
.tnode.locked { opacity: .56; border-left: 2px solid #4e5b67; }
#overlay { background: radial-gradient(ellipse at 50% 20%, rgba(32, 47, 57, .55), transparent 65%), rgba(5, 10, 16, .96); backdrop-filter: blur(15px); padding: 40px 24px; justify-content: center; }
#overlay.win { justify-content: center; padding: 40px 24px; }
.result-ornament { color: var(--gold); margin-bottom: 18px; }
.result-ornament svg { width: 54px; height: 68px; }
#overlay h1 { margin-bottom: 16px; font-family: var(--display); font-size: 35px; line-height: 1.5; letter-spacing: .12em; font-weight: 500; }
#overlay.lose h1 { color: #d3b9a2; }
#overlay.win h1 { color: #e0c28e; }
#overlay .ov-sub { max-width: 520px; color: #b6bfc4; font-size: 13px; line-height: 1.9; margin-bottom: 27px; }
#overlay button { min-height: 48px; padding: 13px 32px; border: 1px solid #d0b481; border-radius: 7px; background: #c4a974; color: #202925; font-family: var(--sans); font-size: 13px; letter-spacing: .04em; }
#overlay button:hover { background: #d6bb86; }
.result-card { max-width: 520px; width: 100%; margin: 20px auto; padding: 21px; border: 1px solid #3c4b58; border-radius: 10px; background: #141f2a; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin: 20px 0; text-align: center; }
.result-stats small { display: block; color: var(--dim); font-size: 11px; margin-bottom: 5px; }
.result-stats b { color: var(--ink); font-family: var(--latin); font-size: 24px; font-weight: 400; }
.result-skills { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 14px; }
.result-skills span { display: inline-flex; gap: 4px; align-items: center; padding: 5px 8px; background: #1f2c38; border: 1px solid #3a4653; border-radius: 5px; font-size: 11px; color: #d3d2c8; }
.result-skills svg { width: 14px; height: 14px; }
.floater { font-family: var(--sans); font-size: 26px; font-weight: 600; text-shadow: 0 2px 12px #000; }
.floater.critnum { color: #edc18a; -webkit-text-stroke: 0; text-shadow: 0 0 15px rgba(229, 173, 95, .45), 0 3px 8px #000; }
.floater.critlabel { color: #e2c393; font-size: 13px; letter-spacing: .18em; text-shadow: 0 2px 8px #000; }
.critflash { background: radial-gradient(circle at 50% 42%, rgba(220, 172, 93, .2), transparent 65%); }
.doomflash { background: radial-gradient(circle at 50% 42%, rgba(157, 133, 187, .22), transparent 65%); }
#appFooter { display: flex; align-items: center; justify-content: space-between; height: 32px; min-height: 32px; padding: 0 23px; border-top: 1px solid #26313c; background: #0d141c; color: #8f999f; font-size: 9px; letter-spacing: .05em; }
#appFooter .version { color: #929078; font-family: var(--latin); font-size: 9px; letter-spacing: .15em; }

/* Components supplied by the edition 3 renderer. */
.title-scene .title-flourish { margin: 0 auto 18px; }
.title-scene .title-flourish::before, .title-scene .title-flourish::after { display: none; }
.title-scene .title-flourish svg { width: 40px; height: 52px; }
.title-kicker { font-family: var(--latin); font-size: 11px; letter-spacing: .3em; color: #d4bc90; margin-bottom: 12px; }
.title-rule { display: flex; justify-content: center; align-items: center; gap: 12px; color: var(--gold); margin: 19px auto 18px; }
.title-rule span { width: 45px; height: 1px; background: linear-gradient(90deg, transparent, rgba(200, 170, 113, .7)); }
.title-rule span:last-child { transform: rotate(180deg); }
.title-rule svg { width: 11px; height: 11px; }
.title-subtitle { color: #e1d8c5; font-family: var(--display); font-size: 14px; line-height: 1.9; letter-spacing: .1em; }
.title-depth { display: block; color: #b1ada3; font-family: var(--latin); font-size: 8px; letter-spacing: .22em; margin-top: 30px; }
.mode-eyebrow { display: block; font-family: var(--latin); font-size: 8px; letter-spacing: .12em; color: var(--dim); margin-bottom: 5px; }
.primary .mode-eyebrow { color: #5f553e; }
.mode-choice.resume { border-color: #628273; }
.mode-choice.resume .mode-icon { color: var(--green); }
.title-note { align-items: flex-start; line-height: 1.8; }
.title-note > span { padding-top: 3px; }
.title-records > span { color: var(--dim); font-size: 11px; display: flex; align-items: baseline; justify-content: space-between; }
.title-records > span b { font-size: 19px; }
.panel-title-row { display: flex; gap: 10px; justify-content: space-between; align-items: center; }
.panel-title-row .turn { display: inline-flex; gap: 4px; align-items: center; color: var(--gold); font-family: var(--latin); font-size: 10px; letter-spacing: .08em; white-space: nowrap; }
.panel-title-row .turn b { font-size: 14px; font-weight: 400; }
.panel-title-row .turn svg { width: 15px; height: 15px; }
.battle-resource { display: flex; align-items: center; gap: 5px; margin: -8px 0 15px; padding: 11px 0; border-top: 1px solid #2c3945; border-bottom: 1px solid #2c3945; color: #a9c6cc; font-size: 11px; }
.battle-resource > svg { width: 15px; height: 15px; }
.battle-resource b { font-family: var(--latin); font-size: 19px; font-weight: 400; color: #d6e3e1; padding: 0 3px; }
.battle-resource > span:last-child { margin-left: auto; color: var(--dim); font-size: 9px; }
.skill .cost .c-sp svg { width: 11px; height: 11px; color: #80a7b0; }
.skill .price svg { width: 13px; height: 13px; margin-right: 3px; }
.pass-icons { display: flex; gap: 8px; margin-left: auto; }
.pass-icons > span { display: inline-flex; color: #b3a8c8; }
.passcmd > span:last-child { color: #9a91a7; font-size: 10px; }
.inline-icon { display: inline-flex; vertical-align: middle; margin: 0 2px; }
.inline-icon svg { width: 15px; height: 15px; }
.enemy-rank { display: inline-block; margin-left: 8px; padding: 2px 5px; border: 1px solid rgba(200, 170, 113, .4); border-radius: 3px; font-family: var(--sans); font-size: 9px; font-weight: 400; line-height: 1.4; vertical-align: 3px; color: #d2b48b; letter-spacing: 0; }
.enemy-hp-head { display: flex; justify-content: space-between; align-items: center; color: #c7c6bd; font-size: 9px; margin-bottom: 5px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 6px #000; }
.enemy-hp-head > span:first-child { color: #b4b5ad; }
.enemy-hp-head em { color: #b2b4b3; font-style: normal; }
.intent-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; color: var(--gold); }
.intent-icon svg { width: 20px; height: 20px; }
.intent-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.intent-info small { color: #a7a89e; font-size: 8px; letter-spacing: .05em; line-height: 1.2; }
.intent-info b { color: #e4d7be; font-size: 12px; line-height: 1.5; font-weight: 500; }
.intent-info > span { color: #b7b8b1; font-size: 9px; line-height: 1.5; }
.intent-value { white-space: nowrap; font-size: 11px; }
.intent.danger .intent-icon { color: var(--ember); }
.intent.danger .intent-info b { color: #e6bc9f; }
.shield { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 7px; max-width: 62%; }
.shield > span { display: inline-flex; gap: 3px; align-items: center; white-space: nowrap; }
#playerStatus.low-hp { border-color: rgba(182, 110, 100, .65); }
#playerStatus.low-hp .fill-hp { background: #b67769; }
.scene-kicker { color: #c6b18d; font-family: var(--latin); font-size: 9px; letter-spacing: .22em; margin-bottom: 18px; text-shadow: 0 2px 10px #000; }
.scene-rule { width: 44px; height: 1px; background: rgba(200, 170, 113, .55); margin: 13px auto 0; }
.route-step { display: flex; align-items: center; flex-direction: column; gap: 7px; }
.route-step i { display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 25px; background: #131e28; border: 1px solid #3d4b57; border-radius: 50%; color: #617482; }
.route-step b { font-weight: 400; font-family: var(--latin); font-size: 10px; color: #8796a0; }
.route-step.done i { color: #c6ba97; border-color: #9d8b61; background: #34342d; }
.route-step.done b { color: #d4c19b; }
.route-step.boss i { color: #bf9174; border-color: #775b45; }
.route-number { flex-basis: 25px; padding-right: 7px; font-size: 16px; color: #89969e; }
.route-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; flex: 0 0 28px; color: #bea882; }
.route-icon svg { width: 25px; height: 25px; }
.route-content small { margin: 0 0 3px; font-size: 9px; color: #a6b0b7; }
.route-content > span { display: block; font-size: 11px; color: #afbac1; line-height: 1.65; margin-top: 4px; }
.route-card.elite .route-icon { color: #d6a579; }
.route-card.campfire .route-icon { color: #c9966e; }
.route-card { gap: 10px; }
.choice-head { justify-content: flex-start; }
.choice-head .rarity-tag { margin-left: auto; white-space: nowrap; }
.choice-head .c-ico { margin-right: 0; flex: 0 0 22px; }
.choice-meta { align-items: center; flex-wrap: wrap; gap: 5px 10px; }
.choice-meta svg { width: 12px; height: 12px; }
.choice-meta b { color: #9dbcae; font-weight: 400; font-size: 9px; }
.draft-progress { display: flex; justify-content: space-between; gap: 9px; margin: 18px 0; }
.draft-progress span { display: flex; flex: 1; flex-direction: column; align-items: center; gap: 7px; padding: 10px 6px; border-bottom: 1px solid #40505c; color: #8b9ca6; font-size: 10px; }
.draft-progress b { font-family: var(--latin); font-size: 17px; font-weight: 400; }
.draft-progress .on { color: #d6bd8d; border-color: #b79b68; }
.draft-picked { padding: 12px 0; margin: 0 0 15px; border-bottom: 1px solid #35434e; color: #b3c5bf; font-size: 11px; line-height: 1.8; }
.text-action { display: block; width: 100%; min-height: 44px; margin-top: 10px; padding: 10px; background: transparent; border: 0; color: var(--dim); font-size: 12px; }
.text-action:hover { color: var(--ink); }
.tree-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.tree-title > span { margin-left: auto; color: #97a6b1; font-size: 10px; }
.tree-columns .tnode { padding: 11px 10px; gap: 8px; }
.tree-columns .tnode .tn { font-size: 13px; }
.tree-columns .tnode .td { font-size: 12px; }
.tree-columns .tnode .ti { width: 24px; flex-basis: 24px; }
.tree-columns .tnode .ti svg { width: 23px; height: 23px; }
.tree-columns .tnode .tstat { font-size: 9px; min-width: 27px; }
.tp-skp > span { display: inline-block; margin-left: 12px; color: var(--dim); font-size: 10px; }
#ipList > .panel-description { margin: 0 0 18px; }
.result-kicker { display: block; font-family: var(--latin); font-size: 9px; letter-spacing: .18em; color: var(--gold); margin-bottom: 19px; }
.result-story { font-size: 13px; line-height: 2; }
.result-death-cause { display: grid; gap: 6px; margin: 18px 0; padding: 14px 16px; border: 1px solid #765457; border-radius: 9px; background: #2a2028; text-align: left; overflow-wrap: anywhere; }
.result-death-cause small { color: #d1acaf; font-size: 11px; }
.result-death-cause b { color: #f0d7d8; font-size: 15px; line-height: 1.6; }
.result-death-cause span { color: #d4bdc0; font-size: 12px; }
.result-stats { grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 19px 0; margin: 20px 0; border-top: 1px solid #34414c; border-bottom: 1px solid #34414c; }
.result-stats b em { font-family: var(--sans); font-size: 10px; color: var(--dim); font-style: normal; }
.result-build h3 { font-size: 11px; font-weight: 400; color: var(--dim); margin-bottom: 11px; }
.result-skill-list, .result-passive-list { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.result-skill-list span, .result-passive-list span { display: inline-flex; gap: 4px; align-items: center; padding: 5px 7px; border: 1px solid #374653; border-radius: 5px; color: #c7d1d6; background: #17242f; font-size: 10px; }
.result-passive-list span { border-color: #514b61; color: #c6bad8; background: #252334; }
.result-skill-list svg, .result-passive-list svg { width: 13px; height: 13px; }
.combat-effect { position: absolute; top: 42%; left: 50%; width: 200px; height: 200px; z-index: 7; pointer-events: none; transform: translate(-50%, -50%); }
.slash-effect::before { content: ''; position: absolute; inset: 20px; border-top: 3px solid rgba(238, 228, 195, .95); transform: rotate(-38deg) scaleX(.5); filter: drop-shadow(0 0 7px #d9ad76); animation: slash-trace .4s ease-out forwards; }
@keyframes slash-trace { 0% { transform: rotate(-38deg) scaleX(.2); opacity: 0; } 35% { opacity: 1; } 100% { transform: rotate(-38deg) scaleX(1.5); opacity: 0; } }
.magic-effect { border: 1px solid rgba(175, 157, 202, .6); border-radius: 50%; animation: magic-ring .6s ease-out forwards; box-shadow: 0 0 22px rgba(143, 118, 188, .45), 0 0 28px rgba(143, 118, 188, .15) inset; }
@keyframes magic-ring { from { transform: translate(-50%, -50%) scale(.25); opacity: .9; } to { transform: translate(-50%, -50%) scale(1.2); opacity: 0; } }
.guard-effect { top: 80%; width: 280px; height: 90px; background: radial-gradient(ellipse, rgba(145, 192, 177, .3), transparent 70%); animation: guard-glow .6s ease-out forwards; }
@keyframes guard-glow { from { opacity: .8; transform: translate(-50%, -50%) scale(.7); } to { opacity: 0; transform: translate(-50%, -50%) scale(1.2); } }
.journal-update .journal-label { animation: journal-notice .7s ease-out; }
@keyframes journal-notice { from { color: #dcc292; background: rgba(200, 170, 113, .1); } to { color: #939b9e; background: transparent; } }
body[data-view="title"] #logWrap { display: none; }
@media (min-width: 768px) {
  body[data-view="title"] #stage { grid-row: 1 / -1; }
}

/* Small desktops and landscape windows retain scrollable commands. */
@media (max-width: 1099px) and (min-width: 768px) {
  #appFrame { width: calc(100% - 40px); height: calc(100dvh - 40px); }
  #gameShell { grid-template-columns: minmax(0, 1fr) 350px; }
  #appHeader { padding: 0 18px; gap: 14px; }
  .journey-meta { gap: 9px; font-size: 10px; }
  #menu { padding: 24px 20px; }
  .title-scene h1 { font-size: 39px; letter-spacing: .08em; }
  .title-scene .subtitle { font-size: 11px; }
  .title-tagline { font-size: 12px; }
  .skill { gap: 8px; padding: 12px 10px; }
  .skill .icon { flex-basis: 28px; width: 28px; }
  .skill .icon svg { width: 25px; height: 25px; }
  .skill .sdesc { font-size: 12px; }
  .battle-tools { gap: 6px; }
  .itemcmd, .treecmd { gap: 4px; padding: 8px; font-size: 10px; }
}
@media (max-height: 740px) and (min-width: 768px) {
  #appFrame { height: calc(100dvh - 32px); }
  #appHeader { height: 62px; min-height: 62px; }
  #gameShell { grid-template-rows: minmax(0, 1fr) 64px; }
  #appFooter { height: 26px; min-height: 26px; }
  .stage-top { top: 15px; }
  #sceneZone { top: 47px; bottom: 126px; }
  .enemy-art { width: clamp(158px, 27dvh, 220px); }
  .ename { font-size: 18px; }
  .enemy-kicker { font-size: 8px; margin-bottom: 2px; }
  .intent { margin-top: 8px; padding: 7px 10px; min-height: 35px; font-size: 11px; }
  #playerStatus { bottom: 12px; padding: 11px 14px 9px; }
  .pname { margin-bottom: 8px; }
  .sp-row { margin-top: 7px; }
  #menu { padding-top: 21px; }
  .panel-heading { margin-bottom: 20px; }
  .panel-title { font-size: 22px; }
  .panel-description { font-size: 12px; }
  .mode-choice { padding-top: 15px; padding-bottom: 15px; }
  .mode-choice .mode-icon { top: 18px; }
  .title-records { margin-top: 18px; padding-top: 15px; }
  .scene-icon .big { width: 95px; height: 95px; margin-bottom: 13px; }
  .scene-icon .big svg { width: 52px; height: 52px; }
  .scene-icon .lab { font-size: 24px; }
}
@media (max-height: 540px) and (min-width: 768px) {
  #appFrame { height: calc(100dvh - 16px); width: calc(100% - 24px); }
  #appHeader { min-height: 52px; height: 52px; }
  #appFooter { display: none; }
  #gameShell { grid-template-rows: minmax(0, 1fr) 42px; }
  #sceneZone { top: 34px; bottom: 85px; }
  .enemy-art { width: clamp(85px, calc(50dvh - 110px), 138px); }
  .ename { font-size: 14px; }
  .enemy-kicker { display: none; }
  .intent { min-height: 28px; padding: 4px 9px; margin-top: 5px; font-size: 10px; }
  .intent-info { gap: 1px; }
  .intent-info small { font-size: 7px; line-height: 1.2; }
  .intent-info b { font-size: 10px; line-height: 1.3; }
  .intent-info > span { font-size: 8px; line-height: 1.35; }
  .intent-value { font-size: 9px; }
  .enemy-hp-head { font-size: 8px; line-height: 1.2; margin-bottom: 3px; }
  .ebar-bg { height: 3px; }
  .ebar-wrap { width: 180px; }
  .ehp-txt { font-size: 9px; margin-top: 3px; }
  .esp, .enemy-status { display: none; }
  #playerStatus { bottom: 8px; padding: 8px 12px; }
  .pname { margin-bottom: 5px; font-size: 10px; }
  .sp-row { display: none; }
  .status-meters { gap: 5px 14px; }
  .stage-top { top: 9px; }
  .floorbadge, .goldbadge { padding: 4px 7px; font-size: 10px; }
  #log { padding-top: 6px; padding-bottom: 6px; font-size: 10px; }
  .journal-label { flex-basis: 54px; }
  .journal-label svg { display: none; }
  .title-scene h1 { font-size: 32px; }
  .title-scene .kicker { margin-bottom: 8px; }
  .title-flourish { margin: 13px auto; }
  .scene-icon .big { width: 62px; height: 62px; margin-bottom: 9px; }
  .scene-icon .big svg { width: 35px; height: 35px; }
  .scene-icon .lab { font-size: 20px; }
  .scene-icon .sub { font-size: 11px; margin-top: 5px; }
}

/* Handheld: the art, journal, and command panel form a natural vertical flow. */
@media (max-width: 767px) {
  body { align-items: stretch; justify-content: flex-start; background: var(--bg); }
  #appFrame { width: 100%; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  #appHeader { height: calc(54px + env(safe-area-inset-top)); min-height: calc(54px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { width: 25px; height: 33px; }
  .brand-mark svg { width: 22px; height: 28px; }
  .brand-type b { font-size: 14px; letter-spacing: .1em; }
  .brand-type small { font-size: 7px; letter-spacing: .15em; }
  .journey-meta { margin-left: auto; }
  #chapterLabel { display: none; }
  .save-indicator { display: none; }
  .header-tools { margin-left: auto; gap: 0; }
.tool-btn, #muteBtn { width: 44px; min-height: 44px; height: 44px; padding: 10px; }
  .tool-btn svg, #muteBtn svg { width: 19px; height: 19px; }
  #gameShell { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: clamp(286px, 42dvh, 366px) 46px minmax(0, 1fr); min-height: 0; }
  #stage { grid-column: 1; grid-row: 1; background-position: center 45%; }
  body[data-view="title"] #gameShell { grid-template-rows: clamp(286px, 42dvh, 366px) minmax(0, 1fr); }
  body[data-view="title"] #commandPanel { grid-row: 2; }
  #logWrap { grid-column: 1; grid-row: 2; }
  #commandPanel { grid-column: 1; grid-row: 3; border-left: 0; border-top: 1px solid #2b3642; }
  #menu { padding: 18px 17px calc(22px + env(safe-area-inset-bottom)); }
  #appFooter { display: none; }
  .stage-top { top: 12px; left: 14px; right: 14px; }
  .floorbadge, .goldbadge { padding: 4px 7px; font-size: 10px; border-radius: 4px; }
  .floorbadge span { font-size: 8px; }
  .goldbadge svg { width: 13px; height: 13px; }
  #sceneZone { top: 31px; bottom: 92px; }
  .enemy { width: 100%; }
  .enemy-kicker { display: none; }
  .ename { font-size: 15px; line-height: 1.35; letter-spacing: .08em; }
  .enemy .sprite { margin: -5px 0 -4px; }
  .enemy-art { width: clamp(90px, 14dvh, 132px); }
  .ebar-wrap { width: 175px; margin-top: -3px; }
  .ebar-bg { height: 3px; }
  .ehp-txt { font-size: 8px; margin-top: 3px; line-height: 1.3; }
  .esp { gap: 3px; margin-top: 4px; }
  .epip { width: 3px; height: 3px; }
  .enemy-status { position: absolute; right: 14px; top: 3px; flex-direction: column; align-items: flex-end; gap: 3px; margin-top: 0; }
  .enemy-status span { padding: 2px 4px; font-size: 8px; }
  .enemy-status svg { width: 10px; height: 10px; }
  .intent { width: max-content; max-width: calc(100% - 28px); gap: 6px; min-height: 42px; padding: 4px 9px; margin-top: 7px; border-radius: 5px; font-size: 10px; line-height: 1.3; }
  .intent > svg { width: 13px; height: 13px; }
  .intent-value { margin-left: 2px; }
  .intent-icon { flex-basis: 18px; }
  .intent-icon svg { width: 17px; height: 17px; }
  .intent-info { gap: 1px; }
  .intent-info small { font-size: 7px; line-height: 1.2; }
  .intent-info b { font-size: 11px; line-height: 1.3; }
  .intent-info > span { font-size: 8px; line-height: 1.4; }
  .intent-value { font-size: 9px; }
  .enemy-hp-head { font-size: 8px; line-height: 1.4; margin-bottom: 3px; }
  .enemy-rank { margin-left: 6px; font-size: 7px; padding: 1px 4px; vertical-align: 2px; }
  #playerStatus { bottom: 8px; left: 12px; right: 12px; border-radius: 6px; padding: 8px 10px 7px; }
  .pname { font-size: 10px; margin-bottom: 6px; }
  .player-name { gap: 5px; }
  .player-name svg { width: 12px; height: 13px; }
  .player-name b { font-size: 10px; margin-left: 3px; }
  .pname .shield { font-size: 9px; }
  .status-meters { gap: 4px 15px; }
  .bar { gap: 5px; }
  .bar label { width: 21px; font-size: 8px; }
  .bar .num { width: 46px; font-size: 8px; }
  .track { height: 3px; }
  .hp-bar .track { height: 4px; }
  .sp-row { margin-top: 5px; min-height: 8px; }
  #spPips { gap: 4px; margin-left: 27px; }
  .pip { width: 5px; height: 5px; border-radius: 1px; }
  .sp-recovery { font-size: 7px; }
  .journal-label { flex-basis: 40px; gap: 0; }
  .journal-label > span:last-child { display: none; }
  .journal-label > span:first-child { display: inline-flex; }
  .journal-label svg { width: 14px; height: 14px; }
  #log { padding: 5px 10px; font-size: 10px; line-height: 1.7; }
  #stageCaption { bottom: 16px; font-size: 8px; letter-spacing: .27em; }
  body[data-view="title"] #sceneZone { padding: 20px 14px; }
  .title-scene { margin-top: -4px; }
  .title-scene .kicker { font-size: 8px; margin-bottom: 11px; letter-spacing: .25em; }
  .title-scene h1 { font-size: 32px; letter-spacing: .08em; }
  .title-scene .subtitle { font-size: 9px; letter-spacing: .25em; margin-top: 7px; }
  .title-scene .title-flourish { margin-bottom: 11px; }
  .title-scene .title-flourish svg { width: 29px; height: 37px; }
  .title-kicker { font-size: 8px; margin-bottom: 9px; letter-spacing: .25em; }
  .title-rule { gap: 10px; margin: 13px auto 12px; }
  .title-rule span { width: 34px; }
  .title-rule svg { width: 9px; height: 9px; }
  .title-subtitle { font-size: 11px; line-height: 1.85; }
  .title-depth { font-size: 7px; margin-top: 20px; }
  .title-flourish { gap: 12px; margin: 14px auto 12px; }
  .title-flourish::before, .title-flourish::after { width: 34px; }
  .title-flourish svg { width: 21px; height: 26px; }
  .title-tagline { font-size: 10px; letter-spacing: .06em; }
  .panel-heading { margin: 0 0 17px; }
  .eyebrow { font-size: 8px; margin-bottom: 5px; }
  .panel-title { font-size: 20px; letter-spacing: .07em; }
  .panel-description { font-size: 11px; line-height: 1.65; margin-top: 6px; }
  body[data-view="battle"] .panel-heading { margin-bottom: 16px; }
  body[data-view="battle"] .panel-description { display: none; }
  body[data-view="battle"] .eyebrow { margin-bottom: 4px; }
  .battle-resource { margin-top: -4px; padding: 8px 0; margin-bottom: 12px; }
  .mode-choice { padding: 14px 40px 14px 52px; margin-bottom: 9px; }
  .mode-choice .mode-icon { top: 17px; left: 15px; }
  .mode-choice .mode-icon svg { width: 23px; height: 23px; }
  .mode-choice .mode-name { font-size: 14px; }
  .mode-choice .mode-text { font-size: 11px; margin-top: 3px; }
  .title-note { margin: 11px 0 15px; font-size: 10px; }
  .title-records { margin: 15px 0; padding-top: 14px; }
  .title-records b { font-size: 21px; }
  .title-records small { font-size: 10px; }
  .secondary-links { margin-top: 8px; }
  .secondary-links button { font-size: 11px; }
  .menu-head { font-size: 13px; margin-bottom: 12px; }
  .menu-head .turn { font-size: 10px; }
  .skill-grid { gap: 8px; }
  .skill { min-height: 74px; padding: 11px 11px; gap: 10px; margin-bottom: 8px; }
  .skill .sname { font-size: 13px; }
  .skill .sdesc { font-size: 12px; line-height: 1.6; }
  .skill .cost .c-sp { font-size: 11px; }
  .skill .cost .c-ct { font-size: 9px; }
  .skill .icon { width: 29px; flex-basis: 29px; }
  .skill .icon svg { width: 26px; height: 26px; }
  .skill-key { display: none; }
  .battle-tools { margin-top: 12px; }
  .itemcmd, .treecmd { font-size: 11px; }
  .choice { padding: 13px; font-size: 13px; }
  .choice .c-sub { font-size: 11px; }
  .subhead { font-size: 12px; }
  .panel-tip { font-size: 10px; }
  .scene-icon { padding: 6px 20px; max-width: 340px; }
  .scene-icon .big { width: 64px; height: 64px; margin-bottom: 10px; box-shadow: 0 0 0 6px rgba(200, 170, 113, .025); }
  .scene-icon .big svg { width: 36px; height: 36px; }
  .scene-kicker { font-size: 7px; margin-bottom: 13px; }
  .scene-rule { width: 30px; margin-top: 8px; }
  .scene-icon .lab { font-size: 21px; letter-spacing: .09em; }
  .scene-icon .sub { font-size: 10px; line-height: 1.6; margin-top: 5px; }
  .route-progress { margin: 14px 0 18px; }
  .route-card { min-height: 85px; padding: 14px; gap: 11px; }
  .route-content b { font-size: 13px; }
  #itemPanel, #treePanel { padding: 0; align-items: flex-end; backdrop-filter: blur(6px); }
  .ip-card, .tp-card { width: 100%; max-height: 88dvh; padding: 17px 17px calc(25px + env(safe-area-inset-bottom)); border: 1px solid #44515b; border-bottom: 0; border-radius: 14px 14px 0 0; animation: slideup .2s ease-out; }
  .ip-head { top: -18px; padding-bottom: 10px; margin-bottom: 15px; font-size: 17px; }
  .tree-tabs { gap: 6px; margin-bottom: 17px; }
  .tree-tab { font-size: 11px; }
  .tnode { gap: 9px; padding: 12px 11px; min-height: 76px; }
  .tnode .ti { width: 28px; flex-basis: 28px; }
  .tnode .ti svg { width: 24px; height: 24px; }
  .tnode .td { font-size: 11px; }
  .tnode .tstat { font-size: 10px; }
  .tree-columns { grid-template-columns: minmax(0, 1fr); }
  .tree-columns .tnode { padding: 12px 11px; gap: 9px; }
  .tree-columns .tnode .tn { font-size: 13px; }
  .tree-columns .tnode .td { font-size: 12px; }
  .tree-columns .tnode .tstat { font-size: 10px; }
  .tp-skp > span { display: block; margin: 4px 0 0; }
  #overlay, #overlay.win { padding: 25px 20px; justify-content: center; }
  #overlay h1 { font-size: 28px; }
  #overlay .ov-sub { font-size: 12px; }
  .result-ornament { margin-bottom: 13px; }
  .result-ornament svg { width: 42px; height: 54px; }
  .result-card { padding: 17px; margin: 15px auto; }
  .result-stats { gap: 10px; }
  .result-stats b { font-size: 22px; }
}
@media (max-width: 767px) and (max-height: 660px) {
  #gameShell { grid-template-rows: 286px 38px minmax(0, 1fr); }
  .enemy-art { width: 90px; }
  .intent { margin-top: 4px; }
  #menu { padding-top: 14px; }
  .panel-description { display: none; }
  .panel-heading { margin-bottom: 13px; }
  .scene-kicker { display: none; }
}
@media (max-width: 767px) and (max-height: 470px) and (orientation: landscape) {
  #appHeader { height: 46px; min-height: 46px; }
  #gameShell { grid-template-columns: minmax(0, 1fr) minmax(280px, 44%); grid-template-rows: minmax(0, 1fr) 34px; }
  body[data-view="title"] #gameShell { grid-template-rows: minmax(0, 1fr); }
  #stage { grid-column: 1; grid-row: 1; }
  #logWrap { grid-column: 1; grid-row: 2; }
  #commandPanel { grid-column: 2; grid-row: 1 / -1; border-left: 1px solid var(--line); border-top: 0; }
  body[data-view="title"] #commandPanel { grid-row: 1; }
  #menu { padding: 15px 14px; }
  #sceneZone { top: 29px; bottom: 79px; }
  .enemy-art { width: 84px; }
  .enemy-kicker { display: none; }
  .ename { font-size: 12px; }
  .ebar-wrap { width: 130px; }
  .intent { margin-top: 3px; min-height: 24px; padding: 4px 6px; font-size: 8px; }
  .intent > svg { width: 11px; height: 11px; }
  .esp, .enemy-status, .sp-row { display: none; }
  #playerStatus { bottom: 6px; padding: 7px 8px; }
  .pname { margin-bottom: 4px; }
  .status-meters { gap: 3px 10px; }
  .stage-top { top: 7px; left: 10px; right: 10px; }
  .title-scene h1 { font-size: 24px; }
  .title-scene .kicker { font-size: 7px; margin-bottom: 7px; }
  .title-scene .subtitle { font-size: 8px; }
  .title-flourish { margin: 9px auto; }
  .title-tagline { font-size: 9px; }
  #stageCaption { bottom: 10px; font-size: 6px; }
  .scene-icon .big { width: 45px; height: 45px; margin-bottom: 8px; }
  .scene-icon .big svg { width: 25px; height: 25px; }
  .scene-icon .lab { font-size: 17px; }
  .scene-icon .sub { font-size: 8px; }
}
@media (max-width: 359px) {
  .brand-type b { font-size: 12px; }
  .brand-type small { font-size: 6px; }
  .brand-mark { width: 21px; }
  .tool-btn, #muteBtn { width: 44px; padding: 8px; }
  .title-scene h1 { font-size: 28px; }
  #menu { padding-left: 12px; padding-right: 12px; }
  .skill { gap: 7px; }
  .skill .icon { width: 24px; flex-basis: 24px; }
  .skill .sname { font-size: 12px; }
  .skill .sdesc { font-size: 12px; }
}

/* Accessibility preferences apply to generated views as well as the shell. */
body.large-text #menu { font-size: 16px; }
body.large-text .panel-description, body.large-text .skill .sdesc, body.large-text .choice .c-sub, body.large-text .tnode .td { font-size: 13px; }
body.large-text .skill .sname, body.large-text .choice, body.large-text .tnode .tn, body.large-text .menu-head { font-size: 15px; }
body.large-text .skill { min-height: 94px; }
body.large-text .skill .cost .c-sp { font-size: 13px; }
body.large-text #log { font-size: 13px; }
body.large-text .panel-tip { font-size: 12px; }
body.large-text .mode-choice .mode-text { font-size: 13px; }
body.large-text .mode-choice .mode-name { font-size: 16px; }
body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
body.reduced-motion .stage-atmosphere { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .stage-atmosphere { display: none; }
}
@media (prefers-contrast: more) {
  :root { --dim: #bdc6cf; --line: #4b5b6a; }
  .skill .sdesc, .choice .c-sub, .tnode .td { color: #cbd3d9; }
  #playerStatus, .intent { background: #0b141e; border-color: #71808d; }
}

/* Final art integration and quiet atmosphere. */
.scene-icon.with-art .big { animation: none; filter: none; margin: 8px auto 12px; display: flex; justify-content: center; width: auto; height: auto; border: 0; border-radius: 0; background: none; box-shadow: none; }
.scene-art { background-image: var(--scene-atlas); background-repeat: no-repeat; width: clamp(150px, 25dvh, 248px); max-height: 250px; filter: drop-shadow(0 16px 20px #0007); animation: scene-breathe 5s ease-in-out infinite; }
.scene-icon.with-art .lab { margin-top: 5px; }
.scene-kicker { font: 9px Georgia, serif; letter-spacing: .24em; color: #c2b393; }
.enemy[data-aspect="plague"] .enemy-art { filter: hue-rotate(36deg) saturate(.75) drop-shadow(0 16px 24px #0008); }
.enemy[data-aspect="arcane"] .enemy-art { filter: hue-rotate(-36deg) saturate(.7) drop-shadow(0 16px 24px #0008); }
.enemy[data-aspect="iron"] .enemy-art { filter: sepia(.32) saturate(.65) drop-shadow(0 16px 24px #0008); }
.save-indicator i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .8; }
.archive-list { margin-top: 20px; }
.archive-entry { display: flex; align-items: center; gap: 12px; padding: 15px 0; border-bottom: 1px solid #ffffff0c; }
.archive-entry > span:first-child { color: var(--gold); }
.archive-entry > span:nth-child(2) { flex: 1; min-width: 0; }
.archive-entry b { display: block; font-size: 13px; font-weight: 500; }
.archive-entry small { display: block; color: var(--dim); margin-top: 4px; font-size: 10px; }
.archive-entry > span:last-child { font-family: Georgia,serif; font-size: 13px; color: var(--gold); white-space: nowrap; }
@keyframes scene-breathe { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (max-width: 767px) {
  .scene-art { width: clamp(84px, calc(15dvh - 12px), 128px); max-height: 140px; }
  .scene-icon.with-art .big { margin: 3px auto 5px; }
  .scene-icon.with-art .lab { font-size: 20px; }
  .scene-icon.with-art .scene-rule, .scene-icon.with-art .scene-kicker { display: none; }
  .scene-icon.with-art .sub { font-size: 10px; max-width: 290px; line-height: 1.6; }
  .scene-kicker { font-size: 7px; letter-spacing: .16em; }
}
@media (max-height: 650px) and (min-width: 768px) { .scene-art { width: 130px; max-height: 140px; } }
@media (orientation: landscape) and (max-height: 520px) {
  .enemy-status { display: flex; position: absolute; top: 2px; right: 8px; flex-direction: column; align-items: flex-end; gap: 2px; margin: 0; }
  .enemy-status span { padding: 1px 4px; font-size: 8px; }
  .enemy-status svg { width: 9px; height: 9px; }
  .scene-art { width: 75px; max-height: 80px; }
  .scene-icon.with-art .scene-kicker, .scene-icon.with-art .scene-rule { display: none; }
  .scene-icon.with-art .big { margin: 0 auto 3px; }
  .scene-icon.with-art .lab { font-size: 17px; }
  .scene-icon.with-art .sub { font-size: 9px; line-height: 1.4; margin-top: 3px; }
}
@media (prefers-reduced-motion: reduce) { .scene-art { animation: none; } }
body.reduced-motion .scene-art { animation: none; }

/* Independent, accessible handbook and preferences. */
.ux-backdrop[hidden]{display:none!important}
.ux-backdrop{position:fixed;inset:0;z-index:110;display:grid;place-items:center;padding:24px;background:rgba(4,8,12,.83);backdrop-filter:blur(9px);font-family:"Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;color:#ece4d6;line-height:1.7}
.ux-dialog{width:min(100%,580px);max-height:min(88dvh,800px);overflow:auto;overscroll-behavior:contain;background:linear-gradient(145deg,#19212b,#10171f 65%);border:1px solid #465044;border-top:2px solid #cfad6b;border-radius:14px;box-shadow:0 28px 90px #000a,0 0 60px #cfad6b0a;animation:ux-enter .24s ease-out;scrollbar-width:thin;scrollbar-color:#46505a #141b24}
.ux-dialog-head{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;padding:26px 28px 17px;border-bottom:1px solid #ffffff0b}
.ux-eyebrow{margin:0 0 7px;font-family:Georgia,"Times New Roman",serif;font-size:10px;letter-spacing:2.5px;color:#cfad6b;line-height:1.4}
.ux-dialog h2{margin:0;font-family:"Shippori Mincho","Yu Mincho","Hiragino Mincho ProN",serif;font-size:25px;font-weight:600;line-height:1.4;color:#ece4d6;letter-spacing:1px}
.ux-close{display:grid;place-items:center;flex:none;width:40px;height:40px;margin:-4px -8px 0 0;border:1px solid #ffffff0c;border-radius:50%;background:#0b0f1570;color:#aaa99f;cursor:pointer}
.ux-close svg{width:19px;height:19px}.ux-close:hover{color:#ece4d6;border-color:#cfad6b60}
.ux-dialog-body{padding:23px 28px}.ux-dialog-body p{margin:0}.ux-dialog-body .ux-lead{font-size:14px;line-height:1.95;color:#d3d4cf}
.ux-dialog-body .ux-note{margin-top:18px;padding:12px 14px;border-left:2px solid #cfad6b60;background:#0b0f154f;color:#aeb5ba;font-size:12px;line-height:1.85;border-radius:0 5px 5px 0}
.ux-dialog-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:17px 28px 22px;border-top:1px solid #ffffff0b;background:#0b0f1530}
.ux-btn{display:inline-flex;align-items:center;justify-content:center;gap:12px;min-height:44px;padding:10px 20px;border:1px solid #586069;border-radius:7px;font:600 13px/1.6 "Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;letter-spacing:.5px;cursor:pointer;white-space:nowrap;transition:background .16s,color .16s,transform .16s}
.ux-btn svg{width:18px;height:18px}.ux-btn-primary{color:#191710;border-color:#cfad6b;background:linear-gradient(110deg,#d8bd80,#ba985a);box-shadow:0 3px 13px #0004}.ux-btn-primary:hover{background:#e0c78d;transform:translateY(-1px)}
.ux-btn-quiet{color:#b3babe;border-color:transparent;background:transparent;padding:10px 8px}.ux-btn-quiet:hover{color:#ece4d6;background:#ffffff08}.ux-btn-danger{color:#fff0e8;border-color:#a85a57;background:#813e3d}
.ux-dialog button:focus-visible,.ux-dialog input:focus-visible{outline:2px solid #e4c585;outline-offset:4px}.ux-dialog h2:focus,.ux-dialog:focus{outline:none}
.ux-page-number{color:#7c8994;font:11px Georgia,serif;letter-spacing:2px}
.ux-step-progress{display:flex;align-items:center;justify-content:center;gap:26px;list-style:none;padding:0;margin:0 0 19px}.ux-step-progress li{position:relative;color:#66727f}.ux-step-progress li:not(:last-child)::after{content:"";height:1px;width:26px;background:#38434e;position:absolute;left:26px;top:13px}.ux-step-progress li>span:first-child{display:grid;place-items:center;width:27px;height:27px;border:1px solid #38434e;border-radius:50%;font:12px Georgia,serif}.ux-step-progress .current{color:#ecd2a1}.ux-step-progress .current>span:first-child{border-color:#cfad6b;background:#cfad6b12}.ux-step-progress .complete{color:#81b4a8}.ux-step-progress .complete>span:first-child{border-color:#508777}
.ux-tutorial-emblem{display:grid;place-items:center;width:75px;height:75px;margin:0 auto 21px;color:#cfad6b;border:1px solid #cfad6b25;border-radius:50%;background:radial-gradient(circle,#cfad6b0d,transparent);box-shadow:0 0 35px #cfad6b08}.ux-tutorial-emblem svg{width:37px;height:37px}.ux-tutorial .ux-lead{text-align:left}
.ux-intent-demo{display:flex;align-items:center;gap:13px;width:fit-content;min-width:240px;margin:22px auto 0;padding:14px 24px;border:1px solid #b5765c55;background:linear-gradient(100deg,#673f2e38,#10171f);border-radius:8px}.ux-intent-mark{display:grid;place-items:center;width:30px;height:30px;border:1px solid #bd8368;border-radius:50%;color:#e9b399;font:19px Georgia,serif}.ux-intent-demo small{display:block;color:#b6a591;font-size:10px;letter-spacing:1px}.ux-intent-demo strong{display:block;color:#e3c4a8;font-size:14px;font-weight:600}
.ux-sp-demo{display:flex;align-items:center;justify-content:center;gap:9px;margin:26px 0 8px}.ux-sp-demo>span{width:17px;height:17px;border-radius:50%;background:#0b0f15;border:1px solid #5fa3b1}.ux-sp-demo>span.on{background:#82bec8;box-shadow:0 0 12px #82bec829}.ux-sp-demo strong{margin-left:7px;color:#bedce1;font:20px Georgia,serif}.ux-sp-demo small{font-size:11px;color:#849ca4}
.ux-combo-demo{display:flex;align-items:center;justify-content:center;gap:9px;margin:22px 0 5px}.ux-combo-demo>span{display:flex;flex-direction:column;align-items:center;min-width:83px;padding:10px 12px;border:1px solid #567f764d;border-radius:7px;background:#365b4b20;color:#d6dfd9;font-size:14px}.ux-combo-demo b{display:block;margin-bottom:3px;font-size:9px;font-weight:500;letter-spacing:1px;color:#8bb7a8}.ux-combo-demo i{font-style:normal;color:#cfad6b}.ux-combo-demo>span.enemy{border-color:#a2645b4d;background:#7144351a;color:#d4b8aa}.ux-combo-demo .enemy b{color:#bd998a}
.ux-tabs{display:flex;gap:4px;margin:-3px 0 23px;padding:4px;border:1px solid #ffffff0b;border-radius:8px;background:#0b0f1560}.ux-tabs button{flex:1;min-height:40px;padding:8px 5px;background:transparent;border:1px solid transparent;border-radius:5px;color:#9faab2;font:500 12px/1.5 "Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;cursor:pointer;white-space:nowrap}.ux-tabs button[aria-selected="true"]{background:#cfad6b12;border-color:#cfad6b32;color:#e7d3ab}
.ux-rules{margin:18px 0 0}.ux-rules>div{display:grid;grid-template-columns:98px minmax(0,1fr);gap:14px;padding:14px 0;border-bottom:1px solid #ffffff0b}.ux-rules>div:last-child{border-bottom:0}.ux-rules dt{color:#ded6c7;font-weight:500;font-size:12px}.ux-rules dd{margin:0;color:#afb8bd;font-size:12px;line-height:1.9}.ux-rules dd strong{color:#d6dddf;font-weight:500}.ux-instant-tag{color:#8ebfac;padding:3px 7px;border:1px solid #79ac9545;border-radius:4px;background:#45745b20}.ux-rule-dot{display:inline-block;width:6px;height:6px;margin:0 7px 1px 0;border-radius:50%;background:#aaa}.ux-rule-dot.teal{background:#81b9b0}.ux-rule-dot.purple{background:#b497c5}.ux-rule-dot.red{background:#dc9277}.ux-rule-dot.gold{background:#cfad6b}.ux-rule-dot.blue{background:#8eb8c6}
.ux-guide-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:21px}.ux-guide-grid article{padding:15px;background:#0b0f1540;border:1px solid #ffffff0b;border-radius:7px}.ux-guide-grid h3{margin:0 0 6px;color:#d8c7a9;font-size:13px;font-weight:500}.ux-guide-grid p{font-size:12px;line-height:1.9;color:#aeb8bd}
.ux-keyboard-tip{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:20px;color:#8596a1;font-size:11px}.ux-keyboard-tip kbd{min-width:25px;text-align:center;padding:2px 6px;border:1px solid #48515b;border-radius:4px;background:#0b0f15;color:#d3d5d4;font:10px/1.5 monospace}.ux-keyboard-tip span{margin-right:10px}
.ux-preference{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:17px 0;border-bottom:1px solid #ffffff0b}.ux-preference:first-child{padding-top:0}.ux-preference h3{margin:0 0 4px;color:#dedbd2;font-size:14px;font-weight:500}.ux-preference p{max-width:360px;color:#91a0a9;font-size:12px;line-height:1.8}.ux-switch{display:flex;align-items:center;gap:9px;flex:none;min-height:44px;padding:3px 0 3px 5px;background:transparent;border:0;cursor:pointer}.ux-switch-label{width:25px;color:#73818b;font:10px Georgia,serif}.ux-switch-track{width:42px;height:24px;padding:3px;border:1px solid #45515b;border-radius:15px;background:#0b0f15;transition:background .2s}.ux-switch-track>span{display:block;width:16px;height:16px;border-radius:50%;background:#7a858b;transition:transform .2s,background .2s}.ux-switch.is-on .ux-switch-label{color:#cfad6b}.ux-switch.is-on .ux-switch-track{background:#cfad6b18;border-color:#cfad6b7a}.ux-switch.is-on .ux-switch-track>span{transform:translateX(17px);background:#cfad6b}
.ux-volume-group{padding:13px 0 14px;border-bottom:1px solid #ffffff0b}.ux-volume{display:grid;grid-template-columns:85px minmax(0,1fr) 37px;align-items:center;gap:14px;margin:5px 0;font-size:11px;color:#a9b3b9}.ux-volume input{width:100%;height:30px;accent-color:#cfad6b;cursor:pointer;background:transparent}.ux-volume output{text-align:right;color:#cfad6b;font:11px Georgia,serif}
.ux-settings-links{display:grid;gap:5px;margin:17px 0 5px}.ux-settings-links button{display:flex;align-items:center;justify-content:space-between;min-height:43px;padding:8px 0;background:transparent;border:none;color:#cbbfa8;font:12px/1.6 "Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;text-align:left;cursor:pointer}.ux-settings-links svg{width:17px;height:17px;color:#7b8b96}.ux-settings-links button:hover{color:#edd5a8}.ux-title-return{display:block;width:100%;min-height:43px;margin-top:15px;padding:9px 14px;background:#0b0f1550;border:1px solid #8e786543;border-radius:6px;color:#b9a999;font:12px/1.6 "Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;cursor:pointer}.ux-title-return:hover{border-color:#cfad6b80;color:#dbc4a3}.ux-save-note{font-size:10px;color:#7e8e98}.ux-confirm-message{padding:7px 0 18px;white-space:normal}
.ux-toast{position:fixed;z-index:150;left:50%;bottom:calc(24px + env(safe-area-inset-bottom));width:max-content;max-width:min(90vw,550px);padding:12px 19px;background:#19222cf5;border:1px solid #687b736e;border-radius:9px;box-shadow:0 10px 40px #0006;color:#e4ddcd;font:12px/1.8 "Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;opacity:0;transform:translate(-50%,12px);pointer-events:none;transition:opacity .2s,transform .2s;text-align:center}.ux-toast.show{opacity:1;transform:translate(-50%,0)}.ux-toast[data-tone="error"]{border-color:#c681766e;color:#edbbb1}.ux-toast[data-tone="success"]{border-color:#7cb8a56e;color:#b4ddcd}
.ux-sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
body.large-text .ux-dialog-body .ux-lead{font-size:16px}body.large-text .ux-dialog-body .ux-note,body.large-text .ux-rules dt,body.large-text .ux-rules dd,body.large-text .ux-preference p,body.large-text .ux-guide-grid p{font-size:14px}
body.large-text .sdesc,body.large-text .c-sub,body.large-text .skill-description,body.large-text .skill-desc,body.large-text .node-desc,body.large-text .enemy-intent,body.large-text .intent{font-size:14px!important;line-height:1.6!important}body.large-text .sname,body.large-text .choice{font-size:16px!important}body.large-text #log{font-size:13px!important}
body.reduced-motion *,body.reduced-motion *::before,body.reduced-motion *::after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important;scroll-behavior:auto!important}
body.reduced-motion .enemy .sprite,body.reduced-motion .scene-icon .big,body.reduced-motion .enemy-art,body.reduced-motion .lantern-glow{animation:none!important}
@keyframes ux-enter{from{opacity:0;transform:translateY(12px) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}
@media(max-width:520px){.ux-backdrop{padding:15px}.ux-dialog{max-height:calc(100dvh - 30px);border-radius:11px}.ux-dialog-head{padding:22px 21px 15px}.ux-dialog h2{font-size:23px}.ux-dialog-body{padding:19px 21px}.ux-dialog-footer{padding:16px 21px 19px}.ux-rules>div{grid-template-columns:82px minmax(0,1fr);gap:11px}.ux-guide-grid{grid-template-columns:1fr}.ux-preference{gap:13px}.ux-preference p{font-size:11px}.ux-volume{grid-template-columns:78px minmax(0,1fr) 32px;gap:9px}.ux-combo-demo{gap:7px}.ux-combo-demo>span{min-width:74px;padding:10px 9px}.ux-save-note{max-width:130px;line-height:1.7}.ux-btn{padding:10px 16px}}
@media(max-width:350px){.ux-backdrop{padding:9px}.ux-dialog-head,.ux-dialog-body,.ux-dialog-footer{padding-left:17px;padding-right:17px}.ux-dialog h2{font-size:21px}.ux-rules>div{grid-template-columns:1fr;gap:4px}.ux-combo-demo>span{min-width:64px}.ux-dialog-footer{gap:6px}.ux-btn{padding:10px 12px}.ux-preference p{max-width:190px}}

/* Player feedback pass: readable encounters and a useful combat journal.
   Load after ui.css, onboarding.css, and polish.css. */
:root { --journal-height: 73px; }
body.large-text { --journal-height: 80px; }

/* Three journal lines in every scene; earlier entries remain scrollable. */
body:not([data-view="title"]) #gameShell { grid-template-rows: minmax(0, 1fr) var(--journal-height); }
body:not([data-view="title"]) #logWrap { height: var(--journal-height); min-height: var(--journal-height); overflow: hidden; background: #101922; }
#log { min-height: 0; padding: 8px 16px; font-size: 11.5px; line-height: 1.6; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; touch-action: pan-y; user-select: text; -webkit-user-select: text; }
#log > div { overflow-wrap: anywhere; }
.journal-label { gap: 9px; }

/* The encounter and explorer follow one another in normal flow. Forecasts
   and effects can grow freely without entering the player's HP panel. */
body:not([data-view="title"]) #stage { display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 58px 24px 16px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; }
body:not([data-view="title"]) #sceneZone { position: relative; inset: auto; flex: 1 0 auto; min-height: 0; width: 100%; margin: 0; padding: 0; align-items: center; justify-content: center; }
body:not([data-view="title"]) #playerStatus { position: relative; inset: auto; flex: 0 0 auto; width: 100%; margin: 0; z-index: 4; background: rgba(9, 17, 25, .96); border-color: #485867; box-shadow: 0 5px 22px rgba(0, 0, 0, .32); }
body:not([data-view="title"]) #stageCaption { display: none; }
#sceneZone > .enemy { flex: 0 0 auto; max-width: 500px; padding-bottom: 2px; }
.enemy .ename { margin-bottom: 8px; }
.enemy .sprite { isolation: isolate; z-index: 0; margin: 0 0 9px; filter: none; }
.enemy.elite-foe .sprite { filter: none; }
.enemy .sprite::before { content: ''; position: absolute; inset: -10% -15%; z-index: -1; border-radius: 50%; background: radial-gradient(ellipse at 50% 65%, rgba(123, 132, 138, .085) 0%, rgba(72, 85, 94, .045) 40%, transparent 72%); pointer-events: none; }
.enemy { --foe-hue: 0deg; --foe-saturation: 1.09; --foe-sepia: 0; }
.enemy[data-aspect="plague"] { --foe-hue: 36deg; --foe-saturation: .88; }
.enemy[data-aspect="arcane"] { --foe-hue: -36deg; --foe-saturation: .86; }
.enemy[data-aspect="iron"] { --foe-sepia: .25; --foe-saturation: .85; }
.enemy .enemy-art,
.enemy[data-aspect="plague"] .enemy-art,
.enemy[data-aspect="arcane"] .enemy-art,
.enemy[data-aspect="iron"] .enemy-art { filter: hue-rotate(var(--foe-hue)) sepia(var(--foe-sepia)) saturate(var(--foe-saturation)) brightness(1.12) contrast(1.03) drop-shadow(0 7px 12px rgba(0, 0, 0, .72)); }
body[data-view="battle"] #stage::before { z-index: -1; background: linear-gradient(180deg, rgba(4, 9, 15, .08), rgba(4, 9, 15, .34)), radial-gradient(ellipse at 50% 40%, rgba(5, 11, 19, .48), rgba(7, 13, 21, .28) 45%, transparent 79%); }
.enemy .ebar-wrap { margin-top: 0; width: min(288px, 100%); max-width: none; }
.enemy-hp-head { font-size: 10px; color: #e2ded2; }
.enemy-hp-head > span:first-child, .enemy-hp-head em { color: #c4c6bd; }
.enemy .intent { display: flex; flex: 0 0 auto; width: min(390px, 100%); max-width: 100%; min-height: 56px; margin: 11px 0 0; padding: 9px 12px; gap: 10px; color: #e4dac8; border-color: #756548; background: rgba(13, 21, 29, .97); text-align: left; }
.enemy .intent.danger { background: rgba(44, 25, 24, .98); border-color: #bd825f; }
.enemy .intent-icon { flex: 0 0 24px; }
.enemy .intent-icon svg { width: 21px; height: 21px; }
.enemy .intent-info { flex: 1 1 auto; gap: 2px; }
.enemy .intent-info small { font-size: 9px; line-height: 1.3; color: #b9b6a8; }
.enemy .intent-info b { font-size: 13px; line-height: 1.45; }
.enemy .intent-info > span { font-size: 11px; line-height: 1.5; color: #c6c4b8; overflow-wrap: anywhere; }
.enemy .intent-value { flex: 0 0 auto; max-width: 45%; margin: 0; font-size: 12px; line-height: 1.5; color: #edbea6; white-space: normal; text-align: right; }

/* Buffs and ailments live below their actor's name / HP. Fragment resets
   prevent old span rules from painting a border around each piece of a chip. */
.status-list[hidden] { display: none !important; }
.enemy .enemy-status,
#playerStatus .player-status-effects,
#playerStatus #shieldTxt.status-list { position: static; display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 6px; width: 100%; max-width: none; margin: 9px 0 0; padding: 0; }
.enemy .enemy-status { justify-content: center; }
#playerStatus .player-status-effects, #playerStatus #shieldTxt.status-list { margin: -2px 0 10px; }
.enemy .enemy-status:empty, #playerStatus .player-status-effects:empty { display: none; }
.status-chip { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 5px; min-width: 44px; min-height: 44px; padding: 7px 9px; border: 1px solid #645451; border-radius: 6px; background: #251e21; color: #dfb7a4; font-family: var(--sans); font-size: 11px; font-weight: 500; line-height: 1.35; white-space: nowrap; letter-spacing: 0; text-shadow: none; }
.status-chip.status-buff { color: #bdd7c9; border-color: #4c695e; background: #172b26; }
.status-chip.status-debuff { color: #e2b7a5; border-color: #74534a; background: #2e2222; }
.status-chip:hover { filter: brightness(1.14); }
.enemy .enemy-status .status-chip > span,
.enemy .enemy-status .status-chip > small,
#playerStatus .status-chip > span,
#playerStatus .status-chip > small { position: static; width: auto; min-width: 0; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: inherit; font-family: inherit; font-size: inherit; line-height: inherit; }
.status-chip .status-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.status-chip .status-icon svg, .enemy .enemy-status .status-chip svg, #playerStatus .status-chip svg { width: 16px; height: 16px; }
.status-chip .status-name { display: inline; }
.status-chip .status-duration, .enemy .enemy-status .status-chip > .status-duration, #playerStatus .status-chip > .status-duration { display: inline; font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 400; opacity: .85; }
.status-chip[data-status="poison"] { color: #b6d69f; border-color: #5a7453; background: #222c21; }
.status-chip[data-status="burn"] { color: #edb48c; border-color: #936540; background: #352821; }
.status-chip[data-status="stun"] { color: #ead196; border-color: #8b7950; background: #312d20; }
.status-chip[data-status="weaken"] { color: #b0cadd; border-color: #56748a; background: #202b34; }
.status-chip[data-status="curse"], .status-chip[data-status="doom"] { color: #d8bce6; border-color: #856894; background: #2e2537; }
.status-chip[data-status="enrage"] { color: #edbd94; border-color: #8b6246; background: #33261e; }
.status-chip[data-status="shield"], .status-chip[data-status="pendingShield"] { color: #b7d7dd; border-color: #4e7780; background: #1b2a31; }

/* Compact commands keep their text and a full touch target. */
.skill-grid { gap: 6px; }
.skill { min-height: 66px; gap: 10px; padding: 8px 11px; margin-bottom: 6px; }
.skill .sname { line-height: 1.4; }
.skill .sdesc { margin-top: 2px; line-height: 1.5; }
.skill .icon { height: 32px; }
.skill .cost .c-ct { margin-top: 2px; line-height: 1.35; }
.skill .cost .c-sp { line-height: 1.35; }
.skill.item-row { min-height: 66px; }
body.large-text .skill { min-height: 78px; padding-top: 9px; padding-bottom: 9px; }
body.large-text .status-chip { font-size: 13px; }
body.large-text .status-chip .status-duration { font-size: 11px; }
body.large-text #log { font-size: 13px; line-height: 1.6; }
body.large-text .enemy .intent-info small { font-size: 10px; }
body.large-text .enemy .intent-info b { font-size: 14px; }
body.large-text .enemy .intent-info > span { font-size: 12px; }
body.large-text .enemy .intent-value { font-size: 13px; }

@media (max-width: 767px) {
  /* One outer scroll area keeps every command reachable. The journal alone
     retains an independent scroll area for reading earlier turns. */
  body:not([data-view="title"]) #gameShell { display: block; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  body:not([data-view="title"]) #stage { min-height: 0; height: auto; gap: 10px; padding: 40px 12px 10px; overflow: hidden; scrollbar-gutter: auto; background-position: center 45%; }
  body:not([data-view="title"]) #sceneZone { flex: 0 0 auto; }
  body:not([data-view="title"]) #playerStatus { padding: 9px 11px 8px; }
  body:not([data-view="title"]) #commandPanel { min-height: 0; height: auto; }
  body:not([data-view="title"]) #menu { min-height: 0; height: auto; overflow: visible; padding: 15px 16px calc(24px + env(safe-area-inset-bottom)); }
  body:not([data-view="title"]) #logWrap { height: var(--journal-height); min-height: var(--journal-height); }
  #log { padding: 8px 11px; font-size: 11.5px; line-height: 1.6; }
  .journal-label { flex-basis: 39px; }
  .enemy .ename { margin-bottom: 5px; font-size: 17px; line-height: 1.4; }
  .enemy .sprite { margin: 0 0 6px; }
  .enemy .enemy-art { width: clamp(92px, 13.5dvh, 124px); }
  .enemy .ebar-wrap { width: min(300px, 100%); }
  .enemy-hp-head { font-size: 10px; line-height: 1.4; margin-bottom: 4px; }
  .enemy .ebar-bg { height: 4px; }
  .enemy .intent { width: min(330px, 100%); min-height: 52px; margin-top: 8px; padding: 7px 9px; gap: 7px; align-items: center; }
  .enemy .intent-info { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 2px 6px; }
  .enemy .intent-info small { grid-column: 1; grid-row: 1; white-space: nowrap; font-size: 9px; line-height: 1.3; }
  .enemy .intent-info b { grid-column: 2; grid-row: 1; min-width: 0; font-size: 12px; line-height: 1.45; }
  .enemy .intent-info > span { grid-column: 1 / -1; grid-row: 2; font-size: 11px; line-height: 1.4; }
  .enemy .intent-value { max-width: 42%; font-size: 11px; line-height: 1.5; }
  .enemy .intent-icon { flex-basis: 19px; }
  .enemy .intent-icon svg { width: 19px; height: 19px; }
  .enemy .enemy-status, #playerStatus .player-status-effects, #playerStatus #shieldTxt.status-list { gap: 5px; }
  .status-chip { padding: 6px 7px; font-size: 10px; gap: 4px; }
  .status-chip .status-duration, .enemy .enemy-status .status-chip > .status-duration, #playerStatus .status-chip > .status-duration { font-size: 9px; }
  .status-chip .status-icon svg, .enemy .enemy-status .status-chip svg, #playerStatus .status-chip svg { width: 15px; height: 15px; }
  .pname { margin-bottom: 6px; }
  .pname .player-name { font-size: 11px; }
  .bar label, .bar .num { font-size: 9px; }
  .bar .num { width: 52px; }
  .status-meters { gap: 5px 14px; }
  .hp-bar .track { height: 5px; }
  .sp-row { display: none; }
  .skill { min-height: 62px; padding: 8px 10px; gap: 9px; }
  .skill .sname { font-size: 13px; line-height: 1.4; }
  .skill .sdesc { font-size: 12px; line-height: 1.45; margin-top: 2px; }
  .skill .icon { width: 26px; flex-basis: 26px; height: 30px; }
  .skill .icon svg { width: 24px; height: 24px; }
  .skill .cost { min-width: 43px; }
  .skill .cost .c-sp { font-size: 11px; }
  .skill .cost .c-ct { font-size: 9px; }
  .battle-tools { margin-top: 10px; }
  body[data-view="battle"] .panel-heading { margin-bottom: 10px; }
  body[data-view="battle"] .eyebrow { display: none; }
  .scene-icon { width: 100%; max-width: 370px; padding: 5px 8px; }
  .scene-icon .sub, .scene-icon.with-art .sub { font-size: 11px; line-height: 1.65; }
  .scene-art { width: clamp(90px, 16dvh, 144px); max-height: none; }
  body.large-text .skill { min-height: 76px; padding-top: 9px; padding-bottom: 9px; }
  body.large-text .status-chip { font-size: 12px; }
  body.large-text .bar label, body.large-text .bar .num { font-size: 11px; }
  body.large-text .enemy .intent-info { grid-template-columns: minmax(0, 1fr); }
  body.large-text .enemy .intent-info small { grid-column: 1; grid-row: 1; }
  body.large-text .enemy .intent-info b { grid-column: 1; grid-row: 2; }
  body.large-text .enemy .intent-info > span { grid-column: 1; grid-row: 3; }
}

/* Short landscape keeps the two columns and permits manual scrolling.
   All encounter elements retain normal flow, including maximum effects. */
@media (orientation: landscape) and (max-height: 520px) {
  body:not([data-view="title"]) #gameShell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, 43%); grid-template-rows: max-content var(--journal-height); align-content: start; overflow-y: auto; overflow-x: hidden; }
  body:not([data-view="title"]) #stage { grid-column: 1; grid-row: 1; align-self: start; height: max-content; min-height: max-content; padding: 32px 12px 10px; gap: 8px; overflow: hidden; }
  body:not([data-view="title"]) #logWrap { grid-column: 1; grid-row: 2; height: var(--journal-height); min-height: var(--journal-height); }
  body:not([data-view="title"]) #commandPanel { grid-column: 2; grid-row: 1 / 3; align-self: stretch; height: auto; border-left: 1px solid var(--line); border-top: 0; }
  body:not([data-view="title"]) #menu { height: auto; min-height: 100%; padding: 15px 14px 20px; overflow: visible; }
  body:not([data-view="title"]) #sceneZone { flex: 0 0 auto; }
  body:not([data-view="title"]) #playerStatus { padding: 9px 10px; }
  .enemy .ename { font-size: 15px; line-height: 1.4; margin-bottom: 6px; }
  .enemy .enemy-art { width: 96px; }
  .enemy .sprite { margin: 0 0 7px; }
  .enemy .intent { min-height: 52px; margin-top: 8px; padding: 7px 10px; }
  .enemy .intent-info { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 2px 6px; }
  .enemy .intent-info small { grid-column: 1; grid-row: 1; font-size: 9px; white-space: nowrap; }
  .enemy .intent-info b { grid-column: 2; grid-row: 1; min-width: 0; font-size: 12px; }
  .enemy .intent-info > span { grid-column: 1 / -1; grid-row: 2; font-size: 11px; }
  .enemy .intent-value { font-size: 11px; }
  .enemy .enemy-status { display: flex; position: static; flex-direction: row; flex-wrap: wrap; margin: 8px 0 0; }
  .enemy .enemy-status[hidden] { display: none !important; }
  .scene-art { width: 100px; max-height: none; }
  .scene-icon.with-art .lab { font-size: 19px; }
  .scene-icon.with-art .sub { font-size: 11px; line-height: 1.5; }
  .skill { min-height: 62px; padding: 8px 10px; }
  .skill .sdesc { font-size: 12px; }
  body.large-text .skill { min-height: 76px; }
}
@media (max-width: 359px) {
  body:not([data-view="title"]) #menu { padding-left: 12px; padding-right: 12px; }
  .enemy .intent { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .enemy .intent-value { max-width: 40%; }
}
@media (prefers-contrast: more) {
  .enemy .intent { background: #0b141e; border-color: #a4a68d; }
  .status-chip { border-width: 2px; }
  .skill .sdesc { color: #d2d9de; }
}
@media (prefers-reduced-motion: reduce) { .enemy .sprite, .scene-art { animation: none; } }
body.reduced-motion .enemy .sprite, body.reduced-motion .scene-art { animation: none; }

/* Every encounter uses the same frame. Only the command panel and journal
   scroll, so moving between battle, rewards and shops does not move the page. */
body:not([data-view="title"]) #gameShell { display: grid; grid-template-columns: minmax(0, 1fr) 410px; grid-template-rows: minmax(0, 1fr) var(--journal-height); align-content: stretch; overflow: hidden; }
body:not([data-view="title"]) #stage { grid-column: 1; grid-row: 1; align-self: stretch; min-height: 0; height: 100%; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; }
body:not([data-view="title"]) #sceneZone { flex: 1 0 auto; min-height: 0; }
body:not([data-view="title"]) #logWrap { grid-column: 1; grid-row: 2; }
body:not([data-view="title"]) #commandPanel { grid-column: 2; grid-row: 1 / 3; min-height: 0; height: 100%; overflow: hidden; }
body:not([data-view="title"]) #menu { min-height: 0; height: 100%; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; scrollbar-gutter: stable; }

/* Route choices and tools use the same whole-panel scroll as other commands. */
body[data-view="map"] #menu { display: block; }

/* Short reward and shop instructions share a line with their heading. */
#menu .compact-heading { margin: 0 0 10px; }
#menu .compact-heading .panel-title-row { justify-content: flex-start; gap: 8px; }
#menu .compact-heading .panel-title { flex: 0 0 auto; font-size: 18px; line-height: 1.4; letter-spacing: .04em; }
#menu .compact-heading .panel-description { display: block; flex: 1 1 auto; min-width: 0; margin: 0; font-size: 11px; line-height: 1.45; }
#menu .compact-heading .turn { flex: 0 0 auto; margin-left: auto; }
body[data-view="merchant"] #menu .compact-heading + .subhead { margin: 0 0 6px; border-top: 0; padding-top: 0; }
body.large-text #menu .compact-heading .panel-description { font-size: 13px; line-height: 1.6; }

@media (max-width: 767px) and (orientation: portrait) {
  /* Match the previous reward view's roughly 300–327px illustration area. */
  body:not([data-view="title"]) #gameShell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, min(clamp(298px, calc(210px + 14dvh), 338px), calc(100% - var(--journal-height) - 90px))) var(--journal-height) minmax(90px, 1fr); }
  body:not([data-view="title"]) #stage { padding: 26px 12px 8px; gap: 6px; }
  body:not([data-view="title"]) #commandPanel { grid-column: 1; grid-row: 3; }
  body:not([data-view="title"]) #menu { padding: 15px 16px calc(16px + env(safe-area-inset-bottom)); }
  #sceneZone > .enemy { padding-bottom: 0; }
  .enemy .ename { margin-bottom: 4px; }
  .enemy .sprite { margin-bottom: 4px; }
  .enemy .intent { min-height: 48px; margin-top: 5px; padding-top: 6px; padding-bottom: 6px; }
  body[data-view="map"] #menu { padding: 4px 16px calc(4px + env(safe-area-inset-bottom)); }
  body[data-view="map"] .panel-heading { margin: 0 0 4px; }
  body[data-view="map"] .eyebrow,
  body[data-view="map"] .panel-description,
  body[data-view="map"] #menu > .panel-tip { display: none; }
  body[data-view="map"] .panel-title { font-size: 20px; line-height: 1.4; }
  body[data-view="map"] .route-progress { margin: 2px 0 4px; }
  body[data-view="map"] .route-progress::before { top: 11px; }
  body[data-view="map"] .route-step { gap: 2px; }
  body[data-view="map"] .route-step i { width: 22px; height: 22px; }
  body[data-view="map"] .route-step b { font-size: 9px; line-height: 1.3; }
  body[data-view="map"] .battle-tools { margin: 2px 0 0; }
  body[data-view="map"] .battle-tools .itemcmd,
  body[data-view="map"] .battle-tools .treecmd { margin-bottom: 0; }
}

@media (orientation: landscape) and (max-height: 520px) {
  body:not([data-view="title"]) #gameShell { grid-template-columns: minmax(0, 1fr) minmax(290px, 43%); grid-template-rows: minmax(0, 1fr) var(--journal-height); }
  body:not([data-view="title"]) #stage { padding: 32px 12px 10px; gap: 8px; }
  body:not([data-view="title"]) #menu { padding: 10px 14px; }
  body[data-view="map"] .panel-heading { margin: 0 0 6px; }
  body[data-view="map"] .panel-title { font-size: 18px; line-height: 1.4; }
  body[data-view="map"] .eyebrow,
  body[data-view="map"] .panel-description,
  body[data-view="map"] #menu > .panel-tip { display: none; }
  body[data-view="map"] .route-progress { margin: 6px 0 8px; }
  body[data-view="map"] .battle-tools { margin: 8px 0 0; }
  body[data-view="map"] .battle-tools .itemcmd,
  body[data-view="map"] .battle-tools .treecmd { margin-bottom: 0; }
}

/* Impact geometry is centred on the JS-provided target coordinates. */
.combat-fx-layer {
  position: absolute; inset: 0; z-index: 12; overflow: hidden;
  pointer-events: none; contain: layout paint; isolation: isolate;
}
.combat-fx-target { position: absolute; width: 1px; height: 1px; pointer-events: none; }
.combat-fx-target[data-target="player"] { --pop-color: #ffd0b4; }
.combat-impact {
  --fx-color: #ffe1a1; --fx-rgb: 255, 206, 122; --fx-scale: 1;
  position: absolute; left: 50%; top: 50%; width: 224px; height: 224px;
  transform: translate(-50%, -50%) scale(var(--fx-scale));
}
.combat-impact[data-strength="heavy"] { --fx-scale: 1.16; }
.combat-impact[data-strength="critical"] { --fx-scale: 1.32; }
.combat-impact[data-type="pierce"] { --fx-color: #e6f2ff; --fx-rgb: 179, 217, 255; }
.combat-impact[data-type="fire"] { --fx-color: #ffbd66; --fx-rgb: 255, 123, 47; }
.combat-impact[data-type="frost"] { --fx-color: #c8faff; --fx-rgb: 130, 221, 255; }
.combat-impact[data-type="lightning"] { --fx-color: #e9dcff; --fx-rgb: 187, 149, 255; }
.combat-impact[data-type="poison"] { --fx-color: #c0ffac; --fx-rgb: 160, 101, 212; }
.combat-impact[data-type="heal"] { --fx-color: #a6ffcf; --fx-rgb: 109, 240, 171; }
.combat-impact[data-type="shield"] { --fx-color: #b9eaff; --fx-rgb: 107, 185, 255; }
.combat-impact[data-type="hurt"] { --fx-color: #ffbc9c; --fx-rgb: 255, 81, 69; }
.combat-impact[data-type="boss"] { --fx-color: #ffe0a6; --fx-rgb: 240, 100, 52; --fx-scale: 1.45; }
.combat-core, .combat-ring, .combat-streak, .combat-particle,
.combat-guard, .combat-heal-cross, .combat-bolt {
  position: absolute; left: 50%; top: 50%; pointer-events: none;
}
.combat-core {
  width: 116px; height: 116px; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, #fff6de 0 5%, var(--fx-color) 8%, rgba(var(--fx-rgb), .6) 20%, rgba(var(--fx-rgb), .15) 44%, transparent 68%);
  mix-blend-mode: screen; animation: combat-core-burst 380ms ease-out both;
}
.combat-ring {
  width: 126px; height: 126px; border: 2px solid var(--fx-color); border-radius: 50%; opacity: 0;
  box-shadow: 0 0 15px rgba(var(--fx-rgb), .55), inset 0 0 14px rgba(var(--fx-rgb), .28);
  animation: combat-ring-expand 520ms cubic-bezier(.12, .55, .3, 1) both;
}
.combat-ring + .combat-ring { animation-delay: 70ms; border-width: 1px; }
.combat-streak {
  --angle: -32deg; width: 204px; height: 9px; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--fx-color) 15%, #fff 47%, #fff9dd 64%, transparent);
  clip-path: polygon(0 46%, 45% 0, 100% 48%, 57% 100%);
  filter: drop-shadow(0 0 6px var(--fx-color));
  animation: combat-streak-cut 330ms cubic-bezier(.1, .65, .2, 1) both;
}
.combat-impact[data-type="slash"]::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 168px; height: 68px;
  border: 3px solid transparent; border-bottom-color: #fff9e6; border-right-color: #ffd990;
  border-radius: 50%; filter: drop-shadow(0 0 7px #ffdc96); opacity: 0;
  animation: combat-slash-arc 380ms ease-out both;
}
.combat-impact[data-type="slash"] .combat-ring { width: 74px; height: 74px; border-width: 1px; }
.combat-impact[data-type="slash"] .combat-core { width: 86px; height: 86px; }
.combat-impact[data-type="pierce"] .combat-streak {
  width: 236px; height: 5px; clip-path: polygon(0 35%, 84% 0, 100% 50%, 84% 100%, 0 65%);
  animation-name: combat-pierce; animation-duration: 280ms;
}
.combat-impact[data-type="pierce"] .combat-ring { width: 52px; height: 94px; border-width: 1px; }
.combat-impact[data-type="fire"] .combat-core {
  width: 168px; height: 168px; animation-duration: 480ms;
  background: radial-gradient(circle, #fffbe7 0 5%, #ffe5a3 9%, #ffb039 20%, rgba(249, 76, 31, .6) 36%, transparent 66%);
}
.combat-impact[data-type="fire"] .combat-ring { width: 148px; height: 148px; border: 3px solid #ffc270; }
.combat-impact[data-type="frost"] .combat-ring { border-style: dashed; border-width: 2px; }
.combat-impact[data-type="lightning"] .combat-core { width: 158px; height: 158px; animation-duration: 300ms; }
.combat-impact[data-type="lightning"] .combat-ring { border-width: 1px; animation-duration: 350ms; }
.combat-impact[data-type="poison"] .combat-core {
  background: radial-gradient(circle, rgba(190, 242, 139, .7), rgba(169, 100, 218, .5) 25%, transparent 66%);
  animation-duration: 550ms;
}
.combat-impact[data-type="poison"] .combat-ring { border-color: #c294eb; width: 104px; height: 104px; }
.combat-impact[data-type="heal"] .combat-core { width: 174px; height: 174px; animation-duration: 620ms; }
.combat-impact[data-type="heal"] .combat-ring { width: 116px; height: 44px; border-width: 1px; animation-duration: 660ms; }
.combat-impact[data-type="shield"] .combat-ring { width: 148px; height: 148px; border-width: 3px; animation-duration: 650ms; }
.combat-impact[data-type="hurt"] .combat-core {
  width: 142px; height: 142px; background: radial-gradient(circle, #fff3d8, #ffb192 8%, rgba(226, 64, 50, .45) 30%, transparent 64%);
}
.combat-impact[data-type="hurt"] .combat-ring { border-color: #f37764; border-width: 1px; }
.combat-impact[data-type="boss"] .combat-ring {
  width: 168px; height: 168px; border-width: 3px; border-color: #ffd388;
  box-shadow: 0 0 22px #be533955, inset 0 0 22px #fbc06e44; animation-duration: 700ms;
}
.combat-impact[data-type="boss"] .combat-core { width: 190px; height: 190px; animation-duration: 550ms; }
.combat-particle {
  --dx: 0px; --dy: -70px; --rot: 0deg; --delay: 0ms; --life: 520ms; --size: 5px;
  width: var(--size); height: var(--size); background: var(--color, var(--fx-color)); opacity: 0;
  border-radius: 50%; box-shadow: 0 0 8px var(--color, var(--fx-color));
  animation: combat-particle-scatter var(--life) cubic-bezier(.15, .5, .3, 1) var(--delay) both;
}
.combat-impact[data-type="slash"] .combat-particle, .combat-impact[data-type="pierce"] .combat-particle {
  height: calc(var(--size) * .35); border-radius: 1px;
}
.combat-impact[data-type="fire"] .combat-particle {
  height: calc(var(--size) * 1.6); border-radius: 65% 65% 30% 30%;
  background: linear-gradient(#fff4c4, var(--color, #ffa13f));
}
.combat-impact[data-type="frost"] .combat-particle {
  width: calc(var(--size) * 1.5); height: calc(var(--size) * 2.8); border-radius: 0;
  background: linear-gradient(120deg, #fff, #b9f2ff 38%, #6faac4);
  clip-path: polygon(50% 0, 100% 48%, 50% 100%, 0 48%);
}
.combat-impact[data-type="poison"] .combat-particle {
  background: transparent; border: 2px solid var(--color, #b8f38e);
  box-shadow: 0 0 9px #ba87e3; animation-name: combat-mote-rise;
}
.combat-impact[data-type="heal"] .combat-particle {
  background: #ddffed; box-shadow: 0 0 8px #9effc9; animation-name: combat-mote-rise;
}
.combat-guard {
  width: 100px; height: 124px; opacity: 0;
  background: linear-gradient(135deg, #dff8ff 0%, #90d1ff 10%, #397cc54d 18%, #11234b33 50%, #8bcaff 87%, #e7f7ff);
  clip-path: polygon(50% 0, 93% 16%, 89% 63%, 76% 81%, 50% 100%, 24% 81%, 11% 63%, 7% 16%);
  filter: drop-shadow(0 0 12px #7dbaf9); animation: combat-guard-rise 640ms ease-out both;
}
.combat-guard::after {
  content: ''; position: absolute; inset: 10px;
  background: linear-gradient(90deg, transparent 47%, #b9edff99 49%, #b9edff99 51%, transparent 53%);
}
.combat-heal-cross {
  width: var(--size, 22px); height: var(--size, 22px); opacity: 0;
  filter: drop-shadow(0 0 6px #9cffc7);
  animation: combat-mote-rise var(--life, 700ms) ease-out var(--delay, 0ms) both;
}
.combat-heal-cross::before, .combat-heal-cross::after {
  content: ''; position: absolute; border-radius: 1px; background: #dcffeb;
}
.combat-heal-cross::before { left: 0; top: 37%; width: 100%; height: 26%; }
.combat-heal-cross::after { left: 37%; top: 0; width: 26%; height: 100%; }
.combat-bolt {
  width: 116px; height: 202px; opacity: 0; color: #f6eeff;
  filter: drop-shadow(0 0 5px #fff) drop-shadow(0 0 12px #b298ff);
  animation: combat-bolt-strike 430ms ease-out both;
}
.combat-bolt svg { display: block; width: 100%; height: 100%; overflow: visible; }
.combat-bolt path, .combat-bolt polyline { stroke-linejoin: round; stroke-linecap: round; }
.combat-pop {
  position: absolute; left: 50%; top: 50%; z-index: 4; display: flex; flex-direction: column;
  align-items: center; gap: 3px; width: max-content; max-width: 260px; opacity: 0;
  color: var(--pop-color, #fff1d6); text-align: center; white-space: nowrap;
  font-family: var(--sans, sans-serif); font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 2px #090d16, 1px 0 2px #090d16, -1px 0 2px #090d16, 0 4px 14px #000;
  animation: combat-number-rise 940ms cubic-bezier(.2, .65, .25, 1) var(--delay, 0ms) both;
}
.combat-pop-number { font-size: 36px; font-weight: 800; line-height: 1; letter-spacing: -.045em; }
.combat-pop-label { font-size: 10px; font-weight: 700; line-height: 1.35; letter-spacing: .14em; }
.combat-pop[data-strength="heavy"] .combat-pop-number { font-size: 41px; }
.combat-pop[data-strength="critical"] { color: #ffdf8f; text-shadow: 0 2px 2px #201008, 0 0 14px #d5855766, 0 4px 14px #000; }
.combat-pop[data-strength="critical"] .combat-pop-number { font-size: 48px; }
.combat-pop[data-type="heal"] { color: #b7ffcf; }
.combat-pop[data-type="shield"] { color: #bce6ff; }
.combat-pop[data-type="poison"] { color: #d2b0f0; }
.combat-stage-flash {
  position: absolute; inset: 0; z-index: 9; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at var(--flash-x, 50%) var(--flash-y, 45%), #e8ba7338, transparent 55%);
  animation: combat-stage-pulse 320ms ease-out both;
}
.combat-stage-flash[data-type="fire"] { background: radial-gradient(ellipse at var(--flash-x, 50%) var(--flash-y, 45%), #ff9a3b45, transparent 64%); }
.combat-stage-flash[data-type="frost"] { background: radial-gradient(ellipse at var(--flash-x, 50%) var(--flash-y, 45%), #a2e8ff35, transparent 60%); }
.combat-stage-flash[data-type="lightning"] { background: radial-gradient(ellipse at var(--flash-x, 50%) var(--flash-y, 45%), #d9ceff45, transparent 62%); }
.combat-stage-flash[data-type="hurt"] { background: radial-gradient(ellipse at center, transparent 45%, #ab3e3e50); box-shadow: inset 0 0 50px #aa333333; }
.combat-stage-flash[data-type="boss"] { background: radial-gradient(ellipse at center, #dd914635, transparent 60%); box-shadow: inset 0 0 70px #a83c3c40; }
#stage.combat-jolt { animation: combat-stage-jolt 220ms ease-out both; }
@keyframes combat-core-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2); }
  12% { opacity: .95; transform: translate(-50%, -50%) scale(.85); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); }
}
@keyframes combat-ring-expand {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2); }
  12% { opacity: .9; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.35); }
}
@keyframes combat-streak-cut {
  0% { opacity: 0; transform: translate(-62%, -50%) rotate(var(--angle)) scaleX(.1); }
  15% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--angle)) scaleX(1); }
  45% { opacity: .9; }
  100% { opacity: 0; transform: translate(-38%, -50%) rotate(var(--angle)) scaleX(.65); }
}
@keyframes combat-slash-arc {
  0% { opacity: 0; transform: translate(-60%, -50%) rotate(40deg) scale(.3); }
  18% { opacity: 1; transform: translate(-50%, -50%) rotate(28deg) scale(1); }
  100% { opacity: 0; transform: translate(-38%, -50%) rotate(12deg) scale(1.15); }
}
@keyframes combat-pierce {
  0% { opacity: 0; transform: translate(-85%, -50%) rotate(var(--angle)) scaleX(.3); }
  22% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--angle)) scaleX(1); }
  100% { opacity: 0; transform: translate(-15%, -50%) rotate(var(--angle)) scaleX(.65); }
}
@keyframes combat-particle-scatter {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(0deg) scale(.6); }
  12% { opacity: 1; }
  75% { opacity: .75; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(.25); }
}
@keyframes combat-mote-rise {
  0% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), 4px) scale(.5); }
  20% { opacity: .9; }
  75% { opacity: .7; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -80px))) scale(.85); }
}
@keyframes combat-guard-rise {
  0% { opacity: 0; transform: translate(-50%, -38%) scale(.65); }
  18% { opacity: .8; transform: translate(-50%, -50%) scale(1); }
  60% { opacity: .65; }
  100% { opacity: 0; transform: translate(-50%, -54%) scale(1.05); }
}
@keyframes combat-bolt-strike {
  0% { opacity: 0; transform: translate(-50%, -72%) scaleY(.2); }
  12%, 28% { opacity: 1; transform: translate(-50%, -60%) scaleY(1); }
  100% { opacity: 0; transform: translate(-50%, -58%) scaleY(1); }
}
@keyframes combat-number-rise {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(.78); }
  12% { opacity: 1; transform: translate(-50%, -64%) scale(1.08); }
  24% { transform: translate(-50%, -72%) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, calc(-72% - 48px)) scale(.96); }
}
@keyframes combat-stage-pulse { 0% { opacity: 0; } 15% { opacity: .8; } 100% { opacity: 0; } }
@keyframes combat-stage-jolt {
  0%, 100% { transform: translate(0, 0); }
  18% { transform: translate(var(--jolt-x, 3px), var(--jolt-y, 1px)); }
  42% { transform: translate(calc(var(--jolt-x, 3px) * -.6), calc(var(--jolt-y, 1px) * -.6)); }
  65% { transform: translate(calc(var(--jolt-x, 3px) * .25), calc(var(--jolt-y, 1px) * .25)); }
}
@keyframes combat-static-flash { 0%, 100% { opacity: 0; } 12%, 65% { opacity: .65; } }
@keyframes combat-static-number { 0%, 100% { opacity: 0; } 8%, 80% { opacity: 1; } }
@media (max-width: 700px) {
  .combat-impact { width: 180px; height: 180px; --fx-scale: .78; }
  .combat-impact[data-strength="heavy"] { --fx-scale: .9; }
  .combat-impact[data-strength="critical"] { --fx-scale: 1.04; }
  .combat-impact[data-type="boss"] { --fx-scale: 1.12; }
  .combat-pop-number { font-size: 29px; }
  .combat-pop[data-strength="heavy"] .combat-pop-number { font-size: 34px; }
  .combat-pop[data-strength="critical"] .combat-pop-number { font-size: 39px; }
  .combat-pop-label { font-size: 9px; }
}
/* Override the global motion preference rule while preserving readable feedback. */
body.reduced-motion #stage.combat-jolt { animation: none !important; }
body.reduced-motion .combat-impact > *, body.reduced-motion .combat-impact::after,
body.reduced-motion .combat-stage-flash {
  animation: combat-static-flash 220ms ease-out both !important;
  transform: translate(-50%, -50%);
}
body.reduced-motion .combat-stage-flash { transform: none; }
body.reduced-motion .combat-streak { transform: translate(-50%, -50%) rotate(var(--angle)); }
body.reduced-motion .combat-particle { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))); }
body.reduced-motion .combat-heal-cross { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -24px))); }
body.reduced-motion .combat-pop {
  animation: combat-static-number 700ms ease-out both !important; transform: translate(-50%, -80%);
}
@media (prefers-reduced-motion: reduce) {
  #stage.combat-jolt { animation: none !important; }
  .combat-impact > *, .combat-impact::after, .combat-stage-flash {
    animation: combat-static-flash 220ms ease-out both !important; transform: translate(-50%, -50%);
  }
  .combat-stage-flash { transform: none; }
  .combat-streak { transform: translate(-50%, -50%) rotate(var(--angle)); }
  .combat-particle { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))); }
  .combat-heal-cross { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -24px))); }
  .combat-pop { animation: combat-static-number 700ms ease-out both !important; transform: translate(-50%, -80%); }
}

/* The battle skill row is the density reference for every normal command. */
#menu :is(.skill, .choice, .route-card) {
  min-height: 66px;
  height: auto;
  max-height: none;
  padding: 8px 11px;
  margin-bottom: 6px;
  gap: 10px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.4;
}
#menu .skill-grid { gap: 6px; }
#menu .skill-grid .skill { margin-bottom: 0; }
#menu .skill.choice, #menu .skill.route-card {
  display: flex;
  flex-direction: row;
  align-items: center;
}
#menu .command-card .info { flex: 1; min-width: 0; }
#menu .command-card .sname {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}
#menu :is(.skill .sdesc, .choice .c-sub) {
  display: block;
  max-height: none;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-line-clamp: unset;
  text-overflow: clip;
}
#menu .command-card .cost { flex: 0 0 auto; min-width: 43px; text-align: right; }
#menu .command-card .cost > svg { width: 17px; height: 17px; color: var(--dim); }
#menu .command-card .cost .c-sp { line-height: 1.35; }
#menu .command-card .cost .c-ct { margin-top: 2px; line-height: 1.35; }
#menu .command-tag { display: inline; margin-left: 6px; color: #a1b5bd; font-size: 9px; font-weight: 400; }
#menu .command-card .rarity-tag { vertical-align: middle; white-space: nowrap; }
#menu .command-card.r-normal { border-color: #494c42; border-left-color: #b49d70; }
#menu .command-card.r-rare { border-color: #65586f; border-left-color: #a392b7; }
#menu .command-card.r-epic { border-color: #755a4a; border-left-color: #d39867; }
#menu .command-card.instant { border-left-color: #7caa98; }
#menu .route-card.elite .icon { color: #d6a579; }
#menu .route-card.campfire .icon { color: #c9966e; }
body:not([data-view="title"]) #menu .endpass {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 66px;
  height: auto;
  padding: 8px 11px;
  gap: 10px;
  font-size: 13px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}
body.large-text #menu :is(.skill, .choice, .route-card),
body.large-text:not([data-view="title"]) #menu .endpass {
  min-height: 78px;
  padding-top: 9px;
  padding-bottom: 9px;
}
body.large-text #menu .command-card .sname { font-size: 16px !important; }
body.large-text #menu .command-tag { font-size: 11px; }
body.large-text:not([data-view="title"]) #menu .endpass { font-size: 16px; }
@media (max-width: 767px) {
  #menu :is(.skill, .choice, .route-card),
  body:not([data-view="title"]) #menu .endpass {
    min-height: 62px;
    padding: 8px 10px;
    gap: 9px;
  }
  #menu :is(.skill .sdesc, .choice .c-sub) { line-height: 1.45; }
  #menu .command-card .cost .c-sp { font-size: 11px; }
  #menu .command-card .cost .c-ct { font-size: 9px; }
  body.large-text #menu :is(.skill, .choice, .route-card),
  body.large-text:not([data-view="title"]) #menu .endpass {
    min-height: 76px;
    padding-top: 9px;
    padding-bottom: 9px;
  }
}
@media (orientation: landscape) and (max-height: 520px) {
  #menu :is(.skill, .choice, .route-card),
  body:not([data-view="title"]) #menu .endpass {
    min-height: 62px;
    padding: 8px 10px;
  }
  body.large-text #menu :is(.skill, .choice, .route-card),
  body.large-text:not([data-view="title"]) #menu .endpass { min-height: 76px; }
}

/* Effects share an existing header line; adding one never moves the meters. */
#playerStatus .pname {
  height: 20px;
  min-height: 20px;
  min-width: 0;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
}
#playerStatus .pname .player-name {
  flex: 0 0 auto;
  min-width: 0;
  white-space: nowrap;
}
.enemy .enemy-hp-head {
  height: 20px;
  min-height: 20px;
  min-width: 0;
  gap: 7px;
}
.enemy .enemy-hp-head > span { flex: 0 0 auto; white-space: nowrap; }
#playerStatus #shieldTxt.status-list,
.enemy .enemy-hp-head .enemy-status {
  position: static;
  display: flex;
  flex: 1 1 0;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  width: 0;
  min-width: 0;
  max-width: none;
  height: 20px;
  min-height: 20px;
  gap: 4px;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  touch-action: pan-x;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
#playerStatus #shieldTxt.status-list::-webkit-scrollbar,
.enemy .enemy-hp-head .enemy-status::-webkit-scrollbar { display: none; }
#playerStatus .status-chip,
.enemy .enemy-status .status-chip,
body.large-text #playerStatus .status-chip,
body.large-text .enemy .enemy-status .status-chip {
  flex: 0 0 auto;
  height: 20px;
  min-height: 20px;
  min-width: 0;
  padding: 1px 4px;
  gap: 3px;
  border-width: 1px;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0;
}
#playerStatus .status-chip > .status-name,
.enemy .enemy-status .status-chip > .status-name { display: none; }
#playerStatus .status-chip .status-icon svg,
.enemy .enemy-status .status-chip .status-icon svg { width: 13px; height: 13px; }
#playerStatus .status-chip > .status-duration,
.enemy .enemy-status .status-chip > .status-duration,
body.large-text #playerStatus .status-chip > .status-duration,
body.large-text .enemy .enemy-status .status-chip > .status-duration {
  font-size: 10px;
  line-height: 1;
  opacity: 1;
}

/* The explorer's meters stay anchored; artwork sits behind the enemy HUD. */
body:not([data-view="title"]) #stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  scrollbar-gutter: auto;
}
body:not([data-view="title"]) #sceneZone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
body:not([data-view="title"]) #playerStatus {
  grid-row: 2;
  align-self: end;
  min-width: 0;
}
body:not([data-view="title"]) #sceneZone > .enemy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(42px, 1fr) max-content max-content;
  justify-items: center;
  align-items: center;
  width: min(100%, 500px);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  flex: 0 0 auto;
  isolation: isolate;
}
.enemy > .enemy-kicker { grid-row: 1; position: relative; z-index: 2; }
.enemy > .ename { grid-row: 2; min-width: 0; overflow-wrap: anywhere; position: relative; z-index: 2; }
.enemy > .sprite {
  /* Absolute grid placement keeps the original sprite size from enlarging
     either the encounter row or the explorer's fixed resource panel. */
  position: absolute;
  inset: 0;
  grid-column: 1 / 2;
  grid-row: 3 / 4;
  width: 100%;
  min-width: 0;
  min-height: 0;
  z-index: 0;
  pointer-events: none;
}
.enemy > .ebar-wrap { grid-row: 4; position: relative; z-index: 2; }
.enemy > .intent { grid-row: 5; position: relative; z-index: 2; }
.enemy .enemy-art {
  width: clamp(200px, 28dvh, 340px);
  max-width: 100%;
  translate: 0 6px;
}
body:not([data-view="title"]) #sceneZone > .scene-icon {
  flex: 0 0 auto;
  min-width: 0;
  margin: auto;
}
@media (max-width: 767px) {
  .enemy .enemy-art { width: clamp(92px, 13.5dvh, 124px); }
  body.large-text #sceneZone > .enemy {
    grid-template-rows: auto auto minmax(72px, 1fr) max-content max-content;
  }
}
@media (orientation: landscape) and (max-height: 520px) {
  .enemy .enemy-art { width: 96px; }
  body:not([data-view="title"]) #sceneZone > .enemy {
    grid-template-rows: auto auto minmax(96px, 1fr) max-content max-content;
  }
}
/* Shared fixed command toolbar and independently scrolling lists. */
html, body, #appFrame, #gameShell, #menu, #log, #stage, #sceneZone, #tpList, #journalHistory, .ip-card, .tp-card, .ux-dialog, .ux-backdrop, #itemPanel, #treePanel { overscroll-behavior: none !important; }
#commandPanel.with-command-bar { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#commandBar { flex: 0 0 52px; height: 52px; padding: 10px 16px; border-bottom: 1px solid #35424d; background: #111b24; overflow: hidden; }
#commandBar[hidden] { display: none; }
#commandBar .command-bar-row { height: 100%; min-width: 0; gap: 8px; }
#commandBar .command-bar-title { flex: 1 1 auto; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; line-height: 1.5; letter-spacing: .07em; }
#commandBar .command-inventory { flex: 0 0 auto; margin-right: 6px; color: #b1bbc3; font-family: var(--sans); font-size: 11px; font-weight: 400; line-height: 1.5; letter-spacing: 0; white-space: nowrap; }
body.large-text #commandBar .command-inventory { font-size: 12px; }
#commandPanel.with-command-bar #menu { flex: 1 1 0; height: auto; min-height: 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
body[data-view="map"] #commandPanel.with-command-bar #menu { padding-top: 4px; }
#treePanel .tp-card.with-tree-nav { display: flex; flex-direction: column; height: min(85dvh, 760px); max-height: 85dvh; overflow: hidden; }
#treePanel .with-tree-nav .ip-head { flex: 0 0 auto; position: static; margin-top: 0; }
#tpNav { flex: 0 0 auto; }
#tpNav[hidden] { display: none; }
#tpNav .tree-tabs { margin-bottom: 12px; }
#treePanel .with-tree-nav #tpList { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
@media (max-width: 767px) { #treePanel .tp-card.with-tree-nav { height: 88dvh; max-height: 88dvh; } }
#journalOpen { margin: 0; padding: 0; border: 0; border-right: 1px solid rgba(161, 169, 179, .12); border-radius: 0; background: transparent; font-family: var(--sans); cursor: pointer; }
#journalOpen:hover { color: #dfc58f; background: #192530; }
#journalOpen:focus-visible { outline: 2px solid #dbc68e; outline-offset: -3px; }
.ux-dialog:has(#journalHistory) { display: flex; flex-direction: column; height: min(82dvh, 720px); overflow: hidden; }
.ux-dialog:has(#journalHistory) .ux-dialog-head { flex: 0 0 auto; }
.ux-dialog:has(#journalHistory) .ux-eyebrow, .ux-dialog:has(#journalHistory) .ux-dialog-footer { display: none; }
.ux-dialog:has(#journalHistory) .ux-dialog-body { flex: 1 1 0; min-height: 0; overflow: hidden; }
#journalHistory { height: 100%; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; color: #b3bbc0; font-family: var(--sans); font-size: 13px; line-height: 1.6; }
#journalHistory:focus-visible { outline: 1px solid #dbc68e; outline-offset: 2px; }
#journalHistory .journal-entry { overflow-wrap: anywhere; margin: 0 0 4px; }
#journalHistory .l-dmg { color: #dd9d92; }
#journalHistory .l-heal { color: #a4c9b8; }
#journalHistory .l-sys { color: #d8bf92; }
#journalHistory .l-sp { color: #abd0d9; }
#journalHistory .l-xp { color: #c1b6d5; }
#journalHistory .l-crit { color: #e6c588; font-weight: 600; }
#journalHistory .journal-empty { color: #b1bbc3; }
body.large-text #journalHistory { font-size: 14px; }
.battle-heading-controls {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.battle-heading-controls .command-quicktool {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 44px;
  height: 30px;
  min-height: 30px;
  padding: 0 2px;
  gap: 2px;
  border: 1px solid #455564;
  border-radius: 5px;
  background: #192530;
  color: #bacbd0;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}
.battle-heading-controls .command-quicktool svg { width: 13px; height: 13px; }
.battle-heading-controls .turn { margin-right: 8px; }
.battle-heading-controls .quick-bag { color: #c5d1b2; border-color: #8a9b72; }
.battle-heading-controls .quick-bag svg { color: #a2bcb0; }
#menu .itemcmd { border-color: #8a9b72; }
.battle-heading-controls .quick-talent { color: #c3b6cd; }
.battle-heading-controls .quick-talent.available { color: #ddc1e6; border-color: #7d648b; }
.battle-heading-controls .quick-end { color: #dfc58f; border-color: #796846; }
.battle-heading-controls .quick-end svg { width: 17px; height: 17px; }
.battle-heading-controls .command-quicktool:disabled { opacity: .45; cursor: default; }
.battle-heading-controls .command-quicktool:hover:not(:disabled) { background: #253541; border-color: #8a9aab; }
.battle-heading-controls .command-quicktool:focus-visible { outline: 2px solid #dbc68e; outline-offset: 2px; }
#menu .skill .skill-type {
  display: inline-block;
  margin-left: 3px;
  padding: 1px 3px;
  border: 1px solid #675c46;
  border-radius: 3px;
  color: #c8b795;
  font-size: 9px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  vertical-align: middle;
  white-space: nowrap;
}
#menu .skill .skill-type.magic { border-color: #62546d; color: #c4b2d4; }
body.large-text #menu .skill .skill-type { font-size: 10px; }
#menu .skill .cost .reason-sp { color: #d8b293; }
#menu .skill .cost .reason-wait { color: #cfabb1; }
#menu .skill .cost .reason-busy { color: #bbc6cc; }
#menu .skill .merchant-price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
#menu .merchant-price-value { display: inline-flex; align-items: center; line-height: 1.2; white-space: nowrap; }
#menu .merchant-reason { color: #ffe1ba; font-family: var(--sans); font-size: 10px; font-weight: 400; line-height: 1.2; letter-spacing: 0; white-space: nowrap; }
body.large-text #menu .merchant-reason { font-size: 11px; }

/* Talent overview: native fixed header, point count and page tabs remain intact. */
#tpList .talent-overview { color: var(--ink); font-family: var(--sans); }
#tpList .talent-overview-note { margin: 0 0 12px; color: #aebbc4; font-size: 11px; line-height: 1.6; }
#tpList .talent-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
#tpList .talent-group { min-width: 0; padding: 13px 13px 0; border: 1px solid #3a4853; border-top: 2px solid var(--talent-accent); border-radius: 8px; background: #182430; }
#tpList .talent-group-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
#tpList .talent-group-icon { display: flex; flex: 0 0 27px; align-items: center; justify-content: center; color: var(--talent-accent); }
#tpList .talent-group-icon svg { width: 25px; height: 25px; }
#tpList .talent-group-heading-copy { min-width: 0; flex: 1; }
#tpList .talent-group h3 { margin: 0; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.4; }
#tpList .talent-role { margin: 2px 0 0; color: #aebbc4; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
#tpList .talent-progress { display: inline-flex; align-items: baseline; gap: 3px; flex: 0 0 auto; color: #a7b4bf; font-size: 11px; font-variant-numeric: tabular-nums; }
#tpList .talent-progress b { color: #d7c196; font-family: var(--serif); font-size: 21px; font-weight: 500; line-height: 1; }
#tpList .talent-contributions { margin-bottom: 10px; }
#tpList .talent-contribution-label { margin: 0 0 5px; color: #a3afb9; font-size: 10px; line-height: 1.4; }
#tpList .talent-contributions ul { display: flex; flex-direction: column; gap: 3px; list-style: none; padding: 0; margin: 0; }
#tpList .talent-contributions li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 6px; padding: 0; font-size: 11px; line-height: 1.5; }
#tpList .talent-contributions li > span { color: #c0cbd2; }
#tpList .talent-contributions li > b { color: #d7c196; font-weight: 500; white-space: nowrap; }
#tpList .talent-unlearned { margin: 0; color: #8999a6; font-size: 11px; line-height: 1.5; }
#tpList .talent-next { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 66px; padding: 10px 11px; border: 1px solid #736683; border-radius: 6px; background: #202d3a; color: var(--ink); text-align: left; font-family: var(--sans); cursor: pointer; transition: background .15s ease, border-color .15s ease; }
#tpList .talent-next-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 3px; }
#tpList .talent-next-label { color: #b9a9ce; font-size: 10px; line-height: 1.3; }
#tpList .talent-next-name { color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.4; }
#tpList .talent-next-description { color: #b9c5ce; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
#tpList .talent-next-cost { display: flex; flex: 0 0 auto; align-items: center; gap: 4px; color: #c8b5de; font-size: 10px; line-height: 1.4; white-space: nowrap; }
#tpList .talent-next-cost > span { display: flex; align-items: center; }
#tpList .talent-next-cost svg { width: 16px; height: 16px; }
#tpList .talent-next:not(:disabled):hover { background: #293848; border-color: #b2a0c7; }
#tpList .talent-next:disabled { background: #17222c; border-color: #3c4650; cursor: default; }
#tpList .talent-next:disabled .talent-next-copy { opacity: .65; }
#tpList .talent-next:disabled .talent-next-cost { color: #95a4ae; }
#tpList .talent-complete { display: flex; align-items: center; gap: 8px; min-height: 49px; padding: 10px 11px; border: 1px solid #4b655a; border-radius: 6px; color: #b5d0bd; background: #1a2a29; font-size: 11px; line-height: 1.5; }
#tpList .talent-complete svg { width: 17px; height: 17px; flex: 0 0 17px; }
#tpList .talent-stages { margin-top: 7px; }
#tpList .talent-stages > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 7px 0 9px; color: #aebbc4; font-size: 11px; line-height: 1.4; list-style: none; cursor: pointer; }
#tpList .talent-stages > summary::-webkit-details-marker { display: none; }
#tpList .talent-detail-chevron { display: flex; color: #98a6b1; transform: rotate(90deg); transition: transform .15s ease; }
#tpList .talent-detail-chevron svg { width: 16px; height: 16px; }
#tpList .talent-stages[open] .talent-detail-chevron { transform: rotate(-90deg); }
#tpList .talent-stages ol { padding: 0; margin: 0; list-style: none; border-top: 1px solid #35434f; }
#tpList .talent-stage { display: flex; align-items: flex-start; gap: 7px; padding: 10px 0; border-bottom: 1px solid #2f3d48; font-size: 11px; line-height: 1.5; }
#tpList .talent-stage:last-child { border-bottom: 0; }
#tpList .talent-stage-number { flex: 0 0 18px; text-align: center; font-size: 10px; color: #94a4b1; font-variant-numeric: tabular-nums; }
#tpList .talent-stage-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
#tpList .talent-stage-name { color: #d2dbe0; font-size: 12px; font-weight: 500; }
#tpList .talent-stage-description { color: #a5b4be; overflow-wrap: anywhere; }
#tpList .talent-stage-state { flex: 0 0 auto; font-size: 10px; color: #93a3b0; white-space: nowrap; }
#tpList .talent-stage.owned .talent-stage-state { color: #a2cbb6; }
#tpList .talent-stage.available .talent-stage-state { color: #c8b5de; }
#tpList .talent-stage.locked .talent-stage-name { color: #a3afb8; }
#tpList .talent-next:focus-visible, #tpList .talent-stages > summary:focus-visible, #tpList .talent-complete:focus-visible { outline: 2px solid #d9c18e; outline-offset: 3px; }
body.large-text #tpList .talent-overview-note, body.large-text #tpList .talent-role, body.large-text #tpList .talent-contributions li, body.large-text #tpList .talent-unlearned, body.large-text #tpList .talent-next-description, body.large-text #tpList .talent-complete, body.large-text #tpList .talent-stages > summary, body.large-text #tpList .talent-stage { font-size: 13px; }
body.large-text #tpList .talent-group h3 { font-size: 16px; }
body.large-text #tpList .talent-next-name { font-size: 15px; }
body.large-text #tpList .talent-stage-name { font-size: 14px; }
body.large-text #tpList .talent-contribution-label, body.large-text #tpList .talent-next-label, body.large-text #tpList .talent-next-cost, body.large-text #tpList .talent-stage-state { font-size: 11px; }
body.large-text #tpList .talent-next { min-height: 76px; }
@media (max-width: 767px) {
  #tpList .talent-groups { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #tpList .talent-group { padding: 12px 12px 0; }
}
@media (prefers-reduced-motion: reduce) {
  #tpList .talent-next, #tpList .talent-detail-chevron { transition: none; }
}

/* Keep the document anchored while its existing inner panes remain scrollable. */
html { overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; overscroll-behavior: none; }
#menu, #log, #sceneZone, #tpList, #ipList, #journalHistory,
.ip-card, .tp-card, .ux-dialog { overscroll-behavior: none !important; touch-action: pan-y pinch-zoom; }
#playerStatus #shieldTxt.status-list,
.enemy .enemy-hp-head .enemy-status { touch-action: pan-x pinch-zoom; }

/* Incantation uses the shared dialog and the same action-card layout. */
.incant-target-list{display:grid;gap:10px;margin-top:18px}
.incant-target-list .skill{width:100%;margin:0;text-align:left}
.incant-target-list .sdesc{color:var(--gold)}
