/* /tanks/ — Tanks 1990: board, HUD and game controls only. Page frame,
   headline, mode tabs, stat tiles, panels, rank rows and the more-games
   row come from games.css. Board art keeps its own colours; UI chrome
   reads tokens. Shared by all locales. */

.tank-stage, .tank-stage * { -webkit-user-select: none; user-select: none; }
/* stage */
.tank-stage { position: relative; inline-size: 100%; max-width: 720px; margin: 0 auto; }
/* Square field: cap the width so status bar + field fit under the stuck header. */
.tank-stage:not(:fullscreen, .tank-fs) { max-inline-size: min(720px, max(300px, calc(100svh - var(--header-stuck) - 170px))); }
.tank-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: .4rem; margin-bottom: .5rem; }
.tank-tool-btn { display: inline-grid; place-items: center; inline-size: var(--tap); block-size: var(--tap); border-radius: var(--radius-md); cursor: pointer; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border-strong); transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease); }
.tank-tool-btn:hover { color: var(--text); background: var(--surface-3); }
.tank-fs-hud { display: none; }
.tank-stage:fullscreen { width: 100vw; max-width: none; height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg); }
.tank-stage:fullscreen .tank-fs-hud { display: flex; justify-content: space-between; align-items: center; width: min(92vw, 720px); padding: .4rem .2rem; font-family: var(--font-body); }
.tank-fs-hud-left { display: flex; gap: 1rem; color: #d6f0c0; font-weight: 600; }
.tank-stage:fullscreen .tank-status, .tank-stage:fullscreen .tank-actions { width: min(92vw, 720px); }
.tank-status { display: flex; align-items: center; justify-content: center; gap: 2.5rem; inline-size: 100%; max-width: 720px; margin: 0 auto .6rem; padding: .5rem .9rem; border-radius: var(--radius-md); background: var(--surface-1); border: 1px solid var(--border); }
.tank-stat-block { display: flex; flex-direction: column; align-items: center; gap: .18rem; }
.tank-stat-name { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.tank-counter { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-size: 1.8rem; font-weight: 700; letter-spacing: .06em; color: #9ae66e; background: #11210a; padding: .05rem .7rem; border-radius: 8px; min-width: 3.4rem; text-align: center; box-shadow: inset 0 0 8px rgba(154,230,110,.25); }
.tank-counter.alt { color: #fbbf24; background: #1a160d; box-shadow: inset 0 0 8px rgba(251,191,36,.25); }
.tank-card { border-radius: var(--radius-lg); padding: 8px; background: rgba(0,0,0,.35); border: 1px solid var(--border); box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.tank-box { position: relative; width: 100%; display: flex; align-items: center; justify-content: center; }
#tank-canvas { display: block; border-radius: 8px; background: #0c0e11; image-rendering: pixelated; touch-action: none; max-width: 100%; }
.tank-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .5rem; padding: 1.2rem; border-radius: 8px; background: rgba(7,9,12,.82); }
.tank-overlay.hidden { display: none; }
.tank-overlay h2 { font-family: var(--font-display); font-size: var(--step-3); text-transform: uppercase; margin: 0; line-height: 0.95; color: var(--text); }
.tank-overlay p { margin: 0; color: var(--text-muted); max-width: 460px; }
.tank-hint { font-weight: 700; color: #e0a92e !important; animation: tankPulse 1.4s ease-in-out infinite; }
@keyframes tankPulse { 0%,100%{opacity:.55;} 50%{opacity:1;} }
.tank-actions { display: flex; gap: .5rem; justify-content: center; margin-top: .7rem; }
.tank-actions:empty { display: none; }
.tank-action { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--font-body); font-weight: 600; font-size: .9rem; min-block-size: var(--tap); padding-inline: var(--space-5); border-radius: var(--radius-md); cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; color: #fff; }
.tank-action:disabled { opacity: .45; cursor: default; }
.tank-endgame { background: color-mix(in srgb, var(--danger) 14%, var(--surface-1)); border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent); color: var(--text); }
.tank-endgame:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 24%, var(--surface-1)); }
.tank-endgame > i { color: var(--danger); }
.tank-newgame { background: color-mix(in srgb, var(--lime) 12%, var(--surface-1)); border: 1px solid color-mix(in srgb, var(--lime) 50%, transparent); color: var(--text); }
.tank-newgame:hover:not(:disabled) { background: color-mix(in srgb, var(--lime) 22%, var(--surface-1)); }
.tank-newgame > i { color: var(--lime); }
/* on-screen touch controls */
/* Touch controls (coarse pointers only). On the page they live in a bar
         UNDER the battlefield — nothing covers the action any more; in
         fullscreen they become a small translucent overlay hugging the bottom
         corners, lighting up on press. */
.tank-touch { display: none; }
@media (pointer: coarse) {
  .tank-box { flex-direction: column; }
  .tank-touch { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); margin-top: 6px; background: rgba(12, 18, 9, .55); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; }
}
.tank-dpad { width: 112px; height: 112px; flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4px; pointer-events: auto; }
.tank-dbtn { border: 1px solid rgba(255,255,255,.25); background: rgba(20,30,14,.6); color: #cfe9b3; border-radius: 10px; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; touch-action: none; }
.tank-dbtn:active { background: rgba(111,174,58,.6); }
.tank-dbtn.up { grid-column: 2; grid-row: 1; }
.tank-dbtn.left { grid-column: 1; grid-row: 2; }
.tank-dbtn.right { grid-column: 3; grid-row: 2; }
.tank-dbtn.down { grid-column: 2; grid-row: 3; }
.tank-fire { width: 66px; height: 66px; flex: 0 0 auto; border-radius: 50%; pointer-events: auto; border: 2px solid rgba(224,169,46,.7); background: radial-gradient(circle at 35% 30%, rgba(239,68,68,.85), rgba(150,20,20,.85)); color: #fff; font-size: 1.4rem; box-shadow: 0 4px 14px rgba(0,0,0,.4); touch-action: none; }
.tank-fire:active { transform: scale(.94); }
/* fullscreen: tiny translucent corner overlay, lights up on press.
         Selectors are doubled (:fullscreen + .tank-fs class set from JS) so
         they work on every mobile engine. */
.tank-stage:fullscreen .tank-touch, .tank-stage.tank-fs .tank-touch { display: none; position: absolute; inset: 0; width: auto; padding: 0; margin: 0; background: none; border: none; pointer-events: none; }
@media (pointer: coarse) {
  .tank-stage:fullscreen .tank-touch, .tank-stage.tank-fs .tank-touch { display: block; }
}
.tank-stage:fullscreen .tank-dpad, .tank-stage.tank-fs .tank-dpad { position: absolute; left: max(8px, env(safe-area-inset-left, 0px)); bottom: max(10px, env(safe-area-inset-bottom, 0px)); width: 96px; height: 96px; opacity: .45; }
.tank-stage:fullscreen .tank-dbtn, .tank-stage.tank-fs .tank-dbtn { font-size: 1rem; border-radius: 8px; }
.tank-stage:fullscreen .tank-fire, .tank-stage.tank-fs .tank-fire { position: absolute; right: max(12px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); width: 54px; height: 54px; font-size: 1.1rem; opacity: .5; }
.tank-stage:fullscreen .tank-dbtn:active, .tank-stage.tank-fs .tank-dbtn:active, .tank-stage:fullscreen .tank-fire:active, .tank-stage.tank-fs .tank-fire:active { opacity: 1; }
/* the fullscreen stage layout must also hold when only the class matched */
.tank-stage.tank-fs { width: 100vw; max-width: none; height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg); }
.tank-stage.tank-fs .tank-fs-hud { display: flex; justify-content: space-between; align-items: center; width: min(92vw, 720px); padding: .4rem .2rem; font-family: var(--font-body); }
.tank-stage.tank-fs .tank-status, .tank-stage.tank-fs .tank-actions { width: min(92vw, 720px); }
.tank-lb-cta { display: flex; justify-content: center; }
@media (max-width: 520px) {
  .tank-counter { font-size: 1.5rem; min-width: 3rem; }
  .tank-status { padding: .4rem .6rem; gap: 1.6rem; }
}

/* ── Play layer (assets/play/play.mjs): lives/enemies strip + battlefield (sized
   by the script to the slot) + touch pad under it on coarse pointers. ── */
html.play-open .tank-play > :not(#tank-stage) { display: none; }
html.play-open .tank-stage { max-inline-size: none; inline-size: fit-content; max-width: 100%; margin-inline: auto; }
html.play-open .tank-toolbar, html.play-open .tank-actions, html.play-open .tank-fs-hud { display: none; }
html.play-open .tank-status { inline-size: auto; max-width: none; margin-block-end: .5rem; padding: .3rem .8rem; gap: 2rem; }
html.play-open .tank-counter { font-size: 1.35rem; }
html.play-open .tank-card { padding: 8px; }
/* The pad is a physical layout: keep it left-to-right in RTL locales so ◀ stays on the left. */
.tank-touch, .tank-dpad { direction: ltr; }
html.play-open .tank-play .cps-announce { display: none; }   /* the site promo panel stays on the page, not inside the game layer */
/* Level mode: the enemies count lives in the counter beside the board (Lives · Enemies Left);
   the strip above keeps level and best only, so the number is shown once. */
#tank-stats-lvl .stat-card:has(> #tank-stat-enemies) { display: none; }
