:root {
  --wc-bg: #141718;
  --wc-bg-soft: #1b2023;
  --wc-panel: #242a2e;
  --wc-panel-2: #2c343a;
  --wc-text: #e8ecef;
  --wc-muted: #aeb8bf;
  --wc-accent: #27b06e;
  --wc-accent-2: #43d08a;
  --wc-danger: #d35f5f;
  --wc-border: rgba(255, 255, 255, 0.08);
  --wc-ring: rgba(39, 176, 110, 0.32);
}

@media (prefers-color-scheme: light) {
  /* Intentionally empty: World Commander defaults to dark mode for everyone.
     Light mode is opt-in via the menu toggle (sets html[data-theme="light"]). */
}

:root[data-theme="light"] {
    --wc-bg: #f4f5f7;
    --wc-bg-soft: #ebedf0;
    --wc-panel: #ffffff;
    --wc-panel-2: #f0f1f3;
    --wc-text: #1a1d21;
    --wc-muted: #5f6a73;
    --wc-accent: #1e9058;
    --wc-accent-2: #26a567;
    --wc-danger: #c0392b;
    --wc-border: rgba(0, 0, 0, 0.10);
    --wc-ring: rgba(30, 144, 88, 0.24);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: "Chivo", sans-serif;
  color: var(--wc-text);
  background:
    radial-gradient(1200px 620px at 10% -10%, rgba(39, 176, 110, 0.16), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(67, 208, 138, 0.10), transparent 55%),
    linear-gradient(180deg, #15191b 0%, #111416 100%);
}

@media (prefers-color-scheme: light) {
  /* No auto-light overrides: World Commander defaults to dark mode. */
}

/* Content hyperlinks. Default browser blue is hard to read on the dark theme,
   so links inherit the brand green (which adapts per theme via the CSS vars).
   Chrome components with their own colour — nav menu, buttons/CTAs, footer —
   use more specific selectors and are unaffected. */
a {
  color: var(--wc-accent-2, #43d08a);
  text-decoration-color: rgba(67, 208, 138, 0.5);
}
a:hover {
  color: var(--wc-accent, #27b06e);
}

:root[data-theme="light"] body {
    background:
      radial-gradient(1200px 620px at 10% -10%, rgba(30, 144, 88, 0.08), transparent 60%),
      radial-gradient(900px 500px at 90% 0%, rgba(38, 165, 103, 0.06), transparent 55%),
      linear-gradient(180deg, #f4f5f7 0%, #ebedf0 100%);
}
:root[data-theme="light"] .bg-layer {
    background-image:
      linear-gradient(180deg, rgba(0,0,0,0.01), transparent 30%),
      repeating-linear-gradient(0deg, transparent 0 31px, rgba(0,0,0,0.02) 32px);
}
:root[data-theme="light"] .topbar {
    background: rgba(255, 255, 255, 0.85);
}
:root[data-theme="light"] .brand {
    color: #1a1d21;
}
:root[data-theme="light"] .menu-panel {
    background: var(--wc-panel);
    box-shadow: 0 12px 34px rgba(0,0,0,0.12);
}
:root[data-theme="light"] .menu-panel a,
:root[data-theme="light"] .nav-link-btn {
    color: var(--wc-text);
}
:root[data-theme="light"] .menu-panel a:hover,
:root[data-theme="light"] .nav-link-btn:hover {
    background: rgba(0,0,0,0.04);
}

/* Theme toggle row inside the menu dropdown. */
.menu-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.62rem 0.82rem;
    border-top: 1px solid var(--wc-border);
    color: var(--wc-text);
    font: inherit;
}
.menu-theme-row .menu-theme-label {
    color: var(--wc-muted);
    font-size: 0.85rem;
    -webkit-user-select: none;
    user-select: none;
}
.menu-theme-toggle {
    --tt-w: 2.6rem;
    --tt-h: 1.4rem;
    position: relative;
    width: var(--tt-w);
    height: var(--tt-h);
    border-radius: 999px;
    border: 1px solid var(--wc-border);
    background: var(--wc-bg-soft);
    cursor: pointer;
    padding: 0;
    flex: none;
    transition: background 0.15s ease;
}
.menu-theme-toggle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0.18rem;
    width: calc(var(--tt-h) - 0.5rem);
    height: calc(var(--tt-h) - 0.5rem);
    border-radius: 50%;
    background: var(--wc-text);
    transform: translateY(-50%);
    transition: left 0.15s ease, background 0.15s ease;
}
.menu-theme-toggle[aria-checked="true"] {
    background: var(--wc-accent);
}
.menu-theme-toggle[aria-checked="true"]::before {
    left: calc(var(--tt-w) - var(--tt-h) + 0.18rem);
    background: #ffffff;
}
.menu-theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--wc-ring);
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 30%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(255,255,255,0.015) 32px);
  z-index: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.1rem;
  background: rgba(22, 27, 30, 0.88);
  border-bottom: 1px solid var(--wc-border);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.brand {
  color: #ecf2f6;
  text-decoration: none;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.02em;
}

.menu { position: relative; }

.menu-toggle {
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: #f2f5f7;
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  font: inherit;
  cursor: pointer;
}
.menu-toggle:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--wc-ring); }

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  display: none;
  min-width: 11rem;
  background: #20262a;
  border: 1px solid var(--wc-border);
  border-radius: 0.65rem;
  box-shadow: 0 12px 34px rgba(0,0,0,0.35);
  overflow: hidden;
}
.menu-panel.open { display: block; }
.menu-panel a,
.nav-link-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.62rem 0.82rem;
  color: #dde5ea;
  background: transparent;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font: inherit;
}
.menu-panel a:hover,
.nav-link-btn:hover { background: rgba(255,255,255,0.06); }
.nav-signup { color: var(--wc-accent-2) !important; font-weight: 700; }
.nav-username { color: #9be7bd !important; }
.nav-logout-form { display: block; }

main {
  flex: 1 0 auto;
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.25rem 2rem 6rem;
}

.hero h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.55rem, 2.4vw + 0.8rem, 2.8rem);
}
.hero p {
  margin: 0.5rem 0 1.2rem;
  color: var(--wc-muted);
  line-height: 1.35;
}

.eyebrow {
  margin-bottom: 0.75rem;
  color: #9be7bd;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero--home {
  max-width: 980px;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.about--long {
  padding: 1.2rem 1.2rem 1rem;
}

.about--long h3,
.about--policy h3 {
  margin-top: 0;
  font-family: "Space Grotesk", sans-serif;
}

.about--long p,
.about--policy p {
  line-height: 1.6;
}

.hero--policy {
  max-width: 860px;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}

.modal-shell--open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 10, 0.78);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.notice-modal {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 2rem));
  margin: min(16vh, 7rem) auto 0;
  padding: 1.2rem;
  border: 1px solid var(--wc-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(32,38,42,0.98), rgba(18,22,25,0.98));
  box-shadow: 0 24px 54px rgba(0,0,0,0.45);
}

.notice-modal h2 {
  margin-top: 0;
  font-family: "Space Grotesk", sans-serif;
}

.notice-modal p {
  color: var(--wc-muted);
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.cta-row { display: flex; gap: 0.65rem; flex-wrap: wrap; }
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  color: #04120b;
  background: linear-gradient(135deg, var(--wc-accent), var(--wc-accent-2));
  transition: transform 0.12s, box-shadow 0.15s, opacity 0.15s;
}
button.cta {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  line-height: 1.15;
}
.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.24);
}
.cta:active { transform: translateY(0); }
.cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--wc-ring);
}
.cta-alt {
  background: rgba(255,255,255,0.11);
  color: #eef4f8;
  border: 1px solid rgba(255,255,255,0.18);
}

.about,
.map-panel,
.map-sidebar,
.auth-card,
.admin-card,
.stats article,
.server-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  border: 1px solid var(--wc-border);
  border-radius: 12px;
}

.about {
  margin-top: 1.4rem;
  padding: 1rem 1.1rem;
}

.section-header {
  margin-top: 1.4rem;
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: baseline;
}
.section-header p { color: var(--wc-muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 0.65rem;
}
.stats article { padding: 0.72rem; }
.stats span { color: var(--wc-muted); font-size: 0.85rem; }
.stats strong { font-family: "Space Grotesk", sans-serif; font-size: 1.5rem; }

.toolbar { margin: 0.5rem 0 0.9rem; }
.toolbar {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar input,
.toolbar select,
.auth-form input,
.auth-form textarea,
.player-signin-form input,
.jai-widget-input,
.jai-input-row input {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: rgba(17,21,24,0.82);
  color: #eef4f8;
  font: inherit;
  padding: 0.6rem 0.75rem;
}

.toolbar #serverSearch {
  margin-right: 5px;
}
.toolbar input:focus,
.auth-form input:focus,
.auth-form textarea:focus,
.player-signin-form input:focus,
.jai-widget-input:focus,
.jai-input-row input:focus,
.menu-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--wc-ring);
  border-color: rgba(67, 208, 138, 0.45);
}

.server-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.85rem;
}
.server-card {
  padding: 0.88rem;
  display: grid;
  gap: 0.34rem;
  opacity: 0;
  transform: translateY(8px);
  animation: reveal 260ms ease forwards;
}
.server-card-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.45rem;
}
.server-card h3 { margin: 0; font-family: "Space Grotesk", sans-serif; }
.favorite-btn {
  min-width: 34px;
  color: #eef4f8;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.23);
  font-size: 1rem;
  line-height: 1;
}
.favorite-btn.is-favorite {
  color: #2a2000;
  background: #ffd76a;
  border-color: #e8c04a;
}
.health-strip {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 0.33rem 0.5rem;
  font-size: 0.78rem;
}
.trend-up { color: #9be7bd; }
.trend-down { color: #ffb6b6; }
.trend-flat { color: var(--wc-muted); }
.card-note {
  font-size: 0.84rem;
  color: #d8e2ea;
  border-left: 2px solid rgba(67,208,138,0.45);
  padding-left: 0.45rem;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}
.card-tags span {
  border: 1px solid rgba(255,255,255,0.17);
  border-radius: 999px;
  padding: 0.08rem 0.42rem;
  font-size: 0.73rem;
  color: #cdd9e1;
}
.compare-pick {
  font-size: 0.78rem;
  color: var(--wc-muted);
}
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
}
.compare-col {
  border: 1px solid var(--wc-border);
  border-radius: 10px;
  padding: 0.6rem;
  background: rgba(255,255,255,0.02);
}
.compare-col h4 {
  margin: 0 0 0.4rem;
  font-family: "Space Grotesk", sans-serif;
}

.is-native-hidden {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
}

.wc-select {
  position: relative;
  min-width: 210px;
}

.wc-select-btn {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: rgba(17,21,24,0.82);
  color: #eef4f8;
  font: inherit;
  padding: 0.6rem 0.75rem;
  text-align: left;
  cursor: pointer;
}

.wc-select-btn::after {
  content: "\25be";
  float: right;
  color: var(--wc-muted);
}

.wc-select-menu {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  z-index: 25;
  display: none;
  border: 1px solid var(--wc-border);
  border-radius: 10px;
  background: rgba(18,22,25,0.98);
  box-shadow: 0 14px 34px rgba(0,0,0,0.35);
  padding: 0.3rem;
}

.wc-select.is-open .wc-select-menu {
  display: grid;
  gap: 0.2rem;
}

.wc-select-item {
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  color: var(--wc-text);
  font: inherit;
  text-align: left;
  padding: 0.45rem 0.56rem;
  cursor: pointer;
}

.wc-select-item:hover {
  border-color: rgba(67,208,138,0.35);
  background: rgba(39,176,110,0.13);
}
.status-pill {
  display: inline-block;
  width: fit-content;
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 0.16rem 0.52rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-online { color: #98efc2; background: rgba(39,176,110,0.22); }
.status-paused { color: #f3d48a; background: rgba(211, 163, 63, 0.2); }
.status-offline { color: #f6a8a8; background: rgba(211,95,95,0.2); }
.card-meta { color: var(--wc-muted); font-size: 0.86rem; }
.card-players { font-family: "Space Grotesk", sans-serif; font-size: 1.1rem; }
.server-card-actions { margin-top: 0.45rem; }

/* "Running V2.7.2" badge on official server cards → links to roadmap notes. */
.sc-version-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.16rem 0.6rem;
  color: #cfe8ff;
  background: rgba(76, 194, 255, 0.16);
  border: 1px solid rgba(76, 194, 255, 0.45);
  transition: background 0.15s ease, color 0.15s ease;
}
.sc-version-badge:hover {
  background: rgba(76, 194, 255, 0.3);
  color: #fff;
}

.unit-lib-toolbar {
  align-items: center;
}

.unit-lib-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--wc-muted);
  font-size: 0.84rem;
}

.unit-lib-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--wc-accent);
}

.unit-lib-card code {
  font-family: "JetBrains Mono", monospace;
  color: #9de7ff;
  font-size: 0.82rem;
}

.unit-lib-card--quick {
  overflow: hidden;
  padding: 0;
}

.unit-lib-card__body {
  padding: 0.95rem;
  display: grid;
  gap: 0.45rem;
}

.unit-lib-card__body h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.unit-lib-card__body .card-note {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unit-lib-card-media {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(27, 43, 54, 0.95), rgba(12, 18, 26, 0.92));
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.unit-lib-card-media--empty {
  display: grid;
  place-items: center;
  color: var(--wc-muted);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.unit-lib-edit-btn {
  border: 1px solid rgba(67, 208, 138, 0.35);
  background: rgba(39, 176, 110, 0.12);
  color: #c9fbe2;
}
.unit-reg-media-preview {
  display: grid;
  gap: 0.6rem;
  grid-column: 1 / -1;
}

.unit-reg-media-preview__image,
.unit-reg-media-preview__video {
  width: min(100%, 420px);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(8, 12, 18, 0.9);
}

.unit-library-return-fab {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 30;
  width: 84px;
  height: 84px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: radial-gradient(circle at 30% 25%, rgba(70, 165, 255, 0.34), rgba(10, 18, 26, 0.95));
  box-shadow: 0 18px 40px rgba(0,0,0,0.34);
  color: #f3f9ff;
  text-decoration: none;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 0.5rem;
  text-align: center;
}

.unit-library-return-fab__eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9ad6ff;
}

.unit-library-return-fab__label {
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.1;
}
.server-map-link { width: 100%; }

/* Map */
.map-hero { margin-bottom: 0.5rem; }
.map-hero h1 { margin: 0; font-family: "Space Grotesk", sans-serif; }
.map-hero p { margin: 0.35rem 0 0.7rem; color: var(--wc-muted); }

.map-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.map-hero-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.map-favorite-btn {
  min-width: 34px;
  min-height: 34px;
}

.map-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}
.map-panel { padding: 0.75rem; }

.map-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 0.7rem;
}

.map-toolbar-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

/* Map style selector – floating top-right overlay on the map */
.map-style-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  display: grid;
  gap: 0.35rem;
  background: rgba(14, 19, 22, 0.88);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.map-style-overlay label {
  color: var(--wc-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.map-style-overlay select {
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: rgba(17,21,24,0.82);
  color: #eef4f8;
  font: inherit;
  padding: 0.52rem 0.62rem;
}

/* Share button row – sits under the map, right-aligned */
.map-share-row {
  display: flex;
  justify-content: flex-end;
  padding: 0.45rem 0;
}

.btn-share {
  padding: 0.46rem 0.9rem;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  background: rgba(39,176,110,0.14);
  color: var(--wc-accent-2);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn-share:hover { background: rgba(39,176,110,0.28); }

.map-surface {
  position: relative;
  /* +25% taller than the previous min(68vh, 720px) — gives players a
     much larger battlefield view while still capping at the screen
     height so the map never overflows. */
  height: min(85vh, 900px);
  border-radius: 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, #273432, transparent 40%),
    radial-gradient(circle at 80% 10%, #2f3b34, transparent 45%),
    linear-gradient(180deg, #1d2727, #131b1d);
  border: 1px solid rgba(255,255,255,0.08);
}

/* On-map legend overlay */
.map-legend-overlay {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 1000;
  min-width: 190px;
  max-width: 260px;
  background: rgba(14, 19, 22, 0.88);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 0.76rem;
  color: var(--wc-muted);
  overflow: hidden;
}
.map-legend-toggle {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--wc-text);
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-align: left;
  letter-spacing: 0.02em;
}
.map-legend-toggle:hover { background: rgba(255,255,255,0.06); }
.map-legend-body {
  display: grid;
  gap: 0.3rem;
  padding: 0 0.7rem 0.55rem;
}
.map-legend-body.collapsed { display: none; }
.legend-filter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.legend-filter input[type="checkbox"] {
  accent-color: var(--wc-accent);
  margin: 0;
  width: 13px;
  height: 13px;
}
.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}
.legend-swatch.legend-base { background: #d9d9d9; border-radius: 50%; }
.legend-swatch.legend-ground-blue { background: #2196f3; border-radius: 50%; }
.legend-swatch.legend-aircraft { background: #64b5f6; border-radius: 2px; }
.legend-swatch.legend-enemy { background: #ff706f; border-radius: 2px; }
.legend-swatch.legend-self { background: #4dffa0; border-radius: 2px; }
.legend-swatch.legend-cone {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 10px solid rgba(107,195,255,0.7);
  background: transparent;
}
.legend-swatch.legend-threat {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px dashed rgba(156,186,255,0.9);
  background: rgba(156,186,255,0.12);
}
.legend-swatch.legend-trail {
  background: linear-gradient(to right, rgba(169,169,169,0.15), rgba(169,169,169,0.8));
  border-radius: 2px;
}
.legend-swatch.legend-territory {
  background: linear-gradient(to right, rgba(220,35,35,0.55), rgba(255,255,255,0.55) 50%, rgba(35,95,220,0.55));
  border-radius: 2px;
}
/* Ensure the territory canvas overlay doesn't capture pointer events */
.wc-territory-overlay { pointer-events: none !important; }

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 46px 46px;
}
.map-markers { position: absolute; inset: 0; }
.leaflet-map {
  position: absolute;
  inset: 0;
}
.marker {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.85);
  transform: translate(-50%, -50%);
}
.marker-online { background: var(--wc-accent); box-shadow: 0 0 0 6px rgba(39,176,110,0.22); }
.marker-offline { background: var(--wc-danger); box-shadow: 0 0 0 6px rgba(211,95,95,0.2); }
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.55rem 0.3rem 0;
  font-size: 0.76rem;
  color: var(--wc-muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 0.45rem; }
.legend-item::before {
  content: "";
  width: 10px;
  height: 10px;
  display: inline-block;
}
.legend-base::before { background: #d9d9d9; border-radius: 50%; }
.legend-ground-blue::before {
  background: #2196f3;
  border-radius: 50%;
}
.legend-ground-red::before {
  background: #e53935;
  border-radius: 50%;
}
.legend-aircraft::before { background: #64b5f6; border-radius: 2px; }
.legend-enemy::before { background: #ff706f; border-radius: 2px; }
.legend-self::before { background: #4dffa0; border-radius: 2px; }
.legend-cone::before {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 10px solid rgba(107,195,255,0.7);
  background: transparent;
}
.legend-trail::before {
  background: linear-gradient(to right, rgba(169,169,169,0.15), rgba(169,169,169,0.8));
  border-radius: 2px;
}

.map-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
  margin-top: 0.9rem;
}

.map-detail-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  border: 1px solid var(--wc-border);
  border-radius: 12px;
  padding: 0.85rem;
}

.map-detail-card h3 {
  margin-top: 0;
  font-family: "Space Grotesk", sans-serif;
}

.map-legend--stacked {
  display: grid;
  gap: 0.55rem;
}

.detail-list {
  display: grid;
  gap: 0.45rem;
}

.detail-row,
.map-popup-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 0.35rem;
}

.detail-row span,
.map-popup-row span {
  color: var(--wc-muted);
}

.detail-row strong,
.map-popup-row strong {
  text-align: right;
}

.map-popup h4 {
  margin: 0 0 0.6rem;
  font-family: "Space Grotesk", sans-serif;
}

.map-popup-actions {
  margin-top: 0.55rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.38rem;
  flex-wrap: wrap;
}

.map-copy-btn,
.map-jai-btn {
  background: rgba(255,255,255,0.08);
  color: #dce8ef;
  border: 1px solid rgba(255,255,255,0.16);
}

.map-copy-btn:hover,
.map-jai-btn:hover {
  background: rgba(67,208,138,0.2);
  border-color: rgba(67,208,138,0.34);
}

.map-pin-btn {
  min-width: 64px;
}

.map-pin-btn.is-pinned {
  background: rgba(39,176,110,0.26);
  border-color: rgba(67,208,138,0.45);
}

.map-div-icon-shell {
  background: transparent;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-shape-icon,
.map-aggregate-icon {
  position: relative;
  width: var(--marker-size);
  height: var(--marker-size);
  display: grid;
  place-items: center;
  color: #08120d;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  pointer-events: auto;
}

.map-shape-icon {
  background: var(--marker-color);
  border: 1px solid rgba(255,255,255,0.76);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.18), 0 0 10px rgba(0,0,0,0.22);
  border-radius: 999px;
}

.map-shape-icon--base,
.map-aggregate-icon--base {
  border-radius: 999px;
}

.map-base-icon {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  pointer-events: auto;
}
.map-base-icon__dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  min-width: 16px;
  border-radius: 3px;
  background: var(--marker-color);
  border: 2px solid rgba(255,255,255,0.85);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25), 0 0 10px rgba(0,0,0,0.4);
}
.map-base-icon__label {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.6);
  letter-spacing: 0.02em;
  line-height: 1;
  padding-left: 2px;
}

.map-shape-icon--ground,
.map-aggregate-icon--ground {
  border-radius: 999px;
}

.map-shape-icon--air,
.map-shape-icon--ownship,
.map-aggregate-icon--air {
  border-radius: 3px;
  transform: rotate(var(--marker-angle, 0deg));
}

.map-shape-icon--ownship {
  box-shadow: 0 0 0 2px rgba(77,255,160,0.18), 0 0 10px rgba(77,255,160,0.34);
}

.map-shape-icon--stale {
  opacity: 0.45;
  filter: saturate(0);
}

.map-alt-label {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) rotate(calc(-1 * var(--marker-angle, 0deg)));
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,0.95), 0 0 6px rgba(0,0,0,0.6);
  pointer-events: none;
  line-height: 1;
}

.map-pin-tooltip {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.map-pin-tooltip .leaflet-tooltip-content {
  margin: 0;
}

.map-ruler-tooltip {
  background: rgba(8,13,16,0.92);
  border: 1px solid rgba(255,209,102,0.55);
  color: #ffe6a9;
  font-family: "Space Grotesk", sans-serif;
  border-radius: 6px;
}

.map-pin-mini {
  display: grid;
  gap: 0.08rem;
  padding: 0.14rem 0.36rem;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 6px;
  background: rgba(8,13,16,0.88);
  color: #eef4f8;
  font-family: "Space Grotesk", sans-serif;
  line-height: 1.1;
}

.map-pin-mini strong {
  font-size: 0.67rem;
}

.map-pin-mini span {
  font-size: 0.62rem;
  color: #b8c5cf;
}

.map-aggregate-icon {
  background: color-mix(in srgb, var(--marker-color) 78%, #ffffff 22%);
  border: 2px solid rgba(255,255,255,0.86);
  box-shadow: 0 12px 20px rgba(0,0,0,0.26);
  border-radius: 999px;
}

.map-aggregate-icon--air {
  border-radius: 3px;
  transform: rotate(var(--marker-angle, 0deg));
}

.map-aggregate-icon__count {
  position: relative;
  z-index: 1;
  font-size: 0.78rem;
  line-height: 1;
}

.map-aggregate-icon--ground .map-aggregate-icon__count {
}

.player-signin-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  border: 1px solid rgba(67,208,138,0.25);
  border-radius: 10px;
  background: rgba(39,176,110,0.08);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.65rem;
}
.player-signin-form { display: flex; gap: 0.5rem; align-items: center; }
.player-signin-form input { width: 250px; }
.signin-msg { color: #9be7bd; font-size: 0.84rem; min-height: 1em; }
.signup-info { margin: 0 0 0.7rem 0; }

.tier-badge {
  display: inline-block;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tier-badge--anonymous { background: rgba(255,255,255,0.13); color: var(--wc-muted); }
.tier-badge--player { background: rgba(39,176,110,0.24); color: #aaf3cd; }
.tier-badge--subscriber { background: rgba(67,208,138,0.28); color: #c8ffdf; }
.tier-badge--free { background: rgba(255,255,255,0.12); color: var(--wc-muted); }
.tier-badge--pending { background: rgba(255,196,64,0.25); color: #f5d78a; }
.tier-badge--approved { background: rgba(39,176,110,0.24); color: #aaf3cd; }
.tier-badge--denied { background: rgba(211,95,95,0.22); color: #ffbcbc; }
.tier-badge--spectator { background: rgba(100,160,255,0.22); color: #b8d8ff; }

.coalition-selector-buttons { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.btn-team {
  border: none;
  cursor: pointer;
}
.btn-team--active { box-shadow: 0 0 0 2px rgba(67,208,138,0.35); }
.notice-modal--coalition {
  border-color: rgba(67, 208, 138, 0.35);
  background: linear-gradient(180deg, rgba(24,33,38,0.98), rgba(14,20,24,0.98));
}

/* Map unit popup (compact Leaflet popup) */
.wc-unit-popup .leaflet-popup-content-wrapper {
  background: rgba(14,20,24,0.97);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  color: #eef4f8;
  padding: 0;
}
.wc-unit-popup .leaflet-popup-tip-container { display: none; }
.wc-unit-popup .leaflet-popup-content { margin: 0; }
.map-popup {
  padding: 0.6rem 0.75rem 0.5rem;
  min-width: 160px;
}
.map-popup-title {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}
.map-popup-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  padding: 0.12rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.map-popup-row span { color: var(--wc-muted); }
.map-popup-row strong { text-align: right; }
.map-popup-actions {
  margin-top: 0.4rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}
.map-detail-btn {
  flex: 1;
  text-align: center;
}
.map-popup-pin-btn {
  border: none;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 0.25rem 0.45rem;
  font-size: 0.92rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 130ms, background 130ms;
}
.map-popup-pin-btn:hover { opacity: 1; background: rgba(255,255,255,0.16); }
.map-popup-pin-btn.is-pinned { opacity: 1; background: rgba(255,215,80,0.22); }

/* Unit detail modal */
.notice-modal--unit {
  max-width: 460px;
  position: relative;
  padding-top: 1.4rem;
}
.modal-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--wc-muted);
  cursor: pointer;
  padding: 0 0.2rem;
}
.modal-close-btn:hover { color: var(--wc-text); }
.unit-detail-title {
  margin: 0 0 0.85rem;
  font-size: 1.1rem;
  font-family: "Space Grotesk", sans-serif;
}
.unit-detail-summary,
.unit-detail-full {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.7rem;
}
.unit-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.22rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.unit-detail-row span { color: var(--wc-muted); font-size: 0.84rem; flex-shrink: 0; }
.unit-detail-row strong { font-size: 0.88rem; text-align: right; }
.unit-detail-full { margin-top: 0.5rem; }
.unit-detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--wc-border);
}
.unit-detail-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.unit-detail-page-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.05fr);
  gap: 1rem;
}

.unit-detail-back-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 0.75rem;
}

.unit-detail-page-card {
  display: grid;
  gap: 0.85rem;
}

.unit-detail-page-card--media {
  align-content: start;
}

.unit-detail-page-image,
.unit-detail-page-video {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(10, 16, 24, 0.92);
}

.unit-detail-page-image {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.unit-detail-page-image--empty {
  display: grid;
  place-items: center;
  color: var(--wc-muted);
  min-height: 220px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.unit-detail-page-image--empty {
  display: grid;
  place-items: center;
  color: var(--wc-muted);
}

.unit-detail-page-facts {
  display: grid;
  gap: 0.25rem;
}

.unit-detail-page-note {
  margin-top: 0.25rem;
}

/* ── Manual Processing Banner (aircraft detail page) ── */
.unit-manual-processing-banner {
  max-width: 900px;
  margin: 0 auto 1.5rem;
  padding: 0 1rem;
}
.unit-manual-processing-card {
  background: rgba(255, 180, 50, 0.08);
  border: 1px solid rgba(255, 180, 50, 0.28);
  border-radius: 0.75rem;
  padding: 1.2rem 1.4rem;
}
.unit-manual-processing-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.unit-manual-processing-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}
.unit-manual-processing-title {
  margin: 0;
  font-size: 1.05rem;
  font-family: "Space Grotesk", sans-serif;
  color: #ffd97d;
}
.unit-manual-processing-message {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  color: var(--wc-muted);
}
.unit-manual-processing-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.unit-manual-processing-progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}
.unit-manual-processing-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #e6a31e, #ffd97d);
  border-radius: 4px;
  transition: width 0.6s ease;
  min-width: 0;
}
.unit-manual-processing-pct {
  font-size: 0.82rem;
  color: #ffd97d;
  min-width: 2.6rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.unit-wiki-section {
  display: grid;
  gap: 0.5rem;
  padding-top: 0.2rem;
}

.unit-wiki-section h3 {
  margin: 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--wc-border);
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.02rem;
}

.unit-wiki-prose {
  font-size: 0.96rem;
  line-height: 1.62;
  color: #dbe6ee;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.coalition-selector-buttons--modal {
  margin-top: 0.55rem;
  gap: 0.6rem;
}
.coalition-selector-buttons--modal .btn-team {
  min-width: 160px;
  text-align: center;
}
.map-page-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.7rem 0;
}

/* Desktop modules render inside the native application shell.  Keep the
   module itself, but remove the duplicated website chrome around it. */
body.desktop-embedded > .topbar,
body.desktop-embedded > .site-footer,
body.desktop-embedded > .jai-fab,
body.desktop-embedded > .jai-widget {
  display: none !important;
}

body.desktop-embedded > main {
  min-height: 100vh;
}
.holoview-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}
.holoview-launch span {
  border: 1px solid rgba(67, 208, 138, 0.38);
  border-radius: 999px;
  padding: 0.08rem 0.38rem;
  color: var(--wc-accent-2, #43d08a);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.holoview-launch--locked {
  border-color: rgba(255,255,255,0.09);
  background: rgba(110, 120, 128, 0.16);
  color: rgba(210, 218, 224, 0.46);
  cursor: not-allowed;
  filter: grayscale(1);
}
.holoview-launch--locked span { color: rgba(210, 218, 224, 0.42); border-color: rgba(255,255,255,0.1); }
#changeTeamsBtn {
  min-height: 36px;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.brasit-hud {
  position: fixed;
  top: 76px;
  right: 1rem;
  z-index: 28;
  min-width: 230px;
  max-width: 350px;
  border: 1px solid rgba(77, 255, 160, 0.38);
  border-radius: 8px;
  background: rgba(10, 18, 14, 0.86);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  padding: 0.55rem 0.9rem;
  font-family: "Space Grotesk", monospace;
  color: #b4f8d3;
  opacity: 0;
  pointer-events: none;
}
.brasit-hud--active { opacity: 1; pointer-events: auto; }
.brasit-header {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4dffa0;
  border-bottom: 1px solid rgba(77,255,160,0.2);
  margin-bottom: 0.35rem;
  padding-bottom: 0.2rem;
}
.brasit-line { font-size: 0.8rem; padding: 0.1rem 0; }
.brasit-clear { color: #4dffa0; font-style: italic; }

body.map-compact-hud .brasit-hud {
  min-width: 170px;
  max-width: 220px;
  padding: 0.35rem 0.5rem;
  right: 0.45rem;
  top: 66px;
}

body.map-compact-hud .map-style-overlay {
  transform: scale(0.92);
  transform-origin: top right;
  padding: 0.35rem 0.48rem;
}

body.map-compact-hud .map-toolbar-actions .btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.76rem;
}

body.map-compact-hud .brasit-header {
  font-size: 0.66rem;
}

body.map-compact-hud .brasit-line {
  font-size: 0.7rem;
}

body.map-compact-hud .map-legend-overlay {
  min-width: 150px;
}

/* Auth/Admin */
.auth-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.2rem auto;
  max-width: 920px;
}
.auth-section--center { grid-template-columns: 1fr; max-width: 480px; }
.auth-card { padding: 1.2rem; }
.auth-card--secondary { border-color: rgba(39,176,110,0.25); background: rgba(39,176,110,0.08); }
.auth-form { display: grid; gap: 0.6rem; margin-top: 0.8rem; }
.auth-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.auth-form-row > div { display: grid; gap: 0.3rem; }
.auth-form label { color: var(--wc-muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.auth-field-hint { color: var(--wc-muted); font-size: 0.84rem; margin: -0.25rem 0 0; }
.auth-password-hint { color: var(--wc-muted); font-size: 0.84rem; margin: -0.25rem 0 0; }
.auth-error {
  border: 1px solid rgba(211,95,95,0.35);
  border-radius: 8px;
  background: rgba(211,95,95,0.14);
  color: #ffbbbb;
  padding: 0.5rem 0.7rem;
}
.auth-alt { color: var(--wc-muted); font-size: 0.84rem; }

.btn-primary,
.btn-sm {
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: #05130b;
  background: linear-gradient(135deg, var(--wc-accent), var(--wc-accent-2));
}
.btn-primary { border-radius: 8px; padding: 0.55rem 1.2rem; }
.btn-sm { border-radius: 8px; padding: 0.35rem 0.78rem; }
.btn-danger { background: linear-gradient(135deg, #c85454, #d86f6f); color: #fff3f3; }

/* Admin control centre */
.admin-shell {
  --admin-surface: rgba(21, 27, 30, 0.88);
  --admin-surface-raised: rgba(31, 38, 42, 0.92);
  --admin-input: rgba(8, 13, 15, 0.72);
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 1.4rem;
  width: min(1480px, 100%);
  margin: 0 auto;
}

.admin-sidebar {
  position: sticky;
  top: 5.1rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 7.2rem);
  padding: 0.9rem;
  border: 1px solid var(--wc-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(27, 34, 37, 0.96), rgba(15, 20, 22, 0.94));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.2);
}

.admin-sidebar-heading {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.35rem 1rem;
  border-bottom: 1px solid var(--wc-border);
}
.admin-sidebar-heading > div { display: grid; gap: 0.08rem; min-width: 0; }
.admin-sidebar-heading > div > span {
  color: var(--wc-accent-2);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.admin-sidebar-heading strong { font-family: "Space Grotesk", sans-serif; font-size: 1rem; }
.admin-sidebar-mark {
  display: grid;
  flex: 0 0 2.25rem;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border: 1px solid rgba(67, 208, 138, 0.58);
  border-radius: 10px;
  background: rgba(39, 176, 110, 0.1);
  color: #aaf3cd;
  font: 800 0.72rem/1 "Space Grotesk", sans-serif;
}

.admin-subnav {
  display: grid;
  gap: 0.24rem;
  padding: 0.8rem 0;
}
.admin-subnav a {
  position: relative;
  display: grid;
  gap: 0.08rem;
  padding: 0.64rem 0.72rem 0.64rem 0.88rem;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--wc-text);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.admin-subnav a::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--wc-accent-2);
  opacity: 0;
}
.admin-subnav a strong { font-size: 0.84rem; font-weight: 750; }
.admin-subnav a small { color: var(--wc-muted); font-size: 0.69rem; }
.admin-subnav a:hover {
  border-color: rgba(67, 208, 138, 0.2);
  background: rgba(67, 208, 138, 0.06);
  color: var(--wc-text);
  transform: translateX(2px);
}
.admin-subnav a.is-active {
  border-color: rgba(67, 208, 138, 0.3);
  background: linear-gradient(90deg, rgba(39, 176, 110, 0.18), rgba(39, 176, 110, 0.06));
  color: #dffbed;
}
.admin-subnav a.is-active::before { opacity: 1; }
.admin-subnav a.is-active small { color: #a6d9bb; }

.admin-session-state {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
  padding: 0.72rem;
  border: 1px solid rgba(67, 208, 138, 0.17);
  border-radius: 10px;
  background: rgba(39, 176, 110, 0.06);
}
.admin-session-state > span,
.admin-access-badge i {
  width: 0.48rem;
  height: 0.48rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--wc-accent-2);
  box-shadow: 0 0 0 4px rgba(67, 208, 138, 0.1), 0 0 12px rgba(67, 208, 138, 0.5);
}
.admin-session-state div { display: grid; gap: 0.08rem; }
.admin-session-state strong { font-size: 0.75rem; }
.admin-session-state small { color: var(--wc-muted); font-size: 0.65rem; }

.admin-workspace { min-width: 0; }
.admin-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.1rem;
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--wc-border);
  border-radius: 16px;
  background:
    linear-gradient(110deg, rgba(39, 176, 110, 0.1), transparent 42%),
    var(--admin-surface);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
}
.admin-page-header .eyebrow { margin: 0 0 0.38rem; font-size: 0.65rem; }
.admin-page-header h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.65rem, 2.6vw, 2.35rem);
  line-height: 1.06;
}
.admin-page-header p:not(.eyebrow) {
  max-width: 760px;
  margin: 0.48rem 0 0;
  color: var(--wc-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
.admin-access-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex: 0 0 auto;
  padding: 0.5rem 0.72rem;
  border: 1px solid rgba(67, 208, 138, 0.28);
  border-radius: 999px;
  background: rgba(39, 176, 110, 0.09);
  color: #b9f2d2;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-section {
  display: grid;
  gap: 1rem;
  margin: 0;
  max-width: none;
}
.admin-card {
  padding: 1.2rem;
  background: linear-gradient(180deg, var(--admin-surface-raised), var(--admin-surface));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.13);
}
.admin-card > h2:first-child,
.admin-card > div:first-child h2:first-child { margin-top: 0; }
.admin-card h2 { font-family: "Space Grotesk", sans-serif; font-size: 1.05rem; }
.admin-table-wrap {
  width: 100%;
  margin-top: 0.85rem;
  overflow-x: auto;
  border: 1px solid var(--wc-border);
  border-radius: 11px;
  background: rgba(7, 11, 13, 0.28);
  scrollbar-color: rgba(67, 208, 138, 0.4) transparent;
}
.admin-table { width: 100%; min-width: 660px; border-collapse: collapse; font-size: 0.84rem; }
.admin-table th,
.admin-table td { padding: 0.76rem 0.78rem; border-bottom: 1px solid var(--wc-border); text-align: left; vertical-align: middle; }
.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(19, 25, 28, 0.98);
  color: var(--wc-muted);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.admin-table tbody tr { transition: background 0.12s ease; }
.admin-table tbody tr:hover { background: rgba(67, 208, 138, 0.045); }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table code {
  padding: 0.2rem 0.38rem;
  border: 1px solid var(--wc-border);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.22);
  color: #b8e6c8;
}
.admin-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.admin-register-form { display: flex; gap: 0.55rem; align-items: center; margin-bottom: 0.8rem; }
.admin-register-form input { flex: 1; }
.admin-register-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.admin-users-search { position: relative; margin-bottom: 0.7rem; }
.admin-users-search input { width: 100%; }

.admin-shell input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
.admin-shell select,
.admin-shell textarea,
.admin-modal input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
.admin-modal select,
.admin-modal textarea {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 9px;
  outline: none;
  background: linear-gradient(180deg, rgba(7, 12, 14, 0.82), rgba(13, 18, 21, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025), 0 1px 2px rgba(0, 0, 0, 0.14);
  color: var(--wc-text);
  font: inherit;
  font-size: 0.86rem;
  padding: 0.66rem 0.78rem;
  color-scheme: dark;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.admin-shell textarea,
.admin-modal textarea { min-height: 7rem; line-height: 1.5; resize: vertical; }
.admin-shell input::placeholder,
.admin-shell textarea::placeholder,
.admin-modal input::placeholder,
.admin-modal textarea::placeholder { color: #718087; opacity: 1; }
.admin-shell input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):hover,
.admin-shell select:hover,
.admin-shell textarea:hover,
.admin-modal input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):hover,
.admin-modal select:hover,
.admin-modal textarea:hover { border-color: rgba(67, 208, 138, 0.3); }
.admin-shell input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):focus,
.admin-shell select:focus,
.admin-shell textarea:focus,
.admin-modal input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):focus,
.admin-modal select:focus,
.admin-modal textarea:focus {
  border-color: var(--wc-accent-2);
  background: rgba(7, 13, 15, 0.95);
  box-shadow: 0 0 0 3px var(--wc-ring), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}
.admin-shell input[type="file"],
.admin-modal input[type="file"] { padding: 0.36rem; }
.admin-shell input[type="file"]::file-selector-button,
.admin-modal input[type="file"]::file-selector-button {
  margin-right: 0.7rem;
  padding: 0.46rem 0.68rem;
  border: 1px solid rgba(67, 208, 138, 0.28);
  border-radius: 7px;
  background: rgba(39, 176, 110, 0.12);
  color: #c9f6dd;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.admin-shell input[type="checkbox"],
.admin-shell input[type="radio"],
.admin-modal input[type="checkbox"],
.admin-modal input[type="radio"] { accent-color: var(--wc-accent-2); }
.admin-section label,
.admin-modal label {
  color: #c6d0d5;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.025em;
}
.admin-section .btn-sm,
.admin-section .btn-primary,
.admin-modal .btn-sm,
.admin-modal .btn-primary { min-height: 2.45rem; padding: 0.55rem 0.82rem; border-radius: 8px; }
.admin-section .btn-sm:not(.btn-primary):not(.btn-danger),
.admin-modal .btn-sm:not(.btn-primary):not(.btn-danger) {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.055);
  color: var(--wc-text);
}
.admin-section .btn-sm:hover,
.admin-section .btn-primary:hover,
.admin-modal .btn-sm:hover,
.admin-modal .btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); }

@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; gap: 0.9rem; }
  .admin-sidebar { position: static; min-height: 0; padding: 0.75rem; }
  .admin-sidebar-heading { padding-bottom: 0.7rem; }
  .admin-subnav {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 0.7rem 0 0;
    scrollbar-width: thin;
  }
  .admin-subnav a { flex: 0 0 auto; min-width: 126px; padding: 0.58rem 0.7rem; }
  .admin-subnav a:hover { transform: translateY(-1px); }
  .admin-session-state { display: none; }
}
@media (max-width: 620px) {
  main { padding-left: 0.8rem; padding-right: 0.8rem; }
  .admin-page-header { padding: 1rem; }
  .admin-access-badge { display: none; }
  .admin-card { padding: 0.9rem; }
  .admin-table { min-width: 600px; }
  .admin-sidebar-heading > div > span { display: none; }
}
.jai-badge { padding: 0.12rem 0.45rem; border-radius: 999px; font-size: 0.72rem; }
.jai-badge--on { background: rgba(39,176,110,0.24); color: #aaf3cd; }
.jai-badge--off { background: rgba(255,255,255,0.12); color: var(--wc-muted); }

.admin-modal {
  width: min(660px, calc(100vw - 2rem));
}

.admin-wizard-step {
  display: grid;
  gap: 0.45rem;
  margin: 0.6rem 0;
}

.admin-wizard-actions {
  gap: 0.55rem;
}

.admin-dropbar {
  position: absolute;
  z-index: 62;
  left: 0;
  right: 0;
  top: calc(100% + 0.25rem);
  display: grid;
  gap: 0.2rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  background: rgba(14,19,22,0.96);
  padding: 0.35rem;
}

.admin-dropbar-item {
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  color: var(--wc-text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  padding: 0.44rem 0.56rem;
  display: grid;
}

.admin-dropbar-item span {
  color: var(--wc-muted);
  font-size: 0.76rem;
}

.admin-dropbar-item:hover {
  border-color: rgba(67,208,138,0.35);
  background: rgba(39,176,110,0.12);
}

.admin-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin: 0.6rem 0 0.2rem;
}

.admin-field {
  margin: 0.4rem 0 0.8rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(120, 150, 200, 0.18);
}
.admin-field > label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
  color: var(--wc-muted);
}
.admin-field-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.admin-field-row select {
  flex: 1;
  min-width: 0;
}

/* ── Unit Registry ─────────────────────────────────────────────────────────── */
.unit-reg-header { margin-bottom: 0.85rem; }
.unit-reg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
  align-items: center;
}
.unit-reg-toolbar input[type="search"] {
  flex: 1;
  min-width: 180px;
}
.unit-reg-summary {
  margin: 0.55rem 0 0;
  color: var(--wc-muted);
  font-size: 0.82rem;
}
.unit-reg-table-wrap { overflow-x: auto; }
.unit-reg-table code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  color: var(--wc-accent-2);
}

.unit-reg-modal {
  width: min(780px, calc(100vw - 2rem));
  max-height: 90vh;
  overflow-y: auto;
}
.unit-reg-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin: 0.8rem 0;
}
.unit-reg-notes-label,
.unit-reg-reviewed-label { grid-column: 1 / -1; }
.unit-reg-edit-grid label {
  display: grid;
  gap: 0.3rem;
}
.unit-reg-edit-grid textarea { resize: vertical; }
.unit-reg-reviewed-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-transform: none;
  font-size: 0.9rem;
  color: var(--wc-text);
  cursor: pointer;
}
.unit-reg-reviewed-label input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--wc-accent);
  cursor: pointer;
}
@media (max-width: 600px) {
  .unit-reg-edit-grid { grid-template-columns: 1fr; }
}

/* Account Dashboard */
.account-dashboard {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr);
  gap: 1rem;
  margin: 1rem auto 0;
  align-items: start;
}

.account-nav {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  border: 1px solid var(--wc-border);
  border-radius: 12px;
  padding: 0.65rem;
  display: grid;
  gap: 0.45rem;
  align-content: start;
  position: sticky;
  top: clamp(170px, 30vh, 320px);
  height: fit-content;
}

.account-nav-btn {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  color: var(--wc-text);
  font: inherit;
  text-align: left;
  padding: 0.56rem 0.72rem;
  cursor: pointer;
}

.account-nav-btn:hover { background: rgba(255,255,255,0.05); }

.account-nav-btn.is-active {
  border-color: rgba(67,208,138,0.42);
  background: rgba(39,176,110,0.15);
  color: #bff7da;
}

.account-content {
  display: grid;
  gap: 1rem;
}

.account-tab { display: none; }
.account-tab.is-active { display: block; }

.account-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  border: 1px solid var(--wc-border);
  border-radius: 12px;
  padding: 1rem;
}

.account-card h2 {
  margin-top: 0;
  font-family: "Space Grotesk", sans-serif;
}

.desktop-authorize-card { max-width: 720px; margin: 0 auto 3rem; }
.desktop-device-list { display: grid; gap: .65rem; margin-top: 1rem; }
.desktop-device-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem; border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.025); }
.desktop-device-row div { display: grid; gap: .2rem; }
.desktop-device-row span { color: var(--muted); font-size: .82rem; }
.desktop-device-row.is-revoked { opacity: .55; }
.desktop-app-card { overflow: hidden; }
.desktop-app-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; }
.desktop-app-eyebrow { margin: 0 0 .45rem; color: var(--wc-accent-2); font-size: .72rem; font-weight: 800; letter-spacing: .14em; }
.desktop-access-badge { flex: 0 0 auto; padding: .38rem .62rem; border: 1px solid rgba(94,231,146,.45); border-radius: 999px; color: #74eca0; background: rgba(41,139,78,.12); font-size: .68rem; font-weight: 800; letter-spacing: .08em; }
.desktop-access-badge.is-locked { border-color: rgba(240,186,99,.4); color: #f0ba63; background: rgba(160,104,32,.12); }
.desktop-download-panel { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.25rem 0; padding: 1rem; border: 1px solid var(--wc-border); border-radius: 12px; background: rgba(255,255,255,.025); }
.desktop-download-panel div { display: grid; gap: .25rem; }
.desktop-download-panel span { color: var(--wc-muted); font-size: .8rem; }
.desktop-download-panel .cta { margin: 0; white-space: nowrap; }
.desktop-install-steps { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .75rem; margin: 1rem 0; padding: 0; list-style: none; counter-reset: desktop-step; }
.desktop-install-steps li { position: relative; display: grid; gap: .25rem; padding: .9rem .9rem .9rem 2.75rem; border: 1px solid var(--wc-border); border-radius: 10px; background: rgba(255,255,255,.018); counter-increment: desktop-step; }
.desktop-install-steps li::before { content: counter(desktop-step); position: absolute; left: .8rem; top: .85rem; width: 1.35rem; height: 1.35rem; display: grid; place-items: center; border: 1px solid var(--wc-accent); border-radius: 50%; color: var(--wc-accent-2); font-size: .68rem; font-weight: 800; }
.desktop-install-steps span { color: var(--wc-muted); font-size: .78rem; line-height: 1.4; }

.account-kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.7rem;
}

.account-kv-grid div {
  border: 1px solid var(--wc-border);
  border-radius: 10px;
  padding: 0.62rem 0.7rem;
  background: rgba(255,255,255,0.02);
  display: grid;
  gap: 0.24rem;
}

.account-kv-grid span {
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--wc-muted);
}

.account-kv-grid strong { font-size: 0.98rem; }

.account-newsletter-row { margin-top: 0.4rem; }
.account-alert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.4rem 0.7rem;
  margin-top: 0.35rem;
}
.account-save-btn { width: fit-content; }
.account-logout-form { margin-top: 0.6rem; }

.account-server-name-form {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.account-server-card-form {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.account-server-name-form input[type="text"] {
  min-width: 240px;
}

.account-server-card-form input[type="text"] {
  min-width: 240px;
}

.account-server-msg {
  margin: 0.3rem 0 0;
}

@media (max-width: 980px) {
  .account-dashboard { grid-template-columns: 1fr; }
  .account-nav {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
}

/* Legacy JAI page support */
.jai-layout { max-width: 800px; margin: 1rem auto; }
.jai-chat-container {
  border: 1px solid var(--wc-border);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 260px);
  min-height: 420px;
}
.jai-messages { flex: 1; overflow-y: auto; padding: 1rem; display: grid; gap: 0.7rem; }
.jai-msg { max-width: 76%; padding: 0.62rem 0.9rem; border-radius: 10px; }
.jai-msg--user { justify-self: end; background: rgba(39,176,110,0.22); border: 1px solid rgba(39,176,110,0.32); }
.jai-msg--admin { justify-self: start; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14); }
.jai-role { font-size: 0.72rem; color: var(--wc-muted); display: block; margin-bottom: 0.1rem; }
.jai-content { margin: 0; }
.jai-content,
.jai-widget-msg p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.jai-time { font-size: 0.7rem; color: var(--wc-muted); }
.jai-input-row { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem; padding: 0.75rem 1rem; border-top: 1px solid var(--wc-border); }

/* Floating JAI widget */
.jai-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 45;
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--wc-accent), var(--wc-accent-2));
  color: #04130a;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 14px 26px rgba(0,0,0,0.36);
  transition: opacity 180ms ease, transform 180ms ease;
}
.jai-fab[aria-expanded="true"] {
  opacity: 0;
  transform: scale(0.7);
  pointer-events: none;
}
.jai-fab:focus-visible,
.jai-widget-close:focus-visible,
.jai-widget-input:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--wc-ring); }

.jai-widget {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 44;
  width: min(560px, calc(100vw - 2rem));
  height: min(74vh, 620px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid var(--wc-border);
  border-radius: 16px;
  background: rgba(18,22,25,0.96);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 22px 54px rgba(0,0,0,0.42);
  overflow: hidden;
  opacity: 0;
  transform-origin: bottom right;
  transform: translateY(0) scale(0.12);
  pointer-events: none;
  transition: opacity 210ms ease, transform 210ms cubic-bezier(.2,.8,.2,1);
}
.jai-widget--open {
  opacity: 1;
  transform: translateY(-78px) scale(1);
  pointer-events: auto;
}

.jai-widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.82rem 0.95rem;
  border-bottom: 1px solid var(--wc-border);
  background: linear-gradient(135deg, rgba(39,176,110,0.18), rgba(67,208,138,0.08));
}
.jai-widget-header strong { font-family: "Space Grotesk", sans-serif; }
.jai-widget-subtitle { margin: 0.16rem 0 0; color: var(--wc-muted); font-size: 0.76rem; }
.jai-widget-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: #e8ecef;
  cursor: pointer;
  font-size: 1.08rem;
}
.jai-widget-reset {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  color: var(--wc-muted);
  cursor: pointer;
  font-size: 1.08rem;
  margin-right: 0.35rem;
  transition: background 140ms, color 140ms;
}
.jai-widget-reset:hover { background: rgba(255,80,80,0.18); color: #ff8080; }

.jai-widget-history {
  overflow-y: auto;
  padding: 0.9rem;
  display: grid;
  gap: 0.6rem;
  align-content: start;
}
.jai-widget-msg {
  max-width: 94%;
  border-radius: 14px;
  padding: 0.75rem 0.95rem;
  font-size: 0.94rem;
  line-height: 1.48;
}
.jai-widget-msg p { margin: 0; }
.jai-widget-msg--user {
  justify-self: end;
  background: linear-gradient(135deg, var(--wc-accent), var(--wc-accent-2));
  color: #04130b;
  border-bottom-right-radius: 6px;
}
.jai-widget-msg--system {
  justify-self: start;
  background: rgba(255,255,255,0.08);
  color: #eef4f8;
  border: 1px solid rgba(255,255,255,0.12);
  border-bottom-left-radius: 6px;
}
.jai-typing {
  min-width: 78px;
}
.jai-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  min-height: 0.9rem;
}
.jai-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(232,236,239,0.9);
  animation: jaiTypingPulse 1s ease-in-out infinite;
}
.jai-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.jai-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
.jai-widget-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  padding: 0.8rem 0.85rem;
  border-top: 1px solid var(--wc-border);
}
.jai-widget-send { border-radius: 999px; padding-inline: 0.95rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-footer {
  margin-top: auto;
  position: relative;
  z-index: 14;
  width: 100%;
  padding: 0.55rem 0.8rem;
  font-size: 0.76rem;
  text-align: center;
  color: #d7e1e8;
  background: rgba(12, 16, 18, 0.93);
  border-top: 1px solid rgba(255,255,255,0.09);
}

.footer-link {
  color: #9be7bd;
}

.footer-separator {
  padding-inline: 0.35rem;
  color: rgba(255,255,255,0.35);
}

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

@keyframes jaiTypingPulse {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

/* WIDE FLEET MODE */
body.servers-page main {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  /* Reserve desktop room so the expanded JAI widget can sit outside content. */
  padding: 1.25rem clamp(1rem, 2vw, 2rem) 6rem 1.25rem;
  padding-right: clamp(1rem, 2vw, 2rem);
}

@media (min-width: 1200px) {
  body.servers-page main {
    max-width: calc(100vw - 27rem);
    padding-right: clamp(1rem, 2vw, 2rem);
  }
}

@media (max-width: 1199px) {
  body.servers-page main {
    padding-right: clamp(1rem, 2vw, 2rem);
  }
}

/* FULL-SCREEN MAP MODE */
body.map-page main {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0.7rem 0.9rem;
}

body.map-page .map-hero,
body.map-page .player-signin-bar,
body.map-page .map-page-actions,
body.map-page .map-layout,
body.map-page .map-detail-grid {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

@media (min-width: 1200px) {
  body.map-page main {
    /* Keep the map naturally wide while preserving room for the JAI panel. */
    max-width: calc(100vw - 27rem);
    padding-right: 0.9rem;
  }
}

@media (max-width: 1199px) {
  body.map-page main {
    padding-right: 0.9rem;
  }
}

body.map-page .map-layout {
  height: calc(100vh - 132px);
  min-height: 540px;
}
body.map-page .site-footer {
  display: none;
}
body.map-page .map-panel { height: 100%; }
body.map-page .map-surface {
  height: auto;
  /* +25% taller floor (was 520px) for the dedicated /map page where the
     surface stretches to fill the viewport.  The viewport-fill rule
     (calc(100vh - 132px)) above already maxes it out on tall windows;
     this just guarantees a generous height on shorter ones. */
  min-height: 650px;
}

@media (max-width: 900px) {
  .story-grid { grid-template-columns: 1fr; }
  .map-layout { grid-template-columns: 1fr; }
  /* Mobile heights bumped proportionally with the desktop +25% */
  .map-surface { height: 68vh; }
  body.map-page .map-layout {
    height: auto;
    min-height: 0;
  }
  body.map-page .map-surface {
    height: 85vh;
    min-height: 450px;
  }
}

@media (max-width: 700px) {
  .map-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .detail-row,
  .map-popup-row {
    flex-direction: column;
    gap: 0.2rem;
  }
}

@media (max-width: 700px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .auth-section { grid-template-columns: 1fr; }
  .unit-detail-page-grid { grid-template-columns: 1fr; }
  .unit-library-return-fab {
    width: 74px;
    height: 74px;
    left: 0.7rem;
    bottom: 0.7rem;
  }
  .brasit-hud {
    right: 0.45rem;
    max-width: calc(100vw - 0.9rem);
    font-size: 0.74rem;
  }
  .jai-widget {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    bottom: 0.7rem;
    height: min(68vh, 560px);
    transform-origin: bottom right;
    transform: translateY(0) scale(0.12);
  }
  .jai-widget--open {
    transform: translateY(-72px) scale(1);
  }
  .jai-fab {
    right: 0.7rem;
    bottom: 0.7rem;
    width: 58px;
    height: 58px;
  }
}



/* ============================================================================
   MANUALS
   ============================================================================ */

.manuals-toolbar { gap: 0.5rem; flex-wrap: wrap; }

.manuals-card-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.manual-detail-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.2rem;
  align-items: start;
  margin-top: 1rem;
}

@media (max-width: 760px) {
  .desktop-app-heading, .desktop-download-panel { align-items: stretch; flex-direction: column; }
  .desktop-access-badge { align-self: flex-start; }
  .desktop-download-panel .cta { text-align: center; }
  .desktop-install-steps { grid-template-columns: 1fr; }
  .manual-detail-grid { grid-template-columns: 1fr; }
}

.manual-meta-card { position: sticky; top: 1rem; }

.manual-content-col { display: flex; flex-direction: column; gap: 1.2rem; }

.manual-section-card {}

.manual-section-card h2 {
  margin: 0 0 0.8rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
}

.manual-notes-list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.manual-note-item {
  font-size: 0.9rem;
  color: var(--wc-text);
  margin: 0;
}

.manual-spec-grid {
  display: grid;
  gap: 0.35rem;
}

.manual-guides-grid { display: flex; flex-direction: column; gap: 0.8rem; }

.manual-guides-grid--cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.7rem;
}

.manual-guide-card--compact {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.65rem 0.7rem;
}

.manual-guide-card--filtered-out {
  display: none !important;
}

.manual-guide-card--compact .manual-guide-title {
  font-size: 0.9rem;
  line-height: 1.2;
}

.manual-guide-card--compact .manual-guide-controls {
  margin-top: 0.55rem;
}

@media (max-width: 1260px) {
  .manual-guides-grid--cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .manual-guides-grid--cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .manual-guides-grid--cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.manual-procedure-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.manual-procedure-count {
  color: var(--wc-muted);
  font-size: 0.9em;
  font-weight: 500;
}

.manual-procedure-head input[type="search"] {
  width: min(360px, 100%);
  background: var(--wc-input-bg, rgba(255,255,255,0.06));
  border: 1px solid var(--wc-border, rgba(255,255,255,0.12));
  border-radius: 4px;
  color: var(--wc-text);
  padding: 0.4rem 0.55rem;
  font-size: 0.86rem;
}

.manual-top-procedures {
  margin-bottom: 0.85rem;
}

.manual-top-procedures h3 {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
}

.manual-procedure-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.manual-procedure-chip {
  border: 1px solid rgba(67, 208, 138, 0.4);
  background: rgba(39, 176, 110, 0.1);
  color: var(--wc-text);
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.manual-procedure-chip span {
  color: var(--wc-muted);
}

.manual-guide-card {
  background: var(--wc-surface-2, rgba(255,255,255,0.04));
  border: 1px solid var(--wc-border, rgba(255,255,255,0.08));
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
}

.manual-guide-title {
  cursor: default;
  font-weight: 600;
  font-size: 0.93rem;
  list-style: none;
  padding: 0.2rem 0;
  margin: 0;
}

.manual-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.manual-guide-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.manual-guide-tags {
  display: inline-flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.manual-tag {
  border: 1px solid var(--wc-border);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.74rem;
  color: var(--wc-muted);
}

.manual-tag-danger {
  border-color: rgba(255, 80, 80, 0.45);
  color: #ff8080;
  background: rgba(255, 80, 80, 0.08);
}

.manual-guide-steps {
  margin: 0.5rem 0 0;
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.manual-guide-steps li { font-size: 0.88rem; }

.manual-source-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.manual-source-item {
  border: 1px solid var(--wc-border);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.manual-source-item h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

.manual-source-actions {
  display: inline-flex;
  gap: 0.45rem;
}

.manual-procedure-steps {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.5rem;
  max-height: 52vh;
  overflow: auto;
}

.manual-procedure-step {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border: 1px solid var(--wc-border);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: rgba(255,255,255,0.03);
}

.manual-procedure-step input[type="checkbox"] {
  margin-top: 0.14rem;
}

.manual-status-card { padding: 1.5rem; text-align: center; }

.manual-add-note-form {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.manual-add-note-form textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  background: var(--wc-input-bg, rgba(255,255,255,0.06));
  border: 1px solid var(--wc-border, rgba(255,255,255,0.12));
  border-radius: 4px;
  color: var(--wc-text);
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  font-family: inherit;
}

.manual-user-note {
  border-left: 2px solid var(--wc-accent, #4ea3ff);
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
}

.manual-user-note p { margin: 0 0 0.3rem; }

.manual-user-note-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--wc-muted);
}

.manuals-page .btn-danger,
.manual-detail-page .btn-danger {
  background: transparent;
  border: 1px solid rgba(255, 80, 80, 0.45);
  color: #ff8080;
  cursor: pointer;
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  transition: background 0.15s;
}

.manuals-page .btn-danger:hover,
.manual-detail-page .btn-danger:hover { background: rgba(255, 80, 80, 0.12); }

/* Upload modal form */
.manuals-upload-modal {
  max-width: 620px;
  background:
    radial-gradient(500px 180px at 12% -10%, rgba(39, 176, 110, 0.18), transparent 70%),
    linear-gradient(180deg, rgba(32,38,42,0.98), rgba(18,22,25,0.98));
}

.manuals-form-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  margin-bottom: 0.85rem;
  position: relative;
}

.manuals-form-label input[type="text"],
.manuals-form-label textarea {
  background: var(--wc-input-bg, rgba(255,255,255,0.06));
  border: 1px solid var(--wc-border, rgba(255,255,255,0.12));
  border-radius: 4px;
  color: var(--wc-text);
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  font-family: inherit;
}

.manuals-form-label input[type="file"] { color: var(--wc-text); font-size: 0.88rem; }

.manuals-dropzone {
  border: 1px dashed rgba(67, 208, 138, 0.45);
  background: rgba(39, 176, 110, 0.06);
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.manuals-dropzone:hover,
.manuals-dropzone.is-dragover {
  border-color: rgba(67, 208, 138, 0.8);
  background: rgba(39, 176, 110, 0.12);
  transform: translateY(-1px);
}

.manuals-dropzone:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--wc-ring);
}

.manuals-dropzone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.manuals-dropzone-title {
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
}

.manuals-dropzone-sub {
  margin-top: 0.2rem;
  font-size: 0.84rem;
  color: var(--wc-muted);
}

.manuals-dropzone-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--wc-text);
  white-space: nowrap;
}

.manuals-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--wc-accent-2);
  animation: manualsSpin 0.85s linear infinite;
}

@keyframes manualsSpin {
  to { transform: rotate(360deg); }
}

.manuals-dropzone input[type="file"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.manuals-suggest-list {
  position: absolute;
  z-index: 12;
  top: calc(100% - 0.1rem);
  left: 0;
  right: 0;
  border: 1px solid var(--wc-border);
  border-radius: 8px;
  background: rgba(22, 27, 30, 0.98);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.manuals-suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--wc-text);
  padding: 0.5rem 0.7rem;
  cursor: pointer;
}

.manuals-suggest-item:hover {
  background: rgba(67, 208, 138, 0.14);
}

.manuals-preview-modal {
  width: min(1080px, calc(100vw - 2rem));
  margin-top: 5vh;
  max-height: 90vh;
}

.manuals-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.manuals-preview-head h2 {
  margin-bottom: 0.2rem;
}

.manuals-preview-body {
  margin-top: 0.8rem;
  border: 1px solid var(--wc-border);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(10, 12, 14, 0.7);
}

.manuals-preview-body iframe {
  width: 100%;
  height: min(72vh, 760px);
  border: 0;
}

.manuals-preview-fallback {
  padding: 1rem;
}

.manuals-hint { font-size: 0.78rem; color: var(--wc-muted); }

.manuals-form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  margin-bottom: 0.85rem;
  cursor: pointer;
}

.manuals-upload-error {
  color: #ff8080;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 760px) {
  .manuals-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .manuals-toolbar input,
  .manuals-toolbar select,
  .manuals-toolbar button {
    width: 100%;
  }

  .manual-detail-grid {
    gap: 0.9rem;
  }

  .manual-meta-card {
    position: static;
    top: auto;
  }

  .manual-section-card,
  .manual-meta-card {
    padding: 0.9rem;
  }

  .manual-procedure-head {
    flex-direction: column;
    align-items: stretch;
  }

  .manual-procedure-head input[type="search"] {
    width: 100%;
  }

  .manual-guide-head,
  .manual-source-item,
  .manuals-dropzone-row,
  .manuals-preview-head,
  .manual-user-note-meta,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .manual-guide-controls,
  .manual-source-actions,
  .manuals-card-actions,
  .server-card-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .manual-guide-controls > *,
  .manual-source-actions > *,
  .manuals-card-actions > *,
  .server-card-actions > * {
    width: 100%;
    text-align: center;
    justify-content: center;
    box-sizing: border-box;
  }

  .manual-guide-card,
  .manual-guide-card--compact,
  .manual-source-item,
  .manual-procedure-step,
  .manual-user-note {
    border-radius: 10px;
  }

  .manual-guide-card {
    padding: 0.75rem;
  }

  .manual-guide-title {
    font-size: 0.98rem;
    line-height: 1.3;
  }

  .manual-guide-steps {
    padding-left: 1.15rem;
  }

  .manual-procedure-steps {
    max-height: 58vh;
  }

  .manual-source-item h3 {
    font-size: 0.9rem;
  }

  .manual-add-note-form button,
  .modal-actions button {
    width: 100%;
  }

  .manuals-upload-modal,
  .manuals-preview-modal {
    width: calc(100vw - 1rem);
    max-width: none;
    margin-top: 2vh;
    max-height: 94vh;
    padding: 0.95rem;
  }

  .manuals-preview-body iframe {
    height: 62vh;
  }

  .manuals-dropzone {
    padding: 0.85rem;
  }

  .manuals-dropzone-status {
    justify-content: flex-start;
    white-space: normal;
  }

  .manuals-suggest-list {
    max-height: 220px;
    overflow-y: auto;
  }
}

@media (max-width: 560px) {
  .manual-guides-grid--cards {
    grid-template-columns: 1fr;
  }

  .manual-procedure-head h2 {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: baseline;
  }

  .manual-note-item,
  .manual-guide-steps li,
  .manuals-form-label,
  .manuals-form-label input[type="text"],
  .manuals-form-label textarea,
  .manuals-hint,
  .manual-user-note {
    font-size: 0.86rem;
  }

  .manual-procedure-step {
    padding: 0.5rem;
    gap: 0.45rem;
  }

  .manuals-preview-head h2,
  .manual-section-card h2 {
    font-size: 0.98rem;
  }

  .manuals-upload-modal,
  .manuals-preview-modal {
    width: calc(100vw - 0.5rem);
    padding: 0.8rem;
  }

  .manuals-preview-body iframe {
    height: 56vh;
  }
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.required { color: #ff8080; }

.btn-primary:disabled,
.btn-sm:disabled {
  cursor: not-allowed;
  background: linear-gradient(135deg, rgba(145, 153, 160, 0.45), rgba(110, 120, 128, 0.45));
  color: rgba(235, 240, 244, 0.7);
}

.map-killfeed-grid {
  margin-top: 0.95rem;
}

.kill-feed-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 260px;
  overflow: auto;
  padding-right: 0.2rem;
}

.kill-feed-item {
  border: 1px solid var(--wc-border);
  border-radius: 8px;
  padding: 0.42rem 0.55rem;
  background: rgba(255, 255, 255, 0.03);
}

.kill-feed-main {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
}

.kill-feed-sub {
  margin-top: 0.18rem;
  font-size: 0.78rem;
  color: var(--wc-muted);
}

.kill-feed-kind {
  display: inline-block;
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.kill-feed-kind--shot {
  color: #9ad0ff;
  background: rgba(60, 135, 200, 0.22);
}

.kill-feed-kind--hit {
  color: #ffd27a;
  background: rgba(180, 120, 35, 0.24);
}

.kill-feed-kind--kill {
  color: #ff9e9e;
  background: rgba(170, 55, 55, 0.28);
}

.kill-feed-arrow {
  color: var(--wc-muted);
}

.jai-badge--warn {
  background: rgba(255, 180, 40, 0.15);
  color: #ffb428;
  border: 1px solid rgba(255, 180, 40, 0.3);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}


/* ============================================================
   BEGIN LIGHT-MODE OVERRIDES
   Many earlier rules use hardcoded dark colours (rgba on white,
   #eef4f8 etc) that become invisible in light mode. The block
   below retargets the highest-impact UI surfaces. Dark mode is
   unaffected because every selector is scoped to [data-theme="light"].
   ============================================================ */

/* --- Cards & panels: replace dark gradient with solid light panel --- */
:root[data-theme="light"] .about,
:root[data-theme="light"] .map-panel,
:root[data-theme="light"] .map-sidebar,
:root[data-theme="light"] .auth-card,
:root[data-theme="light"] .admin-card,
:root[data-theme="light"] .stats article,
:root[data-theme="light"] .server-card,
:root[data-theme="light"] .compare-col,
:root[data-theme="light"] .unit-lib-card,
:root[data-theme="light"] .manuals-card,
:root[data-theme="light"] .roadmap-card {
  background: var(--wc-panel);
  border-color: var(--wc-border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* --- Form inputs / selects --- */
:root[data-theme="light"] .toolbar input,
:root[data-theme="light"] .toolbar select,
:root[data-theme="light"] .auth-form input,
:root[data-theme="light"] .auth-form textarea,
:root[data-theme="light"] .player-signin-form input,
:root[data-theme="light"] .jai-widget-input,
:root[data-theme="light"] .jai-input-row input,
:root[data-theme="light"] .wc-select-btn,
:root[data-theme="light"] .wc-select-menu,
:root[data-theme="light"] .wc-select-item {
  background: var(--wc-panel);
  color: var(--wc-text);
  border-color: var(--wc-border);
}
:root[data-theme="light"] .wc-select-menu {
  box-shadow: 0 8px 22px rgba(0,0,0,0.10);
}
:root[data-theme="light"] .wc-select-item:hover {
  background: rgba(30,144,88,0.10);
  border-color: rgba(30,144,88,0.30);
}

/* --- Admin control centre --- */
:root[data-theme="light"] .admin-shell {
  --admin-surface: rgba(255, 255, 255, 0.92);
  --admin-surface-raised: #ffffff;
  --admin-input: #ffffff;
}
:root[data-theme="light"] .admin-sidebar {
  background: linear-gradient(180deg, #ffffff, #f4f6f5);
  box-shadow: 0 14px 34px rgba(28, 45, 36, 0.08);
}
:root[data-theme="light"] .admin-sidebar-mark { color: #17673f; }
:root[data-theme="light"] .admin-subnav a.is-active { color: #124f32; }
:root[data-theme="light"] .admin-subnav a.is-active small { color: #39725a; }
:root[data-theme="light"] .admin-page-header,
:root[data-theme="light"] .admin-card { box-shadow: 0 10px 28px rgba(28, 45, 36, 0.07); }
:root[data-theme="light"] .admin-access-badge { color: #17673f; }
:root[data-theme="light"] .admin-table-wrap { background: rgba(244, 247, 245, 0.72); }
:root[data-theme="light"] .admin-table th { background: #f2f5f3; }
:root[data-theme="light"] .admin-table tbody tr:hover { background: rgba(30, 144, 88, 0.05); }
:root[data-theme="light"] .admin-table code { background: #f2f5f3; color: #17673f; }
:root[data-theme="light"] .admin-shell input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
:root[data-theme="light"] .admin-shell select,
:root[data-theme="light"] .admin-shell textarea,
:root[data-theme="light"] .admin-modal input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
:root[data-theme="light"] .admin-modal select,
:root[data-theme="light"] .admin-modal textarea {
  border-color: rgba(25, 50, 37, 0.16);
  background: linear-gradient(180deg, #ffffff, #f8faf9);
  color: var(--wc-text);
  color-scheme: light;
}
:root[data-theme="light"] .admin-shell input::placeholder,
:root[data-theme="light"] .admin-shell textarea::placeholder,
:root[data-theme="light"] .admin-modal input::placeholder,
:root[data-theme="light"] .admin-modal textarea::placeholder { color: #7d8982; }
:root[data-theme="light"] .admin-shell input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):focus,
:root[data-theme="light"] .admin-shell select:focus,
:root[data-theme="light"] .admin-shell textarea:focus,
:root[data-theme="light"] .admin-modal input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):focus,
:root[data-theme="light"] .admin-modal select:focus,
:root[data-theme="light"] .admin-modal textarea:focus { background: #ffffff; }
:root[data-theme="light"] .admin-section label,
:root[data-theme="light"] .admin-modal label { color: #46534c; }
:root[data-theme="light"] .admin-section .btn-sm:not(.btn-primary):not(.btn-danger),
:root[data-theme="light"] .admin-modal .btn-sm:not(.btn-primary):not(.btn-danger) {
  border-color: rgba(25, 50, 37, 0.15);
  background: #f1f4f2;
  color: var(--wc-text);
}

/* --- Secondary / ghost buttons (cta-alt was white-on-white) --- */
:root[data-theme="light"] .cta-alt {
  background: var(--wc-panel-2);
  color: var(--wc-text);
  border: 1px solid var(--wc-border);
}
:root[data-theme="light"] .btn-share {
  background: rgba(30,144,88,0.14);
  color: var(--wc-accent);
  border: 1px solid rgba(30,144,88,0.30);
}
:root[data-theme="light"] .btn-share:hover {
  background: rgba(30,144,88,0.22);
}
:root[data-theme="light"] .favorite-btn {
  color: var(--wc-text);
  background: var(--wc-panel-2);
  border: 1px solid var(--wc-border);
}
:root[data-theme="light"] .favorite-btn.is-favorite {
  color: #2a2000;
  background: #ffd76a;
  border-color: #e8c04a;
}

/* --- Server-card text colours that were tuned for a dark bg --- */
:root[data-theme="light"] .card-note { color: var(--wc-text); }
:root[data-theme="light"] .card-tags span {
  color: var(--wc-muted);
  border-color: var(--wc-border);
}
:root[data-theme="light"] .health-strip {
  border-color: var(--wc-border);
  background: var(--wc-panel-2);
}
:root[data-theme="light"] .trend-up   { color: #1e9058; }
:root[data-theme="light"] .trend-down { color: #c0392b; }

/* --- Status pills: tints stay, text darkens for contrast --- */
:root[data-theme="light"] .status-online  { color: #155d3a; background: rgba(30,144,88,0.18); }
:root[data-theme="light"] .status-paused  { color: #7a5b1a; background: rgba(211,163,63,0.20); }
:root[data-theme="light"] .status-offline { color: #8a2a2a; background: rgba(192,57,43,0.18); }

/* --- Tier / JAI badges --- */
:root[data-theme="light"] .tier-badge--anonymous,
:root[data-theme="light"] .tier-badge--free,
:root[data-theme="light"] .jai-badge--off {
  background: rgba(0,0,0,0.06);
  color: var(--wc-muted);
}
:root[data-theme="light"] .tier-badge--player,
:root[data-theme="light"] .tier-badge--subscriber,
:root[data-theme="light"] .tier-badge--approved,
:root[data-theme="light"] .jai-badge--on {
  background: rgba(30,144,88,0.16);
  color: #155d3a;
}
:root[data-theme="light"] .tier-badge--pending {
  background: rgba(211,163,63,0.20);
  color: #7a5b1a;
}
:root[data-theme="light"] .tier-badge--denied {
  background: rgba(192,57,43,0.18);
  color: #8a2a2a;
}
:root[data-theme="light"] .tier-badge--spectator {
  background: rgba(40,110,200,0.18);
  color: #1f4a86;
}

/* --- Generic "white-tint on white" fixers
       Catches .compare-col, account panels, jai widget panels,
       map legend toggles, etc. that used rgba(255,255,255,0.0X). --- */
:root[data-theme="light"] .compare-col,
:root[data-theme="light"] .account-nav-btn,
:root[data-theme="light"] .map-legend-toggle,
:root[data-theme="light"] .jai-widget,
:root[data-theme="light"] .jai-widget-history,
:root[data-theme="light"] .jai-widget-input,
:root[data-theme="light"] .jai-msg--admin {
  background: var(--wc-panel);
  border-color: var(--wc-border);
  color: var(--wc-text);
}
:root[data-theme="light"] .account-nav-btn:hover,
:root[data-theme="light"] .map-legend-toggle:hover {
  background: rgba(0,0,0,0.04);
}

/* --- Footer: keep dark for visual anchor on both themes,
       but lift link contrast a touch in light mode. --- */
:root[data-theme="light"] .footer-link { color: #6df0a8; }

/* --- Code samples in unit library --- */
:root[data-theme="light"] .unit-lib-card code { color: #1860a0; }

/* --- Misc text colours that referenced fixed-light hex values --- */
:root[data-theme="light"] .signin-msg,
:root[data-theme="light"] .nav-username { color: #1e9058 !important; }

/* ============================================================
   END LIGHT-MODE OVERRIDES
   ============================================================ */


/* ============================================================
   BUG REPORTS — /bugreport
   ============================================================ */

/* ---- Hero / stats ---- */
.bug-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
  padding: 2rem 1.75rem;
  margin-bottom: 1.5rem;
  border-radius: 14px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(255,140,80,0.10), transparent 55%),
    radial-gradient(120% 120% at 100% 100%, rgba(80,200,255,0.10), transparent 55%),
    rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
.bug-hero-compact { grid-template-columns: 1fr; padding: 1.5rem 1.5rem; margin-bottom: 1rem; }
.bug-hero-text h1 { margin: 0.2rem 0 0.6rem; }
.bug-hero-text p { margin: 0 0 0.8rem; max-width: 60ch; opacity: 0.92; }
.bug-hero-eyebrow {
  display: inline-block; text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 0.72rem; font-weight: 700; padding: 0.18rem 0.55rem;
  border-radius: 999px; background: rgba(255,180,80,0.15); color: #ffc46b;
  border: 1px solid rgba(255,180,80,0.4);
}
.bug-hero-cta { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-top: 0.6rem; }
.bug-hero-back { margin: 0 0 0.6rem; }

.bug-cta-primary { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 700; }
.bug-cta-icon { font-size: 1.1rem; line-height: 1; }

.bug-stats {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem;
}
.bug-stat {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0.85rem 0.6rem; border-radius: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
}
.bug-stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.bug-stat-label { font-size: 0.72rem; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.3rem; }
.bug-stat-active   { background: rgba(255,180,80,0.10); border-color: rgba(255,180,80,0.35); }
.bug-stat-progress { background: rgba(180,140,255,0.10); border-color: rgba(180,140,255,0.35); }
.bug-stat-resolved { background: rgba(80,200,140,0.10); border-color: rgba(80,200,140,0.35); }

@media (max-width: 800px) {
  .bug-hero { grid-template-columns: 1fr; padding: 1.5rem 1.25rem; }
  .bug-stats { grid-template-columns: repeat(4, 1fr); }
  .bug-stat-value { font-size: 1.25rem; }
}

/* ---- Toolbar ---- */
.bug-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.8rem; margin-bottom: 1rem;
  padding: 0.65rem 0.85rem; border-radius: 10px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07);
}
.bug-toolbar-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.bug-toolbar-result { font-size: 0.85rem; opacity: 0.85; }

/* Legacy aliases (kept so older fragments still render) */
.bug-index-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.bug-index-toolbar { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* ---- Empty state ---- */
.bug-empty {
  text-align: center; padding: 2.5rem 1rem;
  border-radius: 12px; border: 1px dashed rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.02);
}
.bug-empty h3 { margin: 0 0 0.4rem; }
.bug-empty p { margin: 0; opacity: 0.85; }

/* ---- Bug card list ---- */
.bug-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.bug-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding: 1rem 1.1rem 0.95rem 0.85rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 4px solid rgba(255,255,255,0.18);
  align-items: start;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.bug-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  border-color: rgba(255,255,255,0.16);
}
/* Severity accent stripe (left border) */
.bug-card.sev-low      { border-left-color: rgba(140,200,255,0.7); }
.bug-card.sev-medium   { border-left-color: rgba(255,196,107,0.7); }
.bug-card.sev-high     { border-left-color: rgba(255,144,112,0.8); }
.bug-card.sev-critical { border-left-color: rgba(255,94,94,0.95); }
/* Resolved cards fade slightly */
.bug-card.status-resolved,
.bug-card.status-wont_fix,
.bug-card.status-duplicate { opacity: 0.78; }

.bug-card-body { min-width: 0; }
.bug-card-title { margin: 0.3rem 0 0.4rem; font-size: 1.08rem; line-height: 1.35; }
.bug-card-title a { color: inherit; text-decoration: none; }
.bug-card-title a:hover { text-decoration: underline; }
.bug-card-snippet { margin: 0 0 0.5rem; opacity: 0.85; line-height: 1.45; }
.bug-card-foot { margin: 0; display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }
.bug-card-dot { opacity: 0.45; }
.bug-card-meta-row { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.1rem; }
.bug-meta-tag { font-size: 0.75rem; opacity: 0.78; }

/* ---- Vote button ---- */
.bug-vote-form { margin: 0; }
.bug-vote-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 58px; padding: 0.55rem 0.4rem;
  background: rgba(255,255,255,0.05); color: inherit;
  border: 1px solid rgba(255,255,255,0.14); border-radius: 10px;
  cursor: pointer; font-weight: 700; line-height: 1.1;
  transition: background 120ms, border-color 120ms, transform 80ms;
}
.bug-vote-btn:hover:not(:disabled) {
  background: rgba(80,200,140,0.18); border-color: rgba(80,200,140,0.7);
  color: #6bd29a;
}
.bug-vote-btn:active:not(:disabled) { transform: scale(0.96); }
.bug-vote-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.bug-vote-btn.is-voted { background: rgba(80,200,140,0.25); border-color: rgba(80,200,140,0.85); color: #6bd29a; }
.bug-vote-btn .vote-arrow { font-size: 1.05rem; }
.bug-vote-btn .vote-count { font-size: 1.05rem; }
.bug-vote-btn .vote-label { font-size: 0.7rem; opacity: 0.85; margin-top: 0.15rem; }
.bug-vote-btn-lg { min-width: 78px; padding: 0.7rem 0.6rem; }
.bug-vote-btn-lg .vote-arrow,
.bug-vote-btn-lg .vote-count { font-size: 1.25rem; }

/* ---- Pills ---- */
.bug-status-pill, .bug-severity-pill, .bug-workaround-pill {
  display: inline-block; padding: 0.18rem 0.6rem;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.05);
}
.bug-status-pill.status-open          { background: rgba(255,180,80,0.18);  border-color: rgba(255,180,80,0.55);  color: #ffc46b; }
.bug-status-pill.status-investigating { background: rgba(120,180,255,0.18); border-color: rgba(120,180,255,0.55); color: #8fc1ff; }
.bug-status-pill.status-in_progress   { background: rgba(180,140,255,0.18); border-color: rgba(180,140,255,0.55); color: #c0a3ff; }
.bug-status-pill.status-resolved      { background: rgba(80,200,140,0.18);  border-color: rgba(80,200,140,0.55);  color: #6bd29a; }
.bug-status-pill.status-wont_fix      { background: rgba(180,180,180,0.15); border-color: rgba(180,180,180,0.4);  color: #c8c8c8; }
.bug-status-pill.status-duplicate     { background: rgba(180,180,180,0.15); border-color: rgba(180,180,180,0.4);  color: #c8c8c8; }

.bug-severity-pill.sev-low      { color: #8fcfff; }
.bug-severity-pill.sev-medium   { color: #ffc46b; }
.bug-severity-pill.sev-high     { color: #ff9070; }
.bug-severity-pill.sev-critical { color: #ff5e5e; border-color: rgba(255,80,80,0.6); background: rgba(255,80,80,0.18); }

.bug-workaround-pill { color: #6bd29a; border-color: rgba(80,200,140,0.55); background: rgba(80,200,140,0.15); }

.bug-signin-note { margin-top: 1rem; }

/* ---- Detail page ---- */
.bug-detail-hero h1 { margin-top: 0.5rem; }
.bug-detail-meta-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 0.4rem; }
.bug-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 900px) { .bug-detail-grid { grid-template-columns: 1fr; } }

.bug-detail-card, .bug-comments-card {
  padding: 1.1rem 1.3rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
}
.bug-detail-actions { margin-bottom: 0.8rem; }
.bug-prose { white-space: pre-wrap; word-wrap: break-word; line-height: 1.55; margin: 0.3rem 0 0.9rem; }
.bug-prose-pre {
  background: rgba(0,0,0,0.28); padding: 0.7rem 0.9rem;
  border-radius: 8px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
}
.bug-expected-actual { margin: 0.4rem 0 0.6rem; }
.bug-side-panel {
  padding: 0.7rem 0.9rem;
  background: rgba(0,0,0,0.18); border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}
.bug-side-panel h3 { margin-top: 0; }

.bug-detail-facts {
  display: grid; grid-template-columns: max-content 1fr;
  gap: 0.25rem 0.85rem; margin: 0.5rem 0 1rem;
  padding: 0.75rem 0.95rem; border-radius: 8px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
  font-size: 0.85rem;
}
.bug-detail-facts dt { opacity: 0.7; }
.bug-detail-facts dd { margin: 0; }

/* ---- Attachments ---- */
.bug-attachments { list-style: none; margin: 0.4rem 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.6rem; }
.bug-attachment { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.55rem; background: rgba(0,0,0,0.22); border-radius: 10px; border: 1px solid rgba(255,255,255,0.07); }
.bug-attachment-thumb { width: 100%; height: 110px; object-fit: cover; border-radius: 7px; display: block; }
.bug-attachment-video { width: 100%; max-height: 180px; border-radius: 7px; background: #000; }
.bug-attachment-name { font-size: 0.75rem; opacity: 0.85; word-break: break-all; }
.bug-attachment-link { color: inherit; text-decoration: none; font-weight: 600; }
.bug-attachment-link:hover { text-decoration: underline; }

/* ---- Admin ---- */
.bug-admin-panel { margin: 0.8rem 0; padding: 0.8rem 1rem; border: 1px dashed rgba(255,255,255,0.18); border-radius: 10px; background: rgba(255,255,255,0.03); }
.bug-admin-panel summary { cursor: pointer; -webkit-user-select: none; user-select: none; }
.bug-admin-notes {
  margin-top: 0.8rem; padding: 0.7rem 1rem;
  background: rgba(120,180,255,0.10); border-left: 3px solid rgba(120,180,255,0.7);
  border-radius: 8px;
}

/* ---- Comments ---- */
.bug-comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.bug-comment { padding: 0.7rem 0.9rem; background: rgba(0,0,0,0.18); border-radius: 10px; border-left: 3px solid transparent; }
.bug-comment.is-workaround { border-left-color: rgba(80,200,140,0.75); background: rgba(80,200,140,0.08); }
.bug-comment-head { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.25rem; }
.bug-comments-empty, .bug-comments-signin { margin: 0.5rem 0 0; }

/* ---- Forms (shared by new + comment) ---- */
.bug-form { display: grid; gap: 1rem; max-width: 900px; }
.bug-form-section {
  display: grid; gap: 0.7rem;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(255,255,255,0.08); border-radius: 12px;
  background: rgba(255,255,255,0.03);
  margin: 0;
}
.bug-form-section legend {
  padding: 0 0.4rem; font-weight: 700; font-size: 0.95rem;
  letter-spacing: 0.01em;
}
.bug-form-section-hint, .bug-form-label-hint { font-weight: 400; opacity: 0.65; font-size: 0.82rem; }
.bug-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.7rem; }
.bug-form-label { display: grid; gap: 0.3rem; font-size: 0.85rem; opacity: 0.95; }
.bug-form-label .required { color: #ff8080; }
.bug-form-label input,
.bug-form-label select,
.bug-form-label textarea {
  width: 100%; box-sizing: border-box;
  padding: 0.55rem 0.7rem; font-size: 0.95rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 7px; color: inherit;
  font-family: inherit;
  transition: border-color 120ms, box-shadow 120ms, background 120ms;
}
.bug-form-label input:focus,
.bug-form-label select:focus,
.bug-form-label textarea:focus {
  outline: none;
  border-color: rgba(120,180,255,0.7);
  box-shadow: 0 0 0 3px rgba(120,180,255,0.18);
  background: rgba(255,255,255,0.07);
}
.bug-form-label textarea { resize: vertical; min-height: 90px; }
.bug-form-file input[type="file"] { padding: 0.45rem 0.5rem; background: rgba(255,255,255,0.04); }
.bug-form-actions { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.2rem; }
.bug-form-anon-note { margin: 0.4rem 0 0; padding: 0.55rem 0.85rem; background: rgba(255,255,255,0.04); border-radius: 8px; }
.bug-checkbox-label { display: flex; gap: 0.4rem; align-items: center; font-size: 0.85rem; }
.bug-comment-form { margin-top: 0.9rem; display: grid; gap: 0.5rem; }

.form-error {
  background: rgba(255,80,80,0.15); border: 1px solid rgba(255,80,80,0.5);
  color: #ff9b9b; padding: 0.6rem 0.95rem; border-radius: 8px; margin-bottom: 0.9rem;
}

/* ---- Light-theme readability ---- */
:root[data-theme="light"] .bug-hero { background:
    radial-gradient(120% 120% at 0% 0%, rgba(255,140,80,0.10), transparent 55%),
    radial-gradient(120% 120% at 100% 100%, rgba(80,140,220,0.10), transparent 55%),
    rgba(0,0,0,0.025); border-color: rgba(0,0,0,0.08); }
:root[data-theme="light"] .bug-stat,
:root[data-theme="light"] .bug-toolbar,
:root[data-theme="light"] .bug-card,
:root[data-theme="light"] .bug-detail-card,
:root[data-theme="light"] .bug-comments-card,
:root[data-theme="light"] .bug-form-section,
:root[data-theme="light"] .bug-detail-facts,
:root[data-theme="light"] .bug-empty { background: rgba(0,0,0,0.025); border-color: rgba(0,0,0,0.1); }
:root[data-theme="light"] .bug-comment,
:root[data-theme="light"] .bug-side-panel { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); }
:root[data-theme="light"] .bug-prose-pre { background: rgba(0,0,0,0.06); }
:root[data-theme="light"] .bug-form-label input,
:root[data-theme="light"] .bug-form-label select,
:root[data-theme="light"] .bug-form-label textarea { background: #fff; border-color: rgba(0,0,0,0.18); }
:root[data-theme="light"] .bug-vote-btn { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.15); }
:root[data-theme="light"] .bug-vote-btn.is-voted { background: rgba(40,160,90,0.18); color: #1e8a4d; border-color: rgba(40,160,90,0.6); }

/* ---- /bugreport/new : numbered steps, layout, sidebar tips, dropzone ---- */
.bug-new-hero { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
@media (max-width: 800px) { .bug-new-hero { grid-template-columns: 1fr; } }

.bug-new-steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem;
}
.bug-new-steps li {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.35rem; padding: 0.7rem 0.4rem;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; text-align: center;
}
.bug-new-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.85rem; height: 1.85rem; border-radius: 999px;
  background: rgba(255,180,80,0.18); border: 1px solid rgba(255,180,80,0.5);
  color: #ffc46b; font-weight: 700; font-size: 0.95rem;
}
.bug-new-step-label { font-size: 0.78rem; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.06em; }
@media (max-width: 520px) {
  .bug-new-steps { grid-template-columns: repeat(2, 1fr); }
}

.bug-new-layout {
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
  gap: 1.25rem; align-items: start;
}
@media (max-width: 980px) { .bug-new-layout { grid-template-columns: 1fr; } }

.bug-new-aside { display: grid; gap: 1rem; position: sticky; top: 1rem; }
@media (max-width: 980px) { .bug-new-aside { position: static; } }

.bug-tips-card {
  padding: 1rem 1.15rem; border-radius: 12px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
}
.bug-tips-title { margin: 0 0 0.6rem; font-size: 1rem; display: flex; gap: 0.4rem; align-items: center; }
.bug-tips-list, .bug-tips-sev { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; font-size: 0.88rem; line-height: 1.45; }
.bug-tips-list li::before { content: "\2022"; margin-right: 0.45rem; opacity: 0.55; }
.bug-tips-sev li { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 0.55rem; }
.bug-tips-sev .bug-severity-pill { text-align: center; }

/* Numbered chip inside legend */
.bug-form-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.55rem; height: 1.55rem; margin-right: 0.5rem;
  border-radius: 999px;
  background: rgba(255,180,80,0.18); border: 1px solid rgba(255,180,80,0.5);
  color: #ffc46b; font-weight: 700; font-size: 0.8rem;
  vertical-align: middle;
}
.bug-form-label-row { display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }

/* Drop-zone-styled file input */
.bug-form-dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.35rem; padding: 1.5rem 1rem; text-align: center;
  border: 1.5px dashed rgba(255,255,255,0.22); border-radius: 12px;
  background: rgba(255,255,255,0.03);
  cursor: pointer; transition: border-color 120ms, background 120ms;
}
.bug-form-dropzone:hover { border-color: rgba(120,180,255,0.6); background: rgba(120,180,255,0.06); }
.bug-form-dropzone input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.bug-form-dropzone-icon { font-size: 1.6rem; }
.bug-form-dropzone-title { font-weight: 700; font-size: 1rem; }
.bug-form-dropzone-sub { font-size: 0.8rem; opacity: 0.78; max-width: 50ch; }

.bug-form-tip {
  margin: 0.7rem 0 0; padding: 0.6rem 0.85rem;
  background: rgba(120,180,255,0.08); border-left: 3px solid rgba(120,180,255,0.6);
  border-radius: 6px; font-size: 0.85rem;
}
.bug-form-tip code { background: rgba(0,0,0,0.28); padding: 0.05rem 0.35rem; border-radius: 4px; }

:root[data-theme="light"] .bug-new-steps li,
:root[data-theme="light"] .bug-tips-card { background: rgba(0,0,0,0.025); border-color: rgba(0,0,0,0.1); }
:root[data-theme="light"] .bug-form-dropzone { background: rgba(0,0,0,0.025); border-color: rgba(0,0,0,0.2); }
:root[data-theme="light"] .bug-form-dropzone:hover { background: rgba(80,140,220,0.08); border-color: rgba(80,140,220,0.7); }
:root[data-theme="light"] .bug-form-tip { background: rgba(80,140,220,0.10); }
:root[data-theme="light"] .bug-form-tip code { background: rgba(0,0,0,0.08); }

/* -- Generic error / 404 / 500 page ----------------------------------- */
.error-page { max-width: 720px; margin: 4rem auto; padding: 2rem; text-align: center; }
.error-page h1 { margin-bottom: 0.5rem; }
.error-page .error-status { opacity: 0.7; margin-bottom: 1.5rem; }
.error-page .error-message { margin-bottom: 1.5rem; }
.error-page .error-prompt { margin-bottom: 2rem; }
.error-page .error-cta { margin-bottom: 2rem; }
.error-page .error-cta .btn { display: inline-block; padding: 0.75rem 1.5rem; background: #4a9eff; color: #fff; text-decoration: none; border-radius: 6px; font-weight: 600; }
.error-page .error-cta .btn:hover { background: #3a8eef; }
.error-page .error-secondary { opacity: 0.7; font-size: 0.9rem; }
.error-page .error-ref { opacity: 0.5; font-size: 0.8rem; margin-top: 2rem; }

/* ============================================================
 * Billing / pricing page
 * ============================================================ */
.hero--billing { text-align: center; padding: 3rem 1rem 2rem; }
.billing-flash {
  max-width: 960px; margin: 1rem auto; padding: 0.75rem 1.25rem;
  background: rgba(60, 145, 235, 0.18); color: #d1e6ff;
  border: 1px solid rgba(60, 145, 235, 0.55); border-radius: 8px;
  text-align: center;
}
.billing-flash--warn {
  background: rgba(235, 145, 60, 0.18); color: #ffe4cf;
  border-color: rgba(235, 145, 60, 0.55);
}
.billing-status-card {
  max-width: 960px; margin: 1.5rem auto;
  padding: 1.25rem 1.5rem; border-radius: 12px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08);
}
.billing-status-card h2 { margin-top: 0; font-size: 1.15rem; }
.billing-status-list { list-style: none; padding: 0; margin: 0 0 1rem; line-height: 1.7; }
.billing-portal-form { margin-top: 0.5rem; }
.billing-coupon-form { margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px solid var(--wc-border); }
.billing-coupon-form > label { display: block; font-size: 0.9rem; margin-bottom: 0.35rem; color: var(--wc-muted); }
.billing-coupon-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.billing-coupon-row input {
  flex: 1; min-width: 180px; border: 1px solid rgba(255,255,255,0.2); border-radius: 8px;
  background: rgba(17,21,24,0.82); color: #eef4f8; font: inherit; padding: 0.5rem 0.65rem;
}
.auth-optional { color: var(--wc-muted); font-weight: 400; font-size: 0.85em; }
.billing-grid {
  max-width: 1100px; margin: 2rem auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem; padding: 0 1rem;
}
.billing-card {
  padding: 1.75rem 1.5rem; border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  display: flex; flex-direction: column;
}
.billing-card h3 { margin: 0 0 0.5rem; font-size: 1.4rem; }
.billing-price { font-size: 2.2rem; font-weight: 700; margin: 0.25rem 0 1rem; }
.billing-price-unit { font-size: 0.95rem; opacity: 0.65; font-weight: 400; }
.billing-features { list-style: none; padding: 0; margin: 0 0 1.5rem; line-height: 1.65; flex: 1; }
.billing-features li { padding: 0.25rem 0; border-bottom: 1px dashed rgba(255,255,255,0.06); }
.billing-features li:last-child { border-bottom: 0; }
.billing-card--donor { border-color: rgba(235, 195, 60, 0.45); background: rgba(235, 195, 60, 0.06); }
.billing-card form { margin-top: auto; }
.billing-faq { max-width: 760px; margin: 2.5rem auto; padding: 0 1rem; }
.billing-faq details {
  padding: 0.75rem 1rem; margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.03); border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.billing-faq summary { cursor: pointer; font-weight: 600; }
.billing-faq details[open] { background: rgba(255, 255, 255, 0.05); }

/* ============================================================
 * Legal / policy pages (refund, cookies, terms, privacy…)
 * ============================================================ */
.legal-page {
  max-width: 820px;
  margin: 2.5rem auto;
  padding: 0 1.25rem 3rem;
  line-height: 1.65;
}
.legal-page h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.legal-page h2 {
  font-size: 1.2rem;
  margin-top: 2rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.legal-page p, .legal-page ul { margin: 0.85rem 0; }
.legal-page ul { padding-left: 1.5rem; }
.legal-page li { margin: 0.35rem 0; }
.legal-page a { color: var(--wc-accent-2, #43d08a); }
.legal-meta { opacity: 0.65; font-size: 0.9rem; margin-top: 0; }
.legal-back { margin-top: 2.5rem; opacity: 0.85; }

/* Z Assorted Works branding on legal pages — swap based on theme so the
   bundled solid-background logos sit naturally on either light or dark. */
.legal-header { margin: 0 0 1.5rem; }
.legal-brand {
  display: block;
  max-width: 220px;
  height: auto;
  border-radius: 6px;
}
.legal-brand--light { display: none; }
.legal-brand--dark  { display: block; }
html[data-theme="light"] .legal-brand--light { display: block; }
html[data-theme="light"] .legal-brand--dark  { display: none; }

/* ============================================================
 * Legal modal (re-acceptance pop-up) + interstitial agree page +
 * rendered .legal-doc body (from Python-markdown output).
 * ============================================================ */

/* ---- rendered legal document body ---- */
.legal-doc h1 { font-size: 1.7rem; margin: 1.5rem 0 0.5rem; }
.legal-doc h2 {
  font-size: 1.2rem;
  margin-top: 2rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.legal-doc h3 { font-size: 1.05rem; margin-top: 1.25rem; }
.legal-doc p, .legal-doc ul, .legal-doc ol { margin: 0.85rem 0; }
.legal-doc ul, .legal-doc ol { padding-left: 1.5rem; }
.legal-doc li { margin: 0.3rem 0; }
.legal-doc strong { font-weight: 700; }
.legal-doc hr {
  border: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  margin: 2rem 0;
}

/* ---- billing/agree interstitial ---- */
.billing-agree-tier {
  font-size: 1.15rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.billing-agree-form { margin-top: 1.5rem; }
.billing-agree-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0;
  font-size: 0.98rem;
  cursor: pointer;
}
.billing-agree-row input[type="checkbox"] {
  margin-top: 0.25rem;
  transform: scale(1.15);
}
.billing-agree-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.billing-agree-cancel {
  color: rgba(255, 255, 255, 0.65);
  text-decoration: underline;
}
.checkout-page { max-width: 1120px; }
.checkout-shell { display:grid; grid-template-columns:minmax(0,1fr) minmax(320px,.58fr); gap:1.4rem; align-items:start; }
.checkout-panel select { width:100%; padding:.8rem; border:1px solid var(--wc-border); border-radius:8px; background:var(--wc-bg); color:var(--wc-text); font:inherit; }
.checkout-panel select:disabled { opacity:.55; }
.checkout-pay:disabled { opacity:.45; cursor:not-allowed; }
#embeddedCheckout { min-height:360px; }
.checkout-primary { display:grid; gap:1rem; }
.checkout-panel,.checkout-order { padding:1.25rem; border:1px solid rgba(255,255,255,.1); border-radius:14px; background:rgba(14,23,26,.78); }
.checkout-panel h2 { margin:.2rem 0 1rem; border:0; padding:0; font-size:1.08rem; }
.checkout-step { color:var(--wc-accent-2,#43d08a); font-size:.67rem; font-weight:800; letter-spacing:.11em; text-transform:uppercase; }
.billing-code-field { display:grid; gap:.5rem; }
.checkout-code-control { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:.55rem; }
.checkout-code-control input { min-width:0; width:100%; }
.checkout-code-control .btn-sm { min-width:76px; }
.checkout-order { position:sticky; top:5.25rem; display:grid; gap:.9rem; box-shadow:0 18px 45px rgba(0,0,0,.18); }
.checkout-order-item { display:flex; justify-content:space-between; gap:1rem; padding:.25rem 0 1rem; border-bottom:1px solid rgba(255,255,255,.1); }
.checkout-order-item > div { min-width:0; display:grid; gap:.2rem; }
.checkout-order-item span,.checkout-renewal { color:var(--wc-muted,#9aa7ac); font-size:.75rem; line-height:1.45; }
.checkout-order-item > strong { white-space:nowrap; }
.checkout-order-row,.checkout-order-total { display:flex; justify-content:space-between; gap:1rem; align-items:flex-start; }
.checkout-order-row { color:var(--wc-muted,#9aa7ac); font-size:.82rem; }
.checkout-order-row strong { color:var(--wc-text,#eef5f3); text-align:right; }
.checkout-order-discount strong { color:var(--wc-accent-2,#43d08a); }
.checkout-order-total { margin-top:.15rem; padding-top:1rem; border-top:1px solid rgba(255,255,255,.12); font-size:1rem; }
.checkout-order-total strong { color:var(--wc-accent-2,#43d08a); font-size:1.35rem; white-space:nowrap; }
.checkout-code-status { min-height:2.2rem; padding:.58rem .7rem; border-radius:8px; background:rgba(255,255,255,.035); color:var(--wc-muted,#9aa7ac); font-size:.75rem; line-height:1.35; }
.checkout-code-status[data-state="success"] { background:rgba(67,208,138,.09); color:#7ce3ac; }
.checkout-code-status[data-state="error"] { background:rgba(220,91,91,.1); color:#efaaaa; }
.checkout-pay { width:100%; text-align:center; }
.checkout-order .billing-agree-cancel { justify-self:center; font-size:.8rem; }
.checkout-order .billing-flash { margin:0; }
[hidden] { display:none !important; }
@media (max-width: 820px) {
  .checkout-shell { grid-template-columns:1fr; }
  .checkout-order { position:static; }
}
@media (max-width: 480px) {
  .checkout-page { padding-inline:.8rem; }
  .checkout-panel,.checkout-order { padding:1rem; }
  .checkout-order-item { display:grid; }
  .checkout-order-item > strong { justify-self:start; }
}
button.cta[disabled],
a.cta[disabled],
button.cta-alt[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---- re-acceptance modal ---- */
.legal-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.legal-modal {
  background: #161b22;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  max-width: 580px;
  width: 100%;
  padding: 1.75rem 1.5rem;
  color: #e8eaed;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}
html[data-theme="light"] .legal-modal {
  background: #fdfdfd;
  color: #1a1d22;
  border-color: rgba(0, 0, 0, 0.12);
}
.legal-modal h2 { margin-top: 0; font-size: 1.25rem; }
.legal-modal-form { margin-top: 1rem; }
.legal-modal-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0;
  cursor: pointer;
  font-size: 0.96rem;
}
.legal-modal-row input[type="checkbox"] {
  margin-top: 0.25rem;
  transform: scale(1.15);
}
.legal-modal-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.legal-modal-signout-form { margin: 0; padding: 0; }
.legal-modal-signout {
  background: none;
  border: 0;
  padding: 0;
  color: rgba(232, 234, 237, 0.6);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.92rem;
}
html[data-theme="light"] .legal-modal-signout { color: rgba(26, 29, 34, 0.6); }
.legal-modal-error {
  color: #ff8585;
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

/* Signup-page legal-acceptance checkboxes */
.signup-legal {
  margin: 1rem 0 0.5rem;
  padding: 0.75rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.signup-legal-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0;
  font-size: 0.95rem;
  cursor: pointer;
}
.signup-legal-row input[type="checkbox"] { transform: scale(1.1); }

/* 2FA verify-step UI tweaks */
.auth-form--inline { margin-top: 0.5rem; }
.auth-resend {
  background: none;
  border: 0;
  padding: 0.25rem 0;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9rem;
}
html[data-theme="light"] .auth-resend { color: rgba(0, 0, 0, 0.55); }
.auth-resend:hover { color: var(--accent, #3c91eb); }

/* ============================================================
 * Competitions
 * ============================================================ */
.comp-grid {
  max-width: 1100px; margin: 2rem auto; padding: 0 1rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.comp-card {
  position: relative;
  padding: 1.75rem 1.5rem; border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  display: flex; flex-direction: column;
}
.comp-card h2 { margin: 0.25rem 0 0.25rem; }
.comp-card-blurb { flex: 1; opacity: 0.85; }
.comp-card form, .comp-card .cta { margin-top: 1rem; }
.comp-card-status {
  align-self: flex-start;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 0.2rem 0.6rem; border-radius: 999px;
  margin-bottom: 0.5rem;
}
.comp-card-status--active   { background: rgba(60, 200, 120, 0.18); color: #6ee5a5; }
.comp-card-status--upcoming { background: rgba(60, 145, 235, 0.18); color: #8fc4ff; }
.comp-card-status--ended    { background: rgba(255, 255, 255, 0.10); color: rgba(255,255,255,0.6); }

/* Floating circular back button — same treatment as the JAI fab, but
   pinned to the TOP-LEFT (under the site header) instead of bottom-right.
   Being position:fixed it's out of the document flow, so the hero is the
   first in-flow element and stays cleanly centred. */
.comp-fab-back {
  position: fixed;
  left: 1rem;
  top: 4.75rem;          /* clears the site header */
  z-index: 45;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  text-decoration: none;
  background: linear-gradient(135deg, var(--wc-accent), var(--wc-accent-2));
  color: #04130a;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 14px 26px rgba(0,0,0,0.36);
  transition: transform 180ms ease;
}
.comp-fab-back:hover { transform: scale(1.06); }
.comp-fab-back:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--wc-ring); }

/* Hero / meta — centred within the same 1200px column as the sections so
   the title/blurb/countdown share one consistent centre line with
   everything beneath them.  width:100% + margin-inline:auto guarantees the
   block is centred regardless of the body's flex behaviour. */
.comp-hero {
  text-align: center;
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding: 0.75rem 1rem 0;
}
.comp-tagline { font-size: 1.1rem; opacity: 0.85; margin: 0.25rem 0 0.75rem; }
/* Selector is scoped under .comp-hero so its specificity (0,2,0) beats the
   base `.hero p { margin: ... 0 ... 0 }` rule (0,1,1) — otherwise the base
   rule zeroes the left/right margins and the max-width block hugs the left
   instead of centring. */
.comp-hero .comp-blurb {
  max-width: 760px;
  margin: 0 auto 1.5rem;
  opacity: 0.9;
}
.comp-meta {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  margin-top: 0.5rem;
}
.comp-countdown {
  display: inline-flex; flex-direction: column; align-items: center;
  padding: 0.75rem 1.5rem; border-radius: 12px;
  background: rgba(60, 145, 235, 0.12); border: 1px solid rgba(60, 145, 235, 0.4);
}
.comp-countdown--closed { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.15); }
.comp-countdown-label {
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.7;
}
.comp-countdown-value {
  font-family: 'Space Grotesk', monospace; font-size: 1.6rem; font-weight: 700;
  color: #8fc4ff;
}
.comp-ends { margin: 0.25rem 0 0; }
.comp-calc { opacity: 0.6; }

/* Sections */
.comp-section { max-width: 1200px; margin: 2.5rem auto; padding: 0 1rem; }
.comp-section-title { font-size: 1.4rem; margin-bottom: 1.25rem; }
.comp-section-note {
  display: block; font-size: 0.85rem; font-weight: 400; opacity: 0.6;
  text-transform: none; letter-spacing: 0; margin-top: 0.15rem;
}

/* Congrats Category Winners — headline champions banner */
.comp-champions {
  padding: 1.5rem 1.25rem;
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.10), rgba(78, 161, 255, 0.06));
  border: 1px solid rgba(245, 197, 66, 0.28);
  border-radius: 18px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}
.comp-champions-title { color: #f5c542; }
.comp-champion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
}
.comp-champion-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: rgba(9, 13, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.comp-champion-card.is-won {
  border-color: rgba(245, 197, 66, 0.45);
  background:
    linear-gradient(135deg, rgba(245, 197, 66, 0.12), rgba(9, 13, 20, 0.5));
}
.comp-champion-cat {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wc-muted, #aab4c4);
}
.comp-champion-name {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.comp-champion-card.is-won .comp-champion-name { color: #ffe79a; }
.comp-champion-none { color: var(--wc-muted, #aab4c4); font-weight: 600; font-size: 1rem; }
.comp-champion-pts {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f5c542;
  font-size: 0.95rem;
}

/* Results reveal countdown gate */
.comp-reveal { display: flex; justify-content: center; }
.comp-reveal-card {
  width: 100%;
  max-width: 720px;
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.10), rgba(78, 161, 255, 0.08));
  border: 1px solid rgba(245, 197, 66, 0.30);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
}
.comp-reveal-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #f5c542;
  margin-bottom: 0.5rem;
}
.comp-reveal-title {
  margin: 0;
  font-size: 1.3rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 0;
  padding: 0;
}
.comp-reveal-countdown {
  font-family: 'Space Grotesk', monospace;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 9vw, 4rem);
  line-height: 1.1;
  margin: 0.6rem 0 0.5rem;
  color: #fff;
  text-shadow: 0 0 24px rgba(78, 161, 255, 0.35);
}
.comp-reveal-sub { margin: 0; color: var(--wc-muted, #aab4c4); }

/* Subscriber / donation bonus badge shown next to a player's name */
.comp-bonus {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
  white-space: nowrap;
}
.comp-bonus--sub {
  color: #ffe79a;
  background: rgba(245, 197, 66, 0.16);
  border: 1px solid rgba(245, 197, 66, 0.42);
}
.comp-bonus--donation {
  color: #9be7c4;
  background: rgba(67, 208, 138, 0.16);
  border: 1px solid rgba(67, 208, 138, 0.42);
}

/* Leaderboard grid */
.comp-leaderboard-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.comp-board {
  padding: 1.1rem 1.1rem 0.85rem; border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.comp-board--server { background: rgba(255, 255, 255, 0.025); }
.comp-board-title { margin: 0 0 0.75rem; font-size: 1.05rem; }
.comp-board--server .comp-board-title { font-size: 0.95rem; opacity: 0.9; }
.comp-rank-list { list-style: none; margin: 0; padding: 0; }
.comp-rank {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0; border-bottom: 1px dashed rgba(255,255,255,0.06);
}
.comp-rank:last-child { border-bottom: 0; }
.comp-rank-num {
  flex: 0 0 1.5rem; height: 1.5rem; line-height: 1.5rem; text-align: center;
  border-radius: 50%; font-size: 0.8rem; font-weight: 700;
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.8);
}
.comp-rank-name { flex: 1; }
.comp-rank-pts { font-weight: 700; font-variant-numeric: tabular-nums; }
/* Medals for the combined (championship) boards */
.comp-rank--1 .comp-rank-num { background: linear-gradient(135deg,#f9d976,#c9962f); color:#3a2c00; }
.comp-rank--2 .comp-rank-num { background: linear-gradient(135deg,#e8e8ec,#a9adb6); color:#26282c; }
.comp-rank--3 .comp-rank-num { background: linear-gradient(135deg,#e0a479,#a9683c); color:#2a1500; }
.comp-rank--leader {
  background: rgba(249, 217, 118, 0.08);
  margin: 0 -0.5rem; padding-left: 0.5rem; padding-right: 0.5rem;
  border-radius: 6px;
}
.comp-empty { opacity: 0.5; font-style: italic; margin: 0.5rem 0; }

/* Per-server block heading */
.comp-server-block { margin-bottom: 2rem; }
.comp-server-name {
  font-size: 1.15rem; margin: 0 0 0.85rem;
  padding-bottom: 0.35rem; border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Competitions — prize / donation card */
.comp-prize-card {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
  padding: 1.75rem; border-radius: 14px;
  background: linear-gradient(135deg, rgba(249,217,118,0.10), rgba(60,145,235,0.08));
  border: 1px solid rgba(249, 217, 118, 0.35);
}
.comp-prize-badge {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  background: rgba(249, 217, 118, 0.2); color: #f9d976;
}
.comp-prize-amount {
  font-size: 2.1rem; margin: 0.5rem 0 0; color: #f9d976;
}
.comp-prize-sub { margin: 0 0 0.75rem; opacity: 0.8; }
.comp-prize-blurb { margin: 0; opacity: 0.9; }
/* min-width:0 lets the grid columns shrink below their content's intrinsic
   width — without it the long donate URL forces the column (and the page)
   wider than the viewport, which reads as the whole page being off-centre. */
.comp-prize-main,
.comp-prize-donate { min-width: 0; }
.comp-prize-donate {
  border-left: 1px solid rgba(255,255,255,0.12); padding-left: 1.5rem;
}
.comp-prize-donate .cta { overflow-wrap: anywhere; }
.comp-prize-donate h3 { margin: 0 0 0.5rem; }
.comp-prize-donate .cta { margin-top: 0.5rem; display: inline-block; }
.comp-prize-donor { margin-top: 0.85rem; opacity: 0.7; }
.comp-prize-note {
  max-width: 100%; margin: 1rem auto 0; padding: 0.85rem 1.1rem;
  background: rgba(255,255,255,0.04); border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08); font-size: 0.92rem; opacity: 0.9;
}
@media (max-width: 700px) {
  .comp-prize-card { grid-template-columns: 1fr; }
  .comp-prize-donate { border-left: 0; padding-left: 0;
    border-top: 1px solid rgba(255,255,255,0.12); padding-top: 1.25rem; }
}

/* Competitions — footer disclaimer */
.comp-disclaimer {
  font-size: 0.85rem;
  opacity: 0.6;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1rem;
}
.comp-disclaimer-title {
  font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
  margin: 0 0 0.5rem; opacity: 0.8;
}
.comp-disclaimer ul { margin: 0; padding-left: 1.2rem; line-height: 1.55; }
.comp-disclaimer li { margin: 0.3rem 0; }

/* The Long War — live cross-server championship */
.long-war { --lw-green:#6ee5a5; --lw-cyan:#69d4ee; }
.long-war-hero {
  overflow: hidden; position: relative; max-width: none; padding: 3.5rem 1rem 3rem;
  background:
    radial-gradient(circle at 50% -20%, rgba(105,212,238,.18), transparent 42%),
    linear-gradient(180deg, rgba(5,19,22,.9), transparent);
  border-bottom: 1px solid rgba(110,229,165,.18);
}
.long-war-hero::after {
  content:""; position:absolute; inset:0; pointer-events:none; opacity:.17;
  background-image:linear-gradient(rgba(105,212,238,.15) 1px,transparent 1px),
                   linear-gradient(90deg,rgba(105,212,238,.15) 1px,transparent 1px);
  background-size:42px 42px; mask-image:linear-gradient(to bottom,#000,transparent 85%);
}
.long-war-hero > * { position:relative; z-index:1; }
.long-war-live,.long-war-pulse {
  display:inline-flex; align-items:center; gap:.5rem; color:var(--lw-green);
  font-size:.72rem; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
}
.long-war-live { margin-bottom:1rem; padding:.38rem .7rem; border:1px solid rgba(110,229,165,.35); border-radius:999px; background:rgba(39,111,73,.15); }
.long-war-live i,.long-war-pulse i { width:7px; height:7px; border-radius:50%; background:currentColor; box-shadow:0 0 12px currentColor; animation:long-war-pulse 1.8s ease-in-out infinite; }
@keyframes long-war-pulse { 50% { opacity:.35; transform:scale(.72); } }
.long-war-hero h1 { margin-bottom:.1rem; font-size:clamp(2.8rem,8vw,5.6rem); letter-spacing:-.045em; }
.long-war-sync {
  width:min(860px,calc(100% - 2rem)); margin:2rem auto 0; display:grid;
  grid-template-columns:repeat(3,1fr); border:1px solid rgba(105,212,238,.18);
  border-radius:14px; overflow:hidden; background:rgba(4,13,17,.68); backdrop-filter:blur(12px);
}
.long-war-sync div { min-width:0; padding:.85rem 1rem; display:grid; gap:.2rem; border-right:1px solid rgba(105,212,238,.14); }
.long-war-sync div:last-child { border-right:0; }
.long-war-sync span,.long-war-category-grid small { color:var(--wc-muted,#aab4c4); font-size:.7rem; }
.long-war-sync strong { overflow:hidden; color:#eef9f8; font-size:.85rem; text-overflow:ellipsis; white-space:nowrap; }
.long-war-rules { display:grid; grid-template-columns:minmax(260px,.72fr) 1.28fr; gap:2rem; align-items:center; padding:1.5rem; border:1px solid rgba(255,255,255,.09); border-radius:18px; background:linear-gradient(135deg,rgba(105,212,238,.055),rgba(110,229,165,.035)); }
.long-war-rules h2 { margin:.3rem 0 .65rem; font-size:clamp(1.55rem,4vw,2.25rem); }
.long-war-rules p { margin:0; color:var(--wc-muted,#aab4c4); line-height:1.55; }
.long-war-kicker { color:var(--lw-cyan); font-size:.69rem; font-weight:800; letter-spacing:.13em; text-transform:uppercase; }
.long-war-category-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.65rem; }
.long-war-category-grid article { min-width:0; display:flex; align-items:center; gap:.75rem; padding:.75rem; border:1px solid rgba(255,255,255,.08); border-radius:10px; background:rgba(3,12,16,.5); }
.long-war-category-grid article > span { color:var(--lw-cyan); font:700 .7rem "Space Grotesk",sans-serif; }
.long-war-category-grid article div { min-width:0; display:grid; gap:.12rem; }
.long-war-category-grid strong { font-size:.83rem; }
.long-war-category-grid small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.long-war-heading { display:flex; align-items:end; justify-content:space-between; gap:1rem; margin-bottom:1.25rem; }
.long-war-heading .comp-section-title { margin:.2rem 0 0; }
.long-war-pulse { color:var(--lw-green); }
.long-war-pulse.is-delayed { color:#e4bd72; }
.long-war .comp-board { border-color:rgba(105,212,238,.14); background:linear-gradient(145deg,rgba(13,31,35,.85),rgba(8,18,23,.72)); }
.long-war .comp-rank--leader { background:linear-gradient(90deg,rgba(110,229,165,.14),transparent); }
.long-war .comp-rank--1 .comp-rank-num { background:linear-gradient(135deg,var(--lw-green),var(--lw-cyan)); color:#062018; }
.long-war-awaiting { padding:2rem; border:1px dashed rgba(105,212,238,.25); border-radius:14px; color:var(--wc-muted,#aab4c4); text-align:center; }
.long-war-scoring-heading sup { color:var(--lw-green); font-size:.55em; vertical-align:super; }
.long-war-scoring-note { margin:0 0 1.25rem; padding:.85rem 1rem; border:1px solid rgba(228,189,114,.28); border-radius:12px; color:var(--wc-muted,#aab4c4); background:rgba(95,72,30,.13); font-size:.84rem; line-height:1.55; }
.long-war-scoring-note strong { color:#e7c986; }
.long-war-score-groups { display:grid; gap:1rem; }
.long-war-score-group { overflow:hidden; border:1px solid rgba(105,212,238,.15); border-radius:16px; background:linear-gradient(145deg,rgba(13,31,35,.88),rgba(8,18,23,.74)); }
.long-war-score-group > header { display:flex; gap:.9rem; align-items:flex-start; padding:1rem 1.1rem; border-bottom:1px solid rgba(105,212,238,.12); }
.long-war-score-group > header > span { display:grid; flex:0 0 2rem; width:2rem; height:2rem; place-items:center; border:1px solid rgba(105,212,238,.28); border-radius:8px; color:var(--lw-cyan); font:.72rem/1 "Space Grotesk",sans-serif; }
.long-war-score-group h3 { margin:0 0 .25rem; font-size:1.05rem; }
.long-war-score-group header p { margin:0; color:var(--wc-muted,#aab4c4); font-size:.79rem; line-height:1.45; }
.long-war-table-wrap { overflow-x:auto; }
.long-war-score-table { width:100%; border-collapse:collapse; font-size:.82rem; }
.long-war-score-table th,.long-war-score-table td { padding:.72rem 1rem; border-bottom:1px solid rgba(255,255,255,.06); text-align:left; vertical-align:top; }
.long-war-score-table thead th { color:var(--wc-muted,#aab4c4); background:rgba(3,12,16,.35); font-size:.66rem; letter-spacing:.09em; text-transform:uppercase; }
.long-war-score-table tbody th { width:28%; color:#edf8f7; font-weight:700; }
.long-war-score-table tbody td:nth-child(2) { width:9rem; color:var(--lw-green); white-space:nowrap; }
.long-war-score-table tbody td:last-child { color:var(--wc-muted,#aab4c4); line-height:1.45; }
.long-war-score-table tbody tr:last-child > * { border-bottom:0; }
@media (max-width:800px) {
  .long-war-rules { grid-template-columns:1fr; }
  .long-war-sync { grid-template-columns:1fr; }
  .long-war-sync div { border-right:0; border-bottom:1px solid rgba(105,212,238,.14); }
  .long-war-sync div:last-child { border-bottom:0; }
}
@media (max-width:520px) {
  .long-war-category-grid { grid-template-columns:1fr; }
  .long-war-heading { align-items:flex-start; flex-direction:column; }
  .long-war-score-table,.long-war-score-table tbody,.long-war-score-table tr,.long-war-score-table th,.long-war-score-table td { display:block; }
  .long-war-score-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
  .long-war-score-table tbody tr { padding:.75rem .9rem; border-bottom:1px solid rgba(255,255,255,.07); }
  .long-war-score-table tbody tr:last-child { border-bottom:0; }
  .long-war-score-table tbody th,.long-war-score-table tbody td,.long-war-score-table tbody td:nth-child(2) { width:auto; padding:.16rem 0; border:0; }
  .long-war-score-table tbody td:nth-child(2)::before { content:"Points: "; color:var(--wc-muted,#aab4c4); font-weight:400; }
}
