/* Scale text alone; photographed routes and canvas geometry stay unchanged. */
:root { --ui-scale: 1; }
dialog { touch-action: pan-y; overscroll-behavior: contain; }
.battle-review,.inventory-dialog {
    position:fixed; inset:0; margin:auto; width:min(680px,calc(100vw - 24px)); height:fit-content;
    max-height:calc(100dvh - 24px); padding:20px; overflow-y:auto; color:var(--paper,#eff5eb);
    background:var(--ink,#071b29); border:2px solid var(--sea,#8ed9cc); border-radius:12px;
    font-family:inherit; font-size:calc(16px * var(--ui-scale)); line-height:1.65;
}
.battle-review::backdrop,.inventory-dialog::backdrop { background:#061723bb; }
.battle-review h2,.inventory-dialog h2 { font-size:calc(20px * var(--ui-scale)); margin:0 0 14px; }
.battle-review h3,.inventory-dialog h3 { font-size:calc(17px * var(--ui-scale)); margin:8px 0; color:var(--gold,#efd49b); }
.battle-review p,.inventory-dialog p { margin:8px 0; overflow-wrap:anywhere; }
.battle-result-text { white-space:pre-line; }
.battle-turn-record,.inventory-row { margin:10px 0; padding:10px 0; border-top:1px solid var(--line,#597c86); }
.battle-review ul { padding-left:1.5em; }
.battle-review summary { cursor:pointer; min-height:44px; padding:8px 0; }
.battle-review-close,.inventory-action,.inventory-retry,.inventory-close {
    min-height:44px; padding:9px 14px; margin:6px 6px 0 0; border:1px solid var(--sea,#8ed9cc);
    border-radius:6px; background:var(--panel,#143444); color:var(--paper,#eff5eb); font:inherit;
}
.battle-review-close { display:block; margin-left:auto; }
.inventory-header { position:sticky; top:-20px; background:var(--ink,#071b29); padding:8px 0; display:flex; justify-content:space-between; gap:12px; z-index:1; }
.inventory-list { list-style:none; }
.inventory-equipped-row { border-color:var(--gold,#efd49b); }
.inventory-name { font-weight:bold; color:var(--gold,#efd49b); }
.inventory-status { color:var(--sea,#8ed9cc); }
.shop-save-warning { grid-column:1/-1; padding:12px; border:1px solid var(--gold); background:var(--panel); line-height:1.65; overflow-wrap:anywhere; }
.shop-save-warning p { margin:0 0 8px; }
.shop-save-retry { min-height:44px; padding:8px 12px; background:var(--ink); color:var(--paper); border:1px solid var(--sea); font:inherit; }
.inventory-btn { white-space:nowrap; }
.community-activity.community-activity,.restoration-episode.restoration-episode,.memory-exhibition.memory-exhibition { font-size:calc(16px * var(--ui-scale)); font-family:inherit; }
.community-activity.community-activity h2,.restoration-episode.restoration-episode h2,.memory-exhibition.memory-exhibition h2 { font-size:calc(20px * var(--ui-scale)); }
.community-activity.community-activity h3,.restoration-episode.restoration-episode h3,.memory-exhibition.memory-exhibition h3 { font-size:calc(18px * var(--ui-scale)); }
.community-activity.community-activity .activity-progress,.community-activity.community-activity .activity-note,.community-activity.community-activity .activity-map button,.restoration-episode.restoration-episode .ep-cards small,.restoration-episode.restoration-episode .ep-note,.memory-exhibition.memory-exhibition .memory-card span,.memory-exhibition.memory-exhibition .memory-evidence,.memory-exhibition.memory-exhibition .memory-note { font-size:calc(14px * var(--ui-scale)); }
.festival-opening,.microphone-rehearsal { color:var(--paper);background:var(--ink);border:2px solid var(--sea);border-radius:10px;padding:18px;overflow:auto;touch-action:pan-y;font-family:inherit;font-size:calc(16px * var(--ui-scale));line-height:1.65; }
.festival-opening { position:fixed;inset:0;margin:auto;width:min(760px,calc(100vw - 24px));height:fit-content;max-height:calc(100dvh - 24px); }
.festival-opening::backdrop { background:#061723bb; }
.festival-opening h2,.microphone-rehearsal h2 { font-size:calc(20px * var(--ui-scale));margin:0 0 10px;color:var(--gold); }
.festival-opening h3 { font-size:calc(17px * var(--ui-scale));color:var(--sea); }
.festival-opening-cast { display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:12px 0; }
.festival-opening-person img { width:64px;height:64px;object-fit:contain;image-rendering:pixelated;float:left;margin:0 10px 5px 0; }
.festival-opening-person p { clear:both; }
.festival-opening-controls,.microphone-controls { display:flex;flex-wrap:wrap;gap:8px;margin:12px 0; }
.festival-opening button,.microphone-rehearsal button { flex-shrink:0;min-height:44px;padding:8px 12px;border:1px solid var(--sea);border-radius:5px;font:inherit;background:var(--panel);color:var(--paper); }
.festival-opening-note,.microphone-note { font-size:calc(14px * var(--ui-scale));color:#bdd8d5; }
.festival-opening-progress { color:var(--gold); }
.microphone-rehearsal { position:fixed;left:auto;right:8px;top:8px;bottom:auto;margin:0;width:min(36vw,380px);height:fit-content;max-height:calc(100dvh - 16px);z-index:200; }
.microphone-controls { display:grid;grid-template-columns:1fr; }
.microphone-feedback { padding:8px;border-left:3px solid var(--gold);background:var(--panel); }
@media(orientation:portrait) { .microphone-rehearsal { left:8px;right:8px;top:auto;bottom:8px;width:auto;max-height:42dvh; } .festival-opening-cast { grid-template-columns:1fr; } }
.narrative-panel { max-height:calc(100dvh - 64px); overflow-y:auto; touch-action:pan-y; overscroll-behavior:contain; }
.story-card,.waterfront-lookout { font-size:calc(16px * var(--ui-scale)); }
.memory-walk { font-size:calc(14px * var(--ui-scale)); }
.level-receipt { font-size:calc(14px * var(--ui-scale)); }
.learning-help { font-size:calc(16px * var(--ui-scale)); }
.battle-choice-panel>button,.battle-choice-panel>h2 { flex-shrink:0; height:auto; }
.battle-choice-panel .battle-skill-label { min-width:0; overflow-wrap:anywhere; line-height:1.6; }
.battle-choice-panel { touch-action:pan-y; overscroll-behavior:contain; }
.settings-hint { font-size:calc(14px * var(--ui-scale)); }
.experience-meter { background:#071b29ed; border-radius:4px; }
.battle-clarity-header>strong { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
#battle-menu { padding:10px 12px; gap:10px; max-height:78dvh; overflow-y:auto; touch-action:pan-y; overscroll-behavior:contain; }
#battle-menu .battle-intent { padding:0; }
#battle-menu .enemy-fact { gap:2px 6px; padding:7px; }
#battle-menu .enemy-fact>strong,#battle-menu .enemy-fact>span { font-size:calc(14px * var(--ui-scale)); line-height:1.4; }
#battle-menu .enemy-fact>small { display:none; }
.battle-support-clock { font-size:calc(14px * var(--ui-scale)); line-height:1.4; margin-top:5px; }
#battle-menu .action-menu { min-width:0; grid-template-columns:repeat(2,minmax(0,1fr)); }
#battle-menu .action-btn { min-width:0; font-size:calc(16px * var(--ui-scale)); }
#battle-menu .battle-clarity-header { grid-column:1/-1; display:flex; gap:6px; margin:0; }
.battle-help-button,.battle-review-button { flex:1; min-width:0; min-height:44px; padding:4px 8px; background:#123744; color:#efffff; border:1px solid #8ed9cc; border-radius:6px; font:inherit; font-size:calc(14px * var(--ui-scale)); }
#battle-menu .party-member { min-width:0; padding:4px 0; }
#battle-menu .party-member .name small { display:block; font-size:calc(14px * var(--ui-scale)); }
@media (max-height:500px) and (orientation:landscape) {
    #hud { display:grid; grid-template-columns:minmax(0,1fr) auto auto; grid-template-areas:'location lights controls' 'stats stats stats'; align-items:center; gap:5px 8px; }
    #hud .location-name { grid-area:location; max-width:none; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    #hud .bay-light-counter { grid-area:lights; white-space:nowrap; }
    #hud .hud-buttons { grid-area:controls; margin-left:0; }
    #hud .hud-buttons button { flex-shrink:0; white-space:nowrap; padding:6px 8px; }
    #hud .stats-container { grid-area:stats; min-width:0; width:auto; align-items:center; }
    #hud .stat-item { flex-shrink:0; white-space:nowrap; }
    #hud .experience-meter { flex:1 1 270px; min-width:0; flex-wrap:wrap; }
    #hud .experience-next-skill { flex-basis:100%; }
    .exploration-brief { top:116px; max-height:calc(100dvh - 190px); }
    #battle-menu { min-height:0; align-items:center; gap:8px; padding:8px; }
    #battle-menu .battle-intent { flex:1 1 48%; }
    #battle-menu .party-status { flex:1 1 18%; max-width:22%; }
    #battle-menu .action-menu { flex:1 1 28%; gap:5px; }
    #battle-menu .enemy-fact { grid-template-columns:1fr; padding:5px; }
    #battle-menu .enemy-fact>strong { line-height:1.3; }
    #battle-menu .battle-targets { padding:0; }
    #battle-menu .battle-help-button,#battle-menu .battle-review-button { min-height:44px; padding:3px; }
}
@media (max-width:700px) and (orientation:portrait) {
    #battle-menu { gap:6px; }
    #battle-menu .party-status { max-width:none; }
    #battle-menu .action-menu { gap:5px; }
    #battle-menu .action-btn { min-height:44px; padding:6px; }
}
