/* Dedicated portrait UI. Shared styles are only the map/art/effects foundation. */
html,body{min-width:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none}
body{--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px);font-size:14px;padding:0 env(safe-area-inset-right,0px) 0 env(safe-area-inset-left,0px);height:100vh;height:100dvh}
button{min-height:44px;touch-action:manipulation;font-size:14px}button:disabled{opacity:.4}
#roster-class-tooltip{display:none!important}
.topbar{height:calc(52px + var(--safe-top));padding:var(--safe-top) 116px 0 12px;gap:8px}.topbar .brand,.topbar .chapter,.topbar .mode,.audio-settings{display:none}.phase-indicator{margin:0;padding:0;border:0;display:flex;align-items:center;gap:10px}.phase-indicator strong{font-size:12px}.phase-indicator span{font-size:11px}
#scene-host{height:calc(100vh - 52px - var(--safe-top));height:calc(100dvh - 52px - var(--safe-top))}#scene-host>.workspace{height:100%;display:flex;flex-direction:column;position:relative}.character-panel,.map-heading,.map-caption{display:none!important}
.map-panel{position:static;flex:1;min-height:0;padding:0;display:flex;flex-direction:column}.map-viewport{width:100%;flex:1;min-height:150px;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}.map-viewport *{touch-action:none}.map-viewport img{pointer-events:none;-webkit-user-drag:none}.map-frame{position:absolute;left:0;top:0;transform-origin:0 0}
.map-turn-end{position:fixed;top:calc(4px + var(--safe-top));right:calc(8px + env(safe-area-inset-right,0px));height:44px;min-width:100px;padding:0 10px;z-index:25;font-size:13px}
.combat-log{height:66px;min-height:66px;padding:4px 10px;gap:0;flex-shrink:0}.message-line{font-size:13px;min-height:19px;line-height:19px}
.mobile-summary{height:148px;min-height:148px;display:grid;grid-template-columns:112px minmax(0,1fr);background:#eee3cb;color:#403b2f;border-bottom:1px solid #9e8756;overflow:hidden}
.mobile-bust{position:relative;overflow:hidden;height:148px;background:radial-gradient(#e6d8b6,#d6c49d)}.mobile-bust img{width:100%;height:100%;object-fit:contain;object-position:50% 0;transform:translate(var(--bust-x,0%),var(--bust-y,0%)) scale(var(--bust-scale,2.4));transform-origin:50% 0;display:block}
.summary-info{min-width:0;padding:8px 10px;position:relative}.summary-info h2{font-size:22px;line-height:27px;margin:0 0 2px;letter-spacing:.04em;padding-right:55px}.summary-class{font-size:13px;margin:0 0 5px}.summary-hp{display:flex;align-items:center;gap:8px;font-size:13px}.summary-hp meter{height:8px;flex:1;min-width:25px}.summary-stats{display:grid;grid-template-columns:repeat(2,1fr);gap:4px 12px;margin:6px 0 0;font-size:14px}.summary-stats div{display:flex;justify-content:space-between}.summary-stats dd{margin:0;font-weight:bold}.detail-open{position:absolute;top:5px;right:7px;min-width:48px;padding:0 7px;background:#ddd0af;border:1px solid #ad9565;color:#4c432f}.summary-effects{font-size:11px;margin-top:4px;color:#715625}
.mobile-roster{flex-shrink:0;height:76px;background:#1e3027;padding:3px 8px;overflow:hidden}.mobile-roster>span{font-size:10px;letter-spacing:.08em;color:#c2bc9a;display:block;height:15px}.mobile-roster .party{display:flex;justify-content:flex-start;gap:5px;overflow-x:auto;overscroll-behavior:contain;touch-action:pan-x;scrollbar-width:thin;padding:0 0 3px;border:0}.mobile-roster .party-member{position:relative;flex:0 0 48px;min-width:48px;height:48px;overflow:hidden;background:#d3c09b;border:1px solid #8a7956}.mobile-roster .party-sprite{width:100%;height:100%;object-fit:cover;object-position:var(--roster-position);transform:scale(var(--roster-scale));transform-origin:var(--roster-position);image-rendering:auto}.mobile-roster .party-member[aria-pressed=true]{border:2px solid #ffe0a0;box-shadow:inset 0 0 0 1px #765623}.mobile-roster .party-member[data-roster-state=defeated]{filter:brightness(.4) grayscale(1);opacity:.8}.mobile-roster .party-member.has-acted{filter:grayscale(1);opacity:.6}.mobile-roster .party-member.has-moved:not(.has-acted){border-bottom:4px solid #b08d45}
.mobile-actions{flex-shrink:0;background:#24392f;border-top:1px solid #a7976555;padding:6px 8px calc(6px + var(--safe-bottom));max-height:230px;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y}
#action-popup,#skill-inspector{position:static!important;left:auto!important;top:auto!important;visibility:visible!important;width:100%!important;max-height:none!important;border:0;border-radius:0;box-shadow:none;background:transparent;padding:0;overflow:visible;pointer-events:auto}
#action-popup>.eyebrow{font-size:12px;line-height:18px;margin:0 0 5px;letter-spacing:0}#action-popup .commands{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}#action-popup .commands button{height:44px;min-width:0;padding:0 4px;justify-content:center;font-size:14px;gap:3px}#action-popup .commands button span:first-child{font-size:12px}#action-popup #cancel-command{grid-column:1/-1;height:44px}
#action-popup[data-mode=attack] .commands,#action-popup[data-mode=skillTarget] .commands{display:block}#action-popup[data-mode=attack] #cancel-command,#action-popup[data-mode=skillTarget] #cancel-command{width:100%}.mobile-actions[data-mode=skill] #attack-command,.mobile-actions[data-mode=skill] #skill-command,.mobile-actions[data-mode=skill] #wait-command,.mobile-actions[data-mode=skill] #item-command{display:none!important}.mobile-actions[data-mode=skill] #action-popup>.eyebrow{display:none}
#skill-menu{display:flex;flex-direction:row;gap:5px;padding:0 0 5px;margin:0;overflow-x:auto;border:0}#skill-menu button{min-width:115px;flex:1;padding:7px;min-height:44px}#skill-menu small{display:none}#skill-menu button[data-inspected=true]{border-color:#ebd08d;background:#9c8c4b44}#skill-details{padding:6px 0!important;font-size:12px;margin:0!important;border-top:1px solid #acac7355!important;display:grid;grid-template-columns:110px 1fr;gap:8px}#skill-details>div+div{border:0!important;margin:0!important;padding:0!important}#skill-details h3{font-size:15px;margin:2px 0}#skill-details .eyebrow{display:none}#skill-detail-effect,#skill-detail-formula{margin:2px 0;line-height:18px}#skill-detail-description{display:none!important}
.mobile-target-info{font-size:12px;line-height:18px;margin-bottom:5px}.item-notice{font-size:13px;margin:4px 0}
.mobile-modal{position:fixed;inset:0;z-index:80;background:#0e1d19b8;display:flex;align-items:center;justify-content:center;padding:16px 12px calc(16px + var(--safe-bottom));padding-top:calc(16px + var(--safe-top))}
.detail-card{width:min(100%,440px);max-height:100%;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;background:#efe4cf;color:#403c31;border:1px solid #b9a272;border-radius:8px;padding:0 14px 14px;box-shadow:0 12px 40px #0008}.detail-card header{position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;gap:10px;background:#efe4cf;z-index:2;padding:12px 0 8px;border-bottom:1px solid #ab997466}.detail-card h2{font-size:24px}.detail-card header p{font-size:12px;margin:4px 0 0}.detail-close{min-width:64px;border:1px solid #a18a5f;background:#dac8a1;color:#443b29;border-radius:4px}.detail-fullbody{height:310px;position:relative;overflow:hidden;background:radial-gradient(ellipse,#d9c69b55,transparent 70%)}.detail-fullbody img{width:100%;height:100%;object-fit:contain;transform:translate(var(--body-x,0%),var(--body-y,0%)) scale(var(--body-scale,1));transform-origin:50% 100%}.detail-card h3{font-size:13px;letter-spacing:.1em;border-bottom:1px solid #bca98155;padding-bottom:5px;margin:16px 0 8px}.detail-stats{display:grid;grid-template-columns:1fr 1fr;gap:0 18px;margin:10px 0}.detail-stats div{display:flex;justify-content:space-between;min-height:29px;border-bottom:1px solid #baa78044;align-items:center}.detail-stats dd{margin:0;font-weight:bold}.detail-profile{white-space:pre-line;font-size:14px;line-height:1.8;margin:0}.detail-skills{list-style:none;padding:0;margin:0}.detail-skills li{margin-bottom:10px;font-size:13px;line-height:1.6}.detail-skills strong{display:block;font-size:14px}.detail-effects{font-size:13px;line-height:1.7}.detail-card footer{text-align:center;margin-top:15px}
.mobile-start{position:fixed;inset:0;z-index:100;display:grid;place-content:center;text-align:center;background:#162820f5;padding:24px}.mobile-start h2{color:#f1dfb7;font-size:28px}.mobile-start p{font-size:14px;line-height:1.8}.mobile-start button{min-height:52px;border:1px solid #bda36a;background:#3b5240;color:#f3e4c3;border-radius:4px;font-size:18px}
.village-scene{display:flex;flex-direction:column;height:100%;overflow-y:auto;touch-action:pan-y}.village-landscape{flex:none;min-height:340px;padding:12px}.village-sidebar{flex:none;padding:16px}.village-heading{top:16px;left:20px}.village-heading h1{font-size:25px}.village-party{margin-top:10px}.facility-link{min-height:44px}.dialogue-window{left:12px;right:12px;bottom:calc(12px + var(--safe-bottom));padding:16px;min-height:0;max-height:65dvh;overflow:auto}.dialogue-text{font-size:14px}.dialogue-next{min-height:44px;min-width:88px}.village-member img{height:130px}
@media(max-height:740px){.mobile-summary{height:132px;min-height:132px}.mobile-bust{height:132px}.summary-info{padding:5px 8px}.summary-info h2{font-size:20px}.summary-stats{gap:2px 10px;margin-top:4px}.summary-class{margin-bottom:3px}.mobile-actions{max-height:210px}}
@media(orientation:landscape) and (max-height:550px){.mobile-summary{height:112px;min-height:112px;grid-template-columns:100px 1fr}.mobile-bust{height:112px}.summary-stats{grid-template-columns:repeat(4,1fr)}.mobile-roster{height:60px}.mobile-roster>span{display:none}.mobile-actions{max-height:160px}#action-popup .commands{grid-template-columns:repeat(5,1fr)}#action-popup #cancel-command{grid-column:auto}.combat-log{height:48px;min-height:48px}.message-line{font-size:12px;line-height:13px;min-height:13px}.map-viewport{min-height:100px}}
.mobile-actions[data-restricted="true"] button:disabled{background:#474c49!important;color:#a8ada9!important;border-color:#68706a!important;opacity:.65;cursor:default}
#portrait-gate{position:fixed;inset:0;z-index:2147483647;display:grid;place-items:center;background:#12231f;color:#f5e7c6;padding:24px env(safe-area-inset-right,0px) 24px env(safe-area-inset-left,0px);text-align:center;touch-action:none;overscroll-behavior:none;font-family:inherit}
#portrait-gate[hidden]{display:none!important}.portrait-gate-card{padding:0 24px}.portrait-gate-card svg{width:76px;height:76px;color:#d5b96b}.portrait-gate-card h1{font-size:clamp(18px,4vw,24px);margin:6px 0 12px}.portrait-gate-card p{font-size:16px;margin:0 0 12px}.portrait-gate-card small{font-size:13px;line-height:1.6}.portrait-paused{overflow:hidden!important}
