/* ==========================================================================
   GTA VI — LEONIDA ATLAS | ULTRA-MODERN GAME HUD UI (v1.0)
   Optimized for Cloudflare Pages Static Deployment
   ========================================================================== */

:root {
  --bg-deep: #070412;
  --glass-panel: rgba(13, 8, 28, 0.72);
  --glass-panel-hover: rgba(22, 13, 46, 0.86);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --neon-pink: #ff2a85;
  --neon-cyan: #00f0ff;
  --neon-amber: #ff9e44;
  --neon-violet: #9d4edd;
  --text-primary: #f8f7ff;
  --text-secondary: #b8b2d8;
  --text-muted: #7f78a6;

  --font-display: 'Chakra Petch', 'Orbitron', sans-serif;
  --font-tech: 'Rajdhani', 'Chakra Petch', sans-serif;
  --font-thai: 'Noto Sans Thai', 'Chakra Petch', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100vh;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-thai);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.bg-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-artwork {
  position: absolute;
  inset: -3%;
  width: 106%;
  height: 106%;
  background-image: url('../images/bg-vice-city.svg');
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

#ambientCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.bg-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 42, 133, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(7, 4, 18, 0.15) 35%, rgba(5, 2, 14, 0.85) 100%);
}

.bg-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.018) 0px,
    rgba(255, 255, 255, 0.018) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.bg-scanlines.is-off {
  opacity: 0;
}

.hud-topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(6, 3, 16, 0.82) 0%, rgba(6, 3, 16, 0) 100%);
  backdrop-filter: blur(8px);
}

.hud-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-tech);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan);
  animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.hud-divider {
  color: rgba(255, 255, 255, 0.2);
}

.hud-coords {
  color: var(--neon-amber);
  font-family: var(--font-display);
  font-size: 0.78rem;
}

.hud-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: #e0f7ff;
  font-family: var(--font-tech);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-toggle-btn:hover {
  background: rgba(0, 240, 255, 0.16);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.25);
}

.fx-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-cyan);
}

.hud-toggle-btn.is-muted .fx-indicator {
  background: #64748b;
}

.hud-badge-ver {
  padding: 5px 10px;
  border-radius: 4px;
  background: rgba(255, 42, 133, 0.15);
  border: 1px solid rgba(255, 42, 133, 0.4);
  color: #ffb3d4;
  font-size: 0.76rem;
}

.hub-container {
  position: relative;
  z-index: 5;
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand-hero {
  text-align: center;
  margin-bottom: 24px;
  animation: heroEnter 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes heroEnter {
  from {
    opacity: 0;
    transform: translateY(-18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.logo-wrapper {
  display: inline-block;
  position: relative;
  filter: drop-shadow(0 14px 35px rgba(255, 42, 133, 0.28));
  transition: transform 0.35s ease;
}

.logo-wrapper:hover {
  transform: scale(1.02);
}

.game-logo {
  width: min(580px, 90vw);
  height: auto;
  display: block;
  margin: 0 auto;
}

.hero-tagline {
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
}

.highlight-cyan {
  color: var(--neon-cyan);
  font-weight: 700;
}

.highlight-pink {
  color: #ff69ab;
  font-weight: 700;
}

.command-deck {
  width: 100%;
  background: linear-gradient(160deg, rgba(16, 10, 36, 0.76) 0%, rgba(9, 5, 22, 0.84) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 2px solid rgba(0, 240, 255, 0.55);
  border-radius: 14px;
  padding: 24px;
  backdrop-filter: blur(20px);
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  animation: deckEnter 0.85s 0.12s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes deckEnter {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.deck-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.deck-kicker {
  display: block;
  font-family: var(--font-tech);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--neon-cyan);
  margin-bottom: 2px;
}

.deck-heading {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.deck-status-summary {
  display: flex;
  gap: 8px;
}

.status-pill {
  font-family: var(--font-tech);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 4px;
}

.status-pill--active {
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid rgba(0, 240, 255, 0.45);
  color: var(--neon-cyan);
}

.status-pill--planned {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.game-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  background: var(--glass-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 18px 18px 14px;
  color: var(--text-primary);
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.game-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--neon-cyan), var(--neon-pink));
  opacity: 0.35;
  transition: opacity 0.25s ease;
}

.game-btn:hover,
.game-btn:focus-visible {
  transform: translateY(-4px);
  background: var(--glass-panel-hover);
  border-color: rgba(0, 240, 255, 0.65);
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.55),
    0 0 22px rgba(0, 240, 255, 0.18);
  outline: none;
}

.game-btn:hover::before,
.game-btn:focus-visible::before {
  opacity: 1;
}

.game-btn--featured {
  background: linear-gradient(135deg, rgba(255, 42, 133, 0.22) 0%, rgba(18, 12, 44, 0.88) 60%, rgba(0, 240, 255, 0.16) 100%);
  border-color: rgba(255, 42, 133, 0.6);
  box-shadow: 0 0 25px rgba(255, 42, 133, 0.16);
}

.game-btn--featured::before {
  width: 4px;
  opacity: 1;
  background: linear-gradient(180deg, #ff2a85, #ff9e44, #00f0ff);
}

.game-btn--featured:hover {
  border-color: var(--neon-pink);
  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(255, 42, 133, 0.32);
}

.btn-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  background: radial-gradient(
    260px circle at var(--mx, 50%) var(--my, 50%),
    rgba(0, 240, 255, 0.16),
    transparent 70%
  );
}

.game-btn--featured .btn-spotlight {
  background: radial-gradient(
    280px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 42, 133, 0.24),
    transparent 70%
  );
}

.game-btn:hover .btn-spotlight {
  opacity: 1;
}

.btn-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.btn-index {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--neon-cyan);
}

.game-btn--featured .btn-index {
  color: #ff77b7;
}

.btn-tag {
  font-family: var(--font-tech);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 3px;
}

.btn-tag--ready {
  background: rgba(255, 42, 133, 0.25);
  border: 1px solid rgba(255, 42, 133, 0.65);
  color: #ffd1e6;
}

.btn-tag--next {
  background: rgba(0, 240, 255, 0.16);
  border: 1px solid rgba(0, 240, 255, 0.45);
  color: #bdf9ff;
}

.btn-tag--soon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-muted);
}

.btn-hotkey {
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.btn-icon-box {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--neon-cyan);
  transition: all 0.25s ease;
}

.game-btn--featured .btn-icon-box {
  background: rgba(255, 42, 133, 0.2);
  border-color: rgba(255, 42, 133, 0.5);
  color: #ff85bc;
}

.game-btn:hover .btn-icon-box {
  transform: scale(1.06);
  border-color: var(--neon-cyan);
  color: #ffffff;
}

.btn-icon-box svg {
  width: 22px;
  height: 22px;
}

.btn-text {
  display: flex;
  flex-direction: column;
}

.btn-en {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffffff;
  line-height: 1.25;
}

.btn-th {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--neon-cyan);
  margin-top: 2px;
}

.game-btn--featured .btn-th {
  color: #ff94c4;
}

.btn-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-top: 6px;
}

.btn-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--font-thai);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.game-btn:hover .btn-footer {
  color: #ffffff;
}

.btn-arrow {
  font-family: var(--font-display);
  font-size: 0.95rem;
  transition: transform 0.2s ease;
}

.game-btn:hover .btn-arrow {
  transform: translateX(4px);
}

.hud-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 28px;
  background: linear-gradient(0deg, rgba(5, 2, 14, 0.92) 0%, rgba(5, 2, 14, 0) 100%);
  font-family: var(--font-tech);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  pointer-events: none;
}

.footer-left {
  display: flex;
  gap: 16px;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 3px;
}

.hud-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 2, 12, 0.8);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.hud-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.hud-modal-window {
  width: min(580px, 100%);
  background: linear-gradient(155deg, rgba(20, 12, 46, 0.96) 0%, rgba(9, 5, 22, 0.98) 100%);
  border: 1px solid rgba(0, 240, 255, 0.45);
  border-top: 3px solid var(--neon-pink);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.85),
    0 0 40px rgba(255, 42, 133, 0.22);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  transform: scale(0.94) translateY(12px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.hud-modal-backdrop.is-open .hud-modal-window {
  transform: scale(1) translateY(0);
}

.modal-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-code {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--neon-cyan);
}

.modal-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-secondary);
  font-family: var(--font-tech);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  border-color: var(--neon-pink);
  color: #ffffff;
  background: rgba(255, 42, 133, 0.2);
}

.modal-content {
  padding: 24px 24px 20px;
}

.modal-badge {
  display: inline-block;
  font-family: var(--font-tech);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: 3px;
  background: rgba(255, 42, 133, 0.2);
  border: 1px solid rgba(255, 42, 133, 0.55);
  color: #ffc2de;
  margin-bottom: 12px;
}

.modal-title-en {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.modal-title-th {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--neon-cyan);
  margin-top: 2px;
}

.modal-desc {
  margin-top: 12px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.modal-specs-box {
  margin-top: 18px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 8px;
}

.specs-header {
  font-family: var(--font-tech);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--neon-amber);
  margin-bottom: 10px;
}

.specs-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.specs-list li {
  position: relative;
  padding-left: 18px;
  font-size: 0.86rem;
  color: #e2e8f0;
}

.specs-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--neon-cyan);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-action-secondary {
  background: linear-gradient(90deg, rgba(255, 42, 133, 0.25), rgba(0, 240, 255, 0.2));
  border: 1px solid rgba(0, 240, 255, 0.5);
  color: #ffffff;
  font-family: var(--font-thai);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-action-secondary:hover {
  background: linear-gradient(90deg, rgba(255, 42, 133, 0.45), rgba(0, 240, 255, 0.35));
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.28);
}

.modal-ready-note {
  font-family: var(--font-tech);
  font-size: 0.8rem;
  color: var(--text-muted);
}

@media (max-width: 1024px) {
  .module-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .hud-topbar {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .hud-coords,
  .hud-divider,
  .hud-footer {
    display: none;
  }

  .hub-container {
    padding: 10px 14px 36px;
  }

  .command-deck {
    padding: 16px;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
}
