/* ==========================================================================
   ATOM // SYSTEM BREACH — NEURAL DEFENSE PROTOCOL
   Dedicated Game Subsystem CSS
   ========================================================================== */

/* Fullscreen Modal Backdrop */
.atom-game-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(3, 6, 12, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--text-main, #e0f2fe);
  padding: 1rem;
}

.atom-game-modal.active {
  opacity: 1;
  pointer-events: auto;
}

/* Modal Outer Frame Box */
.atom-game-frame {
  position: relative;
  width: 100%;
  max-width: 860px;
  max-height: 92vh;
  background: #040812;
  border: 1px solid var(--border-glow, rgba(0, 255, 204, 0.4));
  box-shadow: 0 0 50px rgba(0, 255, 204, 0.15), inset 0 0 30px rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Modal Header Bar */
.atom-game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: rgba(6, 12, 24, 0.95);
  border-bottom: 1px solid var(--border-color, rgba(0, 255, 204, 0.2));
}

.atom-game-title-box {
  display: flex;
  flex-direction: column;
}

.atom-game-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--neon-cyan, #00ffcc);
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.atom-game-title-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-cyan, #00ffcc);
  box-shadow: 0 0 10px var(--neon-cyan, #00ffcc);
  animation: recog-pulse 2s infinite ease-in-out;
}

.atom-game-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
  letter-spacing: 0.12em;
}

.atom-game-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.atom-game-btn-icon {
  background: rgba(0, 255, 204, 0.06);
  border: 1px solid var(--border-color, rgba(0, 255, 204, 0.25));
  color: var(--neon-cyan, #00ffcc);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.atom-game-btn-icon:hover {
  background: rgba(0, 255, 204, 0.2);
  border-color: var(--neon-cyan, #00ffcc);
  box-shadow: 0 0 12px rgba(0, 255, 204, 0.3);
}

.atom-game-close-btn {
  background: rgba(255, 50, 80, 0.1);
  border: 1px solid rgba(255, 50, 80, 0.3);
  color: #ff4772;
}

.atom-game-close-btn:hover {
  background: rgba(255, 50, 80, 0.25);
  border-color: #ff4772;
  box-shadow: 0 0 12px rgba(255, 50, 80, 0.4);
}

/* Game Body / Main Area */
.atom-game-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: #02050b;
  overflow: hidden;
}

/* Screens: Intro, Playing, Game Over */
.atom-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.atom-screen.hidden {
  display: none !important;
}

/* Intro Screen */
.atom-intro-box {
  max-width: 540px;
  text-align: center;
  background: rgba(8, 16, 32, 0.8);
  border: 1px solid var(--border-color, rgba(0, 255, 204, 0.3));
  padding: 2.25rem 1.75rem;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  position: relative;
}

.atom-intro-tag {
  font-size: 0.78rem;
  color: var(--neon-cyan, #00ffcc);
  margin-bottom: 0.75rem;
  display: block;
}

.atom-intro-heading {
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.atom-intro-terminal {
  background: rgba(2, 6, 14, 0.9);
  border-left: 3px solid var(--neon-cyan, #00ffcc);
  padding: 1rem;
  text-align: left;
  font-size: 0.88rem;
  color: var(--neon-cyan, #00ffcc);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.atom-controls-hint {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.atom-hint-item span {
  color: var(--neon-cyan, #00ffcc);
  font-weight: 600;
  background: rgba(0,255,204,0.08);
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  border: 1px solid rgba(0,255,204,0.2);
}

/* HUD Top Telemetry Bar inside playing screen */
.atom-hud-bar {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.atom-hud-card {
  background: rgba(6, 14, 28, 0.8);
  border: 1px solid rgba(0, 255, 204, 0.2);
  padding: 0.4rem 0.75rem;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
}

.atom-hud-label {
  font-size: 0.65rem;
  color: var(--text-dim, #64748b);
  letter-spacing: 0.05em;
}

.atom-hud-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.atom-hud-value.cyan { color: var(--neon-cyan, #00ffcc); }
.atom-hud-value.green { color: var(--neon-green, #00ff88); }
.atom-hud-value.yellow { color: #facc15; }
.atom-hud-value.pink { color: #ff007f; }

/* Integrity Bar */
.atom-integrity-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.atom-integrity-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.atom-integrity-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00ff88, #00ffcc);
  box-shadow: 0 0 10px #00ffcc;
  transition: width 0.25s ease, background-color 0.25s ease;
}

.atom-integrity-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  box-shadow: 0 0 10px #ef4444;
}

/* Arena Canvas Wrapper */
.atom-arena-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

#atom-game-canvas {
  width: 100%;
  max-width: 800px;
  max-height: 480px;
  aspect-ratio: 16 / 10;
  background: #030712;
  border: 1px solid rgba(0, 255, 204, 0.3);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 255, 204, 0.1);
  border-radius: 2px;
  touch-action: none;
}

/* Toast Message Container */
.atom-toast-overlay {
  position: absolute;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.atom-toast-msg {
  background: rgba(4, 10, 22, 0.92);
  border: 1px solid var(--neon-cyan, #00ffcc);
  box-shadow: 0 0 15px rgba(0, 255, 204, 0.4);
  color: var(--neon-cyan, #00ffcc);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border-radius: 2px;
  letter-spacing: 0.08em;
  animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1), toast-fade-out 0.4s 2.3s forwards;
}

.atom-toast-msg.alert {
  border-color: #ff3366;
  color: #ff3366;
  box-shadow: 0 0 15px rgba(255, 51, 102, 0.5);
}

.atom-toast-msg.gold {
  border-color: #ffd700;
  color: #ffd700;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

@keyframes toast-slide-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-fade-out {
  to { opacity: 0; transform: translateY(-5px); }
}

/* Mobile Touch Controls */
.atom-mobile-controls {
  display: none;
  position: absolute;
  bottom: 0.5rem;
  left: 0;
  right: 0;
  justify-content: space-between;
  padding: 0 1.5rem;
  pointer-events: none;
  z-index: 15;
}

@media (max-width: 992px), (pointer: coarse) {
  .atom-mobile-controls {
    display: flex;
  }
}

.atom-dpad {
  pointer-events: auto;
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 4px;
}

.atom-dpad-btn {
  background: rgba(0, 255, 204, 0.12);
  border: 1px solid rgba(0, 255, 204, 0.35);
  color: var(--neon-cyan, #00ffcc);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.atom-dpad-btn:active {
  background: rgba(0, 255, 204, 0.35);
}

.atom-dpad-up { grid-column: 2; grid-row: 1; }
.atom-dpad-down { grid-column: 2; grid-row: 3; }
.atom-dpad-left { grid-column: 1; grid-row: 2; }
.atom-dpad-right { grid-column: 3; grid-row: 2; }

/* Game Over Screen */
.atom-gameover-box {
  max-width: 520px;
  width: 100%;
  text-align: center;
  background: rgba(12, 4, 10, 0.92);
  border: 1px solid rgba(255, 51, 102, 0.5);
  box-shadow: 0 0 35px rgba(255, 51, 102, 0.2);
  padding: 2rem 1.5rem;
  border-radius: 4px;
}

.atom-gameover-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #ff3366;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.atom-gameover-sub {
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 1.5rem;
}

.atom-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.atom-stat-item {
  background: rgba(20, 6, 16, 0.8);
  border: 1px solid rgba(255, 51, 102, 0.2);
  padding: 0.5rem 0.85rem;
  border-radius: 2px;
}

.atom-stat-label {
  font-size: 0.68rem;
  color: var(--text-dim, #64748b);
}

.atom-stat-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

.atom-gameover-msg {
  font-size: 0.85rem;
  color: var(--neon-cyan, #00ffcc);
  background: rgba(0, 255, 204, 0.05);
  border-left: 2px solid var(--neon-cyan, #00ffcc);
  padding: 0.6rem 0.85rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.atom-actions-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-game-primary {
  background: rgba(0, 255, 204, 0.15);
  border: 1px solid var(--neon-cyan, #00ffcc);
  color: var(--neon-cyan, #00ffcc);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.7rem 1.5rem;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-game-primary:hover {
  background: rgba(0, 255, 204, 0.3);
  box-shadow: 0 0 15px rgba(0, 255, 204, 0.4);
}

.btn-game-secondary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
  color: var(--text-main, #e0f2fe);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.7rem 1.5rem;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-game-secondary:hover {
  border-color: var(--neon-cyan, #00ffcc);
  color: var(--neon-cyan, #00ffcc);
}

/* Responsive Scaling for Mobile Screens */
@media (max-width: 600px) {
  .atom-game-frame { max-height: 98vh; }
  .atom-game-header { padding: 0.5rem 0.85rem; }
  .atom-game-title { font-size: 0.95rem; }
  .atom-intro-box { padding: 1.25rem 1rem; }
  .atom-intro-heading { font-size: 1.25rem; }
  .atom-hud-bar { grid-template-columns: repeat(3, 1fr); font-size: 0.8rem; }
  .atom-hud-card { padding: 0.25rem 0.5rem; }
  .atom-hud-value { font-size: 0.9rem; }
}
