:root {
  /* Palette */
  --primary: #ff4e00;
  --primary-dim: rgba(255, 78, 0, 0.1);
  --rad-green: #00ff41;
  --rad-green-alpha: rgba(0, 255, 65, 0.15);
  --error: #ff2a2a;
  --animal-blue: #00d9ff;
  --scanning: #fdfd96;
  --bg: #050505;
  --text-main: #eee;
  --text-dim: #666;

  /* UI & Assets */
  --font-stack: "Courier New", Courier, monospace;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --modal-bg: rgba(10, 15, 10, 0.95);
  --noise-url: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* --- Layout Base --- */
body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg);
  color: var(--text-main);
  font-family: var(--font-stack);
  overflow: hidden;
  overscroll-behavior-y: contain;
}

/* Shared: Full Screen Overlays */
.fog-container,
.noise,
.scanlines,
.modal-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.modal-overlay {
  pointer-events: auto;
  z-index: 9999;
}

/* Override for modal interaction */

/* Shared: Flex Centering */
.content,
.modal-overlay,
.entity-stats {
  display: flex;
  align-items: center;
  justify-content: center;
}

.content {
  flex-direction: column;
  position: relative;
  z-index: 20;
  min-height: 100vh;
  padding: 20px;
  box-sizing: border-box;
  text-align: center;
  width: 90%;
  max-width: 900px;
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.1);
  border-left: solid black 1px;
  border-right: solid black 1px;
}

/* Typography */
h1 {
  font-size: clamp(2rem, 8vw, 5rem);
  margin: 10px 0;
  color: #fff;
  text-shadow: 0 0 15px #ff00cbc4;
  letter-spacing: 6px;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  width: fit-content;
  animation: glitch 8s infinite;
}

.sub-header {
  letter-spacing: 2px;
  color: var(--text-dim);
  font-size: clamp(0.7rem, 2vw, 0.9rem);
  margin-bottom: 20px;
}

/* --- Buttons (Unified) --- */
.btn,
.btn-small,
#join-btn {
  text-decoration: none;
  font-weight: bold;
  text-transform: uppercase;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--primary);
  letter-spacing: 2px;
  color: var(--primary);
}

.btn:hover,
.btn-small:hover {
  background: var(--primary);
  color: #000;
  box-shadow: 0 0 20px var(--primary);
}

/* Specific Button Tweaks */
.btn {
  width: 80%;
  max-width: 300px;
  margin-top: 30px;
  padding: 15px 20px;
  border-width: 2px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px var(--primary);
}

.btn-small {
  padding: 10px 20px;
  font-size: 0.85rem;
  margin-top: 10px;
}

.btn-secondary {
  border-color: #888;
  color: #888;
}

.btn-secondary:hover {
  background: #888;
  color: #000;
  box-shadow: 0 0 10px #888;
}

#join-btn {
  position: relative;
  overflow: hidden;
  background: rgba(255, 68, 0, 0.05);
  box-shadow: inset 0 0 15px var(--primary-dim);
  text-shadow: 0 0 8px rgba(255, 68, 0, 0.7);
}

#join-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 68, 0, 0.2),
      transparent);
  transition: 0.5s;
}

#join-btn:hover::before {
  left: 100%;
}

#join-btn:hover {
  transform: scale(1.05);
  letter-spacing: 4px;
}

/* Links - Map Intel Style */
.dashboard-link {
  margin-top: 35px;
  font-size: 0.8rem;
  color: #555;
  /* Dimmer "unselected" color */
  text-decoration: none;
  transition: all 0.2s ease-in-out;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: inline-block;
  position: relative;
}

/* Adding the tactical brackets [ ] via pseudo-elements */
.dashboard-link::before {
  content: "[ ";
  color: #444;
}

.dashboard-link::after {
  content: " ]";
  color: #444;
}

.dashboard-link:hover {
  color: var(--rad-green);
  text-shadow: 0 0 10px var(--rad-green);
  /* Glowing HUD effect */
  transform: scale(1.05);
  /* Slight "zoom" like a map focus */
}

.dashboard-link:hover::before,
.dashboard-link:hover::after {
  color: var(--rad-green);
  content: "> ";
  /* Changes bracket to a pointer on hover */
}

/* --- Background FX --- */
.fog-container {
  background: radial-gradient(circle at 50% 50%,
      var(--rad-green-alpha),
      transparent 70%);
  filter: blur(80px);
  animation: drift 20s infinite alternate;
  z-index: 1;
}

.noise {
  z-index: 2;
  opacity: 0.05;
  background: var(--noise-url);
}

.scanlines {
  z-index: 30;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%),
    linear-gradient(90deg,
      rgba(255, 0, 0, 0.02),
      rgba(0, 255, 0, 0.01),
      rgba(0, 0, 255, 0.02));
  background-size: 100% 3px, 3px 100%;
}

/* --- Status Indicators --- */
.status {
  font-size: 0.9rem;
  letter-spacing: 3px;
  margin-bottom: 20px;
  text-transform: uppercase;
  animation: flicker 0.15s infinite;
}

.status.nominal {
  color: var(--rad-green);
  text-shadow: 0 0 8px var(--rad-green);
}

.status.offline {
  color: var(--error);
  text-shadow: 0 0 12px var(--error);
}

.status.scanning {
  color: var(--scanning);
  text-shadow: 0 0 8px var(--scanning);
}

.time-container {
  display: inline-block;
  /* Shrink-wraps the container to the clock's width */
  text-align: center;
  /* Keeps the main clock centered within itself */
  margin-bottom: 20px;
}

#game-clock {
  margin: 0;
  /* Removes default spacing */
  display: block;
  /* Ensures it takes its own line within the container */
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  letter-spacing: 6px;
  color: white;
  margin: 20px 0;
  font-weight: bold;
}

.blink {
  animation: blink-animation 1s steps(2, start) infinite;
}

@keyframes blink-animation {
  to {
    visibility: hidden;
  }
}

#blood-moon-subtext {
  display: block;
  /* Puts it on the line below the clock */
  color: #ff4444;
  /* Red color */
  font-size: 0.75em;
  /* Scales relative to the big clock; adjust as needed */
  margin-top: -10px;
  /* Pulls it up to be "almost touching" the big text */
  font-style: italic;
}

.entity-stats {
  flex-wrap: wrap;
  gap: 15px;
  list-style: none;
  padding: 0;
  margin: 15px 0;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.count {
  color: var(--text-main);
  margin-left: 5px;
}

.bullet {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 10px;
  box-shadow: 0 0 8px currentColor;
}

.b-green {
  color: var(--rad-green);
  background: var(--rad-green);
}

.b-red {
  color: var(--error);
  background: var(--error);
}

.b-blue {
  color: var(--animal-blue);
  background: var(--animal-blue);
}

/** chat toast **/
#chat-toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 350px;
    z-index: 9999;
    pointer-events: none; /* Let clicks pass through to the background */
    display: flex;
    flex-direction: column-reverse; /* Newest messages at the bottom */
    gap: 8px;
}

.chat-toast {
    background: rgba(0, 0, 0, 0.6);
    border-left: 3px solid #ff0000; /* 7 Days to Die Red */
    color: #fff;
    padding: 10px 15px;
    font-family: 'monospace';
    font-size: 0.9rem;
    text-shadow: 1px 1px 2px #000;
    backdrop-filter: blur(4px);
    
    /* Animation */
    animation: toast-in 0.4s ease forwards, toast-out 0.5s ease 8s forwards;
}

.chat-toast .user { color: #f1c40f; font-weight: bold; margin-right: 5px; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.95); pointer-events: none; }
}

/* --- Ticker --- */
.ticker-wrapper {
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 20, 0, 0.4);
  border-bottom: 1px solid rgba(0, 255, 65, 0.2);
  display: flex;
  align-items: center;
  z-index: 50;
  overflow: hidden;
  box-shadow: 0 0px 500px rgba(255, 0, 0, 0.31);
}

.ticker-label {
  background: var(--rad-green);
  color: #000;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 5px 10px;
  z-index: 2;
  letter-spacing: 1px;
}

.ticker-placeholder {
  padding-left: 5px;
}

.loading-dots {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  animation: dots 1.5s steps(4, end) infinite;
  width: 0px;
}

@keyframes dots {
  to {
    width: 2.5em;
  }
}

.ticker-content {
  white-space: nowrap;
  display: flex;
  padding: 5px 0;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.ticker-item {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 20s linear infinite;
  font-size: 0.85rem;
  color: var(--rad-green);
}

/* Player Stats in Ticker */
.p-wrap {
  display: inline-flex;
  align-items: center;
  margin-right: 60px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.p-score {
  background: var(--rad-green);
  color: #000;
  padding: 2px 8px;
  font-weight: 900;
  font-size: 0.75rem;
  border-radius: 2px;
  margin-right: 10px;
}

.p-name {
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

.p-lv {
  color: var(--rad-green);
  font-size: 0.7rem;
  margin-left: 6px;
  opacity: 0.7;
}

.p-divider {
  color: rgba(255, 255, 255, 0.2);
  margin: 0 12px;
}

.p-kills {
  color: #fff;
  font-size: 0.8rem;
  margin-right: 12px;
}

.p-deaths {
  color: var(--error);
  font-size: 0.8rem;
}

.p-kd {
  margin-left: 15px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  color: #00e5ff;
  font-size: 0.8rem;
}

/* --- Modal --- */
.modal-overlay {
  display: none;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.terminal-border {
  background: var(--modal-bg);
  border: 1px solid rgba(0, 255, 0, 0.2);
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.1);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  position: relative;
}

.modal-header {
  border-bottom: 1px solid rgba(0, 255, 0, 0.2);
  padding-bottom: 10px;
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
}

.alert-title {
  color: #00ff00;
  font-weight: bold;
  letter-spacing: 2px;
}

.highlight-red {
  color: #ff4444 !important;
  font-weight: bold;
}

.highlight-green {
  color: #00ff00 !important;
}

.highlight-green:hover {
  text-shadow: 0 0 5px #00ff00;
}

.download-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 20px 0;
}

.opt-box {
  background: var(--glass-bg);
  padding: 15px;
  border-left: 3px solid #00ff00;
}

.opt-box h3 {
  font-size: 0.9rem;
  margin: 0 0 5px 0;
  color: #aaa;
}

.opt-box p {
  font-size: 0.8rem;
  color: #888;
  margin: 0 0 10px 0;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: var(--font-stack);
  transition: 0.3s;
}

.btn-text:hover {
  color: #fff;
  text-shadow: 0 0 5px #fff;
}

/* Code Copy */
.copy-path {
  background: rgba(255, 255, 255, 0.1);
  color: var(--rad-green);
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.copy-path:hover {
  background: var(--rad-green-alpha);
  border-color: var(--rad-green);
}

.copy-path.copied {
  background: var(--rad-green);
  color: #000;
}

/* --- Discord Badge --- */
.discord-badge {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 100;
  transition: transform 0.3s ease;
  text-decoration: none;
  opacity: 25%;
}

.discord-badge:hover {
  transform: scale(1.05);
}

.discord-glass {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 18px;
  border-radius: 4px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.discord-glass img {
  width: 22px;
  filter: invert(1) brightness(0.6);
}

.comms-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.label {
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.status-text {
  font-size: 0.7rem;
  color: var(--rad-green);
  letter-spacing: 2px;
  font-weight: bold;
}

.discord-badge:hover .discord-glass {
  border-color: #5865f2;
  background: rgba(88, 101, 242, 0.1);
}

.discord-badge:hover .status-text {
  color: #fff;
}

/* --- Animations --- */
@keyframes drift {
  from {
    transform: scale(1) translate(-10%, -10%);
  }

  to {
    transform: scale(1.3) translate(10%, 10%);
  }
}

@keyframes flicker {
  0% {
    opacity: 0.97;
  }

  100% {
    opacity: 1;
  }
}

@keyframes marquee {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(-100%, 0);
  }
}

@keyframes glitch {

  0%,
  95%,
  100% {
    transform: none;
    opacity: 1;
  }

  96% {
    transform: skewX(2deg);
    opacity: 0.8;
  }

  97% {
    transform: skewX(-2deg);
    opacity: 0.9;
  }

  98% {
    transform: translate(2px, 1px);
  }

  99% {
    transform: translate(-1px, -1px);
  }
}

.chat-entry {
  display: inline-block;
  white-space: nowrap;
  margin-left: 15px;
}

.chat-user {
  color: var(--rad-green);
  /* Matches your dashboard green */
  font-family: monospace;
  font-weight: bold;
}

.chat-msg {
  color: #fff;
  text-transform: uppercase;
  /* Keeps the terminal look */
}