/* ==========================================================================
   STRIKE — Styles
   Minimalist dark arcade aesthetic
   ========================================================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Palette */
  --bg:           #000000;
  --surface:      #0a0a0a;
  --surface-lite: #141414;
  --border:       #1a1a1a;
  --text:         #e0e0e0;
  --text-dim:     #666666;
  --red:          #e63030;
  --red-glow:     #ff4444;
  --blue:         #3090e6;
  --blue-glow:    #44aaff;
  --orange:       #e69030;
  --orange-glow:  #ffaa44;
  --white-glow:   rgba(255, 255, 255, 0.08);

  /* Sizing */
  --panel-h:      90px;
  --btn-size:     130px;

  /* Timing */
  --ease-out:     cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Light Mode — Original Game ─── */
[data-theme="light"] {
  --bg:           #f0f0f0;
  --surface:      #e0e0e0;
  --surface-lite: #d5d5d5;
  --border:       #c0c0c0;
  --text:         #1a1a1a;
  --text-dim:     #555555;
  --white-glow:   rgba(0, 0, 0, 0.06);
}
[data-theme="light"] #strike-counter { color: #1a1a1a; }
[data-theme="light"] .strike-label { color: #444; }
[data-theme="light"] #global-stats { color: #555; }
[data-theme="light"] #global-stats span[id] { color: #222; }
[data-theme="light"] #copyright { color: #888; }
[data-theme="light"] #victory-text { color: #cc0000; }
[data-theme="light"] .missile-opt {
  background: #d8d8d8;
  border-color: #bbb;
  color: #222;
}
[data-theme="light"] .missile-opt.selected {
  background: #ccc;
}
[data-theme="light"] .opt-stat { color: #555; }
[data-theme="light"] #control-panel { background: #e0e0e0; border-color: #ccc; }
[data-theme="light"] #launch-zone .btn-ring { border-color: rgba(200, 0, 0, 0.3); }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Game Canvas ---------- */
#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Launch Button Zone ---------- */
#launch-zone {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

#launch-btn {
  position: relative;
  width: var(--btn-size);
  height: var(--btn-size);
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s var(--ease-out);
}

#launch-btn:active:not(:disabled) {
  transform: scale(0.92);
}

#launch-btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

#launch-btn:disabled .btn-ring {
  animation: none;
  border-color: #333;
  box-shadow: none;
}

#launch-btn:disabled .btn-face {
  background: #1a1a1a;
  color: #444;
  box-shadow: none;
}

/* Outer pulsing ring */
.btn-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--red);
  animation: pulse-ring 2.4s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(230, 48, 48, 0.15);
}

@keyframes pulse-ring {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.06); }
}

/* Inner button face */
.btn-face {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #d42a2a, #8b1a1a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  box-shadow:
    0 4px 24px rgba(230, 48, 48, 0.3),
    inset 0 -3px 8px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.1);
  transition: box-shadow 0.2s ease;
}

#launch-btn:hover:not(:disabled) .btn-face {
  box-shadow:
    0 4px 32px rgba(230, 48, 48, 0.5),
    inset 0 -3px 8px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.15);
}

/* ---------- Strike Counter ---------- */
#strike-counter {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 10;
  pointer-events: none;
}

#strike-count {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text);
  line-height: 1;
  transition: transform 0.2s var(--ease-spring), color 0.3s ease;
}

#strike-count.bump {
  transform: scale(1.3);
  color: var(--red-glow);
}

.strike-label {
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ---------- Global Stats ---------- */
#global-stats {
  position: fixed;
  top: 20px;
  right: 24px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-dim);
  z-index: 10;
  pointer-events: none;
  opacity: 0.7;
}

.stat-sep {
  margin: 0 6px;
  opacity: 0.4;
}

#stat-players,
#stat-strikes {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Victory Text ---------- */
#victory-text {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 8px;
  color: #ffffff;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.5), 0 0 60px rgba(255, 100, 50, 0.3);
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}

#victory-text.visible {
  opacity: 1;
}

/* ---------- Copyright ---------- */
#copyright {
  position: fixed;
  bottom: calc(var(--panel-h) + 8px);
  right: 12px;
  font-size: 9px;
  letter-spacing: 1px;
  color: #333;
  z-index: 10;
  pointer-events: none;
}

/* ---------- Control Panel ---------- */
#control-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--panel-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-inner {
  display: flex;
  gap: 12px;
  padding: 0 16px;
}

/* Missile option buttons */
.missile-opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 24px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-lite);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  outline: none;
  min-width: 100px;
}

.missile-opt:hover {
  border-color: #2a2a2a;
  background: #1a1a1a;
  color: var(--text);
}

/* Default selection (Tomahawk — red) */
.missile-opt.selected {
  border-color: var(--red);
  background: rgba(230, 48, 48, 0.06);
  color: var(--text);
  box-shadow: 0 0 16px rgba(230, 48, 48, 0.1);
}

/* Type-specific selection colors */
.missile-opt.selected[data-type="machinegun"] {
  border-color: var(--blue);
  background: rgba(48, 144, 230, 0.06);
  box-shadow: 0 0 16px rgba(48, 144, 230, 0.1);
}

.missile-opt.selected[data-type="mop"] {
  border-color: var(--orange);
  background: rgba(230, 144, 48, 0.06);
  box-shadow: 0 0 16px rgba(230, 144, 48, 0.1);
}

.opt-icon {
  width: 28px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.opt-icon svg {
  width: 100%;
  height: 100%;
}

.opt-name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
}

.opt-stat {
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.5;
}

/* ---------- App Brand (Logo + Title) ---------- */
#app-brand {
  position: fixed;
  top: 20px;
  left: 72px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px 4px 4px;
  border-radius: 8px;
  transition: all 0.2s ease;
}
#app-brand:hover {
  background: rgba(255, 255, 255, 0.05);
}
[data-theme="light"] #app-brand:hover {
  background: rgba(0, 0, 0, 0.05);
}
.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #d42a2a, #8b1a1a);
  box-shadow: 0 0 12px rgba(230, 48, 48, 0.3), inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}
.brand-name {
  font-family: 'Orbitron', 'Share Tech Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--text);
  text-transform: uppercase;
  opacity: 0.85;
}
[data-theme="light"] .brand-logo {
  box-shadow: 0 0 10px rgba(200, 40, 40, 0.25), inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

/* ---------- Global Leaderboard Button ---------- */
#global-lb-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 9000;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #333;
  background: rgba(10, 10, 10, 0.85);
  color: #e0e0e0;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#global-lb-btn:hover {
  border-color: #FFA500;
  box-shadow: 0 0 12px rgba(255, 165, 0, 0.3);
  transform: scale(1.08);
}
[data-theme="light"] #global-lb-btn {
  background: rgba(220, 220, 220, 0.9);
  border-color: #aaa;
  color: #1a1a1a;
}

/* ---------- Global Leaderboard Backdrop ---------- */
#global-lb-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#global-lb-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Global Leaderboard Drawer ---------- */
#global-lb-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 340px;
  max-width: 90vw;
  z-index: 9600;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
  font-family: 'Share Tech Mono', 'SF Mono', 'Fira Code', monospace;
}
#global-lb-drawer.open {
  transform: translateX(0);
}

.glb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.glb-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text);
  text-transform: uppercase;
}
.glb-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.glb-close:hover {
  border-color: var(--red);
  color: var(--red);
}

/* Tabs */
.glb-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.glb-tab {
  flex: 1;
  padding: 10px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}
.glb-tab:hover {
  color: var(--text);
  background: var(--surface-lite);
}
.glb-tab.active {
  color: #FFA500;
  border-bottom-color: #FFA500;
}

/* Country filter dropdown */
.glb-country-filter {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.glb-country-filter select {
  width: 100%;
  background: var(--surface-lite);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}
.glb-country-filter select:focus {
  border-color: #FFA500;
}

/* Rows list */
.glb-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.glb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  transition: background 0.15s ease;
}
.glb-row:hover {
  background: var(--surface-lite);
}
.glb-rank {
  width: 32px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.glb-rank.gold { color: #FFD700; }
.glb-rank.silver { color: #C0C0C0; }
.glb-rank.bronze { color: #CD7F32; }
.glb-flag {
  font-size: 16px;
  width: 22px;
  text-align: center;
}
.glb-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.glb-score {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #FFA500;
}
.glb-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 2px;
}

/* ---------- About Dialog ---------- */
#about-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#about-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

#about-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  z-index: 9800;
  width: 440px;
  max-width: 90vw;
  max-height: 80vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
#about-dialog.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.about-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.about-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #d42a2a, #8b1a1a);
  box-shadow: 0 0 16px rgba(230, 48, 48, 0.3);
  flex-shrink: 0;
}
.about-header h2 {
  font-family: 'Orbitron', 'Share Tech Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--text);
  margin: 0;
}

.about-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.about-tagline {
  font-size: 13px;
  color: var(--red);
  letter-spacing: 1px;
  margin-bottom: 20px;
  font-style: italic;
  opacity: 0.9;
}
.about-section {
  margin-bottom: 18px;
}
.about-section h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.about-section p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0;
}
.about-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.about-section li {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
  padding-left: 16px;
  position: relative;
  margin-bottom: 4px;
}
.about-section li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--red);
  font-weight: 700;
}
.about-section li strong {
  color: var(--text);
}

#about-close {
  margin: 0 24px 20px;
  padding: 14px 24px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'Orbitron', 'Share Tech Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}
#about-close:hover {
  background: #cc2020;
  box-shadow: 0 0 20px rgba(230, 48, 48, 0.3);
  transform: translateY(-1px);
}

/* ---------- Screen Flash Overlay ---------- */
#screen-flash {
  position: fixed;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

/* ---------- Responsive ---------- */

/* Portrait phones: push button into lower third, above control panel */
@media (max-aspect-ratio: 4/5) {
  #launch-zone {
    align-items: flex-end;
    padding-bottom: calc(var(--panel-h) + 50px);
  }

  #strike-counter {
    top: 12px;
  }

  #global-stats {
    top: 68px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    font-size: 9px;
    white-space: nowrap;
  }

  #victory-text {
    font-size: 20px;
    letter-spacing: 5px;
  }

  #copyright {
    bottom: calc(var(--panel-h) + 6px);
    font-size: 8px;
  }
}

@media (max-width: 600px) {
  :root {
    --btn-size: 100px;
    --panel-h: 76px;
  }

  #global-lb-btn {
    top: 12px;
    left: 12px;
    width: 38px;
    height: 38px;
    font-size: 17px;
  }

  #app-brand {
    top: 14px;
    left: 58px;
    gap: 8px;
  }
  .brand-logo {
    width: 22px;
    height: 22px;
  }
  .brand-name {
    font-size: 13px;
    letter-spacing: 3px;
  }

  .btn-face {
    font-size: 11px;
    letter-spacing: 2px;
  }

  .missile-opt {
    padding: 8px 14px;
    min-width: 80px;
  }

  .opt-name {
    font-size: 11px;
  }

  .opt-stat {
    font-size: 8px;
  }

  #strike-count {
    font-size: 28px;
  }

  #global-stats {
    font-size: 10px;
    right: 16px;
  }
}

@media (max-width: 380px) {
  .panel-inner {
    gap: 6px;
  }

  .missile-opt {
    padding: 6px 10px;
    min-width: 70px;
  }

  .opt-icon {
    width: 22px;
    height: 18px;
  }
}
