:root { color-scheme: dark; font-family: system-ui, sans-serif; color: #eee8ce; background: #283136; --honey: #f2b744; }
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
button { font: inherit; color: #283136; background: #eee8ce; border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; min-height: 44px; }
button:hover { background: #fff6d9; }
button:focus-visible, canvas:focus-visible { outline: 3px solid var(--honey); outline-offset: 3px; }
button:disabled { opacity: .62; cursor: default; }
button[aria-pressed=true] { background: var(--honey); }
button[hidden], [hidden] { display: none !important; }
::selection { color: #283136; background: var(--honey); }
#game { position: fixed; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; gap: 10px; padding: 12px 18px; }
header, footer { display: flex; align-items: center; gap: 18px; }
h1 { font-size: clamp(16px, 2.1vw, 25px); margin: 0; flex: 1; }
#save-status { font-size: 12px; max-width: 32ch; }
.toolbar { display: flex; gap: 12px; align-items: stretch; }
.honey { min-width: 70px; display: flex; flex-direction: column; justify-content: center; color: var(--honey); }
.honey span { font-size: 12px; }
.honey strong { font-size: 30px; font-variant-numeric: tabular-nums; }
#cards { display: flex; gap: 6px; flex: 1; min-width: 0; }
.card { flex: 1; min-width: 0; padding: 7px 5px; display: grid; gap: 2px; text-align: center; }
.card strong { font-size: 13px; }
.card span { font-size: 11px; font-variant-numeric: tabular-nums; }
.card.selected { outline: 3px solid var(--honey); outline-offset: 1px; }
.field-wrap { position: relative; min-height: 0; display: grid; place-items: center; background: #202a26; border-radius: 14px; }
canvas { display: block; max-width: 100%; max-height: 100%; touch-action: none; }
#gate { position: absolute; inset: 0; display: grid; place-items: center; background: #17201bd9; border-radius: 14px; padding: 16px; }
#gate section { text-align: center; max-width: 480px; }
h2 { font-size: clamp(22px, 4vw, 38px); margin: 0 0 12px; }
#gate p { line-height: 1.5; margin: 0 0 18px; }
#resume { background: var(--honey); font-weight: 700; }
#restart { margin-left: 10px; }
footer { justify-content: space-between; font-size: 12px; min-height: 18px; }
#feedback { flex: 1; }
#wave { white-space: nowrap; }
#insets { position: fixed; visibility: hidden; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
@media (max-height: 500px) {
  #game { padding: 5px 10px; gap: 5px; }
  header { gap: 12px; }
  header button { padding: 4px 12px; min-height: 36px; }
  .toolbar { gap: 7px; }
  .honey strong { font-size: 24px; }
  .card { padding: 4px; }
  #save-status { font-size: 11px; }
  footer { font-size: 11px; }
}
@media (orientation: portrait) {
  .toolbar { display: none; }
  #game { grid-template-rows: auto 0 auto minmax(0, 1fr) auto; }
  header { flex-wrap: wrap; }
  #save-status { max-width: none; }
}

#campaign-progress { font-size: 12px; max-width: 24ch; }
#loadout { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; border:0; padding:0; margin:0 0 12px; }
#loadout label { display:flex; align-items:center; gap:5px; min-height:44px; padding:4px 8px; background:#34453a; border-radius:8px; }
#loadout input { width:20px; height:20px; }
#gate { overflow:auto; }
#gate section { max-height:100%; }
#gate h2 { font-size:clamp(20px,3vw,30px); margin-bottom:8px; }
#gate p { margin-bottom:10px; line-height:1.3; }
@media (max-height:500px) { header {gap:8px;} h1 {font-size:16px;} #campaign-progress {font-size:11px;} #gate {padding:8px;} #loadout {gap:4px;margin-bottom:6px;} }
@media (orientation:portrait) { footer {flex-wrap:wrap;} #campaign-progress {max-width:none;} #save-status {flex-basis:100%;} }

#render-status { font-size:11px; max-width:30ch; }
#technical-fallback { margin:6px; }

#mode-help:empty{display:none}#mode-help{margin:0;font-size:13px;line-height:1.25}#special-field{touch-action:none}

header{grid-row:1}.toolbar{grid-row:2}#mode-help{grid-row:3}.field-wrap{grid-row:4}footer{grid-row:5}

#audio-settings{position:relative;flex:none;font-size:12px}#audio-settings summary{cursor:pointer;min-height:44px;display:flex;align-items:center;padding:0 8px;border:1px solid #eee8ce55;border-radius:8px}.audio-panel{position:absolute;bottom:48px;left:0;z-index:20;width:230px;max-width:calc(100vw - 40px);padding:12px;background:#283136;border:1px solid #eee8ce;border-radius:10px;display:grid;gap:10px}.audio-panel label{display:flex;align-items:center;gap:8px;min-height:30px}.audio-panel input[type=range]{width:100%;min-height:32px}.audio-panel input[type=checkbox]{width:20px;height:20px}#audio-status{font-size:12px;line-height:1.3}

.mode-screen{position:absolute;inset:0;z-index:30;padding:8px;background:#283136;display:flex;flex-direction:column;gap:4px;overflow:auto}.mode-screen[hidden]{display:none}.mode-screen header,.mode-screen footer{display:flex;flex-wrap:wrap;gap:5px;flex:none}.mode-screen header strong{margin-right:auto}.mode-screen p{margin:0;font-size:12px;line-height:1.25}.mode-screen [data-menu]{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:5px;overflow:auto;min-height:0}.mode-screen [data-menu][hidden],.mode-screen [data-controls][hidden]{display:none}.mode-screen [data-controls]{display:flex;gap:4px;overflow-x:auto;flex:none;max-height:52px}.mode-screen button{min-height:40px;font-size:12px;flex-shrink:0}.mode-screen canvas{width:100%;min-height:120px;flex:1;touch-action:none}.mode-screen canvas[hidden]{display:none}.mode-screen [data-stats]{font-size:12px;align-self:center}.mode-screen footer button{min-height:36px}

#game>header{flex-wrap:wrap;gap:6px}#game>header button{font-size:12px;padding:8px 10px}#game>header h1{min-width:160px}

#game{padding-top:58px}#services{position:absolute;top:5px;left:8px;right:8px;height:40px;display:flex;gap:6px;z-index:40}#services button{min-height:40px;font-size:13px;padding:8px 14px}.mode-screen{top:50px}#service-layer{position:absolute;inset:0;z-index:50;background:#283136;display:flex;flex-direction:column;overflow:hidden}#service-status{margin:0;font-size:12px;padding:6px 10px;flex:none}#service-status:empty{display:none}.service-screen{min-height:0;flex:1;overflow:auto;padding:8px;background:#eee8ce}

/* Compact battle HUD: two fixed control rows; remaining height belongs to the field. */
#game{padding:4px 10px;gap:4px;grid-template-rows:44px 48px minmax(0,1fr)}
#game>.battle-header{grid-row:1;flex-wrap:nowrap;gap:8px;min-width:0}
#game>.battle-header button{min-height:44px;min-width:44px;flex-shrink:0;padding:8px 12px;font-size:13px}
#campaign-progress{max-width:none;min-width:0;overflow-wrap:anywhere;font-size:12px}
#wave{margin-left:auto;font-size:12px}
#save-status{max-width:30ch;overflow-wrap:anywhere}
#game:has(#retry-save:not([hidden])){grid-template-rows:auto 48px minmax(0,1fr)}
#game:has(#retry-save:not([hidden]))>.battle-header{flex-wrap:wrap}
.toolbar{grid-row:2;min-width:0;gap:6px;height:48px}
.honey{min-width:50px}.honey strong{font-size:24px}.honey span{font-size:11px}
#cards{overflow-x:auto;overflow-y:hidden;scroll-padding:4px;padding:2px;gap:6px;scrollbar-width:thin}
#cards>button{flex:0 0 auto;min-width:96px;min-height:44px;max-width:160px;padding:3px 7px}
#cards .card{height:44px;grid-template-columns:1fr auto;align-items:center;column-gap:5px}
#cards .card strong{grid-column:1/-1;font-size:12px;white-space:nowrap}
#cards .card span{font-size:11px}
#shovel{min-height:44px;min-width:44px;padding:6px 10px}
.field-wrap{grid-row:3;min-height:0}
#battle-toast{position:absolute;left:18px;right:18px;bottom:12px;z-index:6;min-height:0;margin:0;padding:6px 10px;background:#17201be8;border-radius:8px;pointer-events:none;justify-content:center;font-size:13px}
#game-menu{color:#eee8ce;background:#283136;border:1px solid #eee8ce66;border-radius:14px;width:min(560px,calc(100vw - 24px));max-height:calc(100dvh - 24px);padding:16px;overflow:auto}
#game-menu::backdrop{background:#101914cc}
#game-menu header{gap:12px;justify-content:space-between;margin-bottom:12px}
#game-menu h1{font-size:22px;min-width:0}
#game-menu #services,.mode-menu{position:static;display:flex;flex-wrap:wrap;gap:8px;height:auto;margin:12px 0}
#game-menu #services button,.mode-menu button{min-height:44px;min-width:44px;font-size:14px;padding:10px 14px}
#game-menu .audio-panel{position:static;width:100%;max-width:none;margin-top:8px}
#game-menu .audio-panel label,#game-menu .audio-panel input[type=range]{min-height:44px}
#game-menu summary{min-height:44px}
#game-menu #mode-help{margin:12px 0}
.mode-screen{top:52px}.mode-screen button,.mode-screen footer button{min-height:44px}
@media(orientation:portrait){#game{grid-template-rows:auto 0 minmax(0,1fr)}#game>.battle-header{flex-wrap:wrap}#campaign-progress{flex:1}#wave{font-size:11px}#game-menu{padding:12px}}

#cards .card.illustrated{position:relative;padding-left:46px}
#cards .card img{position:absolute;left:3px;top:2px;width:40px;height:40px;object-fit:contain;pointer-events:none}

#restart-picker{color:#eee8ce;background:#283136;border:1px solid #eee8ce66;border-radius:14px;width:min(560px,calc(100vw - 24px));max-height:calc(100dvh - 24px);padding:16px;overflow:auto}
#restart-picker::backdrop{background:#101914cc}
#restart-roster{display:flex;flex-wrap:wrap;gap:8px;border:0;padding:8px 0}
#restart-roster[hidden]{display:none}
#restart-roster label{display:flex;align-items:center;gap:6px;min-height:44px;padding:8px;background:#354d40;border-radius:8px}
#restart-roster input{width:20px;height:20px}
#restart-picker footer{display:flex;gap:8px;justify-content:flex-end}
#restart-picker button{min-height:44px}

#cards .portrait{position:absolute;left:3px;top:2px;width:40px;height:40px;overflow:hidden;pointer-events:none}
#cards .portrait img{left:0;top:0}
#cards .atlas-portrait img{width:120px;height:80px;max-width:none;object-fit:fill}

.resource-flight{position:fixed;left:0;top:0;width:32px;height:32px;display:grid;place-items:center;background:transparent;color:#503518;font:bold 12px sans-serif;z-index:30;pointer-events:none;will-change:transform}

.resource-flight svg{width:32px;height:42px;overflow:visible}

/* Apiary battle rack: portrait cards in a wooden tray, above the playable field. */
#game{background:#293c28;grid-template-rows:40px 116px minmax(0,1fr);gap:5px;padding:5px 10px}
#game>.battle-header{color:#f5ebc8}
#game>.battle-header button,#shovel{color:#fff0c5;background:linear-gradient(#93602f,#633c20);border:2px solid #382716;border-radius:10px;box-shadow:inset 0 2px 0 #c79755,0 2px 4px #17201766;text-shadow:0 1px 1px #2d1d0f}
#game>.battle-header button{min-height:36px;padding:5px 12px}
.toolbar{height:116px;gap:10px;padding:8px 10px;background:linear-gradient(180deg,#bc8545 0%,#875023 12%,#72411f 87%,#aa7136 100%);border:3px solid #422817;border-radius:12px;box-shadow:inset 0 2px 3px #edc88788,0 3px 6px #17201766;align-items:stretch}
.honey{width:78px;min-width:78px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;color:#fff0b5;border-right:2px solid #432916;padding-right:10px}
.honey::before{content:'';display:block;width:32px;height:35px;background:linear-gradient(135deg,#ffe881,#eaa31c);clip-path:polygon(50% 0,95% 25%,95% 75%,50% 100%,5% 75%,5% 25%)}
.honey span{font-size:11px;font-weight:700}.honey strong{font-size:27px;line-height:1.1;font-variant-numeric:tabular-nums;background:#fff1bc;color:#4a2a13;min-width:64px;text-align:center;border-radius:4px;padding:1px 4px}
#cards{gap:7px;padding:0 1px;align-items:stretch;scrollbar-color:#d3a15c #4f301d}
#cards>button.card,#cards>button.card.illustrated{display:grid;grid-template-columns:1fr;grid-template-rows:18px 1fr 18px 14px;position:relative;isolation:isolate;flex:0 0 100px;width:100px;min-width:100px;max-width:100px;height:94px;min-height:94px;padding:3px 5px;border:2px solid #503b20;border-radius:7px;background:linear-gradient(#e5e7bd,#a5b878 70%,#f8e7ae 70%);color:#302714;box-shadow:inset 0 1px 2px #ffffde,0 2px 3px #271c1466;overflow:hidden}
#cards .card strong{grid-row:1;grid-column:1;font-size:11px;line-height:15px;z-index:2;text-align:center;white-space:nowrap}
#cards .card>span:nth-child(2){grid-row:3;font-weight:800;font-size:12px;line-height:17px;text-align:center;z-index:2}
#cards .card>span:nth-child(3){grid-row:4;font-size:10px;line-height:12px;text-align:center;z-index:2}
#cards .card .portrait{position:absolute;left:22px;top:18px;width:54px;height:42px;overflow:hidden}
#cards .card .portrait img{width:54px;height:48px;left:0;top:0;object-fit:contain}
#cards .card .atlas-portrait img{width:162px;height:108px;object-fit:fill}
#cards .card:disabled{opacity:1;filter:saturate(.35);background:linear-gradient(#aeb79a,#71846c 70%,#d4c8a1 70%);color:#343b2b;box-shadow:inset 0 2px 8px #26392655}
#cards .card[aria-pressed=true]{border-color:#ffe87a;background:linear-gradient(#fff3b3,#c3cf7e 70%,#fff1ad 70%);box-shadow:inset 0 0 0 2px #9b641c,0 2px 5px #241b12}
#cards .card:not(:disabled):hover{border-color:#ffe9a2;transform:translateY(-1px)}
#game button:focus-visible{outline:3px solid #fff3b0;outline-offset:2px}
#shovel{align-self:center;min-width:62px;min-height:62px;max-width:85px;white-space:normal}
@media(max-height:550px) and (orientation:landscape){
 #game{grid-template-rows:36px 88px minmax(0,1fr);padding:3px 7px;gap:3px}
 .toolbar{height:88px;padding:5px 7px;gap:7px}
 #cards>button.card,#cards>button.card.illustrated{height:72px;min-height:72px;grid-template-rows:14px 1fr 15px 12px;flex-basis:88px;width:88px;min-width:88px;max-width:88px;padding:2px 4px}
 #cards .card strong{font-size:10px;line-height:13px}
 #cards .card .portrait{left:27px;top:15px;width:32px;height:28px}
 #cards .card .portrait img{width:32px;height:30px}
 #cards .card .atlas-portrait img{width:96px;height:64px}
 .honey{min-width:62px;width:62px;padding-right:7px}.honey::before{width:23px;height:25px}.honey strong{font-size:22px;min-width:50px}.honey span{display:none}
 #shovel{min-width:48px;min-height:48px;font-size:11px;padding:4px}
}
@media(orientation:portrait){#game{grid-template-rows:auto 0 minmax(0,1fr)}.toolbar{visibility:hidden;height:0;padding:0;border:0}}
#cards>button.card{row-gap:0}
#cards .card .portrait{height:34px}
#cards .card .portrait img{height:34px}
#cards .card .atlas-portrait img{height:108px}
@media(max-height:550px) and (orientation:landscape){#cards .card .portrait{height:25px}#cards .card .portrait img{height:25px}#cards .card .atlas-portrait img{height:64px}}
#cards .card .shield-portrait img{width:162px;height:54px;max-width:none;object-fit:fill;left:-108px;top:-4px}
@media(max-height:550px) and (orientation:landscape){#cards .card .shield-portrait img{width:96px;height:32px;left:-64px;top:0}}
#cards .card .sapper-portrait img{width:162px;height:54px;max-width:none;object-fit:fill;left:-54px;top:-12px}
@media(max-height:550px) and (orientation:landscape){#cards .card .sapper-portrait img{width:96px;height:32px;left:-32px;top:-5px}}

#cards .card .bowling-portrait img{width:162px;height:54px;max-width:none;object-fit:fill;left:-54px;top:-8px}
#cards .card .explosive-portrait img{filter:sepia(.5) saturate(2);}
@media(max-height:550px) and (orientation:landscape){#cards .card .bowling-portrait img{width:96px;height:32px;left:-32px;top:-4px}}

#wave-meter{position:absolute;z-index:3;right:2%;bottom:2%;width:clamp(150px,24%,240px);padding:7px 10px;border:2px solid #654323;border-radius:9px;background:#fff0c9ed;box-shadow:0 2px 4px #26362455;color:#46321f;pointer-events:none;display:grid;gap:4px;font-size:12px;font-weight:700;text-align:center}
#wave-meter[hidden]{display:none}#wave-bar{display:block;width:100%;height:10px;appearance:none;border:1px solid #6e512d;border-radius:5px;overflow:hidden;background:#573c28}
#wave-bar::-webkit-progress-bar{background:#573c28}#wave-bar::-webkit-progress-value{background:linear-gradient(#b3cf58,#719f35);border-radius:4px}
#wave-bar::-moz-progress-bar{background:#8db844}#wave-meter.urgent{border-color:#b96c25;color:#843b1d;background:#ffe2a9}
@media(max-height:550px) and (orientation:landscape){#wave-meter{padding:3px 7px;font-size:10px;gap:2px;bottom:1%;}#wave-bar{height:7px}}
/* Reserve the wave panel's corner so action feedback never covers its label. */
#battle-toast{right:calc(clamp(150px,24%,240px) + 32px);text-align:left}

/* Icon-first normal battle cards. Simulation controls the reveal, including pause. */
#cards .card.visual-card strong,#cards .card.visual-card>span:nth-child(3){display:none}
#cards>button.card.visual-card{grid-template-rows:1fr 22px}
#cards .card.visual-card>span:nth-child(2){grid-row:2;display:flex;align-items:center;justify-content:center;gap:6px;font-size:16px;line-height:20px}
#cards .card.visual-card>span:nth-child(2)::before{content:'';width:12px;height:16px;border-radius:70% 30% 60% 40%;transform:rotate(-35deg);background:radial-gradient(ellipse at 32% 30%,#fff5af 0 12%,#ffc435 30%,#ed920c 70%);border:1px solid #a75b16;box-shadow:inset -1px -1px 1px #c8720b}
#cards .card.visual-card .portrait{top:4px;left:22px;width:54px;height:60px}
#cards .card.visual-card .portrait img{height:60px}
#cards .card.visual-card .atlas-portrait img{height:108px}
#cards .card.visual-card .shield-portrait img,#cards .card.visual-card .sapper-portrait img{height:54px}
#cards .card.visual-card:disabled{filter:none;background:linear-gradient(#e5e7bd,#a5b878 70%,#f8e7ae 70%);color:#302714}
#cards .card.visual-card.recharging::after{content:'';position:absolute;inset:0;background:#17241fbb;z-index:3;pointer-events:none;transform:scaleY(calc(1 - var(--recharge-fill,0)));transform-origin:top;}
#cards .card.visual-card.unaffordable:not(.recharging){filter:saturate(.35);}
#cards .card.visual-card.unaffordable>span:nth-child(2){color:#852f20}
@media(max-height:550px) and (orientation:landscape){
 #cards>button.card.visual-card{grid-template-rows:1fr 20px}
 #cards .card.visual-card .portrait{left:21px;top:2px;width:42px;height:44px}
 #cards .card.visual-card .portrait img{width:42px;height:44px}
 #cards .card.visual-card .atlas-portrait img{width:126px;height:84px}
 #cards .card.visual-card .shield-portrait img{width:126px;height:42px;left:-84px;top:-3px}
 #cards .card.visual-card .sapper-portrait img{width:126px;height:42px;left:-42px;top:-8px}
}

/* Painted shared resource artwork, matching the collectible. */
.honey::before{width:52px;height:52px;clip-path:none;background:url('./characters/apiary/jar-v1.webp') center/contain no-repeat}
.honey span{display:none}
.resource-flight img{width:32px;height:32px;object-fit:contain}
#cards .card.visual-card>span:nth-child(2)::before{width:13px;height:18px;transform:none;border:0;border-radius:0;box-shadow:none;background:url('./characters/apiary/drop-v1.webp') center/contain no-repeat}
#cards>button.card.visual-card{background:linear-gradient(#fff0cf,#f5dba8);border-color:#91602f;box-shadow:inset 0 0 0 2px #fff4d9,0 2px 3px #271c1466}
#cards .card.visual-card:disabled{background:linear-gradient(#fff0cf,#f5dba8)}
#cards .card.visual-card[aria-pressed=true]{border-color:#ffe877;box-shadow:inset 0 0 0 2px #c28a31,0 0 5px #ffe877}
@media(max-height:550px) and (orientation:landscape){.honey::before{width:36px;height:36px}}

/* Nine-slice painted frame keeps decorative corners at a fixed size. */
.toolbar{border:3px solid transparent;border-image: url('./characters/apiary/panel-v1.webp') 88 fill / 16px / 0 stretch;background:none;box-shadow:none;padding:13px 17px;gap:8px}
.honey{border-right:1px solid #b98a48;color:#513516}
.honey strong{background:#fff0ce;box-shadow:inset 0 0 0 1px #c99d61}
@media(orientation:landscape){#game{grid-template-rows:40px 126px minmax(0,1fr)}.toolbar{height:126px}}
@media(max-height:550px) and (orientation:landscape){#game{grid-template-rows:36px 104px minmax(0,1fr)}.toolbar{height:104px}}

/* Preparation preserves the battlefield context and the actual ordered battle deck. */
#gate.preparing{background:linear-gradient(#17352218,#17352230),url('./environments/orthographic-v1.png') center/cover;border-radius:12px;align-items:stretch;padding:12px;}
#gate.preparing[data-phase="night"]{background:linear-gradient(#061735b8,#09172abf),url('./environments/orthographic-v1.png') center/cover;}
#gate.preparing>section{max-width:none;width:100%;display:flex;flex-direction:column;min-height:0;text-align:left;}
#gate.preparing h2{font-size:20px;color:#fff8db;text-shadow:0 2px 4px #102314;}
#gate.preparing #gate-copy{font-size:13px;color:#fff8db;text-shadow:0 1px 3px #102314;}
#loadout:not([hidden]){min-height:0;}
#gate.preparing #loadout{display:flex;flex-direction:column;flex:1;flex-wrap:nowrap;margin:0;min-height:0;}
.prep-instruction{color:#fffbe8;text-shadow:0 1px 3px #102314;font-size:14px;}
.prep-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(150px,.4fr);gap:clamp(16px,5vw,100px);min-height:0;flex:1;}
.prep-allies,.prep-enemies{background:#f6e7cbe8;border:2px solid #8f6034;border-radius:14px;padding:10px;color:#3f2e1b;min-height:0;overflow:auto;}
.prep-grid h3{font-size:16px;margin:0 0 8px;}
.prep-roster{display:grid;grid-template-columns:repeat(auto-fill,minmax(92px,1fr));gap:8px;}
.prep-choice{display:flex;flex-direction:column;align-items:center;background:#fff4d9;color:#352719;padding:5px;min-width:0;border:2px solid #b98b52;gap:3px;}
.prep-choice[aria-pressed="true"]{border-color:#287151;box-shadow:inset 0 0 0 2px #287151;}
.prep-choice>span:not(.prep-portrait){font-size:12px;overflow-wrap:anywhere;}
.prep-portrait{display:block;position:relative;width:100%;height:70px;overflow:hidden;}
.prep-portrait img{width:100%;height:100%;object-fit:contain;}
.prep-art-missing{display:grid;place-items:center;font-size:11px;color:#6a604f;background:#e9dcc1;border-radius:8px;}
.prep-sapper img{width:200%;height:200%;object-fit:contain;position:absolute;left:-48%;top:-2%;}
.prep-enemy{display:flex;align-items:center;gap:8px;border-top:1px solid #bca477;padding:7px 0;font-size:13px;}
.prep-enemy .prep-portrait{width:64px;height:64px;flex-shrink:0;}
#cards.preparation-deck,#restart-deck.preparation-deck{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px;}
.prep-slot{min-width:0;display:grid;grid-template-rows:minmax(0,1fr);border:2px solid #9c713c;border-radius:8px;background:#f7e9ca;overflow:hidden;}
.prep-slot.empty{display:grid;place-items:center;color:#987d56;font-size:24px;background:#efd7ad;}
.prep-remove{position:relative;padding:0;min-height:0;background:transparent;border:0;border-radius:0;}
.prep-remove .prep-portrait{height:100%;min-height:0;}
.prep-order{position:absolute;top:2px;left:3px;border-radius:50%;background:#563c21;color:white;padding:1px 5px;font-size:11px;}
#gate.preparing #restart{align-self:center;flex-shrink:0;margin:8px 0 0;background:#f8d077;color:#332411;font-weight:bold;}
@media(max-height:500px){#gate.preparing{padding:6px;}#gate.preparing h2{font-size:16px;margin-bottom:2px;}#gate.preparing #gate-copy{display:none;}#gate.preparing .prep-instruction{font-size:12px;margin:0 0 4px;}.prep-allies,.prep-enemies{padding:5px;}.prep-grid{gap:10px;grid-template-columns:minmax(0,1fr) 160px;}.prep-grid h3{font-size:13px;margin-bottom:3px;}.prep-roster{grid-template-columns:repeat(auto-fill,minmax(80px,1fr));gap:4px;}.prep-portrait{height:52px;}.prep-enemy .prep-portrait{width:45px;height:45px;}#gate.preparing #restart{min-height:36px;padding:5px 16px;margin-top:4px;}}

#restart-picker{width:min(1100px,calc(100vw - 24px));background:linear-gradient(#17352255,#17352255),url('./environments/orthographic-v1.png') center/cover;}
#restart-picker[data-phase="night"]{background:linear-gradient(#061735c0,#09172ac0),url('./environments/orthographic-v1.png') center/cover;}
#restart-deck{height:104px;}
#restart-roster{display:flex;flex-direction:column;max-height:400px;min-height:180px;flex-wrap:nowrap;}
#restart-picker .prep-instruction{margin:4px 0;font-size:13px;}
#restart-picker .prep-remove{min-height:0;}
@media(max-height:500px){#restart-picker{padding:8px;}#restart-picker h2{font-size:17px;margin:0;}#restart-picker-copy{font-size:12px;margin:4px 0;}#restart-deck{height:88px;}#restart-roster{height:180px;}#restart-picker-status{margin:4px 0;}}
#restart-picker[open]{display:flex;flex-direction:column;height:min(740px,calc(100dvh - 24px));overflow:hidden;box-sizing:border-box;}
#restart-picker>h2,#restart-picker>p,#restart-picker>footer,#restart-deck{flex-shrink:0;}
#restart-picker #restart-roster{flex:1;min-height:0;height:auto;max-height:none;}
#restart-picker footer{margin-top:4px;}
@media(max-height:500px){#restart-picker .prep-roster{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));}#restart-picker .prep-choice{display:grid;grid-template-columns:42px minmax(0,1fr);grid-template-rows:auto auto;text-align:left;gap:1px;padding:3px;}#restart-picker .prep-choice .prep-portrait{grid-row:1 / 3;height:44px;}#restart-picker .prep-choice>span:not(.prep-portrait){font-size:11px;}#restart-picker .prep-choice small{font-size:11px;}}

.prep-remove{touch-action:none;user-select:none;}
.prep-slot.dragging{opacity:.45;}
.prep-drag-ghost{position:fixed;z-index:10000;pointer-events:none;transform:translate(-50%,-50%);opacity:.9;}

.profile-screen{position:fixed;inset:0;z-index:1000;overflow:auto;display:grid;place-items:center;padding:24px;background:radial-gradient(ellipse at top,#45533b,#172721);color:#fff4d6}.profile-screen[hidden]{display:none}.profile-card{box-sizing:border-box;width:min(100%,400px);display:grid;gap:12px;padding:28px;border:1px solid #9d9862;border-radius:20px;background:#26372f;box-shadow:0 16px 60px #0006}.profile-card h1,.profile-card p{margin:0}.profile-brand{color:#efca78;font-size:14px}.profile-card h1{font-size:28px}.profile-card input{box-sizing:border-box;min-width:0;width:100%;padding:12px;border-radius:8px;border:1px solid #92947c;background:#fff9e8;color:#182820;font:inherit}.profile-card button{white-space:normal;min-height:44px}.profile-note{font-size:13px;line-height:1.5;color:#d5d9c6}#profile-error{color:#ffd5c5;line-height:1.4;overflow-wrap:anywhere}.profile-menu{display:flex;align-items:center;flex-wrap:wrap;gap:12px}.profile-menu strong{overflow-wrap:anywhere;max-width:100%}@media(max-width:440px){.profile-screen{padding:16px}.profile-card{padding:20px}}

#cryo-wave{position:absolute;inset:0;z-index:5;pointer-events:none;border-radius:14px;background:radial-gradient(ellipse at center,#edffff66 0%,#91eaff66 35%,#69bfeccc 65%,transparent 75%);box-shadow:inset 0 0 55px #c2f6ff}#cryo-wave::after{content:'Холодная волна';position:absolute;left:50%;top:43%;transform:translateX(-50%);padding:12px 20px;border-radius:12px;background:#214658ed;color:#efffff;font-weight:700;font-size:clamp(18px,3vw,32px);white-space:nowrap}.card.illustrated strong{overflow-wrap:anywhere}

#cards .conveyor-empty{align-self:center;margin:auto 16px;color:#54381f;font-size:clamp(12px,1.5vw,16px);line-height:1.4;white-space:normal;max-width:48ch}
