/* ==========================================
   GALACTIC ARCHIVE - GLOBAL & LAYOUT
   ========================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Courier New', Courier, monospace;
}

body {
  background-color: #050b14;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  color: #ffffff;
  overflow: hidden;
  padding: 16px;
}

.game-container {
  width: min(96vw, 1200px);
  aspect-ratio: 16 / 9;
  max-height: 92vh;
  position: relative;
  background-color: #000000;
  border: 4px solid #000000;
  box-shadow: 6px 6px 0px #000000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================
   TOP HUD BAR (FIXED CORNER CONTROLS)
   ========================================== */

.hud-bar {
  position: fixed;
  top: 15px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  pointer-events: auto;
}

.hud-left-controls, 
.hud-right-controls {
  display: flex;
  gap: 10px;
}

.hud-btn {
  background: rgba(10, 25, 47, 0.85);
  color: #64ffda;
  border: 1px solid #64ffda;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 0.85rem;
  text-transform: uppercase;
  transition: all 0.2s ease;
}

.hud-btn:hover {
  background: #64ffda;
  color: #0a192f;
  box-shadow: 0 0 12px rgba(100, 255, 218, 0.6);
}

.hud-mute-btn {
  background: rgba(0, 20, 40, 0.8);
  border: 1px solid #00f0ff;
  color: #00f0ff;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-mute-btn:hover {
  background: #00f0ff;
  color: #050a14;
  box-shadow: 0 0 10px #00f0ff;
}

.hud-mute-btn.muted {
  border-color: #ff3366;
  color: #ff3366;
}

.hud-mute-btn.muted:hover {
  background: #ff3366;
  color: #ffffff;
  box-shadow: 0 0 10px #ff3366;
}

.hud-read-btn {
  background: rgba(255, 183, 3, 0.15);
  color: #ffb703;
  border: 1px solid #ffb703;
}

.hud-read-btn:hover {
  background: #ffb703;
  color: #0a192f;
  box-shadow: 0 0 12px rgba(255, 183, 3, 0.6);
}

.hud-read-btn.reading-active {
  background: #ff0055;
  color: #ffffff;
  border-color: #ff0055;
  animation: pulseRead 1s infinite alternate;
}

@keyframes pulseRead {
  0% { box-shadow: 0 0 5px #ff0055; }
  100% { box-shadow: 0 0 15px #ff0055; }
}

/* ==========================================
   HUD LOG PROGRESS BAR & PILL BUTTON
   ========================================== */

.hud-logs-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
}

.log-btn-label {
  font-weight: bold;
  letter-spacing: 1px;
}

.log-progress-track {
  width: 90px;
  height: 12px;
  background: rgba(2, 12, 27, 0.9);
  border: 1px solid #64ffda;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.8);
}

.log-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00f0ff 0%, #64ffda 100%);
  border-radius: 4px;
  width: 0%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px #64ffda;
}

.log-progress-text {
  font-size: 0.75rem;
  color: #64ffda;
  min-width: 32px;
  text-align: right;
  font-weight: bold;
}

.hud-logs-btn:hover .log-progress-track {
  border-color: #ffffff;
}

.hud-logs-btn:hover .log-progress-fill {
  background: linear-gradient(90deg, #64ffda 0%, #ffffff 100%);
  box-shadow: 0 0 12px #ffffff;
}

/* ==========================================
   TITLE / LANDING SCREEN
   ========================================== */

.title-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a192f 0%, #020c1b 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 2000;
}

.title-content {
  background: rgba(10, 25, 47, 0.9);
  border: 2px solid #64ffda;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 0 25px rgba(100, 255, 218, 0.3);
  max-width: 450px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-cover-icon {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid #64ffda;
  margin-bottom: 16px;
  box-shadow: 0 0 15px rgba(100, 255, 218, 0.4);
}

.game-title {
  font-size: 2.2rem;
  color: #64ffda;
  margin: 0 0 8px 0;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.game-subtitle {
  font-size: 1rem;
  color: #8892b0;
  margin-bottom: 16px;
}

.title-astro-credit, 
.secret-astro-zone {
  margin: 10px 0 20px 0;
  text-align: center;
  user-select: none;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.title-astro-credit:hover, 
.secret-astro-zone:hover {
  transform: scale(1.08);
}

.glowing-astro-text {
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: bold;
  color: #00f0ff;
  letter-spacing: 1.5px;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.7), 0 0 15px rgba(100, 255, 218, 0.4);
  animation: astroGlow 2.5s infinite ease-in-out alternate;
}

@keyframes astroGlow {
  0% { opacity: 0.75; transform: scale(1); text-shadow: 0 0 4px #00f0ff; }
  100% { opacity: 1; transform: scale(1.03); text-shadow: 0 0 12px #00f0ff, 0 0 22px #64ffda; }
}

.title-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.start-btn {
  background: #64ffda;
  color: #0a192f;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(100, 255, 218, 0.4);
}

.start-btn:hover {
  background: #ffffff;
  color: #0a192f;
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.8);
  transform: scale(1.03);
}

.start-btn.restore-btn {
  background: transparent;
  color: #00f0ff;
  border: 2px solid #00f0ff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.start-btn.restore-btn:hover {
  background: #00f0ff;
  color: #0a192f;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.7);
}

.title-mute-pos {
  position: absolute;
  top: 50%;
  left: 40px;
  transform: translateY(-50%);
  z-index: 1000;
}

.title-info-pos {
  position: absolute;
  top: 50%;
  right: 40px;
  transform: translateY(-50%);
  z-index: 1000;
}

/* ==========================================
   COMIC PANEL FRAME & CAPTION BOX
   ========================================== */

.panel-box {
  flex: 1;
  width: 100%;
  height: 100%;
  background-size: contain;
  background-position: center center;
  background-repeat: no-repeat;
  background-color: #020c1b;
  position: relative;
  transition: background-image 0.4s ease-in-out;
  overflow: visible !important;
}

.caption-box {
  position: absolute;
  bottom: 0px;
  left: 12px;
  right: 12px;
  background: rgba(6, 20, 42, 0.94) !important;
  color: #fdfdfd !important;
  border: 2px solid #64ffda !important;
  border-radius: 6px;
  padding: 14px 18px;
  font-family: 'Courier New', monospace;
  font-size: 1.05rem !important;
  font-weight: 700 !important; 
  letter-spacing: 0.5px;
  line-height: 1.55;
  box-shadow: 0 0 15px rgba(100, 255, 218, 0.3), 
              inset 0 0 10px rgba(100, 255, 218, 0.15);
  text-shadow: 0 0 4px rgba(100, 255, 218, 0.6);
  overflow: visible !important;
}

.caption-box.caption-epilogue {
  right: 320px;
  max-width: 60%;
}

/* ==========================================
   JUDGE INFO MODAL - REPO LINK BUTTON
   ========================================== */

.repo-link-box {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.repo-link-box span {
  font-size: 0.85rem;
  color: #8892b0;
}

.repo-link-btn {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  background: rgba(100, 255, 218, 0.08);
  color: #64ffda;
  border: 1px solid #64ffda;
  padding: 8px 14px;
  border-radius: 4px;
  text-decoration: none;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: bold;
  transition: all 0.25s ease;
  box-shadow: 0 0 10px rgba(100, 255, 218, 0.15);
}

.repo-link-btn:hover {
  background: #64ffda;
  color: #0a192f;
  box-shadow: 0 0 18px rgba(100, 255, 218, 0.6);
  transform: translateY(-1px);
}

/* ==========================================
   EDUCATIONAL FAILURE DEBRIEF BOX
   ========================================== */

.debrief-box {
  position: absolute;
  top: 60px;
  left: 16px;
  max-width: 360px;
  background: rgba(30, 5, 10, 0.94);
  border: 2px solid #ff3366;
  border-radius: 6px;
  padding: 12px 16px;
  color: #ff99bb;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  box-shadow: 0 0 15px rgba(255, 51, 102, 0.4);
  z-index: 25;
  overflow: visible !important;
}

.debrief-title {
  color: #ff3366;
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

/* ==========================================
   GLOSSARY TOOLTIPS (CAPTION & DEBRIEF)
   ========================================== */

.glossary-term {
  color: #64ffda;
  border-bottom: 1px dashed #64ffda;
  cursor: help;
  position: relative;
  display: inline-block;
}

.debrief-box .glossary-term {
  color: #ffe600;
  border-bottom: 1px dashed #ffe600;
}

.caption-box .glossary-term:hover::after,
.caption-box .glossary-term:focus::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%;
  left: 0;
  background: #0a192f;
  color: #e6f1ff;
  border: 1px solid #64ffda;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.78rem;
  white-space: normal;
  width: 230px;
  box-shadow: 0 0 12px rgba(100, 255, 218, 0.5);
  z-index: 1000;
  pointer-events: none;
  text-align: left;
}

.debrief-box .glossary-term:hover::after,
.debrief-box .glossary-term:focus::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 130%;
  left: 0;
  background: #0a192f;
  color: #e6f1ff;
  border: 1px solid #ffe600;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.78rem;
  white-space: normal;
  width: 230px;
  box-shadow: 0 0 12px rgba(255, 230, 0, 0.5);
  z-index: 1000;
  pointer-events: none;
  text-align: left;
}

/* ==========================================
   INTERACTIVE EASTER EGG OVERLAYS
   ========================================== */

.secret-rez-zone {
  position: absolute;
  bottom: 18px;
  right: 28px;
  padding: 8px 16px;
  cursor: pointer;
  z-index: 20;
  user-select: none;
}

.glowing-rez-text {
  font-family: 'Courier New', monospace;
  font-style: italic;
  font-weight: bold;
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 2px;
  display: inline-block;
  transform: rotate(-6deg);
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.secret-rez-zone:hover .glowing-rez-text {
  color: #64ffda;
  transform: rotate(-6deg) scale(1.2);
  text-shadow: 0 0 8px #64ffda, 0 0 18px #00f0ff, 0 0 30px #ffb703;
}

/* ==========================================
   NASA HUD OVERLAY
   ========================================== */

.hud-overlay {
  position: absolute;
  top: 55px;
  right: 16px;
  width: 320px;
  background: rgba(10, 25, 47, 0.88);
  border: 2px solid #00f0ff;
  border-radius: 4px;
  padding: 12px;
  color: #00f0ff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
  z-index: 10;
  transition: all 0.3s ease;
}

.hud-header {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 8px;
  color: #00f0ff;
}

.hud-overlay img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border: 1px solid #00f0ff;
  margin-bottom: 6px;
  display: block;
}

.hud-overlay p {
  font-size: 11px;
  color: #e6f1ff;
  line-height: 1.3;
}

.hud-overlay.alert {
  border: 2px solid #ff3333 !important;
  box-shadow: 0 0 18px rgba(255, 51, 51, 0.8) !important;
  background: rgba(40, 0, 0, 0.9) !important;
}

.hud-overlay.alert .hud-header {
  color: #ff3333 !important;
  font-weight: bold;
}

/* ==========================================
   CHOICE BUTTONS
   ========================================== */

.choices-container {
  min-height: 85px;
  background-color: #0a192f;
  border-top: 4px solid #000000;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  z-index: 10;
  flex-wrap: wrap;
}

.choice-btn {
  flex: 1;
  min-width: 160px;
  padding: 12px;
  background-color: #00f0ff;
  color: #000000;
  border: 3px solid #000000;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 3px 3px 0px #000000;
  transition: transform 0.1s, background-color 0.2s, color 0.2s;
  text-align: center;
  touch-action: manipulation;
}

.choice-btn:hover {
  background-color: #ff0055;
  color: #ffffff;
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0px #000000;
}

/* ==========================================
   LOG NOTIFICATION TOAST & TERMINAL MODAL
   ========================================== */

.log-toast-popup {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: #0a192f;
  border: 2px solid #64ffda;
  box-shadow: 0 0 20px rgba(100, 255, 218, 0.4);
  color: #e6f1ff;
  padding: 12px 18px;
  border-radius: 6px;
  z-index: 9999;
  animation: toastSlideUp 0.4s ease-out;
}

.log-toast-header {
  color: #ffb703;
  font-weight: bold;
  font-size: 0.8rem;
  letter-spacing: 1px;
}

.log-toast-body {
  color: #64ffda;
  font-weight: bold;
  margin: 4px 0;
}

.log-toast-hint {
  color: #8892b0;
  font-size: 0.78rem;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 12, 24, 0.88);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.crt-terminal-box {
  background: #0a192f;
  border: 2px solid #64ffda;
  box-shadow: 0 0 25px rgba(100, 255, 218, 0.4);
  width: 90%;
  max-width: 680px;
  max-height: 85vh;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  color: #e6f1ff;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(100, 255, 218, 0.1);
  border-bottom: 1px solid #64ffda;
}

.modal-header h2 {
  font-size: 1.1rem;
  color: #64ffda;
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #ff5555;
  font-size: 1.4rem;
  cursor: pointer;
  font-weight: bold;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  line-height: 1.6;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: #020c1b;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #64ffda;
  border-radius: 3px;
}

.log-entry-item {
  background: rgba(100, 255, 218, 0.05);
  border: 1px solid rgba(100, 255, 218, 0.2);
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.log-entry-item.locked {
  border-style: dashed;
  color: #48566e;
  background: transparent;
}

/* ==========================================
   MINI-GAME CANVAS OVERLAY STYLING
   ========================================== */

#canvas-view {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  background-color: #000000 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  z-index: 50;
  box-sizing: border-box !important;
}

#canvas-view.hidden {
  display: none !important;
}

#phaser-game-container {
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  overflow: hidden;
}

#phaser-game-container canvas {
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.25);
}

/* ==========================================
   ARCHIE CURATOR CRT DRAWER
   ========================================== */

.curator-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.96);
  border-left: 2px solid #00ff88;
  box-shadow: -10px 0 25px rgba(0, 255, 136, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  transition: transform 0.3s ease-in-out;
  font-family: 'Courier New', monospace;
  color: #64ffda;
}

.curator-drawer.hidden {
  transform: translateX(100%);
}

.curator-header {
  padding: 16px;
  background: #09101d;
  border-bottom: 1px solid #00ff88;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.curator-title {
  font-size: 15px;
  font-weight: bold;
  color: #00ff88;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 10px;
  height: 10px;
  background-color: #00ff88;
  border-radius: 50%;
  box-shadow: 0 0 10px #00ff88;
}

.curator-close-btn {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 20px;
  cursor: pointer;
  font-weight: bold;
  padding: 4px 8px;
}

.curator-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 14px;
  line-height: 1.6;
}

.curator-msg {
  padding: 10px 14px;
  border-radius: 4px;
  word-wrap: break-word;
}

.curator-msg.bot {
  background: rgba(0, 255, 136, 0.1);
  border-left: 4px solid #00ff88;
  color: #f1f5f9;
}

.curator-msg.user {
  background: rgba(56, 189, 248, 0.18);
  border-right: 4px solid #38bdf8;
  color: #38bdf8;
  align-self: flex-end;
}

.bot-tag {
  color: #00ff88;
  font-weight: bold;
  margin-right: 6px;
}

.curator-chips {
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid rgba(100, 255, 218, 0.25);
  background: rgba(9, 16, 29, 0.5);
}

.chip-btn {
  background: rgba(0, 255, 136, 0.15);
  border: 1px solid #00ff88;
  color: #00ff88;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  padding: 8px 12px;
  min-height: 44px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.chip-btn:hover {
  background: #00ff88;
  color: #030712;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
}

.curator-input-box {
  padding: 14px;
  background: #09101d;
  border-top: 1px solid #00ff88;
  display: flex;
  gap: 10px;
}

.curator-input-box input {
  flex: 1;
  background: #030712;
  border: 1px solid #64ffda;
  color: #00ff88;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  border-radius: 4px;
  outline: none;
}

.curator-input-box button {
  background: #00ff88;
  color: #030712;
  border: none;
  font-family: inherit;
  font-weight: bold;
  font-size: 13px;
  padding: 0 16px;
  cursor: pointer;
  border-radius: 4px;
}

/* ==========================================
   ANIMATIONS & DANGER / VICTORY GLOWS
   ========================================== */

.hidden {
  display: none !important;
}

@keyframes toastSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes screenShake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shake {
  animation: screenShake 0.5s ease-in-out;
}

.alarm-flash {
  animation: flashRed 0.6s infinite alternate;
}

@keyframes flashRed {
  0% { 
    box-shadow: inset 0 0 10px rgba(255, 0, 0, 0.4), 0 0 15px rgba(255, 0, 0, 0.5); 
    border-color: #ff0055 !important;
  }
  100% { 
    box-shadow: inset 0 0 80px rgba(255, 0, 0, 0.85), 0 0 35px rgba(255, 0, 0, 0.9); 
    border-color: #ff0000 !important;
  }
}

.success-glow {
  animation: glowCyan 1.2s infinite alternate ease-in-out;
}

@keyframes glowCyan {
  0% { 
    box-shadow: inset 0 0 15px rgba(0, 240, 255, 0.4), 0 0 20px rgba(100, 255, 218, 0.5); 
    border-color: #64ffda !important;
  }
  100% { 
    box-shadow: inset 0 0 65px rgba(0, 240, 255, 0.85), 0 0 40px rgba(0, 240, 255, 0.95); 
    border-color: #00f0ff !important;
  }
}

/* ==========================================
   MOBILE PORTRAIT OPTIMIZATIONS (<768px)
   ========================================== */

@media screen and (max-width: 768px) {
  body {
    padding: 0;
  }

  .game-container {
    width: 100vw !important;
    height: auto !important;
    min-height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
    flex-direction: column;
  }

  .title-mute-pos {
    top: 16px !important;
    left: 16px !important;
    transform: none !important;
  }

  .title-info-pos {
    top: 16px !important;
    right: 16px !important;
    transform: none !important;
  }

  .hud-overlay {
    position: relative !important;
    width: 95% !important;
    margin: 10px auto !important;
    max-height: 160px;
    overflow-y: auto;
    top: auto !important;
    right: auto !important;
  }

  .debrief-box {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px auto !important;
    z-index: 30;
  }

  .panel-box {
    width: 100% !important;
    min-height: 260px !important;
  }

  .caption-box {
    font-size: 0.9rem !important;
    padding: 10px 12px;
  }

  .choice-btn {
    min-height: 48px;
    font-size: 0.95rem;
    padding: 12px 14px;
    width: 100%;
  }

  .curator-drawer {
    width: 100vw;
    max-width: 100vw;
  }
}

/* ==========================================
   MOBILE PORTRAIT OPTIMIZATIONS (<768px)
   ========================================== */
@media screen and (max-width: 768px) {
  body {
    padding: 0;
  }

  .game-container {
    width: 100vw !important;
    height: auto !important;
    min-height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
    flex-direction: column;
  }

  .hud-bar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    background: rgba(5, 11, 20, 0.95);
    border-bottom: 1px solid #64ffda;
  }

  .hud-left-controls {
    flex-wrap: wrap;
    gap: 6px;
  }

  .hud-btn,
  .hud-mute-btn {
    padding: 6px 8px;
    font-size: 0.72rem;
  }

  #canvas-view {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2500 !important;
  }

  .title-mute-pos {
    top: 16px !important;
    left: 16px !important;
    transform: none !important;
  }

  .title-info-pos {
    top: 16px !important;
    right: 16px !important;
    transform: none !important;
  }

  .hud-overlay {
    position: relative !important;
    width: 95% !important;
    margin: 10px auto !important;
    max-height: 160px;
    overflow-y: auto;
    top: auto !important;
    right: auto !important;
  }

  .debrief-box {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px auto !important;
    z-index: 30;
  }

  .panel-box {
    width: 100% !important;
    min-height: 260px !important;
  }

  .caption-box {
    font-size: 0.9rem !important;
    padding: 10px 12px;
  }

  .choice-btn {
    min-height: 48px;
    font-size: 0.95rem;
    padding: 12px 14px;
    width: 100%;
  }

  .curator-drawer {
    width: 100vw;
    max-width: 100vw;
  }
}

/* ==========================================
   MOBILE LANDSCAPE ORIENTATION OPTIMIZATIONS
   ========================================== */
@media screen and (max-width: 900px) and (orientation: landscape) {
  body {
    padding: 0;
    margin: 0;
  }

  .game-container {
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    border: none;
    border-radius: 0;
    padding: 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .panel-box {
    height: 55vh;
    min-height: auto;
  }

  #choices-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 6px;
    padding: 4px;
  }

  .choice-btn {
    min-height: 40px;
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .hud-bar {
    top: 6px;
    left: 8px;
    right: 8px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .hud-btn,
  .hud-mute-btn {
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  #canvas-view {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2500 !important;
  }
}

/* ==========================================
   MISSION 7: SUBSURFACE CRYOBOT DIVING FX
   ========================================== */
#phaser-game-container.europa-diving-fx {
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 65px rgba(2, 132, 199, 0.55), 0 0 24px rgba(0, 240, 255, 0.25);
  animation: europaHullPulse 3.6s ease-in-out infinite;
}

/* Abyssal pressure vignette & caustic light sweep */
#phaser-game-container.europa-diving-fx::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 25%, transparent 45%, rgba(3, 19, 36, 0.72) 100%),
    repeating-linear-gradient(
      0deg,
      rgba(56, 189, 248, 0.03) 0px,
      rgba(56, 189, 248, 0.03) 2px,
      transparent 2px,
      transparent 8px
    );
  animation: europaStrataScroll 0.85s linear infinite;
  z-index: 5;
}

/* Intensify pressure vignette near 15.0 km ocean breakthrough */
#phaser-game-container.europa-diving-fx.deep-pressure {
  box-shadow: inset 0 0 95px rgba(0, 240, 255, 0.65), 0 0 32px rgba(0, 255, 136, 0.35);
}

@keyframes europaStrataScroll {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 0 0, 0 -32px; }
}

@keyframes europaHullPulse {
  0%, 100% { filter: brightness(1) contrast(1.03); }
  50% { filter: brightness(1.06) contrast(1.08); }
}

/* ==========================================
   MOBILE PORTRAIT OVERRIDE (< 768px)
   ========================================== */
@media screen and (max-width: 768px) {
  html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
  }

  .game-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 100vh !important;
    padding: 0 0 24px 0 !important;
    box-sizing: border-box !important;
  }

  .hud-bar {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    padding: 8px 10px !important;
    box-sizing: border-box !important;
    z-index: 100 !important;
  }

  .hud-left-controls {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    width: auto !important;
  }

  .hud-btn,
  .hud-mute-btn {
    padding: 5px 8px !important;
    font-size: 0.72rem !important;
    width: auto !important;
  }

  .panel-box,
  #panel-box {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 220px !important;
    margin: 10px auto !important;
    box-sizing: border-box !important;
  }

  #panel-img {
    width: 100% !important;
    height: auto !important;
    max-height: 36vh !important;
    object-fit: cover !important;
  }

  .caption-box,
  #caption-box {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    font-size: 0.92rem !important;
    line-height: 1.45 !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
  }

  #choices-container {
    display: flex !important;
    flex-direction: column !important;
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    padding: 0 !important;
    gap: 8px !important;
    box-sizing: border-box !important;
  }

  .choice-btn {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 46px !important;
    padding: 10px 14px !important;
    font-size: 0.9rem !important;
    box-sizing: border-box !important;
    white-space: normal !important;
  }
}