:root{--ink:#071b29;--panel:#102c3b;--line:#365663;--paper:#eef3e7;--muted:#b1c6c9;--sea:#74d7cb;--gold:#f1bf75;--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px)}
.journal-story summary{min-height:44px;cursor:pointer;display:list-item;padding:10px 0;color:var(--gold)}.journal-story summary:focus-visible{outline:3px solid var(--gold);outline-offset:2px}.journal-story-list{list-style:none;padding:0;margin:0}.journal-story-list li{padding:12px;margin-bottom:8px;border:1px solid var(--line);background:var(--panel);line-height:1.85}.journal-story-list h3{color:var(--sea);margin:0 0 6px}.journal-story-list p{margin:0;overflow-wrap:anywhere}
html,body{background:var(--ink);color:var(--paper);touch-action:manipulation;font-size:calc(16px * var(--ui-scale, 1))}body{background:radial-gradient(ellipse at 50% 30%,#163e4b,var(--ink) 75%)}button,input,select{font:inherit}button,select{min-height:44px;touch-action:manipulation}button{cursor:pointer}button:focus-visible,select:focus-visible,input:focus-visible{outline:3px solid var(--gold);outline-offset:3px}button:disabled{opacity:.45;cursor:default}#game-wrapper{max-width:1200px;margin:auto;height:100dvh;padding:var(--safe-top) env(safe-area-inset-right) var(--safe-bottom) env(safe-area-inset-left)}#game-container{width:min(100vw,calc(100dvh * 4 / 3));height:auto;aspect-ratio:4/3;max-width:none;max-height:none}#game-container canvas{width:100%!important;height:100%!important;image-rendering:pixelated}#ui-overlay{inset:var(--safe-top) 0 var(--safe-bottom);height:auto}button{transition:background .15s,border-color .15s}button:active{filter:brightness(1.15)}
#hud{top:12px;padding:0 16px;gap:8px;align-items:center;flex-wrap:wrap;pointer-events:none}.location-name,.bay-light-counter,.stat-item{background:rgba(7,27,41,.94);border:1px solid var(--line);border-radius:4px;font-size:calc(14px * var(--ui-scale, 1));padding:8px 12px;color:var(--paper);max-width:none}.location-name{font-weight:700;color:var(--gold)}.stats-container{gap:4px;flex-wrap:wrap}.stat-item.class{display:none}.hud-buttons{margin-left:auto;display:flex;flex-direction:row;gap:6px;pointer-events:auto}.hud-buttons button{font-size:calc(14px * var(--ui-scale, 1));padding:8px 12px;border:1px solid var(--line);background:var(--panel);color:var(--paper);border-radius:4px}.menu-btn{min-width:44px}.bay-light-counter .icon{color:var(--gold)}
#dialogue-container{bottom:20px;width:min(760px,calc(100% - 32px));max-height:60%;overflow:auto}.dialogue-box{border:1px solid var(--line);border-top:3px solid var(--gold);background:rgba(7,27,41,.98);border-radius:5px;padding:20px 24px 52px;box-shadow:0 12px 40px #0006}.speaker-name{font-size:calc(16px * var(--ui-scale, 1));color:var(--gold);margin-bottom:10px}.text-content{font-size:calc(18px * var(--ui-scale, 1));line-height:1.85;min-height:58px;overflow-wrap:anywhere}.continue-indicator{border:0;background:transparent;color:var(--sea);font-size:calc(14px * var(--ui-scale, 1));bottom:4px;right:16px;animation:none}.choices-container{gap:8px}.choice-btn{font-size:calc(16px * var(--ui-scale, 1));padding:12px 18px;background:var(--panel);border:1px solid var(--line);border-radius:4px;color:var(--paper)}
#battle-menu{bottom:0;height:auto;min-height:142px;padding:16px;background:linear-gradient(0deg,var(--ink) 80%,#071b29dd);border-top:1px solid var(--line);display:flex;gap:16px;align-items:center;justify-content:space-between}.party-status{position:static;display:flex;max-width:50%;gap:8px}.party-member{background:transparent;padding:6px 10px;border:0;min-width:130px}.party-member .name{font-size:calc(16px * var(--ui-scale, 1))}.party-member .hp-bar,.party-member .mp-bar{height:8px}.action-menu{position:static;display:grid;grid-template-columns:repeat(2,minmax(110px,1fr));gap:8px}.action-btn{width:auto;min-width:110px;height:auto;min-height:48px;font-size:calc(16px * var(--ui-scale, 1));border:1px solid var(--line);background:var(--panel);border-radius:4px}.action-btn:hover{background:#205160;border-color:var(--sea);transform:none}.action-icon{width:24px;height:24px}.enemy-speech{top:85px;font-size:calc(16px * var(--ui-scale, 1));max-width:min(420px,85%);border-radius:5px}
#quest-log,#skill-panel{top:78px;left:auto;right:16px;width:min(460px,calc(100% - 32px));max-height:calc(100% - 100px);background:var(--ink);border:1px solid var(--line);border-top:3px solid var(--gold);border-radius:5px;padding:16px;overscroll-behavior:contain;touch-action:pan-y}#quest-log *,#skill-panel *{font-size:calc(16px * var(--ui-scale, 1))}.quest-log-header,.skill-panel-header{color:var(--gold)}.quest-log-close,.skill-panel-close,.shop-close{min-width:44px}.quest-log-item,.skill-item{background:var(--panel);border:1px solid var(--line);border-radius:4px;padding:12px;line-height:1.65}.skill-upgrade{font-size:calc(16px * var(--ui-scale, 1));padding:8px}.quest-log-item .quest-name{color:var(--sea)}#quest-popup{top:86px;right:16px;max-width:360px;background:var(--ink);border-color:var(--gold);border-radius:5px}.quest-title,.quest-objective{font-size:calc(16px * var(--ui-scale, 1))}
#shop-overlay,#pause-menu{background:#031018d9;padding:16px}.shop-panel,.pause-panel,.audio-panel{background:var(--ink);border:1px solid var(--line);border-top:3px solid var(--gold);border-radius:5px;color:var(--paper);max-height:90%;overflow:auto;touch-action:pan-y}.shop-panel{width:560px;max-width:100%}.shop-items{max-height:60dvh}.shop-item{background:var(--panel);border-radius:4px;line-height:1.6}.shop-title,.shop-item-name,.shop-item-desc,.shop-item-price,.shop-gold,.shop-buy{font-size:calc(16px * var(--ui-scale, 1))}.shop-buy{min-width:70px}.pause-panel button{font-size:calc(16px * var(--ui-scale, 1));min-height:48px}.pause-panel .pause-title{font-size:calc(24px * var(--ui-scale, 1));color:var(--gold)}#audio-settings{top:78px;right:16px;left:auto;z-index:150;max-width:calc(100% - 32px)}.audio-panel{width:320px;max-width:100%;padding:18px;gap:16px;box-shadow:0 20px 80px #0009}.audio-title{font-size:calc(18px * var(--ui-scale, 1));color:var(--gold);display:flex;justify-content:space-between;align-items:center}#settings-close{background:transparent;border:0;color:var(--paper);min-width:44px}.audio-row{font-size:calc(16px * var(--ui-scale, 1));justify-content:space-between}.audio-row input[type=range]{min-width:60px;width:100%;accent-color:var(--sea);height:44px}.audio-row input[type=checkbox]{width:24px;height:24px;accent-color:var(--sea)}.audio-row select{background:var(--panel);color:var(--paper);border:1px solid var(--line);border-radius:4px;padding:6px}
#mobile-controls{bottom:16px;left:16px;right:16px;pointer-events:none}.mobile-dpad,.mobile-actions{pointer-events:auto}.mobile-btn{width:60px;height:60px;font-size:calc(20px * var(--ui-scale, 1));border-radius:8px;border:1px solid var(--sea);background:#102c3bea;box-shadow:0 3px 0 #0007}.mobile-btn-action{width:76px;height:60px;border-color:var(--gold);border-radius:8px;font-size:calc(16px * var(--ui-scale, 1))}body.modal-open #mobile-controls{visibility:hidden}
#title-screen{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;padding:24px;background:linear-gradient(0deg,#071b29f5,#071b2966 65%,#071b2988)}.title-eyebrow{color:var(--sea);font-size:calc(12px * var(--ui-scale, 1));letter-spacing:.3em;margin-bottom:16px}.title-wordmark{font-family:Georgia,serif;font-size:clamp(40px,7vw,76px);color:var(--paper);letter-spacing:.02em;font-weight:normal;line-height:1}.title-subtitle{font-size:clamp(22px,4vw,32px);color:var(--gold);letter-spacing:.14em;margin:18px 0 24px}.title-rule{height:2px;width:64px;background:var(--gold);margin:0 auto 24px}.title-actions{width:min(280px,100%);display:grid;gap:10px}.title-actions button,.save-slot,.save-back{min-height:52px;padding:12px 20px;border:1px solid var(--line);background:var(--panel);border-radius:4px;color:var(--paper);font-size:calc(16px * var(--ui-scale, 1))}.title-actions .primary{background:var(--gold);color:var(--ink);border-color:var(--gold);font-weight:700}.title-footer{position:absolute;bottom:20px;font-size:calc(12px * var(--ui-scale, 1));color:var(--muted);letter-spacing:.08em}.title-controls{margin-top:24px;font-size:calc(13px * var(--ui-scale, 1));color:var(--muted)}#save-picker{position:absolute;inset:0;display:grid;place-items:center;background:#031018ed;z-index:110;padding:20px}.save-panel{width:min(440px,100%);display:grid;gap:12px}.save-panel h2{font-size:calc(24px * var(--ui-scale, 1));color:var(--gold);margin-bottom:12px}.save-slot{text-align:left;display:flex;flex-direction:column;gap:6px}.save-slot small{font-size:calc(14px * var(--ui-scale, 1));color:var(--muted)}.save-message{color:var(--gold);font-size:calc(16px * var(--ui-scale, 1));line-height:1.6}
#character-select{padding:24px;overflow:auto;justify-content:safe center;background:linear-gradient(160deg,#163d48,var(--ink) 70%);touch-action:pan-y}.char-select-title{font-size:calc(28px * var(--ui-scale, 1));color:var(--gold);text-shadow:none}.char-select-subtitle{font-size:calc(16px * var(--ui-scale, 1));color:var(--muted);margin-bottom:24px}.character-grid{grid-template-columns:repeat(3,1fr);gap:12px;max-width:760px;padding:0}.character-card{background:#102c3b;border:1px solid var(--line);border-radius:5px;padding:20px 14px;color:var(--paper)}.character-card:hover{transform:none;box-shadow:none;border-color:var(--sea)}.character-card.selected{border:2px solid var(--gold);background:#213a3c;box-shadow:none}.char-portrait{width:80px;height:80px;border:0;border-radius:0;background:transparent}.char-name{font-size:calc(16px * var(--ui-scale, 1))}.char-desc{font-size:calc(16px * var(--ui-scale, 1));color:var(--muted)}.char-stats{font-size:calc(13px * var(--ui-scale, 1));flex-wrap:wrap;gap:6px}.char-stat{font-size:calc(13px * var(--ui-scale, 1))}.start-btn{font-size:calc(18px * var(--ui-scale, 1));border-radius:4px;background:var(--gold);color:var(--ink);border:0;padding:14px 40px;margin-top:24px}.start-btn:hover{transform:none;box-shadow:none}
@media(orientation:portrait) and (max-width:700px){#game-container{position:absolute;top:calc(var(--safe-top) + 110px);width:100%;height:auto;aspect-ratio:4/3}#hud{top:10px;padding:0 12px;gap:6px}.location-name{max-width:65%;font-size:calc(14px * var(--ui-scale, 1));width:auto}.bay-light-counter{font-size:calc(14px * var(--ui-scale, 1))}.stats-container{width:auto;gap:4px}.stat-item{font-size:calc(13px * var(--ui-scale, 1));padding:6px 8px;max-width:none}.stat-item.lvl{display:none}.hud-buttons{width:auto;margin-left:auto}.hud-buttons button{font-size:calc(13px * var(--ui-scale, 1));padding:6px 9px}#dialogue-container{bottom:90px;width:calc(100% - 24px);max-height:calc(100% - 180px)}.dialogue-box{padding:16px 18px 48px}.text-content{font-size:calc(16px * var(--ui-scale, 1));line-height:1.8}#battle-menu{padding:12px;flex-direction:column;align-items:stretch;gap:8px;min-height:210px}.party-status{max-width:100%;justify-content:space-between}.party-member{min-width:0;flex:1}.action-menu{grid-template-columns:repeat(2,1fr)}.action-btn{min-height:50px;font-size:calc(16px * var(--ui-scale, 1))}#quest-popup{max-width:calc(100% - 24px);right:12px;top:116px}.enemy-speech{top:112px}.character-grid{grid-template-columns:1fr;width:100%;gap:8px}.character-card{display:grid;grid-template-columns:64px 1fr;text-align:left;padding:12px;column-gap:12px}.char-portrait{grid-row:1/4;width:64px;height:64px;margin:0}.char-stats{justify-content:flex-start;margin-top:6px}.char-select-title{font-size:calc(24px * var(--ui-scale, 1))}.char-select-subtitle{margin-bottom:16px}.start-btn{margin-top:16px;width:100%}.title-controls{font-size:calc(12px * var(--ui-scale, 1));max-width:280px;line-height:1.8}#audio-settings{top:20px;right:12px;max-width:calc(100% - 24px)}}
@media(orientation:landscape) and (max-height:500px){#game-container{height:100dvh;width:auto;max-width:100vw;aspect-ratio:4/3}#hud{top:4px;padding:0 10px;flex-wrap:nowrap}.stats-container{width:auto}.stat-item{font-size:calc(12px * var(--ui-scale, 1));padding:5px 8px}.location-name{font-size:calc(13px * var(--ui-scale, 1));max-width:25vw}.bay-light-counter{font-size:calc(13px * var(--ui-scale, 1))}.hud-buttons{width:auto}.hud-buttons button{font-size:calc(13px * var(--ui-scale, 1))}.mobile-btn,.mobile-btn-action{height:48px;min-height:48px;width:52px;font-size:calc(16px * var(--ui-scale, 1))}#mobile-controls{bottom:10px}#dialogue-container{bottom:12px;width:70%;max-width:620px;max-height:70%}.text-content{font-size:calc(16px * var(--ui-scale, 1));min-height:32px;line-height:1.6}.dialogue-box{padding:12px 18px 44px}.speaker-name{font-size:calc(16px * var(--ui-scale, 1));margin-bottom:6px}#battle-menu{min-height:112px;padding:8px 16px}.party-member .name{font-size:calc(14px * var(--ui-scale, 1))}.action-btn{min-height:44px;font-size:calc(16px * var(--ui-scale, 1));min-width:100px}.action-menu{gap:4px}.title-wordmark{font-size:calc(40px * var(--ui-scale, 1))}.title-subtitle{font-size:calc(22px * var(--ui-scale, 1));margin:10px}.title-eyebrow{margin-bottom:8px}.title-rule,.title-controls{display:none}.title-actions{gap:6px}.title-actions button{min-height:44px;padding:8px}.title-footer{bottom:8px}.character-grid{grid-template-columns:repeat(3,1fr)}#character-select{padding:12px}.char-select-title{font-size:calc(22px * var(--ui-scale, 1))}.char-select-subtitle{font-size:calc(14px * var(--ui-scale, 1));margin-bottom:10px}.character-card{padding:10px}.char-portrait{width:40px;height:40px;margin-bottom:6px}.char-name,.char-desc{font-size:calc(16px * var(--ui-scale, 1))}.char-stats{display:flex;flex-wrap:wrap;gap:4px}.char-stat{font-size:calc(16px * var(--ui-scale, 1));padding:2px 5px}.start-btn{margin-top:10px;padding:10px}.audio-panel{max-height:85dvh}#audio-settings{top:10px}.enemy-speech{top:54px}.save-panel{gap:6px}.save-panel h2{margin:0;font-size:calc(20px * var(--ui-scale, 1))}.save-slot{min-height:48px;padding:6px 14px;flex-direction:row;align-items:center;justify-content:space-between}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}body.reduced-motion *,body.reduced-motion *::before,body.reduced-motion *::after{animation:none!important;transition:none!important}
.battle-intent{color:var(--gold);font-size:calc(16px * var(--ui-scale, 1));line-height:1.6;flex-basis:100%;padding:8px;border-left:3px solid var(--gold)}
.enemy-intent-icon,.support-charge-icon,.status-icon img{width:24px;height:24px;object-fit:contain;image-rendering:pixelated;vertical-align:middle}.enemy-intent-icon,.support-charge-icon{margin-right:6px}
.battle-choice-panel{background:var(--ink)!important;border:1px solid var(--line)!important;border-top:3px solid var(--gold)!important;color:var(--paper)!important;border-radius:5px!important;font-size:calc(16px * var(--ui-scale, 1))!important;touch-action:pan-y;overscroll-behavior:contain}.battle-choice-panel button{font-size:calc(16px * var(--ui-scale, 1))!important;line-height:1.5;border:1px solid var(--line)!important;background:var(--panel)!important;color:var(--paper)!important;border-radius:4px!important;padding:10px 14px!important}
@media(orientation:portrait) and (max-width:700px){.battle-choice-panel{position:fixed!important;inset:15% 12px 16%!important;z-index:160!important}}
#save-error{position:absolute;inset:20% 16px auto;margin:auto;max-width:480px;background:var(--ink);border:2px solid var(--gold);padding:24px;z-index:200;line-height:1.8;box-shadow:0 20px 80px #000a}#save-error button{margin-top:16px;min-width:100px;background:var(--panel);color:var(--paper);border:1px solid var(--line);padding:8px 16px}
#battle-menu{flex-wrap:wrap}.battle-intent{margin:0;padding:4px 10px;font-size:calc(14px * var(--ui-scale, 1))}.battle-choice-panel h2{font-size:calc(22px * var(--ui-scale, 1));color:var(--gold)}
@media(orientation:portrait) and (max-width:700px){.battle-intent{flex-basis:auto;font-size:calc(14px * var(--ui-scale, 1))}#battle-menu{gap:6px}}

.char-portrait img{width:100%;height:100%;object-fit:contain;image-rendering:pixelated}
.battle-readout{position:absolute;left:24px;right:24px;top:78px;z-index:25;pointer-events:none;color:var(--paper);font-size:calc(16px * var(--ui-scale, 1));line-height:1.6;text-shadow:0 2px 3px #071b29}.battle-enemy-health{color:var(--gold);font-weight:700}.battle-readout p{margin:6px 0;white-space:pre-line}.battle-mode .exploration-brief{display:none}.battle-mode .hud-buttons{visibility:hidden}
@media(orientation:portrait) and (max-width:700px){.battle-readout{top:calc(110px + 75vw + 12px);left:16px;right:16px;font-size:calc(16px * var(--ui-scale, 1))}.battle-readout p{margin-top:4px}.battle-mode .party-status{overflow-x:auto;justify-content:flex-start}.battle-mode .party-member{flex:0 0 auto;min-width:120px}.battle-mode #battle-menu{min-height:0}.battle-mode .battle-intent{margin:0;padding:4px 8px}}
@media(orientation:landscape) and (max-height:500px){.battle-readout{top:52px;left:16px;right:16px;max-width:42%;font-size:calc(16px * var(--ui-scale, 1))}.battle-mode .party-status{overflow-x:auto;max-width:44%}.battle-mode #battle-menu{flex-wrap:wrap;gap:4px}.battle-mode .battle-intent{margin:0;padding:0 8px;font-size:calc(16px * var(--ui-scale, 1))}}

/* Compact automatic-support roster: only the player has battle resources. */
.battle-mode .party-status{flex-direction:column;gap:2px;overflow:visible;min-width:0}.battle-mode .party-member{flex:none}.support-roster{padding:0 10px;font-size:calc(14px * var(--ui-scale, 1));line-height:1.4;min-width:0}.support-roster p{margin:0}.support-names{white-space:nowrap;overflow-x:auto;max-width:100%;color:var(--muted);padding-bottom:2px}
@media(orientation:portrait) and (max-width:700px){.battle-mode .party-status{width:100%;max-width:100%}}

/* The whole label is clickable: preserve >=44px targets in short viewports. */
#audio-settings .audio-row { min-height:44px; flex-shrink:0; }
#audio-settings .audio-panel { overflow-y:auto; overscroll-behavior:contain; }

.character-back{display:block;margin:10px auto 0;min-height:48px;padding:10px 18px;font:inherit;color:var(--paper);background:var(--panel);border:1px solid var(--line);border-radius:4px}.character-back:focus-visible{outline:3px solid var(--gold);outline-offset:3px}

#character-select > *{flex-shrink:0}

/* Coastal field menus: brass-edged pixel panels over the existing game world. */
#skill-panel,
#pause-menu .pause-panel {
    --menu-brass: #b58c52;
    --menu-edge: #506669;
    --menu-well: #0a202c;
    background: #102b38;
    border: 3px double var(--menu-brass);
    border-radius: 0;
    color: var(--paper);
    box-shadow: inset 0 0 0 3px #071b29, 6px 6px 0 #03101899;
}
#skill-panel .menu-kicker,
#pause-menu .menu-kicker {
    margin: 0 0 4px;
    color: var(--sea);
    font-size:calc(12px * var(--ui-scale, 1));
    font-weight: 700;
    letter-spacing: .16em;
    line-height: 1.5;
}
#skill-panel {
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    width: min(760px, calc(100% - 32px));
    max-height: calc(100% - 32px);
    padding: 20px;
    z-index: 110;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: inset 0 0 0 3px #071b29, 6px 6px 0 #03101899, 0 0 0 100vmax #031018cc;
}
#skill-panel .skill-panel-header {
    flex: 0 0 auto;
    gap: 16px;
    margin: 0 0 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--menu-brass);
}
#skill-panel .skill-panel-header h2 {
    margin: 0;
    font-size:calc(25px * var(--ui-scale, 1));
    color: var(--gold);
    letter-spacing: .08em;
    line-height: 1.4;
}
#skill-panel .skill-panel-close {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--menu-edge);
    border-radius: 0;
    color: var(--paper);
    background: var(--menu-well);
    font-size:calc(24px * var(--ui-scale, 1));
}
#skill-panel .skill-points {
    flex: 0 0 auto;
    margin: 0 0 6px;
    color: var(--gold);
    font-weight: 700;
    line-height: 1.6;
}
#skill-panel .skill-help {
    flex: 0 0 auto;
    margin: 0 0 12px;
    color: var(--muted);
    font-size:calc(14px * var(--ui-scale, 1));
    line-height: 1.65;
}
#skill-panel .skill-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px;
    margin: 0 -4px;
    scrollbar-color: var(--menu-brass) var(--menu-well);
    scrollbar-width: thin;
}
#skill-panel .skill-list:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: -2px;
}
#skill-panel .skill-item {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--menu-well);
    border: 1px solid var(--menu-edge);
    border-top: 3px solid var(--sea);
    border-radius: 0;
    line-height: 1.65;
    overflow-wrap: anywhere;
}
#skill-panel .skill-row { gap: 6px; min-width: 0; }
.skill-art { width: 32px; height: 32px; flex: 0 0 32px; object-fit: contain; image-rendering: pixelated; }
#skill-panel .skill-heading, .battle-choice-panel .battle-skill-choice { display: flex; align-items: center; gap: 10px; }
#skill-panel .skill-heading .skill-name, .battle-skill-label { min-width: 0; overflow-wrap: anywhere; }
#skill-panel .skill-kind { color: var(--sea); font-size:calc(12px * var(--ui-scale, 1)); letter-spacing: .08em; }
#skill-panel .skill-name { color: var(--paper); font-size:calc(17px * var(--ui-scale, 1)); font-weight: 700; }
#skill-panel .skill-level { display: inline-block; margin-left: 8px; color: var(--gold); font-size:calc(14px * var(--ui-scale, 1)); white-space: nowrap; }
#skill-panel .skill-desc { color: var(--paper); font-size:calc(16px * var(--ui-scale, 1)); }
#skill-panel .skill-next { margin: 4px 0 0; padding-top: 8px; border-top: 1px solid #294653; color: var(--muted); font-size:calc(16px * var(--ui-scale, 1)); }
#skill-panel .skill-actions { margin-top: auto; display: flex; align-items: stretch; }
#skill-panel .skill-upgrade {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    background: #224b51;
    border: 1px solid var(--sea);
    border-radius: 0;
    box-shadow: inset 0 -3px 0 #132f38;
    color: var(--paper);
    font-size:calc(15px * var(--ui-scale, 1));
    font-weight: 700;
    line-height: 1.5;
}
#skill-panel .skill-upgrade:disabled {
    opacity: 1;
    border-color: #40575e;
    background: #122a35;
    color: var(--muted);
    box-shadow: none;
}
#skill-panel .skill-item[data-state="locked"] { border-top-color: #677b7e; }
#skill-panel .skill-item[data-state="maxed"] { border-top-color: var(--menu-brass); }
#pause-menu { padding: 16px; background: #031018d9; }
#pause-menu .pause-panel {
    width: min(420px, 100%);
    max-width: 100%;
    max-height: 100%;
    padding: 28px;
    gap: 12px;
    align-items: stretch;
    text-align: center;
    overscroll-behavior: contain;
}
#pause-menu .pause-panel > * { flex-shrink: 0; }
.christmas-mode #pause-menu .pause-title { display:flex; align-items:center; justify-content:center; gap:8px; }
.seasonal-wreath { width:48px; height:48px; flex:0 0 48px; object-fit:contain; image-rendering:pixelated; pointer-events:none; }
.christmas-mode #pause-menu .pause-panel { border-top-color:#edc783; border-bottom:3px solid #875053; }
#audio-settings .settings-hint { margin:-8px 0 0; font-size:calc(13px * var(--ui-scale, 1)); line-height:1.6; color:var(--muted); }
@media(orientation:landscape) and (max-height:500px) { .seasonal-wreath { width:40px; height:40px; flex-basis:40px; } }
#pause-menu .pause-title { margin: 0; color: var(--gold); font-size:calc(27px * var(--ui-scale, 1)); letter-spacing: .08em; line-height: 1.5; }
#pause-menu .pause-caption { margin: 0 0 8px; padding-bottom: 20px; border-bottom: 1px solid var(--menu-brass); color: var(--muted); font-size:calc(14px * var(--ui-scale, 1)); line-height: 1.7; }
#pause-menu .pause-panel button {
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    border: 1px solid var(--menu-edge);
    border-radius: 0;
    background: var(--menu-well);
    color: var(--paper);
    font-weight: 700;
    line-height: 1.5;
    box-shadow: inset 0 -3px 0 #031018;
}
#pause-menu .pause-panel .pause-resume { border-color: var(--gold); color: var(--ink); background: var(--gold); box-shadow: inset 0 -3px 0 var(--menu-brass); }
#pause-menu .pause-panel .pause-to-title { margin-top: 4px; border-color: var(--menu-edge); background: transparent; color: var(--muted); box-shadow: none; font-weight: 400; }
@media (hover: hover) {
    #skill-panel button:not(:disabled):hover,
    #pause-menu .pause-panel button:hover { border-color: var(--gold); filter: brightness(1.12); }
}
@media (max-width: 600px) {
    #skill-panel { width: calc(100% - 24px); max-height: calc(100% - 24px); padding: 16px; }
    #skill-panel .skill-list { grid-template-columns: minmax(0, 1fr); }
    #skill-panel .skill-item { padding: 12px; }
    #pause-menu .pause-panel { padding: 24px 20px; }
}
@media (orientation: landscape) and (max-height: 500px) {
    #skill-panel { width: min(760px, calc(100% - 24px)); max-height: calc(100% - 20px); padding: 12px 16px; }
    #skill-panel .skill-panel-header { margin-bottom: 6px; padding-bottom: 6px; }
    #skill-panel .skill-panel-header h2 { font-size:calc(21px * var(--ui-scale, 1)); }
    #skill-panel .menu-kicker { margin: 0; font-size:calc(11px * var(--ui-scale, 1)); }
    #skill-panel .skill-help { margin-bottom: 6px; font-size:calc(13px * var(--ui-scale, 1)); }
    #skill-panel .skill-points { margin-bottom: 2px; }
    #skill-panel .skill-item { padding: 10px; gap: 8px; }
    #skill-panel .skill-upgrade { min-height: 44px; padding: 8px 10px; }
    #pause-menu { padding: 10px; }
    #pause-menu .pause-panel { width: min(440px, 100%); padding: 12px 20px; gap: 8px; }
    #pause-menu .menu-kicker { margin: 0; font-size:calc(11px * var(--ui-scale, 1)); }
    #pause-menu .pause-title { font-size:calc(22px * var(--ui-scale, 1)); }
    #pause-menu .pause-caption { margin: 0; padding-bottom: 8px; font-size:calc(13px * var(--ui-scale, 1)); }
    #pause-menu .pause-panel button { min-height: 44px; padding: 8px 14px; }
    #pause-menu .pause-panel .pause-to-title { margin-top: 0; }
}

/* Preserve the complete real-location composition in both phone orientations. */
.waterfront-lookout{box-sizing:border-box;margin:auto;width:min(1400px,96vw);max-width:96vw;max-height:96dvh;padding:12px;border:3px double #d6bb82;border-radius:0;background:#102d3a;color:#fff5dd;overflow:auto;font:16px/1.5 system-ui,sans-serif}
.waterfront-lookout::backdrop{background:#04121eea}
.waterfront-lookout header{display:flex;align-items:center;justify-content:space-between;gap:12px}
.waterfront-lookout h2{font-size:calc(18px * var(--ui-scale, 1));margin:0}
.waterfront-lookout button{font:inherit;min-height:48px;padding:8px 14px;color:#fff5dd;background:#224c58;border:1px solid #d6bb82;cursor:pointer}
.waterfront-lookout button:focus-visible{outline:3px solid #fff5dd;outline-offset:2px}
.waterfront-lookout img{display:block;width:100%;height:auto;max-height:calc(96dvh - 130px);object-fit:contain;margin-top:12px;image-rendering:pixelated}
.waterfront-lookout p{margin:8px 0 0}

/* Three-character Japanese action labels need room beside the landscape d-pad. */
@media(orientation:landscape) and (max-height:500px){.mobile-btn-action{width:80px;white-space:nowrap}}
/* Story journal: route first, past accomplishments disclosed on demand. */
.journal-route{padding:12px;margin:12px 0;background:var(--panel);border-left:3px solid var(--gold);line-height:1.75}
.journal-route p{margin:6px 0;overflow-wrap:anywhere}
.journal-route .journal-location{color:var(--sea)}
.journal-route h3{margin:8px 0 4px;color:var(--gold)}
.journal-completed summary{min-height:44px;display:list-item;align-content:center;cursor:pointer;padding:8px 4px;box-sizing:border-box}
.journal-completed summary:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
.friend-badge-panel{border-top:1px solid var(--line);margin-top:16px;padding-top:12px;line-height:1.75}
.friend-badge-panel h3{color:var(--gold);margin:0 0 8px}.friend-badge-panel p{margin:8px 0}
.friend-badge-panel label{display:block}.friend-badge-panel input{display:block;width:100%;box-sizing:border-box;min-height:44px;margin:6px 0 10px;padding:8px;color:var(--paper);background:var(--panel);border:1px solid var(--line);font:inherit}
.friend-badge-panel button{min-height:44px;padding:8px 12px;background:var(--panel);color:var(--paper);border:1px solid var(--sea);font:inherit;border-radius:4px}
.friend-badge-panel :focus-visible{outline:2px solid var(--gold);outline-offset:2px}.friend-badge-panel button:disabled{opacity:.6}
.friend-badge-owned{padding:10px;border:1px solid var(--sea);border-left:4px solid var(--sea);color:var(--sea);background:var(--panel)}
.friend-badge-art{display:block;width:64px;height:64px;object-fit:contain;image-rendering:pixelated;margin:8px 0}

.quest-pin{min-height:44px;margin-top:8px;padding:8px 12px;border:1px solid var(--line);border-radius:4px;background:var(--ink);color:var(--sea);cursor:pointer}.quest-pin[aria-pressed="true"]{border-color:var(--gold);color:var(--gold)}.quest-pin:focus-visible{outline:2px solid var(--gold);outline-offset:3px}.quest-pin-status{color:var(--sea);line-height:1.6}
/* Equipment cards keep comparison text above the purchase action on narrow phones. */
.shop-item { grid-template-columns: minmax(0, 1fr) auto; }
.shop-item-heading { display:flex; align-items:center; gap:10px; grid-column:1 / -1; min-width:0; }
.shop-item-icon { width:48px; height:48px; flex:none; image-rendering:pixelated; object-fit:contain; }
.shop-item-owned,.shop-item-comparison,.shop-item-equip-note { grid-column:1 / -1; font-size:calc(14px * var(--ui-scale, 1)); overflow-wrap:anywhere; }
.shop-item-owned { color:var(--sea); }
.shop-item-comparison { color:var(--paper); border-left:2px solid var(--gold); padding-left:8px; }
.shop-item-equip-note { color:var(--paper); opacity:.85; }
.shop-item .shop-item-desc { grid-column:1 / -1; }
.shop-item .shop-buy { min-height:44px; }

/* Decorative role identities retain the existing named selection buttons. */
.char-portrait{position:relative}
.char-portrait .class-emblem{position:absolute;right:-12px;bottom:-2px;width:28px;height:28px;object-fit:contain;image-rendering:pixelated;pointer-events:none}

/* Keep the shop header visible and give item browsing one scroll owner. */
#shop-overlay .shop-panel {
    display: flex;
    flex-direction: column;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
}
#shop-overlay .shop-header { flex: 0 0 auto; }
#shop-overlay .shop-items {
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-color: var(--gold) var(--panel);
    scrollbar-width: thin;
}
#shop-overlay .shop-item { flex-shrink: 0; }

/* Keep the journal close control reachable while browsing long records. */
#quest-log .quest-log-header {
    position: sticky;
    top: -16px;
    z-index: 2;
    margin: -16px -16px 8px;
    padding: 8px 16px;
    background: var(--ink);
    border-bottom: 1px solid var(--line);
}
#character-select .char-specialty {font-size:calc(14px * var(--ui-scale, 1));line-height:1.55;color:var(--paper);margin:6px 0 10px;}
@media(orientation:portrait) and (max-width:700px){#character-select .char-portrait{grid-row:1/5}#character-select .char-stats{grid-column:2}}
