/* ==========================================
   CYBER HUNT GAME STYLES — COMMAND CENTER UI REDESIGN
   Tyspingo Typing Master Pro
   ========================================== */

/* Game Mode Selection Card Styling for Cyber Hunt */
.game-select-card.cyber-card::before {
  background: linear-gradient(90deg, #22c55e, #38bdf8);
}

.game-select-card.cyber-card:hover {
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.7), 0 0 30px rgba(34, 197, 94, 0.25);
}

.cyber-card .game-card-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.3);
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

.cyber-btn {
  background: linear-gradient(135deg, #15803d 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3) !important;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
}

.cyber-btn:hover {
  box-shadow: 0 6px 22px rgba(34, 197, 94, 0.6) !important;
  transform: translateY(-2px) !important;
}

/* Standalone Cyber Hunt Page Layout */
html.cyber-page, body.cyber-page {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: #030712;
  color: #f3f4f6;
  font-family: 'JetBrains Mono', 'Fira Code', 'Space Mono', 'Consolas', monospace;
  overflow-x: hidden;
}

.cyber-standalone-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #030712;
  background-image: 
    radial-gradient(circle at 50% 30%, rgba(14, 165, 233, 0.05) 0%, transparent 60%),
    linear-gradient(to right, rgba(34, 197, 94, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(34, 197, 94, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
}

/* Cyber Game Frame Container - Command Center Workstation */
.cyber-game-frame {
  position: relative;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  min-height: 720px;
  height: calc(100vh - 70px);
  height: calc(100dvh - 70px);
  background: #030712;
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 12px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.95), inset 0 0 120px rgba(34, 197, 94, 0.03);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

/* Scanline Matrix Overlay */
.ch-scanline {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.32) 50%),
              linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
  background-size: 100% 4px, 6px 100%;
  pointer-events: none;
  z-index: 4;
}

/* CRT Edge Flicker */
.ch-crt-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  z-index: 4;
}

/* Hidden Focusable Mobile Input */
.game-mobile-input {
  position: absolute;
  opacity: 0.001;
  width: 1px;
  height: 1px;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: -1;
}

/* 1. TOP HUD HEADER */
.ch-hud {
  background: rgba(15, 23, 42, 0.96);
  border-bottom: 1px solid rgba(34, 197, 94, 0.3);
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 10;
  user-select: none;
}

.ch-hud-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ch-hud-branding {
  display: flex;
  flex-direction: column;
}

.ch-hud-title {
  font-size: 0.95rem;
  font-weight: 900;
  color: #38bdf8;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.ch-hud-sub {
  font-size: 0.72rem;
  color: #22c55e;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.ch-hud-center {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.ch-hud-mission-info {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ch-hud-mission-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: #4ade80;
  letter-spacing: 1px;
}

.ch-hud-round-val {
  font-size: 0.75rem;
  color: #38bdf8;
  font-weight: 700;
}

.ch-hud-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.ch-attempts-box {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #ef4444;
  font-weight: 700;
  background: rgba(127, 29, 29, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
}

.ch-attempts-hearts {
  font-size: 0.95rem;
  letter-spacing: 2px;
}

.ch-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: #22c55e;
  font-weight: 700;
  letter-spacing: 1px;
}

.ch-status-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 10px #22c55e;
  animation: ch-dot-pulse 1.5s infinite alternate;
}

@keyframes ch-dot-pulse {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

.ch-timer-box {
  background: rgba(6, 78, 59, 0.35);
  border: 1px solid rgba(34, 197, 94, 0.6);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ch-timer-box[hidden] {
  display: none !important;
}

.ch-timer-label {
  font-size: 0.75rem;
  color: #4ade80;
  font-weight: 700;
}

.ch-timer-val {
  font-size: 1.15rem;
  font-weight: 900;
  color: #38bdf8;
  letter-spacing: 1px;
}

.ch-timer-val.is-warning {
  color: #eab308 !important;
  animation: ch-warning-blink 0.6s infinite alternate;
}

.ch-timer-val.is-critical {
  color: #ef4444 !important;
  animation: ch-critical-blink 0.3s infinite alternate;
}

@keyframes ch-warning-blink {
  0% { opacity: 1; }
  100% { opacity: 0.4; }
}

@keyframes ch-critical-blink {
  0% { opacity: 1; text-shadow: 0 0 12px #ef4444; }
  100% { opacity: 0.2; text-shadow: none; }
}

/* 2. THREE-COLUMN COMMAND CENTER GRID */
.ch-command-center-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 250px 1fr 230px;
  gap: 0;
  overflow: hidden;
  background: #030712;
  position: relative;
  z-index: 5;
}

/* SIDEBAR PANELS */
.ch-sidebar-left, .ch-sidebar-right {
  background: #070d19;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  font-size: 0.78rem;
  color: #94a3b8;
  user-select: none;
  overflow-y: auto;
}

.ch-sidebar-left {
  border-right: 1px solid rgba(34, 197, 94, 0.2);
}

.ch-sidebar-right {
  border-left: 1px solid rgba(34, 197, 94, 0.2);
}

.ch-side-panel {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
}

.ch-side-panel-header {
  font-size: 0.72rem;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 1px;
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(56, 189, 248, 0.2);
  padding-bottom: 0.25rem;
}

/* Dynamic System Logs Window */
.ch-logs-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.7rem;
  max-height: 140px;
  overflow-y: auto;
}

.ch-log-line {
  margin: 0;
  line-height: 1.4;
  word-break: break-all;
  color: #4ade80;
}

/* Target Info Metadata */
.ch-target-info-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.72rem;
}

.ch-target-row {
  display: flex;
  justify-content: space-between;
}

.ch-target-label {
  color: #64748b;
}

.ch-target-val {
  color: #f3f4f6;
  font-weight: 700;
}

.ch-target-val.accent {
  color: #22c55e;
}

/* Network Activity Graph Bars */
.ch-network-graph {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 45px;
  padding-top: 0.4rem;
}

.ch-graph-bar {
  flex: 1;
  background: linear-gradient(to top, #15803d, #38bdf8);
  border-radius: 2px 2px 0 0;
  transition: height 0.3s ease;
}

/* System Monitor & Connections */
.ch-sys-metric {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
}

.ch-sys-metric-val {
  color: #22c55e;
  font-weight: 700;
}

.ch-conn-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.ch-conn-item.active {
  color: #38bdf8;
}

/* 3. CENTRAL MAIN TERMINAL WINDOW */
.ch-terminal-window {
  display: flex;
  flex-direction: column;
  background: #030712;
  overflow: hidden;
}

.ch-terminal-bar {
  height: 36px;
  background: #0f172a;
  border-bottom: 1px solid rgba(34, 197, 94, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  font-size: 0.78rem;
  color: #4ade80;
  user-select: none;
}

.ch-terminal-dots {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ch-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.ch-dot-red { background: #ef4444; }
.ch-dot-yellow { background: #eab308; }
.ch-dot-green { background: #22c55e; }

.ch-terminal-title {
  font-weight: 700;
  letter-spacing: 1px;
  color: #38bdf8;
}

.ch-arena {
  flex: 1;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  position: relative;
}

/* Briefing Box */
.ch-briefing-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-left: 4px solid #22c55e;
  border-radius: 6px;
  padding: 0.7rem 1rem;
  font-size: 0.78rem;
  color: #4ade80;
  line-height: 1.5;
}

.ch-briefing-line {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 4. SEPARATED TARGET CODE AND YOUR INPUT PANELS (REQUIRED) */

/* PANEL A: TARGET CODE DISPLAY */
.ch-target-code-panel {
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 0.85rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-shadow: inset 0 0 20px rgba(56, 189, 248, 0.05);
}

.ch-panel-header-label {
  font-size: 0.75rem;
  color: #38bdf8;
  font-weight: 800;
  letter-spacing: 1px;
  display: flex;
  justify-content: space-between;
}

.ch-target-code-text {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  line-height: 1.6;
  color: #4ade80;
  font-weight: 700;
  word-break: break-all;
  white-space: pre-wrap;
  text-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

/* PANEL B: YOUR INPUT DISPLAY */
.ch-your-input-panel {
  background: rgba(6, 78, 59, 0.15);
  border: 1.5px solid rgba(34, 197, 94, 0.45);
  border-radius: 8px;
  padding: 0.85rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-shadow: inset 0 0 25px rgba(34, 197, 94, 0.05);
  position: relative;
}

.ch-your-input-text {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  line-height: 1.6;
  word-break: break-all;
  white-space: pre-wrap;
  font-weight: 700;
  min-height: 2.2em;
}

/* Character level styling for Your Input Panel */
.ch-char-correct {
  color: #22c55e;
  text-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
}

.ch-char-incorrect {
  color: #ffffff;
  background-color: #ef4444;
  border-radius: 2px;
  padding: 0 1px;
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.9);
}

.ch-cursor {
  display: inline-block;
  width: 9px;
  height: 1.2em;
  background-color: #38bdf8;
  vertical-align: middle;
  margin: 0 1px;
  animation: ch-cursor-blink 0.7s infinite;
  box-shadow: 0 0 8px #38bdf8;
}

@keyframes ch-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

/* LIVE TYPING STATISTICS BAR */
.ch-typing-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.5rem 0.85rem;
  font-size: 0.78rem;
  color: #94a3b8;
}

.ch-stat-block {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ch-stat-block-val {
  color: #f3f4f6;
  font-weight: 800;
}

.ch-stat-block-val.accent-green { color: #22c55e; }
.ch-stat-block-val.accent-blue { color: #38bdf8; }
.ch-stat-block-val.accent-red { color: #ef4444; }

/* 5. BOTTOM ACCESS CONTROL PANEL */
.ch-access-panel {
  background: rgba(15, 23, 42, 0.92);
  border-top: 1px solid rgba(34, 197, 94, 0.25);
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 10;
  user-select: none;
}

.ch-access-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.ch-access-status-indicator.locked {
  color: #eab308;
}

.ch-access-status-indicator.unlocked {
  color: #22c55e;
}

.ch-access-btn {
  background: linear-gradient(135deg, #15803d 0%, #0284c7 100%);
  color: #ffffff;
  border: 2px solid #22c55e;
  border-radius: 8px;
  padding: 0.6rem 2rem;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
  transition: all 0.25s ease;
  animation: ch-access-pulse 1.8s infinite alternate;
}

.ch-access-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  animation: none;
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.2);
}

.ch-access-btn:hover:not([disabled]) {
  transform: scale(1.04);
  border-color: #38bdf8;
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.7);
}

@keyframes ch-access-pulse {
  0% { box-shadow: 0 0 12px rgba(34, 197, 94, 0.4); }
  100% { box-shadow: 0 0 30px rgba(34, 197, 94, 0.8), 0 0 12px rgba(56, 189, 248, 0.5); }
}

/* OVERLAYS SYSTEM */
.ch-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(3, 7, 18, 0.94);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 30;
  text-align: center;
  box-sizing: border-box;
}

.ch-overlay[hidden] {
  display: none !important;
}

/* Modal Cards */
.ch-modal-card {
  background: #090d16;
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 14px;
  padding: 2rem 2.25rem;
  max-width: 580px;
  width: 94%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95), 0 0 40px rgba(34, 197, 94, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  box-sizing: border-box;
  max-height: 90vh;
  overflow-y: auto;
}

.ch-modal-card.failure-card {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95), 0 0 40px rgba(239, 68, 68, 0.25);
}

.ch-modal-card.hacked-card {
  border-color: #ef4444;
  box-shadow: 0 0 50px rgba(239, 68, 68, 0.5), inset 0 0 30px rgba(239, 68, 68, 0.2);
  animation: ch-hacked-flicker 0.4s ease-in-out infinite alternate;
}

@keyframes ch-hacked-flicker {
  0% { border-color: #ef4444; }
  100% { border-color: #38bdf8; }
}

.ch-ascii-banner {
  font-family: inherit;
  font-size: clamp(0.68rem, 2vw, 0.88rem);
  line-height: 1.3;
  white-space: pre;
  color: #4ade80;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
  margin: 0;
}

.ch-ascii-banner.failure {
  color: #ef4444;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.ch-modal-title {
  font-size: 1.75rem;
  font-weight: 900;
  margin: 0;
  color: #4ade80;
  letter-spacing: 1.5px;
}

.ch-modal-title.failure-title {
  color: #ef4444;
}

/* Progress Bar Loading Component */
.ch-progress-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.ch-progress-bar-bg {
  width: 100%;
  height: 24px;
  background: #0f172a;
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.ch-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #15803d, #22c55e, #38bdf8);
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.8);
  transition: width 0.1s linear;
}

.ch-progress-text {
  font-size: 0.82rem;
  color: #38bdf8;
  font-weight: 700;
  letter-spacing: 1px;
}

/* Mistake Diff Diagnostic Box */
.ch-diff-box {
  width: 100%;
  background: rgba(127, 29, 29, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  color: #f87171;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-sizing: border-box;
}

.ch-diff-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ch-diff-label {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
}

.ch-diff-val {
  font-family: inherit;
  font-weight: 700;
  color: #f3f4f6;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  word-break: break-all;
}

.ch-diff-val.expected {
  color: #4ade80;
  border-left: 3px solid #22c55e;
}

.ch-diff-val.user-typed {
  color: #f87171;
  border-left: 3px solid #ef4444;
}

/* Buttons */
.ch-btn {
  background: linear-gradient(135deg, #15803d 0%, #0369a1 100%);
  color: #ffffff;
  border: 1px solid rgba(34, 197, 94, 0.5);
  border-radius: 8px;
  padding: 0.75rem 1.8rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
  transition: all 0.2s ease;
}

.ch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(34, 197, 94, 0.6);
}

.ch-btn-danger {
  background: linear-gradient(135deg, #991b1b 0%, #7f1d1d 100%);
  border-color: #ef4444;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.ch-btn-danger:hover {
  box-shadow: 0 6px 22px rgba(239, 68, 68, 0.7);
}

/* RESPONSIVE COLLAPSE FOR SMALL SCREENS */
@media (max-width: 1024px) {
  .ch-command-center-grid {
    grid-template-columns: 220px 1fr;
  }
  .ch-sidebar-right {
    display: none;
  }
}

@media (max-width: 768px) {
  .ch-command-center-grid {
    grid-template-columns: 1fr;
  }
  .ch-sidebar-left {
    display: none;
  }
  .cyber-game-frame {
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    border-radius: 6px;
  }
}

@media (max-width: 600px) {
  .ch-hud {
    padding: 0.4rem 0.75rem;
  }
  .ch-hud-title {
    font-size: 0.82rem;
  }
  .ch-hud-mission-title {
    font-size: 0.78rem;
  }
  .ch-access-btn {
    font-size: 0.95rem;
    padding: 0.5rem 1.25rem;
  }
  .ch-modal-card {
    padding: 1.25rem;
  }
}
