* { margin: 0; padding: 0; box-sizing: border-box; }
:root{
  --phosphor:#33ff33;
  --phosphor-soft:#2fe12f;
  --grid:#2fa62f;
  --bg:#0a0a0a;
  --warn:#ffff33;
  --error:#ff3333;
}
body {
  background: var(--bg);
  font-family: 'VT323', monospace;
  color: var(--phosphor);
  overflow: hidden;
  font-size: 18px;
  text-shadow: 0 0 3px var(--phosphor);
  padding-top: 96px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  body {
    padding-top: 20px;
    overflow-y: auto;
  }
  
  .screen {
    overflow-y: auto;
  }
}

@media (max-width: 480px) {
  body {
    padding-top: 10px;
  }
}

.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 1000;
  animation: scan 8s linear infinite;
}

@keyframes scan {
  0% { transform: translateY(0); }
  100% { transform: translateY(10px); }
}

.screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* Title Screen */
#title-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

#title-globe-canvas {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 750px;
  height: 375px;
  opacity: 0.8;
  pointer-events: none;
}

.title-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title-logo {
  font-size: 72px;
  letter-spacing: 10px;
  text-shadow: 0 0 20px var(--phosphor), 0 0 40px var(--phosphor);
  margin-bottom: 60px;
  animation: glow-pulse 2s infinite;
}

@keyframes glow-pulse {
  0%, 100% { text-shadow: 0 0 20px var(--phosphor), 0 0 40px var(--phosphor); }
  50% { text-shadow: 0 0 30px var(--phosphor), 0 0 60px var(--phosphor); }
}

.subtitle {
  font-size: 28px;
  margin-bottom: 280px;
  color: var(--warn);
  text-shadow: 0 0 10px var(--warn);
  visibility: hidden;
}

.start-button {
  font-family: 'VT323', monospace;
  font-size: 32px;
  background: transparent;
  border: 3px solid var(--phosphor);
  color: var(--phosphor);
  padding: 15px 60px;
  cursor: pointer;
  text-shadow: 0 0 10px var(--phosphor);
  box-shadow: 0 0 20px rgba(51, 255, 51, 0.3);
  transition: all 0.3s;
  margin-top: 80px;
}

.start-button:hover {
  background: var(--phosphor);
  color: var(--bg);
  text-shadow: none;
  box-shadow: 0 0 30px var(--phosphor);
}

/* Mobile responsive for title screen */
@media (max-width: 768px) {
  .title-logo {
    font-size: 48px;
    margin-bottom: 40px;
  }
  
  #title-globe-canvas {
    width: 90vw;
    height: 45vw;
    top: 40%;
  }
  
  .subtitle {
    margin-bottom: 180px;
  }
  
  .start-button {
    font-size: 24px;
    padding: 12px 40px;
    margin-top: 40px;
  }
}

@media (max-width: 480px) {
  .title-logo {
    font-size: 36px;
    letter-spacing: 5px;
    margin-bottom: 30px;
  }
  
  #title-globe-canvas {
    width: 95vw;
    height: 47.5vw;
    top: 38%;
  }
  
  .subtitle {
    font-size: 20px;
    margin-bottom: 150px;
  }
  
  .start-button {
    font-size: 20px;
    padding: 10px 30px;
    margin-top: 30px;
  }
}

/* Game Screens */
.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.game-header {
  background: rgba(10, 10, 10, 0.95);
  border: 2px solid var(--phosphor);
  padding: 15px 25px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 22px;
  text-shadow: 0 0 8px var(--phosphor);
}

.level-title {
  font-size: 28px;
  letter-spacing: 3px;
}

.score-display {
  display: flex;
  gap: 40px;
}

/* Mobile responsive for game screens */
@media (max-width: 768px) {
  .game-container {
    padding: 10px;
  }
  
  .game-header {
    flex-direction: column;
    gap: 10px;
    padding: 10px 15px;
    font-size: 18px;
  }
  
  .level-title {
    font-size: 20px;
    letter-spacing: 2px;
  }
  
  .score-display {
    gap: 20px;
    font-size: 16px;
  }
  
  .game-content {
    padding: 15px;
  }
  
  .terminal-text {
    font-size: 16px;
  }
  
  .input-group {
    flex-direction: column;
    gap: 10px;
  }
  
  .game-input {
    font-size: 18px;
    width: 100%;
  }
  
  .submit-btn {
    font-size: 18px;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .game-header {
    font-size: 16px;
  }
  
  .level-title {
    font-size: 18px;
  }
  
  .terminal-text {
    font-size: 14px;
  }
}

.game-content {
  flex: 1;
  border: 2px solid var(--phosphor);
  background: rgba(10, 10, 10, 0.9);
  padding: 30px;
  overflow-y: auto;
  box-shadow: inset 0 0 30px rgba(51, 255, 51, 0.1);
}

.terminal-text {
  font-size: 20px;
  line-height: 1.6;
  margin: 10px 0;
  text-shadow: 0 0 5px var(--phosphor);
}

.cipher-text {
  color: var(--warn);
  text-shadow: 0 0 8px var(--warn);
  font-size: 24px;
  letter-spacing: 3px;
  margin: 20px 0;
  padding: 20px;
  border: 1px solid var(--warn);
  background: rgba(255, 255, 51, 0.05);
}

.input-group {
  margin: 30px 0;
  display: flex;
  align-items: center;
  gap: 15px;
}

.input-label {
  font-size: 22px;
  text-shadow: 0 0 5px var(--phosphor);
}

.game-input {
  flex: 1;
  background: transparent;
  border: 2px solid var(--phosphor);
  color: var(--phosphor);
  font-family: 'VT323', monospace;
  font-size: 24px;
  padding: 10px 15px;
  text-shadow: 0 0 5px var(--phosphor);
  outline: none;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.submit-btn {
  font-family: 'VT323', monospace;
  font-size: 24px;
  background: transparent;
  border: 2px solid var(--phosphor);
  color: var(--phosphor);
  padding: 10px 30px;
  cursor: pointer;
  text-shadow: 0 0 5px var(--phosphor);
  transition: all 0.2s;
}

.submit-btn:hover {
  background: var(--phosphor);
  color: var(--bg);
  text-shadow: none;
  box-shadow: 0 0 20px var(--phosphor);
}

.error-msg {
  color: var(--error);
  text-shadow: 0 0 10px var(--error);
  font-size: 22px;
  animation: blink-alert 0.5s infinite;
}

.success-msg {
  color: var(--phosphor);
  text-shadow: 0 0 15px var(--phosphor);
  font-size: 24px;
  animation: glow-pulse 1s infinite;
}

@keyframes blink-alert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* War Dialer */
.dialer-display {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 30px 0;
}

.phone-number {
  border: 1px solid var(--grid);
  padding: 15px;
  text-align: center;
  font-size: 20px;
  background: rgba(51, 255, 51, 0.05);
}

.phone-number.scanning {
  border-color: var(--warn);
  color: var(--warn);
  text-shadow: 0 0 10px var(--warn);
  animation: pulse 0.5s infinite;
}

.phone-number.found {
  border-color: var(--phosphor);
  background: rgba(51, 255, 51, 0.2);
  box-shadow: 0 0 20px rgba(51, 255, 51, 0.5);
}

/* Games List */
.games-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 30px 0;
}

.game-option {
  border: 2px solid var(--grid);
  padding: 15px 25px;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(10, 10, 10, 0.5);
}

.game-option:hover {
  border-color: var(--phosphor);
  background: rgba(51, 255, 51, 0.1);
  box-shadow: 0 0 15px rgba(51, 255, 51, 0.3);
}

.game-option.dangerous {
  border-color: var(--error);
}

/* Launch Codes */
.code-puzzle {
  margin: 30px 0;
  padding: 25px;
  border: 2px solid var(--phosphor);
  background: rgba(51, 255, 51, 0.05);
}

.puzzle-title {
  font-size: 24px;
  margin-bottom: 15px;
  color: var(--warn);
  text-shadow: 0 0 8px var(--warn);
}

.binary-display {
  font-size: 28px;
  letter-spacing: 5px;
  margin: 20px 0;
  text-align: center;
}

/* NORAD Interface */
#norad-screen {
  display: none;
}

#norad-screen.active {
  display: flex;
  flex-direction: column;
}

#header, #footer {
  padding: 12px 20px; 
  display: flex;
  justify-content: space-between; 
  align-items:center;
  text-shadow: 0 0 8px var(--phosphor), 0 0 15px var(--phosphor);
  z-index: 100; 
  background: rgba(10, 10, 10, 0.95);
  border-bottom: 2px solid var(--phosphor);
  font-size: 20px;
  letter-spacing: 2px;
}

#footer{ 
  border-bottom:none; 
  border-top: 2px solid var(--phosphor); 
}

.controls {
  display: flex;
  gap: 20px;
  align-items: center;
}

#connection-status {
  color: var(--warn);
  text-shadow: 0 0 8px var(--warn);
}

#connection-status.active {
  color: var(--phosphor);
  text-shadow: 0 0 8px var(--phosphor);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

#main-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

#terminal-section {
  width: 33%;
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--phosphor);
  background: rgba(10, 10, 10, 0.5);
}

/* Mobile responsive for NORAD screen */
@media (max-width: 1024px) {
  #main-container {
    flex-direction: column;
  }
  
  #terminal-section {
    width: 100%;
    height: 40vh;
    border-right: none;
    border-bottom: 2px solid var(--phosphor);
  }
  
  .display-section {
    width: 100%;
    height: 60vh;
  }
}

@media (max-width: 768px) {
  #header, #footer {
    padding: 8px 12px;
    font-size: 14px;
    flex-wrap: wrap;
  }
  
  .controls {
    gap: 10px;
    font-size: 12px;
  }
  
  #terminal-section {
    height: 35vh;
  }
  
  .display-section {
    height: 65vh;
    flex-direction: column;
  }
  
  .globe-container, .map-container {
    height: 50%;
  }
  
  #terminal-output {
    font-size: 12px;
    padding: 10px;
  }
  
  #command-input {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  #header, #footer {
    font-size: 12px;
    padding: 6px 8px;
  }
  
  .controls {
    font-size: 10px;
  }
  
  #terminal-output {
    font-size: 10px;
  }
  
  #command-input {
    font-size: 12px;
  }
}

#term-handle {
  padding: 10px 20px;
  background: rgba(51, 255, 51, 0.1);
  border-bottom: 1px solid var(--phosphor);
  text-align: center;
  font-size: 20px;
  letter-spacing: 3px;
  text-shadow: 0 0 8px var(--phosphor);
}

#terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  font-size: 16px;
  line-height: 1.4;
}

#terminal-output::-webkit-scrollbar {
  width: 10px;
}

#terminal-output::-webkit-scrollbar-track {
  background: rgba(0, 26, 0, 0.5);
}

#terminal-output::-webkit-scrollbar-thumb {
  background: var(--phosphor);
  box-shadow: 0 0 10px var(--phosphor);
}

.terminal-line {
  text-shadow: 0 0 5px var(--phosphor);
  margin: 3px 0;
}

.alert {
  color: var(--error);
  text-shadow: 0 0 10px var(--error), 0 0 20px var(--error);
}

#input-line {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  background: rgba(0, 26, 0, 0.8);
  border-top: 1px solid var(--phosphor);
}

#prompt {
  margin-right: 10px;
  text-shadow: 0 0 5px var(--phosphor);
  font-size: 20px;
}

#command-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--phosphor);
  font-family: 'VT323', monospace;
  font-size: 18px;
  outline: none;
  text-shadow: 0 0 5px var(--phosphor);
  letter-spacing: 2px;
}

.cursor {
  display: inline-block;
  width: 12px;
  height: 20px;
  background: var(--phosphor);
  animation: blink 1s infinite;
  box-shadow: 0 0 10px var(--phosphor);
  margin-left: 5px;
}

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

.display-section {
  width: 67%;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 10px;
}

.globe-container, .map-container {
  flex: 1;
  position: relative;
  border: 2px solid var(--phosphor);
  background: #000000;
  box-shadow: inset 0 0 30px rgba(51, 255, 51, 0.2);
  overflow: hidden;
}

.globe-container canvas,
.map-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#defcon {
  font-weight: bold;
}

#defcon.defcon-1 { 
  color: var(--error); 
  text-shadow: 0 0 10px var(--error), 0 0 20px var(--error); 
  animation: blink-alert 0.3s infinite;
}

#defcon.defcon-2 { 
  color: #ff6600; 
  text-shadow: 0 0 10px #ff6600; 
}

#defcon.defcon-3 { 
  color: var(--warn); 
  text-shadow: 0 0 10px var(--warn); 
}

#shield-status {
  font-weight: bold;
}

#shield-status.active {
  color: #00ffff;
  text-shadow: 0 0 10px #00ffff;
  animation: pulse 2s infinite;
}

/* Popup Styles */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.3s;
  padding: 20px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.popup-box {
  background: rgba(10, 10, 10, 0.98);
  border: 3px solid var(--phosphor);
  box-shadow: 0 0 40px rgba(51, 255, 51, 0.6), inset 0 0 30px rgba(51, 255, 51, 0.1);
  width: 500px;
  max-width: 90%;
  animation: popupAppear 0.3s ease-out;
}

@keyframes popupAppear {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.popup-header {
  background: rgba(51, 255, 51, 0.2);
  padding: 15px 20px;
  font-size: 24px;
  letter-spacing: 3px;
  text-shadow: 0 0 10px var(--phosphor);
  border-bottom: 2px solid var(--phosphor);
  text-align: center;
}

.popup-body {
  padding: 30px;
  text-align: center;
}

.popup-buttons {
  display: flex;
  gap: 10px;
  padding: 20px;
  border-top: 2px solid var(--phosphor);
}

.popup-btn {
  flex: 1;
  font-family: 'VT323', monospace;
  font-size: 22px;
  background: transparent;
  border: 2px solid var(--phosphor);
  color: var(--phosphor);
  padding: 12px 20px;
  cursor: pointer;
  text-shadow: 0 0 8px var(--phosphor);
  transition: all 0.2s;
}

.popup-btn:hover {
  background: var(--phosphor);
  color: var(--bg);
  text-shadow: none;
  box-shadow: 0 0 20px var(--phosphor);
}

.popup-btn.secondary {
  border-color: var(--error);
  color: var(--error);
  text-shadow: 0 0 8px var(--error);
}

.popup-btn.secondary:hover {
  background: var(--error);
  color: var(--bg);
  box-shadow: 0 0 20px var(--error);
}

/* Mobile responsive for popups */
@media (max-width: 768px) {
  .popup-overlay {
    padding: 15px;
  }
  
  .popup-box {
    width: 100%;
    max-width: 400px;
  }
  
  .popup-header {
    font-size: 18px;
    padding: 12px 15px;
  }
  
  .popup-body {
    padding: 20px 15px;
    font-size: 16px;
  }
  
  .popup-buttons {
    padding: 15px;
    gap: 8px;
  }
  
  .popup-btn {
    font-size: 18px;
    padding: 10px 15px;
  }
}

@media (max-width: 480px) {
  .popup-box {
    max-width: 100%;
  }
  
  .popup-header {
    font-size: 16px;
    padding: 10px;
  }
  
  .popup-body {
    padding: 15px 10px;
    font-size: 14px;
  }
  
  .popup-buttons {
    flex-direction: column;
    padding: 10px;
  }
  
  .popup-btn {
    font-size: 16px;
    padding: 10px;
    width: 100%;
  }
}

/* TRANSMISSION POPUPS */
.transmission-popup {
  position: fixed;
  width: 450px;
  max-width: 90%;
  background: rgba(10, 10, 10, 0.98);
  border: 3px solid var(--error);
  box-shadow: 0 0 30px rgba(255, 51, 51, 0.8), inset 0 0 30px rgba(255, 51, 51, 0.2);
  z-index: 600;
  animation: popup-appear 0.3s ease-out;
}

.transmission-header {
  background: rgba(255, 51, 51, 0.2);
  padding: 12px 15px;
  font-size: 20px;
  letter-spacing: 2px;
  text-shadow: 0 0 10px var(--error);
  color: var(--error);
  border-bottom: 2px solid var(--error);
  animation: blink-alert 1s infinite;
}

.transmission-body {
  padding: 20px;
  font-size: 18px;
  line-height: 1.6;
  text-shadow: 0 0 5px var(--phosphor);
  min-height: 100px;
}

.transmission-dismiss {
  width: 100%;
  background: transparent;
  border: none;
  border-top: 2px solid var(--phosphor);
  color: var(--phosphor);
  font-family: 'VT323', monospace;
  font-size: 20px;
  padding: 12px;
  cursor: pointer;
  text-shadow: 0 0 8px var(--phosphor);
  transition: all 0.2s;
}

.transmission-dismiss:hover {
  background: var(--phosphor);
  color: var(--bg);
  text-shadow: none;
  box-shadow: 0 0 20px var(--phosphor);
}

/* Mobile responsive for transmission popups */
@media (max-width: 768px) {
  .transmission-popup {
    width: 90%;
    max-width: 350px;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%);
  }
  
  .transmission-header {
    font-size: 16px;
    padding: 10px 12px;
  }
  
  .transmission-body {
    padding: 15px;
    font-size: 14px;
    min-height: 80px;
  }
  
  .transmission-dismiss {
    font-size: 16px;
    padding: 10px;
  }
}

@media (max-width: 480px) {
  .transmission-popup {
    width: 95%;
    max-width: 300px;
  }
  
  .transmission-header {
    font-size: 14px;
    padding: 8px 10px;
  }
  
  .transmission-body {
    padding: 12px;
    font-size: 12px;
    min-height: 60px;
  }
  
  .transmission-dismiss {
    font-size: 14px;
    padding: 8px;
  }
}

/* End Screen */
.end-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 50px;
}

.end-message {
  font-size: 48px;
  margin-bottom: 30px;
  text-shadow: 0 0 20px var(--phosphor);
  line-height: 1.6;
}

.final-score {
  font-size: 64px;
  color: var(--warn);
  text-shadow: 0 0 30px var(--warn);
  margin: 40px 0;
}

.restart-btn {
  font-family: 'VT323', monospace;
  font-size: 28px;
  background: transparent;
  border: 3px solid var(--phosphor);
  color: var(--phosphor);
  padding: 15px 50px;
  cursor: pointer;
  margin-top: 30px;
  text-shadow: 0 0 10px var(--phosphor);
  transition: all 0.3s;
}

.restart-btn:hover {
  background: var(--phosphor);
  color: var(--bg);
  text-shadow: none;
  box-shadow: 0 0 30px var(--phosphor);
}
