/* V43: predictable reading order, real gaps and comfortable touch targets. */
dialog,dialog :where(button,select,input,textarea){box-sizing:border-box}
dialog :where(button,select){font:inherit;white-space:normal;min-width:0}
dialog :where(h2,h3,h4,p,small,label,strong){overflow-wrap:anywhere}
dialog :where(p){line-height:1.55}
dialog :where(label>select,label>input:not([type=checkbox]):not([type=radio]),label>textarea){display:block;width:100%;max-width:100%;margin-top:6px}
dialog :where(select,input:not([type=checkbox]):not([type=radio]):not([type=range]),textarea){min-height:44px}
dialog :where(.dialog-head){gap:12px;align-items:start;margin-bottom:16px}
dialog :where(.dialog-head h2){margin:0;line-height:1.2}
dialog :where(.dialog-head .close){flex:none}
#battleDialog .rpg-powers{display:flex;flex-direction:column;gap:10px}
#battleDialog .battle-power-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-items:stretch;grid-auto-rows:1fr}
#battleDialog .battle-power-grid button{margin:0;min-height:52px;justify-content:center;line-height:1.35;padding:9px 10px}
#battleDialog .battle-power-grid button small{display:none}
#battleDialog .battle-power-grid strong{line-height:1.35;word-break:normal}
#battleDialog .battle-power-info{margin:0;padding:10px 12px;flex:none}
#battleDialog .battle-power-info summary{padding:3px 0;min-height:28px;line-height:1.4}
#battleDialog .battle-power-descriptions{display:grid;gap:10px;padding-top:10px}
#battleDialog .battle-power-descriptions p{margin:0;padding-top:8px;border-top:1px solid #78658555;font-size:12px;line-height:1.5;text-align:left}
#battleDialog #battleBack{min-height:44px;flex-direction:row;align-items:center;justify-content:center;gap:8px;margin:0}
#battleDialog #battleBack small{display:block}
#battleDialog .rpg-commands,#battleDialog .battle-item-grid{margin-top:10px;gap:8px;align-items:stretch}
#battleDialog .rpg-commands button{margin:0;justify-content:center}
#battleDialog .battle-items>.battle-item-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
#battleDialog .battle-item-grid button{margin:0;min-height:76px;justify-content:flex-start}
#battleDialog .battle-items>button,#battleDialog .battle-gear>button{display:block;width:100%;margin-top:12px;min-height:44px}
#battleDialog .battle-rules{margin-top:12px}
#battleDialog .battle-return{flex-wrap:wrap;line-height:1.4}
#npcDialog #npcPortrait{float:none;display:block;width:min(160px,48vw);height:160px;object-fit:contain;margin:0 auto 14px}
#npcDialog #npcSpeech{margin:0 0 14px;text-align:left;line-height:1.6}
#npcDialog #npcMission{margin:0 0 14px;padding:12px 14px;border:1px solid #766482;border-left:3px solid #b8f1cf;border-radius:12px;background:#272236;line-height:1.55}
#npcDialog>button{display:block;width:100%;min-height:46px;margin:10px 0 0}
#chronicleContent,#caveContent,#labContent{display:flow-root}
.chronicle-card,.activity-card{display:flow-root;margin:14px 0;padding:14px}
.chronicle-card>p,.activity-card>p{margin:8px 0 12px;line-height:1.55}
.chronicle-card>button,.activity-card>button{display:block;width:100%;min-height:44px;margin:8px 0 0}
.chronicle-card>select{width:100%;margin-top:12px}
.chronicle-portrait{margin:0 0 10px 14px}
.skill-choice{gap:12px;padding:14px;line-height:1.4}
.skill-choice input{margin-top:2px}
.skill-choice small{margin-top:8px;line-height:1.55}
.dungeon-tabs{gap:8px;margin:10px 0 16px}
.dungeon-tabs button{margin:0;line-height:1.4}
.dungeon-tabs small{display:block;margin-top:4px}
.dungeon-return43{width:100%;min-height:46px;margin:16px 0 0;padding:10px 14px;border:1px solid #977ba8;background:#393049;color:#f2e5cf}
.dungeon-return43 small{display:block;font-size:11px;margin-top:4px;line-height:1.4;color:#cfc1dc}
.market-grid{gap:14px;align-items:stretch}
.market-card{gap:10px}
.market-card>button{margin:0;line-height:1.4}
.market-card>h3,.market-card>p{margin:0}
.ranking-table{width:100%;border-collapse:collapse;table-layout:fixed;margin:16px 0}
.ranking-table th,.ranking-table td{padding:12px 8px;border-bottom:1px solid #77648a55;text-align:left;vertical-align:middle}
.ranking-table :is(th,td):first-child{width:38px;white-space:nowrap;overflow-wrap:normal;font-variant-numeric:tabular-nums}
.ranking-table :is(th,td):last-child{width:88px;text-align:right;white-space:nowrap;overflow-wrap:normal;font-variant-numeric:tabular-nums}
.ranking-table :is(th,td):nth-child(2){overflow-wrap:anywhere}
#leaderboardDialog>label{display:block;margin:14px 0}
#leaderboardDialog>button{display:block;width:100%;margin:10px 0 0;min-height:44px}
#arcadeDialog .arcade-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0}
#arcadeDialog .arcade-controls button{min-height:44px;margin:0;font-size:13px;line-height:1.4;padding:10px}
#arcadeHelp,#arcadeStatus{font-size:13px;line-height:1.5;margin:12px 0}
.map40-tools{display:flex;align-items:center;gap:8px;flex:none;min-width:0;margin:2px 0 4px}
#mapDialog.map40 .map40-route{flex:1;min-width:0;margin:0;gap:6px}
#mapDialog.map40 .map40-route select{margin:0;min-height:36px}
#map40-recall{flex:none;min-height:40px;padding:6px 9px;font-size:12px;border-color:#9e85b2;background:#3c3350;color:#f8e9cf;line-height:1.3}
#mapDialog.map40 #map40-info{line-height:1.5;margin:3px 0}
#mapDialog.map40 #map40-guide{line-height:1.4;margin-bottom:3px}
#mapDialog.map40 .map40-controls{padding:6px 6px 4px}
#mapDialog>#toast{bottom:calc(130px + env(safe-area-inset-bottom));max-height:80px;max-width:min(85vw,330px);padding:9px 12px;font-size:12px;line-height:1.5;pointer-events:none}
#mapDialog>.acquisition-toast{bottom:calc(216px + env(safe-area-inset-bottom));max-height:25dvh;width:min(290px,calc(100vw - 36px));padding:10px!important}
.music-now-playing{display:block;font-size:12px;line-height:1.5;margin:10px 0;color:#d6c1e4}
.battle-intro43{position:absolute;inset:0;z-index:9;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:9px;pointer-events:none;overflow:hidden;background:radial-gradient(ellipse,#3d3044ed,#111b27f2);color:#fae8c5;animation:battle-intro-fade43 1.15s ease-in-out both}
.battle-intro43::before,.battle-intro43::after{content:"";position:absolute;width:160%;height:70%;left:-30%;top:40%;background:radial-gradient(ellipse,#adacc54a,transparent 63%);filter:blur(12px);animation:battle-intro-mist43 1.1s ease-out both}
.battle-intro43::after{top:-20%;animation-direction:reverse;background:radial-gradient(ellipse,#b48cd23a,transparent 63%)}
.battle-intro43 strong{z-index:1;font:700 clamp(18px,5vw,27px) Georgia,serif;text-align:center;padding:0 18px;line-height:1.3}
.battle-intro43 small{z-index:1;color:#dcc6e4;font-size:12px}
.battle-intro-moon{font-size:42px;color:#eacb8e;text-shadow:0 0 25px #f0ca9566;z-index:1}
.battle-intro-active .rpg-player{animation:battle-arrival-player43 1s ease-out both}
.battle-intro-active .rpg-opponent{animation:battle-arrival-enemy43 1s ease-out both}
@keyframes battle-intro-fade43{0%,45%{opacity:1}100%{opacity:0}}
@keyframes battle-intro-mist43{from{transform:translateX(-25%) translateY(15%);opacity:.4}to{transform:translateX(25%) translateY(-10%);opacity:0}}
@keyframes battle-arrival-player43{from{transform:translate(-50px,15px);opacity:0}65%,to{transform:translate(0,0);opacity:1}}
@keyframes battle-arrival-enemy43{from{transform:translate(50px,-15px);opacity:0}65%,to{transform:translate(0,0);opacity:1}}
@media(prefers-reduced-motion:reduce){.battle-intro43,.battle-intro-active .fighter{animation:none!important}}
@media(max-width:360px){#mapDialog.map40 .map40-route>span{display:none}.ranking-table :is(th,td):last-child{width:76px}.chronicle-card,.activity-card{padding:12px}#battleDialog .battle-power-grid strong{font-size:12px}}
@media(max-height:600px){#battleDialog .rpg-arena{min-height:170px;height:170px}#battleDialog .battle-hud{padding:6px 8px}#mapDialog.map40 #map40-guide{max-height:18px}}
