*{box-sizing:border-box}body{margin:0}button,input,select{font:inherit}button,input,select{border:1px solid var(--gold-dark);background:var(--hi);color:var(--ink);border-radius:.45rem}button{cursor:pointer}button:hover,button:focus-visible{border-color:var(--accent);background:var(--gold-dark)}button:disabled{opacity:.5;cursor:not-allowed}a{color:var(--accent)}h1,h2,h3,p{margin:.3em 0}.fan-game{background:var(--bg)}.fan-game canvas{image-rendering:pixelated}.game-hud{position:absolute;inset:.55rem .55rem auto;display:grid;gap:.35rem;pointer-events:none}.game-hud>*{pointer-events:auto}.hud-main,.hud-status,.hud-notice{background:color-mix(in srgb,var(--bg) 92%,transparent);border:1px solid var(--line);border-radius:.5rem;padding:.45rem .65rem;box-shadow:0 2px 10px #0008}.hud-main{display:flex;align-items:center;justify-content:space-between;gap:.75rem;max-width:34rem}.hud-main strong,.hud-main span{display:block}.hud-main span,.subtle{font-size:.8rem;color:var(--muted)}.hud-main button{min-width:44px;padding:.2rem}.hud-status{display:flex;align-items:center;gap:.5rem;width:max-content;max-width:100%;font-size:.8rem}.vita{width:90px;height:.5rem;background:var(--line);border-radius:1rem;overflow:hidden}.vita span{display:block;width:100%;height:100%;background:var(--accent)}.hud-notice:empty{display:none}.world-actions{position:absolute;right:.75rem;bottom:max(.75rem,env(safe-area-inset-bottom));display:flex;gap:.4rem}.joystick{position:absolute;left:1rem;bottom:max(1rem,env(safe-area-inset-bottom));width:104px;height:104px;border:1px solid color-mix(in srgb,var(--accent) 55%,transparent);border-radius:50%;background:color-mix(in srgb,var(--bg) 70%,transparent);touch-action:none}.joystick span{position:absolute;inset:32px;border-radius:50%;background:color-mix(in srgb,var(--accent) 58%,transparent);pointer-events:none}.lobby{position:absolute;inset:0;overflow:auto;display:grid;place-items:center;padding:1rem;background:linear-gradient(90deg,color-mix(in srgb,var(--bg) 97%,transparent),color-mix(in srgb,var(--bg) 80%,transparent)),url('assets/cover.webp') center/cover}.lobby-card{width:min(100%,34rem);padding:1.2rem;border:1px solid var(--line);border-radius:.8rem;background:color-mix(in srgb,var(--panel) 94%,transparent);box-shadow:0 1rem 3rem #0008}.logo{max-width:min(16rem,70%);max-height:7rem;object-fit:contain}.lobby-actions,.row,.actions{display:flex;gap:.4rem;flex-wrap:wrap;align-items:center}.journey,.entry,.profile-card{padding:.65rem;border:1px solid var(--line);border-radius:.45rem;background:var(--hi);margin:.4rem 0}.game-dialog{width:min(46rem,calc(100vw - 1rem));max-height:calc(100dvh - 1rem);padding:0;background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:.65rem;box-shadow:0 1rem 4rem #000b}.game-dialog::backdrop{background:#05090fc9}.game-dialog>header{position:sticky;top:0;z-index:2;display:flex;gap:.5rem;align-items:center;padding:.4rem;background:var(--hi);border-bottom:1px solid var(--line)}.game-dialog>header h2{flex:1;font-size:1.1rem}.game-dialog>header button{min-width:44px}.panel-body{padding:.75rem;overflow-wrap:anywhere}.panel-body label{display:grid;gap:.25rem;margin:.55rem 0}.panel-body input,.panel-body select{padding:.55rem;max-width:100%}.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(145px,1fr));gap:.45rem}.grid .entry{margin:0}.portrait{width:72px;height:72px;object-fit:contain;image-rendering:pixelated;background:var(--bg);border-radius:.35rem}.portrait.large{width:110px;height:110px}.star{color:var(--accent)}.battle{position:absolute;inset:0;display:flex;flex-direction:column;gap:.4rem;padding:.6rem;background:linear-gradient(color-mix(in srgb,var(--bg) 85%,transparent),color-mix(in srgb,var(--bg) 96%,transparent))}.battle[hidden],.lobby[hidden],.world-actions[hidden],.game-hud[hidden]{display:none}.battle-top h2{font-size:1rem}.battle-portraits{display:flex;justify-content:space-around;gap:.5rem;flex:1;min-height:0}.battle-portraits>div{width:45%;display:grid;place-content:center;text-align:center}.battle-portraits img{max-height:32dvh;width:auto;max-width:100%;object-fit:contain;image-rendering:pixelated}.battle-log{max-height:18dvh;overflow:auto;background:var(--bg);border:1px solid var(--line);padding:.5rem;border-radius:.4rem}.battle-controls{display:flex;flex-wrap:wrap;gap:.3rem}.battle-controls button{flex:1 1 110px}.toast{position:absolute;bottom:6rem;left:50%;transform:translateX(-50%);background:var(--accent);color:var(--bg);padding:.55rem .8rem;border-radius:.4rem;max-width:90%;z-index:20}.muted{color:var(--muted)}.panel-body button{margin:.1rem}.badge{font-size:.75rem;color:var(--muted)}.form-actions{display:flex;gap:.4rem;flex-wrap:wrap;margin-top:.7rem}@media (pointer:fine){.joystick{opacity:.45}}@media(max-width:500px){.hud-main{max-width:100%}.hud-main span{font-size:.72rem}.hud-status{font-size:.73rem}.world-actions{bottom:1rem}.lobby-card{padding:.8rem}.game-dialog{width:calc(100vw - .5rem);max-height:calc(100dvh - .5rem)}.grid{grid-template-columns:repeat(2,minmax(0,1fr))}.battle-controls button{flex-basis:30%;font-size:.82rem}.joystick{width:88px;height:88px}.joystick span{inset:27px}}

.hud-status{flex-wrap:wrap}.hud-status #run-text{white-space:normal}.unavailable{display:grid;place-items:center;color:var(--muted);font-size:1.4rem}.panel-body dl{display:grid;grid-template-columns:max-content 1fr;gap:.2rem .7rem}.panel-body dd{margin:0}.battle-controls details{flex:1 1 100%}@media(max-width:500px){.world-actions{max-width:calc(100% - 115px);flex-wrap:wrap;justify-content:flex-end}.world-actions button{font-size:.75rem;padding:.3rem .45rem}}

.profile-heading{display:flex;align-items:center;gap:.8rem;min-width:0}.profile-appearance{flex:0 0 120px;margin:0;padding:.4rem;text-align:center;background:var(--bg);border:1px solid var(--line);border-radius:.45rem}.profile-appearance canvas{display:block;width:100%;height:110px;object-fit:contain;image-rendering:pixelated}.profile-appearance figcaption,.profile-appearance-missing{display:block;color:var(--muted);font-size:.75rem}.profile-appearance-missing[hidden]{display:none}

.story-scene{display:block;width:100%;max-height:min(32dvh,15rem);object-fit:cover;border-radius:.45rem;margin-bottom:.65rem}.hunt-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:.4rem;margin:.5rem 0}.hunt-cards .entry{margin:0}.hunt-cards p{margin:.2rem 0}

.battle-intent{padding:.35rem .5rem;background:var(--hi);border:1px solid var(--line);border-radius:.4rem;font-size:.82rem}.battle-intent:empty{display:none}.atlas-region{margin:.4rem 0}.atlas-region>summary,.panel-body details>summary{cursor:pointer;padding:.45rem;background:var(--hi);border-radius:.35rem}.atlas-region .grid{margin:.45rem 0}
.game-hud{grid-template-columns:minmax(0,1fr);min-width:0}.hud-main,.hud-status{min-width:0;max-width:100%}.hud-main{max-width:min(34rem,100%)}.hud-main>div,#active-name{min-width:0;overflow-wrap:anywhere}.hud-status #run-text:not(:empty){flex:1 0 100%;min-width:0;overflow-wrap:anywhere}
.journey .actions{align-items:center}.journey .save-more{margin:0}
@media(max-width:600px){.lobby-card{padding:14px}.lobby-card .logo{max-height:72px;width:auto;max-width:100%;object-fit:contain}.lobby-card h1{margin:6px 0}.lobby-card>p{margin:4px 0}.journey{padding:9px}.journey .actions{margin-top:5px}}
.dex-toolbar{display:flex;align-items:end;gap:8px}.dex-toolbar>label{flex:1;min-width:0}.dex-toolbar>label input{width:100%;min-height:44px}.dex-toolbar details{position:relative;flex:none}.dex-toolbar details>summary{min-height:44px;display:flex;align-items:center;padding:8px 12px;border:1px solid var(--gold-dark);border-radius:6px;background:var(--hi);cursor:pointer}.dex-toolbar details[open]>.row{position:absolute;right:0;z-index:5;width:min(500px,calc(100vw - 48px));display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:10px;background:var(--panel);border:1px solid var(--gold-dark);border-radius:6px;box-shadow:0 10px 24px #000b}.dex-toolbar select{width:100%;min-height:44px}.actions[hidden]{display:none}
@media(max-width:600px){.lobby-card h1{font-size:1.2rem;line-height:1.2}.lobby-card .logo{max-height:52px}.lobby-card>p{font-size:.85rem}}
.battle{background:var(--bg);overflow-y:auto;overscroll-behavior:contain}.battle-portraits{min-height:135px}.battle-portraits>div{min-width:0;gap:.2rem;justify-items:center;overflow-wrap:anywhere}.battle-vita{width:min(100%,150px);height:.55rem;overflow:hidden;border:1px solid var(--gold-dark);border-radius:1rem;background:var(--line)}.battle-vita>span{display:block;height:100%;background:var(--accent)}.battle-status{color:var(--accent);font-size:.8rem}.battle-controls details{min-width:0}.battle-controls summary{min-height:40px;display:flex;align-items:center;cursor:pointer}.battle-move-guide{margin:.35rem 0;padding-left:1.25rem;font-size:.85rem}.battle-move-guide li+li{margin-top:.4rem}.empty-state{grid-column:1/-1}.dex-toolbar>button{min-height:44px}
.battle-controls details>summary::before{content:'▸';margin-right:.4rem}.battle-controls details[open]>summary::before{content:'▾'}
/* Keep game controls above the shared action dock. */
.hud-shortcuts.fg-dock>button{flex:1 0 44px;min-width:44px;padding:.25rem .1rem;font-size:clamp(.6rem,2.5vw,.75rem)}.joystick,.world-actions{bottom:calc(4.1rem + env(safe-area-inset-bottom))}@media(max-width:500px){.joystick,.world-actions{bottom:calc(3.9rem + env(safe-area-inset-bottom))}}@media(max-height:480px) and (orientation:landscape){.joystick,.world-actions{bottom:calc(3.7rem + env(safe-area-inset-bottom))}}
