/* Subway Soldier: Outbreak — Stylesheet */

:root {
  --bg: #070a13;
  --surface: #0f172a;
  --surface-border: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-cyan: #38bdf8;
  --accent-amber: #facc15;
  --accent-red: #ef4444;
  --accent-green: #22c55e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100%;
  padding: 8px 12px;
  gap: 8px;
  background: var(--bg);
}

/* Fullscreen mode (both native :fullscreen and .fullscreen-fallback) */
#app:fullscreen,
#app:-webkit-full-screen,
#app.fullscreen-fallback {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  padding: 0 !important;
  background: #000 !important;
  justify-content: center !important;
}

#app:fullscreen #stage,
#app:-webkit-full-screen #stage,
#app.fullscreen-fallback #stage {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
}

#app:fullscreen #controls,
#app:-webkit-full-screen #controls,
#app.fullscreen-fallback #controls,
#app:fullscreen #titlebar,
#app:-webkit-full-screen #titlebar,
#app.fullscreen-fallback #titlebar {
  display: none;
}

/* Titlebar */
#titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 960px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--surface-border);
}

.title-group h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-group p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.title-actions {
  display: flex;
  gap: 8px;
}

/* Stage & Canvas Container */
#stage {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 960 / 540;
  background: #000;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

canvas#game {
  width: 100%;
  height: 100%;
  display: block;
  aspect-ratio: 960 / 540;
  cursor: crosshair;
}

/* In-Stage Tactical HUD Overlays */
.hud-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 16px;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.hud-pill {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.hud-pill.danger {
  border-color: rgba(239, 68, 68, 0.4);
}

.hud-pill.highlight {
  border-color: rgba(250, 204, 21, 0.4);
}

.hud-pill span.label {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

/* Compass radar track */
#compass {
  width: 220px;
  height: 22px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.compass-track {
  width: 100%;
  height: 100%;
  position: relative;
}

.compass-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--accent-cyan);
  font-size: 9px;
}

.blip {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
}

.blip-zombie { color: #ef4444; }
.blip-civilian { color: #22c55e; }
.blip-bubble { color: #facc15; }

/* Notice ticker */
#noticeText {
  position: absolute;
  top: 55px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

/* HUD Bottom Bar */
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}

.health-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 160px;
}

.health-bar-container {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

#hpBar {
  width: 100%;
  height: 100%;
  background: var(--accent-green);
  transition: width 0.15s ease, background 0.15s ease;
}

.weapon-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

#weaponTierBadge {
  background: var(--accent-cyan);
  color: #070a13;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

#ammoCount {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: monospace;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

/* Floating interactive full screen toggle on HUD */
.hud-interactive {
  pointer-events: auto;
}

.hud-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.hud-btn:hover {
  background: var(--accent-cyan);
  color: #070a13;
}

/* Controls Bar outside canvas */
#controls {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

button {
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

button:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.9);
  border-color: var(--accent-cyan);
  color: #fff;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent-cyan);
  color: #070a13;
  border-color: var(--accent-cyan);
}

button.primary:hover:not(:disabled) {
  background: #7dd3fc;
  border-color: #7dd3fc;
  color: #070a13;
}

.legend {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Touch Controls */
#touchControls {
  display: none;
  justify-content: space-between;
  width: 100%;
  margin-top: 4px;
}

@media (pointer: coarse) {
  #touchControls {
    display: flex;
  }
}

.dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-gap: 6px;
}

.dpad-grid button {
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
}

.action-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.action-buttons button {
  width: 60px;
  height: 50px;
  font-size: 0.8rem;
  justify-content: center;
}

/* Modal Briefing & Status Dialog */
[hidden], #modal[hidden] {
  display: none !important;
}

#modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100000;
}

#modalPanel {
  background: #0f172a;
  border: 1px solid var(--accent-cyan);
  border-radius: 10px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  position: relative;
}

.close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.close:hover {
  color: #fff;
}

#modalTitle {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 8px;
}

#modalBody {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 20px;
}

.briefing-content .brief-sec {
  margin-bottom: 16px;
}

.briefing-content h3 {
  font-size: 0.95rem;
  color: var(--accent-amber);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.briefing-content ul {
  padding-left: 20px;
  margin-top: 6px;
}

.briefing-content li {
  margin-bottom: 6px;
}

#modalButtons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
