@font-face {
  font-family: 'Space Grotesk';
  src: url('./assets/fonts/space-grotesk-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('./assets/fonts/space-grotesk-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('./assets/fonts/space-grotesk-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --deep: #060914;
  --mid: #11182c;
  --dark-teal: #008B8B;
  --panel: rgba(16, 22, 44, 0.88);
  --gold: #FFDD32;
  --cyan: #7DF9FF;
  --warm-white: #f1eaff;
  --accent-red: #ff0055;
  --accent-blue: #00a8ff;
  --border: rgba(125, 249, 255, 0.25);
  --glass: rgba(125, 249, 255, 0.08);
}

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

html, body {
  width: 100%; height: 100%;
  background: var(--deep);
  color: var(--warm-white);
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

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

/* ==================== SCREENS MANAGEMENT ==================== */
.screen {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem 1rem;
}


.screen.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 10;
}

/* ==================== STAGE 1: LOADING SCREEN ==================== */
#screen-loading {
  background: var(--deep);
  justify-content: flex-end;
  padding-bottom: 7vh;
}

#bg-carousel {
  position: absolute; inset: 0;
  overflow: hidden;
  z-index: -2;
}

.bg-photo {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0;
  animation: crossfade 18s infinite;
  filter: saturate(0.85) brightness(0.45);
}
.bg-photo:nth-child(1) { background-image: url('./assets/loading/school-exterior.png'); animation-delay: 0s; }
.bg-photo:nth-child(2) { background-image: url('./assets/loading/computer-lab.png'); animation-delay: 6s; }
.bg-photo:nth-child(3) { background-image: url('./assets/loading/cubesat-gameplay.png'); animation-delay: 12s; }

@keyframes crossfade {
  0%   { opacity: 0; transform: scale(1.05); }
  4%   { opacity: 1; }
  28%  { opacity: 1; transform: scale(1.12); }
  33%  { opacity: 0; }
  100% { opacity: 0; }
}

#scrim {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(10,14,31,0.2) 0%, rgba(10,14,31,0.75) 80%),
    linear-gradient(to top, rgba(10,14,31,0.95) 0%, rgba(10,14,31,0.35) 45%, rgba(10,14,31,0.55) 100%);
  z-index: -1;
}

#loading-content {
  position: relative; z-index: 5;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  width: 90%; max-width: 600px;
}

.eyebrow {
  text-transform: uppercase; letter-spacing: 0.22em; font-size: 0.8rem;
  color: var(--gold); font-weight: 600; margin-bottom: 0.5rem;
  text-shadow: 0 0 12px rgba(255, 221, 50,0.4);
}

.wordmark {
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 700; line-height: 0.95; letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
.wordmark span { color: var(--gold); }

.tagline {
  font-size: 1.1rem; color: rgba(241,234,255,0.75);
  max-width: 440px; margin-bottom: 2.5rem;
}

#loading-wrap { width: 320px; max-width: 80vw; margin-bottom: 2rem; }
#loading-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.15em; color: rgba(241,234,255,0.5); margin-bottom: 0.6rem; }
#loading-track { width: 100%; height: 4px; background: rgba(255,255,255,0.12); border-radius: 2px; overflow: hidden; }
#loading-fill { width: 0%; height: 100%; background: var(--gold); box-shadow: 0 0 10px var(--gold); transition: width 0.2s linear; }

.glow-btn {
  padding: 1rem 2.5rem; font-size: 1.05rem; font-weight: 700; letter-spacing: 0.08em;
  color: var(--deep); background: var(--gold);
  border: none; border-radius: 99px; cursor: pointer;
  box-shadow: 0 0 24px rgba(255, 221, 50,0.45);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0; transform: translateY(10px); pointer-events: none;
}
.glow-btn.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.glow-btn:hover { transform: translateY(-3px); box-shadow: 0 0 34px rgba(255, 221, 50,0.7); background: #ffe099; }
.glow-btn:active { transform: translateY(-1px); }

/* ==================== STAGE 2: ROLE SELECTION ==================== */
#screen-role-select {
  background: radial-gradient(circle at center, #182247 0%, var(--deep) 80%);
  padding: 2rem;
}

.screen-header { text-align: center; margin-bottom: 2.5rem; max-width: 600px; }
.screen-header h2 { font-size: 2.4rem; color: var(--gold); margin-bottom: 0.5rem; }
.screen-header p { color: rgba(241,234,255,0.7); font-size: 1rem; line-height: 1.5; }

.role-cards {
  display: flex; gap: 1.8rem;
  max-width: 1100px; width: 100%;
  justify-content: center; flex-wrap: wrap;
}

.role-card {
  flex: 1; min-width: 290px; max-width: 340px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 2rem 1.6rem;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  backdrop-filter: blur(12px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.role-card:hover {
  transform: translateY(-8px);
  border-color: var(--gold);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 16px 36px rgba(0,0,0,0.4), 0 0 20px rgba(255, 221, 50,0.15);
}

.role-icon { font-size: 3.5rem; margin-bottom: 1rem; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4)); }
.role-card h3 { font-size: 1.4rem; margin-bottom: 0.8rem; color: #fff; }
.role-desc { font-size: 0.92rem; color: rgba(241,234,255,0.7); margin-bottom: 1.5rem; min-height: 54px; line-height: 1.5; }

.role-perks {
  list-style: none; text-align: left; width: 100%; margin-bottom: 2rem;
  font-size: 0.88rem; color: #d1cae5;
}
.role-perks li { padding: 0.4rem 0; border-bottom: 1px dashed rgba(255,255,255,0.1); }
.role-perks li:last-child { border-bottom: none; }

.select-role-btn {
  width: 100%; padding: 0.85rem; border-radius: 12px; border: none;
  background: rgba(255,255,255,0.12); color: #fff;
  font-weight: 600; font-size: 0.95rem; cursor: pointer;
  transition: all 0.2s;
  margin-top: auto;
}
.role-card:hover .select-role-btn {
  background: var(--gold); color: var(--deep); font-weight: 700;
  box-shadow: 0 0 15px rgba(255, 221, 50,0.4);
}

/* ==================== STAGE 1.5: MODE SELECTION ==================== */
#screen-mode-select {
  background: radial-gradient(circle at center, #182247 0%, var(--deep) 80%);
  padding: 2rem;
  overflow-y: auto;
}
.mode-card {
  max-width: 380px !important; min-width: 310px !important;
}

/* ==================== STAGE 3: QUESTIONNAIRE ==================== */
#screen-questionnaire {
  background: radial-gradient(circle at center, #1f183d 0%, var(--deep) 80%);
  padding: 2rem;
}

.quiz-container {
  width: 100%; max-width: 680px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px; padding: 2.5rem;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.quiz-header { text-align: center; margin-bottom: 2rem; }
.quiz-header h2 { font-size: 1.8rem; color: var(--gold); margin-bottom: 1rem; }

.progress-bar-wrap {
  width: 100%; height: 6px; background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden; margin-bottom: 0.6rem;
}
#quiz-progress-fill { width: 10%; height: 100%; background: var(--cyan); transition: width 0.3s ease; }
#quiz-progress-text { font-size: 0.8rem; color: rgba(241,234,255,0.6); text-transform: uppercase; letter-spacing: 0.1em; }

#question-title { font-size: 1.3rem; margin-bottom: 1.8rem; line-height: 1.4; color: #fff; text-align: center; min-height: 58px; }

.options-grid {
  display: flex; flex-direction: column; gap: 0.9rem;
}

.quiz-option-btn {
  width: 100%; padding: 1.1rem 1.4rem; border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff; font-size: 1.05rem; font-family: inherit;
  text-align: left; cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; align-items: center; justify-content: space-between;
}
.quiz-option-btn:hover {
  background: rgba(255, 221, 50,0.15);
  border-color: var(--gold);
  transform: translateX(6px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.quiz-option-btn::after { content: '→'; opacity: 0; transition: opacity 0.2s, transform 0.2s; }
.quiz-option-btn:hover::after { opacity: 1; transform: translateX(4px); }

/* ==================== STAGE 4: CHARACTER REVEAL ==================== */
#screen-reveal {
  background: radial-gradient(circle at top, #2d1e50 0%, var(--deep) 75%);
  padding: 1.5rem 1rem;
  overflow-y: auto;
}

.reveal-card {
  width: 100%; max-width: 540px;
  background: rgba(20, 27, 51, 0.95);
  border: 2px solid var(--gold);
  border-radius: 24px; padding: 1.5rem 1.8rem;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: 0 25px 60px rgba(0,0,0,0.6), 0 0 35px rgba(255, 221, 50,0.2);
  animation: popIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  margin: auto 0;
}

@keyframes popIn {
  0% { transform: scale(0.88); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.reveal-badge {
  display: inline-block; padding: 0.25rem 0.8rem;
  background: rgba(255, 221, 50,0.2); color: var(--gold);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.15em;
  border-radius: 99px; margin-bottom: 0.6rem;
}

.reveal-emoji-large { font-size: 3.2rem; margin-bottom: 0.2rem; filter: drop-shadow(0 10px 20px rgba(0,0,0,0.4)); }
#reveal-name { font-size: 2rem; color: #fff; margin-bottom: 0.2rem; }
.role-tag { font-size: 0.9rem; color: var(--cyan); font-weight: 600; margin-bottom: 0.6rem; }
.reveal-desc { font-size: 0.88rem; color: rgba(241,234,255,0.8); line-height: 1.4; margin-bottom: 1.2rem; }

.reveal-stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem;
  margin-bottom: 1.2rem; text-align: left;
}
.stat-box {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  padding: 0.6rem 0.8rem; border-radius: 10px;
}
.stat-label { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(241,234,255,0.5); margin-bottom: 0.1rem; }
.stat-box strong { font-size: 0.85rem; color: var(--gold); }

.catchphrase-quote {
  font-size: 0.95rem; font-style: italic; color: #fff;
  padding: 0.7rem 1rem; background: rgba(127, 167, 201, 0.12);
  border-left: 4px solid var(--cyan); border-radius: 8px;
  margin-bottom: 1.4rem;
}

#start-gameplay-btn {
  width: 100%;
  padding: 1.1rem 1.5rem;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #000;
  background: linear-gradient(135deg, #FFDD32, #ff9f1c);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(255, 221, 50, 0.8), 0 5px 15px rgba(0,0,0,0.3);
  transition: all 0.25s ease;
  text-transform: uppercase;
  animation: pulseGlow 2s infinite;
  opacity: 1 !important;
  pointer-events: auto !important;
  display: block !important;
  transform: none !important;
  margin-top: 1rem;
}
#start-gameplay-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 0 35px rgba(255, 221, 50, 0.9), 0 8px 20px rgba(0,0,0,0.4);
  background: linear-gradient(135deg, #ffe099, #ffb703);
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 221, 50, 0.5); }
  50% { box-shadow: 0 0 35px rgba(255, 221, 50, 0.9); }
}

/* ==================== STAGE 1.8: FREE STYLE HUB ==================== */
#screen-freestyle-hub {
  background: radial-gradient(circle at center, #111a38 0%, var(--deep) 85%);
  padding: 2rem;
  overflow-y: auto;
}
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.8rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto 3rem auto;
}
.hub-tile {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  backdrop-filter: blur(12px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.hub-tile:hover {
  transform: translateY(-6px);
  border-color: var(--gold);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 16px 36px rgba(0,0,0,0.5), 0 0 20px rgba(255, 221, 50,0.2);
}
.hub-tile-icon {
  font-size: 3.2rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}
.hub-tile h3 {
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 0.6rem;
}
.hub-tile p {
  font-size: 0.9rem;
  color: rgba(241,234,255,0.7);
  margin-bottom: 1.2rem;
  flex: 1;
  line-height: 1.5;
}
.hub-score-badge {
  background: rgba(125, 249, 255, 0.12);
  border: 1px solid var(--cyan);
  color: var(--gold);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ==================== STAGE 5: RPG GAMEPLAY ==================== */
#screen-gameplay {
  background: #000;
  display: flex; flex-direction: column;
}

#game-hud {
  height: 64px; width: 100%;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; z-index: 20;
}

.hud-left, .hud-center, .hud-right { display: flex; align-items: center; gap: 1.2rem; }
.hud-logo { font-weight: 700; letter-spacing: 0.15em; color: var(--gold); font-size: 1.1rem; }

.hud-player-info {
  display: flex; align-items: center; gap: 0.6rem;
  background: rgba(255,255,255,0.08); padding: 0.35rem 0.8rem; border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.12);
}
#hud-avatar { font-size: 1.4rem; }
.hud-player-info strong { display: block; font-size: 0.9rem; line-height: 1.1; color: #fff; }
.hud-player-info small { font-size: 0.72rem; color: var(--cyan); }

.hud-center label { font-size: 0.88rem; color: rgba(241,234,255,0.7); }
#campus-zone-select {
  padding: 0.5rem 1rem; border-radius: 8px; border: 1px solid var(--border);
  background: #1c2545; color: #fff; font-family: inherit; font-size: 0.9rem;
  cursor: pointer;
}

.hud-stat {
  background: rgba(0,0,0,0.3); padding: 0.4rem 0.8rem; border-radius: 8px;
  font-size: 0.88rem; border: 1px solid rgba(255,255,255,0.08);
}
.hud-stat strong { color: var(--gold); margin-left: 4px; }
.icon-btn { background: none; border: none; font-size: 1.3rem; cursor: pointer; padding: 4px; transition: transform 0.2s; }
.icon-btn:hover { transform: scale(1.15); }

#rpg-viewport-wrap {
  flex: 1; width: 100%; position: relative; overflow: hidden;
}
#rpg-viewport { width: 100%; height: 100%; }
#rpg-viewport canvas { display: block; width: 100%; height: 100%; }

#scavenger-hud-banner {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(16, 20, 45, 0.95); border: 2px solid #ff007f;
  padding: 0.8rem 1.6rem; border-radius: 99px;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 25px rgba(255,0,127,0.4);
  backdrop-filter: blur(12px); z-index: 20;
  animation: scavPulse 2s infinite;
}
@keyframes scavPulse {
  0%, 100% { box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 25px rgba(255,0,127,0.4); border-color: #ff007f; }
  50% { box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 35px rgba(125, 249, 255,0.6); border-color: #7DF9FF; }
}

/* AI Bot Emergency Search Timer HUD */
#ai-bot-timer-hud {
  position: absolute; top: 76px; left: 50%; transform: translateX(-50%);
  background: rgba(16, 22, 44, 0.96); border: 2px solid var(--cyan);
  padding: 0.7rem 1.5rem; border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 25px rgba(125, 249, 255,0.4);
  backdrop-filter: blur(12px); z-index: 25;
  width: 90%; max-width: 650px;
}
#ai-bot-timer-hud.hidden { display: none !important; }
.ai-timer-content {
  display: flex; align-items: center; gap: 12px; width: 100%;
}
.ai-timer-icon { font-size: 1.4rem; animation: pulse 1.2s infinite alternate; }
.ai-timer-label { font-size: 0.8rem; font-weight: 700; color: var(--cyan); letter-spacing: 0.05em; white-space: nowrap; }
.ai-timer-bar-wrap { flex: 1; height: 10px; background: rgba(0,0,0,0.6); border-radius: 6px; overflow: hidden; border: 1px solid rgba(125, 249, 255,0.3); }
#ai-timer-bar-fill { width: 100%; height: 100%; background: linear-gradient(90deg, #00ff88, var(--cyan)); transition: width 0.3s linear; }
#ai-timer-seconds { font-family: 'JetBrains Mono', monospace; font-size: 1rem; font-weight: 800; color: var(--gold); min-width: 45px; text-align: right; }
@keyframes pulse { 0% { transform: scale(1); } 100% { transform: scale(1.15); } }

.scav-icon { font-size: 1.6rem; animation: bounce 1s infinite; }
.scav-text { display: flex; flex-direction: column; font-size: 0.85rem; }
.scav-text strong { font-family: 'Orbitron', sans-serif; color: #FFDD32; letter-spacing: 0.5px; font-size: 0.95rem; }
#scav-desc { color: #e1e7fa; font-size: 0.8rem; }
.scav-counter-badge {
  background: rgba(125, 249, 255, 0.2); border: 1px solid #7DF9FF;
  color: #7DF9FF; font-weight: 700; font-family: 'Orbitron', sans-serif;
  padding: 0.4rem 0.8rem; border-radius: 99px; font-size: 0.9rem;
  text-shadow: 0 0 8px rgba(125, 249, 255,0.6); white-space: nowrap;
}

#controls-hint {
  position: absolute; top: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(10, 14, 31, 0.85); border: 1px solid var(--border);
  padding: 0.6rem 1.2rem; border-radius: 99px; font-size: 0.85rem;
  pointer-events: none; backdrop-filter: blur(8px);
}
#controls-hint strong { color: var(--gold); }

#interact-prompt {
  position: absolute; bottom: 180px; left: 50%; transform: translateX(-50%);
  background: rgba(20, 27, 51, 0.95); border: 2px solid var(--gold);
  padding: 0.7rem 1.4rem; border-radius: 99px;
  display: flex; align-items: center; gap: 0.8rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5), 0 0 20px rgba(255, 221, 50,0.3);
  animation: pulse 1.5s infinite; cursor: pointer; z-index: 15;
}
@keyframes pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.05); }
}
.key-badge {
  background: var(--gold); color: var(--deep); font-weight: 700;
  padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.9rem;
}
#interact-target-name { font-weight: 600; font-size: 1rem; color: #fff; }

/* Toast Notification */
.toast {
  position: absolute; top: 24px; right: 24px;
  background: rgba(20, 27, 51, 0.96); border-left: 4px solid var(--gold);
  padding: 1rem 1.4rem; border-radius: 12px;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 15px 35px rgba(0,0,0,0.5); z-index: 30;
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideIn {
  0% { transform: translateX(120%); }
  100% { transform: translateX(0); }
}
.toast-icon { font-size: 1.8rem; }
.toast-text strong { display: block; color: var(--gold); font-size: 0.95rem; }
.toast-text p { font-size: 0.85rem; color: #fff; margin-top: 2px; }

/* ==================== 2D RPG DIALOGUE BOX ==================== */
#dialogue-box {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  width: 92%; max-width: 960px; min-height: 150px;
  background: rgba(10, 14, 31, 0.94);
  border: 2px solid rgba(255,255,255,0.2); border-radius: 20px;
  padding: 1.4rem 1.8rem; display: flex; gap: 1.6rem;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.7), 0 0 30px rgba(127,167,201,0.15);
  z-index: 25;
}

.dialogue-portrait-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 100px; border-right: 1px solid var(--border); padding-right: 1.2rem;
}
.dialogue-avatar { font-size: 3.5rem; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); }
#dialogue-name { font-weight: 700; font-size: 0.9rem; color: var(--gold); margin-top: 0.4rem; text-align: center; }

.dialogue-content-wrap { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.dialogue-text { font-size: 1.08rem; color: #fff; line-height: 1.5; margin-bottom: 1.2rem; }

.dialogue-choices { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.dialogue-btn {
  padding: 0.65rem 1.2rem; border-radius: 10px; border: 1px solid var(--cyan);
  background: rgba(125, 249, 255, 0.15); color: #fff; font-family: inherit; font-size: 0.92rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.dialogue-btn:hover { background: var(--cyan); color: var(--deep); box-shadow: 0 0 20px rgba(125, 249, 255, 0.7); transform: translateY(-2px); }
.dialogue-btn.minigame-trigger-btn { border-color: var(--gold); background: rgba(255, 221, 50, 0.18); color: var(--gold); }
.dialogue-btn.minigame-trigger-btn:hover { background: var(--gold); color: var(--deep); box-shadow: 0 0 20px rgba(255, 221, 50, 0.8); transform: translateY(-2px); }

.dialogue-close {
  position: absolute; top: 14px; right: 16px; background: none; border: none;
  color: rgba(255,255,255,0.4); font-size: 1.2rem; cursor: pointer; transition: color 0.2s;
}
.dialogue-close:hover { color: #fff; }

/* ==================== MODALS ==================== */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; backdrop-filter: blur(10px); padding: 20px;
}
.modal-content {
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  width: 95vw; height: 90vh; max-width: 1300px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 25px 60px rgba(0,0,0,0.8);
}
.small-modal { width: 500px; height: auto; max-height: 80vh; }

.modal-header {
  padding: 1rem 1.6rem; background: rgba(0,0,0,0.3); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title-wrap { display: flex; align-items: center; gap: 0.8rem; }
#modal-icon { font-size: 1.5rem; }
.modal-header h3 { font-size: 1.2rem; color: #fff; }

.modal-close {
  padding: 0.5rem 1rem; border-radius: 8px; border: 1px solid var(--accent-red);
  background: rgba(217,119,106,0.15); color: var(--accent-red);
  font-family: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.modal-close:hover { background: var(--accent-red); color: #fff; }

.modal-body { flex: 1; position: relative; overflow: hidden; background: #0c1024; }
.pad-body { padding: 2rem; overflow-y: auto; line-height: 1.6; }
.pad-body ul { margin-left: 1.5rem; margin-top: 0.5rem; }
.pad-body li { margin-bottom: 0.6rem; }
.pad-body code { background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; font-family: monospace; color: var(--gold); }

#minigame-iframe { width: 100%; height: 100%; border: none; display: block; }

#builtin-minigame-wrap { padding: 3rem 2rem; text-align: center; max-width: 700px; margin: 0 auto; }
.builtin-header h4 { font-size: 1.6rem; color: var(--gold); margin-bottom: 0.6rem; }
.builtin-header p { color: rgba(241,234,255,0.7); margin-bottom: 2.5rem; }

#circuit-puzzle-box { background: rgba(255,255,255,0.04); border: 1px solid var(--border); padding: 2rem; border-radius: 16px; text-align: left; }
.quiz-q { font-size: 1.15rem; color: #fff; font-weight: 600; margin-bottom: 1.5rem; line-height: 1.5; }
.circuit-options { display: flex; flex-direction: column; gap: 0.8rem; }
.circuit-btn {
  padding: 1rem 1.2rem; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(255,255,255,0.06); color: #fff; font-family: inherit; font-size: 0.95rem;
  text-align: left; cursor: pointer; transition: all 0.2s;
}
.circuit-btn:hover { background: rgba(255,255,255,0.12); border-color: var(--cyan); }
.circuit-btn.correct { background: rgba(143,185,150,0.3); border-color: #8fb996; color: #fff; }
.circuit-btn.wrong { background: rgba(217,119,106,0.3); border-color: #d9776a; }

.modal-footer {
  padding: 0.8rem 1.6rem; background: rgba(0,0,0,0.4); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-hint { font-size: 0.88rem; color: rgba(241,234,255,0.7); }
.small-btn { padding: 0.6rem 1.4rem; font-size: 0.9rem; }

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }

/* ==================== HUD ZONE NAVIGATION & FINALE STYLES ==================== */
.hud-nav-label { font-size: 0.8rem; color: var(--gold); font-weight: 700; text-transform: uppercase; margin-right: 0.6rem; }
.hud-nav-buttons { display: flex; gap: 0.5rem; }
.zone-btn {
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem; font-weight: 600;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  color: #fff;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.zone-btn:hover {
  background: rgba(255, 221, 50, 0.2);
  border-color: var(--gold);
  transform: translateY(-2px);
}
.zone-btn.active {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
  font-weight: 800;
  box-shadow: 0 0 15px rgba(255, 221, 50, 0.5);
}

.finale-btn {
  background: linear-gradient(135deg, #FFDD32, #ff9f1c) !important;
  color: #000 !important;
  font-weight: 800 !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  display: inline-block !important;
  transform: none !important;
  margin-right: 1rem;
  box-shadow: 0 0 15px rgba(255, 221, 50, 0.6);
  animation: pulseGlow 2s infinite;
}

.finale-content { max-width: 750px !important; background: radial-gradient(circle at top, #2d1e50 0%, #0c1024 85%) !important; border: 2px solid var(--gold) !important; }
.finale-header h3 { color: var(--gold); font-size: 1.4rem; letter-spacing: 0.05em; }
.finale-emojis { font-size: 3rem; margin-bottom: 0.8rem; }
.gold-text { color: var(--gold); }
.finale-desc { font-size: 1.05rem; color: rgba(241, 234, 255, 0.85); line-height: 1.6; margin-bottom: 1.8rem; max-width: 620px; margin-left: auto; margin-right: auto; }

.finale-stats-card {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 221, 50, 0.3);
  border-radius: 16px; padding: 1.4rem; margin-bottom: 1.8rem; text-align: left;
}
.f-stat { font-size: 0.95rem; display: flex; justify-content: space-between; align-items: center; }
.f-stat span { color: rgba(241, 234, 255, 0.6); }
.f-stat strong { font-size: 1.05rem; }

.faculty-commendation {
  background: rgba(127, 167, 201, 0.12); border-left: 4px solid var(--cyan);
  padding: 1rem 1.4rem; border-radius: 8px; text-align: left; margin-bottom: 2rem;
}
.faculty-commendation p { font-size: 0.85rem; color: var(--cyan); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.4rem; }
.faculty-commendation blockquote { font-style: italic; color: #fff; font-size: 0.95rem; line-height: 1.5; }

.finale-actions { display: flex; justify-content: center; gap: 1rem; }
.sec-btn { background: rgba(255, 255, 255, 0.1) !important; color: #fff !important; border: 1px solid rgba(255,255,255,0.3) !important; opacity: 1 !important; pointer-events: auto !important; transform: none !important; }
.sec-btn:hover { background: rgba(255, 255, 255, 0.2) !important; }

/* ==================== CELESTECON AI NARRATOR WIDGET ==================== */
.narrator-widget {
  position: absolute;
  bottom: 25px;
  right: 25px;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  gap: 15px;
  pointer-events: auto;
}
.narrator-avatar-box {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 221, 50, 0.25) 0%, rgba(12, 16, 36, 0.95) 80%);
  border: 3px solid var(--gold);
  box-shadow: 0 0 20px rgba(255, 221, 50, 0.5);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: visible;
}
.narrator-avatar-box:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 0 30px rgba(255, 221, 50, 0.8);
}
#narrator-avatar-img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
}
.narrator-badge {
  position: absolute;
  bottom: -6px;
  background: var(--gold);
  color: #0c1024;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.08em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.narrator-bubble {
  background: rgba(18, 24, 48, 0.95);
  border: 1px solid rgba(255, 221, 50, 0.4);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  width: 320px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  animation: floatUp 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.narrator-bubble.hidden {
  display: none;
}
.narrator-bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 0.4rem;
}
.narrator-title {
  font-weight: 700;
  color: var(--gold);
  font-size: 0.85rem;
}
.narrator-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 1rem;
}
.narrator-close-btn:hover {
  color: #fff;
}
.narrator-body p {
  font-size: 0.88rem;
  line-height: 1.45;
  color: #f1eaff;
  margin-bottom: 0.8rem;
}
.narrator-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.n-topic-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}
.n-topic-btn:hover {
  background: var(--gold);
  color: #0c1024;
  border-color: var(--gold);
}

/* ==================== JUDGE & ORGANIZER CONSOLE MODALS ==================== */
.judge-content, .organizer-content {
  max-width: 650px;
  border: 2px solid var(--gold);
  background: linear-gradient(145deg, #0f172a, #1e1b4b);
}
.dispute-box, .crisis-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: left;
}
.dispute-event-tag, .crisis-level-tag {
  display: inline-block;
  background: rgba(255, 221, 50, 0.15);
  color: var(--gold);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}
.crisis-level-tag {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}
.modal-desc-text {
  color: #e2e8f0;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}
.verdict-options, .crisis-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.verdict-btn, .crisis-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.verdict-btn:hover, .crisis-btn:hover {
  background: rgba(255, 221, 50, 0.15);
  border-color: var(--gold);
  transform: translateX(4px);
}
.crisis-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #818cf8;
}

/* ==================== CLASSIC GAME PRESENTATION ====================
   Exploration uses a compact command HUD and direct input.  These rules
   intentionally override the older web-card language without touching the
   underlying game flow. */
:root {
  --hud-black: #050811;
  --hud-surface: #0b1220;
  --hud-surface-raised: #121d30;
  --hud-frame: #314765;
  --hud-muted: #9bb0c9;
  --hud-cyan: #48d7ff;
  --hud-gold: #f4c85b;
}

button:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--hud-gold);
  outline-offset: 2px;
}

/* Keep the 3D world dominant and make the HUD read as a game command bar. */
#screen-gameplay {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
}

#game-hud {
  position: relative;
  z-index: 60;
  flex: 0 0 auto;
  width: 100%;
  min-height: 76px;
  height: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  overflow: visible;
  background:
    linear-gradient(90deg, rgba(72, 215, 255, 0.08), transparent 24%),
    var(--hud-black);
  border-top: 1px solid #18253a;
  border-bottom: 2px solid var(--hud-frame);
  box-shadow: inset 0 -1px 0 #02040a, 0 4px 14px rgba(0, 0, 0, 0.42);
}

.hud-left,
.hud-right {
  display: flex;
  align-items: center;
  min-width: 0;
}

.hud-left {
  gap: 10px;
}

.hud-right {
  justify-content: flex-end;
  gap: 5px;
}

.hud-logo {
  color: var(--hud-gold);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  white-space: nowrap;
  text-shadow: none;
}

.hud-menu-btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid var(--hud-frame);
  border-radius: 0;
  background: #0d1727;
  color: #e7f0fb;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.42);
  transition: background-color 90ms linear, border-color 90ms linear, color 90ms linear;
}

.hud-menu-btn {
  padding: 0 10px;
}

.icon-btn {
  width: 34px;
  padding: 0;
  font-size: 0.95rem;
}

.hud-menu-btn:hover,
.hud-menu-btn:focus-visible,
.icon-btn:hover,
.icon-btn:focus-visible {
  border-color: var(--hud-cyan);
  background: #152740;
  color: #fff;
  transform: none;
}

.hud-menu-btn:active,
.icon-btn:active,
.zone-btn:active,
.dialogue-btn:active,
.n-topic-btn:active,
.modal-close:active {
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.52);
  transform: translateY(1px);
}

.hud-zone-readout,
.hud-objective {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding-left: 10px;
  border-left: 1px solid #26374f;
}

.hud-zone-readout {
  min-width: 150px;
}

.hud-objective {
  max-width: 310px;
}

.hud-kicker {
  color: var(--hud-muted);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.hud-zone-readout strong,
.hud-objective strong {
  overflow: hidden;
  color: #f2f7fd;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.hud-objective strong {
  color: #b9d7ed;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.hud-player-info {
  gap: 7px;
  padding: 0 10px 0 0;
  border: 0;
  border-radius: 0;
  border-right: 1px solid #26374f;
  background: transparent;
}

#hud-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--hud-frame);
  background: #111e31;
  font-size: 1rem;
}

.hud-player-info strong {
  color: #fff;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.hud-player-info small {
  display: block;
  color: var(--hud-cyan);
  font-size: 0.57rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hud-stat {
  display: flex;
  min-width: 55px;
  min-height: 42px;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 4px 7px;
  border: 1px solid #26374f;
  border-radius: 0;
  background: var(--hud-surface);
  color: var(--hud-muted);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.15;
  text-transform: uppercase;
}

.hud-stat strong {
  margin: 0;
  color: #fff;
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-shadow: none !important;
}

.hud-center {
  position: absolute;
  top: calc(100% + 8px);
  left: 14px;
  z-index: 70;
  display: none;
  width: min(530px, calc(100vw - 28px));
  padding: 12px;
  border: 1px solid var(--hud-frame);
  border-left: 3px solid var(--hud-cyan);
  border-radius: 0;
  background: #080f1b;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.32);
}

#game-hud.menu-open .hud-center {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.hud-nav-label {
  margin: 0;
  color: var(--hud-muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hud-nav-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.zone-btn {
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid #2b405d;
  border-radius: 0;
  background: #101b2c;
  color: #dceafa;
  font: inherit;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  line-height: 1.2;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.36);
  transition: background-color 90ms linear, border-color 90ms linear, color 90ms linear;
}

.zone-btn:hover,
.zone-btn:focus-visible {
  border-color: var(--hud-cyan);
  background: #19304d;
  color: #fff;
  transform: none;
}

.zone-btn.active {
  border-color: var(--hud-cyan);
  background: var(--hud-cyan);
  color: #03101a;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
  font-weight: 800;
}

.finale-btn {
  min-height: 42px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid #e7ad35 !important;
  border-radius: 0 !important;
  background: #e7ad35 !important;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.24) !important;
  color: #12100a !important;
  font-size: 0.67rem;
  letter-spacing: 0.07em;
  animation: none !important;
}

#rpg-viewport-wrap {
  min-height: 0;
  border: 8px solid #03050a;
  border-top: 0;
  background: #03050a;
}

#controls-hint {
  top: auto;
  bottom: 18px;
  left: 18px;
  z-index: 14;
  max-width: calc(100% - 36px);
  padding: 7px 10px;
  border: 1px solid #30435f;
  border-radius: 0;
  background: rgba(5, 10, 19, 0.9);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.28);
  color: #b8ccdf;
  font-size: 0.67rem;
  letter-spacing: 0.035em;
  transform: none;
  transition: opacity 120ms linear, transform 120ms linear;
  backdrop-filter: none;
}

#controls-hint strong {
  color: var(--hud-gold);
}

#controls-hint.is-dismissed {
  opacity: 0;
  transform: translateY(4px);
}

#interact-prompt {
  bottom: 34px;
  z-index: 18;
  max-width: min(560px, calc(100% - 36px));
  min-height: 42px;
  padding: 7px 12px;
  border: 1px solid var(--hud-gold);
  border-radius: 0;
  background: rgba(5, 10, 19, 0.96);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.34);
  cursor: default;
  pointer-events: none;
  animation: none;
}

.key-badge {
  min-width: 25px;
  padding: 3px 6px;
  border: 1px solid #fff0b5;
  border-radius: 0;
  background: var(--hud-gold);
  color: #161005;
  font-size: 0.75rem;
  text-align: center;
}

#interact-target-name {
  overflow: hidden;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#scavenger-hud-banner,
#ai-bot-timer-hud {
  border-radius: 0;
  background: rgba(7, 13, 24, 0.97);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.34);
  backdrop-filter: none;
  animation: none;
}

#scavenger-hud-banner {
  top: 14px;
  border: 1px solid #ff5b93;
}

#ai-bot-timer-hud {
  top: 90px;
  border: 1px solid var(--hud-cyan);
}

.ai-timer-icon,
.scav-icon {
  animation: none;
}

.ai-timer-bar-wrap {
  border-radius: 0;
  border-color: #28415e;
}

#ai-timer-bar-fill {
  background: var(--hud-cyan);
  transition: width 120ms linear;
}

.scav-counter-badge {
  border-radius: 0;
  background: #112a3a;
  text-shadow: none;
}

.toast {
  top: 16px;
  right: 16px;
  border: 1px solid #3e5877;
  border-left: 3px solid var(--hud-gold);
  border-radius: 0;
  background: #0a1220;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.36);
  animation: none;
}

/* Dialogue reads as a field transmission, with number-key choices. */
#dialogue-box {
  bottom: 16px;
  width: min(980px, calc(100% - 32px));
  min-height: 152px;
  padding: 15px 48px 15px 15px;
  gap: 15px;
  border: 1px solid #4b6383;
  border-left: 4px solid var(--hud-cyan);
  border-radius: 0;
  background: #08111f;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.4);
  backdrop-filter: none;
}

.dialogue-portrait-wrap {
  min-width: 88px;
  padding-right: 12px;
  border-right: 1px solid #344b68;
}

.dialogue-avatar {
  font-size: 2.8rem;
  filter: none;
}

#dialogue-name {
  color: var(--hud-gold);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dialogue-content-wrap::before {
  content: 'COMMS CHANNEL // RESPONSE REQUIRED';
  display: block;
  margin-bottom: 6px;
  color: var(--hud-muted);
  font-size: 0.57rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.dialogue-text {
  margin-bottom: 12px;
  color: #edf5fd;
  font-size: 0.95rem;
  line-height: 1.45;
}

.dialogue-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.dialogue-btn {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid #365273;
  border-radius: 0;
  background: #101c2d;
  color: #eaf4fd;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  transition: background-color 90ms linear, border-color 90ms linear, color 90ms linear;
}

.dialogue-btn::before {
  content: '[' attr(data-shortcut) ']';
  color: var(--hud-gold);
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.dialogue-btn:hover,
.dialogue-btn:focus-visible {
  border-color: var(--hud-cyan);
  background: #1b3653;
  box-shadow: none;
  color: #fff;
  transform: none;
}

.dialogue-btn.minigame-trigger-btn {
  border-color: #b9892a;
  background: #2d2414;
  color: #fff2c4;
}

.dialogue-btn.minigame-trigger-btn:hover,
.dialogue-btn.minigame-trigger-btn:focus-visible {
  border-color: var(--hud-gold);
  background: #473716;
  box-shadow: none;
  color: #fff;
  transform: none;
}

.dialogue-close {
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #365273;
  border-radius: 0;
  background: #101c2d;
  color: #b9cfe3;
  font-size: 0.85rem;
  transition: background-color 90ms linear, border-color 90ms linear, color 90ms linear;
}

.dialogue-close:hover,
.dialogue-close:focus-visible {
  border-color: #f07278;
  background: #3b1b24;
  color: #fff;
}

/* The guide remains a small comms indicator until the player asks for it. */
.narrator-widget {
  right: 18px;
  bottom: 18px;
  z-index: 50;
  gap: 10px;
}

.narrator-avatar-box {
  order: 2;
  width: 58px;
  height: 58px;
  padding: 0;
  overflow: visible;
  border: 2px solid var(--hud-gold);
  border-radius: 0;
  background: #101b2c;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: border-color 90ms linear, background-color 90ms linear;
}

.narrator-avatar-box:hover,
.narrator-avatar-box:focus-visible {
  border-color: #fff0af;
  background: #1b2a3f;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
  transform: none;
}

#narrator-avatar-img {
  width: 46px;
  height: 46px;
  border-radius: 0;
}

.narrator-badge {
  right: -6px;
  bottom: -8px;
  border: 1px solid #fff0af;
  border-radius: 0;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.36);
}

.narrator-bubble {
  order: 1;
  width: min(350px, calc(100vw - 104px));
  padding: 12px;
  border: 1px solid #4b6383;
  border-right: 3px solid var(--hud-gold);
  border-radius: 0;
  background: #091321;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.36);
  backdrop-filter: none;
  animation: none;
}

.narrator-bubble-header {
  padding-bottom: 6px;
  border-bottom-color: #344b68;
}

.narrator-title {
  color: var(--hud-gold);
  font-size: 0.69rem;
  letter-spacing: 0.05em;
}

.narrator-close-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #365273;
  border-radius: 0;
  background: #101c2d;
  color: #b9cfe3;
}

.narrator-close-btn:hover,
.narrator-close-btn:focus-visible {
  border-color: #f07278;
  background: #3b1b24;
  color: #fff;
}

.narrator-body p {
  color: #d8e6f1;
  font-size: 0.78rem;
}

.n-topic-btn {
  border: 1px solid #365273;
  border-radius: 0;
  background: #101c2d;
  color: #dbeafa;
  font-size: 0.68rem;
  transition: background-color 90ms linear, border-color 90ms linear, color 90ms linear;
}

.n-topic-btn:hover,
.n-topic-btn:focus-visible {
  border-color: var(--hud-gold);
  background: #3a2f18;
  color: #fff7d7;
}

/* Supporting screens share the same physical, no-bounce control language. */
.glow-btn,
#start-gameplay-btn,
.select-role-btn,
.quiz-option-btn,
.modal-close,
.circuit-btn,
.verdict-btn,
.crisis-btn {
  border-radius: 0;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3);
  transition: background-color 90ms linear, border-color 90ms linear, color 90ms linear;
}

.glow-btn:hover,
#start-gameplay-btn:hover,
.select-role-btn:hover,
.quiz-option-btn:hover,
.modal-close:hover,
.circuit-btn:hover,
.verdict-btn:hover,
.crisis-btn:hover {
  transform: none;
}

#start-gameplay-btn,
.finale-btn {
  animation: none;
}

.role-card,
.hub-tile,
.quiz-container,
.reveal-card,
.modal-content,
.judge-content,
.organizer-content,
#circuit-puzzle-box {
  border-radius: 0;
  backdrop-filter: none;
}

.role-card,
.hub-tile {
  border-color: #314765;
  background: #0b1422;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 6px 6px 0 rgba(0, 0, 0, 0.22);
  transition: border-color 90ms linear, background-color 90ms linear;
}

.role-card:hover,
.hub-tile:hover {
  border-color: var(--hud-gold);
  background: #101d2e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 6px 6px 0 rgba(0, 0, 0, 0.22);
  transform: none;
}

.role-card .select-role-btn,
.hub-tile .select-role-btn {
  border: 1px solid #365273;
  background: #101c2d;
}

.role-card:hover .select-role-btn,
.role-card .select-role-btn:hover,
.hub-tile .select-role-btn:hover {
  border-color: var(--hud-gold);
  background: #3a2f18;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3);
  color: #fff7d7;
}

.quiz-container,
.reveal-card,
.modal-content {
  border-color: #405a7d;
  background: #091321;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.3);
}

.reveal-card {
  animation: none;
}

.quiz-option-btn,
.circuit-btn,
.verdict-btn,
.crisis-btn {
  border-color: #365273;
  background: #101c2d;
}

.quiz-option-btn:hover,
.quiz-option-btn:focus-visible,
.circuit-btn:hover,
.circuit-btn:focus-visible,
.verdict-btn:hover,
.verdict-btn:focus-visible,
.crisis-btn:hover,
.crisis-btn:focus-visible {
  border-color: var(--hud-cyan);
  background: #1a3351;
  box-shadow: none;
}

.quiz-option-btn::after {
  display: none;
}

.modal {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: none;
}

.modal-header,
.modal-footer {
  background: #080f1b;
  border-color: #334b69;
}

.modal-close {
  border-color: #b6545a;
  background: #301820;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: #5a2730;
  color: #fff;
}

@media (max-width: 1280px) {
  .hud-objective {
    display: none;
  }
}

@media (max-width: 980px) {
  #game-hud {
    min-height: 66px;
    padding: 7px 9px;
  }

  .hud-player-info {
    display: none;
  }

  .hud-zone-readout {
    min-width: 130px;
  }

  .hud-right {
    gap: 3px;
  }

  .hud-stat {
    min-width: 43px;
    padding: 4px 5px;
  }

  .hud-stat span {
    display: none;
  }

  #ai-bot-timer-hud {
    top: 78px;
  }
}

@media (max-width: 680px) {
  #game-hud {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .hud-logo {
    display: none;
  }

  .hud-zone-readout {
    min-width: 0;
  }

  .hud-zone-readout strong {
    max-width: 130px;
  }

  .hud-stat {
    display: none;
  }

  #hud-certified,
  #hud-keys {
    display: inline;
  }

  #hud-certified,
  #hud-keys {
    font-size: 0.72rem;
  }

  .hud-center {
    left: 8px;
    width: calc(100vw - 16px);
  }

  .hud-nav-buttons,
  .dialogue-choices {
    grid-template-columns: 1fr;
  }

  #dialogue-box {
    bottom: 9px;
    width: calc(100% - 18px);
    min-height: 0;
    padding: 12px 38px 12px 12px;
    gap: 10px;
  }

  .dialogue-portrait-wrap {
    display: none;
  }

  .dialogue-text {
    font-size: 0.84rem;
  }

  #controls-hint {
    bottom: 10px;
    left: 9px;
    max-width: calc(100% - 18px);
    font-size: 0.59rem;
  }

  #interact-prompt {
    bottom: 20px;
  }

  .narrator-widget {
    right: 10px;
    bottom: 10px;
  }

  .narrator-bubble {
    width: min(310px, calc(100vw - 86px));
  }
}

/* ==================== AEROSS HUD STYLING OVERRIDES ==================== */
.glow-btn, .dialogue-btn, .zone-btn, .n-topic-btn, .circuit-btn, .verdict-btn, .crisis-btn, .select-role-btn, .quiz-option-btn, .finale-btn {
  border-radius: 0 !important;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px) !important;
  border: 1px solid var(--dark-teal) !important;
  box-shadow: 0 4px 15px rgba(0, 139, 139, 0.4), inset 0 0 10px rgba(125, 249, 255, 0.1) !important;
  transition: all 0.2s ease-out !important;
  background: rgba(16, 22, 44, 0.9) !important;
  color: var(--warm-white) !important;
}

.glow-btn:hover, .dialogue-btn:hover, .zone-btn:hover, .n-topic-btn:hover, .circuit-btn:hover, .verdict-btn:hover, .crisis-btn:hover, .select-role-btn:hover, .quiz-option-btn:hover, .finale-btn:hover {
  background: rgba(0, 139, 139, 0.8) !important;
  box-shadow: 0 0 25px rgba(125, 249, 255, 0.6), inset 0 0 15px rgba(125, 249, 255, 0.4) !important;
  border-color: var(--cyan) !important;
  transform: translateY(-2px) !important;
}

.glow-btn:active, .dialogue-btn:active, .zone-btn:active, .n-topic-btn:active, .circuit-btn:active, .verdict-btn:active, .crisis-btn:active, .select-role-btn:active, .quiz-option-btn:active, .finale-btn:active {
  transform: translateY(1px) !important;
  box-shadow: 0 2px 10px rgba(125, 249, 255, 0.4), inset 0 0 25px rgba(125, 249, 255, 0.6) !important;
}

.panel, .modal-content {
  border-radius: 0 !important;
  border: 2px solid var(--dark-teal) !important;
  box-shadow: 0 0 30px rgba(0, 139, 139, 0.5), inset 0 0 20px rgba(16, 22, 44, 0.8) !important;
  background: rgba(16, 22, 44, 0.95) !important;
  clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px) !important;
}
