/* The scene and its conversation are the application, edge to edge. */
html,body{height:100%;overflow:hidden}
body{height:100dvh;min-width:320px}
main{width:100%;height:100%;max-width:none;margin:0;padding:8px}
#oracle-game,.earth-prologue{height:100%;min-height:0;padding:0}
.game-layout,.earth-layout{display:grid;grid-template-columns:minmax(0,1fr) clamp(330px,28vw,430px);gap:8px;height:100%;min-height:0;align-items:stretch}
.adventure,.cosmic-panel,.earth-map-panel,.journey-side,.earth-selection{min-width:0;min-height:0;border-radius:5px;margin:0;position:relative;top:auto}
.adventure{display:flex;flex-direction:column;height:100%}
.adventure-top,.cosmic-top,.earth-map-top{padding:9px 14px;min-height:40px;flex-shrink:0}
.adventure-top small,.cosmic-top small,.cosmic-place{display:none}
.hero-hud{padding:8px 14px;gap:12px;flex-shrink:0}
.hero-hud .portrait{width:42px;height:48px}
.campaign-strip{padding:5px 14px;flex-shrink:0}
.activity-strip{padding:7px 14px;flex-shrink:0}
.activity-strip small,.activity-auto{display:none}
.world-view{flex:1;min-height:0;display:flex;align-items:center;justify-content:center}
#world{display:block;width:100%;height:100%;object-fit:contain;image-rendering:pixelated}
.world-event,.map-key{display:none}
.encounter:not([hidden]){position:absolute;bottom:128px;left:12px;right:12px;z-index:2;background:#17272eea;border:1px solid #788671;border-radius:4px;pointer-events:none}
.inventory-bar{padding:8px 14px;flex-shrink:0}
.party-bar{padding:5px 14px;flex-shrink:0}
.playbar{padding:9px 12px;flex-shrink:0;gap:8px;flex-wrap:wrap}
.playback-buttons{gap:7px}
.playback-options{gap:8px}
.quiet-button{padding:6px 10px}
.journey-side{height:100%;display:flex;flex-direction:column;overflow:hidden}
.chat-pane{height:100%;min-height:0;flex:1;overflow:hidden}
.chat-heading{min-height:45px;padding:9px 16px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between}
.chat-heading h2{font-size:16px;margin:0}
.chat-scroll{min-height:80px}
.chat-log{padding:16px 14px 8px}
.chat-entry{margin-bottom:17px}
.chat-bubble p{font-size:13px;line-height:1.75;overflow-wrap:anywhere}
.chat-meta{font-size:11px}
.chat-meta span{font-size:10px}
.chat-status{padding:10px 14px;flex-shrink:0}
.chat-status p{font-size:11px}
.chat-footer{padding:9px 14px;flex-shrink:0}
#oracle-game[data-stage=cosmic] .chat-footer,#oracle-game[data-stage=cosmic] .chat-status{display:none}
.cosmic-panel{display:flex;flex-direction:column;height:100%;overflow:hidden}
.cosmic-stage{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;background:#111a2e}
.cosmic-stage #cosmic-world{width:100%;height:100%;max-height:none;aspect-ratio:auto;object-fit:contain}
.cosmic-god-name{top:8%;bottom:auto}
.cosmic-seals{padding:12px 16px;flex-shrink:0}
.cosmic-seals>div{padding:8px;gap:5px}
.cosmic-footer{padding:10px 14px;flex-shrink:0;gap:8px}
.cosmic-footer>span{font-size:11px}
.cosmic-chat-controls{border-top:1px solid #465653;padding:10px 14px 12px;max-height:65%;overflow-y:auto;scrollbar-width:thin;flex-shrink:0;background:#182a30}
.composer-hint{font-size:11px;line-height:1.6;margin:0 0 7px;color:#adbbac}
.cosmic-dialogue-actions{margin:0 0 8px;display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap}
.cosmic-dialogue-actions:has(>button[hidden]):not(:has(>button:not([hidden]))){display:none}
.oracle-composer{margin:0}
.oracle-composer label{font-size:12px;color:#dacda3;display:block;margin-bottom:6px}
.oracle-composer textarea{display:block;width:100%;min-height:78px;max-height:160px;resize:vertical;border:1px solid #6d7967;background:#101e24;color:#f1eddf;padding:10px;font:inherit;font-size:13px;line-height:1.65;border-radius:4px;box-sizing:border-box}
.oracle-composer textarea:focus{outline:2px solid #bdab6f;outline-offset:1px}
.oracle-composer textarea:disabled{opacity:.5;resize:none}
.composer-send{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px}
.composer-send small{color:#a1b1a5;font-size:10px}
.composer-send .depart-button{width:auto;margin:0;padding:7px 13px;gap:12px;font-size:12px;min-height:36px}
.oracle-settings{margin-top:10px;border-top:1px solid #42564e;padding-top:7px;font-size:11px}
.oracle-settings summary{cursor:pointer;color:#b7c4b4}
.oracle-settings .mode-row{margin:10px 0 5px}
.oracle-settings .mode-note{margin:6px 0;font-size:10px}
.oracle-settings .preset-row{margin:8px 0;gap:5px}
.oracle-settings .preset-button{font-size:10px;padding:5px 8px}
.oracle-settings .class-guide{margin:8px 0 0}
.form-error{margin:8px 14px;padding:8px 0;flex-shrink:0}
.earth-map-panel{display:flex;flex-direction:column;height:100%}
.earth-canvas-wrap{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;background:#182836;overflow:hidden}
#earth-city{width:100%;height:auto;max-height:100%;object-fit:contain;aspect-ratio:8/5}
.earth-scene-footer{min-height:48px;padding:10px 14px;flex-shrink:0}
.earth-selection{height:100%;overflow-y:auto;padding:20px;gap:15px;scrollbar-width:thin}
.selection-title{font-size:18px;margin:0 0 5px;color:#e2d6b0;font-weight:600}
.earth-selection .earth-selected{margin-top:auto}
.earth-selection .earth-motion{margin-bottom:auto}
.journey-details{width:min(1000px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:20px;border:1px solid #68755e;border-radius:6px;background:#15252d;color:#e4e4d8;overscroll-behavior:contain;scrollbar-width:thin}
.journey-details::backdrop{background:#080e16b8}
.details-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;position:sticky;top:-20px;margin:-20px -20px 16px;padding:12px 20px;background:#1c3034;z-index:2}
.details-heading h2{margin:0;font-size:18px}
.journey-details .origin-panel{margin:0 0 12px}
.journey-details .world-book,.journey-details .records-layout,.journey-details .result-panel{margin-top:20px}
.journey-details .guide{margin:20px 0 0}
.journey-details .records-layout{grid-template-columns:1fr}
[hidden]{display:none!important}
@media(max-width:1000px){
 main{padding:5px}.game-layout,.earth-layout{gap:5px;grid-template-columns:minmax(0,1fr) 330px}
 .hero-hud{padding:7px 10px;gap:8px}.hero-name{min-width:0}.hero-name>span{font-size:12px}.hero-name small{font-size:9px}.turn-counter{display:none}
 .campaign-strip{font-size:10px}.playback-buttons{flex-wrap:wrap}.playbar{padding:6px 8px}.quiet-button{font-size:10px;padding:5px 7px}.trail-label{display:none}
 .cosmic-footer{flex-wrap:wrap}.cosmic-seals{padding:8px}.cosmic-seals strong{font-size:11px}
}
@media(max-width:740px){
 main{padding:0}.game-layout,.earth-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,42fr) minmax(0,58fr);gap:3px}
 .adventure,.cosmic-panel,.earth-map-panel,.journey-side,.earth-selection{border-radius:0}
 .adventure-top,.cosmic-top,.earth-map-top{min-height:31px;padding:5px 10px;font-size:11px}
 .hero-hud{padding:3px 10px}.hero-hud .portrait{width:30px;height:36px}.hero-name strong{font-size:13px}.hero-hud .health{max-width:110px}
 .campaign-strip,.activity-strip,.party-bar,.inventory-bar{display:none}
 .playbar{min-height:35px;padding:3px 8px}.playbar .quiet-button{min-height:27px}
 .encounter:not([hidden]){bottom:42px;font-size:10px;padding:5px}
 .chat-heading{min-height:36px;padding:6px 12px}.chat-heading h2{font-size:14px}.chat-log{padding:12px 12px 4px}.chat-bubble p{font-size:12px}.chat-entry{margin-bottom:13px}
 .chat-status{padding:6px 12px}.chat-status p{display:none}.chat-footer{display:none}
 .cosmic-chat-controls{padding:7px 12px;max-height:65%}.composer-hint{font-size:10px;margin-bottom:5px}.oracle-composer textarea{min-height:58px;height:58px;padding:7px}.oracle-composer label{margin-bottom:4px}
 .cosmic-seals{padding:5px 10px;gap:5px}.cosmic-seals>div{padding:4px}.cosmic-seals small{display:none}.cosmic-seals strong{font-size:10px}
 .cosmic-footer{padding:4px 10px;min-height:28px}.cosmic-footer>span{display:none}.cosmic-footer>div{width:100%;justify-content:space-between}.cosmic-god-name{display:none}
 .earth-scene-footer{min-height:33px;padding:5px 10px}.earth-scene-footer p{font-size:11px}
 .earth-selection{padding:12px 16px;gap:10px}.earth-selection .earth-selected{margin:0}.selection-title{font-size:15px;margin:0}.earth-selection .earth-motion{margin:0}.earth-selected canvas{width:42px;height:52px}.earth-roster{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.earth-roster button{padding:7px}.earth-roster small{font-size:9px}.earth-person-note{margin:0;font-size:11px}.earth-summon{padding:10px}
 .journey-details{padding:12px}.details-heading{top:-12px;margin:-12px -12px 12px;padding:10px 12px}
}
@media(max-height:650px) and (min-width:741px){
 .hero-hud{padding:4px 12px}.activity-strip,.party-bar{display:none}.cosmic-seals{padding:6px}.cosmic-footer{padding:6px 12px}.cosmic-chat-controls{max-height:65%}.oracle-composer textarea{height:58px;min-height:58px}.chat-status p{display:none}
}
/* Keep seal numerals beside their labels, including on narrow screens. */
.cosmic-seals>div{display:grid;grid-template-columns:24px minmax(0,1fr);column-gap:6px;row-gap:0;align-items:center}
.cosmic-seals span{position:static;grid-column:1;grid-row:1 / 3;align-self:center;text-align:center}
.cosmic-seals strong,.cosmic-seals small{grid-column:2}
/* The city's click coordinates must match the actual painted canvas bounds. */
.earth-canvas-wrap{container-type:size}
#earth-city{width:min(100cqw,160cqh);height:auto;max-height:none;flex:none}
@media(max-width:740px){.cosmic-seals>div{grid-template-columns:17px minmax(0,1fr);column-gap:3px}.cosmic-seals span{font-size:14px}}
/* A quiet nameplate remains readable over the sanctuary's bright stars. */
.cosmic-god-name{left:50%;right:auto;top:5%;bottom:auto;transform:translateX(-50%);width:max-content;max-width:calc(100% - 32px);display:grid;grid-template-columns:18px auto 18px;column-gap:12px;row-gap:4px;align-items:center;justify-items:center;padding:12px 24px;background:linear-gradient(135deg,#101b30e6,#1f2b42c9);border:1px solid #d7bb7280;border-radius:5px;box-shadow:0 3px 18px #04091655,inset 0 0 0 3px #b5a16d12;backdrop-filter:blur(5px);pointer-events:none}
.cosmic-god-name>span{grid-column:2;grid-row:1;color:#f5df9f;font:600 17px/1.25 Georgia,serif;letter-spacing:.25em;text-indent:.25em;text-shadow:0 1px 2px #030813}
.cosmic-god-name>small{grid-column:2;grid-row:2;font-size:11px;line-height:1.5;letter-spacing:.08em;color:#e6dec5;text-shadow:0 1px 2px #030813}
.cosmic-god-name>i{width:7px;height:7px;grid-row:1 / 3;transform:rotate(45deg);background:#d9bf7a55;border:1px solid #e1c98699;box-shadow:0 0 8px #d5bd6f25}
.cosmic-god-name>i:first-child{grid-column:1}.cosmic-god-name>i:last-child{grid-column:3}
@media(max-width:740px){.cosmic-god-name{display:grid;top:6px;left:8px;transform:none;padding:5px 12px;grid-template-columns:8px auto 8px;column-gap:8px;row-gap:1px}.cosmic-god-name>span{font-size:12px;letter-spacing:.2em}.cosmic-god-name>small{font-size:8px;line-height:1.4}.cosmic-god-name>i{width:4px;height:4px}}

.adventure-top .world-countdown{margin-left:auto;margin-right:8px;font-size:11px;white-space:nowrap;font-variant-numeric:tabular-nums;color:#d8c59a}
.adventure-top .world-countdown[data-urgent="true"]{color:#ffb19a}
#world[data-outcome="destruction"]{filter:saturate(.42) brightness(.68) hue-rotate(320deg)}
#world[data-outcome="death"]{filter:saturate(.52)}
