/* Keep the field visible; show additional choices when the player asks for them. */
.game{--dock-clear:94px}
.game[data-defense-open=true]{--dock-clear:274px}
.game .hud{z-index:3;pointer-events:none}
.game .hud button{pointer-events:auto}
.menu-button{display:flex;align-items:center;gap:7px;min-height:44px;padding:7px 12px;border:2px solid var(--bark-900);border-radius:var(--radius-pill);background:var(--cream-50);box-shadow:var(--lip-s);font:800 14px/1 var(--font-display)}
.menu-button svg{width:22px;height:22px}
.game[data-phase=ready]:not([data-defense-open=true]) #buy-coins{display:none}
.game:not([data-phase]) .wave-hud,.game:is([data-phase=loading],[data-phase=ready]) .wave-hud,.game .environment-badge,.game .nursery-label{display:none}
.game .scene-heading{left:22px;top:calc(76px + var(--app-safe-top,0px));right:18px}
.game .scene-heading .pill{display:none}
.game .scene-heading h2{margin:0;font-size:clamp(28px,8.4vw,36px);line-height:1.15;white-space:normal}
.game .scene-heading h2 br{display:none}
.game[data-defense-open=true] .scene-heading{visibility:hidden}
.game .start-card{bottom:calc(var(--dock-clear) + var(--app-safe-bottom,0px));padding:18px;max-height:calc(100% - var(--dock-clear) - 170px - var(--app-safe-top,0px) - var(--app-safe-bottom,0px));text-align:left;border-width:2px;border-radius:22px;box-shadow:0 4px 0 var(--bark-900);backdrop-filter:none}
.game .start-card>p:first-child{margin:0 0 6px;font-size:13px;line-height:1.35}
.game .start-card h3{font-size:26px;margin:0 0 14px}
.game .start-card .primary{height:52px;gap:12px;font-size:18px;border-width:2px;box-shadow:var(--lip-s)}
.game .energy-row{justify-content:flex-start;margin:0 0 14px;gap:8px}
.game .energy-chip{min-height:44px;padding:5px 10px 5px 5px;font-size:14px;border-width:1px;box-shadow:none}
.game .energy-chip svg{width:24px;height:24px}
.game .energy-note{font-size:12px;font-weight:700;line-height:1.3}
.game[data-phase=ready][data-defense-open=true] .start-card{padding:12px;max-height:calc(100% - var(--dock-clear) - 68px - var(--app-safe-top,0px) - var(--app-safe-bottom,0px))}
.game[data-phase=ready][data-defense-open=true] .start-card :is(#stage-title,#stage-objective){display:none}
.game[data-phase=ready][data-defense-open=true] .energy-row{margin-bottom:10px}
.game[data-phase=ready][data-defense-open=true] .start-card .primary{height:48px}
.game .bottom-dock{z-index:4;left:14px;right:14px;bottom:calc(12px + var(--app-safe-bottom,0px))}
.game .defense-toggle{display:flex;align-items:center;gap:10px;width:100%;min-height:58px;padding:9px 14px;text-align:left;border:2px solid var(--bark-900);border-radius:18px;background:var(--cream-50);box-shadow:var(--lip-s)}
.defense-toggle>svg{width:30px;height:30px}
.defense-toggle>span{flex:1;min-width:0}
.defense-toggle strong{display:block;font:800 16px/1.2 var(--font-display)}
.defense-toggle small{display:block;margin-top:3px;font:700 11px/1.2 var(--font-body);color:var(--bark-700)}
.defense-toggle .defense-chevron{width:22px;height:22px;transition:transform .15s}
.defense-toggle[aria-expanded=true] .defense-chevron{transform:rotate(180deg)}
.game .defense-panel{margin-bottom:10px;padding:12px;border:2px solid var(--bark-900);border-radius:18px;background:var(--cream-100);box-shadow:var(--lip-s);max-height:calc(100svh - 230px - var(--app-safe-top,0px) - var(--app-safe-bottom,0px));overflow-y:auto;overscroll-behavior:contain}
.game .defense-panel .dock-status{padding:4px 1px 10px;font-size:11px;color:var(--bark-700);text-shadow:none}
.game .defense-panel .tactical-briefing{margin:0 0 8px;padding:0;border:0;background:none}
.game .defense-panel .tactical-briefing summary{min-height:44px;display:flex;align-items:center;gap:8px}
.game .defense-panel .tactical-briefing summary::before{content:'+';font-size:20px}
.game .defense-panel .tactical-briefing[open] summary::before{content:'−'}
.game .defense-panel .micro{display:block;margin:8px 0;font-size:11px}
/* Keep build actions outside the scrolling body; sticky controls can disappear in iOS. */
.game #build-planner{top:calc(116px + var(--app-safe-top,0px));bottom:calc(12px + var(--app-safe-bottom,0px));left:calc(16px + var(--app-safe-left,0px));right:calc(16px + var(--app-safe-right,0px))}
.game #build-planner:not([hidden]){display:flex;flex-direction:column;justify-content:flex-end}
.game #build-planner[data-preview-side=top]{justify-content:flex-start}
.game #build-preview{flex:0 1 auto;min-height:0;max-height:100%;overflow:hidden;padding:12px;animation:none}
.game .build-preview:not([hidden]){display:flex;flex-direction:column}
.game .build-preview-heading{display:flex;align-items:flex-start;gap:10px;flex:none}
.game .build-preview-heading h3{flex:1;min-width:0;margin:4px 0 8px;padding:0;font-size:20px;line-height:1.2}
.game .build-preview .build-close{position:static;float:none;flex:none;width:44px;height:44px;margin:0}
.game .build-preview-body{min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
.game .build-preview-body p{margin:8px 0;font:700 12px/1.35 var(--font-body);color:var(--bark-700)}
.game .build-preview-actions{flex:none;padding-bottom:4px}
.game .build-preview-actions .build-payment{margin-top:8px;padding-top:8px;gap:8px}
.game .build-preview-actions .build-warning{margin:8px 0 0;padding:5px 8px;border:2px solid var(--berry-700);border-radius:8px;background:var(--cream-200);color:var(--berry-700);font:800 12px/1.3 var(--font-body)}
.game .build-preview .primary{position:static;min-height:48px;height:auto;width:100%;margin-top:10px;padding:8px;font-size:16px}
@media(max-height:450px){
  .game #build-planner{top:calc(60px + var(--app-safe-top,0px))}
  .game #build-preview{padding:8px}
  .game .build-preview-heading h3{font-size:17px}
  .game .build-preview .primary{min-height:44px;margin-top:6px}
}
.game .action{min-height:90px;border-radius:13px}
.game .action strong{font-size:11px}
.game .wave-hud{top:calc(68px + var(--app-safe-top,0px))}
.game .hero-vitals{top:calc(128px + var(--app-safe-top,0px));width:164px}
.game .hero-vitals:not(.hurt):not(.down):not(.low-health) #hero-state{display:none}
.game .tree-label{top:calc(128px + var(--app-safe-top,0px))}
.game .threat-callout{top:calc(204px + var(--app-safe-top,0px))}
.game .toast{top:calc(204px + var(--app-safe-top,0px))}
.game:has(.threat-callout:not([hidden])) .toast{top:calc(272px + var(--app-safe-top,0px))}
.game .skill-wrap{bottom:calc(94px + var(--app-safe-bottom,0px))}
.game .move-hint{bottom:calc(184px + var(--app-safe-bottom,0px))}
.game[data-defense-open=true] .combat-hud .skill-wrap,.game[data-planning=true] .combat-hud .skill-wrap,
.game[data-defense-open=true] .move-hint,.game[data-planning=true] .move-hint{display:none}
.game .tutorial-coach{top:calc(194px + var(--app-safe-top,0px));bottom:auto;max-height:124px;padding:10px 12px;gap:8px;grid-template-columns:minmax(0,1fr) 44px;font-size:12px;border-radius:16px;box-shadow:var(--lip-s)}
.game .tutorial-coach strong{font-size:14px;margin:0 0 4px}
.game .tutorial-coach p{margin:0;font-size:12px;line-height:1.35}
.game .tutorial-coach button[data-tutorial-skip]{width:44px;min-height:44px;padding:7px;font-size:22px;box-shadow:none}
.game[data-defense-open=true] .tutorial-coach{top:auto;bottom:calc(var(--dock-clear) + 10px + var(--app-safe-bottom,0px))}
.game-menu{margin-top:6px}
.menu-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.menu-entry{display:flex;align-items:center;gap:9px;min-height:76px;padding:12px;text-align:left;border:2px solid var(--bark-900);border-radius:16px;background:var(--cream-50);box-shadow:var(--lip-s);font:800 14px/1.25 var(--font-display)}
.menu-entry svg{width:30px;height:30px}
.menu-entry span{min-width:0;overflow-wrap:anywhere}
.menu-entry small{display:block;margin-top:4px;font:700 11px/1.2 var(--font-body);color:var(--bark-700)}
.menu-links{display:flex;flex-wrap:wrap;gap:4px 14px;margin-top:12px}
.menu-links button{min-height:44px;padding:8px 0;background:none;font:800 13px/1.3 var(--font-body);text-decoration:underline;text-underline-offset:4px}
.menu-ad{margin-top:8px}
.menu-ad-button{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:48px;padding:8px 10px;border:2px solid var(--bark-900);border-radius:14px;background:var(--sun-400);box-shadow:var(--lip-s);font:800 14px/1.25 var(--font-display);color:var(--bark-900)}
.menu-ad-button svg{width:22px;height:22px}
.menu-ad-button:disabled{background:var(--cream-200);color:var(--bark-500);box-shadow:none}
.dialog-inner .menu-ad-status{margin:6px 0 0;font:700 11px/1.35 var(--font-body);color:var(--bark-700)}
.menu-details{margin-top:6px;font:700 12px/1.4 var(--font-body);color:var(--bark-700)}
.menu-details summary{min-height:44px;padding:12px 0;cursor:pointer}
.menu-details p{font-size:13px}
.game-menu .daily-entry{margin-top:16px}
@media(max-height:700px){
  .game .scene-heading{top:calc(68px + var(--app-safe-top,0px))}
  .game .start-card{padding:14px;max-height:calc(100% - var(--dock-clear) - 120px - var(--app-safe-top,0px) - var(--app-safe-bottom,0px))}
  .game .start-card h3{font-size:23px;margin-bottom:10px}
  .game .energy-row{margin-bottom:10px}
  .game[data-phase=ready]:not([data-defense-open=true]) .start-card{display:grid;grid-template-columns:auto minmax(0,1fr);gap:8px;align-items:center}
  .game[data-phase=ready]:not([data-defense-open=true]) #stage-title{display:none}
  .game[data-phase=ready]:not([data-defense-open=true]) #stage-objective{grid-column:1/-1;margin:0}
  .game[data-phase=ready]:not([data-defense-open=true]) .energy-row{display:contents}
  .game[data-phase=ready]:not([data-defense-open=true]) .energy-note{grid-column:1/-1;grid-row:3;font-size:11px}
  .game[data-phase=ready]:not([data-defense-open=true]) #energy-chip{grid-column:1;grid-row:2}
  .game[data-phase=ready]:not([data-defense-open=true]) #start{grid-column:2;grid-row:2;height:48px;min-width:0;padding:0 10px;gap:6px;font-size:clamp(14px,4.4vw,17px);white-space:nowrap}
  .game[data-phase=ready]:not([data-defense-open=true]) #start svg{width:18px;height:18px}
  .game[data-mode=daily][data-phase=ready] #start{grid-column:1/-1}
  .game .tutorial-coach{padding:10px;max-height:124px}
  .game[data-defense-open=true] .tutorial-coach{bottom:calc(var(--dock-clear) + var(--app-safe-bottom,0px))}
  .menu-entry{min-height:68px;padding:10px;font-size:13px}
}
