/* SPDX-License-Identifier: MIT */
html,body { margin:0; width:100%; height:100%; overflow:hidden; background:#e7e8cf; }
canvas { position:absolute; inset:0; width:100%; height:100%; }
#canvas { z-index:2; touch-action:none; outline:none; }
#canvas:focus-visible { outline:2px solid #52794a; outline-offset:-2px; }
#glcanvas { z-index:0; }
#overlay { position:absolute; inset:0; display:grid; place-items:center; z-index:5; background:#e7e8cf; }
#loading { font:24px system-ui; position:absolute; top:45%; left:30%; }
#leaf-actions { position:absolute; inset:0; pointer-events:none; z-index:3; }
.leaf-action { position:absolute; background:transparent; border:0; padding:0; pointer-events:none; outline:none; color:transparent; font-size:0; }
.leaf-action:focus-visible { outline:3px solid #52794a; outline-offset:4px; }
#leaf-state { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
#leaf-board-actions { position:absolute; z-index:3; pointer-events:none; }
.leaf-board-action { position:absolute; transform:translate(-50%,-50%); width:24px; height:24px; padding:0; background:transparent; border:0; pointer-events:none; outline:none; }
.leaf-board-action:focus-visible { outline:3px solid #52794a; border-radius:50%; background:#ffffff44; }
#leaf-pointer { position:absolute; z-index:4; pointer-events:none; width:18px; height:18px; transform:translate(-50%,-50%); border:3px solid #294426; border-radius:50%; box-shadow:0 0 0 2px #fff; }
@media(max-width:730px) {
  canvas { top:calc((100% - var(--leaf-bar-height,100px)) / 2); transform:translateY(-50%); height:min(calc(100% - var(--leaf-bar-height,100px)),62.5vw); }
  #leaf-actions { inset:auto 0 0; min-height:60px; display:flex; flex-wrap:nowrap; overflow-x:auto; gap:6px; padding:8px; box-sizing:border-box; background:#e7e8cf; }
  .leaf-action { position:static!important; width:auto!important; height:auto!important; flex:none; pointer-events:auto; min-height:44px; min-width:44px; border:1px solid #889a77; border-radius:8px; padding:8px 12px; font:14px system-ui; white-space:nowrap; color:#203823; background:#fafbef; cursor:pointer; }
  .leaf-action:focus-visible { outline-offset:2px; }
  .leaf-action:disabled { opacity:.45; cursor:default; }
}

/* Campaign and unit information use native rendered content and action targets. */
html:is([data-leaf-screen="campaign"],[data-leaf-screen="menu"],[data-leaf-screen="info"],[data-leaf-screen="result"]) { background:#f5f3e9; }
html:is([data-leaf-screen="campaign"],[data-leaf-screen="menu"],[data-leaf-screen="info"],[data-leaf-screen="result"]) canvas { opacity:0; pointer-events:none; }
html:is([data-leaf-screen="campaign"],[data-leaf-screen="menu"],[data-leaf-screen="info"],[data-leaf-screen="result"]) #leaf-board-actions { visibility:hidden; }
html:is([data-leaf-screen="campaign"],[data-leaf-screen="menu"],[data-leaf-screen="info"],[data-leaf-screen="result"]) #leaf-actions { inset:0; display:block; padding:0; overflow:auto; pointer-events:auto; background:#f5f3e9; scrollbar-color:#a1ac94 transparent; }
.leaf-panel { box-sizing:border-box; max-width:1000px; margin:0 auto; padding:32px 36px; color:#26352b; font:15px/1.5 system-ui,-apple-system,sans-serif; }
.leaf-panel * { box-sizing:border-box; }
.leaf-panel h1,.leaf-panel h2,.leaf-panel h3,.leaf-panel p { margin:0; }
.leaf-panel h1 { font-size:clamp(25px,3.2vw,36px); line-height:1.15; letter-spacing:-.04em; font-weight:650; }
.leaf-panel h2 { font-size:17px; font-weight:650; margin-bottom:16px; }
.leaf-panel h3 { font-size:16px; font-weight:650; line-height:1.35; }
.leaf-panel .leaf-subtitle { color:#607064; margin-top:8px; font-size:14px; }
.leaf-panel-header { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; }
.leaf-panel .leaf-action { position:static!important; width:auto!important; height:auto!important; min-width:44px; min-height:44px; padding:10px 16px; border:1px solid transparent; border-radius:8px; font:600 14px/1.35 system-ui,-apple-system,sans-serif; white-space:normal; color:#2f513c; cursor:pointer; pointer-events:auto; }
.leaf-panel .leaf-action:hover:not(:disabled) { background:#e6eadf; }
.leaf-panel .leaf-action:focus-visible { outline:3px solid #52794a; outline-offset:3px; }
.leaf-panel .leaf-primary { color:#fff; background:#30543b; padding:13px 24px; }
.leaf-panel .leaf-primary:hover:not(:disabled) { background:#23452e; }
.leaf-panel .leaf-secondary,.leaf-panel .leaf-purchase { background:#fffef7; border-color:#ced5c6; }
.leaf-panel .leaf-quiet { background:transparent; padding:10px 0 10px 12px; color:#607064; }
.leaf-panel .leaf-text-button { background:transparent; padding:10px 0; min-height:44px; font-weight:500; text-decoration:underline; text-decoration-color:#b4c4ad; text-underline-offset:3px; }
.leaf-panel .leaf-action:disabled { color:#727c73; background:#e8ebe2; border-color:transparent; opacity:1; cursor:default; }
.leaf-campaign-summary { display:flex; align-items:center; justify-content:space-between; gap:20px; margin:24px 0 28px; border-block:1px solid #dce0d3; padding:16px 0; }
.leaf-journey { display:flex; align-items:center; list-style:none; margin:0; padding:0; gap:20px; }
.leaf-journey li { position:relative; display:grid; place-items:center; width:32px; height:32px; border:1px solid #d3d9ca; border-radius:50%; color:#8a9485; font-size:12px; }
.leaf-journey li+li::before { content:""; position:absolute; height:1px; width:20px; background:#d3d9ca; right:100%; }
.leaf-journey li.complete { color:#30543b; background:#e1e8d9; border-color:#c7d2bd; }
.leaf-journey li.current { color:white; background:#30543b; border-color:#30543b; }
.leaf-renown { display:flex; align-items:baseline; gap:8px; color:#607064; }
.leaf-renown strong { color:#30543b; font-size:30px; line-height:1; font-weight:650; font-variant-numeric:tabular-nums; }
.leaf-renown span { font-size:13px; }
.leaf-campaign-body { display:grid; grid-template-columns:1fr 1.25fr; gap:40px; }
.leaf-roster { display:grid; gap:10px; }
.leaf-unit { display:flex; align-items:center; gap:12px; border:1px solid #dce0d3; background:#eeefe4; padding:8px 16px 8px 4px; border-radius:10px; }
.leaf-portrait { display:block; width:88px; height:88px; object-fit:contain; flex:none; }
.leaf-casualties { margin-top:18px!important; font-size:13px; color:#756951; line-height:1.6; }
.leaf-casualties strong { font-weight:600; }
.leaf-offer { display:flex; align-items:center; gap:10px; padding:10px 0; border-top:1px solid #dce0d3; }
.leaf-offer .leaf-portrait { width:68px; height:68px; }
.leaf-offer-detail { flex:1; min-width:0; }
.leaf-offer-detail p { font-size:12px; color:#607064; margin-top:3px; }
.leaf-offer-controls { display:flex; flex-direction:column; align-items:stretch; flex:none; min-width:110px; }
.leaf-offer-controls .leaf-text-button { padding:5px; min-height:32px; font-size:12px; }
.leaf-empty { color:#607064; max-width:340px; }
.leaf-panel-footer { margin-top:28px; padding-top:20px; border-top:1px solid #dce0d3; display:flex; align-items:center; justify-content:space-between; gap:20px; }
.leaf-panel-footer p { font-size:12px; color:#607064; max-width:220px; }
html[data-leaf-screen="menu"] .leaf-panel { max-width:720px; }
.leaf-menu-art { display:flex; justify-content:center; margin:24px 0; }
.leaf-menu-art .leaf-portrait { width:120px; height:120px; }
.leaf-modes { display:grid; gap:12px; }
.leaf-panel .leaf-mode { display:block; text-align:left; padding:16px 22px; font-size:17px; }
.leaf-mode span { display:block; font-size:13px; font-weight:400; opacity:.8; margin-top:5px; }
.leaf-unit-info { display:flex; align-items:center; gap:40px; margin-top:24px; }
.leaf-unit-info>.leaf-portrait { width:180px; height:180px; }
.leaf-stats { flex:1; display:grid; grid-template-columns:1fr 1fr; gap:0 24px; margin:0; }
.leaf-stats>div { display:flex; align-items:baseline; justify-content:space-between; gap:12px; padding:10px 0; border-bottom:1px solid #dce0d3; }
.leaf-stats dt { color:#607064; font-size:13px; }
.leaf-stats dd { margin:0; font-size:18px; font-weight:600; }
.leaf-abilities { margin-top:24px; padding-top:20px; border-top:1px solid #dce0d3; }
.leaf-abilities p { font-size:14px; margin-top:8px; }
@media(max-width:730px) {
  .leaf-panel { padding:22px 18px; }
  .leaf-panel-header { gap:12px; }
  .leaf-panel .leaf-quiet { font-size:12px; padding-left:6px; }
  .leaf-campaign-summary { margin:20px 0; gap:12px; }
  .leaf-journey { gap:10px; }
  .leaf-journey li { width:26px; height:26px; }
  .leaf-journey li+li::before { width:10px; }
  .leaf-renown { flex-direction:column; align-items:center; gap:4px; }
  .leaf-renown strong { font-size:25px; }
  .leaf-renown span { font-size:11px; }
  .leaf-campaign-body { grid-template-columns:1fr; gap:24px; }
  .leaf-panel h2 { margin-bottom:12px; }
  .leaf-roster { grid-template-columns:repeat(auto-fit,minmax(145px,1fr)); }
  .leaf-unit { gap:4px; padding:8px 10px 8px 0; }
  .leaf-unit .leaf-portrait { width:54px; height:68px; }
  .leaf-unit h3 { font-size:13px; }
  .leaf-unit .leaf-text-button { font-size:12px; }
  .leaf-panel-footer { position:sticky; bottom:-22px; background:#f5f3e9; padding:14px 0 18px; margin-bottom:-22px; }
  .leaf-panel-footer p { max-width:120px; font-size:11px; }
  .leaf-panel .leaf-primary { padding:12px 18px; }
  .leaf-menu-art { margin:16px 0; }
  .leaf-menu-art .leaf-portrait { width:90px; height:90px; }
  .leaf-unit-info { gap:16px; align-items:flex-start; }
  .leaf-unit-info>.leaf-portrait { width:76px; height:100px; }
  .leaf-stats { grid-template-columns:1fr; }
}
@media(max-width:730px) {
  .leaf-panel { padding:16px; }
  .leaf-panel h1 { font-size:24px; }
  .leaf-panel .leaf-subtitle { font-size:12px; margin-top:5px; }
  .leaf-campaign-summary { margin:14px 0 16px; padding:10px 0; }
  .leaf-campaign-body { gap:16px; }
  .leaf-no-offers .leaf-improvements { display:none; }
  .leaf-panel-footer { bottom:-16px; margin-top:16px; margin-bottom:-16px; padding:10px 0 16px; }
  .leaf-panel-footer p { max-width:125px; }
}
.leaf-panel .leaf-offer-controls .leaf-text-button { min-height:44px; }
@media(max-width:350px) {
  .leaf-roster { grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); }
  .leaf-unit { padding:8px 4px; }
  .leaf-unit .leaf-portrait { width:38px; height:60px; }
  .leaf-unit h3 { font-size:12px; }
}
.leaf-panel-footer { position:sticky; bottom:-32px; margin-bottom:-32px; background:#f5f3e9; }
@media(min-width:731px) {
  .leaf-offer-controls { flex-direction:row; align-items:center; gap:8px; }
  .leaf-offer-controls .leaf-purchase { white-space:nowrap; }
  .leaf-offer-controls .leaf-text-button { padding:8px; }
}
@media(max-width:730px) {
  .leaf-panel-footer { bottom:-16px; margin-bottom:-16px; }
}
