/*
 * Toy Tanks: Paintball Arena (games/toy-tanks/style.css)
 * Responsive 11x9 Battle City arena canvas + ergonomic dual-thumb gamepad dock.
 */

:root {
  --game-bg: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 50%, #c7d2fe 100%);
  --game-ink: #0f172a;
  --game-accent: #1d4ed8;
  --game-banner-bg: rgba(255, 255, 255, 0.88);
}

.tanks-workspace {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 8px;
  gap: 6px;
  overflow: hidden;
  outline: none;
}

/* --- Top HUD Bar -------------------------------------------------------- */

.tanks-hud {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  width: 100%;
  max-width: 740px;
  flex: 0 0 auto;
  z-index: 2;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid rgba(59, 130, 246, 0.45);
  border-radius: 999px;
  padding: 3px 13px;
  font-size: 0.92rem;
  font-weight: 800;
  color: #1e3a8a;
  box-shadow: 0 3px 8px rgba(30, 58, 138, 0.08);
  font-variant-numeric: tabular-nums;
}

.hud-strong {
  color: #1d4ed8;
  font-weight: 900;
}

.hud-dim {
  color: #64748b;
}

.shields-icons {
  letter-spacing: 2px;
  font-size: 1rem;
}

/* --- Center Arena Stage ------------------------------------------------- */

.arena-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.arena-frame {
  position: relative;
  aspect-ratio: 11 / 9;
  height: 100%;
  max-height: 100%;
  max-width: 100%;
  background: #1e293b;
  border: 4px solid #334155;
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tank-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* Wave Cleared / Retry Overlay Inside Arena */
.wave-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 6;
}

.wave-card {
  background: #ffffff;
  border: 4px solid #38bdf8;
  border-radius: 24px;
  padding: 20px 22px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.35);
}

.wave-card-icon {
  font-size: 2.3rem;
  margin-bottom: 8px;
}

.wave-card-text {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
}

.tank-cta-btn {
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 3px solid #ffffff;
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.2);
  transition: transform 0.12s ease;
  touch-action: manipulation;
}

.tank-cta-btn:active {
  transform: scale(0.94);
}

.tank-cta-btn:focus-visible {
  outline: 4px solid #f59e0b;
  outline-offset: 3px;
}

.next-wave-btn {
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
}

.retry-wave-btn {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
}

/* --- Ergonomic Gamepad Dock (Mobile Thumb & Desktop Controls) ----------- */

.gamepad-dock {
  flex: 0 0 auto;
  width: 100%;
  max-width: 680px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 12px 4px;
  gap: 16px;
  z-index: 3;
}

/* 3x3 Cross D-Pad */
.dpad-cross {
  display: grid;
  grid-template-columns: repeat(3, 46px);
  grid-template-rows: repeat(3, 42px);
  gap: 3px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.78);
  border: 2px solid rgba(59, 130, 246, 0.38);
  border-radius: 26px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  touch-action: none;
  user-select: none;
}

.key-up {
  grid-column: 2;
  grid-row: 1;
}

.key-left {
  grid-column: 1;
  grid-row: 2;
}

.dpad-center {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  opacity: 0.65;
  pointer-events: none;
}

.key-right {
  grid-column: 3;
  grid-row: 2;
}

.key-down {
  grid-column: 2;
  grid-row: 3;
}

.dpad-key {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 2px solid #ffffff;
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(29, 78, 216, 0.25);
  transition: transform 0.08s ease, background 0.1s ease;
  touch-action: none;
}

.dpad-key.is-pressed,
.dpad-key:active {
  transform: scale(0.91);
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
}

.dpad-key:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
}

/* Right Thumb Big Fire Button */
.fire-zone {
  display: flex;
  align-items: center;
  justify-content: center;
}

.fire-btn {
  min-width: 132px;
  height: 88px;
  padding: 0 24px;
  border-radius: 44px;
  border: 4px solid #ffffff;
  background: linear-gradient(180deg, #fb7185 0%, #e11d48 60%, #be123c 100%);
  color: #ffffff;
  font-size: 1.22rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 8px 20px rgba(225, 29, 72, 0.35),
    inset 0 2px 5px rgba(255, 255, 255, 0.45);
  transition: transform 0.08s ease, box-shadow 0.1s ease;
  touch-action: none;
}

.fire-btn.is-firing,
.fire-btn:active {
  transform: scale(0.93);
  box-shadow: 0 3px 10px rgba(225, 29, 72, 0.3);
}

.fire-btn:focus-visible {
  outline: 4px solid #f59e0b;
  outline-offset: 3px;
}

/* --- Finale Celebration Overlay ----------------------------------------- */

.celebration-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.celebration-card {
  background: #ffffff;
  border: 4px solid #3b82f6;
  border-radius: 28px;
  padding: 28px 24px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.28);
}

.celebration-emojis {
  font-size: 2.8rem;
  margin-bottom: 12px;
}

.celebration-text {
  margin: 0 0 20px;
  font-size: 1.22rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
}

/* --- Responsive Adjustments (Mobile Portrait & Compact Landscape) ------- */

@media (max-width: 540px) {
  .arena-frame {
    width: 100%;
    height: auto;
  }

  .dpad-cross {
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(3, 40px);
  }

  .fire-btn {
    min-width: 118px;
    height: 78px;
    font-size: 1.08rem;
  }
}

@media (max-height: 580px) {
  .instruction-banner {
    display: none;
  }

  .tanks-hud {
    gap: 4px 8px;
  }

  .hud-pill {
    padding: 2px 10px;
    font-size: 0.8rem;
  }

  .gamepad-dock {
    padding: 0 8px 2px;
  }

  .dpad-cross {
    grid-template-columns: repeat(3, 36px);
    grid-template-rows: repeat(3, 32px);
    padding: 3px;
  }

  .dpad-key {
    font-size: 1rem;
  }

  .fire-btn {
    min-width: 104px;
    height: 62px;
    font-size: 0.96rem;
  }
}

/* --- Reduced Motion Support (TZ 5.4) ------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .dpad-key,
  .fire-btn,
  .tank-cta-btn {
    transition: none !important;
    animation: none !important;
  }
}
