/* Global Styles */
:root {
  /* Outer CRT bezel: never larger than this box, still matches viewport aspect */
  --terminal-max-w: 1920px;
  --terminal-max-h: 1080px;
}

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

/* Base font size for responsive scaling */
html {
  font-size: 16px; /* Base size for calculations */
}

/* Responsive font sizes for different screen sizes */
@media (max-width: 1200px) {
  html {
    font-size: 14px;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 10px;
  }
}

body {
  font-family: 'VT323', 'Courier New', monospace;
  background-color: #000;
  color: #0f0;
  overflow: hidden;
  font-size: 1.25rem; /* Using rem for responsive sizing */
  letter-spacing: 1px; /* Slightly spread out letters like old CRTs */
  line-height: 1.2;
  text-shadow: 0 0 2px #0f0; /* Subtle glow */
}

/* Terminal Screen Styles */
.terminal-screen {
  user-select: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  overflow: hidden;
}

.terminal-content {
  /* Viewport-shaped inset, capped by --terminal-max-w/h. Width may hit --terminal-max-w
     on ultrawide; height must NOT be forced down by that cap (old 4th min() term did
     calc(max-w * vh/vw) and produced a paper-thin bezel + clipped UI). */
  width: min(
    95vw,
    calc(95vh * 100vw / 100vh),
    var(--terminal-max-w),
    calc(var(--terminal-max-h) * 100vw / 100vh)
  );
  height: min(
    95vh,
    calc(95vw * 100vh / 100vw),
    var(--terminal-max-h)
  );
  padding: 2.5rem; /* Using rem for responsive padding */
  border: 4px solid #0f0;
  box-shadow: 0 0 20px #0f0, inset 0 0 10px rgba(0, 255, 0, 0.3);
  background-color: rgba(0, 10, 0, 0.9);
  position: relative;
  /* CRT screen effect */
  border-radius: 10px;
  /* Add subtle bulge effect */
  box-shadow: 0 0 20px #0f0, 
              inset 0 0 10px rgba(0, 255, 0, 0.3),
              inset 0 0 30px rgba(0, 20, 0, 0.5);
  /* Add subtle barrel distortion */
  border-radius: 15px;
  overflow-x: hidden;
  overflow-y: auto;
  /* Add background color flicker animation */
  animation: bgFlicker 8s infinite;
  /* Add flex layout to better position content */
  display: flex;
  flex-direction: column;
  /* Force hardware acceleration to maintain 3D effect */
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
}

/* CRT bulge overlay */
.terminal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 10, 0, 0) 0%,
    rgba(0, 10, 0, 0) 70%,
    rgba(0, 10, 0, 0.2) 80%,
    rgba(0, 10, 0, 0.5) 100%
  );
  pointer-events: none;
  z-index: 2;
  border-radius: 15px;
}

/* Add darker corners for more pronounced curvature */
.terminal-content::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at top left, rgba(0, 0, 0, 0.5) 0%, transparent 20%),
    radial-gradient(circle at top right, rgba(0, 0, 0, 0.5) 0%, transparent 20%),
    radial-gradient(circle at bottom left, rgba(0, 0, 0, 0.5) 0%, transparent 20%),
    radial-gradient(circle at bottom right, rgba(0, 0, 0, 0.5) 0%, transparent 20%);
  pointer-events: none;
  z-index: 3;
  border-radius: 15px;
}

/* Add a subtle distortion to the content */
.terminal-content > * {
  position: relative;
  z-index: 5;
}

.terminal-content h1, .terminal-content h2 {
  text-align: center;
  margin-bottom: 2rem; /* Using rem for responsive margin */
  text-shadow: 0 0 8px #0f0;
  font-size: 3.5rem; /* Using rem for responsive font size */
  letter-spacing: 2px;
  font-weight: normal; /* Old terminals didn't have bold text */
  /* Add subtle text distortion */
  transform: scale(1, 1.03);
}

.ascii-art {
  text-align: center;
  margin: 2.5rem 0; /* Using rem for responsive margin */
  font-size: 1rem; /* Using rem for responsive font size */
  line-height: 1;
  transform: scale(1.5); /* Increased from 1.2 */
  transform-origin: center;
}

/* Adjust ASCII art scaling for smaller screens */
@media (max-width: 768px) {
  .ascii-art {
    transform: scale(1.2);
  }
}

@media (max-width: 480px) {
  .ascii-art {
    transform: scale(1);
    font-size: 0.8rem;
  }
}

.loading-bar {
  width: 100%;
  height: 2.5rem; /* Using rem for responsive height */
  border: 2px solid #0f0;
  margin: 2.5rem 0; /* Using rem for responsive margin */
  position: relative;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.progress {
  height: 100%;
  width: 0%;
  background-color: #0f0;
  transition: width 0.5s ease;
  box-shadow: 0 0 15px #0f0;
}

.terminal-text {
  height: 15rem;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-top: 1rem;
  text-transform: uppercase;
  /* Ensure this element doesn't create its own stacking context that breaks the parent transform */
  transform: translateZ(0); /* Force the element onto the GPU without affecting visible transform */
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  /* Hide scrollbar for Chrome/Safari/Opera */
  &::-webkit-scrollbar {
    display: none;
  }
}

.terminal-text p {
  margin: 1.25rem 0; /* Using rem for responsive margin */
  font-size: 1.8rem; /* Using rem for responsive font size */
  letter-spacing: 1px;
}

.blink {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Game Container Styles */
#game-container {
  position: fixed;
  user-select: none;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  z-index: 200;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-color: #000;
  display: block;
}

/* HUD Styles */
#hud {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.bar {
  width: 200px;
  height: 20px;
  background-color: rgba(0, 0, 0, 0.7);
  border: 1px solid #0f0;
  position: relative;
  display: flex;
  align-items: center;
  padding-left: 5px;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.bar-label {
  color: #0f0;
  font-size: 14px;
  z-index: 2;
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.7);
  margin-right: 5px;
}

.bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background-color: #0f0;
  width: 100%;
  z-index: 1;
  opacity: 0.5;
  transition: width 0.3s ease;
}

#health-bar .bar-fill {
  background-color: #0f0;
}

#energy-bar .bar-fill {
  background-color: #00f;
}

#ability-cooldowns {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.ability {
  width: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.7);
  border: 1px solid #0f0;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  color: #0f0;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.cooldown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  font-size: 16px;
}

#upgrade-points {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #0f0;
  font-size: 16px;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 10px;
  border: 1px solid #0f0;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

/* Menu Styles */
.menu-options {
  list-style: none;
  margin: 2.5rem 0; /* Using rem for responsive margin */
}

.menu-options li {
  margin: 1.875rem 0; /* Using rem for responsive margin */
  cursor: pointer;
  transition: color 0.2s;
  font-size: 2rem;
  text-align: center;
  text-shadow: 0 0 5px #0f0;
  letter-spacing: 2px;
}

/* Adjust menu item size for smaller screens */
@media (max-width: 768px) {
  .menu-options li {
    font-size: 1.75rem;
    margin: 1.5rem 0;
  }
}

@media (max-width: 480px) {
  .menu-options li {
    font-size: 1.2rem;
    margin: 1.2rem 0;
  }
}

.menu-options li:hover {
  color: #fff;
  text-shadow: 0 0 15px #0f0, 0 0 20px #0f0;
  transform: scale(1.05);
  transition: all 0.2s ease;
}

/* Enhanced Scanline effect */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.3) 50%);
  background-size: 100% 0.25rem; /* Using rem for responsive sizing */
  z-index: 1000;
  pointer-events: none;
  opacity: 0.3; /* More visible scanlines */
}

/* CRT flicker effect */
@keyframes flicker {
  0% { opacity: 0.97; }
  5% { opacity: 0.9; }
  10% { opacity: 0.97; }
  15% { opacity: 1; }
  20% { opacity: 0.97; }
  25% { opacity: 0.9; }
  30% { opacity: 0.97; }
  35% { opacity: 0.95; }
  40% { opacity: 0.98; }
  45% { opacity: 0.97; }
  50% { opacity: 0.99; }
  55% { opacity: 0.95; }
  60% { opacity: 0.97; }
  65% { opacity: 0.95; }
  70% { opacity: 0.97; }
  75% { opacity: 0.92; }
  80% { opacity: 0.97; }
  85% { opacity: 0.95; }
  90% { opacity: 0.97; }
  95% { opacity: 0.93; }
  100% { opacity: 0.97; }
}

/* Terminal background color flicker */
@keyframes bgFlicker {
  0% { background-color: rgba(0, 10, 0, 0.9); }
  25% { background-color: rgba(0, 10, 0, 0.9); }
  30% { background-color: rgba(2, 22, 2, 0.9); }
  35% { background-color: rgba(0, 10, 0, 0.9); }
  65% { background-color: rgba(0, 10, 0, 0.9); }
  70% { background-color: rgba(2, 22, 2, 0.9); }
  75% { background-color: rgba(0, 10, 0, 0.9); }
  90% { background-color: rgba(0, 10, 0, 0.9); }
  95% { background-color: rgba(1, 15, 1, 0.9); }
  100% { background-color: rgba(0, 10, 0, 0.9); }
}

/* CRT glitch effect */
@keyframes glitch {
  0% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
  100% {
    transform: translate(0);
  }
}

/* Horizontal scan line glitch */
@keyframes scanlineGlitch {
  0% {
    opacity: 0;
    transform: translateY(-6.25rem);
  }
  10%, 100% {
    opacity: 0;
    transform: translateY(31.25rem);
  }
  10.5% {
    opacity: 1;
  }
  11% {
    opacity: 0;
  }
  11.5% {
    opacity: 1;
  }
  12% {
    opacity: 0;
  }
  12.5% {
    opacity: 1;
  }
}

/* Multiple scan lines with different timings - adjust for larger terminal */
@keyframes scanline1 {
  0%, 20% { opacity: 0; transform: translateY(-1.875rem); }
  21% { opacity: 0.7; }
  30% { opacity: 0.7; transform: translateY(80vh); }
  31%, 100% { opacity: 0; }
}

@keyframes scanline2 {
  0%, 45% { opacity: 0; transform: translateY(-1.875rem); }
  46% { opacity: 0.6; }
  55% { opacity: 0.6; transform: translateY(80vh); }
  56%, 100% { opacity: 0; }
}

@keyframes scanline3 {
  0%, 70% { opacity: 0; transform: translateY(-1.875rem); }
  71% { opacity: 0.8; }
  80% { opacity: 0.8; transform: translateY(80vh); }
  81%, 100% { opacity: 0; }
}

body {
  animation: flicker 5s infinite;
}

/* Add scan lines contained within the terminal (same treatment on death overlay CRT) */
.terminal-content .scanline1,
.terminal-content .scanline2,
.terminal-content .scanline3,
.connection-terminated-overlay__crt .scanline1,
.connection-terminated-overlay__crt .scanline2,
.connection-terminated-overlay__crt .scanline3 {
  position: absolute;
  left: 0;
  width: 100%;
  height: 0.25rem; /* Using rem for responsive height */
  background-color: rgba(0, 255, 0, 0.15);
  pointer-events: none;
  z-index: 10;
}

.terminal-content .scanline1,
.connection-terminated-overlay__crt .scanline1 {
  top: 30%;
  animation: scanline1 7s infinite;
}

.terminal-content .scanline2,
.connection-terminated-overlay__crt .scanline2 {
  top: 50%;
  animation: scanline2 9s infinite;
}

.terminal-content .scanline3,
.connection-terminated-overlay__crt .scanline3 {
  top: 70%;
  animation: scanline3 8s infinite;
}

/* CRT vignette effect */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, transparent 60%, rgba(0, 0, 0, 0.25) 100%);
  z-index: 999;
  pointer-events: none;
}

/* Additional responsive adjustments */

/* Portrait orientation on mobile devices */
@media (max-width: 768px) and (orientation: portrait) {
  .terminal-content {
    width: min(
      92vw,
      calc(92vh * 100vw / 100vh),
      var(--terminal-max-w),
      calc(var(--terminal-max-h) * 100vw / 100vh)
    );
    height: min(
      92vh,
      calc(92vw * 100vh / 100vw),
      var(--terminal-max-h)
    );
    padding: 1.5rem;
  }
  
  .terminal-content h1, .terminal-content h2 {
    font-size: 2.8rem;
    margin-bottom: 1.5rem;
  }
  
  .ascii-art {
    margin: 1.5rem 0;
    transform: scale(1);
  }
  
  .loading-bar {
    height: 1.8rem;
    margin: 1.5rem 0;
  }
  
  .terminal-text p {
    font-size: 1.5rem;
    margin: 1rem 0;
  }
}

/* Landscape orientation on mobile devices */
@media (max-height: 500px) and (orientation: landscape) {
  .terminal-content {
    width: min(
      92vw,
      calc(88vh * 100vw / 100vh),
      var(--terminal-max-w),
      calc(var(--terminal-max-h) * 100vw / 100vh)
    );
    height: min(
      88vh,
      calc(92vw * 100vh / 100vw),
      var(--terminal-max-h)
    );
    padding: 1rem;
  }
  
  .terminal-content h1, .terminal-content h2 {
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
  }
  
  .ascii-art {
    margin: 0.8rem 0;
    transform: scale(0.8);
  }
  
  .loading-bar {
    height: 1.5rem;
    margin: 0.8rem 0;
  }
  
  .terminal-text p {
    font-size: 1.2rem;
    margin: 0.6rem 0;
  }
  
  .menu-options {
    margin: 1rem 0;
  }
  
  .menu-options li {
    font-size: 1.5rem;
    margin: 0.8rem 0;
  }
}

/* Very small screens */
@media (max-width: 320px) {
  html {
    font-size: 8px;
  }
  
  .terminal-content {
    padding: 1rem;
    width: min(
      95vw,
      calc(95vh * 100vw / 100vh),
      var(--terminal-max-w),
      calc(var(--terminal-max-h) * 100vw / 100vh)
    );
    height: min(
      95vh,
      calc(95vw * 100vh / 100vw),
      var(--terminal-max-h)
    );
  }
  
  .ascii-art {
    transform: scale(0.7);
    font-size: 0.7rem;
  }
  
  .terminal-content h1, .terminal-content h2 {
    font-size: 2.5rem;
  }
}

/* High-resolution displays */
@media (min-width: 1600px) {
  html {
    font-size: 18px;
  }
}

/* Short but wide viewports (e.g. full width, half height on a large monitor): keep
   the CRT readable without clipping. */
@media (max-height: 780px) and (min-width: 600px) {
  html {
    font-size: 14px;
  }

  .terminal-content {
    padding: 1.1rem 1.25rem;
  }

  .terminal-content h1,
  .terminal-content h2 {
    font-size: 2.4rem;
    margin-bottom: 0.65rem;
  }

  .ascii-art {
    margin: 0.65rem 0;
    transform: scale(0.88);
  }

  .loading-bar {
    height: 1.75rem;
    margin: 1rem 0;
  }

  .menu-options {
    margin: 1rem 0;
  }

  .menu-options li {
    font-size: 1.35rem;
    margin: 0.55rem 0;
  }

  .login-options .menu-option {
    margin: 0.45rem 0;
    padding: 0.35rem 0;
    font-size: 1.35rem;
  }
}

@media (min-width: 1600px) and (max-height: 820px) {
  html {
    font-size: 15px;
  }
}

/* Login Menu Styles */
.login-options {
  /* margin: 3rem 0; */
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-options .menu-options {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 80%;
  max-width: 500px;
}

.login-options .menu-option {
  margin: 1.5rem 0;
  padding: 0.8rem 0;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 2rem;
  text-align: center;
  text-shadow: 0 0 5px #0f0;
  letter-spacing: 2px;
  position: relative;
  border: 2px solid transparent;
}

.login-options .menu-option.menu-option--auth-hidden {
  display: none !important;
}

.login-options .menu-option.selected {
  color: #fff;
  text-shadow: 0 0 15px #0f0, 0 0 20px #0f0;
  transform: scale(1.05);
  border: 2px solid #0f0;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5), inset 0 0 5px rgba(0, 255, 0, 0.2);
  background-color: rgba(0, 255, 0, 0.05);
  border-radius: 5px;
}

.login-options .menu-option .selector {
  position: absolute;
  left: 1rem;
  animation: blink 1s step-end infinite;
}

/* Responsive adjustments for login menu */
@media (max-width: 768px) {
  .login-options .menu-option {
    font-size: 2rem;
    margin: 1.2rem 0;
    padding: 0.6rem 0;
  }
  
  .login-options .menu-option .selector {
    left: 0.8rem;
  }
}

@media (max-width: 480px) {
  .login-options .menu-option {
    font-size: 1.8rem;
    margin: 1rem 0;
    padding: 0.5rem 0;
  }
  
  .login-options .menu-option .selector {
    left: 0.6rem;
  }
  
  .login-options .menu-options {
    width: 90%;
  }
}

#loading-section, #login-section {
  width: 100%;
  transition: opacity 0.8s ease;
  display: flex;
  flex-direction: column;
}

#login-section {
  opacity: 0;
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-bottom: 0;
  /* Negative = shift menu up from geometric center (px only — JS reads parseFloat). */
  --home-menu-vertical-nudge: -40px;
}

.login-text {
  margin: 0;
  height: auto;
  min-height: 0;
  overflow: visible;
  justify-content: flex-start;
  padding-bottom: 0;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
}

.login-text p {
  margin: 0;
}

#login-section .login-options {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0;
}

.home-audio-btn {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 2px solid rgba(0, 255, 0, 0.45);
  border-radius: 4px;
  background: rgba(0, 20, 0, 0.75);
  color: #0f0;
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.25);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  font: inherit;
}

.home-audio-btn:hover {
  border-color: #0f0;
  box-shadow: 0 0 12px rgba(0, 255, 0, 0.45);
  color: #6f6;
}

.home-audio-btn:focus-visible {
  outline: 2px solid #0f0;
  outline-offset: 2px;
}

.home-audio-btn .home-audio-icon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.home-audio-btn--on .home-audio-icon--off {
  display: none;
}

.home-audio-btn:not(.home-audio-btn--on) .home-audio-icon--on {
  display: none;
}

/* Signup Form Styles */
.signup-form {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 5px;
}

.form-group {
  width: 100%;
  margin-bottom: 1.5rem;
  position: relative;
}

.form-group label {
  display: block;
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 5px #0f0;
  letter-spacing: 1px;
}

.form-group input {
  width: 100%;
  background-color: rgba(0, 20, 0, 0.7);
  border: 2px solid #0f0;
  color: #0f0;
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 1.8rem;
  padding: 0.8rem 1rem;
  outline: none;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3), inset 0 0 5px rgba(0, 255, 0, 0.2);
  transition: all 0.3s ease;
}

/* Form field glitch effect for errors */
@keyframes formFieldGlitch {
  0% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  50% { transform: translateX(2px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

/* Focus state without animation */
.form-group input:focus {
  border-color: #0f0;
  box-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.form-group .error-message {
  color: #fff;
  font-size: 1.4rem;
  margin-top: 0.5rem;
  text-shadow: 0 0 5px #ff3333;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Error state with glitch animation */
.form-group.error input {
  border-color: #ff3333;
  box-shadow: 0 0 10px rgba(255, 51, 51, 0.3), inset 0 0 5px rgba(255, 51, 51, 0.2);
  animation: formFieldGlitch 0.3s ease-in-out 3; /* Play the animation 3 times */
}

.form-group.error .error-message {
  opacity: 1;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 2rem;
}

.form-button {
  background-color: rgba(0, 20, 0, 0.7);
  border: 2px solid #0f0;
  color: #0f0;
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 1.8rem;
  padding: 0.8rem 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 0 0 5px #0f0;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
  letter-spacing: 1px;
}

.form-button:hover {
  background-color: #0f0;
  color: #000;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
  text-shadow: none;
}

.form-button.primary {
  background-color: rgba(0, 40, 0, 0.8);
}

/* Primary comes after :hover in the sheet with equal specificity; without this, hover
   keeps color:#000 but background reverts to dark green — text vanishes. */
.form-button.primary:hover {
  background-color: #0f0;
  color: #000;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
  text-shadow: none;
}

.form-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-button:disabled:hover {
  background-color: rgba(0, 20, 0, 0.7);
  color: #0f0;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
  text-shadow: 0 0 5px #0f0;
}

.form-button.primary:disabled:hover {
  background-color: rgba(0, 40, 0, 0.8);
}

/* Password strength indicator */
.password-strength {
  height: 5px;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.3);
  margin-top: 0.5rem;
  position: relative;
  overflow: hidden;
}

.password-strength-bar {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength-bar.weak {
  width: 33.33%;
  background-color: #ff3333;
  box-shadow: 0 0 10px #ff3333;
}

.password-strength-bar.medium {
  width: 66.66%;
  background-color: #ffcc00;
  box-shadow: 0 0 10px #ffcc00;
}

.password-strength-bar.strong {
  width: 100%;
  background-color: #0f0;
  box-shadow: 0 0 10px #0f0;
}

.password-strength-text {
  font-size: 1.2rem;
  margin-top: 0.3rem;
  text-align: right;
}

/* Back button */
.back-button {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-size: 1.6rem;
  color: #0f0;
  text-decoration: none;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.back-button:hover {
  text-shadow: 0 0 8px #0f0;
}

.back-button::before {
  content: "<<";
  margin-right: 0.5rem;
}

/* Form section transition */
#signup-section {
  opacity: 0;
  display: none;
  width: 100%;
  transition: opacity 0.8s ease;
  flex-grow: 1; /* Allow the signup section to take available space */
  display: flex;
  flex-direction: column;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #0f0 #001400;  
}

#signup-section.active {
  opacity: 1;
  display: flex;
}

/* Terminal header transition */
.terminal-header {
  transition: opacity 0.5s ease, margin 0.5s ease, height 0.5s ease;
}

/* Back button positioning when header is hidden */
#signup-section .back-button {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  font-size: 1.6rem;
  z-index: 10;
}

/* Adjust terminal text area in signup section */
.signup-text {
  margin-top: 1.5rem;
}

.signin-text:empty,
.signup-text:empty {
  display: none;
  margin: 0;
  padding: 0;
  min-height: 0;
}

/* Make form more compact */
#signup-section .form-group {
  margin-bottom: 1.2rem;
}

#signup-section .form-group label {
  margin-bottom: 0.3rem;
}

/* Responsive adjustments for the signup form */
@media (max-height: 700px) {
  #signup-section .form-group {
    margin-bottom: 0.8rem;
  }
  
  #signup-section .form-group label {
    font-size: 1.5rem;
  }
  
  #signup-section .form-group input {
    padding: 0.5rem 0.8rem;
    font-size: 1.5rem;
  }
  
  #signup-section .form-actions {
    margin-top: 1.2rem;
  }
  
  #signup-section .form-button {
    padding: 0.5rem 1.2rem;
    font-size: 1.5rem;
  }
  
  .signup-text p {
    margin: 0.8rem 0;
    font-size: 1.5rem;
  }
}

/* Even more compact for very small screens */
@media (max-height: 600px) {
  .signup-form {
    padding-top: 1rem;
  }
  
  #signup-section .form-group {
    margin-bottom: 0.5rem;
  }
  
  #signup-section .form-group label {
    font-size: 1.3rem;
  }
  
  #signup-section .form-group input {
    padding: 0.4rem 0.6rem;
    font-size: 1.3rem;
  }
  
  #signup-section .form-actions {
    margin-top: 0.8rem;
  }
  
  #signup-section .form-button {
    padding: 0.4rem 1rem;
    font-size: 1.3rem;
  }
  
  .signup-text {
    margin-top: 0.8rem;
  }
  
  .signup-text p {
    margin: 0.5rem 0;
    font-size: 1.3rem;
  }
  
  #signup-section .back-button {
    top: 1rem;
    left: 1rem;
    font-size: 1.3rem;
  }
}

/* Sign-in Form Styles */
.signin-form {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 5px;
}

.signin-form h2 {
  margin-bottom: 2rem;
}

.remember-me {
  width: 100%;
  display: flex;
  align-items: center;
  margin: 1rem 0;
}

.remember-me input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.5rem;
  height: 1.5rem;
  background-color: rgba(0, 20, 0, 0.7);
  border: 2px solid #0f0;
  margin-right: 0.8rem;
  position: relative;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
  transition: all 0.2s ease;
}

.remember-me input[type="checkbox"]:checked {
  background-color: rgba(0, 40, 0, 0.8);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.remember-me input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  color: #0f0;
  font-size: 1.2rem;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-shadow: 0 0 5px #0f0;
}

.remember-me label {
  font-size: 1.4rem;
  cursor: pointer;
  text-shadow: 0 0 5px #0f0;
}

.forgot-password {
  width: 100%;
  text-align: center;
  margin-top: 1.5rem;
}

.forgot-password a {
  color: #0f0;
  text-decoration: none;
  font-size: 1.4rem;
  text-shadow: 0 0 5px #0f0;
  transition: all 0.2s ease;
  position: relative;
}

.forgot-password a:hover {
  color: #fff;
  text-shadow: 0 0 10px #0f0;
}

.forgot-password a::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: #0f0;
  box-shadow: 0 0 5px #0f0;
  transition: all 0.2s ease;
}

.forgot-password a:hover::after {
  height: 2px;
  box-shadow: 0 0 10px #0f0;
}

/* Form section transition */
#signin-section {
  opacity: 0;
  display: none;
  width: 100%;
  transition: opacity 0.8s ease;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
  /* Custom terminal-style scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #0f0 #001400;
}

/* Custom scrollbar for webkit browsers */
#signup-section::-webkit-scrollbar,
#signin-section::-webkit-scrollbar {
  width: 8px;
}

#signup-section::-webkit-scrollbar-track,
#signin-section::-webkit-scrollbar-track {
  background: rgba(0, 20, 0, 0.7);
  border: 1px solid #0f0;
  box-shadow: inset 0 0 5px rgba(0, 255, 0, 0.2);
}

#signup-section::-webkit-scrollbar-thumb,
#signin-section::-webkit-scrollbar-thumb {
  background-color: #0f0;
  border-radius: 0px;
  box-shadow: 0 0 6px #0f0;
}

#signup-section::-webkit-scrollbar-thumb:hover,
#signin-section::-webkit-scrollbar-thumb:hover {
  background-color: #00ff00;
  box-shadow: 0 0 10px #0f0;
}

#signin-section.active {
  opacity: 1;
  display: flex;
}

/* Back button positioning when header is hidden */
#signin-section .back-button {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  font-size: 1.6rem;
  z-index: 10;
}

/* Adjust terminal text area in signin section */
.signin-text {
  margin-top: 1.5rem;
}

/* Make form more compact */
#signin-section .form-group {
  margin-bottom: 1.5rem;
}

/* Responsive adjustments for the signin form */
@media (max-height: 700px) {
  .signin-form {
    padding-top: 1.5rem;
  }
  
  .signin-form h2 {
    margin-bottom: 1.5rem;
  }
  
  #signin-section .form-group {
    margin-bottom: 1rem;
  }
  
  #signin-section .form-group label {
    font-size: 1.5rem;
  }
  
  #signin-section .form-group input {
    padding: 0.5rem 0.8rem;
    font-size: 1.5rem;
  }
  
  .remember-me {
    margin: 0.8rem 0;
  }
  
  .remember-me label {
    font-size: 1.2rem;
  }
  
  #signin-section .form-actions {
    margin-top: 1.2rem;
  }
  
  #signin-section .form-button {
    padding: 0.5rem 1.2rem;
    font-size: 1.5rem;
  }
  
  .forgot-password {
    margin-top: 1rem;
  }
  
  .forgot-password a {
    font-size: 1.2rem;
  }
  
  .signin-text p {
    margin: 0.8rem 0;
    font-size: 1.5rem;
  }
}

/* Even more compact for very small screens */
@media (max-height: 600px) {
  .signin-form {
    padding-top: 1rem;
  }
  
  .signin-form h2 {
    margin-bottom: 1rem;
    font-size: 2.8rem;
  }
  
  #signin-section .form-group {
    margin-bottom: 0.6rem;
  }
  
  #signin-section .form-group label {
    font-size: 1.3rem;
  }
  
  #signin-section .form-group input {
    padding: 0.4rem 0.6rem;
    font-size: 1.3rem;
  }
  
  .remember-me {
    margin: 0.5rem 0;
  }
  
  .remember-me input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
  }
  
  .remember-me label {
    font-size: 1.1rem;
  }
  
  #signin-section .form-actions {
    margin-top: 0.8rem;
  }
  
  #signin-section .form-button {
    padding: 0.4rem 1rem;
    font-size: 1.3rem;
  }
  
  .forgot-password {
    margin-top: 0.8rem;
  }
  
  .forgot-password a {
    font-size: 1.1rem;
  }
  
  .signin-text {
    margin-top: 0.8rem;
  }
  
  .signin-text p {
    margin: 0.5rem 0;
    font-size: 1.3rem;
  }
  
  #signin-section .back-button {
    top: 1rem;
    left: 1rem;
    font-size: 1.3rem;
  }
}

/* Character Selection Screen Styles */
#character-select-section {
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  flex-direction: column;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background-color: #000;
  color: #0f0;
  font-family: 'VT323', monospace;
  padding: 0;
  border: 1px solid #0f0;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
  z-index: 100; /* Ensure it's above other elements */
}

/* Stacked over the game: dimmed full viewport, CRT-sized panel centered (same feel as .terminal-content). */
#character-select-section.character-select--over-game {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  max-height: none;
  min-height: 0;
  padding: min(1.25rem, 2.5vh);
  box-sizing: border-box;
  background: rgba(0, 6, 2, 0.28);
  border: none;
  box-shadow: none;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
  opacity: 1 !important;
}

/* CRT-sized panel: same min() pattern as .terminal-content (pre-shrink change). */
#character-select-section.character-select--over-game .terminal-window {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  width: min(
    95vw,
    calc(95vh * 100vw / 100vh),
    var(--terminal-max-w),
    calc(var(--terminal-max-h) * 100vw / 100vh)
  );
  height: min(
    95vh,
    calc(95vw * 100vh / 100vw),
    var(--terminal-max-h)
  );
  max-width: 100%;
  max-height: min(95vh, var(--terminal-max-h));
  min-height: 0;
  background: rgba(0, 14, 6, 0.78);
  border: 3px solid rgba(0, 255, 100, 0.55);
  box-shadow: 0 0 20px rgba(0, 255, 100, 0.28), inset 0 0 16px rgba(0, 30, 14, 0.45);
  border-radius: 14px;
  overflow: hidden;
  animation: bgFlicker 8s infinite;
}

#character-select-section.character-select--over-game .terminal-window-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* When character select is active, ensure it takes full screen */
#character-select-section[style*="display: flex"] {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
}

#character-select-section:not([style*="display: none"]) ~ .terminal-header,
#character-select-section[style*="display: flex"] ~ .terminal-header,
.terminal-content.character-select-active .terminal-header:not(.character-select-header) {
  display: none !important;
}

.character-select-header {
  padding: 0.5rem 1rem;
  background-color: #0f0;
  color: #000;
  border-bottom: 1px solid #0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 50px;
  position: relative;
}

.character-select-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: bold;
  text-shadow: none;
  color: #000;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
}

/* Killed: same dark shell as home terminal + scanlines (3s hold); 3D not rendered during hold */
.connection-terminated-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background-color: rgba(0, 0, 0, 0.9);
  font-family: 'VT323', monospace;
  pointer-events: auto;
  overflow: hidden;
}

.connection-terminated-overlay__crt {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: rgba(0, 10, 0, 0.9);
  animation: bgFlicker 8s infinite;
}

.connection-terminated-overlay__panel {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.5rem 2rem 1.75rem;
  max-width: min(92vw, 420px);
  border: 4px solid #0f0;
  background-color: rgba(0, 10, 0, 0.9);
  box-shadow:
    0 0 20px #0f0,
    inset 0 0 10px rgba(0, 255, 0, 0.3),
    inset 0 0 30px rgba(0, 20, 0, 0.5);
  border-radius: 15px;
}

.connection-terminated-overlay__title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: normal;
  color: #8f8;
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(0, 255, 100, 0.45);
}

.connection-terminated-overlay__count {
  font-size: clamp(3rem, 12vw, 6rem);
  line-height: 1;
  color: #cfc;
  text-shadow: 0 0 18px rgba(0, 255, 120, 0.55);
}

.connection-terminated-overlay__hint {
  margin: 0.75rem 0 1rem;
  font-size: clamp(1rem, 2.8vw, 1.25rem);
  color: rgba(160, 255, 170, 0.75);
  letter-spacing: 0.04em;
}

.connection-terminated-overlay__panel .form-button {
  margin-top: 0.25rem;
}

/* Settings + close: same 36×36 frame and 3px border (character select + play match green headers). */
.character-select-header .crt-titlebar-btn {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  border: 3px solid #0a0a0a;
  border-radius: 0;
  background-color: transparent;
  color: #0a0a0a;
  cursor: pointer;
  flex-shrink: 0;
  font-family: 'VT323', monospace;
  text-shadow: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.character-select-header .crt-titlebar-btn__svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

.character-select-header .crt-titlebar-btn--close {
  font-size: 26px;
  font-weight: bold;
}

.character-select-header .crt-titlebar-btn--close:hover {
  background-color: #f00;
  color: #fff;
  border-color: #0a0a0a;
}

.character-select-header .crt-titlebar-btn--close:active {
  background-color: #b00;
  color: #fff;
  border-color: #0a0a0a;
}

.character-select-header .crt-titlebar-btn--settings:hover {
  background-color: #000;
  color: #0f0;
  border-color: #0a0a0a;
}

.character-select-header .crt-titlebar-btn--settings:active {
  background-color: #1a1a1a;
  color: #0f0;
  border-color: #0a0a0a;
}

.terminal-window {
  border: 1px solid #0f0;
  background-color: #000;
  padding: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.terminal-window-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  width: 100%;
  height: calc(100% - 50px); /* Subtract header height */
}

.character-select-container {
  display: flex;
  flex-direction: row;
  padding: 1rem;
  gap: 2rem;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

.character-info {
  flex: 1;
  min-width: 300px;
  max-width: 62%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background-color: rgba(0, 0, 0, 0.7);
  border: 1px solid #0f0;
  padding: 1rem;
  overflow-y: auto;
  max-height: 100%;
  scrollbar-width: thin;
  scrollbar-color: #0f0 #001400;
}

.character-info::-webkit-scrollbar-track {
  background: rgba(0, 20, 0, 0.7);
  border: 1px solid #0f0;
  box-shadow: inset 0 0 5px rgba(0, 255, 0, 0.2);
}

.character-info::-webkit-scrollbar-thumb {
  background-color: #0f0;
  border-radius: 0px;
  box-shadow: 0 0 6px #0f0;
}

.character-info::-webkit-scrollbar-thumb:hover {
  background-color: #00ff00;
  box-shadow: 0 0 10px #0f0;
}

.character-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.25rem;
}

.character-role {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(0, 255, 0, 0.6);
}

.character-info h2 {
  text-align: center;
  margin: 0;
  padding: 0.5rem;
  font-size: 1.8rem;
  font-weight: normal;
  color: #0f0;
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.7);
  letter-spacing: 1px;
}

.ability-section {
  margin-bottom: 1rem;
}

.ability-section h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.4rem;
  color: #0f0;
  border-bottom: 1px solid #0f0;
  padding-bottom: 0.3rem;
  position: relative;
}

#character-select-section .ability-section h3 {
  font-weight: normal;
}

.ability-section h3::before {
  content: '>';
  margin-right: 0.5rem;
}

/* Terminal-style attribute table */
.attributes-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-family: 'VT323', monospace;
  font-weight: normal;
  color: #cdf7cd;
}

.attributes-table td {
  padding: 0.5rem;
  border-bottom: 1px dashed rgba(0, 255, 0, 0.3);
}

.attributes-table tr:last-child td {
  border-bottom: none;
}

/* Character screen: big, easy tap targets for stat points */
#character-select-section .point-squares {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

#character-select-section .point-square {
  width: 2.25rem;
  height: 2.25rem;
  min-width: 2.25rem;
  min-height: 2.25rem;
  border: 2px solid #0f0;
  background-color: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  position: relative;
  border-radius: 2px;
}

#character-select-section .point-square:hover {
  background-color: rgba(0, 255, 0, 0.25);
  transform: scale(1.05);
}

#character-select-section .point-square:focus-visible {
  outline: 2px solid #ff0;
  outline-offset: 3px;
}

#character-select-section .point-square.filled {
  background-color: #0f0;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.65);
}

#character-select-section .attributes-table td:first-child {
  vertical-align: middle;
  font-size: 1.15rem;
  font-weight: normal;
  padding-right: 1rem;
  width: 38%;
}

#character-select-section .attributes-table__stat-row {
  cursor: default;
}

#character-select-section .attributes-table td:last-child {
  vertical-align: middle;
}

/* Top account row — copy `.player-status-bar` markup to lobby or other screens later */
.player-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.75rem 2rem;
  padding: 0.6rem 1rem 0.65rem;
  background: rgba(0, 28, 0, 0.92);
  border-bottom: 1px solid rgba(0, 255, 0, 0.4);
  flex-shrink: 0;
}

.player-status-bar__item {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 4.5rem;
}

.player-status-bar__label {
  font-size: 0.85rem;
  color: rgba(0, 255, 0, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.player-status-bar__value {
  font-size: 1.45rem;
  color: #e8ffe8;
  line-height: 1.15;
}

.player-status-bar__item--wallet .player-status-bar__value {
  color: #ff0;
  font-size: 1.65rem;
}

.character-details-block {
  margin-bottom: 0.75rem;
}

.character-detail-body {
  margin: 0.25rem 0 0 0;
  font-size: 1.15rem;
  line-height: 1.35;
  font-weight: normal;
  color: rgba(220, 255, 220, 0.95);
}

.hero-loadout-hint {
  margin: 0.85rem 0 0;
  min-height: 3.25rem;
  font-size: 1.08rem;
  line-height: 1.45;
  font-weight: normal;
  color: rgba(210, 255, 150, 0.92);
}

#confirm-character {
  margin-top: 1.5rem;
  padding: 0.9rem 2rem;
  background-color: rgba(0, 50, 0, 0.7);
  color: #0f0;
  border: 2px solid #0f0;
  font-family: 'VT323', monospace;
  font-size: 1.6rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  align-self: center;
  width: 80%;
  max-width: 300px;
  position: relative;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.7);
  animation: pulse-glow 2s infinite;
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1rem;
  margin-top: auto;
}

/* Preview column: QUIT GAME | PLAY / SWITCH — side by side */
#character-confirm-actions #confirm-character {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  max-width: 14rem;
  margin: 0;
  align-self: stretch;
  display: block;
}

#confirm-character:hover {
  background-color: #0f0;
  color: #000;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
  text-shadow: none;
}

#confirm-character:active {
  background-color: #0c0;
  color: #000;
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 10px rgba(0, 255, 0, 0.3); }
  50% { box-shadow: 0 0 20px rgba(0, 255, 0, 0.7); }
  100% { box-shadow: 0 0 10px rgba(0, 255, 0, 0.3); }
}

/* Adjust character preview layout to ensure button fits well */
.character-preview {
  flex: 0 0 38%;
  min-width: 300px;
  max-width: 38%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: flex-start;
  height: 100%;
  min-height: 0;
}

/* Model + class row stacked; class buttons sit just under the 3D preview with room for hover */
.character-preview__stack {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  gap: 0.65rem;
}

.model-container {
  width: 100%;
  flex: 1 1 0;
  min-height: 300px;
  height: auto;
  background-color: rgba(0, 10, 0, 0.5);
  border: 1px solid #0f0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0, 255, 0, 0.2);
}

.model-container canvas {
  width: 100% !important;
  height: 100% !important;
  position: absolute;
  top: 0;
  left: 0;
  outline: none;
  z-index: 1;
}

.character-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
}

.character-silhouette {
  width: 60%;
  height: 80%;
  background-color: rgba(0, 255, 0, 0.1);
  border: 1px solid rgba(0, 255, 0, 0.3);
  position: relative;
  transition: all 0.3s ease;
}

.model-container:hover {
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

/* Terminal-style character options */
.character-options {
  display: flex;
  justify-content: space-between;
  width: 100%;
  flex-shrink: 0;
  gap: 0.5rem;
  /* Breathing room for translateY/scale and glow on .character-option */
  padding: 0.4rem 0 0.55rem;
}

.character-option {
  flex: 1;
  padding: 0.7rem 0.3rem;
  background-color: rgba(0, 20, 0, 0.7);
  color: #0f0;
  border: 1px solid #0f0;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.character-option:hover {
  background-color: rgba(0, 255, 0, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 255, 0, 0.4);
}

.character-option.active {
  background-color: #0f0;
  color: #000;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.7);
  font-weight: bold;
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .character-option {
    font-size: 0.9rem;
    padding: 0.5rem 0.2rem;
  }
}

/* Terminal window styling */
.terminal-window-header {
  display: flex;
  background-color: #0f0;
  align-items: center;
  padding: 10px 15px;
}

.terminal-window-header h2 {
  margin: 0;
  flex-grow: 1;
  text-align: center;
  font-family: 'VT323', monospace;
  color: black;
  font-size: 1.5rem;
}

.control-dots {
  display: flex;
  gap: 5px;
}

.control-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #555;
}

.control-dot:nth-child(1) {
  background-color: #000;
}

.control-dot:nth-child(2) {
  background-color: #000;
}

.control-dot:nth-child(3) {
  background-color: #000;
}

.header-buttons {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
  align-items: center;
}

/* Settings modal: real scroll is .terminal-content; lock it so the page doesn't move behind the overlay. */
html.char-select-settings-active .terminal-content {
  overflow: hidden !important;
  overscroll-behavior: none;
}

html.char-select-settings-active {
  overflow: hidden;
  overscroll-behavior: none;
}

.char-select-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.82);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

.char-select-settings-panel {
  width: min(920px, 100%);
  height: min(88vh, 840px);
  max-height: min(88vh, 840px);
  display: flex;
  flex-direction: column;
  background: #0a120a;
  border: 2px solid #0f0;
  box-shadow: 0 0 24px rgba(0, 255, 100, 0.35);
  font-family: 'VT323', monospace;
  color: #b8ffc8;
  min-height: 0;
  touch-action: auto;
  overscroll-behavior: contain;
}

.char-select-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: #0f0;
  color: #000;
}

.char-select-settings-header h3 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: bold;
}

.char-select-settings-close {
  border: 1px solid #000;
  background: transparent;
  color: #000;
  width: 2rem;
  height: 2rem;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.char-select-settings-close:hover {
  background: #000;
  color: #0f0;
}

.char-select-settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem 0;
  background: rgba(0, 32, 12, 0.92);
  border-bottom: 1px solid rgba(0, 255, 100, 0.35);
}

.char-select-settings-tab {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(0, 255, 100, 0.45);
  background: rgba(0, 0, 0, 0.35);
  color: #8cf0a8;
  cursor: pointer;
  border-radius: 2px;
}

.char-select-settings-tab:hover {
  border-color: #0f0;
  color: #c8ffd8;
}

.char-select-settings-tab.is-active {
  background: #0f0;
  color: #000;
  border-color: #0f0;
}

.char-select-settings-tabpanel {
  display: none;
  padding-top: 0.35rem;
}

.char-select-settings-tabpanel.is-active {
  display: block;
}

.char-select-settings-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  padding: 1rem 1.1rem 1.25rem;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 96, 0.75) rgba(0, 18, 8, 0.95);
}

.char-select-settings-scroll::-webkit-scrollbar {
  width: 10px;
}

.char-select-settings-scroll::-webkit-scrollbar-track {
  background: rgba(0, 18, 8, 0.92);
  border-left: 1px solid rgba(0, 255, 100, 0.28);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.45);
}

.char-select-settings-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0, 255, 120, 0.55) 0%, rgba(0, 180, 72, 0.45) 100%);
  border: 1px solid #0a5;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0, 255, 80, 0.25);
}

.char-select-settings-scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(0, 255, 160, 0.75) 0%, rgba(0, 220, 96, 0.55) 100%);
  border-color: #0f0;
}

.char-select-controls-root {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.char-select-controls-layout--stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.char-select-controls-toprow {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-start;
}

.char-select-controls-column--movement {
  flex: 0 0 auto;
}

.char-select-controls-column--mouse {
  flex: 1 1 200px;
  min-width: 160px;
}

.char-select-controls-qer-row {
  width: 100%;
}

.char-select-controls-row--qer {
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 0.5rem;
}

.char-select-controls-midrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.55rem;
  align-items: flex-start;
}

.char-select-controls-mouserow {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-start;
  justify-content: space-evenly;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
}

.char-select-controls-card--mouse .char-select-controls-mouserow {
  padding: 0;
}

.char-select-controls-card--mouse {
  margin-top: 0;
  width: 100%;
}

.char-select-mouse-bind {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  max-width: 11rem;
  text-align: center;
}

.char-select-mouse-bind__icon {
  width: 44px;
  height: 56px;
  flex-shrink: 0;
  color: #b8ffc8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-select-mouse-svg {
  width: 100%;
  height: auto;
  max-height: 54px;
  display: block;
}

.char-select-mouse-bind__label {
  font-size: 0.82rem;
  line-height: 1.25;
  opacity: 0.92;
  text-align: center;
}

.char-select-controls-card--movement {
  margin-bottom: 0;
}

.char-select-controls-card--architect {
  margin-top: 0.15rem;
}

.char-select-controls-card {
  border: 1px solid rgba(0, 255, 100, 0.35);
  background: rgba(0, 24, 8, 0.55);
  padding: 0.75rem 1rem;
}

.char-select-controls-card__title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: #0f0;
  font-weight: normal;
}

.char-select-controls-card__hint {
  margin: 0.55rem 0 0;
  font-size: 0.88rem;
  opacity: 0.85;
  line-height: 1.35;
}

.char-select-controls-card__caption {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0.88;
  color: #b8ffc8;
}

.char-select-architect-tess-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0 0 0.5rem;
}

.char-select-wasd-cluster {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
}

.char-select-wasd-cluster__row {
  display: flex;
  gap: 0.28rem;
  justify-content: center;
}

.char-select-wasd-cluster__row--top {
  justify-content: center;
}

.char-select-wasd-cluster__spacer {
  width: 2.15rem;
  height: 2.15rem;
}

.char-select-controls-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
}

.char-select-keybind {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.3rem;
  border: 1px solid rgba(0, 255, 100, 0.3);
  background: rgba(0, 20, 8, 0.5);
  text-align: center;
}

.char-select-keybind__keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  justify-content: center;
}

.char-select-keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.15rem;
  height: 2.15rem;
  padding: 0 0.4rem;
  border: 2px solid rgba(0, 255, 100, 0.65);
  border-radius: 4px;
  background: linear-gradient(180deg, #1a2e1a 0%, #0a140a 100%);
  color: #e8ffe8;
  font-family: 'VT323', monospace;
  font-size: 1.15rem;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.char-select-keycap--inline {
  display: inline-flex;
  min-width: 1.6rem;
  height: 1.6rem;
  font-size: 0.95rem;
  vertical-align: middle;
  margin: 0 0.1rem;
}

.char-select-keycap--wide {
  min-width: 4.75rem;
  padding: 0 0.45rem;
  font-size: 0.92rem;
}

.char-select-keybind__label {
  font-size: 0.82rem;
  line-height: 1.25;
  opacity: 0.9;
  max-width: 14rem;
}

.char-select-abilities-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.char-select-ability-row {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(0, 255, 100, 0.35);
  background: rgba(0, 24, 8, 0.55);
}

.char-select-ability-row__icon {
  flex-shrink: 0;
}

.char-select-ability-row__text {
  flex: 1;
  min-width: 0;
}

.char-select-ability-row__class {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  color: #0f0;
  font-weight: normal;
}

.char-select-ability-row__desc {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
  opacity: 0.9;
}

.char-select-audio-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.5rem;
}

.char-select-audio-mute-btn {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  padding: 0.45rem 1rem;
  border: 1px solid #0f0;
  background: rgba(0, 0, 0, 0.45);
  color: #b8ffc8;
  cursor: pointer;
}

.char-select-audio-mute-btn:hover {
  background: #0f0;
  color: #000;
}

.char-select-audio-mute-btn.is-muted {
  background: rgba(80, 0, 20, 0.55);
  border-color: #f66;
  color: #fcc;
}

.char-select-audio-volume-label {
  font-size: 0.95rem;
}

.char-select-audio-slider {
  flex: 1;
  min-width: 140px;
  max-width: 280px;
  accent-color: #0f0;
}

.char-select-audio-volume-readout {
  font-size: 0.95rem;
  opacity: 0.85;
  min-width: 2.75rem;
}

.char-select-settings-section {
  margin-bottom: 1.5rem;
}

.char-select-settings-section:last-child {
  margin-bottom: 0;
}

.char-select-settings-account-name {
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(0, 255, 100, 0.45);
  background: rgba(0, 20, 8, 0.55);
  color: #0f0;
  text-shadow: 0 0 4px rgba(0, 255, 100, 0.35);
}

.char-select-settings-section--account-logout {
  margin-top: 0.5rem;
}

.char-select-settings-logout-btn {
  min-width: 9rem;
}

.char-select-settings-section-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  color: #0f0;
  letter-spacing: 0.02em;
}

.char-select-settings-hint {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  opacity: 0.88;
  line-height: 1.35;
}

.char-select-settings__subheading {
  grid-column: 1 / -1;
  margin: 0.75rem 0 0.4rem;
  font-size: 1rem;
  color: #7edcff;
  font-weight: normal;
}

.char-select-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 0.65rem 0.5rem;
  align-items: start;
}

.char-select-settings-grid--buffs {
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 0.35rem 0.65rem;
  align-items: start;
}

.char-select-settings__subheading--buffs {
  grid-column: 1 / -1;
  margin: 0.4rem 0 0.15rem;
  font-size: 0.95rem;
}

.char-select-settings-grid--buffs > .char-select-settings__subheading--buffs:first-child {
  margin-top: 0;
}

.char-select-buff-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  border: none;
  background: transparent;
  text-align: center;
}

.char-select-buff-item__hud-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Appended to document.body: viewport positioning even when .terminal-content creates
   a fixed-position containing block; stays above the settings panel and buff icons. */
.char-select-buff-floater-tip {
  display: none;
  position: fixed;
  z-index: 10200;
  box-sizing: border-box;
  min-width: 11rem;
  max-width: min(18rem, calc(100vw - 24px));
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.3;
  color: #b8ffc8;
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.9);
  background: rgba(0, 24, 10, 0.97);
  border: 1px solid #0f0;
  box-shadow:
    0 0 14px rgba(0, 255, 80, 0.35),
    inset 0 0 8px rgba(0, 255, 100, 0.08);
  pointer-events: none;
  text-align: center;
}

.char-select-buff-floater-tip.is-visible {
  display: block;
}

.char-select-buff-item[tabindex='0']:focus {
  outline: none;
}

.char-select-buff-item[tabindex='0']:focus-visible {
  outline: 2px solid #0f0;
  outline-offset: 3px;
  border-radius: 3px;
}

/* In-game HUD icon frames (scoped; works before game-hud-styles is injected). */
.char-select-buff-item .hud-special {
  flex-shrink: 0;
}

.char-select-buff-item .hud-special__frame {
  position: relative;
  width: 54px;
  height: 54px;
  box-sizing: border-box;
  border: 2px solid #0a5;
  background: rgba(0, 28, 0, 0.75);
  box-shadow: inset 0 0 8px rgba(0, 255, 0, 0.12);
  transition: border-color 0.2s, box-shadow 0.2s, filter 0.2s;
}

.char-select-buff-item .hud-special__icon {
  position: absolute;
  inset: 5px;
  color: #6f6;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.char-select-buff-item .hud-special__svg {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 0 3px rgba(0, 255, 0, 0.35));
}

.char-select-buff-item .hud-status-effect--buff .hud-special__frame {
  border-color: #2f2;
  box-shadow:
    inset 0 0 8px rgba(0, 255, 0, 0.15),
    0 0 8px rgba(0, 255, 0, 0.2);
}

.char-select-buff-item .hud-status-effect--debuff .hud-special__frame {
  border-color: #f55;
  box-shadow:
    inset 0 0 8px rgba(255, 64, 64, 0.16),
    0 0 8px rgba(255, 64, 64, 0.25);
  background: rgba(28, 0, 0, 0.78);
}

.char-select-buff-item .hud-status-effect--debuff .hud-special__icon {
  color: #ff7a7a;
}

.char-select-buff-item__label {
  font-size: 0.72rem;
  line-height: 1.15;
  opacity: 0.9;
  max-width: 7.5rem;
  word-break: break-word;
}

.char-select-settings__tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.25rem 0.5rem;
  border: 1px solid rgba(0, 255, 100, 0.35);
  background: rgba(0, 24, 8, 0.65);
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: center;
}

.char-select-settings__tile--static {
  cursor: default;
}

.char-select-settings__fake-frame {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(0, 255, 100, 0.5);
  background: rgba(0, 0, 0, 0.45);
}

.char-select-settings__fake-frame .hud-special__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-select-settings__fake-frame .hud-special__svg {
  width: 100%;
  height: 100%;
}

.char-select-settings__tile-label {
  font-size: 0.78rem;
  line-height: 1.15;
  opacity: 0.92;
  max-width: 100%;
  word-break: break-word;
}

/* Modals: same CRT “menu access” panel look (dark field, green frame, scanlines) — not in-world pause UI */
.terminal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 6, 2, 0.42);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 12000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.terminal-dialog.dialog-panel--menu-access-legacy {
  position: relative;
  width: min(400px, 92vw);
  max-width: 90%;
  font-family: 'VT323', monospace;
  color: #0f0;
  background-color: rgba(0, 20, 20, 0.95);
  border: 2px solid #0f0;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
  overflow: hidden;
}

.terminal-dialog.dialog-panel--menu-access-legacy::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 255, 0, 0.1),
    rgba(0, 255, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 0;
}

.terminal-dialog.dialog-panel--menu-access-legacy .terminal-dialog-header,
.terminal-dialog.dialog-panel--menu-access-legacy .terminal-dialog-content,
.terminal-dialog.dialog-panel--menu-access-legacy .terminal-dialog-buttons {
  position: relative;
  z-index: 1;
}

.terminal-dialog.dialog-panel--menu-access-legacy .terminal-dialog-header {
  margin: 0;
  background: transparent;
  color: #0f0;
  font-size: 1.5rem;
  font-weight: normal;
  line-height: 1.2;
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
  padding: 1.1rem 1.25rem 0.35rem;
  text-align: center;
  letter-spacing: 0.04em;
}

.terminal-dialog.dialog-panel--menu-access-legacy .terminal-dialog-content {
  padding: 0.35rem 1.25rem 0.5rem;
}

.terminal-dialog.dialog-panel--menu-access-legacy .terminal-dialog-content p {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.4;
  color: rgba(0, 255, 100, 0.88);
  text-align: center;
}

.terminal-dialog.dialog-panel--menu-access-legacy .terminal-dialog-buttons {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.65rem 1.15rem 1.15rem;
  gap: 10px;
}

.terminal-dialog.dialog-panel--menu-access-legacy .terminal-dialog-buttons .form-button {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  background-color: rgba(0, 40, 0, 0.6);
  border: 1px solid #0f0;
  color: #0f0;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  text-shadow: none;
}

.terminal-dialog.dialog-panel--menu-access-legacy .terminal-dialog-buttons .form-button::before {
  content: '> ';
  opacity: 0.85;
}

.terminal-dialog.dialog-panel--menu-access-legacy .terminal-dialog-buttons .form-button:hover {
  background-color: rgba(0, 255, 0, 0.2);
  text-shadow: 0 0 5px #0f0;
}

/* Destructive confirm (quit match / logout) */
.terminal-dialog.dialog-panel--menu-access-legacy
  .terminal-dialog-buttons
  .form-button.primary[data-logout-action='confirm'],
.terminal-dialog.dialog-panel--menu-access-legacy
  .terminal-dialog-buttons
  .form-button.primary[data-quit-action='confirm'] {
  border-color: #f44;
  color: #faa;
  background-color: rgba(60, 20, 20, 0.55);
}

.terminal-dialog.dialog-panel--menu-access-legacy
  .terminal-dialog-buttons
  .form-button.primary[data-logout-action='confirm']:hover,
.terminal-dialog.dialog-panel--menu-access-legacy
  .terminal-dialog-buttons
  .form-button.primary[data-quit-action='confirm']:hover {
  background-color: rgba(200, 40, 40, 0.75);
  color: #100;
  text-shadow: none;
}

/* Error message */
.error-message {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: #f00;
  color: #fff;
  padding: 10px 15px;
  border-radius: 5px;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  z-index: 1001;
  animation: fadeInOut 3s ease;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0; }
  10%, 90% { opacity: 1; }
}

@media (max-width: 1024px) {
  .character-select-container {
    flex-direction: column;
    overflow-y: auto;
  }
  
  .character-info, .character-preview {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  
  .model-container {
    flex: 0 0 auto;
    height: 300px;
    min-height: 300px;
  }
  
  .character-preview__stack {
    flex: 0 0 auto;
  }
  
  .character-preview-bottom {
    flex-shrink: 0;
  }
}

/* Game loading message styles */
.game-loading-message {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 20, 0, 0.8);
  border: 1px solid #0f0;
  padding: 1rem 2rem;
  border-radius: 5px;
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
  z-index: 1000;
  width: 80%;
  max-width: 600px;
  text-align: left;
}

.game-loading-message p {
  margin: 0.5rem 0;
  font-size: 1.2rem;
  color: #0f0;
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.7);
}

.loading-dots {
  display: inline-block;
  margin-left: 0.5rem;
}

.loading-dots span {
  display: inline-block;
  animation: loadingDots 1.4s infinite;
  opacity: 0;
}

.loading-dots span:nth-child(1) {
  animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loadingDots {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

#terminal-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 300;
  display: flex;
  justify-content: center;
  align-items: center;
}

#terminal-menu .terminal-content {
  width: 80%;
  max-width: 600px;
  height: auto;
  min-height: 300px;
  padding: 2rem;
}

#terminal-menu h2 {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2rem;
  color: #0f0;
  text-shadow: 0 0 10px rgba(0, 255, 0, 0.7);
}

#terminal-menu .menu-options {
  margin-bottom: 2rem;
}

#terminal-menu .menu-options li {
  margin-bottom: 1rem;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

#terminal-menu .menu-options li:hover {
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
  transform: translateX(10px);
}

/* PLAY / QUIT under the class row */
.character-preview-bottom {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 100%;
  justify-content: flex-start;
}

.character-confirm-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 0.65rem 0.9rem;
  margin-top: 0;
  width: 100%;
}

.character-confirm-row .crt-button {
  min-width: 7rem;
}

/* QUIT GAME (left): muted red; PLAY/SWITCH (right): green — same row in default + in-match */
#character-confirm-actions #quit-game-from-match {
  flex: 1 1 0;
  min-width: 0;
  max-width: 14rem;
  margin: 0;
  padding: 0.9rem 1rem;
  background-color: rgba(50, 0, 0, 0.55);
  color: #f88;
  border: 2px solid #f55;
  font-family: 'VT323', monospace;
  font-size: 1.6rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  align-self: stretch;
  position: relative;
  box-shadow: 0 0 10px rgba(255, 60, 60, 0.35);
  text-shadow: 0 0 5px rgba(255, 100, 100, 0.55);
  animation: pulse-glow-quit 2s infinite;
  display: block;
}

#character-confirm-actions #quit-game-from-match:hover {
  background-color: #c00;
  color: #000;
  border-color: #f00;
  box-shadow: 0 0 20px rgba(255, 40, 40, 0.85);
  transform: scale(1.05);
  text-shadow: none;
}

#character-confirm-actions #quit-game-from-match:active {
  transform: scale(0.98);
  box-shadow: 0 0 15px rgba(255, 60, 60, 0.55);
}

@keyframes pulse-glow-quit {
  0% {
    box-shadow: 0 0 10px rgba(255, 60, 60, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 80, 80, 0.55);
  }
  100% {
    box-shadow: 0 0 10px rgba(255, 60, 60, 0.3);
  }
}

/* Match lobby — inside .terminal-content: shares outer CRT bezel with character select */
#match-lobby-section {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background-color: #000;
  color: #0f0;
  font-family: 'VT323', 'Courier New', monospace;
  padding: 0;
  border: 1px solid #0f0;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
  z-index: 101;
}

#match-lobby-section.match-lobby--open {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#match-lobby-section .match-lobby-window {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
}

#match-lobby-section .match-lobby-window .terminal-window-content {
  flex: 1;
  min-height: 0;
  height: auto;
}

.match-lobby-content {
  display: flex;
  flex-direction: row;
  gap: 1.25rem;
  padding: 1rem 1.25rem 1.25rem;
  align-items: stretch;
  min-height: 0;
  flex: 1;
}

.match-lobby-sidebar {
  flex: 0 0 min(280px, 40%);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.match-lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-bottom: 0.85rem;
  margin-bottom: 0.15rem;
  border-bottom: 1px dotted rgba(0, 255, 0, 0.4);
}

.match-lobby-actions .form-button,
.match-lobby-private .form-button,
.match-lobby-sidebar > .form-button {
  width: 100%;
  text-align: center;
}

.match-lobby-private {
  margin-top: 0.15rem;
  padding-top: 1rem;
  border-top: 1px dotted rgba(0, 255, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.match-lobby-log-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px dotted rgba(0, 255, 0, 0.45);
  background: rgba(0, 14, 0, 0.75);
  padding: 0.75rem 0.9rem;
  min-height: 300px;
}

.match-lobby-log-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: normal;
  color: #0f0;
  border-bottom: 1px solid rgba(0, 255, 0, 0.35);
  padding-bottom: 0.35rem;
}

.match-lobby-log-title::before {
  content: '> ';
}

.match-lobby-state {
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 1.05rem;
  color: #c8f0c8;
  white-space: pre-wrap;
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(0, 255, 0, 0.2);
  max-height: 38%;
  overflow: auto;
}

.match-queue-log {
  flex: 1;
  margin: 0;
  min-height: 140px;
  overflow-y: auto;
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 1rem;
  line-height: 1.45;
  color: #9fdd9f;
  white-space: pre-wrap;
  word-break: break-word;
}

#match-lobby-section .match-lobby-private .form-group {
  margin-bottom: 0.35rem;
}

#match-lobby-section .match-lobby-private .form-group label {
  font-size: 1.25rem;
}

#match-lobby-section .match-lobby-private .form-group input {
  font-size: 1.45rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

@media (max-width: 720px) {
  .match-lobby-content {
    flex-direction: column;
  }

  .match-lobby-sidebar {
    flex: none;
    width: 100%;
  }
}

/* Multiplayer floating name tags (CSS2DRenderer) */
.mp-player-nametag {
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 14px;
  color: #fff;
  text-shadow:
    0 0 3px #000,
    0 1px 2px #000,
    1px 0 2px #000,
    -1px 0 2px #000;
  padding: 1px 6px 2px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  pointer-events: none;
  white-space: nowrap;
}
