/* Day boxes remain legible and centered without native browser title bubbles. */
.event-road{background:transparent;border:0;padding:2px;gap:3px;overflow:visible}
.event-road>span{display:flex;flex-direction:column;justify-content:center;position:relative;background:#f5dfb3;color:#63442c;border:1.5px solid #69452e;border-bottom-width:3px;border-radius:2px;cursor:help;padding:2px 0;outline-offset:2px}
.event-road>span.road-machine{background:#74a7a0;color:#233f3a}
.event-road>span.road-relic{background:#b7a0c4;color:#43324e}
.event-road>span.road-market{background:#cf9479;color:#512e23}
.event-road>span.road-boss{background:#a85860;color:#fff1cf}
.event-road>span.done{opacity:.65}
.event-road>span.current{flex:1.18;scale:1.1;background:#efbd47;outline:2px solid #573723;rotate:-2deg;color:#3f2c20;z-index:2;box-shadow:0 2px 0 #71481f66}
.event-road>span:focus-visible,.event-road>span:hover{filter:brightness(1.12);outline:2px solid #32867e}
.road-tooltip{position:fixed;z-index:10000;pointer-events:none;display:flex;flex-direction:column;gap:2px;box-sizing:border-box;width:260px;max-width:calc(100vw - 24px);padding:9px 16px 12px;background:#fff0ce;color:#473126;border:2px solid #67442e;border-radius:3% 5% 4% 2%;box-shadow:3px 4px 0 #39251d55;rotate:-1deg;font:17px PandaHand,system-ui}
.road-tooltip:before{content:'';position:absolute;top:-5px;left:16%;height:8px;width:32px;background:#e2bd65bb;rotate:-8deg}
.road-tooltip span{font-size:15px;color:#326f67}
.road-tooltip p{font:15px/1.3 PandaHand,system-ui;margin:4px 0 0;color:#473126}
.options-icon{display:inline-block;width:27px;height:27px;vertical-align:middle;flex:none;margin-right:4px;filter:drop-shadow(0 1px 0 #fff7)}
.icon-button .options-icon{width:29px;height:29px;margin:0}
dialog:has(.unit-sheet){box-sizing:border-box;width:min(760px,96vw);max-width:96vw;max-height:92dvh;overflow-x:hidden;overflow-y:auto;padding:clamp(10px,2vw,22px);scrollbar-gutter:stable}
.unit-sheet{width:100%;min-width:0;box-sizing:border-box}
.unit-sheet header{position:static!important;background:transparent!important;display:flex;align-items:center;gap:12px;padding:0 0 8px;border-bottom:2px dashed #94734d}
.unit-sheet header>div{min-width:0;flex:1}.unit-sheet header h2{overflow-wrap:anywhere;margin:0}
.unit-sheet header img{width:64px;height:64px;object-fit:contain;flex:none}.unit-sheet header button{flex:none}
.unit-sheet small{display:block;line-height:1.25;overflow-wrap:anywhere}
.unit-sheet dl{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px 18px}
.unit-sheet dl>div{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,auto);gap:6px;align-items:start;min-width:0}
.unit-sheet dt,.unit-sheet dd{min-width:0;overflow-wrap:anywhere;white-space:normal;line-height:1.25}.unit-sheet dd{text-align:right;margin:0;max-width:180px}
.scene-camp .encounter-dock{top:62px;bottom:44px;gap:10px;justify-content:center}
.scene-camp .encounter-options{flex:0 1 auto;width:min(96%,1000px);max-height:calc(100% - 55px);height:480px;align-items:stretch}
.encounter-options .route-choice{display:flex;flex-direction:column;min-height:0;gap:7px}
.route-choice>div.preview-frame{display:grid;place-items:center;flex:1 1 auto;min-height:0;padding:0;background:transparent;overflow:hidden}
.route-choice .encounter-preview{display:block;min-height:0;flex:none;object-fit:fill;border-radius:3px;pointer-events:none}
.encounter-options .route-choice h2{font-size:21px;margin:0;flex:none}
.encounter-options .route-choice ul{display:flex;flex:none;gap:8px;margin:0;min-height:26px;flex-wrap:wrap}
.encounter-options .route-choice li{font-size:14px;flex:0 1 auto;gap:4px}
.encounter-options .route-choice li img{width:28px;height:28px;object-fit:contain}
.route-choice>div{flex:none}.route-choice>div strong{font-size:16px}
.arena-zoom{position:fixed;inset:0;width:100vw;height:100dvh;z-index:9000;pointer-events:none;transform-origin:0 0;box-shadow:0 0 0 2px #63432a}
.arena-departure{position:fixed;inset:0;z-index:8999;pointer-events:none;background:#e5cc93;transform-origin:0 0;will-change:transform,opacity}
.arena-card-flight{position:fixed;inset:0;z-index:9000;pointer-events:none;transform-origin:0 0;will-change:transform,opacity}
.arena-card-flight *{animation:none!important;transition:none!important}
.battle-arriving .battle-top,.battle-arriving .battle-groups,.battle-arriving .battle-bottom{opacity:0}
.battle-top,.battle-groups,.battle-bottom{transition:opacity .14s ease-out}
.battle-group .enemy-counter{position:relative;flex:none;width:84px;max-width:84px;height:min(18px,90%);min-height:10px;overflow:hidden}
.enemy-counter-track{position:absolute;inset:0;background:#56342855;border-radius:2px;overflow:hidden}
.enemy-counter-track i{display:block;height:100%;background:#d63e2b;transition:width .2s linear}
.enemy-counter b{position:absolute;inset:0;display:grid;place-items:center;color:#fff4d4;font:900 12px/1 system-ui;text-shadow:0 1px 2px #37170d,1px 0 1px #37170d}
.enemy-single-health .enemy-counter-track>span{position:absolute;top:0;height:100%}
.enemy-single-heal{background:#b7fa82}.enemy-single-shield{background:repeating-linear-gradient(135deg,#80e3ed 0 3px,#348dbe 3px 5px)}
@media(max-height:350px){.battle-group .enemy-counter{width:76px;max-width:76px}.enemy-counter b{font-size:10px}}
@media(prefers-reduced-motion:reduce){.enemy-counter-track i{transition:none}}
.battle-group .health-tick{transition:none!important}
.battle-group .health-tick i{transition:height .2s linear!important}
.battle-group .health-tick b{transition:height .2s linear,bottom .2s linear,opacity .2s linear!important}
.battle-group .health-tick.depleted i,.battle-group .health-tick.depleted b{transition:none!important}
.health-tick b.is-empty,.enemy-counter-track>span.is-empty{opacity:0;pointer-events:none}
.battle-group .enemy-counter-track i{transition:width .2s linear!important}
.battle-group .enemy-single-heal,.battle-group .enemy-single-shield{transition:width .2s linear,left .2s linear,opacity .2s linear!important}
@media(max-height:550px) and (orientation:landscape){
 .event-road{gap:2px}.event-road>span{padding:1px 0;border-width:1px 1px 2px}.scene-top{gap:4px;padding-inline:5px}
 .icon-button .options-icon{width:23px;height:23px}.options-icon{width:19px;height:19px}
 .scene-camp .encounter-dock{top:43px;bottom:32px;gap:5px;left:2%;right:2%}
 .scene-camp .encounter-options{height:100%;max-height:calc(100% - 28px);gap:12px;width:98%}
 .scene-camp .encounter-dock>.ribbon-title{font-size:13px;margin:0;padding:3px 14px}
 .encounter-options .route-choice{gap:3px}.encounter-options .route-choice h2{font-size:14px}
 .encounter-options .route-choice li{font-size:10px}.encounter-options .route-choice li img{width:18px;height:18px}
 .encounter-options .route-choice ul{min-height:18px;gap:4px}.route-choice>div strong{font-size:11px}
 .route-choice button{min-height:25px;padding:2px 8px;font-size:12px}
 .unit-sheet header img{width:42px;height:42px}.unit-sheet header h2{font-size:20px}.unit-sheet header small{font-size:11px}
}
@media(max-width:650px){.unit-sheet dl{grid-template-columns:minmax(0,1fr)}.unit-sheet header{gap:6px}.unit-sheet header button{padding:3px 8px;font-size:12px}.unit-sheet dd{max-width:50vw}}

/* One choice uses the preview aspect ratio, not the full two-choice row. */
.encounter-options>.route-choice:only-child{flex:0 1 auto;max-width:100%;margin-inline:auto;box-sizing:border-box;min-width:0}
.route-choice>div.preview-frame{min-width:0;grid-template-columns:minmax(0,1fr);justify-items:center}
.route-choice .encounter-preview{max-width:100%;max-height:100%}

.route-choice .encounter-enemy{padding:0;min-height:0;min-width:0;width:30px;height:30px;flex:none;border:0;background:transparent;box-shadow:none}
.route-choice .encounter-enemy img{display:block;width:100%;height:100%;object-fit:contain}
@media(max-height:500px){.route-choice .encounter-enemy{width:20px;height:20px}}

/* Each species owns an equal column, portrait directly above its caption. */
.encounter-options .route-choice ul{display:grid;grid-template-columns:repeat(var(--enemy-columns,1),minmax(0,1fr));width:100%;align-items:start;justify-content:stretch;gap:8px;margin:0;padding:7px 0 0;list-style:none}
.encounter-options .route-choice li{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;min-width:0;gap:3px;text-align:center}
.route-choice li>span{width:100%;overflow-wrap:anywhere;text-align:center;line-height:1.1}
.route-choice .encounter-enemy{position:relative;overflow:visible;width:48px;height:44px;padding:0}
.ability-badges{display:inline-flex;gap:2px;align-items:center;justify-content:center;vertical-align:middle}
.encounter-enemy .ability-badges{position:absolute;top:-7px;left:calc(100% - 5px);width:max-content}
.ability-badge{display:inline-block;width:18px;height:18px;flex:none;border:1px solid #70523c;border-radius:45% 50% 42% 48%;background:#fff0d9;box-sizing:border-box}
.unit-sheet>.ability-badges{margin:3px 0 5px}.unit-sheet .ability-badge{width:25px;height:25px}
@media(max-height:500px){.route-choice .encounter-enemy{width:30px;height:28px}.ability-badge{width:13px;height:13px}.encounter-options .route-choice ul{padding-top:5px;gap:5px}.encounter-options .route-choice li{gap:2px;font-size:10px}}

.encounter-options .route-choice li .encounter-enemy>img{width:100%;height:100%;max-width:100%;object-fit:contain}
.encounter-enemy .ability-badges{left:50%;translate:-50% 0;top:-9px}
.encounter-options .route-choice .encounter-enemy{align-self:center}

.route-choice{position:relative}
.encounter-xp{position:absolute;top:10px;right:12px;z-index:1;display:flex;flex-direction:column;align-items:center;padding:3px 7px;background:#f9e6b9;color:#466e60;border:1.5px solid #806242;border-radius:4% 8% 3% 5%;rotate:1deg;font:700 15px/1.05 PandaHand,system-ui;pointer-events:none;box-shadow:1px 2px #62492e33}
.encounter-xp small{font-size:10px;color:#6e583d;font-weight:400}
.route-choice>div.preview-frame{position:relative}
@media(max-height:500px){.encounter-xp{top:6px;right:7px;font-size:12px;padding:2px 4px}.encounter-xp small{font-size:8px}}

.paper-tooltip{width:300px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);overflow:auto;box-shadow:3px 4px 0 #39251d55;animation:paper-tip-in .12s ease-out;rotate:-.5deg}
.paper-tooltip>img{float:left;width:48px;height:48px;object-fit:contain;margin:0 9px 4px 0}
.paper-tooltip strong{display:block;font:22px/1.05 PandaHand,system-ui;color:#8e472d}
.paper-tooltip p{white-space:pre-line;overflow-wrap:anywhere}
@keyframes paper-tip-in{from{opacity:0;translate:0 3px}to{opacity:1;translate:0 0}}
@media(max-height:400px){.paper-tooltip{padding:7px 13px;width:270px}.paper-tooltip strong{font-size:19px}.paper-tooltip p,.paper-tooltip span{font-size:13px}}

.encounter-enemy .ability-badges{left:calc(100% + 3px);top:50%;translate:0 -50%;flex-direction:column;gap:2px}
.encounter-xp{pointer-events:auto;cursor:help}

.squad-command-note{display:inline-flex;vertical-align:middle;align-items:center;gap:1px;margin-left:4px;height:21px;padding:1px 3px;border:1px solid #9a733d;border-radius:4px;background:#f5d488;color:#694825;cursor:help;white-space:nowrap}
.squad-command-note img{width:18px;height:18px;object-fit:contain}.squad-command-note>span{font:700 12px/1 system-ui}.squad-command-note.inactive{filter:grayscale(1);opacity:.55}
@media(max-height:500px){.squad-command-note{height:16px;margin-left:2px;padding:0 2px}.squad-command-note img{width:13px;height:13px}.squad-command-note>span{font-size:10px}}
@media(max-height:300px){.encounter-xp{flex-direction:row;gap:4px;top:2px;right:4px;padding:2px 4px;white-space:nowrap;font-size:11px}.encounter-xp small{font-size:8px}}
.paper-tooltip:before{top:1px}.paper-tooltip:has(>img){display:grid;grid-template-columns:48px minmax(0,1fr);column-gap:9px;row-gap:3px}.paper-tooltip:has(>img)>img{grid-column:1;grid-row:1/span 3;margin:0}.paper-tooltip:has(>img)>strong,.paper-tooltip:has(>img)>span,.paper-tooltip:has(>img)>p{grid-column:2}

.ribbon-title:has(.machine-reroll){position:relative;padding-right:120px}
.machine-reroll{position:absolute;right:6px;top:50%;translate:0 -50%;display:inline-flex;align-items:center;gap:4px;min-height:29px;padding:3px 7px!important;font:16px/1 PandaHand,system-ui!important}
.machine-reroll img{width:23px;height:23px;object-fit:contain}
@media(max-height:500px){.ribbon-title:has(.machine-reroll){padding-right:100px}.machine-reroll{font-size:12px!important;min-height:23px;padding:1px 5px!important;right:3px}.machine-reroll img{width:18px;height:18px}}
.battle-group.ally .health-tick.depleted{height:3px;min-height:3px;background:#858079;box-shadow:0 1px 0 #fff5;opacity:.9}

/* One half-width bar per ally, extending in a single unbounded row. */
.battle-group.ally .health-ticks{display:flex;flex-wrap:nowrap;width:max-content;max-width:none;flex-shrink:0;align-items:end;gap:1px}
.battle-group.ally .health-tick{width:4px;min-height:0}
