* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #1a1410;
  overflow: hidden;
  font-family: Georgia, 'Times New Roman', serif;
  color: #dcc8a9;
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  image-rendering: pixelated;
  cursor: default;
}

/* ===== HUD ===== */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#top-bar {
  position: absolute;
  top: 12px;
  left: 220px;
  right: 180px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

#objective-panel {
  background: rgba(26, 20, 14, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(200, 160, 80, 0.35);
  border-radius: 4px;
  padding: 10px 16px;
  font-size: 14px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#conversion-panel {
  background: rgba(26, 20, 14, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(200, 160, 80, 0.35);
  border-radius: 4px;
  padding: 10px 16px;
  font-size: 13px;
  white-space: nowrap;
}

.icon { font-size: 18px; }

/* Alert Banner */
#alert-banner {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(120, 20, 10, 0.92);
  backdrop-filter: blur(6px);
  border: 2px solid #8b2500;
  border-radius: 4px;
  padding: 10px 24px;
  font-weight: bold;
  font-size: 15px;
  letter-spacing: 0.5px;
  animation: alertPulse 1s ease-in-out infinite alternate;
  white-space: nowrap;
}
#alert-banner.hidden { display: none; }

@keyframes alertPulse {
  from { opacity: 0.8; box-shadow: 0 0 10px rgba(139,37,0,0.4); }
  to   { opacity: 1;   box-shadow: 0 0 25px rgba(139,37,0,0.8); }
}

/* Freedom Seeker Stats Panel */
#runner-stats {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(26, 20, 14, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(200, 160, 80, 0.25);
  border-radius: 4px;
  padding: 14px 18px;
  min-width: 210px;
}

#runner-stats h3 {
  font-size: 14px;
  color: #d4a843;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
}

.morale-row {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(200, 160, 80, 0.15);
}

#morale-bar {
  font-family: monospace;
  font-weight: bold;
  letter-spacing: 1px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.fled       { background: #d4a843; }
.dot.caught     { background: #c44; }
.dot.killed     { background: #8b2500; }
.dot.remaining-dot { background: #8a7a60; }

/* Station Info */
#safehouse-info {
  position: absolute;
  bottom: 50px;
  left: 12px;
  background: rgba(26, 20, 14, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(140, 120, 80, 0.3);
  border-radius: 4px;
  padding: 12px 16px;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 14px;
}

/* Minimap */
#clock-container {
  position: absolute;
  bottom: calc(50px + 200px + 8px);
  right: 12px;
  background: rgba(26, 20, 14, 0.85);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(200, 160, 80, 0.25);
  border-radius: 4px;
  padding: 4px 12px;
  text-align: center;
}

#clock-time {
  font-family: monospace;
  font-size: 16px;
  font-weight: bold;
  color: #e8d8b8;
  letter-spacing: 1px;
}

#minimap-container {
  position: absolute;
  bottom: 50px;
  right: 12px;
  border: 2px solid rgba(200, 160, 80, 0.35);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(26, 20, 14, 0.75);
  backdrop-filter: blur(4px);
}

#minimap-canvas {
  display: block;
  width: 160px;
  height: 200px;
}

/* Hint Bar */
#hint-bar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 20, 14, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(200, 160, 80, 0.15);
  border-radius: 4px;
  padding: 8px 20px;
  font-size: 12px;
  color: #a89878;
  white-space: nowrap;
}

/* Notifications */
#notifications {
  position: absolute;
  top: 90px;
  right: 12px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(26, 20, 14, 0.94);
  backdrop-filter: blur(10px);
  border-left: 4px solid #8b7355;
  border-radius: 4px;
  padding: 12px 18px;
  font-size: 13px;
  max-width: 320px;
  animation: toastIn 0.3s ease-out, toastOut 0.4s ease-in 4s forwards;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
.toast.warning { border-left-color: #8b2500; }
.toast.success { border-left-color: #6b8e4e; }
.toast.info    { border-left-color: #7a9ab0; }

@keyframes toastIn  { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ===== OVERLAY SCREENS ===== */
.overlay-screen {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 5, 0.94);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  text-align: center;
  padding: 40px;
}

.overlay-screen h1 {
  font-size: 48px;
  margin-bottom: 16px;
  color: #d4a843;
  text-shadow: 0 0 30px rgba(212, 168, 67, 0.3);
}

.overlay-screen .subtitle {
  font-size: 20px;
  color: #b8a888;
  margin-bottom: 16px;
  font-style: italic;
}

.overlay-screen .instructions {
  font-size: 15px;
  line-height: 1.9;
  color: #a89878;
  margin-bottom: 36px;
  max-width: 500px;
}

.primary-btn {
  background: linear-gradient(135deg, #6b4e2e, #4a3520);
  border: 1px solid #8b7355;
  color: #dcc8a9;
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: bold;
  padding: 16px 48px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 1px;
}
.primary-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(139,115,85,0.5);
  background: linear-gradient(135deg, #7d5c38, #5a4228);
}

/* Conductor selector on start screen */
#conductor-select {
  border: 1px solid rgba(200, 160, 80, 0.3);
  border-radius: 6px;
  padding: 14px 24px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(26, 20, 14, 0.6);
}

#conductor-select legend {
  font-size: 14px;
  color: #d4a843;
  padding: 0 8px;
}

#conductor-select label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #a89878;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

#conductor-select label:hover {
  background: rgba(200, 160, 80, 0.12);
  color: #dcc8a9;
}

#conductor-select input[type="radio"] {
  accent-color: #d4a843;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

#conductor-select input[type="radio"]:checked + span,
#conductor-select label:has(input:checked) {
  color: #e8d8b8;
}

.hidden { display: none !important; }

/* Pause overlay — semi-transparent so the game is still visible behind */
#generic-overlay {
  background: rgba(5, 5, 20, 0.7);
  backdrop-filter: blur(4px);
}

/* Generic overlay inner wrapper */
#overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 800px;
  width: 90%;
}

/* Card body — scrollable HTML content */
.overlay-card-body {
  color: #a89878;
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 32px;
  max-width: 560px;
  text-align: left;
  max-height: 50vh;
  overflow-y: auto;
  padding: 0 12px;
}

/* Image overlay */
.overlay-image {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 4px 40px rgba(0,0,0,0.6);
  margin-bottom: 16px;
}

/* Video embed wrapper — 16:9 aspect ratio */
.overlay-video-wrapper {
  position: relative;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  margin-bottom: 20px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 40px rgba(0,0,0,0.6);
  background: #000;
}
.overlay-video {
  width: 100%;
  height: 100%;
  border: none;
}

/* Close button spacing */
.overlay-close-btn {
  margin-top: 8px;
}

/* Debug Interstitial Tester */
#debug-interstitial-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 200;
  width: 32px;
  height: 32px;
  background: rgba(26, 20, 14, 0.7);
  border: 1px solid rgba(200, 160, 80, 0.3);
  border-radius: 4px;
  color: #a89878;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
  line-height: 1;
  pointer-events: auto;
}

#debug-interstitial-btn:hover {
  opacity: 1;
}

#debug-interstitial-menu {
  position: absolute;
  top: 44px;
  right: 8px;
  z-index: 200;
  background: rgba(26, 20, 14, 0.95);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(200, 160, 80, 0.3);
  border-radius: 6px;
  padding: 8px 0;
  min-width: 200px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}

#debug-interstitial-btn:hover {
  opacity: 1;
}

#debug-interstitial-menu {
  position: absolute;
  top: 44px;
  right: 8px;
  z-index: 200;
  background: rgba(26, 20, 14, 0.95);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(200, 160, 80, 0.3);
  border-radius: 6px;
  padding: 8px 0;
  min-width: 200px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.debug-interstitial-header {
  padding: 4px 14px 8px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8a7a5a;
  border-bottom: 1px solid rgba(200, 160, 80, 0.15);
  margin-bottom: 4px;
}

.debug-interstitial-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  background: none;
  border: none;
  color: #d4c4a4;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.debug-interstitial-item:hover {
  background: rgba(200, 160, 80, 0.15);
  color: #ffd700;
}

/* Responsive */
@media (max-width: 700px) {
  #top-bar { left: 12px; right: 12px; flex-direction: column; }
  #runner-stats { top: auto; bottom: 50px; left: 12px; min-width: 150px; padding: 10px 12px; }
  #runner-stats h3 { font-size: 12px; }
  .stat-row { font-size: 11px; }
  #hint-bar { font-size: 10px; padding: 6px 12px; }
  .overlay-screen h1 { font-size: 32px; }
  .overlay-screen .instructions { font-size: 13px; }
  .overlay-card-body { font-size: 14px; max-height: 40vh; }
  .overlay-video-wrapper { max-width: 95vw; }
}
