/* Shared battle HUD surfaces and status meters. */
#game .battle-rail{--rail-height:54px;--hud-surface:#0c1721f5;--hud-border:#4d656990;--hud-fine:#b5c6cb}
#game #hud .hud-left,#game #hud .hero-chip,#game #hud .squad-chip,#game #hud .hud-actions button{
 border:1px solid var(--hud-border);
 border-radius:9px;
 background:linear-gradient(150deg,#24313bfa 0%,var(--hud-surface) 59%,#091219f7 100%)!important;
 box-shadow:inset 0 1px #efdfb914,0 3px 9px #0006;
}
#game #hud .hud-left{
 display:grid;
 grid-template-columns:minmax(0,1fr) auto;
 grid-template-rows:auto auto auto;
 grid-template-areas:"title title" "mission stats" "exp exp";
 row-gap:2px;
 align-content:center;
 align-self:stretch;
 padding:4px 7px;
 height:var(--rail-height);
 max-width:none;
 border-color:#907e55a6;
 color:#f6edd9;
 text-align:start;
}
#game #hud .hud-map-title{grid-area:title;color:#f3d89d;font-size:11px;font-weight:850;line-height:13px;letter-spacing:.035em}
#game #hud .hud-mission-line{grid-area:mission;display:flex;align-items:baseline;gap:5px;min-width:0;white-space:nowrap}
.hud-mission-line strong{color:#fff0d3;font-size:12px;line-height:14px;font-variant-numeric:tabular-nums}
.hud-mission-line span{color:var(--hud-fine);font-size:10px;line-height:12px;overflow:hidden;text-overflow:ellipsis}
#game #hud .hud-stats{
 grid-area:stats;
 align-items:center;
 justify-content:end;
 min-width:0;
 padding-inline-start:7px;
 margin:0;
 gap:6px;
 font-size:10px;
 line-height:12px;
 color:#d9e5e7;
 font-variant-numeric:tabular-nums;
 white-space:nowrap;
 flex-wrap:nowrap;
}
#game #hud .hud-stats>span{display:inline}
#game #hud .hud-stats .gold{color:#ffdb8e}
#game #hud .hud-exp{grid-area:exp;padding-top:1px}
#game #hud .hero-chip,#game #hud .squad-chip{
 display:flex;
 flex-direction:row;
 align-items:center;
 text-align:start;
 gap:5px;
 height:var(--rail-height)!important;
 min-height:var(--rail-height)!important;
 padding:4px 5px!important;
 border-color:color-mix(in srgb,var(--unit-color) 29%,#283d49);
 font-variant-numeric:tabular-nums;
}
#game #hud .hero-chip.sel,#game #hud .squad-chip.chosen{
 border-color:color-mix(in srgb,var(--unit-color) 78%,#fff5cb);
 background:linear-gradient(125deg,color-mix(in srgb,var(--unit-color) 19%,#172633),var(--hud-surface) 70%)!important;
 box-shadow:inset 0 -2px var(--unit-color),0 0 8px color-mix(in srgb,var(--unit-color) 20%,transparent);
}
#game #hud .squad-chip.fallen,#game #hud .hero-chip:disabled{opacity:.72;filter:saturate(.45)}
#game #hud .hud-emblem{
 width:30px;
 height:38px;
 flex:0 0 30px;
 border:1px solid color-mix(in srgb,var(--unit-color) 42%,#182b35);
 border-radius:5px;
 background-color:#0b1a22;
}
#game #hud .hero-face.hud-emblem{background-position:var(--portrait-x) 22%}
#game #hud .squad-chip .dragon-portrait.hud-emblem{display:block!important;filter:var(--icon-tone) var(--icon-edge)}
#game #hud .chip-info{width:auto;display:grid;flex:1;gap:2px;align-content:center;min-width:0}
#game #hud .hud-unit-title,#game #hud .hud-unit-values{min-width:0;display:flex;align-items:baseline;justify-content:space-between;gap:3px}
#game #hud .hud-unit-title b{display:block;margin:0;max-width:none;min-width:0;font-size:12px;line-height:14px;color:#f3f4ee;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#game #hud .hud-unit-status{flex:none;color:var(--unit-color);font-size:9px;line-height:11px}
#game #hud .hud-unit-values{color:var(--hud-fine);font-size:9px;line-height:11px;white-space:nowrap}
#game #hud .hud-hp{color:#e5fff2;font-weight:760}
#game #hud .hud-hp-max{color:#b3c5c7;font-weight:550}
#game #hud .hud-shield{color:#a5d5ff}
#game #hud .hud-meter{
 display:block;
 height:5px;
 width:100%;
 margin:0;
 overflow:hidden;
 border:0;
 border-radius:4px;
 background:#060c12;
 box-shadow:inset 0 1px 2px #0009,0 1px #ffffff12;
}
#game #hud .hud-meter i{
 display:block;
 height:100%;
 border-radius:inherit;
 background:linear-gradient(90deg,#1e8d72 5%,#61c99a 70%,#b9ffd5);
 box-shadow:inset 0 1px #f5fff675;
}
#game #hud .hud-meter.xp{height:3px}
#game #hud .hud-meter.xp i{background:linear-gradient(90deg,#4b4f9c,#a293e0,#ddd2ff)}
#game #hud .hero-chip .hud-meter.xp{height:2px;opacity:1}
#game #hud .boss-hud{
 display:grid;
 width:min(100%,380px);
 max-width:380px;
 padding:5px 8px 6px;
 margin:0;
 background:linear-gradient(130deg,#391e2bf7,#151421f5);
 border:1px solid #c77c8c92;
 border-radius:8px;
 box-shadow:0 4px 14px #0008;
 pointer-events:none;
}
#game #hud .hud-boss-title{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;margin-bottom:4px;color:#fff1e6;font-size:11px}
#game #hud .hud-boss-title span{font-size:8px;font-weight:800;color:#ffafb8;letter-spacing:.065em}
#game #hud .hud-boss-title b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#game #hud .hud-boss-title strong{color:#ffe6da;font-variant-numeric:tabular-nums}
#game #hud .boss-hud .health i{background:linear-gradient(90deg,#a53358,#e47785,#ffc3aa)}
#game #hud .hud-actions,#game .movement-controls{align-items:center;align-self:stretch}
#game #hud .hud-actions button svg{width:21px;height:21px;display:block;margin:auto;fill:none;stroke:#ecd8aa;stroke-width:1.8;stroke-linecap:round}
#game #hud .hud-actions button[aria-expanded="true"]{border-color:#e4ba72;background:#38332d!important}
#game .movement-controls button{border-color:var(--hud-border)}
#game #battle-tools{
 --tools-top:calc(max(4px,env(safe-area-inset-top)) + var(--tools-offset,60px));
 top:var(--tools-top);
 max-height:calc(100dvh - var(--tools-top) - max(8px,env(safe-area-inset-bottom)));
}
@media(orientation:landscape){
 #game .battle-rail{height:var(--rail-height);gap:5px}
 #game #hud .hud-left{width:204px;flex:0 1 204px;min-width:125px}
 #game #hud .party-health{width:auto;flex:0 1 auto;height:var(--rail-height);min-width:0;display:flex;gap:4px}
 #game #hud .hero-chip{width:122px;flex:1 1 122px;min-width:82px}
 #game #hud .squad-hud{height:var(--rail-height);gap:4px;min-width:71px}
 #game #hud .squad-chip{min-width:109px;flex:0 0 109px;max-width:none}
 #game #hud .hud-actions,#game .bottom-hud{height:var(--rail-height)}
 #game #hud .boss-hud{position:absolute;inset:calc(100% + 5px) auto auto 50%;transform:translateX(-50%);width:min(88%,380px)}
}
@media(orientation:landscape) and (max-width:1000px){
 #game #hud .hud-left{flex-basis:165px;min-width:95px}
 #game #hud .hero-chip{min-width:68px;width:95px;flex-basis:95px}
 #game #hud .squad-chip{min-width:92px;flex-basis:92px}
 #game #hud .hud-emblem{width:23px;flex-basis:23px;height:34px}
 #game #hud .hud-stats{gap:4px;padding-inline-start:3px;font-size:9px}
}
@media(orientation:landscape) and (max-width:720px){
 #game .battle-rail{--rail-height:48px;gap:3px}
 #game #hud .hud-left{flex-basis:125px;min-width:80px;grid-template-areas:"title title" "mission mission" "exp exp"}
 #game #hud .hud-stats{display:none}
 #game #hud .hero-chip{min-width:55px;width:64px;flex-basis:64px}
 #game #hud .squad-chip{min-width:74px;flex-basis:74px}
 #game #hud .hero-face.hud-emblem,#game #hud .squad-chip .dragon-portrait.hud-emblem{display:none!important}
}
@media(orientation:portrait){
 #game{--tools-offset:112px}
 #game .battle-rail{--rail-height:51px;grid-template-rows:var(--rail-height) var(--rail-height)}
 #game #hud .hud-left{width:100%;grid-template-areas:"title stats" "mission mission" "exp exp"}
 #game #hud .hud-stats>span:nth-child(2){display:none}
 #game #hud .party-health,#game #hud .squad-hud{height:var(--rail-height)}
 #game #hud .hero-chip{min-width:0}
 #game #hud .squad-chip{min-width:68px;flex-basis:68px}
 #game #hud .squad-chip .dragon-portrait.hud-emblem{display:none!important}
 #game #hud .hero-face.hud-emblem{width:23px;flex-basis:23px;height:34px}
 #game #hud .boss-hud{grid-row:3}
}
@media(orientation:portrait) and (max-width:359px){
 #game #hud .hero-face.hud-emblem{display:none}
 #game #hud .hud-stats>span:not(.gold){display:none}
}

/* The same volume controls are available in the lobby and on the battlefield. */
.volume-mixer{gap:8px;max-width:680px}
.volume-channel{
 display:grid;
 grid-template-columns:minmax(0,1fr) auto;
 grid-template-rows:auto 34px;
 align-items:center;
 gap:0 10px;
 min-width:0;
 padding:6px 9px 3px;
 border:1px solid #82939a46;
 border-radius:8px;
 background:linear-gradient(145deg,#2736418a,#102029d9);
}
.volume-channel b{font-size:14px;line-height:1.2;color:#f0eadc}
.volume-channel button,#battle-tools .volume-channel button{
 min-width:88px;
 min-height:36px;
 padding:3px 7px;
 font-size:11px;
 font-weight:750;
}
.volume-channel button[aria-pressed="true"]{background:#1c3833;border-color:#689d8a;color:#c0ead9}
.volume-channel button[aria-pressed="false"]{background:#222a34;color:#c2cbd3;border-color:#53636c}
.volume-mixer .volume-channel input[type="range"]{width:100%;min-width:0;max-width:none;min-height:32px;margin:0;accent-color:#e4bd78;cursor:pointer;touch-action:pan-y}
.volume-channel output{font-size:13px;font-weight:750;font-variant-numeric:tabular-nums;text-align:end;color:#f4d89e}
@media(pointer:coarse){
 .volume-channel button,#battle-tools .volume-channel button{min-height:44px}
 .volume-channel{grid-template-rows:auto 42px}
 .volume-mixer .volume-channel input[type="range"]{min-height:42px}
}

/* Unlock requirements stay above the roster and can be expanded in place. */
.team-progression{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;gap:8px;margin:8px 0 14px}
.team-progress-modal .team-progression{grid-template-columns:minmax(0,1fr)}
.team-progress-modal>button+button{margin-top:6px}
.team-progress-card{
 min-width:0;
 border:1px solid #b79b644d;
 border-radius:10px;
 background:radial-gradient(ellipse at left top,#38483b50,transparent 50%),linear-gradient(135deg,#182935,#0b1924);
 box-shadow:0 6px 16px #0003;
}
.team-progress-card summary{
 display:grid;
 grid-template-columns:auto minmax(0,1fr) auto auto;
 align-items:center;
 gap:9px;
 padding:9px 11px;
 min-height:60px;
 cursor:pointer;
 list-style:none;
}
.team-progress-card summary::-webkit-details-marker{display:none}
.team-progress-card summary::after{content:"";width:6px;height:6px;justify-self:center;transform:rotate(45deg);border-right:1.5px solid #e6c98b;border-bottom:1.5px solid #e6c98b;margin:0 3px 3px 1px}
.team-progress-card[open] summary::after{transform:rotate(225deg);margin:3px 3px 0 1px}
.team-progress-card summary b,.team-progress-card summary small{display:block}
.team-progress-card summary b{color:#f1d392;font-size:15px}
.team-progress-card summary small{font-size:12px;line-height:1.3;color:#c5d4d6}
.team-progress-card summary strong{font-variant-numeric:tabular-nums;color:#f0dbab;font-size:16px}
.team-progress-icon .art-icon{width:36px;height:36px}
.team-progress-content{padding:0 11px 9px}
.team-progress-content p{margin:0;padding:9px 0;font-size:13px;line-height:1.45;color:#dfddce;border-top:1px solid #b79b642d}
.team-progress-content ul{list-style:none;padding:0;margin:0;display:grid;gap:5px}
.team-mission{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:6px;padding:6px 7px;border-radius:6px;background:#091621c9;border:1px solid #9daeb227}
.team-mission b,.team-mission span,.team-mission small{display:block;font-size:12px;line-height:1.3}
.team-mission small{color:#b8c8d0}
.team-mission.complete small,.team-mission .team-mission-check{color:#a1e2b8}
.team-mission button{font-size:11px;padding:4px 7px;min-height:40px}
.team-slot-link,.chamber-party>.team-slot-link{display:inline-flex;align-items:center;gap:6px;padding:5px 9px;min-height:38px;border:1px solid #b79b6473;border-radius:8px;background:#1d2b31;color:#eed6a1;font-size:12px}
.team-slot-link b{font-variant-numeric:tabular-nums}
@media(max-width:700px){
 .team-progression{grid-template-columns:minmax(0,1fr);gap:6px}
 .team-progress-card summary{min-height:54px}
 .team-progress-icon .art-icon{width:30px;height:30px}
}

/* Keep all recruited heroes reachable on narrow combat screens. */
@media (orientation: portrait) {
 #game .battle-rail { z-index: 3; }
 #game:has(.party-health.is-expanded) { --tools-offset: 168px; }
 #game .battle-rail:has(.party-health.is-expanded) { grid-template-rows: repeat(3, var(--rail-height)); }
 #game #hud .party-health.is-expanded { grid-column: 1/-1; }
 #game #hud:has(.party-health.is-expanded) .squad-hud { grid-column: 1/-1; grid-row: 3; }
 #game #hud:has(.party-health.is-expanded) .boss-hud { grid-row: 4; }
}
@media (orientation: landscape) and (max-width: 700px) {
 #game:has(.party-health.is-expanded) { --tools-offset: 114px; }
 #game #hud .party-health.is-expanded {
  position: absolute;
  inset: calc(100% + 4px) auto auto 0;
  width: min(320px, 100%);
  pointer-events: auto;
 }
 #game #hud .party-health.is-expanded .hero-chip { flex: 1; }
 #game #hud:has(.party-health.is-expanded) .boss-hud {
  inset-block-start: calc(100% + var(--rail-height) + 8px);
 }
}

/* Give recruited heroes and the scrollable dragon strip independent grid space. */
@media (orientation:landscape) and (max-width:1050px) {
 #game:has(.party-health.is-expanded) { --tools-offset:102px; }
 #game .battle-rail:has(.party-health.is-expanded) {
  --rail-height:46px; display:grid; height:auto; align-items:stretch;
  grid-template-columns:minmax(0,1fr) 44px min(235px,max(166px,27vw)) 92px;
  grid-template-rows:repeat(2,var(--rail-height)); gap:4px;
 }
 #game #hud:has(.party-health.is-expanded) .hud-left { grid-area:1/1; width:100%; min-width:0; }
 #game #hud:has(.party-health.is-expanded) .movement-controls { grid-area:1/2; display:flex; }
 #game .battle-rail:has(.party-health.is-expanded) .bottom-hud { grid-area:1/3; max-width:100%; justify-self:end; }
 #game #hud:has(.party-health.is-expanded) .hud-actions { grid-area:1/4; }
 #game #hud .party-health.is-expanded {
  grid-area:2/1/3/3; position:static; inset:auto; z-index:auto; transform:none;
  display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); width:100%; min-width:0; min-height:0;
 }
 #game #hud .party-health.is-expanded .hero-chip { width:100%; min-width:0; }
 #game #hud:has(.party-health.is-expanded) .squad-hud { grid-area:2/3/3/5; width:100%; min-width:0; }
 #game #hud:has(.party-health.is-expanded) .boss-hud { inset-block-start:calc(100% + 4px); }
}
@media (orientation:landscape) and (max-width:590px) {
 #game #hud .party-health.is-expanded .hud-emblem { display:none!important; }
}

@media(orientation:landscape) and (max-width:480px) {
 #game .battle-rail:has(.party-health.is-expanded) { grid-template-rows:repeat(3,var(--rail-height)); }
 #game #hud .party-health.is-expanded { grid-column:1/-1; }
 #game #hud:has(.party-health.is-expanded) .squad-hud { grid-row:3; grid-column:1/-1; }
 #game:has(.party-health.is-expanded) { --tools-offset:154px; }
}
