html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #000000;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* CRT Scanlines Overlay */
body::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  /* Horizontal scanline lines + vertical subpixel mesh */
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
              linear-gradient(90deg, rgba(255, 0, 0, 0.04), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.04));
  z-index: 999;
  background-size: 100% 3px, 6px 100%;
  pointer-events: none;
}

/* Hide CRT scanlines and RGB subpixel mesh during screenshot capture */
body.is-capture::before {
  display: none !important;
}

/* CRT Vignette shadow / Spotted Alert Overlay */
body::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: radial-gradient(circle, rgba(0, 0, 0, 0) 65%, rgba(0, 0, 0, 0.85) 100%);
  z-index: 1000;
  pointer-events: none;
  transition: background 0.3s ease-in-out;
}

/* Red Emergency Pulsing vignette when spotted */
body.spotted-alert::after {
  background: radial-gradient(circle, rgba(255, 0, 0, 0) 50%, rgba(220, 20, 20, 0.4) 85%, rgba(130, 10, 10, 0.75) 100%);
  animation: spottedRedPulse 0.8s infinite alternate ease-in-out;
}

/* Threat/extraction already carry an animated in-world anomaly and warning
   panel. A static vignette avoids a second fullscreen compositor animation
   competing with the WebGL renderer during the tutorial's heaviest scene. */
body.tutorial-threat-safe.spotted-alert::after {
  animation: none;
  opacity: 0.78;
}

@property --title-pulse-stop {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 75%;
}

/* Creepy slow red pulsing vignette on the title screen */
body.title-pulse-alert::after {
  background: radial-gradient(circle, rgba(255, 0, 0, 0) var(--title-pulse-stop), rgba(180, 0, 0, 0.25) 80%, rgba(90, 0, 0, 0.75) 100%);
  animation: titleCreepyPulse 4.5s infinite alternate ease-in-out;
}

@keyframes titleCreepyPulse {
  0% {
    --title-pulse-stop: 75%;
    opacity: 0.3;
  }
  100% {
    --title-pulse-stop: 40%;
    opacity: 0.9;
  }
}


/* Purple Radiation vignette when near Cherenkov rift */
body.radiation-alert::after {
  background: radial-gradient(circle, rgba(191, 0, 255, 0) 50%, rgba(191, 0, 255, 0.15) 85%, rgba(120, 0, 180, 0.5) 100%);
  animation: radiationPulse 1.5s infinite alternate ease-in-out;
}

@keyframes radiationPulse {
  0% {
    opacity: 0.6;
  }
  100% {
    opacity: 1.0;
  }
}

/* Violet/purple desynced vignette when phased in ASCII Void */
body.desynced-alert::after {
  background: radial-gradient(circle, rgba(160, 0, 240, 0) 45%, rgba(160, 0, 240, 0.20) 80%, rgba(90, 0, 160, 0.65) 100%);
  animation: desyncedPulse 2.0s infinite alternate ease-in-out;
}

@keyframes desyncedPulse {
  0% {
    opacity: 0.55;
  }
  100% {
    opacity: 1.0;
  }
}

/* Amber/yellow vignette when near Exposed Wire Spark */
body.electrical-alert::after {
  background: radial-gradient(circle, rgba(255, 174, 0, 0) 50%, rgba(255, 174, 0, 0.15) 85%, rgba(180, 110, 0, 0.55) 100%);
  animation: electricalPulse 0.3s infinite alternate ease-in-out;
}

@keyframes electricalPulse {
  0% {
    opacity: 0.5;
  }
  100% {
    opacity: 1.0;
  }
}

@keyframes spottedRedPulse {
  0% {
    opacity: 0.6;
  }
  100% {
    opacity: 1.0;
  }
}

/* Performance-optimized canvas viewport */
#terminal {
  display: block;
  background-color: #000000;
  
  /* Retro screen flicker overlay */
  animation: crtScreenFlicker 0.15s infinite;
}

#terminal, #overlay-terminal {
  /* Crisp scaling behavior to prevent blurriness */
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#terminal.smooth-rendering, #overlay-terminal.smooth-rendering {
  image-rendering: auto !important;
}

#terminal.disable-crt-flicker {
  animation: none !important;
}

@keyframes crtScreenFlicker {
  0% { opacity: 0.995; }
  50% { opacity: 1.0; }
  100% { opacity: 0.995; }
}

/* Floating overlay for player instruction */
#instructions {
  position: absolute;
  top: 200px; /* Positioned below the top HUD elements to prevent overlap */
  left: 50%;
  transform: translate(-50%, -100px); /* Start shifted up to support slide-down animation */
  opacity: 0;
  color: #00dcff; /* CRT Teal to match transmission style */
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 16px;
  font-weight: bold;
  background-color: rgba(0, 0, 0, 0.9);
  padding: 10px 20px;
  border: 2px solid #00dcff;
  border-radius: 6px;
  box-shadow: 0 0 25px rgba(0, 220, 255, 0.4);
  pointer-events: none;
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out, border-color 0.3s ease-in-out, color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
  z-index: 1001; /* Must render above vignette overlay */
}

/* Retro CRT Settings Overlay */
#settings-overlay,
#first-run-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  font-family: 'Consolas', 'Courier New', monospace;
  animation: modalFadeIn 0.3s ease-out;
}

/* Above the settings overlay: the first-run prompt is answered before anything
   else is reachable, so nothing should be able to draw over it. */
#first-run-overlay { z-index: 2100; }

#first-run-overlay .first-run-body {
  color: #b8f7ff;
  line-height: 1.6;
  margin: 0 0 18px;
  text-align: left;
}

#first-run-overlay .first-run-footnote {
  color: #6f8f99;
  line-height: 1.5;
  margin: 18px 0 0;
  text-align: left;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.settings-box {
  background: #000000;
  border: 4px double rgb(0, 220, 255);
  box-shadow: 0 0 25px rgba(0, 220, 255, 0.4);
  border-radius: 0;
  padding: 25px 30px;
  width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
  color: rgb(240, 110, 20); /* Amber */
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Upgrade 78 display console: wide and scan-friendly at desktop sizes. */
.settings-box.display-console {
  width: 1040px;
  max-width: 94vw;
  max-height: none;
  overflow: hidden;
  padding: 18px 22px;
  gap: 10px;
  background:
    linear-gradient(90deg, rgba(0, 220, 255, 0.035), transparent 28%, transparent 72%, rgba(0, 220, 255, 0.035)),
    #000;
}

.display-console > h2 {
  margin-bottom: 0;
  font-size: 14px;
}

.display-config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
  min-height: 0;
}

.display-config-column {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(0, 220, 255, 0.38);
  background: rgba(0, 12, 18, 0.68);
  box-shadow: inset 0 0 18px rgba(0, 220, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.display-section-title {
  color: rgb(240, 170, 30);
  border-bottom: 1px dashed rgba(240, 170, 30, 0.45);
  padding-bottom: 6px;
  margin-bottom: 2px;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.display-pipeline-title {
  margin-top: 3px;
}

/* The one section on this panel that is a content choice rather than a render
   setting, so it carries the mode's colour instead of the panel's amber. */
.display-red-edition-title {
  margin-top: 10px;
  color: #ff3366;
  border-bottom-color: rgba(255, 51, 102, 0.45);
}

.accessibility-console {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
  padding: 8px 9px;
  border: 1px solid rgba(240, 170, 30, 0.42);
  background: linear-gradient(135deg, rgba(240, 170, 30, 0.08), rgba(0, 220, 255, 0.035));
}

.accessibility-preset-group,
.accessibility-status {
  grid-column: 1 / -1;
}

body[data-accessibility-contrast="high-contrast"] .settings-box {
  border-color: rgb(80, 235, 255);
  box-shadow: 0 0 18px rgba(0, 220, 255, 0.28);
}

body[data-accessibility-preset="photosensitive"] #terminal,
body[data-accessibility-preset="photosensitive"] #overlay-terminal {
  animation: none !important;
}

.accessibility-scale-control {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 7px;
  color: rgb(180, 180, 180);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.accessibility-scale-control input[type="range"] {
  min-width: 0;
  accent-color: rgb(0, 220, 255);
}

.accessibility-scale-control output {
  min-width: 34px;
  color: rgb(240, 170, 30);
  text-align: right;
}

.accessibility-status {
  padding-top: 5px;
  border-top: 1px dashed rgba(0, 220, 255, 0.24);
  color: rgb(100, 205, 195);
  font-size: 9px;
  line-height: 1.25;
  text-align: center;
}

.display-console .setting-group {
  gap: 3px;
}

.display-console .setting-group label,
.display-console .checkbox-container {
  font-size: 12px;
}

.display-console .select-container select {
  font-size: 12px;
  padding: 3px 5px;
}

.display-console .setting-warning {
  padding: 5px 7px;
  border-left: 2px solid #ff5555;
  background: rgba(255, 40, 40, 0.06);
}

.display-console .display-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 9px 12px;
  padding: 0;
}

.display-toggle-grid .select-group {
  grid-column: 1 / -1;
  width: 100%;
  padding: 7px 8px;
  border: 1px dashed rgba(0, 220, 255, 0.28);
  box-sizing: border-box;
}

.display-toggle-grid .select-group select {
  width: 100%;
  margin-top: 3px;
  background: #020a0f;
  color: rgb(0, 220, 255);
  border: 1px solid rgba(0, 220, 255, 0.45);
  padding: 5px 7px;
  font: inherit;
}

.display-toggle-grid .checkbox-container {
  min-height: 30px;
  padding: 4px 6px;
  border-bottom: 1px dashed rgba(0, 220, 255, 0.16);
  box-sizing: border-box;
}

.display-console #btn-back-display {
  align-self: center;
  width: min(420px, 70%);
  margin-top: 0;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}

@media (max-width: 900px), (max-height: 650px) {
  .settings-box.display-console {
    width: min(720px, 94vw);
    max-height: 88vh;
    overflow-y: auto;
  }

  .display-config-layout {
    grid-template-columns: 1fr;
  }
}

/* Custom retro scrollbar for the settings box */
.settings-box::-webkit-scrollbar {
  width: 8px;
}
.settings-box::-webkit-scrollbar-track {
  background: #000;
  border-left: 1px dashed rgba(0, 220, 255, 0.3);
}
.settings-box::-webkit-scrollbar-thumb {
  background: rgba(0, 220, 255, 0.6);
  border: 2px solid #000;
}
.settings-box::-webkit-scrollbar-thumb:hover {
  background: rgb(0, 220, 255);
}

.settings-box h2 {
  margin: 0 0 5px 0;
  color: rgb(0, 220, 255); /* Cyan */
  font-size: 13px;
  text-align: center;
  font-weight: normal;
  line-height: 1.3;
  white-space: pre;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-group label {
  font-size: 13px;
  color: rgb(180, 180, 180);
}

.ascii-divider {
  border-top: 1px dashed rgba(0, 220, 255, 0.3);
  margin: 2px 0;
}

/* Custom styles for select dropdown */
.select-container {
  display: flex;
  align-items: center;
  width: 100%;
}

.select-container::before {
  content: "[ ";
  color: rgb(0, 220, 255);
  font-weight: bold;
  font-family: monospace;
  font-size: 14px;
  pointer-events: none;
}

.select-container::after {
  content: " v ]";
  color: rgb(0, 220, 255);
  font-weight: bold;
  font-family: monospace;
  font-size: 14px;
  pointer-events: none;
}

.select-container select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  flex: 1;
  background: transparent;
  color: rgb(0, 220, 255);
  border: none;
  border-bottom: 1px dashed rgba(0, 220, 255, 0.4);
  font-family: inherit;
  font-size: 13px;
  padding: 4px 6px;
  outline: none;
  cursor: pointer;
  border-radius: 0;
  margin: 0;
}

.select-container select:focus {
  border-bottom-style: solid;
  border-bottom-color: rgb(0, 220, 255);
  color: rgb(240, 110, 20);
}

.select-container select option {
  background-color: #000000;
  color: rgb(0, 220, 255);
}

/* Custom styles for range sliders */
.slider-group label {
  display: flex;
  justify-content: space-between;
}

.slider-group label span {
  color: rgb(0, 220, 255);
  font-weight: bold;
}

.slider-container {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 4px;
}

.slider-bracket {
  color: rgb(0, 220, 255);
  font-weight: bold;
  font-size: 14px;
  user-select: none;
}

.slider-container input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.slider-container input[type="range"]:focus {
  outline: none;
}

.slider-container input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 2px;
  background: rgba(0, 220, 255, 0.5);
  border: none;
  transition: background 0.15s ease;
}

.slider-container input[type="range"]:hover::-webkit-slider-runnable-track {
  background: rgb(0, 220, 255);
}

.slider-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 100%;
  width: 10px;
  background: rgb(0, 220, 255);
  margin-top: -7px; /* Centers thumb on 2px track */
  border-radius: 0; /* Boxy block */
  border: 1px solid #000;
  box-shadow: 0 0 6px rgba(0, 220, 255, 0.8);
  transition: background 0.15s ease, transform 0.1s ease;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
  background: rgb(240, 110, 20);
  box-shadow: 0 0 10px rgba(240, 110, 20, 0.8);
  transform: scaleY(1.1);
}

.row-group {
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

/* Checkbox container reskin */
.checkbox-container {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-family: inherit;
  font-size: 13px;
  color: rgb(180, 180, 180);
}

.checkbox-container input[type="checkbox"] {
  display: none; /* Hide native */
}

.checkbox-container .custom-box::before {
  content: "[ ]";
  color: rgb(0, 220, 255);
  font-family: monospace;
  font-weight: bold;
  font-size: 14px;
  display: inline-block;
  width: 3ch;
  text-align: center;
}

.checkbox-container input[type="checkbox"]:checked + .custom-box::before {
  content: "[x]";
  color: rgb(0, 220, 255);
}

.checkbox-container:hover .custom-box::before {
  color: rgb(240, 110, 20);
}

.checkbox-container:hover .checkbox-label {
  color: rgb(240, 110, 20);
}

/* Buttons and closing */
.button-group {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.button-group button {
  flex: 1;
  background-color: transparent;
  border: 1px dashed rgba(240, 110, 20, 0.6);
  color: rgb(240, 110, 20);
  padding: 6px 8px;
  border-radius: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  text-transform: uppercase;
  transition: all 0.1s ease;
}

.button-group button::before {
  content: "[ ";
}

.button-group button::after {
  content: " ]";
}

.button-group button:hover {
  background-color: rgba(240, 110, 20, 0.1);
  border-style: solid;
  border-color: rgb(240, 110, 20);
  box-shadow: 0 0 8px rgba(240, 110, 20, 0.4);
}

/* Settings Hub Buttons styling */
.btn-hub {
  background-color: transparent;
  color: rgb(0, 220, 255);
  border: 1px dashed rgba(0, 220, 255, 0.6);
  border-radius: 0;
  padding: 10px;
  font-family: inherit;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.1s ease;
  text-transform: uppercase;
  white-space: nowrap;
}

.btn-hub::before {
  content: "[ ";
}

.btn-hub::after {
  content: " ]";
}

.btn-hub:hover {
  background-color: rgba(0, 220, 255, 0.1);
  border-style: solid;
  border-color: rgb(0, 220, 255);
  box-shadow: 0 0 12px rgba(0, 220, 255, 0.4);
  color: rgb(240, 110, 20);
}

.btn-hub.close-btn {
  color: rgb(0, 255, 160);
  border-color: rgba(0, 255, 160, 0.6);
}

.btn-hub.close-btn:hover {
  background-color: rgba(0, 255, 160, 0.1);
  border-color: rgb(0, 255, 160);
  box-shadow: 0 0 12px rgba(0, 255, 160, 0.4);
}

.btn-hub.back-btn {
  color: rgb(240, 110, 20);
  border-color: rgba(240, 110, 20, 0.6);
  margin-top: 5px;
}

.btn-hub.back-btn:hover {
  background-color: rgba(240, 110, 20, 0.1);
  border-color: rgb(240, 110, 20);
  box-shadow: 0 0 12px rgba(240, 110, 20, 0.4);
}

.btn-hub.warning-btn {
  color: rgb(255, 60, 60);
  border-color: rgba(255, 60, 60, 0.6);
}

.btn-hub.warning-btn:hover {
  background-color: rgba(255, 60, 60, 0.1);
  border-color: rgb(255, 60, 60);
  box-shadow: 0 0 12px rgba(255, 60, 60, 0.4);
  color: rgb(255, 60, 60);
}

.btn-hub.amber-btn {
  color: rgb(240, 110, 20);
  border-color: rgba(240, 110, 20, 0.6);
}

.btn-hub.amber-btn:hover {
  background-color: rgba(240, 110, 20, 0.1);
  border-color: rgb(240, 110, 20);
  box-shadow: 0 0 12px rgba(240, 110, 20, 0.4);
  color: rgb(240, 110, 20);
}

/* Controls command console */
.settings-box.controls-console {
  width: min(760px, calc(100vw - 48px));
  padding: 0;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(0, 220, 255, 0.85);
  box-shadow: 0 0 0 3px #000, 0 0 0 4px rgba(0, 220, 255, 0.28), 0 0 42px rgba(0, 220, 255, 0.24);
  background:
    linear-gradient(90deg, rgba(0, 220, 255, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(0, 220, 255, 0.02) 1px, transparent 1px),
    #020708;
  background-size: 22px 22px;
}

.controls-header {
  position: relative;
  padding: 18px 22px 16px;
  border-bottom: 1px solid rgba(0, 220, 255, 0.35);
  background: linear-gradient(90deg, rgba(0, 220, 255, 0.12), transparent 62%);
}

.controls-header::after {
  content: "CHANNEL 04 // AUTHORIZED";
  position: absolute;
  top: 18px;
  right: 22px;
  color: rgba(0, 220, 255, 0.54);
  font-size: 9px;
  letter-spacing: 1.3px;
}

.controls-kicker {
  color: rgb(240, 110, 20);
  font-size: 9px;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.settings-box .controls-header h2 {
  margin: 0;
  text-align: left;
  font-size: 19px;
  line-height: 1.1;
  letter-spacing: 2px;
  white-space: normal;
  font-weight: bold;
  text-shadow: 0 0 12px rgba(0, 220, 255, 0.7);
}

.controls-header p {
  margin: 7px 0 0;
  color: rgb(145, 160, 162);
  font-size: 10px;
  letter-spacing: 0.45px;
}

.controls-layout {
  display: grid;
  grid-template-columns: minmax(215px, 0.82fr) minmax(390px, 1.55fr);
  min-height: 420px;
}

.control-module {
  min-width: 0;
  padding: 17px 18px;
}

.pointer-module {
  border-right: 1px solid rgba(0, 220, 255, 0.25);
  background: rgba(0, 220, 255, 0.025);
}

.module-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 22px;
  padding-bottom: 8px;
  margin-bottom: 13px;
  border-bottom: 1px dashed rgba(0, 220, 255, 0.35);
  color: rgb(0, 220, 255);
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1.05px;
}

.module-state {
  color: rgba(0, 255, 160, 0.76);
  font-size: 8px;
  letter-spacing: 0.8px;
}

.controls-toggle {
  min-height: 40px;
  padding: 8px 9px;
  margin-bottom: 18px;
  border-left: 2px solid rgb(0, 220, 255);
  background: rgba(0, 220, 255, 0.055);
}

.controls-toggle .checkbox-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  color: rgb(192, 204, 205);
}

.controls-toggle .checkbox-label small {
  color: rgb(96, 119, 122);
  font-size: 8px;
  letter-spacing: 0.8px;
}

.controls-slider {
  margin-bottom: 18px;
}

.controls-slider label {
  color: rgb(151, 168, 170);
  font-size: 9px;
  letter-spacing: 0.9px;
}

.controls-slider label span {
  min-width: 42px;
  text-align: right;
  color: rgb(0, 240, 255);
}

.controls-slider label b {
  font-size: 13px;
}

.controls-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: linear-gradient(90deg, rgb(0, 220, 255) 0 var(--range-fill, 31%), rgba(0, 220, 255, 0.18) var(--range-fill, 31%) 100%);
}

.pointer-readout {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(0, 220, 255, 0.45);
  font-size: 8px;
  letter-spacing: 1px;
}

.pointer-readout i {
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(0, 220, 255, 0.4) 0 2px, transparent 2px 6px);
}

.binding-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px 18px;
}

.binding-group.camera-group {
  grid-column: 1 / -1;
}

.binding-group h3 {
  margin: 0 0 5px;
  color: rgba(240, 110, 20, 0.85);
  font-size: 8px;
  font-weight: normal;
  letter-spacing: 1.2px;
}

.binding-grid {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid rgba(0, 220, 255, 0.16);
}

.camera-group .binding-grid {
  grid-template-columns: 1fr 1fr;
  column-gap: 18px;
}

.binding-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 34px;
  gap: 8px;
  border-bottom: 1px solid rgba(0, 220, 255, 0.12);
  color: rgb(150, 164, 166);
  font-size: 9px;
  letter-spacing: 0.35px;
  transition: color 0.12s ease, background-color 0.12s ease;
}

.binding-row:hover,
.binding-row:focus-within {
  color: rgb(221, 231, 232);
  background: linear-gradient(90deg, rgba(0, 220, 255, 0.05), transparent);
}

.btn-bind {
  min-width: 72px;
  min-height: 25px;
  border: 1px solid rgba(0, 220, 255, 0.52);
  background: rgba(0, 12, 14, 0.92);
  color: rgb(0, 220, 255);
  font: bold 10px/1 Consolas, monospace;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.btn-bind:hover,
.btn-bind:focus-visible {
  outline: none;
  border-color: rgb(240, 110, 20);
  color: rgb(240, 110, 20);
  background: rgba(240, 110, 20, 0.08);
  box-shadow: 0 0 10px rgba(240, 110, 20, 0.22);
}

.btn-bind.listening {
  min-width: 94px;
  color: #020708;
  border-color: rgb(0, 240, 255);
  background: rgb(0, 220, 255);
  animation: controlBindPulse 0.72s steps(2, end) infinite;
}

@keyframes controlBindPulse {
  50% { background: rgb(240, 110, 20); border-color: rgb(240, 110, 20); }
}

.controls-status {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-height: 31px;
  padding: 0 18px;
  border-top: 1px solid rgba(0, 220, 255, 0.25);
  border-bottom: 1px solid rgba(0, 220, 255, 0.25);
  color: rgb(0, 255, 160);
  background: rgba(0, 255, 160, 0.035);
  font-size: 8px;
  letter-spacing: 0.85px;
}

.controls-status[data-tone="active"] { color: rgb(240, 110, 20); background: rgba(240, 110, 20, 0.05); }

.status-pulse {
  width: 5px;
  height: 5px;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
}

.controls-status kbd {
  padding: 2px 5px;
  border: 1px solid rgba(0, 220, 255, 0.38);
  color: rgb(0, 220, 255);
  background: #000;
  font: 8px Consolas, monospace;
}

.controls-status small { color: rgb(92, 112, 115); font-size: 7px; }

.controls-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 13px 18px 15px;
}

.controls-actions .btn-hub {
  margin: 0;
  padding: 8px;
  font-size: 10px;
}

.controls-reset { color: rgb(143, 159, 161); border-color: rgba(143, 159, 161, 0.45); }

@media (max-width: 700px) {
  .settings-box.controls-console { overflow-y: auto; }
  .controls-layout { grid-template-columns: 1fr; }
  .pointer-module { border-right: 0; border-bottom: 1px solid rgba(0, 220, 255, 0.25); }
  .binding-groups { grid-template-columns: 1fr; }
  .binding-group.camera-group { grid-column: auto; }
  .camera-group .binding-grid { grid-template-columns: 1fr; }
  .controls-header::after { display: none; }
}

/* Achievement Notification Toast */
.achievement-toast {
  position: absolute;
  bottom: 24px;
  right: -350px; /* Start hidden off-screen */
  width: 320px;
  height: 64px;
  background-color: rgba(0, 0, 0, 0.95);
  border: 2px solid rgb(0, 220, 255);
  box-shadow: 0 0 15px rgba(0, 220, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  z-index: 5000;
  font-family: 'Consolas', 'Courier New', monospace;
  color: #fff;
  box-sizing: border-box;
  transition: right 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.achievement-toast.show {
  right: 24px; /* Slide in */
}

.achievement-icon-container {
  width: 48px;
  height: 48px;
  border: 1px solid rgb(0, 220, 255);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.achievement-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.achievement-title {
  font-size: 10px;
  color: rgb(0, 220, 255);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 2px 0;
  font-weight: bold;
}

.achievement-name {
  font-size: 13px;
  color: rgb(240, 110, 20); /* Amber */
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 1px 0;
}

.achievement-desc {
  font-size: 10px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

/* Key Bindings UI Buttons Styling */
.btn-bind {
  background-color: transparent;
  color: rgb(255, 130, 20);
  border: 1px dashed rgba(255, 130, 20, 0.6);
  border-radius: 0;
  padding: 4px 10px;
  font-family: inherit;
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
  min-width: 100px;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-bind:hover {
  background-color: rgba(255, 130, 20, 0.1);
  border-style: solid;
  border-color: rgb(255, 130, 20);
  box-shadow: 0 0 8px rgba(255, 130, 20, 0.4);
}

.btn-bind.listening {
  color: rgb(0, 220, 255);
  border-color: rgb(0, 220, 255);
  border-style: solid;
  animation: pulse-border 1s infinite alternate;
}

@keyframes pulse-border {
  from { box-shadow: 0 0 4px rgba(0, 220, 255, 0.4); }
  to { box-shadow: 0 0 12px rgba(0, 220, 255, 0.8); }
}


