:root{font-family:system-ui,-apple-system,'Malgun Gothic',sans-serif;color:#f2ead6;background:#071015;color-scheme:dark}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;min-height:100svh;background:radial-gradient(circle at 50% 10%,#1a3334,#071015 68%)}
button,input{font:inherit}
button{touch-action:manipulation}
.hidden{display:none!important}
.app{width:min(100%,430px);min-height:100svh;margin:auto;padding:0 16px 22px;background:#0c171b;box-shadow:0 0 70px #0009;overflow:hidden}
.site-head{height:57px;display:flex;align-items:center;gap:10px;border-bottom:1px solid #ffffff1c}
.site-head h1{font-size:18px;letter-spacing:-.065em;white-space:nowrap;margin:0;color:#f7e5b5}
.site-mark{font-size:10px;font-weight:900;letter-spacing:.11em;color:#e9bc66;white-space:nowrap}
.site-tag{font-size:9px;letter-spacing:.1em;color:#8aa49b;margin-left:auto;white-space:nowrap}

/* Start screen */
.setup-screen{padding:18px 0 12px}
.setup-art{height:150px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;position:relative;overflow:hidden;border:1px solid #6d7144;border-radius:13px;background:linear-gradient(0deg,#0b171adc,#0d151784),url('../../assets/game/common/v1/dungeons.png') left 42%/300% auto no-repeat}
.setup-art:after{content:'';position:absolute;inset:auto 0 0;height:35%;background:linear-gradient(transparent,#0a1517)}
.setup-art{flex-direction:row;justify-content:center;gap:8px}
.setup-hero{z-index:1;width:104px;height:112px;flex:none;background-repeat:no-repeat;background-size:620px 291px;background-position:-38px -45px;image-rendering:pixelated;filter:drop-shadow(0 6px 3px #000)}
.setup-banner-copy{z-index:1;display:flex;flex-direction:column;gap:3px;text-shadow:0 2px 5px #000}
.setup-banner-copy span{font-size:10px;font-weight:900;letter-spacing:.13em;color:#f5ca75}
.setup-banner-copy strong{font-size:28px;line-height:1;color:#fff0bd;letter-spacing:-.05em}
.setup-banner-copy small{font-size:11px;color:#d3ddc4}
.setup-copy h2{font-size:22px;letter-spacing:-.05em;margin:18px 0 4px}
.setup-copy p{font-size:13px;color:#aabdb4;margin:0 0 17px;line-height:1.5}
.setup-label{display:flex;align-items:baseline;gap:8px;font-size:13px;font-weight:900;color:#eed398;margin-bottom:9px}
.setup-label small{font-size:11px;font-weight:500;color:#829f95}
#companions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
#companions .choice{min-height:105px;padding:11px 12px;border-radius:10px;background:#17282b;border:1px solid #3e605d;box-shadow:inset 0 1px #ffffff0a;outline:0;text-align:left;cursor:pointer}
#companions .choice:hover,#companions .choice:focus-visible{border-color:#dabc72;background:#243a38}
#companions .choice strong{display:block;font-size:16px;color:#f5e8ca;margin:0 0 3px}
#companions .choice span{display:block;font-size:11px;line-height:1.4;color:#a9c0b6}
#companions .choice em{display:block;font-size:10px;line-height:1.4;font-style:normal;margin-top:8px;color:#e7c980}
.seed-row{display:flex;align-items:center;gap:14px;margin-top:16px}
.seed-row label{white-space:nowrap;color:#b5c6b9;font-size:12px}
.seed-row input{height:42px;max-width:110px;margin:0;padding:8px 10px;text-align:center;background:#122124;border:1px solid #4d6a60;border-radius:8px;color:#efe2ba}
.start-btn{width:100%;margin-top:14px;height:53px;display:flex;justify-content:center;align-items:center;gap:10px;background:linear-gradient(#f3d88d,#c49548);border:1px solid #fff0bd;border-radius:10px;color:#26302a;font-weight:900;font-size:16px;box-shadow:0 4px 0 #634922,0 12px 23px #0005}
.start-btn span{font-size:20px}
.setup-note{font-size:11px;color:#819a91;text-align:center;line-height:1.5;margin:18px 10px}

/* Persistent run information */
.run-head{padding:11px 0 10px}
.run-heading{display:flex;align-items:center;justify-content:space-between;font-size:11px;letter-spacing:.11em;color:#c8af76;font-weight:900}
.run-heading b{font-size:12px;color:#f0e5c4}
#progress{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;margin:7px 0 11px}
.dot{position:relative;height:13px;display:flex;align-items:center;justify-content:center;border-radius:3px;background:#203338;color:#6d8b84;font-size:9px;font-style:normal;font-weight:900;border:1px solid #334c4d}
.dot.past{background:#487e67;color:#d7f2c5;border-color:#5e997b}
.dot.now{background:#d9b35b;color:#2d2618;border-color:#ffe3a1;box-shadow:0 0 12px #e0bc6555}
.hud{display:grid;grid-template-columns:1fr auto;gap:7px;margin:0}
.hero-vitals{min-width:0;display:flex;align-items:center;gap:8px;background:#16292c;border:1px solid #496e64;border-radius:8px;padding:5px 8px}
.hero-vitals .vital-icon{width:28px;height:28px;display:grid;place-items:center;border-radius:6px;background:#3c6a58;color:#f6e0ac;font-size:16px}
.vital-info{min-width:0;flex:1}
.vital-info .line{display:flex;justify-content:space-between;gap:6px;font-size:11px;font-weight:800}
.vital-info .line strong{white-space:nowrap;color:#ffe3b3}
.hero-vitals .meter{height:5px;margin-top:4px}
.resource{display:flex;align-items:center;gap:6px;border:1px solid #526654;border-radius:8px;padding:0 10px;background:#263728;color:#e9d7a5;font-size:12px;font-weight:900;white-space:nowrap}
.resource .orb{color:#9add9d;font-size:17px}
.companion-status{grid-column:1/-1;display:flex;align-items:center;gap:5px;color:#97b8ab;font-size:10px;min-height:12px;padding-left:2px}
.companion-status b{color:#d5e5ce}
.companion-status.danger b{color:#ffc3ac}

/* The battle scene is the primary play surface on a phone. */
.scene{height:clamp(295px,39svh,355px);position:relative;overflow:hidden;border:2px solid #67765c;border-radius:12px;background-image:linear-gradient(180deg,#03101488 0%,#12232322 37%,#031014a8 100%),url('../../assets/game/common/v1/dungeons.png');background-size:100% 100%,300% auto;background-repeat:no-repeat;background-position:center,0% 52%;box-shadow:inset 0 0 0 2px #152421,0 7px 17px #0007}
.scene.zone-1{background-position:center,50% 53%;border-color:#67617e}
.scene.zone-2{background-position:center,100% 52%;border-color:#927051}
.scene:before{content:'';position:absolute;inset:0;pointer-events:none;background:linear-gradient(90deg,#020c1060,transparent 19%,transparent 81%,#020c1060),linear-gradient(0deg,#061111a8,transparent 36%)}
.scene-top{position:absolute;z-index:2;top:9px;left:9px;right:9px;display:flex;justify-content:space-between;gap:8px;align-items:center}
.scene-top span{font-size:11px;font-weight:900;color:#fff1ce;background:#0b181bc9;border:1px solid #b6a57177;padding:5px 8px;border-radius:5px;max-width:70%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#turn-badge{font-size:10px;color:#c9e8dd;border-color:#8ab9a077}
.foes,.party{position:absolute;z-index:1;left:5px;right:5px;display:flex;justify-content:center;align-items:flex-end;gap:3px;margin:0}
.foes{top:19%}.party{bottom:8%}
.unit{width:92px;min-height:0;border:0;background:transparent;text-align:center;padding:0;flex:0 1 92px;filter:drop-shadow(0 6px 3px #000a)}
.unit.enemy{background:transparent;border:0}
.unit.down{opacity:.45;filter:grayscale(1)}
.unit-art{height:75px;display:flex;align-items:end;justify-content:center;position:relative}
.unit-art:after{content:'';position:absolute;z-index:-1;bottom:1px;width:72px;height:12px;border-radius:50%;background:#061012a8}
.unit img{display:block;width:76px;height:76px;object-fit:contain;image-rendering:pixelated;margin:0}
.unit .sprite{display:block;width:67px;height:75px;margin:0;background-repeat:no-repeat;background-size:397px 198px;background-position:-22px -22px;image-rendering:pixelated}
.unit b{display:block;width:max-content;max-width:100%;margin:1px auto 0;padding:2px 5px;border-radius:4px;background:#071417db;color:#f6edcf;font-size:11px;line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.unit.enemy b{color:#ffe0cb;background:#29191cde}
.unit small{display:block;width:max-content;max-width:100%;min-height:0;margin:2px auto 0;padding:1px 5px;border-radius:4px;background:#0a181bd9;color:#dfecdc;font-size:10px;line-height:1.2;white-space:nowrap}
.unit.enemy small{color:#ffe1d3;background:#29191cd9}
.unit .meter{width:82%;height:5px;margin:4px auto 0;border-radius:4px;background:#421d24}
.scene.phase-battle .party .unit-art{animation:ready 1.8s ease-in-out infinite alternate}
.scene.phase-battle .foes .unit-art{animation:ready 2.1s ease-in-out infinite alternate-reverse}
@keyframes ready{from{transform:translateY(0)}to{transform:translateY(-4px)}}
.meter{height:6px;border-radius:5px;background:#472b31;overflow:hidden}
.meter i{display:block;height:100%;background:#a8dc89}
.enemy .meter i{background:#f19a75}
.scene-caption{position:absolute;z-index:2;bottom:4px;left:8px;right:8px;color:#d1ddd1;text-align:center;font-size:10px;line-height:1.25;text-shadow:0 1px 3px #000;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.destination{align-self:center;text-align:center;margin-top:34px;padding:7px 15px;background:#0c1719a8;border:1px solid #d6b46c88;border-radius:8px;box-shadow:0 0 20px #0009}
.destination-mark{display:block;color:#f3ce75;font-size:22px;line-height:1}
.destination b{font-size:11px;color:#f8dfad}
.scene.phase-won:after,.scene.phase-dead:after{content:'';position:absolute;inset:0;background:#0b171288;pointer-events:none}

/* Decisions and controls */
.loadout{display:flex;align-items:center;gap:9px;min-height:38px;margin:5px 0 0}
.loadout-label{font-size:10px;font-weight:900;color:#829b90;letter-spacing:.1em;white-space:nowrap}
.skills{display:flex;gap:5px;overflow:auto;scrollbar-width:none;align-items:center}
.skills::-webkit-scrollbar{display:none}
.skill{flex:none;background:#213b32;border:1px solid #64906c;color:#dfeacf;padding:4px 7px;border-radius:4px;font-size:10px;white-space:nowrap}
.skill.empty{color:#718d82;border-style:dashed;background:transparent}
.phase-panel{background:#142428;border:1px solid #3f5c56;border-radius:10px;padding:11px 10px 12px;box-shadow:inset 0 1px #ffffff0c}
.phase-kicker{font-size:10px;letter-spacing:.14em;color:#e6bc6a;font-weight:900}
.phase-panel h2{font-size:17px;letter-spacing:-.04em;color:#f9ebcb;margin:3px 0 2px}
.phase-panel .text{font-size:11px;color:#a8beb3;margin:0 0 10px;line-height:1.45}
.phase-panel .choice-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.phase-panel .choice{position:relative;min-height:87px;padding:9px 10px;background:#203638;border:1px solid #597069;border-radius:8px;color:#f0ead6;box-shadow:inset 0 1px #ffffff0c;outline:0;overflow:hidden;text-align:left;cursor:pointer}
.phase-panel .choice:hover,.phase-panel .choice:focus-visible{background:#2b4945;border-color:#e6c578}
.phase-panel .choice:disabled{opacity:.45;cursor:default}
.phase-panel .choice:only-child{grid-column:1/-1}
.phase-panel .choice:nth-child(3):last-child{grid-column:1/-1;min-height:78px}
.phase-panel .choice[data-kind="battle"]{border-left:3px solid #c37860}
.phase-panel .choice[data-kind="rest"],.phase-panel .choice[data-kind="herb"]{border-left:3px solid #91bb7a}
.phase-panel .choice[data-kind="recruit"],.phase-panel .choice[data-kind="skill"]{border-left:3px solid #d5b56e}
.phase-panel .choice[data-kind="shrine"]{border-left:3px solid #9b8abd}
.phase-panel .choice[data-kind="skip"]{border-left:3px solid #86b389;background:#182925}
.choice-head{display:flex;align-items:center;gap:7px;margin-bottom:4px}
.choice-icon{width:24px;height:24px;display:grid;place-items:center;flex:none;border-radius:5px;background:#50625566;color:#ebd7a6;font-size:16px;font-style:normal}
.choice-head strong{font-size:13px;line-height:1.2;margin:0}
.choice-category{margin-left:auto;flex:none;padding:2px 4px;border:1px solid #647c6d;background:#233a35;color:#cce2ca;font-size:9px;font-weight:900;white-space:nowrap}
.choice[data-kind="skill"] .choice-category{border-color:#9a8250;background:#39301d;color:#f2d993}
.phase-panel .choice span.choice-desc{font-size:10px;line-height:1.35;color:#b4c8bb;display:block}
.enemy-preview{display:flex;align-items:center;gap:1px;margin-top:3px;height:23px}
.enemy-preview img{width:23px;height:23px;object-fit:contain;image-rendering:pixelated}
.enemy-preview em{font-style:normal;font-size:9px;color:#d8ae91;margin-left:3px}
.phase-panel .choice em:not(.enemy-preview em){margin:0}
.control-dock{display:flex;gap:7px;align-items:center;min-height:0;margin:9px 0 0}
.control-dock:empty{display:none}
.control-dock .btn{flex:1;min-height:44px;padding:8px 9px;background:#23423c;border:1px solid #719989;border-radius:8px;color:#f0ead6;font-size:12px;font-weight:900;cursor:pointer}
.control-dock .btn.primary{background:linear-gradient(#f2d889,#c7974d);color:#213028;border-color:#f7e0a4;box-shadow:0 3px 0 #6a4b26}
.control-dock .btn:disabled{opacity:.38;cursor:default}
.control-dock.combat{position:sticky;bottom:0;z-index:5;margin:8px -16px -22px;padding:9px 16px calc(10px + env(safe-area-inset-bottom));background:#0b191cef;border-top:1px solid #738f7d;box-shadow:0 -7px 20px #0007}
.control-dock.combat .btn{min-height:51px;font-size:14px}
.app:has(.control-dock.combat){padding-bottom:90px}
.journal{margin-top:12px;border:1px solid #38514c;border-radius:8px;color:#92aba0;font-size:11px;background:#102023}
.journal summary{padding:10px 12px;cursor:pointer;display:flex;justify-content:space-between;list-style:none}
.journal summary::-webkit-details-marker{display:none}
.journal[open] summary{border-bottom:1px solid #38514c}
.journal .log{max-height:210px;overflow:auto;margin:0;padding:8px 20px 0 30px;font-size:11px;line-height:1.5}
.journal li{padding:2px 0;border-bottom:1px solid #ffffff0c}
.journal p{padding:0 12px 9px;line-height:1.5}
.skill-catalog{margin-top:12px;border:1px solid #405c50;border-radius:3px;background:#122320;color:#d9e6d5}
.skill-catalog summary{display:flex;gap:8px;align-items:center;padding:10px 12px;cursor:pointer;list-style:none;font-size:12px;font-weight:800}
.skill-catalog summary::-webkit-details-marker{display:none}
.skill-catalog summary span:first-child{color:#edcc86;font-size:11px}
.skill-catalog summary span:last-child{margin-left:auto;color:#9fb4a7}
.skill-catalog[open] summary{border-bottom:1px solid #405c50}
.skill-catalog-list{max-height:330px;overflow:auto;padding:4px 12px 12px}
.skill-catalog-list h3{margin:12px 0 4px;color:#ebce93;font-size:11px}
.catalog-skill{display:grid;grid-template-columns:96px 1fr;gap:8px;padding:7px 0;border-bottom:1px solid #ffffff16;font-size:11px;line-height:1.45}
.catalog-skill b{color:#f4edd9}
.catalog-skill span{color:#aec3b5}
.result{font-size:18px;color:#e9c36d}

/* Readable combat lanes and a turn-by-turn action ledger. */
.scene{border-radius:3px;border-width:3px;box-shadow:inset 0 0 0 1px #111e1c}
.scene.phase-map,.scene.phase-reward,.scene.phase-recruit,.scene.phase-won,.scene.phase-dead{height:300px}
.scene.phase-battle{height:390px}
.scene.phase-dead:has(.enemy-lane){height:390px;border-color:#a1665d}
.scene.phase-dead:has(.enemy-lane):after{background:#36181623}
.scene.phase-battle .scene-caption{display:none}
.scene.phase-dead:has(.enemy-lane) .scene-caption{display:none}
.foes{top:40px;left:0;right:0;bottom:auto;height:218px;display:block}
.foes:has(.destination){display:flex;justify-content:center;align-items:center;top:16%;height:auto}
.enemy-lane{position:absolute;left:0;right:0;padding:4px 4px 0;border-top:1px solid #ffffff45;background:#07141736}
.enemy-lane.back{top:0;height:99px}
.enemy-lane.front{top:100px;height:116px;border-top:2px solid #e0a77499;background:#170f0f42}
.lane-label{position:absolute;top:6px;left:6px;color:#e3d3b4;background:#172328e8;border:1px solid #769196;padding:3px 5px;font-size:10px;font-weight:900;letter-spacing:.04em}
.enemy-lane.front .lane-label{color:#ffd2aa;border-color:#bc775b}
.lane-units{height:100%;display:flex;align-items:flex-start;justify-content:center;gap:1px}
.enemy-lane .unit{width:86px;flex-basis:86px}
.enemy-lane .unit-art{height:61px}
.enemy-lane .unit img{width:62px;height:62px}
.enemy-lane.back .unit-art{height:47px}
.enemy-lane.back .unit img{width:49px;height:49px}
.enemy-lane .unit b,.enemy-lane .unit small{font-size:10px;margin-top:0}
.enemy-lane .unit .meter{height:4px;margin-top:2px}
.intent{display:block;width:max-content;max-width:100%;margin:2px auto 0;padding:2px 4px;background:#5a2b22;border:1px solid #b76b47;color:#ffe0ae;font-size:9px;font-weight:900;white-space:nowrap}
.empty-lane{align-self:center;color:#9aada5;background:#0a171ac7;padding:3px 7px;font-size:10px}
.scene.phase-battle .party{bottom:14px}
.scene.phase-dead:has(.enemy-lane) .party{bottom:14px}
.scene.phase-battle .party:before{content:'아군';position:absolute;top:4px;left:5px;padding:3px 5px;background:#15332b;border:1px solid #78a981;color:#c8e5ca;font-size:10px;font-weight:900}
.scene.phase-battle .party .unit-art{height:77px}
.scene.phase-battle .party .unit img{width:77px;height:77px}
.scene.phase-battle .party .unit{width:94px;flex-basis:94px}
.scene.phase-battle .unit.focus-target .unit-art{filter:drop-shadow(0 0 6px #f0b264) drop-shadow(0 0 4px #f0b264)}
.scene.phase-dead .unit.focus-target .unit-art{filter:drop-shadow(0 0 6px #ef8d78)}
.scene.phase-battle .unit.focus-source .unit-art{filter:drop-shadow(0 0 5px #b4ead1)}
.combat-readout{margin-top:7px;background:#101d20;border:1px solid #5a716c;padding:7px 8px 8px}
.combat-readout.compact{padding-bottom:5px}
.combat-readout.compact .target-rules{display:none}
.combat-readout.compact .turn-events{max-height:48px}
.readout-head{display:flex;justify-content:space-between;gap:6px;color:#d8e0d1;font-size:10px;margin-bottom:5px}
.readout-head b{color:#f1c578}
.readout-head span{color:#7f9990}
.target-rules{margin:0 0 4px;padding:3px 5px;background:#23363a;color:#b9d5c6;font-size:9px;line-height:1.35}
.turn-events{max-height:119px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#657c72 transparent}
.turn-event{display:grid;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:5px;min-height:22px;padding:2px 3px;border-top:1px solid #ffffff16;color:#e5eee5;font-size:10px}
.turn-event.active{background:#354537;border-left:2px solid #e2c16d;padding-left:1px}
.turn-event .event-side{font-size:9px;font-weight:900;color:#b9e2bc}
.turn-event.enemy .event-side{color:#ecae9c}
.turn-event.status .event-side{color:#d8c392}
.turn-event .event-flow{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.turn-event .event-flow b{color:#f6e9ce}
.turn-event .event-flow i{font-style:normal;color:#92a79c;padding:0 1px}
.turn-event .event-flow em{font-style:normal;color:#e4c27b;font-size:9px}
.turn-event strong{color:#f7c39c;white-space:nowrap;font-size:10px}
.turn-event.ally strong{color:#b4df9e}
.turn-event.status strong{color:#e9d18f}
.feed-empty{font-size:10px;color:#9bb0a5;padding:6px 2px}
.scene.phase-battle~.loadout{margin-top:4px}
#play:has(.scene.phase-battle) .phase-panel{display:none}
.phase-panel,.phase-panel .choice,#companions .choice,.journal,.hero-vitals,.resource,.start-btn,.control-dock .btn{border-radius:3px}
.start-btn,.control-dock .btn.primary{background:#d7b86d;box-shadow:0 3px 0 #5c4426;color:#1c2925}
.phase-panel .choice{background:#1a2a2c;box-shadow:none}
.choice-icon{border-radius:2px;background:#314443;color:#e9d09b}
.skill{border-radius:2px}
.destination{border-radius:2px;box-shadow:none}
.scene-top span{border-radius:2px}
.enemy-preview{display:block;height:auto;margin-top:5px;border-top:1px solid #ffffff24;padding-top:3px}
.preview-lane{height:23px;display:flex;align-items:center;gap:2px}
.preview-lane b{width:26px;flex:none;color:#cfb090;font-size:9px}
.preview-lane span{color:#68857e;font-size:10px}
.preview-lane img{width:21px;height:21px;object-fit:contain;image-rendering:pixelated}

@media(max-width:355px){.app{padding-left:11px;padding-right:11px}.site-tag{display:none}.unit{width:82px;flex-basis:82px}.unit img{width:67px;height:67px}.unit-art{height:68px}.scene{height:290px}.control-dock.combat{margin-left:-11px;margin-right:-11px;padding-left:11px;padding-right:11px}}
@media(max-width:599px){.control-dock.combat{position:fixed;left:50%;bottom:0;transform:translateX(-50%);width:min(100%,430px);margin:0;border-left:1px solid #607f71;border-right:1px solid #607f71}.control-dock.combat .btn{min-height:52px}}
@media(max-width:599px) and (max-height:650px){
  body:has(#play:not(.hidden)) .site-head{display:none}
  .run-head{padding:5px 0 6px}
  #progress{margin:4px 0 6px}
  .scene.phase-battle{height:318px}
  .scene.phase-dead:has(.enemy-lane){height:318px}
  .foes{top:34px;height:168px}
  .enemy-lane.back{height:76px}
  .enemy-lane.front{top:77px;height:91px}
  .enemy-lane.back .unit-art{height:35px}
  .enemy-lane.back .unit img{width:40px;height:40px}
  .enemy-lane.front .unit-art{height:45px}
  .enemy-lane.front .unit img{width:48px;height:48px}
  .enemy-lane .unit b,.enemy-lane .unit small{font-size:9px}
  .enemy-lane .intent{font-size:8px;padding:1px 3px}
  .scene.phase-battle .party{bottom:5px}
  .scene.phase-battle .party .unit-art{height:59px}
  .scene.phase-dead:has(.enemy-lane) .party .unit-art{height:59px}
  .scene.phase-battle .party .unit img{width:59px;height:59px}
  .scene.phase-dead:has(.enemy-lane) .party .unit img{width:59px;height:59px}
  .scene.phase-battle .party .sprite{transform:scale(.79);transform-origin:center bottom}
  .scene.phase-dead:has(.enemy-lane) .party .sprite{transform:scale(.79);transform-origin:center bottom}
  .scene.phase-battle .party .unit{width:79px;flex-basis:79px}
  .scene.phase-dead:has(.enemy-lane) .party .unit{width:79px;flex-basis:79px}
  .scene.phase-battle .party .unit b,.scene.phase-battle .party .unit small{font-size:9px}
  .scene.phase-dead:has(.enemy-lane) .party .unit b,.scene.phase-dead:has(.enemy-lane) .party .unit small{font-size:9px}
  .readout-head{margin-bottom:2px}
  .turn-event{min-height:19px}
}
@media(min-width:600px){.app{border-left:1px solid #405b50;border-right:1px solid #405b50}.scene{height:355px}}
@media(prefers-reduced-motion:reduce){.scene.phase-battle .unit-art{animation:none!important}html{scroll-behavior:auto}}

/* Side-view combat stage: allies on the left, enemy frontline near the clash,
   and enemy reserve at the far right. Motion belongs to the stage, never the HUD. */
.scene{isolation:isolate}
.scene.phase-battle,.scene.is-replaying{height:376px;background-image:linear-gradient(180deg,#06131588 0%,#09181822 52%,#050d0fca 100%),url('../../assets/game/common/v1/dungeons.png')}
.scene.phase-battle:before,.scene.is-replaying:before{background:linear-gradient(90deg,#080e12b8,#101c1b1c 30%,#0c171628 70%,#071111bd),linear-gradient(0deg,#030b0b8f,transparent 28%)}
.scene-top{z-index:8}
.battle-ground{display:none;position:absolute;z-index:1;inset:50px 4px 22px;pointer-events:none}
.scene.phase-battle .battle-ground,.scene.is-replaying .battle-ground{display:block}
.battle-ground:before{content:'';position:absolute;left:0;right:0;top:56%;height:2px;background:linear-gradient(90deg,transparent,#bb846f75 30%,#d9c08b99 50%,#72988675 70%,transparent);box-shadow:0 4px 8px #000}
.battle-ground:after{content:'◆';position:absolute;left:50%;top:56%;transform:translate(-50%,-47%);font-size:22px;color:#dec78f;text-shadow:0 2px 4px #000}
.battle-ground span{position:absolute;top:0;left:3px;font-size:10px;font-weight:900;letter-spacing:.14em;color:#cce2b4;text-shadow:0 2px #000}
.battle-ground span:last-child{left:auto;right:3px;color:#e5a78f}
.battle-ground i{position:absolute;left:50%;top:0;bottom:4px;border-left:1px dashed #dbc59a42}
.scene.phase-battle .foes,.scene.is-replaying .foes{left:auto;right:4px;top:68px;bottom:30px;width:56%;height:auto;display:block;z-index:3}
.scene.phase-battle .enemy-lane,.scene.is-replaying .enemy-lane{top:0;bottom:0;height:auto;right:auto;border:0;background:none;padding:0}
.scene.phase-battle .enemy-lane.back,.scene.is-replaying .enemy-lane.back{left:58%;width:40%}
.scene.phase-battle .enemy-lane.front,.scene.is-replaying .enemy-lane.front{left:0;width:50%}
.enemy-lane .lane-label{top:auto;bottom:-11px;left:50%;transform:translateX(-50%);border:0;border-top:1px solid #a26751;background:#091517df;padding:2px 5px;white-space:nowrap}
.enemy-lane.back .lane-label{color:#b1bdbc;border-color:#6b8b84}
.enemy-lane.front .lane-label{color:#f5bd8d;border-color:#c38155}
.scene.phase-battle .lane-units,.scene.is-replaying .lane-units{height:100%;display:flex;flex-direction:column;justify-content:space-around;align-items:center;gap:0}
.scene.phase-battle .enemy-lane .unit,.scene.is-replaying .enemy-lane .unit{width:80px;min-height:0;flex:0 0 auto}
.scene.phase-battle .enemy-lane.back .unit,.scene.is-replaying .enemy-lane.back .unit{width:69px}
.scene.phase-battle .enemy-lane .unit-art,.scene.is-replaying .enemy-lane .unit-art{height:59px}
.scene.phase-battle .enemy-lane .unit img,.scene.is-replaying .enemy-lane .unit img{width:61px;height:61px}
.scene.phase-battle .enemy-lane.back .unit-art,.scene.is-replaying .enemy-lane.back .unit-art{height:49px}
.scene.phase-battle .enemy-lane.back .unit img,.scene.is-replaying .enemy-lane.back .unit img{width:51px;height:51px}
.scene.phase-battle .unit[data-key^="boss"] .unit-art,.scene.is-replaying .unit[data-key^="boss"] .unit-art{height:83px}
.scene.phase-battle .unit[data-key^="boss"] img,.scene.is-replaying .unit[data-key^="boss"] img{width:85px;height:85px}
.scene.phase-battle .party,.scene.is-replaying .party{left:4px;right:auto;top:69px;bottom:30px;width:29%;display:flex;flex-direction:column;justify-content:space-around;align-items:center;gap:0;z-index:3}
.scene.phase-battle .party:before,.scene.is-replaying .party:before{display:none}
.scene.phase-battle .party .unit,.scene.is-replaying .party .unit{width:86px;flex:0 0 auto}
.scene.phase-battle .party .unit-art,.scene.is-replaying .party .unit-art{height:62px}
.scene.phase-battle .party .unit img,.scene.is-replaying .party .unit img{width:64px;height:64px}
.scene.phase-battle .party .sprite,.scene.is-replaying .party .sprite{transform:scale(.8);transform-origin:center bottom}
.scene.phase-battle .foes .unit img,.scene.is-replaying .foes .unit img{transform:scaleX(-1)}
.scene.phase-battle .unit b,.scene.is-replaying .unit b{font-size:10px;margin-top:0;max-width:100%}
.scene.phase-battle .unit small,.scene.is-replaying .unit small{font-size:9px;margin-top:1px;padding:0 3px}
.scene.phase-battle .unit .meter,.scene.is-replaying .unit .meter{height:4px;margin-top:2px}
.scene.phase-battle .intent,.scene.is-replaying .intent{font-size:8px;margin-top:2px;padding:1px 3px;background:#542b21e8;border-color:#c97953}
.scene.phase-battle .empty-lane,.scene.is-replaying .empty-lane{font-size:9px;opacity:.7;background:#081516a9}
.scene.phase-battle .scene-caption,.scene.is-replaying .scene-caption{display:block;z-index:8;left:19px;right:19px;bottom:2px;padding:3px 5px;background:#071316e6;border-top:1px solid #c7aa73a6;color:#f5ebd6;font-weight:900;font-size:11px}
.scene .foes:has(.destination){left:0;right:0;width:auto;top:16%;bottom:auto;height:auto;display:flex}
.scene:not(.phase-battle):not(.is-replaying) .party{left:10px;right:auto;bottom:25px;width:38%;flex-wrap:wrap;justify-content:flex-start}
.battle-fx{position:absolute;inset:0;z-index:7;pointer-events:none;overflow:hidden}
.fx-trail{position:absolute;display:block;height:4px;transform-origin:left center!important;background:linear-gradient(90deg,transparent,var(--fx-color) 67%,#fff8d2);box-shadow:0 0 10px 2px var(--fx-color);opacity:.95;clip-path:inset(0 100% 0 0);animation:trail-draw .15s ease-out forwards}
@keyframes trail-draw{to{clip-path:inset(0 0 0 0)}}
.fx-flight,.fx-impact,.fx-number{position:absolute;display:block;pointer-events:none}
.fx-flight{width:31px;height:7px;background:var(--fx-color);box-shadow:0 0 11px 3px var(--fx-color),-10px 0 0 #f4efc0;transform-origin:center;animation:shot-flight .32s cubic-bezier(.2,.65,.35,1) forwards}
.fx-flight.fx-orb{width:14px;height:14px;border-radius:50%;box-shadow:0 0 0 3px #fff4,0 0 13px 4px var(--fx-color)}
.fx-flight.fx-slash{clip-path:polygon(0 30%,75% 0,100% 45%,73% 100%,0 67%)}
@keyframes shot-flight{from{transform:translate(-50%,-50%) scale(.4);opacity:.25}to{transform:translate(calc(var(--dx) - 50%),calc(var(--dy) - 50%)) scale(1.2);opacity:1}}
.fx-impact{width:54px;height:54px;border:4px solid var(--fx-color);border-radius:50%;box-shadow:0 0 0 2px #fff8,0 0 20px 4px var(--fx-color);animation:impact-ring .24s steps(4) forwards}
.fx-impact:after{content:'';position:absolute;inset:-9px;border:2px dashed var(--fx-color);border-radius:50%}
.fx-impact.ally-hit:before{content:'';position:absolute;left:22px;top:-18px;width:8px;height:78px;background:#fff1c2;box-shadow:5px 0 0 var(--fx-color),0 0 12px 4px var(--fx-color);transform:rotate(38deg)}
.fx-impact.enemy-hit:before{content:'';position:absolute;left:10px;top:-9px;width:6px;height:63px;background:#ffd8c0;box-shadow:14px 0 0 #ffc297,28px 0 0 #f3a078;transform:rotate(27deg)}
.fx-impact.shield{border-radius:5px;transform:rotate(45deg);border-color:#cce7cf}
.fx-impact.summon{border-color:#b5e9cf}
.fx-impact.heal{border-color:#a8edb4}
.fx-impact.status-hit{border-style:dashed;box-shadow:0 0 0 3px #211224,0 0 16px 4px var(--fx-color)}
.fx-impact.sweep{width:115px;height:115px}
@keyframes impact-ring{from{transform:translate(-50%,-50%) scale(.25);opacity:1}to{transform:translate(-50%,-50%) scale(1.04);opacity:.8}}
.fx-number{z-index:2;min-width:37px;text-align:center;color:#f8e5ae;font-size:19px;font-weight:1000;text-shadow:2px 2px 0 #172221,-2px -2px 0 #172221,0 3px 5px #000;white-space:nowrap;animation:damage-rise .62s ease-out forwards}
.fx-number.hurt{color:#ff9f86}
.fx-effect{position:absolute;z-index:3;max-width:140px;padding:2px 6px;border:1px solid #f1d693;background:#2e3329ed;color:#fff0b9;font-size:10px;font-weight:900;line-height:1.25;white-space:nowrap;text-align:center;transform:translate(-50%,0);box-shadow:0 2px 8px #000b}
.fx-effect.debuff{border-color:#d899a4;background:#46232fef;color:#ffe0e7}
.fx-effect.cold{border-color:#91cee4;background:#1d3b4bef;color:#d9f6ff}
.condition{position:absolute;z-index:5;top:-3px;right:-11px;padding:2px 4px;border:1px solid #e39aaa;background:#56222fee;color:#ffe1e5;font-size:9px;font-weight:900;line-height:1;white-space:nowrap;box-shadow:0 2px 5px #000a;animation:condition-pulse 1.15s steps(2) infinite}
.unit.enemy .condition{right:auto;left:-8px}
.condition.poison{border-color:#b98bc9;background:#3b2349f0;color:#efd5ff}
.condition.slow{top:13px;border-color:#9ccddb;background:#1d4050f0;color:#d5f5ff}
@keyframes condition-pulse{50%{filter:brightness(1.25)}}
@keyframes damage-rise{from{transform:translate(-50%,2px) scale(.65);opacity:0}45%{transform:translate(-50%,-18px) scale(1.2);opacity:1}to{transform:translate(-50%,-27px) scale(1);opacity:1}}
.scene .unit{--recoil:-9px;--recoil-return:3px;--dodge:-13px;--guard:-6px}
.scene .unit.enemy{--recoil:9px;--recoil-return:-3px;--dodge:13px;--guard:6px}
.scene .unit.is-attacking .unit-art{animation:attack-lunge .34s ease-out both!important}
.scene .unit.is-hit .unit-art{animation:hit-recoil .3s steps(3) both!important;filter:brightness(2) drop-shadow(0 0 6px #fff0bd)}
.scene .unit.is-dodging .unit-art{animation:dodge-hop .32s ease-out both!important}
.scene .unit.is-blocking .unit-art{animation:guard-brace .3s ease-out both!important}
.scene .unit.is-summoned .unit-art{animation:summon-arrive .45s ease-out both!important;filter:drop-shadow(0 0 10px #b9f1d6)}
.scene .unit.is-healed .unit-art{animation:heal-rise .45s ease-out both!important;filter:drop-shadow(0 0 9px #a8edb4)}
.scene .unit.is-cursed .unit-art{animation:hit-recoil .3s steps(3) both!important;filter:drop-shadow(0 0 8px var(--status-glow,#af75ba))}
@keyframes attack-lunge{0%{transform:translateX(0)}25%{transform:translateX(var(--windup)) scale(.94,1.04)}55%{transform:translateX(var(--lunge)) scale(1.06,.95)}100%{transform:translateX(0)}}
@keyframes hit-recoil{0%{transform:translateX(0)}35%{transform:translateX(var(--recoil))}70%{transform:translateX(var(--recoil-return))}100%{transform:translateX(0)}}
@keyframes dodge-hop{0%{transform:translate(0,0)}45%{transform:translate(var(--dodge),-12px)}100%{transform:translate(0,0)}}
@keyframes guard-brace{0%{transform:translateX(0)}45%{transform:translateX(var(--guard)) scale(.94)}100%{transform:translateX(0)}}
@keyframes summon-arrive{from{transform:translateY(17px) scale(.4);opacity:0}65%{transform:translateY(-5px) scale(1.15);opacity:1}to{transform:translateY(0) scale(1);opacity:1}}
@keyframes heal-rise{from{transform:translateY(4px);filter:brightness(1)}50%{transform:translateY(-8px);filter:brightness(1.8)}to{transform:translateY(0);filter:brightness(1)}}
.scene.scene-shake{animation:stage-shake .22s steps(3)}
@keyframes stage-shake{0%,100%{transform:translateX(0)}33%{transform:translateX(-3px)}66%{transform:translateX(3px)}}
@media(max-width:355px){.scene.phase-battle,.scene.is-replaying{height:345px}.scene.phase-battle .foes,.scene.is-replaying .foes{width:58%}.scene.phase-battle .party,.scene.is-replaying .party{width:27%;left:2px}.scene.phase-battle .enemy-lane .unit,.scene.is-replaying .enemy-lane .unit{width:68px}.scene.phase-battle .enemy-lane.back .unit,.scene.is-replaying .enemy-lane.back .unit{width:59px}.scene.phase-battle .party .unit,.scene.is-replaying .party .unit{width:76px}}
@media(max-width:599px) and (max-height:650px){.scene.phase-battle,.scene.is-replaying{height:312px}.scene.phase-battle .foes,.scene.is-replaying .foes,.scene.phase-battle .party,.scene.is-replaying .party{top:61px;bottom:27px}.scene.phase-battle .enemy-lane .unit-art,.scene.is-replaying .enemy-lane .unit-art{height:44px}.scene.phase-battle .enemy-lane .unit img,.scene.is-replaying .enemy-lane .unit img{width:46px;height:46px}.scene.phase-battle .enemy-lane.back .unit-art,.scene.is-replaying .enemy-lane.back .unit-art{height:38px}.scene.phase-battle .enemy-lane.back .unit img,.scene.is-replaying .enemy-lane.back .unit img{width:40px;height:40px}.scene.phase-battle .party .unit-art,.scene.is-replaying .party .unit-art{height:48px}.scene.phase-battle .party .unit img,.scene.is-replaying .party .unit img{width:49px;height:49px}.scene.phase-battle .party .sprite,.scene.is-replaying .party .sprite{transform:scale(.65)}.scene.phase-battle .unit b,.scene.is-replaying .unit b{font-size:9px}.scene.phase-battle .intent,.scene.is-replaying .intent{font-size:7px}}
@media(prefers-reduced-motion:reduce){.condition{animation:none}}

/* Both formations face the centre: reserve, front | front, reserve. */
.scene.phase-battle .party,.scene.is-replaying .party{left:4px;right:auto;top:68px;bottom:32px;width:48%;display:block}
.scene.phase-battle .foes,.scene.is-replaying .foes{left:auto;right:4px;top:68px;bottom:32px;width:48%}
.scene.phase-battle .ally-lane,.scene.is-replaying .ally-lane{position:absolute;top:0;bottom:0}
.scene.phase-battle .ally-lane.back,.scene.is-replaying .ally-lane.back{left:0;width:43%}
.scene.phase-battle .ally-lane.front,.scene.is-replaying .ally-lane.front{right:0;width:48%}
.scene.phase-battle .enemy-lane.front,.scene.is-replaying .enemy-lane.front{left:0;width:48%}
.scene.phase-battle .enemy-lane.back,.scene.is-replaying .enemy-lane.back{left:57%;width:43%}
.ally-lane .lane-label{top:auto;bottom:-11px;left:50%;transform:translateX(-50%);border:0;border-top:1px solid #7eab82;background:#091517df;padding:2px 5px;white-space:nowrap;color:#cce6c5}
.ally-lane.back .lane-label{color:#aebeb6;border-color:#6b8b84}
.scene.phase-battle .ally-lane .lane-units,.scene.is-replaying .ally-lane .lane-units{height:100%;display:flex;flex-direction:column;justify-content:space-around;align-items:center;gap:0}
.scene.phase-battle .party .unit,.scene.is-replaying .party .unit{width:72px;flex:0 0 auto}
.scene.phase-battle .ally-lane.back .unit,.scene.is-replaying .ally-lane.back .unit{width:66px}
.scene.phase-battle .party .unit-art,.scene.is-replaying .party .unit-art{height:56px}
.scene.phase-battle .party .unit img,.scene.is-replaying .party .unit img{width:58px;height:58px}
.scene.phase-battle .unit.is-attacking,.scene.is-replaying .unit.is-attacking{position:relative;z-index:9;animation:approach-strike var(--attack-duration,1130ms) ease-in-out both}
.scene.phase-battle .unit.is-attacking .unit-art,.scene.is-replaying .unit.is-attacking .unit-art{animation:none!important}
@keyframes approach-strike{
  0%,9%{transform:translate(0,0)}
  39%{transform:translate(var(--travel-x),var(--travel-y))}
  49%{transform:translate(var(--travel-x),calc(var(--travel-y) + 7px))}
  57%{transform:translate(var(--travel-x),calc(var(--travel-y) - 12px))}
  66%{transform:translate(var(--travel-x),var(--travel-y))}
  92%,100%{transform:translate(0,0)}
}
.auto-combat-status{width:100%;padding:10px 12px;border:1px solid #6f947d;background:#193129;color:#d8eacb;text-align:center;font-size:12px;font-weight:900}
.auto-dot{display:inline-block;width:7px;height:7px;margin-right:5px;border-radius:50%;background:#aada84;box-shadow:0 0 8px #aada84;animation:condition-pulse 1.15s steps(2) infinite}
@media(max-width:355px){.scene.phase-battle .party,.scene.is-replaying .party,.scene.phase-battle .foes,.scene.is-replaying .foes{width:48%}.scene.phase-battle .party .unit,.scene.is-replaying .party .unit{width:61px}.scene.phase-battle .ally-lane.back .unit,.scene.is-replaying .ally-lane.back .unit{width:55px}}
@media(max-width:599px) and (max-height:650px){.scene.phase-battle .party,.scene.is-replaying .party,.scene.phase-battle .foes,.scene.is-replaying .foes{top:61px;bottom:29px}}
@media(prefers-reduced-motion:reduce){.scene.phase-battle .unit.is-attacking,.scene.is-replaying .unit.is-attacking{animation:none}.auto-dot{animation:none}}

/* Stagger single occupants so each camp reads as a group, not four duelling slots. */
.scene.phase-battle .ally-lane.back .lane-units:has(> .unit:only-child),.scene.is-replaying .ally-lane.back .lane-units:has(> .unit:only-child){transform:translateY(-47px)}
.scene.phase-battle .ally-lane.front .lane-units:has(> .unit:only-child),.scene.is-replaying .ally-lane.front .lane-units:has(> .unit:only-child){transform:translateY(30px)}
.scene.phase-battle .enemy-lane.front .lane-units:has(> .unit:only-child),.scene.is-replaying .enemy-lane.front .lane-units:has(> .unit:only-child){transform:translateY(-30px)}
.scene.phase-battle .enemy-lane.back .lane-units:has(> .unit:only-child),.scene.is-replaying .enemy-lane.back .lane-units:has(> .unit:only-child){transform:translateY(47px)}
.scene.phase-battle .unit.focus-source b,.scene.is-replaying .unit.focus-source b{outline:1px solid #d7ebaf;background:#23432f;color:#f2ffd8}
.scene.phase-battle .unit.focus-target b,.scene.is-replaying .unit.focus-target b{outline:1px solid #eab68c;background:#4a2a24;color:#fff1d7}
.battle-ground span{min-width:58px;text-align:center;padding:3px 5px;border:1px solid #719b7a;background:#0f281fc9}
.battle-ground span:last-child{border-color:#bd7c64;background:#311c1bcc}
.fx-target-line{position:absolute;display:block;height:2px;transform-origin:left center;background:repeating-linear-gradient(90deg,var(--fx-color) 0 9px,transparent 9px 14px);filter:drop-shadow(0 0 3px var(--fx-color));opacity:.65;animation:target-line-in .22s ease-out both}
@keyframes target-line-in{from{opacity:0;clip-path:inset(0 100% 0 0)}to{opacity:.65;clip-path:inset(0 0 0 0)}}
@media(max-width:599px) and (max-height:650px){
  .scene.phase-battle .ally-lane.back .lane-units:has(> .unit:only-child),.scene.is-replaying .ally-lane.back .lane-units:has(> .unit:only-child){transform:translateY(-32px)}
  .scene.phase-battle .ally-lane.front .lane-units:has(> .unit:only-child),.scene.is-replaying .ally-lane.front .lane-units:has(> .unit:only-child){transform:translateY(21px)}
  .scene.phase-battle .enemy-lane.front .lane-units:has(> .unit:only-child),.scene.is-replaying .enemy-lane.front .lane-units:has(> .unit:only-child){transform:translateY(-21px)}
  .scene.phase-battle .enemy-lane.back .lane-units:has(> .unit:only-child),.scene.is-replaying .enemy-lane.back .lane-units:has(> .unit:only-child){transform:translateY(32px)}
}
.scene.phase-battle .enemy-lane .lane-units:has(> .unit:nth-child(3)),.scene.is-replaying .enemy-lane .lane-units:has(> .unit:nth-child(3)){justify-content:center}
.scene.phase-battle .enemy-lane .lane-units:has(> .unit:nth-child(3)) .unit-art,.scene.is-replaying .enemy-lane .lane-units:has(> .unit:nth-child(3)) .unit-art{height:38px}
.scene.phase-battle .enemy-lane .lane-units:has(> .unit:nth-child(3)) .unit img,.scene.is-replaying .enemy-lane .lane-units:has(> .unit:nth-child(3)) .unit img{width:40px;height:40px}
.scene.phase-battle .enemy-lane .lane-units:has(> .unit:nth-child(3)) .unit b,.scene.is-replaying .enemy-lane .lane-units:has(> .unit:nth-child(3)) .unit b,.scene.phase-battle .enemy-lane .lane-units:has(> .unit:nth-child(3)) .unit small,.scene.is-replaying .enemy-lane .lane-units:has(> .unit:nth-child(3)) .unit small{font-size:8px;line-height:1;padding:1px 3px}
.scene.phase-battle .enemy-lane .lane-units:has(> .unit:nth-child(3)) .unit .meter,.scene.is-replaying .enemy-lane .lane-units:has(> .unit:nth-child(3)) .unit .meter{height:3px;margin-top:1px}
.scene.phase-battle .enemy-lane .lane-units:has(> .unit:nth-child(3)) .intent,.scene.is-replaying .enemy-lane .lane-units:has(> .unit:nth-child(3)) .intent{font-size:7px;margin-top:1px;padding:1px 2px}
