:root {
  color-scheme: dark;
  --bg: #050811;
  --panel: rgba(11, 18, 31, 0.92);
  --panel-solid: #0d1526;
  --border: #1e2d47;
  --accent: #38bdf8;
  --accent-red: #ef4444;
  --accent-green: #22c55e;
  --accent-amber: #f59e0b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
}

#app {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #0f172a 0%, #03060c 100%);
}

.viewport-wrap {
  position: relative;
  width: min(100vw, calc(100vh * (16 / 9)));
  height: min(100vh, calc(100vw * (9 / 16)));
  max-width: 1440px;
  max-height: 810px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  background: #070b14;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

/* TOP & BOTTOM TACTICAL HUD */
.hud-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(6, 10, 19, 0.92) 0%, rgba(6, 10, 19, 0.65) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 10;
  font-family: var(--mono);
}

.hud-group, .hud-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-code {
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 3px;
}

.hud-timer {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  background: #111b2e;
  padding: 4px 10px;
  border: 1px solid #2a3c58;
  border-radius: 3px;
}

.hud-roe {
  font-size: 11px;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 4px 10px;
  border-radius: 3px;
  max-width: 480px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-btn {
  background: #111c30;
  color: var(--text);
  border: 1px solid #2b3e5e;
  padding: 6px 11px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.hud-btn:hover {
  background: #1b2c4a;
  border-color: var(--accent);
}

.hud-btn-accent {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent);
  color: #e0f2fe;
}

.pill {
  background: var(--accent);
  color: #030712;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
}

/* NOTIFICATIONS */
.notifications-stack {
  position: absolute;
  top: 56px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 11;
  pointer-events: none;
  max-width: 520px;
}

.notif-item {
  font-family: var(--mono);
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 4px;
  background: rgba(9, 15, 28, 0.92);
  border-left: 4px solid var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.notif-item.contradiction {
  border-left-color: var(--accent-red);
  color: #fecaca;
  background: rgba(45, 12, 18, 0.94);
}

.notif-item.success {
  border-left-color: var(--accent-green);
  color: #bbf7d0;
}

.notif-item.warn {
  border-left-color: var(--accent-amber);
  color: #fde68a;
}

/* BOTTOM HUD */
.hud-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 16px;
  background: linear-gradient(0deg, rgba(6, 10, 19, 0.95) 0%, rgba(6, 10, 19, 0.72) 100%);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1.05fr 1.35fr 1.2fr;
  gap: 14px;
  z-index: 10;
  font-family: var(--mono);
}

.hud-panel {
  background: rgba(13, 21, 38, 0.78);
  border: 1px solid #1e2d47;
  border-radius: 4px;
  padding: 8px 11px;
}

.weapon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 11px;
}

.label {
  color: var(--muted);
  font-size: 10px;
}

.ammo-pips {
  color: var(--accent-amber);
  font-size: 14px;
  letter-spacing: 2px;
}

.mini-btn {
  background: #17253e;
  color: var(--accent);
  border: 1px solid #2b4268;
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
}

.stamina-bar {
  flex: 1;
  height: 7px;
  background: #090d16;
  border: 1px solid #293b56;
  border-radius: 4px;
  overflow: hidden;
}

.stamina-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #38bdf8);
  transition: width 0.08s linear;
}

.controls-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

.controls-hint b {
  color: #e2e8f0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.speaker-tag {
  color: var(--accent-amber);
}

.intercept-line {
  margin: 0;
  font-size: 12px;
  color: #e0f2fe;
  line-height: 1.4;
}

.obj-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
}

.obj-list li {
  color: #cbd5e1;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.obj-list li.done {
  color: var(--accent-green);
  text-decoration: line-through;
}

/* OVERLAY SCREENS */
.overlay-screen {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 17, 0.86);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 25;
}

.title-card, .modal-card {
  width: 100%;
  max-width: 1120px;
  max-height: 94%;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid #283a5a;
  border-radius: 8px;
  padding: 22px 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.title-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.agency-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.4px;
  color: var(--accent);
  margin: 0 0 4px;
  font-weight: 700;
}

.game-logo {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1.5px;
  margin: 0;
  line-height: 1.05;
}

.accent-dot {
  color: var(--accent-red);
}

.game-subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.agent-badge {
  font-family: var(--mono);
  font-size: 11px;
  background: #09101d;
  border: 1px solid #243552;
  padding: 10px 14px;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
}

.gemini-credit {
  color: var(--accent-amber);
  font-weight: 700;
}

.section-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0 12px;
}

.section-bar h2 {
  font-family: var(--mono);
  font-size: 14px;
  margin: 0;
  color: #e2e8f0;
}

.section-actions {
  display: flex;
  gap: 10px;
}

.mission-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.mission-card {
  background: #0b1322;
  border: 1px solid #22324d;
  border-radius: 6px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s, border-color 0.15s;
  cursor: pointer;
}

.mission-card:hover:not(.locked) {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.mission-card.locked {
  opacity: 0.52;
  cursor: not-allowed;
}

.mission-card .m-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
}

.mission-card h3 {
  font-size: 16px;
  margin: 5px 0 4px;
}

.mission-card .m-loc {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 10px;
}

.mission-card .m-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  border-top: 1px solid #1a273d;
  padding-top: 8px;
}

.grade-pill {
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 800;
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

.title-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.how-to-play {
  display: flex;
  gap: 18px;
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 600;
}

/* BRIEFING & DOSSIER MODALS */
.classified-banner {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.briefing-top, .debrief-top, .dossier-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.briefing-top h2, .debrief-top h2, .dossier-header h2 {
  margin: 2px 0;
  font-size: 26px;
}

.meta-line {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.weather-box {
  font-family: var(--mono);
  font-size: 12px;
  background: #09101d;
  border: 1px solid #243552;
  padding: 8px 12px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.briefing-columns, .dossier-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.briefing-col h3, .dossier-col h3 {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  margin: 0 0 8px;
}

.narrative-p, .directive-p {
  font-size: 14px;
  line-height: 1.55;
  color: #e2e8f0;
  margin: 0 0 14px;
}

.roe-callout {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.45);
  padding: 10px 12px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 12px;
  color: #fde68a;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dossier-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
}

.dossier-list li {
  background: #09101d;
  border: 1px solid #1e2d47;
  padding: 8px 11px;
  border-radius: 4px;
}

.dossier-list li.fact-item {
  border-left: 3px solid var(--accent-green);
}

.dossier-list li.suspicion-item.contradicted {
  text-decoration: line-through;
  opacity: 0.6;
  border-left: 3px solid var(--accent-red);
}

.contradiction-box {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid var(--accent-red);
  padding: 10px 12px;
  border-radius: 5px;
  margin-bottom: 10px;
  font-size: 12px;
}

.contradiction-box h4 {
  margin: 0 0 4px;
  color: #fca5a5;
  font-family: var(--mono);
}

.suspect-cards {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.suspect-card {
  background: #09101d;
  border: 1px solid #22324d;
  border-radius: 5px;
  padding: 9px 12px;
}

.suspect-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.suspect-card h4 {
  margin: 0;
  font-size: 14px;
}

.tag-buttons {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}

.tag-btn {
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 3px;
  border: 1px solid #2b3e5e;
  background: #121d31;
  color: #cbd5e1;
  cursor: pointer;
}

.tag-btn.active-target {
  background: rgba(239, 68, 68, 0.25);
  border-color: var(--accent-red);
  color: #fecaca;
}

.tag-btn.active-civilian {
  background: rgba(34, 197, 94, 0.25);
  border-color: var(--accent-green);
  color: #bbf7d0;
}

.tag-btn.active-suspect {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--accent-amber);
  color: #fde68a;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.primary-btn, .secondary-btn {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 5px;
  cursor: pointer;
}

.primary-btn {
  background: var(--accent);
  color: #030712;
  border: none;
}

.primary-btn:hover {
  background: #7dd3fc;
}

.secondary-btn {
  background: #111c30;
  color: var(--text);
  border: 1px solid #2b3e5e;
}

.secondary-btn:hover {
  border-color: var(--accent);
}

.grade-stamp {
  background: #09101d;
  border: 2px solid var(--accent);
  padding: 10px 18px;
  border-radius: 6px;
  text-align: center;
  min-width: 160px;
}

.grade-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.grade-letter {
  display: block;
  font-size: 44px;
  line-height: 1.05;
  color: var(--accent-green);
}

.grade-rank {
  font-family: var(--mono);
  font-size: 11px;
  color: #e2e8f0;
}

.debrief-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.stat-box {
  background: #09101d;
  border: 1px solid #1e2d47;
  padding: 10px 12px;
  border-radius: 5px;
  font-family: var(--mono);
}

.stat-box span {
  display: block;
  font-size: 10px;
  color: var(--muted);
}

.stat-box strong {
  font-size: 18px;
  color: var(--accent);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ach-card {
  background: #09101d;
  border: 1px solid #1e2d47;
  padding: 10px 12px;
  border-radius: 5px;
  opacity: 0.48;
}

.ach-card.unlocked {
  opacity: 1;
  border-color: var(--accent-amber);
}
