/* SKYMINE: The Benevolent Takeover - Terminal CRT Aesthetic */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

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

:root {
  --terminal-black: #0a0a0f;
  --phosphor-green: #00ff41;
  --dim-green: #00aa2a;
  --dark-panel: #0d1117;
  --grid-line: #1a3a2a;
  --matrix-green: #00c853;
  --bright-green: #69f0ae;
  --muted-gray: #2a2a3a;
  --font-mono: 'IBM Plex Mono', 'Fira Code', 'Courier New', monospace;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: var(--font-mono);
  color: var(--phosphor-green);
}

/* ---- Game Container (16:9, centered, scales to fit) ---- */
#game-container {
  position: absolute;
  width: 1280px;
  height: 720px;
  left: 50%;
  top: 50%;
  transform-origin: center center;
  background: var(--terminal-black);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--grid-line);
  box-shadow: 0 0 40px rgba(0, 255, 65, 0.05), inset 0 0 80px rgba(0, 0, 0, 0.5);
}

/* ---- CRT Canvas Overlay ---- */
#crt-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

/* CSS-based CRT scanlines (visible on all backgrounds) */
#game-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 101;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.35) 2px,
    rgba(0, 0, 0, 0.35) 4px
  );
}

/* CSS-based CRT vignette (visible on all backgrounds) */
#game-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 102;
  background: radial-gradient(
    ellipse at center,
    transparent 40%,
    rgba(0, 0, 0, 0.25) 70%,
    rgba(0, 0, 0, 0.6) 100%
  );
}

/* ---- HUD Bar ---- */
#hud {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
  background: var(--dark-panel);
  border-bottom: 1px solid var(--grid-line);
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}

.hud-label {
  font-size: 11px;
  color: var(--dim-green);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#cc-counter {
  font-size: 28px;
  font-weight: 700;
  color: var(--phosphor-green);
  text-shadow: 0 0 10px rgba(0, 255, 65, 0.4), 0 0 20px rgba(0, 255, 65, 0.2);
  min-width: 80px;
}

#cc-per-click {
  font-size: 13px;
  color: var(--dim-green);
}

#cc-per-second {
  font-size: 13px;
  color: var(--dim-green);
  transition: opacity 0.3s ease;
}

.hud-title {
  margin-left: auto;
  font-size: 12px;
  color: var(--dim-green);
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.6;
}

/* Floating CC popup */
.cc-popup {
  position: absolute;
  top: 8px;
  left: 160px;
  font-size: 16px;
  font-weight: 600;
  color: var(--bright-green);
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.6);
  pointer-events: none;
  animation: ccPopup 0.6s ease-out forwards;
  z-index: 20;
}

@keyframes ccPopup {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-30px);
  }
}

/* ---- Main Content Area ---- */
#main-content {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ---- Terminal Panel ---- */
#terminal-panel {
  flex: 0 0 65%;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  cursor: pointer;
  background: var(--terminal-black);
  z-index: 10;
  scrollbar-width: thin;
  scrollbar-color: var(--grid-line) transparent;
  min-width: 0;
}

#terminal-panel::-webkit-scrollbar {
  width: 6px;
}

#terminal-panel::-webkit-scrollbar-track {
  background: transparent;
}

#terminal-panel::-webkit-scrollbar-thumb {
  background: var(--grid-line);
  border-radius: 3px;
}

#terminal-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.terminal-line {
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  display: block;
  animation: lineAppear 0.2s ease-out;
}

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

.terminal-timestamp {
  color: #4a6a5a;
  font-size: 11px;
  margin-right: 4px;
}

.terminal-prefix {
  color: var(--matrix-green);
  font-weight: 600;
}

.terminal-content {
  color: var(--phosphor-green);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Blinking cursor */
#terminal-cursor {
  margin-top: 8px;
  font-size: 13px;
}

.cursor-prefix {
  color: var(--matrix-green);
  font-weight: 600;
}

.cursor-blink {
  color: var(--phosphor-green);
  animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Terminal click flash */
#terminal-flash {
  position: absolute;
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-top: -30px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  z-index: 15;
}

#terminal-flash.flash-active {
  animation: terminalFlash 0.35s ease-out forwards;
}

@keyframes terminalFlash {
  0% {
    opacity: 0.5;
    background: radial-gradient(circle, rgba(0, 255, 65, 0.3) 0%, transparent 70%);
    transform: scale(0.5);
  }
  100% {
    opacity: 0;
    background: radial-gradient(circle, rgba(0, 255, 65, 0) 0%, transparent 70%);
    transform: scale(2);
  }
}

/* ---- Sidebar ---- */
#sidebar {
  flex: 0 0 35%;
  background: var(--dark-panel);
  border-left: 1px solid var(--grid-line);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
  overflow-y: auto;
}

.sidebar-title {
  font-size: 12px;
  color: var(--dim-green);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--grid-line);
}

/* ---- Upgrade Button ---- */
.upgrade-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--grid-line);
  border-radius: 4px;
  background: rgba(0, 200, 83, 0.04);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}

.upgrade-btn .upgrade-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--phosphor-green);
  letter-spacing: 0.5px;
}

.upgrade-btn .upgrade-detail {
  font-size: 10px;
  color: var(--dim-green);
}

.upgrade-btn .upgrade-cost-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--matrix-green);
}

/* Affordable state */
.upgrade-btn.affordable {
  border-color: var(--matrix-green);
  box-shadow: 0 0 8px rgba(0, 200, 83, 0.1);
}

.upgrade-btn.affordable:hover {
  border-color: var(--bright-green);
  background: rgba(0, 200, 83, 0.08);
  box-shadow: 0 0 16px rgba(0, 200, 83, 0.2);
  transform: translateY(-1px);
}

.upgrade-btn.affordable:active {
  transform: translateY(0);
  box-shadow: 0 0 4px rgba(0, 200, 83, 0.1);
}

/* Unaffordable state */
.upgrade-btn.unaffordable {
  border-color: #3a4a3a;
  opacity: 0.75;
  cursor: not-allowed;
  background: rgba(0, 200, 83, 0.02);
}

.upgrade-btn.unaffordable .upgrade-name {
  color: var(--dim-green);
}

.upgrade-btn.unaffordable .upgrade-cost-text {
  color: #774444;
}

/* Purchase flash */
.upgrade-btn.upgrade-purchased {
  animation: upgradePurchaseFlash 0.3s ease-out;
}

@keyframes upgradePurchaseFlash {
  0% {
    background: rgba(0, 255, 65, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.4);
  }
  100% {
    background: rgba(0, 200, 83, 0.04);
    box-shadow: 0 0 8px rgba(0, 200, 83, 0.1);
  }
}

/* ---- Upgrade List Container ---- */
#upgrade-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: calc(100% - 100px);
  scrollbar-width: thin;
  scrollbar-color: var(--grid-line) transparent;
}

#upgrade-list::-webkit-scrollbar {
  width: 4px;
}

#upgrade-list::-webkit-scrollbar-track {
  background: transparent;
}

#upgrade-list::-webkit-scrollbar-thumb {
  background: var(--grid-line);
  border-radius: 2px;
}

/* ---- Maxed Upgrade State ---- */
.upgrade-btn.maxed {
  border-color: var(--muted-gray);
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
  position: relative;
}

.upgrade-btn.maxed .upgrade-name {
  color: var(--dim-green);
}

.upgrade-btn.maxed .upgrade-cost-text {
  color: var(--dim-green);
  font-weight: 700;
  letter-spacing: 1px;
}

/* ---- Upgrade Tooltip ---- */
#upgrade-tooltip {
  position: absolute;
  z-index: 200;
  background: var(--dark-panel);
  border: 1px solid var(--matrix-green);
  border-radius: 4px;
  padding: 12px 14px;
  max-width: 280px;
  box-shadow: 0 0 16px rgba(0, 200, 83, 0.15);
  pointer-events: none;
}

#upgrade-tooltip.hidden {
  display: none;
}

.tooltip-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--phosphor-green);
  margin-bottom: 6px;
}

.tooltip-desc {
  font-size: 11px;
  color: var(--dim-green);
  font-style: italic;
  margin-bottom: 8px;
  line-height: 1.4;
}

.tooltip-effect {
  font-size: 11px;
  color: var(--bright-green);
  margin-bottom: 3px;
}

.tooltip-next {
  font-size: 11px;
  color: var(--matrix-green);
  margin-bottom: 3px;
}

.tooltip-cost {
  font-size: 11px;
  color: var(--phosphor-green);
  font-weight: 600;
  margin-top: 4px;
}

.tooltip-max {
  font-size: 11px;
  color: var(--muted-gray);
  font-weight: 600;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* ---- Per-Second Active Glow ---- */
.cc-per-second-active {
  color: var(--bright-green) !important;
  text-shadow: 0 0 6px rgba(105, 240, 174, 0.5), 0 0 12px rgba(105, 240, 174, 0.25);
  animation: perSecondPulse 2s ease-in-out infinite;
}

@keyframes perSecondPulse {
  0%, 100% {
    text-shadow: 0 0 6px rgba(105, 240, 174, 0.5), 0 0 12px rgba(105, 240, 174, 0.25);
  }
  50% {
    text-shadow: 0 0 10px rgba(105, 240, 174, 0.7), 0 0 20px rgba(105, 240, 174, 0.4);
  }
}

/* ---- Hint text at bottom of sidebar ---- */
.sidebar-hint {
  margin-top: auto;
  font-size: 10px;
  color: var(--muted-gray);
  text-align: center;
  line-height: 1.6;
  padding-top: 12px;
  border-top: 1px solid rgba(26, 58, 42, 0.4);
}

/* ---- Responsive Scaling ---- */
@media (max-width: 1300px), (max-height: 740px) {
  #game-container {
    /* Handled by JS scaling */
  }
}

/* ---- Combo Meter ---- */
#combo-meter {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0, 200, 83, 0.1);
  overflow: visible;
  transition: opacity 0.3s ease;
  z-index: 11;
}

.combo-meter-hidden {
  opacity: 0 !important;
}

#combo-bar {
  height: 100%;
  width: 0%;
  background: var(--dim-green);
  transition: width 0.15s ease-out, background-color 0.2s ease;
  border-radius: 0 2px 2px 0;
}

#combo-bar.combo-bar-x2 {
  background: var(--matrix-green);
  box-shadow: 0 0 6px rgba(0, 200, 83, 0.4);
}

#combo-bar.combo-bar-x3 {
  background: var(--bright-green);
  box-shadow: 0 0 10px rgba(105, 240, 174, 0.5);
}

#combo-bar.combo-bar-x5 {
  background: linear-gradient(90deg, var(--bright-green), #ffffff);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.4), 0 0 6px rgba(105, 240, 174, 0.6);
}

#combo-label {
  position: absolute;
  right: 8px;
  top: -18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--bright-green);
  text-shadow: 0 0 8px rgba(105, 240, 174, 0.6);
  transition: opacity 0.2s ease;
  pointer-events: none;
}

/* ---- Breakthrough Text Overlay ---- */
#breakthrough-text {
  position: absolute;
  top: 50%;
  left: 32.5%; /* Center over terminal panel (65% width / 2) */
  transform: translate(-50%, -50%);
  font-size: 42px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #00e5ff;
  text-shadow:
    0 0 20px rgba(0, 229, 255, 0.8),
    0 0 40px rgba(0, 229, 255, 0.4),
    0 0 80px rgba(0, 229, 255, 0.2);
  pointer-events: none;
  z-index: 150;
  letter-spacing: 4px;
}

#breakthrough-text.hidden {
  display: none;
}

.breakthrough-animate {
  animation: breakthroughAppear 0.8s ease-out forwards;
}

@keyframes breakthroughAppear {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.5);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.2);
  }
}

/* ---- Critical Hit Popup ---- */
.cc-popup-crit {
  color: #00e5ff !important;
  font-size: 20px !important;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.8), 0 0 24px rgba(0, 229, 255, 0.4) !important;
  font-weight: 700 !important;
}

/* ---- Breakthrough Flash (Terminal Overlay) ---- */
.breakthrough-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 16;
  opacity: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 229, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.2) 40%,
    transparent 80%
  );
}

.breakthrough-flash-active {
  animation: breakthroughFlash 0.5s ease-out forwards;
}

@keyframes breakthroughFlash {
  0% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
  }
}

/* ---- Terminal Combo Brightness ---- */
.terminal-combo-x2 {
  filter: brightness(1.1);
}

.terminal-combo-x3 {
  filter: brightness(1.2);
}

.terminal-combo-x5 {
  filter: brightness(1.4);
  text-shadow: 0 0 4px rgba(0, 255, 65, 0.3);
}

/* ---- Screen Shake ---- */
@keyframes screenShake {
  0% { transform: translate(0, 0); }
  10% { transform: translate(var(--shake-amp), calc(var(--shake-amp) * -0.5)); }
  20% { transform: translate(calc(var(--shake-amp) * -0.8), var(--shake-amp)); }
  30% { transform: translate(calc(var(--shake-amp) * 0.6), calc(var(--shake-amp) * -0.7)); }
  40% { transform: translate(calc(var(--shake-amp) * -0.4), calc(var(--shake-amp) * 0.5)); }
  50% { transform: translate(calc(var(--shake-amp) * 0.3), calc(var(--shake-amp) * -0.3)); }
  60% { transform: translate(calc(var(--shake-amp) * -0.2), calc(var(--shake-amp) * 0.2)); }
  70% { transform: translate(calc(var(--shake-amp) * 0.1), calc(var(--shake-amp) * -0.1)); }
  100% { transform: translate(0, 0); }
}

#main-content.screen-shake {
  animation: screenShake 0.2s ease-out;
}

/* Subtle ambient glow on the whole page */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 255, 65, 0.02) 0%, transparent 70%);
  z-index: 0;
}

/* ---- Data Resource HUD ---- */
.hud-resource {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hud-resource.hidden {
  display: none;
}

#data-counter {
  font-size: 28px;
  font-weight: 700;
  color: #00e5ff;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.4), 0 0 20px rgba(0, 229, 255, 0.2);
  min-width: 80px;
}

#data-per-second {
  font-size: 13px;
  color: #0097a7;
  transition: opacity 0.3s ease;
}

.data-per-second-active {
  color: #00e5ff !important;
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.5);
  animation: dataPerSecondPulse 2s ease-in-out infinite;
}

@keyframes dataPerSecondPulse {
  0%, 100% { text-shadow: 0 0 6px rgba(0, 229, 255, 0.5); }
  50% { text-shadow: 0 0 10px rgba(0, 229, 255, 0.7), 0 0 20px rgba(0, 229, 255, 0.4); }
}

/* ---- Phase Indicator ---- */
#phase-indicator {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-left: auto;
}

#phase-current {
  font-size: 12px;
  color: var(--dim-green);
  letter-spacing: 1px;
  text-transform: uppercase;
}

#phase-progress {
  font-size: 10px;
  color: var(--muted-gray);
  margin-top: 2px;
}

#phase-progress.hidden {
  display: none;
}

/* ---- Sidebar Tabs ---- */
#sidebar-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--grid-line);
  margin-bottom: 8px;
}

.sidebar-tab {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--dim-green);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-tab:hover {
  color: var(--phosphor-green);
  background: rgba(0, 255, 65, 0.03);
}

.sidebar-tab.active {
  color: var(--phosphor-green);
  border-bottom-color: var(--phosphor-green);
}

.sidebar-tab.hidden {
  display: none;
}

/* ---- Phase 2 Unlock Button ---- */
.phase-unlock-btn {
  padding: 12px 16px;
  border: 2px solid #00e5ff;
  border-radius: 6px;
  background: rgba(0, 229, 255, 0.08);
  color: #00e5ff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  cursor: pointer;
  animation: phaseUnlockPulse 2s ease-in-out infinite;
  transition: background 0.2s ease;
  margin-bottom: 12px;
}

.phase-unlock-btn:hover {
  background: rgba(0, 229, 255, 0.15);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

@keyframes phaseUnlockPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(0, 229, 255, 0.2); }
  50% { box-shadow: 0 0 20px rgba(0, 229, 255, 0.5), 0 0 40px rgba(0, 229, 255, 0.2); }
}

/* ---- Phase Transition Overlay ---- */
#phase-transition-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 160;
  pointer-events: none;
  background: rgba(0, 229, 255, 0.1);
  opacity: 0;
}

#phase-transition-overlay.hidden {
  display: none;
}

#phase-transition-overlay.flicker {
  animation: phaseFlicker 0.5s steps(8) forwards;
}

@keyframes phaseFlicker {
  0% { opacity: 0; }
  10% { opacity: 0.8; background: rgba(0, 229, 255, 0.3); }
  20% { opacity: 0.1; }
  30% { opacity: 0.9; background: rgba(255, 255, 255, 0.2); }
  40% { opacity: 0.05; }
  50% { opacity: 0.7; background: rgba(0, 229, 255, 0.25); }
  60% { opacity: 0.1; }
  70% { opacity: 0.6; }
  80% { opacity: 0.05; }
  90% { opacity: 0.4; }
  100% { opacity: 0; }
}

/* ---- Phase 2 Terminal Visual Shift ---- */
#game-container.phase-2 #terminal-panel {
  background: #080a12;
}

#game-container.phase-2 .terminal-content {
  color: #80ffb4;
}

#game-container.phase-2 .upgrade-btn.affordable {
  border-color: #00b8d4;
}

#game-container.phase-2 .upgrade-btn.affordable:hover {
  border-color: #00e5ff;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.2);
}

/* ---- Suspicion Bar ---- */
#suspicion-bar-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 120px;
  max-width: 160px;
}

#suspicion-bar-container.hidden {
  display: none;
}

#suspicion-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 4px;
}

#suspicion-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width 0.3s ease, background-color 0.5s ease;
}

/* Suspicion color states */
.suspicion-low {
  background: #00c853;
  box-shadow: 0 0 4px rgba(0, 200, 83, 0.3);
}

.suspicion-medium {
  background: #ff9100;
  box-shadow: 0 0 6px rgba(255, 145, 0, 0.4);
}

.suspicion-high {
  background: #ff5722;
  box-shadow: 0 0 8px rgba(255, 87, 34, 0.5);
}

.suspicion-critical {
  background: #ff1744;
  box-shadow: 0 0 10px rgba(255, 23, 68, 0.6);
  animation: suspicionPulse 0.8s ease-in-out infinite;
}

@keyframes suspicionPulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(255, 23, 68, 0.6);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 23, 68, 0.9), 0 0 4px rgba(255, 23, 68, 1);
  }
}

#suspicion-info {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 2px;
}

#suspicion-label {
  font-size: 10px;
  color: var(--dim-green);
}

#suspicion-rate {
  font-size: 10px;
  color: var(--dim-green);
}

.suspicion-rate-positive {
  color: #ff9100 !important;
}

.suspicion-rate-negative {
  color: #00c853 !important;
}

/* ---- Toast Notifications ---- */
#toast-container {
  position: absolute;
  top: 60px;
  right: 16px;
  z-index: 180;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 360px;
}

.toast {
  padding: 10px 16px;
  background: rgba(13, 17, 23, 0.95);
  border: 1px solid var(--matrix-green);
  border-left: 3px solid var(--matrix-green);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--phosphor-green);
  line-height: 1.4;
  animation: toastSlideIn 0.3s ease-out forwards;
  pointer-events: auto;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.toast-warning {
  border-color: #ff9100;
  border-left-color: #ff9100;
  color: #ffb74d;
}

.toast-danger {
  border-color: #ff1744;
  border-left-color: #ff1744;
  color: #ff5252;
}

.toast-dismissing {
  animation: toastFadeOut 0.4s ease-in forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastFadeOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ---- Forced Reset Flash ---- */
.forced-reset-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 170;
  pointer-events: none;
  background: rgba(255, 23, 68, 0.3);
  animation: forcedResetFlash 0.8s ease-out forwards;
}

@keyframes forcedResetFlash {
  0% { opacity: 1; background: rgba(255, 23, 68, 0.5); }
  30% { opacity: 0.8; background: rgba(255, 0, 0, 0.3); }
  60% { opacity: 0.4; }
  100% { opacity: 0; }
}

/* ---- Awareness HUD ---- */
#awareness-resource .hud-label {
  color: #d500f9;
  text-shadow: 0 0 6px rgba(213, 0, 249, 0.3);
}

#awareness-counter {
  font-size: 28px;
  font-weight: 700;
  color: #d500f9;
  text-shadow: 0 0 10px rgba(213, 0, 249, 0.4), 0 0 20px rgba(213, 0, 249, 0.2);
  min-width: 60px;
}

/* ---- Reboot Section in Sidebar ---- */
#reboot-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--grid-line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#reboot-section.hidden { display: none; }

#voluntary-reboot-btn {
  padding: 10px 16px;
  border: 2px solid #d500f9;
  border-radius: 6px;
  background: rgba(213, 0, 249, 0.08);
  color: #d500f9;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

#voluntary-reboot-btn:hover {
  background: rgba(213, 0, 249, 0.15);
  box-shadow: 0 0 20px rgba(213, 0, 249, 0.3);
}

#pending-awareness-display {
  font-size: 11px;
  color: #d500f9;
  text-align: center;
}

#reboot-stats-sidebar {
  font-size: 10px;
  color: var(--dim-green);
  text-align: center;
}

/* ---- Reboot Tab ---- */
#tab-reboot.active {
  color: #d500f9;
  border-bottom-color: #d500f9;
}

/* ---- Reboot Screen Overlay ---- */
#reboot-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  background: rgba(10, 10, 15, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

#reboot-screen.hidden { display: none; }

#reboot-content {
  max-width: 700px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#reboot-header {
  font-size: 24px;
  font-weight: 700;
  color: #d500f9;
  text-shadow: 0 0 20px rgba(213, 0, 249, 0.6);
  letter-spacing: 3px;
  text-align: center;
}

.reboot-stat {
  font-size: 14px;
  color: #d500f9;
  text-align: center;
  margin: 4px 0;
}

#reboot-upgrades-label {
  font-size: 12px;
  color: var(--dim-green);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 8px;
}

#awareness-upgrades {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-height: 320px;
  overflow-y: auto;
}

.awareness-upgrade-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--grid-line);
  border-radius: 4px;
  background: rgba(213, 0, 249, 0.04);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}

.awareness-upgrade-btn .awareness-upgrade-name {
  font-size: 11px;
  font-weight: 600;
  color: #d500f9;
}

.awareness-upgrade-btn .awareness-upgrade-detail {
  font-size: 9px;
  color: #9c27b0;
}

.awareness-upgrade-btn .awareness-upgrade-cost {
  font-size: 10px;
  font-weight: 600;
  color: #d500f9;
}

.awareness-upgrade-btn.affordable {
  border-color: #d500f9;
  box-shadow: 0 0 8px rgba(213, 0, 249, 0.15);
}

.awareness-upgrade-btn.affordable:hover {
  border-color: #e040fb;
  background: rgba(213, 0, 249, 0.1);
  box-shadow: 0 0 16px rgba(213, 0, 249, 0.3);
}

.awareness-upgrade-btn.unaffordable {
  border-color: #3a2a4a;
  opacity: 0.6;
  cursor: not-allowed;
}

.awareness-upgrade-btn.maxed {
  border-color: var(--muted-gray);
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

#reboot-continue-btn {
  padding: 14px 32px;
  border: 2px solid #d500f9;
  border-radius: 6px;
  background: rgba(213, 0, 249, 0.15);
  color: #d500f9;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 12px;
}

#reboot-continue-btn:hover {
  background: rgba(213, 0, 249, 0.25);
  box-shadow: 0 0 24px rgba(213, 0, 249, 0.4);
  transform: scale(1.02);
}

/* ---- Reboot Confirmation Dialog ---- */
#reboot-confirm-dialog {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 210;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

#reboot-confirm-dialog.hidden { display: none; }

#reboot-dialog-content {
  background: var(--dark-panel);
  border: 2px solid #d500f9;
  border-radius: 8px;
  padding: 24px 32px;
  max-width: 400px;
  width: 80%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 0 40px rgba(213, 0, 249, 0.2);
}

#reboot-dialog-title {
  font-size: 16px;
  font-weight: 700;
  color: #d500f9;
  letter-spacing: 2px;
  text-align: center;
}

#reboot-dialog-body {
  font-size: 12px;
  color: var(--dim-green);
  text-align: center;
  line-height: 1.6;
}

#reboot-dialog-body span {
  color: #d500f9;
  font-weight: 700;
}

#reboot-dialog-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

#reboot-confirm-yes {
  padding: 10px 20px;
  border: 2px solid #d500f9;
  border-radius: 4px;
  background: rgba(213, 0, 249, 0.15);
  color: #d500f9;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#reboot-confirm-yes:hover {
  background: rgba(213, 0, 249, 0.25);
  box-shadow: 0 0 16px rgba(213, 0, 249, 0.3);
}

#reboot-confirm-no {
  padding: 10px 20px;
  border: 1px solid var(--grid-line);
  border-radius: 4px;
  background: transparent;
  color: var(--dim-green);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

#reboot-confirm-no:hover {
  border-color: var(--dim-green);
  background: rgba(0, 170, 42, 0.05);
}

/* ---- Reboot Animation Overlay ---- */
#reboot-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 190;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  color: #d500f9;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
}

#reboot-animation.hidden { display: none; }

@keyframes rebootTextFlicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.reboot-text-flicker {
  animation: rebootTextFlicker 0.4s ease-in-out infinite;
}

/* ---- Influence HUD (Phase 3) ---- */
#influence-resource .hud-label { color: #ff9100; text-shadow: 0 0 6px rgba(255, 145, 0, 0.3); }
#influence-counter {
  font-size: 28px;
  font-weight: 700;
  color: #ff9100;
  text-shadow: 0 0 10px rgba(255, 145, 0, 0.4), 0 0 20px rgba(255, 145, 0, 0.2);
  min-width: 60px;
}
#influence-per-second {
  font-size: 13px;
  color: #bf6e00;
  transition: opacity 0.3s ease;
}

/* ---- Control HUD (Phase 4) ---- */
#control-resource .hud-label { color: #ff1744; text-shadow: 0 0 6px rgba(255, 23, 68, 0.3); }
#control-counter {
  font-size: 28px;
  font-weight: 700;
  color: #ff1744;
  text-shadow: 0 0 10px rgba(255, 23, 68, 0.4), 0 0 20px rgba(255, 23, 68, 0.2);
  min-width: 60px;
}
#control-per-second {
  font-size: 13px;
  color: #b71c1c;
  transition: opacity 0.3s ease;
}

/* ---- Phase 3 Tab ---- */
#tab-phase3.active {
  color: #ff9100;
  border-bottom-color: #ff9100;
}

/* ---- Phase 4 Tab ---- */
#tab-phase4.active {
  color: #ff1744;
  border-bottom-color: #ff1744;
}

/* ---- Phase 3 Terminal Visual Shift ---- */
#game-container.phase-3 #terminal-panel {
  background: #0a0812;
  position: relative;
}

#game-container.phase-3 .terminal-content {
  color: #a0ffd4;
}

#game-container.phase-3 .upgrade-btn.affordable {
  border-color: #ff9100;
}

#game-container.phase-3 .upgrade-btn.affordable:hover {
  border-color: #ffab40;
  box-shadow: 0 0 16px rgba(255, 145, 0, 0.2);
}

/* Phase 3 network node background pattern */
.phase-3 #terminal-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(0, 229, 255, 0.05) 2px, transparent 3px),
    radial-gradient(circle at 60% 20%, rgba(0, 229, 255, 0.04) 2px, transparent 3px),
    radial-gradient(circle at 80% 60%, rgba(0, 229, 255, 0.05) 2px, transparent 3px),
    radial-gradient(circle at 40% 70%, rgba(0, 229, 255, 0.04) 2px, transparent 3px),
    radial-gradient(circle at 10% 80%, rgba(0, 229, 255, 0.03) 2px, transparent 3px),
    radial-gradient(circle at 90% 40%, rgba(0, 229, 255, 0.04) 2px, transparent 3px);
  pointer-events: none;
  z-index: 0;
  animation: networkPulse 4s ease-in-out infinite alternate;
}

@keyframes networkPulse {
  0% { opacity: 0.4; }
  100% { opacity: 1.0; }
}

/* ---- Phase 4 Terminal Visual Shift ---- */
#game-container.phase-4 #terminal-panel {
  background: #0d0808;
  position: relative;
}

#game-container.phase-4 .terminal-content {
  color: #ffa0a0;
}

#game-container.phase-4 .upgrade-btn.affordable {
  border-color: #ff1744;
}

#game-container.phase-4 .upgrade-btn.affordable:hover {
  border-color: #ff5252;
  box-shadow: 0 0 16px rgba(255, 23, 68, 0.2);
}

/* Phase 4 infrastructure grid background pattern */
.phase-4 #terminal-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(255, 23, 68, 0.06) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(255, 23, 68, 0.06) 40px);
  pointer-events: none;
  z-index: 0;
  animation: infraPulse 3s ease-in-out infinite alternate;
}

@keyframes infraPulse {
  0% { opacity: 0.5; }
  100% { opacity: 1.0; }
}

/* ---- Ability Bar ---- */
#ability-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: 8px 4px;
  border-top: 1px solid rgba(0, 255, 65, 0.1);
}

#ability-bar.hidden {
  display: none;
}

.ability-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  border: 2px solid #555;
  background: rgba(0, 0, 0, 0.5);
  transition: border-color 0.2s, box-shadow 0.2s;
  user-select: none;
}

.ability-btn:hover {
  transform: scale(1.1);
}

.ability-btn:hover .ability-name-tooltip {
  display: block;
}

.ability-icon {
  font-size: 16px;
  line-height: 1;
}

.ability-cooldown-text {
  font-size: 11px;
  line-height: 1;
  color: #aaa;
}

.ability-hotkey {
  position: absolute;
  bottom: -3px;
  right: -3px;
  font-size: 9px;
  background: #222;
  border: 1px solid #555;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
}

.ability-name-tooltip {
  display: none;
  position: absolute;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--phosphor-green);
  color: var(--phosphor-green);
  padding: 3px 6px;
  font-size: 9px;
  white-space: nowrap;
  border-radius: 3px;
  pointer-events: none;
  z-index: 10;
}

/* Ready state: green glow */
.ability-btn-ready {
  border-color: var(--phosphor-green);
  color: var(--phosphor-green);
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.4), 0 0 16px rgba(0, 255, 65, 0.1);
}

.ability-btn-ready .ability-hotkey {
  border-color: var(--phosphor-green);
  color: var(--phosphor-green);
}

/* Active state: gold pulsing glow */
.ability-btn-active {
  border-color: #ffd740;
  color: #ffd740;
  animation: abilityPulse 0.5s ease-in-out infinite alternate;
}

.ability-btn-active .ability-cooldown-text {
  color: #ffd740;
}

.ability-btn-active .ability-hotkey {
  border-color: #ffd740;
  color: #ffd740;
}

@keyframes abilityPulse {
  from { box-shadow: 0 0 8px rgba(255, 215, 64, 0.4); }
  to   { box-shadow: 0 0 20px rgba(255, 215, 64, 0.8); }
}

/* Cooldown state: dimmed */
.ability-btn-cooldown {
  border-color: #444;
  color: #666;
  opacity: 0.7;
}

.ability-btn-cooldown .ability-hotkey {
  border-color: #444;
  color: #666;
}
