/* Screen-specific composition; the canvas and controller contract remain shared. */
:root { --ink: #f3ead4; --dim: #b9c9c8; --edge: #b4945a; }
body { font-family: "Trebuchet MS", sans-serif; }
.hud { border-top: 1px solid #b4945a; gap: 0; padding: 12px; background: #0b2731; }
.hud-block { border: 0; box-shadow: none; background: none; padding: 5px 14px; }
.hud-block + .hud-block { border-left: 1px solid #60818a66; }
.kicker { color: #a9d8da; font-size: 10px; letter-spacing: .12em; }
.major { text-shadow: none; line-height: 1.12; }
.cmd { border-width: 1px; border-color: #69828b; border-radius: 3px; background: #163844; min-height: 36px; transition: background .12s, border-color .12s; }
.cmd:hover, .cmd:focus-visible { border-color: #8edaff; outline: 2px solid #79cfff; outline-offset: 2px; }
.cmd.selected { background: #e8c982; border-color: #f7dfa5; }
.cmd.recommended { background: #ffdf62; border: 2px solid #69bfff; }
.cmd.disabled, .cmd:disabled { cursor: default; }
[hidden] { display: none !important; }

[data-layout="title"] #battleCanvas { height: 100%; }
[data-layout="title"] .hud { height: 100%; padding: 0; background: none; border: 0; display: block; pointer-events: none; }
[data-layout="title"] .hero-block, [data-layout="title"] .log-block { display: none; }
[data-layout="title"] #commandPanel { position: absolute; left: 37%; width: 26%; top: 48%; display: flex; flex-direction: column; gap: 10px; padding: 0; border: 0; overflow: visible; pointer-events: auto; }
[data-layout="title"] #commandPanel .cmd { text-align: center; min-height: 44px; font: 22px Georgia, serif; }
.opening-title { position: absolute; inset: 0; pointer-events: none; text-align: center; color: #eee6ce; }
.title-eyebrow { margin-top: 7%; text-transform: uppercase; letter-spacing: .25em; color: #d9be80; font-size: clamp(10px, 1.4vw, 16px); }
.opening-title h1 { font: bold clamp(32px, 5.4vw, 65px)/.95 Georgia, serif; margin: 2% 0; text-transform: uppercase; color: #fff1cd; text-shadow: 0 4px 20px #04151b; }
.opening-title h1 span { display: block; color: #e4be72; font-size: .6em; margin-top: 9px; }
.title-promise { font: clamp(15px, 2.1vw, 25px)/1.35 Georgia, serif; margin: 2% 0 0; }
.title-role { font-size: clamp(11px, 1.4vw, 17px); line-height: 1.6; color: #bad6d7; margin: 1.5% 0; }
.title-company { position: absolute; left: 7%; right: 7%; bottom: 10%; display: flex; justify-content: center; align-items: end; height: 22%; }
.title-company .art-portrait { width: 16.66%; height: 100%; object-fit: contain; filter: drop-shadow(0 12px 9px #02151c); }
.title-company .art-portrait { animation: oath-idle 4.5s ease-in-out infinite; }
.title-company .art-portrait:nth-child(2n) { animation-delay: -1.5s; }
@keyframes oath-idle { 50% { transform: translateY(-4px) rotate(.4deg); } }
.title-footer { position: absolute; bottom: 2%; width: 100%; margin: 0; font: clamp(11px, 1.4vw, 17px) Georgia, serif; }
.title-footer span { display: block; font: 11px "Trebuchet MS", sans-serif; color: #a8c7cb; padding-top: 8px; }
.title-save-note { position: absolute; top: 60%; width: 100%; margin: 0; color: #a9cbd0; font-size: 11px; }

[data-layout="chart"] .hud { grid-template-columns: .95fr 1fr 1.45fr; }
[data-layout="chart"] .log-block > .kicker { display: none; }
[data-layout="chart"] .log-line { font-size: 11px; color: #9db7bf; max-height: 2.5em; overflow: auto; }
[data-layout="chart"] .destination-brief p { font-size: clamp(11px, 1.1vw, 14px); line-height: 1.4; }
[data-layout="chart"] .destination-brief .chart-travel-hint { display: block; color: #d9e7e6; border-bottom: 1px solid #60818a66; padding-bottom: 5px; }
[data-layout="chart"] .destination-brief .route-requirement { display: block; }
[data-layout="chart"] .command-panel { gap: 6px; }
.journey-call { position: absolute; right: 2%; top: 11%; width: 32%; max-width: 355px; padding: 16px 18px; background: linear-gradient(125deg, #153e49f2, #092633f5); border-left: 2px solid #e4c176; box-shadow: 0 10px 28px #00101a44; pointer-events: none; }
.eyebrow { color: #a3dbdf; text-transform: uppercase; font-size: 10px; letter-spacing: .13em; }
.journey-call h2 { margin: 6px 0 9px; color: #f7e2ad; font: 24px/1.1 Georgia, serif; }
.journey-call p { margin: 0; font-size: 14px; line-height: 1.5; color: #d3e0dd; }
.oath-stops { display: flex; gap: 10px; padding: 14px 0; margin: 0; list-style: none; }
.oath-stops li { flex: 1; color: #95aeb4; font-size: 11px; }
.oath-stops li span { display: block; width: 23px; height: 23px; line-height: 21px; text-align: center; margin-bottom: 6px; border: 1px solid #63818b; border-radius: 50%; }
.oath-stops .now { color: #ffe5a0; }
.oath-stops .now span { color: #17303b; background: #e9cb83; }
.oath-stops .done { color: #a7e3c2; }
.journey-call .cmd { width: 100%; text-align: center; pointer-events: auto; }
.journey-call small { display: block; margin-top: 10px; color: #9dc4cb; font-size: 11px; line-height: 1.4; }
.campaign-bearing { max-width: 320px; }
.campaign-bearing .cmd { margin-top: 12px; }
.party-point-count { display: inline-block; min-width: 1.2em; padding: 0 3px; border-radius: 8px; background: #9dd5dd; color: #0b2731; font-size: 10px; line-height: 1.25; }
.journey-call .party-talent-reminder { padding-top: 8px; border-top: 1px solid #60818a66; color: #b9e1df; }
[data-layout="chart"] .hero-block { overflow-y: auto; }
@media (max-height: 680px) {
  [data-layout="chart"] .hud { height: 34%; }
  [data-layout="chart"] #battleCanvas { height: 66%; bottom: 34%; }
}

[data-layout="story"] .hud, [data-layout="menu"] .hud { height: 11%; display: flex; justify-content: flex-end; align-items: center; padding: 10px 3%; }
[data-layout="story"] .hero-block, [data-layout="story"] .log-block, [data-layout="menu"] .hero-block, [data-layout="menu"] .log-block { display: none; }
[data-layout="menu"] .log-block { display: block; flex: 1; padding: 0 15px 0 0; border: 0; max-height: 100%; }
[data-layout="menu"] .log-block .kicker, [data-layout="menu"] .log-block > :not(#battleLog) { display: none; }
[data-layout="menu"] .log-line { font-size: 11px; margin: 0; color: #abcbd0; }
[data-mode="build"] .hud .log-block, [data-mode="results"] .hud .log-block { display: none; }
[data-mode="defeat"] .hud .log-block { display: none; }
[data-mode="defeat"] .command-panel { max-width: 100%; }
.recovery-menu { display: flex; flex-direction: column; background: radial-gradient(ellipse at 20% 40%, #57706c40, transparent 55%), #0b2935fa; }
.recovery-lede { color: #c3d9da; font-size: clamp(12px, 1.4vw, 17px); margin: 10px 0 16px; }
.recovery-body { display: grid; grid-template-columns: .8fr 1.3fr; gap: 24px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-color: #abc7c8 #0c2a35; }
.recovery-company { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 12px 15px; background: #17404a66; border-radius: 4px; }
.recovery-company > .art-portrait { width: 145px; height: 175px; filter: drop-shadow(0 10px 12px #01131d88); }
.recovery-company > strong { font: 22px Georgia, serif; color: #ecd6a7; }
.recovery-company > p { font: 17px/1.5 Georgia, serif; color: #c8dfda; max-width: 280px; margin: 10px 0; }
.recovery-portraits { display: flex; justify-content: center; gap: 3px; margin-top: 12px; width: 100%; }
.recovery-portraits .art-portrait { width: 16%; height: 65px; }
.recovery-summary section { border-bottom: 1px solid #527b8266; padding: 6px 0 14px; margin-bottom: 12px; }
.recovery-summary h2 { font: 21px Georgia, serif; color: #e6d2a8; margin: 0 0 12px; }
.recovery-summary p { font-size: 14px; line-height: 1.5; color: #c6dada; margin: 8px 0; }
.recovery-progress { color: #b4e8dc !important; }
.recovery-stats { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; }
.recovery-stats span { color: #9ebdc4; font-size: 11px; }
.recovery-stats b { display: block; color: #f1dfb2; font: 28px Georgia, serif; margin-bottom: 5px; }
.recovery-summary .recovery-last { font-size: 12px; color: #aac7cf; }
.recovery-supplies { display: flex; flex-wrap: wrap; gap: 14px; padding: 14px 0; color: #b3e1c9; font-size: 12px; flex-shrink: 0; }
.recovery-choice { padding: 12px 14px; border-left: 2px solid #8cd6ee; background: #173f4b; color: #d0e1df; font-size: 13px; line-height: 1.5; flex-shrink: 0; }
[data-mode="defeat"] [data-recovery-index="0"]:disabled { background: #17303a; color: #b1c1c6; border-color: #536b75; box-shadow: none; }
[data-mode="defeat"] [data-recovery-index="0"]:disabled.selected { outline: 1px dashed #8ba4aa; outline-offset: 1px; }
[data-layout="menu"][data-mode="defeat"] #commandPanel { display: flex; flex-wrap: nowrap; width: 100%; max-width: 100%; align-items: center; overflow: visible; }
[data-layout="menu"][data-mode="defeat"] #commandPanel .cmd { flex: 1; min-width: 0; }
@media (max-width: 900px), (max-height: 680px) {
  .recovery-body { gap: 16px; }
  .recovery-lede { margin: 7px 0 10px; font-size: 12px; }
  .recovery-company { padding: 8px; }
  .recovery-company > .art-portrait { width: 95px; height: 110px; }
  .recovery-company > strong { font-size: 17px; }
  .recovery-company > p { font-size: 13px; margin: 7px 0; }
  .recovery-portraits { margin-top: 5px; }
  .recovery-portraits .art-portrait { height: 42px; }
  .recovery-summary h2 { font-size: 17px; margin-bottom: 6px; }
  .recovery-summary p { font-size: 11px; line-height: 1.4; margin: 6px 0; }
  .recovery-summary section { padding-bottom: 7px; margin-bottom: 7px; }
  .recovery-summary .recovery-last { font-size: 10px; }
  .recovery-stats { padding: 6px 0; gap: 6px; }
  .recovery-stats b { font-size: 22px; }
  .recovery-stats span { font-size: 9px; }
  .recovery-supplies { padding: 9px 0; gap: 9px; font-size: 10px; }
  .recovery-choice { padding: 8px 10px; font-size: 11px; }
  [data-mode="defeat"] .command-panel { max-width: 100%; }
}
[data-layout="menu"] .command-panel { max-width: 58%; flex-shrink: 0; }
[data-layout="story"] .command-panel, [data-layout="menu"] .command-panel { display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: center; border: 0; overflow: auto; padding: 2px; max-height: 100%; }
[data-layout="menu"] .command-panel { align-content: safe center; }
[data-mode="trade"] .menu-overlay { display: flex; flex-direction: column; }
#menuOverlay > .service-commands { display: grid; grid-template-columns: 1fr 1fr; align-content: start; justify-content: initial; gap: 9px; max-width: none; max-height: none; flex: 1; min-height: 0; padding: 10px 0; }
.service-commands .cmd { min-height: 48px; padding: 10px 14px; }
[data-layout="story"] .cmd, [data-layout="menu"] .command-panel .cmd { min-width: 110px; }
.menu-overlay { inset: 3% 3% 13%; border: 1px solid #b4945a; box-shadow: 0 16px 50px #00111c99; border-radius: 5px; background: #0d2b36fa; padding: 20px; }
.menu-title { font-family: Georgia, serif; text-shadow: none; color: #f5dfac; }
.dialogue-menu { padding: 22px 6%; }
.dialogue-stage { margin-top: 14px; }
.dialogue-person .art-portrait { max-height: 350px; }
.dialogue-speech { border: 0; border-left: 2px solid #d3b471; background: #071e29ca; padding: 16px 20px; }
.dialogue-speech p { font-size: clamp(14px, 1.65vw, 21px); line-height: 1.5; }
.dialogue-menu .menu-subtitle { margin-bottom: 0; }
.roster-row { border-radius: 3px; }
.party-row { padding: 9px; border-color: #446c79; }
.party-row .art-portrait { width: 45px; height: 54px; }
.party-row { grid-template-columns: 45px minmax(0, 1fr) auto; }
.company-identity { display: flex; align-items: center; gap: 16px; padding: 12px 0 0; margin-top: 12px; border-top: 1px solid #52717a; }
.company-identity > .art-portrait { width: 70px; height: 85px; }
.company-identity strong { font: 20px Georgia, serif; color: #f3dba5; }
.company-identity p { font-size: 13px; color: #c1dbdb; margin: 6px 0; }
.company-identity small { font-size: 12px; color: #99b9c0; }
.build-menu { padding: 18px 22px; }
.build-back { display: none; }
.build-summary { gap: 16px; padding-bottom: 10px; margin: 8px 0; border-bottom: 1px solid #53747b; }
.build-summary > .art-portrait { width: 85px; height: 100px; }
.hero-identity { flex: 1; min-width: 0; display: grid; gap: 5px; font-size: 13px; }
.hero-identity > strong { color: #cde7e6; }
.hero-identity > small { color: #a2bfc5; font-size: 11px; }
.hero-statline { display: flex; gap: 18px; margin: 3px 0; }
.hero-statline span { font-size: 10px; }
.hero-statline b { color: #fae5b5; font: 23px Georgia, serif; display: block; }
.point-wallet { display: flex; gap: 18px; text-align: center; color: #f7daa2; }
.point-wallet strong { font: 30px Georgia, serif; }
.point-wallet small { display: block; color: #abcbd1; font: 11px "Trebuchet MS", sans-serif; }
.build-explanation { flex-shrink: 0; color: #c9dfdd; font-size: 13px; line-height: 1.4; margin: 9px 0; }
.build-menu > .menu-subtitle { display: none; }
.build-choice-preview { flex-shrink: 0; margin-top: 9px; padding: 9px 12px; border-left: 2px solid #8cd9f6; background: #173d49; }
.build-choice-preview strong, .build-choice-preview span { display: block; font-size: 13px; line-height: 1.3; }
.build-choice-preview span { color: #b7cfd2; margin-top: 4px; font-size: 11px; }
.talent-tree { border-radius: 3px; border-color: #4c7585; }
.upgrade-row { border-color: #3d606d; border-radius: 3px; padding: 10px; }
.upgrade-row:hover:not(.selected) { border-color: #8bcee8; background: #1b4450; }
.growth-invitation { border-left: 2px solid #92d5bb; margin: 12px 0 0; padding: 9px 14px; background: #183e43; flex-shrink: 0; }
.growth-invitation strong { color: #d4efda; font: 18px Georgia, serif; }
.growth-invitation p, .growth-invitation span { font-size: 12px; color: #bdd6d3; line-height: 1.4; margin: 6px 0; }
.oath-outcome { color: #f0deb1; font: 15px/1.4 Georgia, serif; margin: 4px 0 12px; }

[data-layout="combat"] .hud { grid-template-columns: 1.35fr .9fr 1fr; }
[data-layout="combat"] .hero-block { position: relative; padding-left: 85px; }
[data-layout="combat"] .hero-block > .kicker { display: none; }
.active-hero-portrait { position: absolute; left: 0; top: 0; width: 78px; text-align: center; }
.active-hero-portrait .art-portrait { width: 78px; height: 100px; }
.active-hero-portrait > span { display: block; font-size: 12px; color: #b1edce; }
[data-layout="combat"] .major { font-size: clamp(16px, 1.7vw, 22px); }
[data-layout="combat"] .minor { font-size: 11px; line-height: 1.3; }
[data-layout="combat"] .battle-member { font-size: 11px; border-radius: 3px; padding: 5px; }
[data-layout="combat"] .battle-member small { font-size: 10px; }
[data-layout="combat"] .round-readout { font-size: 10px; margin: 7px 0; }
[data-layout="combat"] .log-line { font-size: 13px; line-height: 1.5; }
.battle-lesson { font-size: 13px; line-height: 1.5; color: #e3e7d7; margin: 6px 0; }
.battle-lesson:not([hidden]) + .log-line { font-size: 10px; color: #9bb9bf; max-height: 2.7em; overflow: auto; }
[data-layout="combat"] .command-panel .cmd { font-size: 14px; }
[data-layout="combat"] .command-panel { grid-template-columns: 1fr; gap: 7px; }
[data-layout="combat"][data-mode="action"] .command-panel, [data-layout="combat"][data-mode="ability"] .command-panel { grid-template-columns: 1fr 1fr; }
.battle-objective { border: 0; border-left: 2px solid #a8d7ce; left: 2%; right: 2%; background: #0a2933ed; }
.battle-objective > span { font-size: .85em; color: #bad4d5; }
.combat-advice { font-size: 12px; margin-top: 7px; padding-top: 6px; }
.rotate-board, .combat-guidance-toggle, .chart-overview { background: #092631ed; border-color: #66808a; }
.combat-sound-toggle { position: absolute; top: 12px; right: 132px; z-index: 2; font-size: clamp(10px, 1.05vw, 13px); background: #092631ed; }
.combat-sound-toggle[aria-pressed="false"] { color: #aac0c9; }
.finale-announcement { left: 22%; right: 22%; top: 6%; }
.save-code-actions,.save-code-entry { display:flex;gap:10px;align-items:center;margin:10px 0; }
#playerCodeForm label { display:block;color:#d8c79c; }
#playerCodeInput { width:180px; padding:10px; font:24px monospace;letter-spacing:3px;color:#f2e4b9;background:#092633;border:1px solid #9fc4cf; }
.save-file-label { display:flex;flex-direction:column;gap:5px; }
.save-file-label input { max-width:240px;font-size:11px; }
.save-code-status { color:#c8e7d4;min-height:20px; }
.save-code-preview { padding:12px;border:1px solid #a8c7bb;background:#123944; }
.save-code-preview strong span { font:26px monospace;letter-spacing:3px;color:#ffe0a0; }
.save-code-preview .cmd { margin-right:7px; }
.save-code-list { margin-top:15px;max-height:160px;overflow:auto; }
.save-code-list>div { display:flex;gap:7px;margin-top:6px; }
.patron-portrait { float:right;width:120px;height:145px;margin:0 10px 10px; }
.patron-portrait .art-portrait { width:100%;height:100%; }
.patron-steps { border-left:2px solid #9fcebd;padding-left:15px; }
.patron-steps .complete { color:#a9e3ba; }
.patron-journal,.atlas-journal { border-top:1px solid #69959f;margin-top:14px;padding-top:9px; }
.patron-journal span { display:block;font-size:12px;color:#c2d6d3; }
.atlas-pillars { display:flex;gap:8px;margin:8px 0; }
.atlas-pillars>span { flex:1;padding:7px;border:1px solid var(--god-color);color:var(--god-color); }
.atlas-pillars b { float:right; }
.atlas-cards { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px; }
.atlas-cards small { display:block;font-size:10px;line-height:1.3;margin-top:5px; }
.atlas-brief { display:flex;gap:18px;margin-top:14px;align-items:flex-start; }
.atlas-brief>div:first-child { flex:0 0 120px;height:170px; }
.atlas-brief .art-portrait { width:100%;height:100%; }
.atlas-brief h2 { margin:0;font:20px/1.3 Georgia,serif;color:#f0dba8; }
.atlas-brief p { font-size:13px;line-height:1.4; }
.atlas-victory { color:#b3ebc6; }
.pantheon-tabs { display:flex;gap:6px;margin:10px 0; }
.pantheon-tabs .cmd { flex:1; }
.pantheon-layout { display:grid;grid-template-columns:minmax(180px,.8fr) minmax(0,2fr);gap:20px;align-items:start; }
.pantheon-list { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px; }
.pantheon-list .cmd { text-align:left;min-width:0;overflow-wrap:anywhere; }
.pantheon-list small { display:block;margin-top:4px;font-size:10px;line-height:1.3; }
.pantheon-profile { min-width:0; }
.pantheon-profile h2 { margin:0;font:25px Georgia,serif;color:#f3dda5; }
.pantheon-profile h3 { margin:12px 0 5px;font-size:16px;color:#d7d9b7; }
.pantheon-profile p { font-size:14px;line-height:1.45;margin:7px 0; }
.pantheon-portrait { float:right;width:105px;height:135px;margin:0 0 9px 12px; }
.pantheon-portrait .art-portrait { width:100%;height:100%; }
.divine-sigil { width:100%;height:100%;color:#edce88;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round; }
.divine-sigil>circle:first-child { fill:#123a46; }
.divine-sigil g { stroke-width:2.3; }
.dialogue-person>.divine-sigil { width:80%;height:80%;max-height:210px;display:block;margin:auto; }
.divine-domain { color:#b2e4df; }
.divine-thread { border-left:2px solid #87b9bc;padding-left:10px;clear:both; }
.divine-request { clear:both;border-top:1px solid #5a878d;margin-top:12px;padding-top:5px; }
.divine-steps { display:grid;gap:5px;font-size:13px;border-left:2px solid #9fcdbb;padding-left:10px; }
.divine-steps .complete { color:#ade6be; }
.divine-traditions { clear:both;margin-top:14px;border-top:1px solid #527e87;padding-top:9px;font-size:12px;line-height:1.5; }
.divine-allies-link { margin-top:10px; }
.champion-choice,.patron-expedition { clear:both;border-top:1px solid #688e88;margin-top:12px;padding-top:5px; }
.champion-choice { border-color:#bdac70; }
.champion-choice .cmd { margin:4px 6px 4px 0; }
.champion-note { color:#edd79d;font-size:12px; }
.accord-actions { display:flex;gap:7px;flex-wrap:wrap; }
.adventure-rules,.divine-origin { clear:both;margin:10px 0;font-size:12px;line-height:1.4;color:#c8d9d3; }
.adventure-rules summary,.divine-origin summary { cursor:pointer;color:#d9cba6; }
.divine-origin { clear:none; }
.champion-preview { color:#edd9a5;border-left:2px solid #bda868;padding-left:8px; }
.divine-journal { margin-bottom:12px;border-bottom:1px solid #69959f;padding-bottom:10px; }
.divine-journal h3 { margin:0 0 6px; }
.divine-journal-heading { display:flex;justify-content:space-between;align-items:center;gap:10px; }
.divine-journal-heading .cmd { font-size:12px; }
.divine-journal summary { font-size:12px;color:#dfd4b0;cursor:pointer; }
.divine-journal p { font-size:12px;line-height:1.4; }
.divine-journal span { display:block;color:#c1d9d2; }
.pantheon-controls { font-size:12px;color:#d7ded4;padding:7px; }
[data-mode="pantheon"] .hud .log-block { display:none; }
[data-mode="pantheon"] .menu-overlay { overflow-y:auto; }
[data-mode="pantheon"] .command-panel { max-width:100%; }
@media(max-width:900px),(max-height:680px){.pantheon-layout{grid-template-columns:minmax(150px,.8fr) minmax(0,2fr);gap:12px}.pantheon-list{gap:4px}.pantheon-list .cmd{font-size:11px;padding:5px}.pantheon-list small{font-size:9px}.pantheon-profile h2{font-size:21px}.pantheon-profile h3{font-size:14px}.pantheon-profile p{font-size:12px}.pantheon-portrait{width:75px;height:95px}.pantheon-tabs .cmd{font-size:12px;padding:6px}.divine-steps{font-size:11px}.pantheon-controls{font-size:10px}}
[data-mode="savecodes"] .hud .log-block,[data-mode="atlas"] .hud .log-block,[data-mode="patrons"] .hud .log-block { display:none; }
[data-mode="savecodes"] .command-panel,[data-mode="atlas"] .command-panel,[data-mode="patrons"] .command-panel { max-width:100%; }
.captain-note { color:#c9dfd6;font-size:12px;line-height:1.4; }
[data-mode="savecodes"] .menu-overlay,[data-mode="patrons"] .menu-overlay,[data-mode="atlas"] .menu-overlay { overflow-y:auto; }
[data-layout="title"] #commandPanel { flex-wrap:wrap; }
@media(max-width:900px),(max-height:680px){.atlas-cards{gap:4px}.atlas-cards .cmd{padding:5px;font-size:11px}.atlas-cards small{font-size:9px}.atlas-brief{gap:10px;margin-top:8px}.atlas-brief>div:first-child{flex-basis:70px;height:110px}.atlas-brief h2{font-size:16px}.atlas-brief p{font-size:11px}.atlas-pillars>span{padding:4px;font-size:11px}.save-code-preview{padding:7px}.save-code-preview p,.save-code-status{font-size:12px}.patron-portrait{width:90px;height:105px}}
.tartaros-objective .tartaros-bearer { color: #b6e7f2; font-size: .85em; margin-top: 2px; }
.tartaros-objective .tartaros-checks { flex-wrap: nowrap; }
.tartaros-checks .cue-step { flex: 1; flex-direction: column; align-items: flex-start; gap: 1px; }
.tartaros-checks .cue-step > span { font-size: .9em; }
.tartaros-checks .cue-step > b { color: inherit; }
.tartaros-role { float: right; color: #b9f1ee; font: normal 8px/1.5 "Trebuchet MS",sans-serif; padding-left: 4px; }
.dialogue-menu[data-scene^="tartaros"] { background: radial-gradient(ellipse at 50% 65%, #6c77a347, transparent 60%), linear-gradient(155deg, #181b35fa, #153e46fa); }
.ending-menu { display: flex; flex-direction: column; align-items: center; text-align: center; overflow-y: auto; background: radial-gradient(ellipse at 50% 35%, #5a807d55, transparent 65%), linear-gradient(#102e3bfa,#09232efa); }
.ending-menu .menu-title { font-size: clamp(24px,3.2vw,40px); }
.ending-menu .scene-location { margin: 5px 0 12px; }
.ending-emblem { font: 42px Georgia,serif; color: #efd59b; margin: 10px 0; }
.ending-lead { font: clamp(17px,2.2vw,27px)/1.4 Georgia,serif; color: #f7e3b6; margin: 5px 0 12px; }
.ending-company { display: flex; justify-content: center; width: 88%; flex-shrink: 0; height: 155px; margin: 3px 0 12px; }
.ending-company .art-portrait { width: 16.66%; height: 100%; filter: drop-shadow(0 10px 8px #021822); }
.ending-menu > p:not(.ending-lead) { color: #c0d8d8; line-height: 1.5; font-size: 14px; max-width: 800px; margin: 7px 0; }
.ending-menu .ending-branch { color: #a9d2c6 !important; }
.ending-letter { display: flex; gap: 12px; align-items: center; text-align: left; width: min(94%,800px); margin: 4px 0 8px; padding: 8px 14px; border-left: 2px solid #dbc38a; background: #092532a6; color: #f4dfb2; font: 15px/1.5 Georgia,serif; }
.ending-letter > .art-portrait { width: 55px; height: 66px; flex-shrink: 0; }
.ending-letter cite { display: block; color: #add3da; font: normal 11px/1.6 "Trebuchet MS",sans-serif; }
.ending-deeds { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); width: min(96%,920px); gap: 8px; text-align: left; }
.ending-deeds p { margin: 4px 0; padding: 7px 9px; border-top: 1px solid #8cb8b0; background: #173d4755; color: #d2e4dc; font: 12px/1.4 "Trebuchet MS",sans-serif; }
.ending-stats { display: flex; justify-content: center; gap: 48px; padding: 12px 0; }
.ending-stats span { font-size: 12px; color: #a5c5ce; }
.ending-stats b { display: block; font: 28px Georgia,serif; color: #f1dfb3; padding-bottom: 5px; }
.ending-menu .ending-close { font: 15px/1.5 Georgia,serif !important; color: #ecd8aa !important; }
[data-mode="ending"] .hud .log-block { display: none; }
[data-mode="ending"] .command-panel { max-width: 100%; }
@media (max-width:900px),(max-height:680px) {
  .finale-announcement { left: 16%; right: 20%; top: 7%; }
  .ending-menu .scene-location { margin: 2px 0 6px; font-size: 10px; }
  .ending-menu .menu-title { font-size: 25px; }
  .ending-emblem { font-size: 23px; margin: 4px 0; }
  .ending-lead { font-size: 18px; margin: 4px 0 7px; }
  .ending-company { height: 80px; margin-bottom: 5px; }
  .ending-letter { gap: 8px; padding: 5px 9px; font-size: 12px; line-height: 1.4; margin-bottom: 4px; }
  .ending-letter > .art-portrait { width: 36px; height: 43px; }
  .ending-letter cite { font-size: 9px; }
  .ending-deeds { gap: 5px; }
  .ending-deeds p { font-size: 10px; line-height: 1.3; padding: 5px 6px; }
  .ending-menu > p:not(.ending-lead) { font-size: 11px; margin: 5px 0; line-height: 1.4; }
  .ending-stats { padding: 7px 0; gap: 30px; }
  .ending-stats b { font-size: 23px; }
  .ending-stats span { font-size: 10px; }
  .ending-menu .ending-close { font-size: 12px !important; }
  [data-mode="ending"] .command-panel { max-width: 100%; }
}

@media (max-width: 900px), (max-height: 680px) {
  .hud { padding: 7px 5px; }
  .hud-block { padding: 4px 9px; }
  .major { font-size: 17px; }
  .minor { font-size: 11px; }
  .controls-hint { font-size: 9px; margin-top: 5px; }
  .journey-call { width: 34%; padding: 11px 13px; top: 12%; }
  .journey-call h2 { font-size: 19px; }
  .journey-call p { font-size: 11px; line-height: 1.4; }
  .journey-call small { font-size: 10px; }
  .oath-stops { gap: 4px; padding: 10px 0; }
  .oath-stops li { font-size: 9px; }
  .journey-call .cmd { font-size: 11px; min-height: 30px; }
  .menu-overlay { padding: 12px; }
  [data-layout="menu"] .command-panel .cmd { min-width: 72px; min-height: 32px; padding: 5px 7px; font-size: 12px; }
  [data-layout="menu"] .command-panel { max-width: 65%; }
  .dialogue-menu { padding: 15px 5%; }
  .dialogue-stage { margin-top: 6px; }
  .dialogue-speech { padding: 10px 14px; }
  .dialogue-speech p { font-size: 15px; }
  .build-summary > .art-portrait { width: 60px; height: 72px; }
  .build-summary { gap: 12px; padding-bottom: 6px; }
  .hero-identity { font-size: 11px; gap: 2px; }
  .hero-statline { gap: 13px; }
  .hero-statline b { font-size: 18px; }
  .point-wallet { gap: 9px; }
  .point-wallet strong { font-size: 23px; }
  .point-wallet small { font-size: 10px; }
  .build-explanation { font-size: 11px; margin: 6px 0; }
  .build-choice-preview { padding: 6px 9px; margin-top: 6px; }
  .company-identity { padding-top: 6px; margin-top: 6px; }
  .company-identity > .art-portrait { width: 45px; height: 55px; }
  .company-identity strong { font-size: 16px; }
  .company-identity p, .company-identity small { font-size: 10px; }
  .party-row { padding: 5px 7px; }
  .party-row .art-portrait { height: 40px; width: 34px; }
  .party-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
  [data-layout="combat"] .hero-block { padding-left: 58px; }
  .active-hero-portrait { width: 54px; }
  .active-hero-portrait .art-portrait { width: 54px; height: 77px; }
  .active-hero-portrait > span { font-size: 10px; }
  [data-layout="combat"] .major { font-size: 15px; }
  [data-layout="combat"] .minor { font-size: 10px; }
  [data-layout="combat"] .battle-member { font-size: 10px; padding: 3px; }
  [data-layout="combat"] .battle-member small { font-size: 9px; }
  [data-layout="combat"] .log-line { font-size: 11px; line-height: 1.4; }
  .battle-lesson { font-size: 11px; line-height: 1.4; }
  [data-layout="combat"] .command-panel .cmd { font-size: 12px; min-height: 30px; padding: 4px 7px; }
  .growth-invitation { padding: 7px 10px; margin-top: 7px; }
  .growth-invitation strong { font-size: 15px; }
  .growth-invitation p, .growth-invitation span { font-size: 11px; }
  [data-layout="title"] #commandPanel .cmd { font-size: 18px; min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) { .cmd { transition: none; } .title-company .art-portrait { animation: none; } }
.soul-chart-button { position:absolute;right:19px;top:70px;width:99px;padding:3px 6px;background:#0c2933ed;z-index:5; }
.soul-chart-button>span { display:block;font-size:10px;color:#e9d9ac; }
.soul-scale { text-align:center;color:#f0d9a7; }
.soul-scale svg { display:block;width:245px;height:112px;max-width:100%;margin:auto; }
.soul-scale strong { display:block;font:19px Georgia,serif; }
.soul-scale>span { display:block;margin-top:4px;font-size:11px;line-height:1.4;color:#c5d9d6; }
.soul-scale.compact svg { width:77px;height:37px; }
.soul-scale.compact strong { font:11px Georgia,serif; }
.soul-beam { transition:transform .7s ease; }
.soul-overview { display:grid;grid-template-columns:245px 1fr;align-items:center;gap:20px; }
.soul-overview p { font-size:13px;line-height:1.5; }
.soul-marks { display:flex;gap:7px; }
.soul-marks>span { flex:1;border-left:2px solid var(--soul-color);padding:6px;font-size:11px;color:#ccdad9; }
.soul-marks b { display:block;color:var(--soul-color);margin-bottom:4px; }
.soul-tabs { display:flex;gap:5px;flex-wrap:wrap;margin:13px 0; }
.soul-tabs .cmd { font-size:11px;padding:7px;flex:1; }
.soul-menu h2 { font:21px Georgia,serif;color:#eddaad;margin:12px 0 5px; }
.soul-menu>p { font-size:13px;line-height:1.4; }
.soul-options { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;margin-top:12px; }
.soul-option { text-align:left;white-space:normal;line-height:1.4;padding:12px;border-top:2px solid var(--soul-color); }
.soul-option small,.soul-option strong,.soul-option span,.soul-option em { display:block; }
.soul-option small { color:var(--soul-color);font-size:11px; }
.soul-option strong { font:17px/1.3 Georgia,serif;margin:6px 0; }
.soul-option span { font-size:12px; }
.soul-option em { font-style:normal;font-size:11px;color:#e7caa2;margin-top:12px; }
.soul-option:disabled { opacity:.65; }
.soul-option.selected small,.soul-option.selected em { color:#24434b; }
.soul-patron-echo { border-left:2px solid #c1a7dc;padding-left:9px; }
.soul-history { margin-top:14px;font-size:12px; }
.soul-recorded { border-left:2px solid #a8d5bf;padding-left:10px;color:#b9e3c8; }
.soul-journal { border-bottom:1px solid #6498a3;margin-bottom:12px;padding-bottom:10px; }
.soul-journal button { display:flex;align-items:center;gap:15px;width:100%;text-align:left; }
.soul-journal small { display:block;margin-top:5px;font-size:11px; }
.soul-ending-scale { float:right;width:240px;margin:0 0 15px 20px; }
.soul-controls { font-size:11px;color:#d3dccb; }
[data-mode="soul"] .hud .log-block { display:none; }
[data-mode="soul"] .command-panel { max-width:100%; }
[data-mode="soul"] .menu-overlay { overflow-y:auto; }
@media(max-width:900px),(max-height:680px){.soul-overview{grid-template-columns:170px 1fr;gap:12px}.soul-scale svg{width:170px;height:80px}.soul-overview p{font-size:11px}.soul-marks{gap:3px}.soul-marks>span{font-size:10px;padding:4px}.soul-menu h2{font-size:18px}.soul-menu>p{font-size:12px}.soul-tabs{margin:9px 0}.soul-tabs .cmd{padding:5px;font-size:10px}.soul-option{padding:8px}.soul-option strong{font-size:15px}.soul-option span{font-size:11px}.soul-chart-button{right:12px;top:64px;width:88px}.soul-ending-scale{width:170px}.soul-option em{margin-top:8px}}

/* Towns and the sacred year share one readable ledger. */
[data-mode="year"] .hud .log-block{display:none}
[data-mode="year"] .command-panel{max-width:100%;grid-template-columns:1fr auto;align-items:center}
.year-controls{font-size:12px;color:#c1dce2}
.year-menu{overflow-y:auto;background:radial-gradient(ellipse at 10% 0%,#85764444,transparent 60%),#102c38fa}
.year-menu>p,.town-stock-note{font-size:13px;line-height:1.5;color:#c3d9dd}
.year-summary{display:grid;grid-template-columns:minmax(180px,1fr) 2fr;gap:18px;padding:14px 0;border-bottom:1px solid #56717b}
.year-date{display:flex;flex-direction:column;gap:5px;color:#d0e8ec}
.year-date strong{font:26px Georgia,serif;color:#f2db9f}
.year-date small{color:#a4c3ce}
.year-summary p{font-size:12px;line-height:1.5;margin:0 0 6px}
.year-tabs{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin:12px 0}
.year-tabs .cmd{font-size:12px;padding:8px 4px}
.year-tabs .selected,.year-action.selected{background:#efd080;color:#193746;border-color:#8dd7f3;box-shadow:inset 0 0 0 1px #8dd7f3}
.company-synergy{display:flex;align-items:center;gap:14px;margin-top:10px}
.company-synergy label{font-size:12px;min-width:180px}
.company-synergy meter{display:block;width:100%;height:12px;accent-color:#9ed6cb}
.company-synergy small{font-size:11px;color:#adcdd6;line-height:1.5}
.zodiac-strip{display:grid;grid-template-columns:repeat(14,1fr);gap:3px;margin:12px 0}
.zodiac-strip span{text-align:center;background:#08202b;border:1px solid #365865;color:#97b7c3;padding:5px 0;font-size:22px}
.zodiac-strip .now{color:#ffe8ad;background:#3a4d46;border-color:#e2c37e}
.zodiac-strip small{display:block;font:9px Arial,sans-serif;margin-top:3px}
.year-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0}
.year-action{display:flex;flex-direction:column;align-items:flex-start;text-align:left;padding:12px;gap:6px;white-space:normal}
.year-action strong{font:18px Georgia,serif}
.year-action span{font-size:12px;line-height:1.5;opacity:.9}
.year-action:disabled{opacity:.6;cursor:default}
.bond-list{display:grid;grid-template-columns:1fr 1fr;gap:4px 12px;margin:8px 0}
.bond-list p{font-size:12px;margin:0;padding:8px;background:#08212c;border-left:2px solid #84b6be;line-height:1.4}
.bond-list .bond-warning{border-color:#ed977f;color:#ffd0b1;background:#4a3032}
.year-log{font-size:12px;color:#aacbd2;padding:12px;border:1px solid #3c5d6a;margin-top:12px}
.year-log summary{cursor:pointer;color:#f0d59d}
.year-log p{line-height:1.4;margin:8px 0}
.year-combat-note{display:block;color:#b8d7df;font-size:10px;line-height:1.4}
.annual-prestige{padding:10px;border:1px solid #d0b476;background:#3a4d40;color:#ffe9ab;font-size:13px}
.year-status{color:#d4deb9;border-left:2px solid #91bbc1;padding-left:9px}
.result-consequences{flex-shrink:0;font-size:11px;line-height:1.35;color:#f2c9a3;max-height:66px;overflow:auto}
.result-consequences p{margin:3px 0}
.hero-block .soul-chart-button{position:static;width:100%;margin-top:7px;padding:3px 5px;display:flex;align-items:center;justify-content:center;gap:8px;min-height:32px}
.hero-block .soul-chart-button .soul-scale.compact svg{width:64px;height:28px}
.year-tabs{grid-template-columns:repeat(5,minmax(0,1fr))}
.element-overview{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:7px;margin:14px 0}
.element-card{border:1px solid #547c89;background:#0b2633;color:#d3e2dd;display:flex;flex-direction:column;align-items:center;gap:6px;padding:9px 6px;cursor:pointer;font:inherit;text-align:center}
.element-card svg{width:34px;height:34px}
.element-card strong{font:16px Georgia,serif;color:#f0dbad}
.element-card span{font-size:11px;line-height:1.4}
.element-card b{font-size:10px;color:#f3d98e}
.element-card.attuned{background:#384c41;border-color:#cbb475}
.element-card.inspected{outline:2px solid #86d0eb;outline-offset:1px}
.year-menu[data-year-tab="elements"] .year-summary,.year-menu[data-year-tab="elements"] .company-synergy{display:none}

/* The second chronicle keeps its map beside the next purposeful crossing. */
.underworld-menu{inset:4% 3% 27% 60%;overflow:auto;padding:15px;background:#112737f5}
.underworld-menu[data-descent-camp="true"]{left:4%}
.underworld-menu .menu-title{font-size:23px;line-height:1.15}
.underworld-menu>p{font-size:12px;line-height:1.5}
.descent-resources,.descent-relic{border-left:2px solid #c3a76f;padding:6px 9px;color:#f1d8a3}
.descent-menu-actions{display:flex;flex-direction:column;gap:7px;margin:12px 0}
.descent-menu-actions .cmd{text-align:left;white-space:normal;font-size:13px;line-height:1.4;padding:9px}
.descent-guide-art{display:flex;justify-content:center;gap:12px;margin:10px 0}
.descent-guide-art .art-portrait{height:110px;width:105px;object-fit:contain}
.descent-lost{font-size:12px;color:#c1d8df;margin:10px 0;padding:8px;border:1px solid #506c7b}
.descent-lost summary{cursor:pointer;color:#e4cc96}
.descent-log{color:#b2d4d8}
[data-mode="underworld"] .hud .log-block{display:none}
[data-mode="underworld"] .command-panel{max-width:100%}
.descent-cues{display:flex;flex-wrap:wrap;gap:4px;margin:4px 0}
.descent-cues>span{padding:2px 5px;border:1px solid #927d9f;background:#28253b;color:#dccfe5;font-size:9px}
.descent-cues>.ready{color:#f6de96;border-color:#8edbef;background:#39464b}
.descent-cues>.complete{color:#b6edcb;border-color:#8fc6a4;background:#204234}
.descent-cues>b{font-size:10px;color:#a9e7ec;align-self:center}
.guide-roster{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:3px;margin-top:4px}
.guide-roster>span{font-size:9px;color:#a7dce7;border-top:1px solid #65a3b3;padding-top:3px;text-align:center}
.guide-roster b,.guide-roster small{display:block;font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.guide-roster .down{opacity:.45}
.battle-speech{position:absolute;left:3%;right:3%;bottom:27%;z-index:9;display:flex;align-items:center;gap:16px;padding:15px 20px;border:1px solid #d5b67a;background:linear-gradient(110deg,#102f40f8,#211f36fa);box-shadow:0 8px 35px #0008;pointer-events:none}
.battle-speech>.art-portrait{width:120px;height:130px;object-fit:contain;flex-shrink:0}
.battle-speech strong{display:block;font:22px Georgia,serif;color:#ffe4ac;margin:5px 0}
.battle-speech small{font-size:11px;color:#9dcbd5;text-transform:uppercase;letter-spacing:.08em}
.battle-speech p{font:18px/1.45 Georgia,serif;color:#f3eddb;margin:8px 0}
.battle-speech span{font-size:11px;color:#9ec5d0}
.battle-banter{position:absolute;left:3%;top:17%;max-width:70%;z-index:3;display:flex;align-items:center;gap:8px;background:#0c2433e8;border-left:2px solid #c5a776;padding:5px 9px;pointer-events:none}
.battle-banter>.art-portrait{width:40px;height:45px;object-fit:contain;flex-shrink:0}
.battle-banter p{font-size:12px;line-height:1.4;color:#deebde;margin:0}
.battle-banter strong{color:#f4d9a4}
@media(max-width:900px),(max-height:680px){.underworld-menu{padding:10px}.underworld-menu .menu-title{font-size:19px}.underworld-menu>p{font-size:11px}.descent-menu-actions .cmd{font-size:11px;padding:7px}.battle-speech{padding:9px 12px;gap:10px}.battle-speech>.art-portrait{width:85px;height:95px}.battle-speech p{font-size:14px}.battle-speech strong{font-size:18px}.battle-speech small{font-size:9px}.battle-banter p{font-size:10px}.descent-guide-art .art-portrait{height:80px;width:72px}.guide-roster>span,.guide-roster b,.guide-roster small{font-size:8px}.descent-cues>span{font-size:8px}.battle-panel:has(.guide-roster) .battle-member{padding:2px 3px}.battle-panel:has(.guide-roster) .round-readout{margin:3px 0}}
.leaderboard-menu{overflow:auto}
[data-mode="leaderboard"] .hud .log-block{display:none}
[data-mode="leaderboard"] .command-panel{max-width:100%}
.leaderboard-menu>p{font-size:13px;line-height:1.5}
.score-summary{padding:13px;border:1px solid #ba9e65;background:#32473d;margin:15px 0;display:flex;flex-direction:column;gap:6px;color:#fae2ae}
.score-summary span{font-size:12px}
#leaderboardForm label{display:block;font-size:13px;margin:14px 0 6px;color:#d0e4e4}
#leaderboardForm small{display:block;margin-top:7px;font-size:11px;color:#aacbd3}
.leaderboard-entry{display:flex;gap:8px}
.leaderboard-entry input{flex:1;min-width:100px;background:#09202c;border:1px solid #7ba1ac;color:#fff0c6;padding:10px;font:16px Georgia,serif}
.leaderboard-status{color:#dfcf9d}
.leaderboard-table{overflow:auto;border:1px solid #50727f}
.leaderboard-table table{width:100%;border-collapse:collapse;font-size:13px}
.leaderboard-table th,.leaderboard-table td{padding:10px;text-align:left;border-bottom:1px solid #395c69}
.leaderboard-table th{color:#f4d59b;background:#102f3a}
.leaderboard-table td{color:#cee0df}
.leaderboard-table tr:nth-child(even){background:#09222e}
.remembered-echo .art-portrait,.ending-company .soul-held{filter:grayscale(1);opacity:.55}
@media(max-width:900px),(max-height:680px){.element-overview{gap:4px}.element-card{padding:6px 3px}.element-card strong{font-size:13px}.element-card span{font-size:10px}.element-card svg{width:25px;height:25px}.leaderboard-table th,.leaderboard-table td{padding:7px;font-size:11px}}
@media(max-width:900px),(max-height:680px){.year-summary{gap:10px;padding:8px 0;grid-template-columns:160px 1fr}.year-date strong{font-size:21px}.year-date span,.year-summary p{font-size:11px}.year-menu>p{font-size:12px}.year-tabs .cmd{font-size:10px;padding:6px 2px}.year-action{padding:8px}.year-action strong{font-size:15px}.year-action span{font-size:11px}.zodiac-strip span{font-size:18px}.zodiac-strip small{font-size:8px}.company-synergy small{font-size:10px}}
@media(prefers-reduced-motion:reduce){.soul-beam{transition:none}}
@media(max-width:900px),(max-height:680px){.soul-scale svg{height:65px}.soul-scale>span{font-size:9px;line-height:1.2}.soul-scale strong{font-size:17px}}

[data-mode="underworld"] #battleCanvas{height:89%;bottom:11%}
[data-mode="underworld"] .underworld-menu{bottom:13%}

[data-mode="battleSpeech"] .battle-objective,[data-mode="battleSpeech"] .combat-advice{visibility:hidden}

.guide-roster{position:absolute;left:2%;top:12%;width:24%;z-index:3;margin:0;padding:5px 7px;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px 7px;background:#102f3deb;border:1px solid #648e9a;border-radius:3px}
.guide-roster-title{grid-column:1/-1;font-size:8px;letter-spacing:.07em;color:#9cd9e6}
.guide-roster>span{padding-top:3px;text-align:left}
.guide-roster em{font-size:9px;font-style:normal;font-weight:normal;color:#d1e4dd}
@media(max-width:900px),(max-height:680px){.guide-roster{padding:4px 5px;top:12%;width:25%}.guide-roster em{font-size:8px}.guide-roster-title{font-size:7px}}

.underworld-team-readout{font-size:10px;color:#ade7e9;border-top:1px solid #5e95a377;margin-top:4px;padding-top:3px}
@media(max-width:900px),(max-height:680px){.underworld-team-readout{font-size:8px}}

/* Conditions stay legible without widening the party cards. */
.ailment-badge{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px;font-style:normal;color:#ffc5ba;background:#452a34;border-radius:3px;padding:2px 3px}
.condition-rules{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin:10px 0}
.condition-rules p{margin:0;padding:9px;border:1px solid #76959166;border-radius:6px;background:#102d39;font-size:12px;line-height:1.5}
.condition-rules strong{color:#aee3e9;white-space:nowrap}
.year-tabs{grid-template-columns:repeat(4,minmax(0,1fr))}
@media(max-width:900px),(max-height:680px){.condition-rules p{padding:6px;font-size:10px}.ailment-badge{font-size:8px}.year-tabs{gap:4px}}

.year-menu[data-year-tab="remedies"] .year-summary,.year-menu[data-year-tab="reputation"] .year-summary,.year-menu[data-year-tab="remedies"] .company-synergy,.year-menu[data-year-tab="reputation"] .company-synergy{display:none}
.regional-medicine-brief{font-size:10px!important;color:#b6d8d6!important;line-height:1.4!important;border-top:1px solid #537a8066;padding-top:5px;margin-top:6px}

.year-action.selected:disabled{background:#153540;color:#bdcfce;box-shadow:none;border-color:#657e87}

.regional-dialogue{overflow-y:auto}
.regional-dialogue[data-choice-stage="true"] .dialogue-stage{flex:none;height:100px;min-height:100px;margin-top:4px}
.regional-dialogue[data-choice-stage="true"] .dialogue-person .art-portrait{height:85px;max-height:85px}
.regional-dialogue[data-choice-stage="true"] .dialogue-speech{padding:6px 10px;margin-top:4px}
.regional-dialogue[data-choice-stage="true"] .dialogue-speech p{font-size:12px}
.regional-choices{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:9px;flex-shrink:0}
.regional-choices .cmd{display:flex;flex-direction:column;gap:6px;white-space:normal;text-align:left;padding:10px}
.regional-choices strong{font-size:15px}.regional-choices span{font-size:12px;line-height:1.4}
.regional-choices .selected{background:#efd080;border:2px solid #80c9ff;color:#173647}
.regional-choices .selected:disabled{background:#25414a;color:#b5c2c6}
.result-aftercare{font-size:11px;color:#bcdfd5;margin:5px 0;flex-shrink:0}
@media(max-width:900px),(max-height:680px){.regional-choices .cmd{padding:7px}.regional-choices strong{font-size:12px}.regional-choices span{font-size:10px}.regional-dialogue[data-choice-stage="true"] .dialogue-speech p{font-size:11px}}

@media(max-width:900px),(max-height:680px){[data-layout="combat"] .battle-party{grid-template-columns:repeat(4,minmax(0,1fr));gap:3px}[data-layout="combat"] .party-six .battle-party{grid-template-columns:repeat(3,minmax(0,1fr))}[data-layout="combat"] .battle-member{min-width:0;min-height:32px;padding:2px;font-size:9px}[data-layout="combat"] .battle-member small{font-size:8px;white-space:nowrap}.ailment-badge{font-size:7px;padding:1px}[data-layout="combat"] .round-readout{margin:3px 0;font-size:9px}}

.boss-warning.ailment-danger{margin:0 0 5px;padding:5px 7px;font-size:11px;line-height:1.3;border-left:3px solid #ffb86f;background:#50301b;color:#ffe3b4}
@media(max-width:900px),(max-height:680px){.boss-warning.ailment-danger{font-size:9px;padding:4px;margin-bottom:4px}}

.arc-choices:has(button:nth-child(3)){grid-template-columns:repeat(3,minmax(0,1fr))}.arc-choices .cmd{min-width:0}
[data-mode="target"] .log-block:has(.intercept-preview) .combat-advice{display:none}
.town-stories{margin-top:8px;padding-top:7px;border-top:1px solid #a9c8bf55}.town-stories>small{font-size:10px;letter-spacing:.12em;color:#e9d6a4}.story-lead.cmd{display:flex;align-items:center;gap:8px;text-align:left;width:100%;margin-top:5px;padding:7px;background:#183943;color:#f8ead0;border:1px solid #7cb9c6}.story-lead .art-portrait{width:43px;height:53px;object-fit:contain;flex-shrink:0}.story-lead>span{display:grid;gap:3px;min-width:0}.story-lead strong{font-size:12px}.story-lead span span{font-size:11px;line-height:1.35;color:#d3e1da}.story-lead:disabled{opacity:.65}.courier-chronicle{padding:10px;border:1px solid #93c4c1;margin:8px 0}.courier-support{position:absolute;top:65px;left:12px;max-width:360px;display:flex;align-items:center;gap:9px;padding:10px;background:#102d36f2;color:#fff0cb;border:1px solid #b7d6bf;border-left:4px solid #edca70;box-shadow:0 4px 16px #0005;pointer-events:none;z-index:9}.courier-support[hidden]{display:none}.courier-support .art-portrait{width:64px;height:80px;object-fit:contain}.courier-support small{display:block;font-size:9px;letter-spacing:.08em;color:#b4d9d7}.courier-support strong{display:block;font-size:12px;margin:4px 0}.courier-support p{font-size:12px;line-height:1.4;margin:0}.guide-roster>span .art-portrait{float:left;width:26px;height:34px;object-fit:contain;margin-right:5px}.guide-roster>span{min-height:38px}
.town-story-board{position:absolute;right:18px;top:82px;width:270px;max-height:45%;overflow:auto;background:#102e36f5;border:1px solid #aac6b4;box-shadow:0 5px 18px #0005;z-index:6;padding:8px}.town-story-board[hidden]{display:none}.town-story-board .town-stories{margin:0;border:0;padding-top:4px}.town-story-board .town-stories>small{display:none}.story-board-toggle{width:100%;background:none;border:0;color:#f0d08a;padding:3px;font:bold 13px Georgia;text-align:left;cursor:pointer}.story-board-toggle span{float:right;color:#a9d6e4}.courier-support{top:150px}.courier-support .art-portrait{height:65px}
.support-portraits{display:flex;flex-shrink:0}.support-portraits:has(img:nth-child(2)) .art-portrait{width:30px;height:55px}
[data-layout="story"] .courier-dialogue .dialogue-stage{height:180px;min-height:180px}[data-layout="story"] .courier-dialogue .dialogue-person .art-portrait{height:160px;max-height:160px}
@media(max-width:900px),(max-height:680px){.story-lead.cmd{padding:5px;gap:5px}.story-lead .art-portrait{width:30px;height:38px}.story-lead strong{font-size:10px}.story-lead span span{font-size:9px}.town-stories{margin-top:5px;padding-top:4px}.courier-support{top:43px;left:8px;max-width:255px;padding:6px}.courier-support .art-portrait{width:40px;height:52px}.courier-support strong,.courier-support p{font-size:10px}}
@media(max-width:900px),(max-height:680px){.town-story-board{right:15px;top:79px;width:225px;max-height:40%;padding:6px}.story-board-toggle{font-size:11px}.courier-support{top:145px;max-width:230px}[data-layout="story"] .menu-overlay.courier-dialogue .dialogue-stage{height:145px;min-height:145px}[data-layout="story"] .menu-overlay.courier-dialogue .dialogue-person .art-portrait{height:130px;max-height:130px}}
@media(max-width:900px),(max-height:680px){.arc-choices:has(button:nth-child(3)){grid-template-columns:1fr}.arc-choices .cmd{padding:6px}.arc-choices span{font-size:10px}.regional-dialogue:has(.arc-choices) .dialogue-stage{height:60px;min-height:60px}.regional-dialogue:has(.arc-choices) .dialogue-person .art-portrait{height:48px;max-height:48px}}
.enkidu-spirit .dialogue-person:last-child .art-portrait{filter:grayscale(.3) sepia(.3) hue-rotate(120deg) saturate(.8) drop-shadow(0 0 10px #8fe8ed);opacity:.72}
.eastern-leads.uruk-leads{top:auto;bottom:calc(25% + 12px)}
[data-layout="story"] .menu-overlay.uruk-dialogue .dialogue-stage{height:245px;min-height:245px}[data-layout="story"] .menu-overlay.uruk-dialogue .dialogue-person .art-portrait{height:225px;max-height:225px}.enkidu-spirit .dialogue-person:last-child .art-portrait{opacity:.9;filter:grayscale(.3) sepia(.3) hue-rotate(120deg) saturate(.8) brightness(1.3) drop-shadow(0 0 10px #8fe8ed)}@media(max-width:900px),(max-height:680px){[data-layout="story"] .menu-overlay.uruk-dialogue .dialogue-stage{height:200px;min-height:200px}[data-layout="story"] .menu-overlay.uruk-dialogue .dialogue-person .art-portrait{height:185px;max-height:185px}}



.eastern-leads.chart-panel-left{left:18px;right:auto}@media(max-width:900px),(max-height:680px){.eastern-leads.chart-panel-left{left:15px;right:auto}}

.game-shell[data-layout="menu"] .experience-tools,.game-shell[data-layout="story"] .experience-tools{visibility:hidden;}
.experience-tools{flex-wrap:wrap;}.controller-choices{display:grid;gap:6px;}.controller-choices .cmd{text-align:left;white-space:normal;}.controller-keys{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));gap:3px;}.controller-keys .cmd{margin:0;padding:5px;min-width:0;}.player-dialog output{display:block;min-height:40px;padding:8px;border:1px solid #86b5bd;margin:8px 0;overflow-wrap:anywhere;}
.game-shell[data-mode="pause"] .experience-tools{visibility:visible;top:12px;}
.game-shell[data-layout="combat"] .experience-tools{top:auto;bottom:calc(25% + 100px);}

/* Touch layouts use normal document flow so controls cannot cover menu choices. */
@media(max-width:700px), (pointer:coarse) and (max-height:500px){
  html,body{height:auto;min-height:100%;overflow:auto;}body{display:block;}
  .game-shell{display:flex;flex-direction:column;width:100%;min-height:100dvh;aspect-ratio:auto;border:0;outline:0;}
  .game-shell #battleCanvas{position:relative;inset:auto;width:100%;height:auto;aspect-ratio:16/9;order:1;touch-action:manipulation;}
  .experience-tools{position:relative;inset:auto;order:0;padding:7px;background:#091f29;}
  .experience-tools .cmd{min-height:40px;font-size:14px;}
  .game-shell[data-layout="combat"] .experience-tools{position:relative;inset:auto;}
  .game-shell[data-layout="chart"] .hud,.game-shell[data-layout="combat"] .hud{position:relative;inset:auto;height:auto;order:3;display:grid;grid-template-columns:1fr;gap:8px;padding:10px;}
  .game-shell .hud-block{min-height:0;max-height:none;}.game-shell .hud-block+.hud-block{border-left:0;}
  .game-shell .command-panel{max-height:none;overflow:visible;}.game-shell .command-panel .cmd{min-height:46px;font-size:15px;}
  .game-shell .journey-call{position:relative;inset:auto;order:2;width:100%;max-width:none;margin:0;}
  .game-shell .battle-objective{position:relative;inset:auto;order:2;max-height:none;width:100%;}
  .game-shell #easternLeads,.game-shell .town-story-board{position:relative!important;inset:auto!important;order:4;width:100%!important;max-height:340px!important;overflow:auto;}
  .game-shell .touch-controls,.force-touch .game-shell .touch-controls{display:flex;position:sticky;inset:auto;bottom:0;order:5;z-index:65;gap:5px;flex-wrap:wrap;background:#0b2935;padding:8px;}
  .touch-controls .cmd{flex:1 0 15%;min-width:44px;min-height:44px;}
  .game-shell[data-layout="title"] #battleCanvas{position:absolute;inset:0;width:100%;height:100%;opacity:.2;pointer-events:none;}
  .game-shell[data-layout="title"] .opening-title{position:relative;inset:auto;order:1;padding:16px 18px 0;min-height:0;background:transparent;}
  .game-shell[data-layout="title"] .title-eyebrow{margin-top:12px;}
  .game-shell[data-layout="title"] .title-company{position:relative;inset:auto;height:110px;margin-top:12px;}
  .game-shell[data-layout="title"] .title-footer,.game-shell[data-layout="title"] .title-save-note{position:relative;inset:auto;margin:12px 0;width:100%;}
  .game-shell[data-layout="title"] .hud{position:relative;inset:auto;order:2;height:auto;display:block;padding:10px 20px 20px;pointer-events:auto;}
  .game-shell[data-layout="title"] #commandPanel{position:relative;inset:auto;width:100%;padding:0;gap:8px;}
  .game-shell[data-layout="title"] #commandPanel .cmd{min-height:46px;font-size:18px;}
  .game-shell[data-layout="title"] .touch-controls,.game-shell[data-layout="story"] .touch-controls{display:none!important;}
  .game-shell .menu-overlay{position:fixed;inset:12px 8px 100px;z-index:80;padding:14px;overflow:auto;}
  .game-shell[data-layout="story"] .hud,.game-shell[data-layout="menu"] .hud{position:fixed;inset:auto 0 0;z-index:85;height:auto;min-height:70px;background:#0b2731;padding:10px;}
  .game-shell[data-layout="story"] #commandPanel{width:100%;display:flex;gap:8px;}
  .game-shell[data-layout="story"] #commandPanel .cmd{flex:1;}
  .game-shell[data-layout="menu"] .touch-controls{display:none!important;}
  .game-shell .dialogue-speech p{font-size:15px;line-height:1.5;}
  .game-shell .regional-choices .cmd{min-height:48px;font-size:14px;}
}
@media(pointer:coarse) and (max-height:500px){
  .game-shell[data-layout="story"] .menu-overlay{display:block;}
  .game-shell[data-layout="story"] .menu-overlay .dialogue-stage{float:left;width:34%;height:155px;min-height:155px;margin:5px 12px 8px 0;}
  .game-shell[data-layout="story"] .menu-overlay .dialogue-person .art-portrait{height:125px;max-height:125px;}
  .game-shell[data-layout="story"] .dialogue-speech{margin-left:35%;padding:6px 10px;}
  .game-shell[data-layout="story"] .dialogue-speech p{font-size:14px;line-height:1.4;}
  .game-shell[data-layout="story"] .regional-choices{clear:both;}
}
