@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Barlow+Condensed:wght@400;600;700;800;900&display=swap');

/* ======================================================
   THEBOYZDRIFT — RACE TELEMETRY HUD  |  red/black
   ====================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

:root {
  --bg:       #050202;
  --surface:  #0a0404;
  --card-bg:  #0d0606;
  --text:     #f0dede;
  --muted:    #998080;
  --dim:      #3d2020;
  --accent:   #cc1a1a;
  --green:    #00ff88;
  --red:      #ff3030;
  --grid:     rgba(204, 26, 26, 0.05);
  --border:   rgba(204, 26, 26, 0.18);
  --glow:     0 0 8px rgba(204,26,26,0.7), 0 0 22px rgba(204,26,26,0.25);
  --glow-sm:  0 0 5px rgba(204,26,26,0.6);
  --font-mono: 'Share Tech Mono', 'Courier New', monospace;
  --font-ui:   'Barlow Condensed', sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* Direct children must fill the width — otherwise flex items shrink to
   their content width, breaking the max-width + margin:auto centering. */
body > * { width: 100%; }
/* Use the theme's own hover/active styles instead of the mobile tap flash */
a, button { -webkit-tap-highlight-color: transparent; }

/* ─── MAIN PAGE SCROLLBAR (themed like the help popup's) ─── */
html {
  scrollbar-width: thin;                                   /* Firefox */
  scrollbar-color: rgba(204, 26, 26, 0.55) var(--bg);
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
  border-left: 1px solid var(--border);
}
::-webkit-scrollbar-thumb {
  background: rgba(204, 26, 26, 0.55);
  border-radius: 5px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:active {
  background: var(--accent);
}
::-webkit-scrollbar-corner { background: var(--bg); }
/* Let the main content grow so the footer is pushed to the bottom
   of the viewport even when the page is short (sticky footer). */
body > main, body > .container { flex: 1 0 auto; }
body > footer, body > .footer { flex-shrink: 0; }

/* ─── Grid background ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ─── Scanline overlay ─── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 998;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
}

/* Everything above bg */
.nav, .header, main, footer, .modal { position: relative; z-index: 1; }

/* ─── NAVBAR ─── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 2, 2, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  height: 52px;
}
.brand {
  display: flex;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-shadow: var(--glow-sm);
  text-decoration: none;
  text-transform: uppercase;
  transition: text-shadow 0.2s;
}
.brand:hover { text-shadow: var(--glow); }

.right-controls {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.nav-link, .help-btn, .theme-btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border);
  padding: 0 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-link::before { content: '[ '; }
.nav-link::after  { content: ' ]'; }
.help-btn::before { content: '[ '; }
.help-btn::after  { content: ' ]'; }
/* Close off the last nav item so HELP is boxed like the others */
.right-controls > :last-child { border-right: 1px solid var(--border); }
.nav-link:hover, .help-btn:hover, .theme-btn:hover {
  color: var(--accent);
  background: rgba(204, 26, 26, 0.06);
  text-shadow: var(--glow-sm);
}
/* Active page indicator */
.nav-link.active {
  color: var(--accent);
  text-shadow: var(--glow-sm);
  background: rgba(204, 26, 26, 0.08);
}

/* ─── HEADER ─── */
.header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 28px 40px;
}

/* HUD status bar above title */
.hud-statusbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.hud-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
  /* the all-caps mono text sits high in its line box, so a flex-centered
     dot lands visually low — nudge it up to match the text's optical center */
  position: relative;
  top: -0.25px;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
/* Servers page: dot turns red when no server responds */
.hud-dot.offline {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}
.hud-statusbar span { color: var(--dim); }
.hud-statusbar .val { color: var(--accent); }
.hud-statusbar #hud-players { color: var(--green); }

/* ─── HERO LOCKUP (logo + title) ─── */
.hero {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.6vw, 30px);
  margin-bottom: 22px;
}
.hero-logo {
  width: clamp(88px, 14vw, 148px);
  height: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 0 18px rgba(204, 26, 26, 0.5));
}
.hero-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.header h1 {
  font-family: var(--font-ui);
  font-size: clamp(3.4rem, 12vw, 7.5rem);
  font-weight: 900;
  line-height: 0.86;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  margin-bottom: 0;
  background: linear-gradient(180deg, var(--text) 0%, var(--text) 48%, var(--accent) 128%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent);
  filter: drop-shadow(0 0 18px rgba(204, 26, 26, 0.28));
}
/* mono subtitle under the title */
.hero-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.header p {
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  max-width: 600px;
  margin-top: 0;
  margin-bottom: 28px;
}
.header p:not(.result-count)::before { content: '> '; color: var(--accent); }

/* ─── SEARCH ─── */
.search-input {
  width: 100%;
  padding: 12px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(204,26,26,0.2), inset 0 0 6px rgba(204,26,26,0.04);
}
.search-input::placeholder { color: var(--dim); }

/* ─── CONTAINER ─── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px 80px;
}

/* ─── SECTIONS ─── */
/* scroll-margin makes anchor jumps (cat-tabs) land the section a third of
   the way down the viewport instead of pinned at the very top. */
.section { margin-bottom: 72px; scroll-margin-top: 42vh; }

.section-label {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  /* equal line boxes so the id, title, and count all center on one line */
  line-height: 1;
}
.section-label .sec-id {
  color: var(--accent);
  margin-right: 14px;
  font-size: 1rem;
  /* same optical nudge as the count — mono glyphs sit high in their box */
  position: relative;
  top: 1px;
}
.section-label .sec-title {
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.12em;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-left: 16px;
}

/* ─── GRID ─── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  counter-reset: card-counter;
}

/* ─── CARDS (HUD panel style) ─── */
.card {
  counter-increment: card-counter;
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

/* Corner brackets — top-left */
.card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  width: 14px;
  height: 14px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  pointer-events: none;
  transition: width 0.25s, height 0.25s;
}
/* Corner brackets — bottom-right */
.card::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  pointer-events: none;
  transition: width 0.25s, height 0.25s;
}
.card:hover {
  border-color: rgba(204,26,26,0.45);
  background: rgba(204,26,26,0.03);
  box-shadow: 0 0 20px rgba(204,26,26,0.08), inset 0 0 12px rgba(204,26,26,0.02);
}
.card:hover::before,
.card:hover::after {
  width: 22px;
  height: 22px;
}

/* Card counter badge */
.card h3::before {
  content: counter(card-counter, decimal-leading-zero) "  ";
  color: #886060;
  font-size: 1em;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

.card h3 {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}
.card p {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 18px;
  flex-grow: 1;
  letter-spacing: 0.02em;
}

/* Horizontal divider */
.card p::after {
  content: '';
  display: block;
  height: 1px;
  background: var(--border);
  margin-top: 14px;
}

/* ─── ACTIONS ─── */
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}
.btn, .copy {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  padding: 7px 16px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 12px rgba(204,26,26,0.5);
}
.copy, .btn-outline {
  border-color: #886060;
  color: #c8b0b0;
}
.copy:hover, .btn-outline:hover {
  background: transparent;
  border-color: var(--text);
  color: var(--text);
  box-shadow: 0 0 10px rgba(240, 222, 222, 0.25);
}

/* ─── SERVER CARDS ─── */
.server-card {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  background: var(--card-bg);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.server-card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 18px; height: 18px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  pointer-events: none;
  z-index: 2;
}
.server-card::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 18px; height: 18px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  pointer-events: none;
  z-index: 2;
}
.server-card:hover {
  border-color: rgba(204,26,26,0.45);
  box-shadow: 0 0 24px rgba(204,26,26,0.1);
}

.server-thumb {
  width: 320px;
  /* stretch to the card's full height (min keeps short cards from squashing it) */
  height: auto;
  align-self: stretch;
  min-height: 210px;
  object-fit: cover;
  flex-shrink: 0;
  filter: brightness(0.85) saturate(0.6) contrast(1.05);
  border-right: 1px solid var(--border);
  transition: filter 0.3s;
}
.server-card:hover .server-thumb {
  filter: brightness(0.95) saturate(0.75) contrast(1.0);
}

.server-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 24px;
  gap: 14px;
}

.server-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.server-header h2 {
  font-family: var(--font-ui);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0;
}

.server-mods { margin-bottom: 2px; }
.server-mods strong {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #998080;
  display: block;
  margin-bottom: 8px;
}
.mod-list { display: flex; flex-wrap: wrap; gap: 6px; }
.mod-bubble {
  background: rgba(204, 26, 26, 0.06);
  border: 1px solid rgba(204, 26, 26, 0.25);
  color: var(--accent);
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.mod-bubble:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 8px rgba(204,26,26,0.4);
}

.server-actions { margin-top: auto; }
.join-btn {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  padding: 9px 22px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.join-btn::before { content: '▶'; font-size: 0.7em; }
.join-btn:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 14px rgba(204,26,26,0.5);
}
.join-btn:active { filter: brightness(0.9); }

/* ─── FOOTER ─── */
footer, .footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
/* <small> normally shrinks its text — keep the footer at its set size */
footer small, .footer small { font-size: 1em; }
.footer .val { color: var(--accent); }

/* ─── MODAL ─── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 2, 2, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
  backdrop-filter: blur(4px);
}
.modal.open { display: flex; }
.modal.open .modal-card {
  animation: hudIn 0.2s ease;
}
@keyframes hudIn {
  from { transform: translateY(12px) scale(0.99); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  width: min(700px, 92vw);
  padding: 32px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

/* ─── AUTO-HIDING SCROLLBAR FOR THE HELP POPUP ───
   The native scrollbar inside the popup is hidden; scrollbar.js draws
   a themed overlay bar that only fades in while you actually scroll
   inside the popup, then disappears when idle. */
.modal-card {
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* old Edge/IE */
}
.modal-card::-webkit-scrollbar { width: 0; height: 0; display: none; }

.modal-scrollbar {
  position: absolute;
  right: 5px;
  width: 8px;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-scrollbar.visible { opacity: 1; }
.modal-scrollbar .cs-thumb {
  position: absolute;
  right: 0;
  width: 6px;
  min-height: 30px;
  background: rgba(204, 26, 26, 0.55);
  border-radius: 3px;
  pointer-events: auto;
  cursor: grab;
  transition: background 0.15s, box-shadow 0.15s, width 0.15s;
}
.modal-scrollbar .cs-thumb:hover,
.modal-scrollbar.dragging .cs-thumb {
  width: 8px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(204, 26, 26, 0.6);
}
.modal-scrollbar.dragging .cs-thumb { cursor: grabbing; }
/* Modal corner brackets */
.modal-card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 20px; height: 20px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
}
.modal-card::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 20px; height: 20px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
}

.modal-card h2 {
  font-family: var(--font-ui);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: var(--glow-sm);
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.install-option {
  background: rgba(204,26,26,0.03);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.install-option h3 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  color: var(--text);
}
.install-option h3 span {
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  font-size: 0.82rem;
  letter-spacing: 0;
}
.install-option ol { margin-left: 20px; }
.install-option li { margin-bottom: 8px; color: var(--muted); font-size: 0.85rem; }
.install-option strong { color: var(--text); }
.install-option code {
  background: rgba(204,26,26,0.08);
  border: 1px solid var(--border);
  padding: 1px 6px;
  font-size: 0.82rem;
  color: var(--accent);
  font-family: var(--font-mono);
}
.install-option pre {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: thin;                                  /* Firefox */
  scrollbar-color: rgba(204, 26, 26, 0.55) rgba(0,0,0,0.4);
}
.install-option pre::-webkit-scrollbar {
  height: 6px;
}
.install-option pre::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.4);
}
.install-option pre::-webkit-scrollbar-thumb {
  background: rgba(204, 26, 26, 0.55);
  border-radius: 3px;
}
.install-option pre::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(204, 26, 26, 0.6);
}

.close-btn {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 9px 22px;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.close-btn::before { content: '[ '; }
.close-btn::after  { content: ' ]'; }
.close-btn:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 10px rgba(204,26,26,0.4);
}

/* ─── LIVE SERVER STATUS ─── */
.server-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.server-location {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #998080;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 9px;
  align-self: center;
}

.status-circle {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-circle.online {
  background: var(--green);
  box-shadow: 0 0 8px var(--green), 0 0 18px rgba(0, 255, 136, 0.35);
  animation: pulse 2s ease-in-out infinite;
}

.status-circle.offline {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.status-circle.loading {
  background: var(--dim);
}

.status-players {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
}

.status-players.online  { color: var(--green); }
.status-players.offline { color: var(--red); }
.status-players.loading { color: var(--dim); }

/* ─── CATEGORY JUMP TABS ─── */
.cat-tabs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.cat-tab {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: #998080;
  text-decoration: none;
  padding: 5px 14px;
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.cat-tab::before { content: '[ '; }
.cat-tab::after  { content: ' ]'; }

.cat-tab:hover {
  color: var(--accent);
  border-color: rgba(204, 26, 26, 0.4);
  box-shadow: 0 0 8px rgba(204, 26, 26, 0.15);
  text-shadow: var(--glow-sm);
}

/* ─── SEARCH MATCH HIGHLIGHT ─── */
mark {
  background: rgba(204, 26, 26, 0.28);
  color: var(--text);
  padding: 0 1px;
  text-shadow: 0 0 6px rgba(204, 26, 26, 0.5);
}

/* ─── SECTION ITEM COUNT ─── */
.sec-count {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  margin-left: 12px;
  white-space: nowrap;
  /* optical nudge: the mono digits sit high in their box vs the title font */
  position: relative;
  top: 1px;
}
.sec-count:not(:empty)::before { content: '· '; color: var(--accent); }

/* ─── EMPTY / ERROR STATE ─── */
.empty-msg {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px dashed var(--border);
  padding: 26px 22px;
  text-align: center;
}
.empty-msg::before { content: '> '; color: var(--accent); }

/* ─── BACK TO TOP ───
   Small square arrow in the usual bottom-right corner. */
.top-btn {
  position: fixed;
  bottom: 76px; /* high enough to clear the footer when scrolled to the bottom */
  right: 22px;
  z-index: 500;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: rgba(5, 2, 2, 0.9);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s, background 0.15s, color 0.15s, box-shadow 0.15s;
}
.top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.top-btn:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 12px rgba(204, 26, 26, 0.5);
}

/* ─── CARD ENTRANCE ─── */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card, .server-card { animation: cardIn 0.3s ease both; }

/* ─── AMBIENT FX ───
   Subtle motion layered over the HUD theme so the page feels live:
   a drifting grid, glitching title, breathing logo, terminal cursor,
   and a pulsing search focus. All are disabled by the
   prefers-reduced-motion block above. */

/* The background grid crawls diagonally, very slowly */
body::before { animation: gridDrift 90s linear infinite; }
@keyframes gridDrift {
  to { background-position: 40px 40px, 40px 40px; }
}

/* Title glitches for a split second every few seconds */
.header h1 { animation: titleGlitch 7s steps(1) infinite; }
@keyframes titleGlitch {
  0%, 100% {
    transform: none;
    filter: drop-shadow(0 0 18px rgba(204, 26, 26, 0.28));
    opacity: 1;
  }
  92% {
    transform: translateX(3px) skewX(-4deg);
    filter: drop-shadow(0 0 18px rgba(204, 26, 26, 0.28)) hue-rotate(-35deg) brightness(1.4);
  }
  92.6% {
    transform: translateX(-3px) skewX(3deg);
    opacity: 0.8;
  }
  93.2% {
    transform: translateX(1px);
    filter: drop-shadow(0 0 22px rgba(204, 26, 26, 0.5)) brightness(1.6);
  }
  93.8% {
    transform: none;
    filter: drop-shadow(0 0 18px rgba(204, 26, 26, 0.28));
    opacity: 1;
  }
}

/* Logo glow breathes in and out */
.hero-logo { animation: logoBreathe 4.5s ease-in-out infinite; }
@keyframes logoBreathe {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(204, 26, 26, 0.35)); }
  50%      { filter: drop-shadow(0 0 26px rgba(204, 26, 26, 0.75)); }
}

/* Search field pulses gently while focused */
.search-input:focus { animation: focusPulse 2.2s ease-in-out infinite; }
@keyframes focusPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(204, 26, 26, 0.2); }
  50%      { box-shadow: 0 0 20px rgba(204, 26, 26, 0.5); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ─── SEARCH RESULT COUNT ─── */
.result-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--dim);
  margin-top: 8px;
  min-height: 1.2em;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .server-card { flex-direction: column; }
  .server-thumb { width: 100%; height: 200px; min-height: 0; border-right: none; border-bottom: 1px solid var(--border); }
}
@media (max-width: 768px) {
  .header h1 { font-size: clamp(3rem, 15vw, 5rem); }
  .hero { gap: 18px; }
  .hero-logo { width: clamp(70px, 20vw, 96px); }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .nav-inner { padding: 0 12px; }
  /* Keep nav links visible on mobile — just make them compact */
  .nav-link, .help-btn {
    padding: 0 12px;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    gap: 4px;
  }
  .header { padding: 30px 16px 24px; }
  .container { padding: 0 16px 60px; }
  .server-body { padding: 16px; }
  .server-header h2 { font-size: 1.1rem; }
  .cat-tabs { gap: 8px; }
  .cat-tab { font-size: 0.68rem; padding: 6px 10px; }
  .actions { gap: 6px; }
  .btn, .copy { font-size: 0.74rem; padding: 8px 14px; }
  /* 16px stops iOS Safari from auto-zooming when the search field is tapped */
  .search-input { font-size: 16px; }
  /* Bigger tap target for the back-to-top button */
  .top-btn { width: 44px; height: 44px; right: 16px; }
}
@media (max-width: 480px) {
  .header h1 { font-size: clamp(2.6rem, 16vw, 4rem); }
  .hero { gap: 14px; }
  .hero-logo { width: 66px; }
  .hero-kicker { font-size: 0.62rem; letter-spacing: 0.2em; margin-top: 9px; padding-top: 9px; }
  .hud-statusbar { gap: 6px 10px; font-size: 0.64rem; letter-spacing: 0.08em; }
  .modal { padding: 12px; }
  .modal-card { padding: 22px 18px; }
  .install-option ol { margin-left: 16px; }
  .server-thumb { height: 160px; }
  .brand { font-size: 0.9rem; letter-spacing: 0.12em; }
  /* Drop the bracket chars on tiny screens to save room */
  .nav-link, .help-btn {
    padding: 0 10px;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
  }
  .nav-link::before, .nav-link::after,
  .help-btn::before, .help-btn::after { content: ''; }
  .server-status { flex-direction: row; gap: 6px; }
  .status-players { font-size: 0.78rem; }
  .mod-bubble { font-size: 0.68rem; padding: 3px 8px; }
  .join-btn { width: 100%; justify-content: center; }
}
/* Extra-narrow phones: shrink brand text so nav never overflows */
@media (max-width: 360px) {
  .brand { font-size: 0.8rem; letter-spacing: 0.08em; }
  .nav-link, .help-btn { padding: 0 8px; font-size: 0.66rem; }
}
