/* ===== GAME SCREEN ===== */
#screen-game {
  background: #1a8ce8;
  overflow: hidden;
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* Timer — canto superior direito, relativo ao .game-wrapper (956×440) */
#hud-timer {
  position: absolute;
  top: 80px;
  right: 16px;
  z-index: 9999;
  font-size: 3rem;
  font-weight: 1000;
  color: #f74141;
  text-shadow: 0px -1px 1px rgba(0,0,0,0.8), 0 0 16px rgba(226, 204, 204, 0.7), 0 2px 4px rgba(0,0,0,0.8), 1px 1px 1px rgba(0,0,0,0.8);
  pointer-events: none;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.canvas-wrapper {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  touch-action: none;
}

.canvas-container {
  position: absolute;
  background: linear-gradient(to bottom, #1a8ce8 0%, #4ab0f5 55%, #f5a623 88%, #d4622a 100%);
  overflow: hidden;
}

.canvas-container canvas {
  position: absolute;
  top: 0;
  left: 0;
}

#terrain-canvas { z-index: 1; }
#game-canvas    { z-index: 2; }
#ui-canvas      { z-index: 3; }
#fx-canvas      { z-index: 4; }
#text-canvas    { z-index: 5; }

.turn-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85);
  border: 2px solid #4FC3E8;
  border-radius: 14px;
  padding: 16px 28px;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  z-index: 20;
  pointer-events: none;
  white-space: nowrap;
  color: #fff;
}

/* ===== SUDDEN DEATH BANNER ===== */
.sudden-death-banner {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(180, 0, 0, 0.92);
  border: 3px solid #ff4444;
  border-radius: 10px;
  padding: 14px 32px;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 12px #ff0000;
  z-index: 9999;
  pointer-events: none;
  animation: sudden-in 0.3s ease-out, sudden-out 0.5s ease-in 2.5s forwards;
}

@keyframes sudden-in {
  from { opacity: 0; transform: translate(-50%, -60%) scale(0.7); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes sudden-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ===== TOP HUD (vento + clima) ===== */
#top-hud {
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 50;
  pointer-events: none;
}
.top-hud-divider { display: none; }

#wind-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(0, 15, 40, 0.45);
  border: 1px solid rgba(80, 160, 255, 0.3);
  border-radius: 8px;
  padding: 3px 8px;
}

/* ===== WEATHER FORECAST ===== */
#weather-forecast {
  position: absolute;
  top: 0;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 15, 40, 0.45);
  border: 1px solid rgba(80, 160, 255, 0.3);
  border-radius: 6px;
  padding: 4px 8px;
}
.wf-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: radial-gradient(ellipse at 50% 30%, rgba(80, 160, 255, 0.18) 0%, rgba(0, 15, 40, 0.35) 80%);
  border: 1px solid rgba(80, 160, 255, 0.2);
  border-radius: 5px;
  padding: 2px 3px;
  width: 30px;
  height: 30px;
}
.wf-slot--empty .wf-name {
  font-size: 16px;
  max-width: unset;
  line-height: 1;
}
.wf-slot--wind {
  border-color: rgba(100, 220, 255, 0.65);
  background: radial-gradient(ellipse at 50% 30%, rgba(0, 190, 255, 0.25) 0%, rgba(0, 20, 50, 0.45) 80%);
}
.wf-slot--wind .wf-name {
  font-size: 15px;
  max-width: unset;
  line-height: 1;
}
.wf-slot--wind-change {
  border-color: rgba(100, 220, 255, 0.5);
}
.wf-wind-badge {
  display: none;
  position: absolute;
  bottom: 1px;
  right: 1px;
  font-size: 8px;
  line-height: 1;
}
.wf-slot--current {
  background: radial-gradient(ellipse at 50% 30%, rgba(100, 200, 255, 0.32) 0%, rgba(0, 30, 70, 0.55) 80%);
  border: 1px solid rgba(100, 180, 255, 0.55);
  border-radius: 5px;
  padding: 2px 4px;
}
.wf-name {
  font-size: 7px;
  color: #c8e8ff;
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
  max-width: 34px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wf-slot--current .wf-name {
  font-size: 8px;
  color: #e8f6ff;
}
.wf-arrow {
  font-size: 12px;
  color: rgba(120, 180, 240, 0.45);
  line-height: 1;
  margin-bottom: 6px;
}
.wf-sprite {
  image-rendering: pixelated;
  display: block;
}

/* ===== CONTROLES ===== */
.controls {
    position: absolute;
    bottom: 8px;
    left: 50%;
    width: 755px;
    height: 55px;
    transform: translateX(-50%);
    z-index: 30;
    background: rgb(1 84 149);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgb(255 255 255 / 30%);
    border-radius: 10px;
    padding: 3px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: auto;
}

.controls-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.ctrl-btn {
  background: #243447;
  border: 1px solid #3a5068;
  border-radius: 6px;
  color: #cce;
  font-size: 1rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  font-weight: 700;
}

.ctrl-btn:active { filter: brightness(1.3); transform: scale(0.95); }
.ctrl-sm { width: 34px; height: 34px; font-size: 0.85rem; }

.shot-selector-container { display: flex; gap: 5px; flex-shrink: 0; }

.shot-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  font-weight: 900;
  font-size: 0.9rem;
  color: #fff;
  gap: 3px;
  user-select: none;
  border: 2px solid transparent;
}

.shot-selector:active { filter: brightness(1.2); }
.shot-s1  { background: #2a7fc1; border-color: #4aaaf0; }
.shot-s2  { background: #1e6aa0; border-color: #3a90d0; }
.shot-ss  { background: #b8900a; border-color: #f0c030; color: #fff8e1; }

.light {
  width: 8px; height: 8px; border-radius: 50%;
  background: #333; flex-shrink: 0;
}
#light1  { background: #2ecc71; }
#light2  { background: #333; }
#lightss { background: #333; }

.angle-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.angle-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: #99bbcc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.angle-box {
  background: #0d1a26;
  border: 1px solid #3a5068;
  border-radius: 4px;
  min-width: 42px;
  padding: 2px 6px;
  text-align: center;
  font-size: 1rem;
  font-weight: 900;
  color: #f0c030;
}

#power-container {
  width: 340px;
  flex-shrink: 0;
  height: 42px;
  background: #0d1a26;
  border: 1px solid #3a5068;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.power-ruler {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.power-ruler-tick {
  position: absolute;
  bottom: 0;
  width: 1px;
}
.power-ruler-tick--major {
  height: 40%;
  background: rgba(255, 255, 255, 0.5);
}
.power-ruler-tick--minor {
  height: 22%;
  background: rgba(255, 255, 255, 0.2);
}
.power-ruler-label {
  position: absolute;
  bottom: 3px;
  transform: translateX(-50%);
  font-size: 7px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  font-family: var(--font-display);
  pointer-events: none;
  line-height: 1;
}

#power-bar-fill {
  height: 100%; min-width: 5px;
  background: linear-gradient(90deg, #2ecc71, #f39c12, #e74c3c);
  position: relative;
}

#prev-power {
  position: absolute; top: 0; left: 5px;
  width: 3px; height: 100%;
  background: rgba(255,255,255,0.85);
  pointer-events: none;
  transition: left 0.1s ease;
}


.powerups-bar {
  position: absolute;
  bottom: 100%;
  left: 12px;
  display: flex;
  gap: 6px;
  padding-bottom: 4px;
}

/* ===== GAME HUD ELEMENTS ===== */
#overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 100;
  pointer-events: none;
}
#overlay.hidden { display: none; }

#turn-queue-container {
    position: absolute;
    top: 2px;
    left: 2px;
    background: rgb(0 0 0 / 34%);
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 0.52rem;
    color: #fff;
    z-index: 10;
    pointer-events: auto;
    text-shadow: 1px 1px 1px #000, -1px -1px 1px #000;
}
#turn-queue { list-style: none; margin: 4px 0 0; padding: 0; pointer-events: none; }
#turn-queue li { padding: 2px 0; display: flex; align-items: center; gap: 4px; }

#btn-quit-game {
  display: block; width: 100%;
  background: rgba(180,30,30,0.85); color: #fff;
  border: none; border-radius: 4px;
  padding: 3px 0; font-size: 0.7rem; font-weight: bold;
  cursor: pointer; letter-spacing: 0.05em;
  margin-bottom: 4px;
}
#btn-quit-game:hover { background: rgba(220,40,40,0.95); }


#ctrl-angle-up   { grid-column: 2; grid-row: 1; }
#ctrl-left       { grid-column: 1; grid-row: 2; }
.ctrl-dpad-center { grid-column: 2; grid-row: 2; background: rgba(255,255,255,0.04); border-radius: 50%; }
#ctrl-right      { grid-column: 3; grid-row: 2; }
#ctrl-angle-down { grid-column: 2; grid-row: 3; }

.ctrl-dpad {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgb(0 0 0 / 28%);
    border: 2px solid rgb(255 255 255 / 42%);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(4px);
    transition: background 0.08s, transform 0.08s;
}
.ctrl-dpad:active {
  background: rgb(0 0 0 / 48%);
 border-color: rgb(255 255 255 / 42%);
  transform: scale(0.88);
  box-shadow: 0 1px 5px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.25);
}

#canvas-move-controls {
  position: absolute; 
  bottom: 7%; 
  left: 30px; 
  transform: translateY(-50%);
  display: grid;
  grid-template-columns: repeat(3, 34px);
  grid-template-rows: repeat(3, 34px);
  gap: 3px;
  z-index: 20; pointer-events: auto;
}

#drag-fire-zone {
    position: absolute;
    bottom: 10%;
    right: 30px;
    transform: translateY(-50%);
    background: rgb(10 30 70 / 61%);
    border: 2px solid rgba(100, 180, 255, 0.35);
    border-radius: 14px;
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 20;
    user-select: none;
    touch-action: none;
    cursor: grab;
    backdrop-filter: blur(4px);
}

#drag-fire-zone.disabled { opacity: 0.35; pointer-events: none; }
#drag-fire-zone.dragging { cursor: grabbing; }
#drag-fire-label {
  font-size: 0.55rem; color: rgba(180,220,255,0.7);
  letter-spacing: 1.5px; font-weight: 700; text-transform: uppercase;
}
#drag-fire-handle {
  width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe066, #e67e00);
  border: 2px solid rgba(255,255,255,0.7);
  box-shadow: 0 0 10px rgba(255,160,0,0.5);
  transition: transform 0.1s, box-shadow 0.1s;
}
#drag-fire-zone.dragging #drag-fire-handle {
  transform: scale(0.88);
  box-shadow: 0 0 18px rgba(255,80,0,0.7);
  background: radial-gradient(circle at 35% 35%, #ff9933, #cc3300);
}

#wind-canvas { border-radius: 50%; display: block; }
#wind-text {
  font-size: 0.7rem; font-weight: 700; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8); white-space: nowrap;
}

.game-settings-btn { position: absolute; top: 140px; right: 12px; z-index: 9999; }

/* ===== SAFE AREA ===== */
@supports (padding: max(0px)) {
  .controls { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
}

/* ===== TAG SWAP PANEL ===== */
#tag-swap-panel {
  position: absolute;
  bottom: 140px;
  right: 12px;
  z-index: 30;
}
#tag-swap-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.72);
  border: 2px solid #ffe066;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  min-width: 60px;
  transition: transform 0.1s, border-color 0.15s;
}
#tag-swap-btn:active { transform: scale(0.92); }
#tag-swap-btn:hover  { border-color: #fff; }
.tag-swap-label {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #ffe066;
  text-transform: uppercase;
}
#tag-swap-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  white-space: nowrap;
}

/* ── HUD de recompensas acumuladas (dentro do #turn-queue-container) ────────── */
#match-rewards-hud {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(255,255,255,0.15);
  pointer-events: none;
}
#match-rewards-gp,
#match-rewards-gold {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
#match-rewards-gp   { color: #a0e8ff; }
#match-rewards-gold { color: #ffd700; }

/* ── Notificações flutuantes de bônus ──────────────────────────────────────── */
#bonus-notifs {
  position: absolute;
  top: 98px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  width: 280px;
}
.bonus-notif {
  font-family: var(--font-display, sans-serif);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 14px;
  border-radius: 20px;
  background: rgba(0,0,0,0.75);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.18);
  white-space: nowrap;
  animation: bonusIn 0.15s ease forwards, bonusOut 0.35s ease 1.85s forwards;
  text-align: center;
}
.bonus-notif--mine  { color: #ffe44d; border-color: rgba(255,228,77,0.35); }
.bonus-notif--kill  { color: #ff8080; }
.bonus-notif--multi { color: #ff5500; font-size: 14px; }

@keyframes bonusIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.88); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
@keyframes bonusOut {
  to { opacity: 0; transform: translateY(-10px); }
}
