 html {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #000;
  color: #0ff;
  font-family: 'Segoe UI', Arial, sans-serif;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh; /* fill itch.io iframe; rotation handled by JS */
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  background: #111 !important;
  border: 4px solid var(--neon);
  z-index: 1;
}

/* Only disable browser gestures on touch devices */
@media (pointer: coarse) {
  #gameCanvas {
    touch-action: none;
    -ms-touch-action: none;
  }
  /* Hide Radio Chatter title and box on all mobile orientations */
  #radio-title,
  #radio-chatter {
    display: none !important;
  }
}

/* Fallback: hide radio UI on small screens (phones) regardless of pointer detection */
@media (max-width: 768px) {
  #radio-title,
  #radio-chatter {
    display: none !important;
  }
}

/* Explicitly hide on mobile landscape as well */
@media (max-width: 1024px) and (orientation: landscape) {
  #radio-title,
  #radio-chatter {
    display: none !important;
  }
}

#hud {
  position: fixed;
  top: 0;
  right: 0;
  left: auto;
  width: 320px;
  padding: 20px 20px 20px 10px;
  z-index: 10;
  color: #fff;
  font-family: 'Orbitron', 'Arial', sans-serif;
  font-size: 1.03rem;
  pointer-events: none;
  text-align: right;
}

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700&display=swap');

.stat-table, #score-bar {
  font-family: 'Orbitron', 'Arial', sans-serif;
  letter-spacing: 0.5px;
}

.blue-glow {
  color: #0ff;
  text-shadow: 0 0 6px #0ff, 0 0 18px #0ff, 0 0 32px #0ff;
  font-family: 'Orbitron', 'Arial', sans-serif;
}

.stat-table td.green, .stat-table .green td {
  color: #0f0;
  text-shadow: 0 0 6px #0f0, 0 0 18px #0f0, 0 0 32px #0f0;
}
.stat-table td.red, .stat-table .red td {
  color: #f33;
  text-shadow: 0 0 6px #f33, 0 0 18px #f33, 0 0 32px #f33;
}
.stat-table td.yellow, .stat-table .yellow td {
  color: #ff0;
  text-shadow: 0 0 6px #ff0, 0 0 18px #ff0, 0 0 32px #ff0;
}

#score-bar {
  margin-top: 8px;
  font-size: 1.12em;
  font-weight: bold;
  text-align: right;
}


#hud h2#planes-title {
  color: #fff;
  margin-top: 0;
  text-shadow: 0 0 10px #fff, 0 0 2px #0ff;
  font-weight: bold;
}

.stat-table, .score-table {
  width: auto;
  border-collapse: collapse;
  margin-bottom: 10px;
  font-size: 1.09em;
  text-align: right;
  margin-left: auto;
}
.stat-table td, .score-table td, .score-table th {
  padding: 1px 2px;
  background: rgba(0,0,0,0.3);
  border: none;
  font-family: 'Orbitron', 'Arial', sans-serif;
  white-space: nowrap;
}
.stat-table td.green, .stat-table .green td { color: #0f0; }
.stat-table td.red, .stat-table .red td { color: #f33; }
.stat-table td.yellow, .stat-table .yellow td { color: #ff0; }
.score-table th.blue { color: #0ff; text-shadow: 0 0 8px #0ff, 0 0 32px #0ff; font-weight: bold; font-size: 1.02em; text-align: right; }
.score-table td { color: #fff; font-weight: bold; font-size: 1.04em; text-align: right; }


.stat-group span {
  display: block;
  text-align: right;
  font-size: 0.93em;
}

.stat-group.green span {
  color: #0f0;
  text-shadow: 0 0 8px #0f0, 0 0 2px #fff;
  font-weight: bold;
}

.stat-group.red span {
  color: #f00;
  text-shadow: 0 0 8px #f00, 0 0 2px #fff;
  font-weight: bold;
}

.stat-group.yellow span {
  color: #ff0;
  text-shadow: 0 0 8px #ff0, 0 0 2px #fff;
  font-weight: bold;
}

.stat-group.cyan span {
  color: #0ff;
  text-shadow: 0 0 8px #0ff, 0 0 2px #fff;
  font-weight: bold;
}

#hud h2 {
  margin-top: 0.5em;
  margin-bottom: 0.2em;
  letter-spacing: 1px;
  font-size: 1.05em;
  font-weight: bold;
  text-shadow: 0 0 6px #0ff, 0 0 16px #0ff;
  text-transform: uppercase;
  pointer-events: auto;
  text-align: right;
}

#hud h2.blue, #hud h2#weather-title {
  color: #0ff;
  text-shadow: 0 0 8px #0ff, 0 0 32px #0ff;
  text-align: right;
  font-weight: bold;
}

#stats, #weather-stats {
  font-size: 1em;
  margin-bottom: 1em;
}

h2#weather-title {
  color: #0ff;
  margin: 1em 0 0.5em 0;
  text-shadow: 0 0 10px #0ff, 0 0 2px #fff;
}


.neon-command-window {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.95);
  border: 2px solid #0ff;
  box-shadow: 0 0 30px #0ff, 0 0 8px #fff;
  color: #fff;
  padding: 2em 2em 1.5em 2em;
  z-index: 1000;
  min-width: 320px;
  border-radius: 16px;
  font-family: 'Segoe UI', monospace, Arial, sans-serif;
}
.neon-command-window h2 {
  color: #0ff;
  text-shadow: 0 0 12px #0ff, 0 0 2px #fff;
  margin-top: 0;
}
.neon-command-window label {
  color: #fff;
  text-shadow: 0 0 4px #0ff, 0 0 1px #fff;
  display: block;
  margin: 1em 0 0.5em 0;
}
.neon-command-window input[type="number"] {
  background: #111;
  border: 1px solid #0ff;
  color: #0ff;
  border-radius: 4px;
  margin-left: 0.5em;
  padding: 0.2em 0.5em;
  width: 80px;
}
.neon-command-window button {
  background: #0ff;
  color: #000;
  border: none;
  border-radius: 4px;
  margin: 1em 0.5em 0 0;
  padding: 0.5em 1.2em;
  font-weight: bold;
  box-shadow: 0 0 10px #0ff, 0 0 2px #fff;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.neon-command-window button:hover {
  background: #fff;
  color: #0ff;
}
#command-window {
  display: none;
}

@media (max-width: 600px) {
  /* Keep HUD (scoring + radio chatter) at top-right on mobile */
  #hud {
    top: 0;
    right: 0;
    left: auto;
    bottom: auto;
    width: auto;
    max-width: 80vw;
    padding: 12px 12px 12px 8px;
    border: none;
    font-size: 0.9em;
  }

  /* Ensure radio chatter box doesn't push layout horizontally */
  #radio-chatter {
    display: inline-block;
    width: auto;
    max-width: 140px; /* approx match the heading width on mobile */
    max-height: 100px; /* half height */
    padding: 3px; /* half padding */
    font-size: 0.4rem; /* half font size */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    margin-left: auto; /* keep aligned to the right edge */
  }

  /* Scale down radio title and messages on mobile */
  #radio-title {
    display: none; /* hide radio title on mobile */
  }
  .radio-message {
    padding: 2px 4px;
  }
  #radio-messages { gap: 2px; }
}

/* Radio Chatter Styling */
#radio-title {
  color: #0ff;
  text-shadow: 0 0 6px #0ff, 0 0 18px #0ff, 0 0 32px #0ff;
  margin: 20px 0 10px 0;
  font-size: 1.1rem;
  font-family: 'Orbitron', 'Arial', sans-serif;
  letter-spacing: 1px;
}

#radio-chatter {
  background: rgba(0,0,0,0.3);
  border: 2px solid #0ff;
  border-radius: 8px;
  padding: 6px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  width: auto;
  max-width: 180px;
  margin-left: auto;
  z-index: -1;
}

#radio-messages {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.radio-message {
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.2;
  animation: fadeIn 0.3s ease-in;
}

.radio-atc {
  border-left-color: #00ffff;
  color: #00ffff;
  text-shadow: 0 0 4px #00ffff;
}

.radio-pilot {
  border-left-color: var(--pilot-color);
  color: var(--pilot-color);
  text-shadow: 0 0 4px var(--pilot-color);
}

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

/* Scrollbar styling for radio chatter */
#radio-chatter::-webkit-scrollbar {
  width: 6px;
}

#radio-chatter::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

#radio-chatter::-webkit-scrollbar-thumb {
  background: #0ff;
  border-radius: 3px;
}

#radio-chatter::-webkit-scrollbar-thumb:hover {
  background: #00cccc;
}

/* Mobile-only UI size reduction (~30%) for Dashboard, Scores, and Leaderboards */
@media (max-width: 768px), (pointer: coarse) {
  /* HUD container smaller typography */
  #hud {
    font-size: 0.72em; /* ~28% smaller */
  }

  /* Tables shrink */
  .stat-table, .score-table {
    font-size: 0.8em; /* additional reduction within HUD */
  }
  .score-table th.blue { font-size: 0.82em; }
  .score-table td { font-size: 0.82em; }
  /* Make the Score row visually match other dashboard rows on mobile */
  #score-bar { font-size: 0.82em !important; line-height: 1.2em; }
  /* Ensure the actual number uses the same scale as other values */
  #score-main { font-size: 1em !important; line-height: inherit; }

  /* Leaderboards header button on HUD */
  #leaderboards .neon-btn {
    padding: 3px 5px !important;
    border-radius: 5px !important;
    box-shadow: 0 0 8px #0ff !important;
    font-size: 0.9em !important;
  }

  /* Modal window typography and controls */
  #lb-modal-window { font-size: 0.78em; }
  #lb-modal-window button {
    padding: 5px 8px !important;
    border-radius: 5px !important;
    font-size: 0.95em !important;
  }

  /* Modal lists */
  #lb-session-list, #lb-career-list {
    padding: 5px !important;
  }
}
