/* Earth's Elite: "gaming hub" styling on the EE navy palette (Option C).
   Mobile first: base rules are for phones, min-width queries add the rest.
   --accent, --accent2 and --accent3 are set per season in the layout. */

:root {
  --space: #050b1f;
  --card: rgba(13, 26, 58, 0.9);
  --inset: #0b1f45;
  --line: #17305c;
  --deep: #003375;
  --text: #D7E1EA;
  --muted: #ADCDEA;
  --up: #5FD38D;
  --down: #E5675C;
  --accent: #8DBEE9;
  --accent2: #5B8FD8;
  --accent3: #ADCDEA;
  --display: 'Chakra Petch', 'Arial Narrow', sans-serif;
  --body: 'Barlow', system-ui, sans-serif;
  --gutter: 16px;
  --starfield: url(/assets/img/background.jpg);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 16px/1.5 var(--body);
  background: var(--space);
}

a { color: var(--muted); text-decoration: none; }
a:hover { color: #fff; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent3);
  outline-offset: 2px;
}

img { max-width: 100%; height: auto; }

h1, h2, h3 { font-family: var(--display); }

.wrap { max-width: 1360px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

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

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 10;
  padding: 10px 16px; border-radius: 10px;
  background: var(--accent); color: var(--space); font-weight: 600;
}
.skip-link:focus { top: 8px; color: var(--space); }

.hide-sm { display: none; }
.show-sm { display: inline-flex; }

/* ---------- Buttons ---------- */

.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 20px;
  border: 0; border-radius: 10px;
  font: 600 16px/1.1 var(--body);
  color: var(--space); cursor: pointer; text-align: center;
}
.pill:hover { color: var(--space); filter: brightness(1.12); }
.pill-a { background: var(--accent); }
.pill-b { background: var(--accent2); }
.pill-c { background: var(--accent3); }
.pill-div { background: var(--div, var(--accent)); }
.pill-ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 1px var(--muted); }
.pill-ghost:hover { color: #fff; background: rgba(173, 205, 234, 0.08); filter: none; }
.pill-sm { min-height: 40px; padding: 8px 14px; font-size: 15px; }
.pill.hide-sm { display: none; } /* .pill would otherwise show it on phones */

.round-btn {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px;
  border: 0; padding: 0; overflow: hidden;
  background: var(--accent); color: var(--space); cursor: pointer;
  font: 700 18px/1 var(--display);
}
.round-btn.ghost { background: transparent; color: var(--muted); }
.round-btn.ghost:hover { color: #fff; }
.round-btn.copied { color: var(--up); }
.round-btn.avatar { background: var(--deep); color: #fff; }
.round-btn.avatar img { width: 100%; height: 100%; object-fit: cover; }
.round-btn.bell { position: relative; overflow: visible; background: var(--card); color: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.round-btn.bell:hover { color: #fff; box-shadow: inset 0 0 0 1px var(--muted); }
.round-btn.bell[aria-current="page"] { box-shadow: inset 0 0 0 2px var(--accent); }
.bell-count {
  position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 6px; background: var(--accent); color: var(--space);
  font: 700 12px/20px var(--body); text-align: center;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* ---------- Header ---------- */

.site-header { background: var(--space); border-bottom: 1px solid var(--line); }

.header-main {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px;
  padding-top: 12px; padding-bottom: 12px;
}

/* A zero basis lets the logo share the first row with the buttons on phones. */
.logo { display: block; flex: 1 1 0; min-width: 100px; max-width: 210px; }
.logo img { display: block; width: 100%; max-width: 210px; }

.header-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Phone menu: the nav drops below the header as a list of links. */
.site-nav { display: none; order: 3; flex: 1 1 100%; flex-direction: column; padding: 4px 0 6px; }
.site-header.menu-open .site-nav { display: flex; }
.nav-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 10px 10px;
  border-bottom: 2px solid transparent;
  font-weight: 600; color: var(--muted);
}
.nav-link:hover { color: #fff; }
.nav-link[aria-current="page"] { color: #fff; border-bottom-color: var(--accent); }

/* ---------- Title banner ---------- */

/* The starfield sits behind each page's title; on the home page it also runs
   behind the header. */
.banner {
  background-image:
    linear-gradient(90deg, rgba(5, 11, 31, 0.95) 0%, rgba(5, 11, 31, 0.7) 55%, rgba(5, 11, 31, 0.45) 100%),
    var(--starfield);
  background-size: cover;
  background-position: center 40%;
  border-bottom: 3px solid var(--div, var(--accent));
}
.page-top.is-home {
  background-image:
    linear-gradient(90deg, rgba(5, 11, 31, 0.92) 0%, rgba(5, 11, 31, 0.55) 60%, rgba(5, 11, 31, 0.35) 100%),
    var(--starfield);
  background-size: cover;
  background-position: center 30%;
}
.is-home .site-header { background: transparent; border-bottom: 0; }
.is-home .banner { background: none; border-bottom: 0; }

.banner-inner { padding-top: 16px; padding-bottom: 32px; }
.banner-home .banner-inner { padding-top: 40px; padding-bottom: 48px; }
.banner .crumb-bar { margin-bottom: 22px; }

.eyebrow {
  margin: 0 0 6px; font-weight: 600; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--div, var(--accent));
}
.banner-title {
  margin: 0 0 12px; font: 700 40px/1.05 var(--display); color: #fff; overflow-wrap: anywhere;
}
.banner-home .banner-title { max-width: 760px; }
.banner-lead { margin: 0; max-width: 640px; font-size: 18px; }
.banner-lead.prose p { margin: 0 0 8px; }
.banner-actions { margin-top: 22px; }

.chip-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card);
  font-size: 14px; font-weight: 600; color: var(--text);
}
a.chip { min-height: 40px; }
a.chip:hover { color: #fff; border-color: var(--muted); }
.chip-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 3px; }

.stat-list { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.stat {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  border-radius: 10px; background: rgba(13, 26, 58, 0.8); border: 1px solid var(--line);
}
.stat strong { font: 700 18px/1.2 var(--display); color: #fff; }
.stat span { font-size: 14px; color: var(--muted); }
.stat-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 4px; background: var(--up); }

/* ---------- Main and cards ---------- */

.site-main { padding-top: 24px; padding-bottom: 48px; }

/* Short pages: the main area grows so the footer sits at the bottom of the
   window instead of leaving empty space under it. */
body:not(.admin) { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body:not(.admin) > .site-main { width: 100%; flex: 1 0 auto; }

.dash { display: flex; flex-direction: column; gap: 28px; }
.dash-two { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding-bottom: 20px;
}
.panel.narrow { max-width: 640px; margin: 0 auto; }
.panel-edge { border-top: 3px solid var(--div, var(--accent)); }

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding: 18px 18px 0; }
/* Older admin markup still has tab and rule spans. */
.panel-tab, .panel-rule { display: none; }
.panel-title { margin: 0; min-width: 0; font: 700 22px/1.2 var(--display); color: #fff; }
.panel-num { font-size: 14px; color: var(--muted); }
.panel-kind { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--div, var(--muted)); }

.panel-body { padding: 12px 18px 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 14px; }
.section-title { margin: 0; font: 700 28px/1.15 var(--display); color: #fff; }

.prose p { margin: 0 0 12px; }
.prose p:last-of-type { margin-bottom: 0; }
.prose a:not(.pill) { text-decoration: underline; text-underline-offset: 2px; }
.lead { font-size: 17px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { margin: 0; padding: 6px 0; color: var(--muted); }

.row-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  background: var(--inset); color: var(--text);
}
a.row-card:hover { color: #fff; background: #10285a; }
.row-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.row-text strong { font-weight: 600; }
.row-text .muted { font-size: 14px; }

.time-badge {
  flex: 0 0 56px; text-align: center;
  font: 700 17px/1.2 var(--display); color: var(--accent);
}
.badge-b { color: var(--accent2); }
.badge-c { color: var(--accent3); }
.badge-div { color: var(--div, var(--accent)); }

.more-link {
  align-self: flex-start;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px;
  font-weight: 600; font-size: 15px;
}

.server-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }.server {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 8px 4px 8px 12px; border-radius: 8px; background: var(--inset);
}
.status-dot { flex: 0 0 8px; height: 8px; border-radius: 4px; }
.status-dot.is-up { background: var(--up); }
.status-dot.is-down { background: var(--down); }
.players { font-weight: 600; color: #fff; white-space: nowrap; }

.plain-list { list-style: none; margin: 0; padding: 0; }
.split-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 2px; border-bottom: 1px solid var(--line);
}
.split-row > :last-child { text-align: right; }
li:last-child > .split-row, .plain-list > .split-row:last-child { border-bottom: 0; }
.link-row { min-height: 44px; color: var(--text); }
.new-tag {
  display: inline-block; padding: 0 7px; margin-right: 2px; border-radius: 6px;
  background: var(--accent); color: var(--space);
  font: 700 12px/1.6 var(--body); text-transform: uppercase; letter-spacing: 0.04em;
  vertical-align: 1px;
}

.news-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.news-card { padding: 16px 18px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.stack .news-card { background: var(--inset); border: 0; border-radius: 8px; padding: 12px 14px; }
.news-card h3 { margin: 0 0 6px; font: 700 18px/1.25 var(--display); }
.news-card h3 a { color: #fff; }
.news-card p { margin: 0 0 6px; font-size: 15px; }
.news-kind { margin: 0 0 6px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }

/* Division cards on the home page. */
.game-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.game-card {
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
  border-radius: 10px; background: var(--card); border: 1px solid var(--line); color: var(--text);
}
.game-card:hover { color: var(--text); border-color: var(--div); }
.game-art {
  display: flex; align-items: flex-end; height: 88px; padding: 10px 12px;
  background: var(--inset); border-bottom: 3px solid var(--div);
  font: 700 36px/1 var(--display); color: var(--div);
}
.game-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 14px; }
.game-body strong { font: 700 18px/1.2 var(--display); color: #fff; }
.game-body span { font-size: 14px; color: var(--muted); }

/* Priority messages and flashes. */
.notice {
  display: flex; align-items: stretch; margin-bottom: 16px;
  border-radius: 10px; overflow: hidden; background: var(--card); border: 1px solid var(--line);
}
.notice-bar { flex: 0 0 4px; background: var(--accent); }
.notice-error .notice-bar { background: var(--down); }
.notice-success .notice-bar { background: var(--up); }
.notice p { margin: 0; padding: 12px 16px; }
.notice a { text-decoration: underline; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 14px; margin: 14px 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span, .field > label { font-size: 15px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--inset); color: #fff;
  font: 16px/1.4 var(--body);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check span { font-weight: 400; color: var(--text); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--down); }
.field textarea { min-height: 200px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.field-error { margin: 0; color: #FF9A90; font-weight: 600; }
.hint { margin: 0; font-size: 14px; color: var(--muted); }
.field input.code-input { max-width: 220px; font: 700 26px/1.2 var(--display); letter-spacing: 0.3em; }

.trace {
  overflow: auto; max-height: 420px; padding: 12px; border-radius: 8px;
  background: var(--inset); font-size: 12px; white-space: pre-wrap;
}

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); }
.footer-links {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px;
  padding-top: 14px; padding-bottom: 20px; font-size: 14px; color: var(--muted);
}
.footer-links a { display: flex; align-items: center; min-height: 44px; }
.link-btn {
  display: flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none;
  font: inherit; color: var(--accent); text-align: left; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.version, .copyright { grid-column: 1 / -1; }
.version { font-weight: 600; color: #fff; padding: 8px 0; }
.copyright { padding-top: 6px; }

/* ---------- Content pages ---------- */

/* --div is a division or department colour, set on a wrapper. */
.tab-div { background: var(--div, var(--accent)); }

.crumb-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 16px; }
.breadcrumbs { min-width: 0; }
.back-btn { padding-left: 10px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin: 0 4px 0 2px; }
.breadcrumbs [aria-current] { color: #fff; }

.division-grid, .category-grid {
  list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px;
}
.division-card {
  display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 18px 20px;
  border-radius: 10px; background: var(--card); border: 1px solid var(--line);
  border-top: 3px solid var(--div); color: var(--text);
}
.division-card:hover { color: var(--text); border-color: var(--div); }
.division-card .eyebrow { margin: 0; color: var(--div); }
.division-card-title { font: 700 26px/1.1 var(--display); color: #fff; }
.division-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.division-card-meta span { padding: 2px 10px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; }

.split { display: flex; flex-direction: column; gap: 20px; }
.split-main, .split-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; background: var(--inset); }
.person.is-open .row-text strong { color: var(--muted); font-style: italic; }
.avatar-ring {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 8px; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--space); border: 1px solid var(--ring, var(--accent));
  font: 700 16px/1 var(--display); color: #fff;
}
.avatar-ring img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { flex-basis: 64px; width: 64px; height: 64px; border-radius: 12px; border-width: 2px; font-size: 26px; background: var(--inset); }
.rank-pill {
  flex: 0 0 auto; margin-left: auto; padding: 2px 8px; border-radius: 6px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600;
}

.section-blurb { margin: 0 0 12px; }
.section-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.senior-section { margin-bottom: 28px; }
.senior-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.senior-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0;
  padding: 18px; border-radius: 10px; background: var(--card); border: 1px solid var(--line);
}
.senior-card.is-vacant { opacity: 0.75; }
.senior-card .avatar-ring { margin-bottom: 10px; }
.senior-role { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ring); }
.senior-name { font: 700 22px/1.2 var(--display); color: #fff; overflow-wrap: anywhere; }
.senior-name.is-vacant { color: var(--muted); font-style: italic; }
.senior-card .rank-pill { margin: 2px 0 0; }
.senior-action { margin-top: 8px; }

.search-form { display: flex; gap: 8px; max-width: 520px; margin-top: 20px; }
.search-form input {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: rgba(11, 31, 69, 0.9); color: #fff;
  font: 16px/1.4 var(--body);
}
.search-form input:focus { border-color: var(--accent); outline: none; }
.category-card .row-text { gap: 2px; }

.article { max-width: 900px; }
.article > .panel-body:first-child { padding-top: 22px; }
.narrow > .panel-body:first-child, .narrow > .form:first-child { padding-top: 10px; }
.article-meta { margin: 0 0 6px; }

.prose h2, .prose h3, .prose h4 { margin: 20px 0 8px; font-family: var(--display); color: #fff; }
.prose h2 { font-size: 24px; }
.prose h3 { font-size: 20px; }
.prose h4 { font-size: 17px; }
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 22px; }
.prose li { margin-bottom: 4px; }
.prose blockquote { margin: 0 0 12px; padding: 8px 14px; border-left: 3px solid var(--accent); background: var(--inset); border-radius: 0 8px 8px 0; }
.prose hr { border: 0; height: 1px; margin: 20px 0; background: var(--line); }
.prose img { border-radius: 8px; }
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0 0 14px; font-size: 15px; }
.prose th, .prose td { padding: 6px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: var(--inset); color: #fff; }

/* ---------- Admin panel ---------- */

.admin-wrap { max-width: 1400px; margin: 0 auto; padding: 0 var(--gutter) 32px; }

.admin-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin: 0 calc(var(--gutter) * -1) 20px; padding: 12px var(--gutter);
  border-bottom: 1px solid var(--line);
}
.admin-logo { display: block; flex: 0 1 150px; min-width: 110px; }
.admin-logo img { display: block; width: 100%; }
.admin-badge { padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.admin-header-tools { display: flex; gap: 8px; margin-left: auto; }
.admin-title-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 16px; }
.admin-title { margin: 0; font: 700 30px/1.1 var(--display); color: #fff; }

.admin-body { display: flex; flex-direction: column; gap: 16px; }
.admin-nav { display: none; }
.admin-body.nav-open .admin-nav { display: block; }
.admin-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.admin-nav-item {
  display: flex; align-items: center; min-height: 44px; padding: 8px 14px;
  border-radius: 8px; border-left: 3px solid transparent;
  font-weight: 600; color: var(--muted);
}
.admin-nav-item:hover { color: #fff; background: var(--card); }
.admin-nav-item[aria-current="page"] { color: #fff; background: var(--card); border-left-color: var(--accent); }

.admin-content { flex: 1 1 auto; min-width: 0; }

.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.admin-form-panel { max-width: 760px; }
.admin-form-panel.wide { max-width: 1000px; }
.panel-head .pill { flex: 0 0 auto; }

.module-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.module-card {
  display: flex; align-items: stretch; gap: 12px; height: 100%;
  padding: 12px 14px 12px 0; border-radius: 8px; background: var(--inset); color: var(--text);
}
a.module-card:hover { color: #fff; background: #10285a; }
.module-card-tab { flex: 0 0 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.module-card-tab.tab-b { background: var(--accent2); }
.module-card-tab.tab-c { background: var(--accent3); }
.module-card .muted { font-size: 14px; }
.category-grid .module-card { padding: 16px 18px 16px 0; background: var(--card); border: 1px solid var(--line); }

.log-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.tag-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list li, .tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: var(--inset); color: var(--muted); font-size: 14px;
}
.tag { align-self: flex-start; margin-top: 4px; background: var(--deep); color: #fff; font-size: 12px; font-weight: 600; }

.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.admin-table { width: 100%; min-width: 520px; border-collapse: separate; border-spacing: 0 6px; }
.admin-table th { padding: 4px 10px; text-align: left; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.admin-table td { padding: 8px 10px; background: var(--inset); vertical-align: middle; }
.admin-table td:first-child { border-radius: 8px 0 0 8px; }
.admin-table td:last-child { border-radius: 0 8px 8px 0; }
.admin-table tr:target td { background: #10285a; }
.admin-table .num { text-align: right; }

/* Phones: each table row becomes a card; cells with data-label get a label. */
@media (max-width: 760px) {
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; min-width: 0; }
  .admin-table { border-spacing: 0; }
  .admin-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .admin-table tr { margin-bottom: 8px; padding: 8px 4px; border-radius: 8px; background: var(--inset); }
  .admin-table td, .admin-table td:first-child, .admin-table td:last-child { padding: 4px 10px; border-radius: 0; background: none; }
  .admin-table .num { text-align: left; }
  .admin-table td[data-label]::before { content: attr(data-label) ": "; font-size: 13px; font-weight: 600; color: var(--muted); }
}

.order-cell { white-space: nowrap; width: 1%; }
.order-num { display: inline-block; min-width: 2ch; margin-right: 4px; font: 700 16px/1 var(--display); color: #fff; text-align: right; }
.inline-form { display: inline-flex; align-items: center; gap: 2px; margin: 0; vertical-align: middle; }
.round-btn.small-btn { width: 36px; height: 36px; }
.round-btn:disabled { opacity: 0.3; cursor: default; }
.round-btn.danger { color: var(--down); }
.round-btn.danger:hover { color: #FF9A90; }

.group-heading { margin: 18px 0 2px; font: 700 18px/1.2 var(--display); color: #fff; }
.group-heading:first-of-type { margin-top: 8px; }
.group-heading[data-highlight] { color: var(--accent); }
.group-heading-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 0 6px; }
.group-heading-row .group-heading { margin: 0; }
.tag-muted { background: var(--inset); color: var(--muted); }
.admin-table td .tag { margin: 0 0 0 6px; vertical-align: 1px; }

.perm-group { margin: 0 0 16px; padding: 0; border: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.perm-group legend { margin-bottom: 8px; padding: 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.perm { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 8px; background: var(--inset); cursor: pointer; }
.perm input { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }
.perm strong { font-weight: 600; }
.perm .tag { margin: 0 0 0 6px; vertical-align: 1px; }
.perm:has(input:checked) { box-shadow: inset 0 0 0 1px var(--accent); }

.sticky-actions {
  position: sticky; bottom: 0; z-index: 2; margin: 16px 0 0; padding: 12px 0;
  background: linear-gradient(180deg, rgba(5, 11, 31, 0) 0%, var(--space) 35%);
}

.field-row { display: flex; flex-wrap: wrap; gap: 14px; }
.field-row > .field { flex: 1 1 110px; min-width: 0; }
.field-row > .grow-2 { flex: 2 1 200px; }
.field-row > .grow-3 { flex: 3 1 200px; }

.test-box { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 8px; background: var(--inset); }
.test-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.test-box p { margin: 0; }

.status-text { display: inline-flex; align-items: center; gap: 6px; }
.status-pip { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 5px; }
.status-pip.is-up { background: var(--up); }
.status-pip.is-down { background: var(--down); }
.text-up { color: var(--up); font-weight: 600; }
.text-down { color: #FF9A90; font-weight: 600; }
.block { display: block; }
.cell-title { display: block; color: #fff; font-weight: 600; }

/* On/off switch: a button with aria-pressed. */
.switch {
  display: inline-flex; align-items: center; width: 52px; height: 30px; padding: 3px;
  border: 0; border-radius: 15px; background: var(--deep); cursor: pointer;
}
.switch span { width: 24px; height: 24px; border-radius: 12px; background: #fff; }
.switch.is-on { justify-content: flex-end; background: var(--accent2); }
@media (prefers-reduced-motion: no-preference) { .switch span { transition: transform 0.15s; } }

.category-list .split-row { padding: 4px 2px; }
.category-list .split-row > a { flex: 1 1 auto; display: flex; align-items: center; min-height: 44px; color: var(--text); }
.category-list .is-current > a { color: #fff; font-weight: 600; }
.category-list .is-current { box-shadow: inset 3px 0 0 var(--accent); padding-left: 10px; }

.colour-dot { flex: 0 0 auto; display: inline-block; width: 18px; height: 18px; border-radius: 5px; }
.colour-field { margin: 0; padding: 0; border: 0; }
.colour-field legend, .choice-group legend { margin-bottom: 6px; padding: 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }

.choice-group { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 4px; }
.choice-group > .field { margin-top: 8px; }
.choice { align-items: flex-start; padding: 6px 0; }
.choice input { margin-top: 3px; flex: 0 0 auto; }
.choice strong { font-weight: 600; }
.day-checks { display: flex; flex-wrap: wrap; gap: 0 18px; }
[data-show-for][hidden] { display: none !important; }
.swatch { position: relative; width: 44px; height: 44px; border-radius: 10px; background: var(--swatch); cursor: pointer; }
.swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--space), 0 0 0 5px #fff; }
.swatch:has(input:focus-visible) { outline: 3px solid var(--accent3); outline-offset: 4px; }

.compare { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 8px; }
.compare-side { padding: 12px 14px; border-radius: 8px; background: var(--inset); min-width: 0; }
.compare-side.is-new { box-shadow: inset 0 0 0 1px var(--accent); }
.compare-label { margin: 0 0 6px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.review-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.decline-form { flex-direction: row; flex-wrap: wrap; align-items: flex-end; flex: 1 1 320px; margin: 0; }
.decline-form .field { flex: 1 1 220px; }

.rank-cell { display: flex; align-items: center; gap: 12px; }
.rank-img { flex: 0 0 auto; max-width: 64px; max-height: 40px; object-fit: contain; }
.image-field { display: flex; align-items: center; gap: 12px; }
.image-field input { flex: 1 1 auto; }

/* ---------- Calendar ---------- */

/* Each event carries its division colour in --ev. */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-month { margin: 0 6px 0 0; font: 700 28px/1.1 var(--display); color: #fff; }
.cal-step { background: var(--card); color: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.cal-step:hover { color: #fff; box-shadow: inset 0 0 0 1px var(--muted); }
.cal-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cal-legend li {
  display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card);
  font-size: 14px; font-weight: 600;
}
.cal-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--ev); }

.cal-panel { padding-bottom: 0; overflow: hidden; }
.cal-panel > .panel-body { padding: 0; }
.cal-head, .cal-grid { display: none; }
.cal-agenda { list-style: none; margin: 0; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.agenda-day { display: flex; gap: 12px; align-items: flex-start; }
.agenda-date {
  flex: 0 0 52px; display: flex; flex-direction: column; align-items: center;
  padding: 6px 0; border-radius: 8px; background: var(--inset); color: var(--muted);
  font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.agenda-date span { font: 700 22px/1.1 var(--display); color: #fff; }
.agenda-day.is-today .agenda-date { box-shadow: inset 0 0 0 2px var(--accent); }
.agenda-items { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.agenda-item {
  display: flex; flex-direction: column; min-height: 44px; justify-content: center;
  padding: 8px 12px; border-radius: 6px; border-left: 3px solid var(--ev);
  background: var(--inset); color: var(--text);
}
a.agenda-item:hover { color: #fff; background: #10285a; }
.agenda-item strong { font-weight: 600; }
.agenda-item .muted { font-size: 14px; }

.cal-day-panel { display: none; }
.cal-day-title { margin: 0; font: 700 22px/1.2 var(--display); color: #fff; }

.event-card { position: relative; border-radius: 10px; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--ev, var(--accent)); }
.event-card-bar { display: none; }
.event-card-body { padding: 14px 16px 16px; }
.event-card-body > :last-child { margin-bottom: 0; }
.event-meta { margin: 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ev, var(--muted)); }
.event-meta .tag { margin: 0 0 0 4px; vertical-align: 1px; letter-spacing: 0.02em; }
.event-title { margin: 4px 0 6px; font: 700 20px/1.25 var(--display); }
.event-title a { color: #fff; }
.event-title a:hover { text-decoration: underline; }
.event-excerpt { margin: 0 0 8px; font-size: 15px; }
.event-card .muted { margin: 0 0 12px; }
.event-card .pill { background: var(--ev, var(--accent)); }
.birthday-line { display: flex; align-items: center; gap: 12px; margin: 0; }
.birthday-line svg { flex: 0 0 auto; color: var(--ev); }
.birthday-line strong { font-weight: 600; }

.event-facts { margin: 0 0 16px; display: grid; gap: 8px; }
.event-facts div { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.event-facts dt { flex: 0 0 90px; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.event-facts dd { margin: 0; flex: 1 1 200px; color: #fff; }
.attendee-list { margin: 0; }

/* ---------- Changelog ---------- */

.changelog { display: flex; flex-direction: column; gap: 36px; max-width: 900px; }
.changelog-series .section-title { margin-bottom: 14px; scroll-margin-top: 16px; }
.changelog-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.changelog-entry { padding: 16px 18px 18px; }
.changelog-entry.is-current { border-left: 3px solid var(--accent); }
.changelog-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.changelog-version { margin: 0; font: 700 22px/1.2 var(--display); color: #fff; }
.changelog-head time { margin-left: auto; }
.changelog-changes { margin: 10px 0 0; padding-left: 20px; }
.changelog-changes li { margin-bottom: 4px; }
.changelog-changes li::marker { color: var(--accent); }

/* ---------- Problem reports ---------- */

.field textarea.plain-text { min-height: 160px; font: 16px/1.5 var(--body); }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.report-text { margin: 0; overflow-wrap: anywhere; }
.status-tag {
  flex: 0 0 auto; display: inline-block; padding: 2px 8px; border-radius: 6px; white-space: nowrap;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--inset); color: var(--muted); border: 1px solid var(--line);
}
.status-new { background: var(--accent); color: var(--space); border-color: var(--accent); }
.status-in_progress { color: #F2C46B; border-color: rgba(242, 196, 107, 0.5); }
.status-resolved { color: var(--up); border-color: rgba(95, 211, 141, 0.5); }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.filter-tabs a[aria-current="page"] { color: #fff; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.report-facts { margin: 0 0 14px; display: grid; gap: 6px; }
.report-facts div { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.report-facts dt { flex: 0 0 110px; font-size: 14px; font-weight: 600; color: var(--muted); }
.report-facts dd { margin: 0; flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.admin-back { margin: 0 0 14px; }
.admin-search { margin: 4px 0 14px; }
.mail-waiting { background: var(--accent); color: var(--space); border-color: var(--accent); }
.mail-retrying { color: #F2C46B; border-color: rgba(242, 196, 107, 0.5); }
.mail-sent { color: var(--up); border-color: rgba(95, 211, 141, 0.5); }
.mail-failed { background: rgba(229, 103, 92, 0.18); color: #FF9A90; border-color: rgba(229, 103, 92, 0.5); }
.mail-to { overflow-wrap: anywhere; }
.mail-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.mail-actions { margin: 0 0 18px; }
.mail-preview-title { margin: 0 0 10px; font: 600 15px/1.3 var(--body); color: var(--muted); }
.mail-preview { display: block; width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 8px; background: #050b1f; }
.credits-heading { margin-bottom: 14px; }
.credits-intro { margin: -6px 0 14px; }
.credit-card { height: 100%; }
.credit-link { margin-top: 4px; color: var(--accent); font-weight: 600; overflow-wrap: anywhere; }
.log-filters { margin: 0 0 16px; gap: 10px; }
.log-filters-end { align-items: flex-end; }
.log-filters-end .actions { margin: 0; }
.admin-table td .tag-link { margin: 0 6px 0 0; text-decoration: none; }
.tag-link:hover, .tag-link:focus-visible { background: var(--accent); color: var(--space); }
.log-table td:first-child { width: 1%; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }
.status-done { color: var(--muted); }
.tag-banned { background: rgba(229, 103, 92, 0.18); color: #FF9A90; }
.ban-notice { margin: 4px 0 12px; }
.loa-tag { display: inline-block; padding: 0 6px; border-radius: 6px; border: 1px solid rgba(242, 196, 107, 0.5); color: #F2C46B; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-style: normal; }
.note-staff { box-shadow: inset 3px 0 0 var(--line); }
.note-public { box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- Notifications ---------- */

.notice-card { padding: 12px 14px 14px; border-radius: 8px; background: var(--inset); }
.notice-card.is-new { box-shadow: inset 3px 0 0 var(--accent); }
.notice-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px -6px 0 0; }
.notice-card .event-meta { color: var(--muted); }
.notice-card .new-tag { margin-left: 6px; }
.notice-card .event-title { margin-bottom: 4px; }
.small-prose { font-size: 15px; }
.small-prose p { margin: 0 0 8px; }

/* Stream Team: /streaming, streamer pages, the multi view and the home page. */
.stream-intro { margin: -6px 0 14px; }
.stream-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.stream-card {
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
  border-radius: 10px; background: var(--card); border: 1px solid var(--line); color: var(--text);
}
.stream-card:hover { color: var(--text); border-color: var(--accent); }
.stream-card.is-live { border-color: rgba(233, 25, 22, 0.55); }
.stream-card.is-live:hover { border-color: #E91916; }
.stream-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--inset); }
.stream-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.stream-thumb-empty { display: flex; align-items: center; justify-content: center; height: 100%; font: 700 56px/1 var(--display); color: var(--line); }
.live-badge {
  display: inline-block; padding: 2px 8px; border-radius: 6px; background: #E91916; color: #fff;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
.stream-thumb .live-badge { position: absolute; top: 10px; left: 10px; }
.live-badge-inline { padding: 0 6px; vertical-align: 2px; }
.stream-overlay {
  position: absolute; right: 10px; bottom: 10px; padding: 2px 8px; border-radius: 6px;
  background: rgba(5, 11, 31, 0.85); color: #fff; font-size: 13px; font-weight: 600;
}
.stream-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; }
.stream-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stream-who strong { font: 700 18px/1.2 var(--display); color: #fff; }
.stream-text { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.nav-live { display: inline-block; width: 8px; height: 8px; margin-left: 2px; border-radius: 4px; background: #E91916; vertical-align: 2px; }

.player-frame { aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.player-frame iframe, .chat-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.player-solo { max-width: 960px; }
.chat-frame { height: 420px; border-radius: 10px; overflow: hidden; background: var(--inset); border: 1px solid var(--line); }
.watch { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.watch-caption { margin: 12px 0 0; font-weight: 600; color: #fff; overflow-wrap: anywhere; }

.multi { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.multi-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.multi-caption { display: flex; align-items: center; gap: 8px; margin: 6px 2px 0; min-width: 0; }
.multi-caption a { font-weight: 600; }
.multi-caption .tag { margin-top: 0; }
.multi-chat .filter-tabs { margin-bottom: 12px; }
.multi-chat .chat-frame { margin-bottom: 18px; }

/* Downloads: /downloads and the panel on division pages. */
.download-intro { margin: -6px 0 14px; }
.download-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.download {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
  padding: 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line);
}
.panel .download { background: var(--inset); border: 0; padding: 10px 12px; }
.download .row-text { flex: 1 1 0; }
.download .row-text strong { overflow-wrap: anywhere; }
.download .tag { margin: 0 0 0 4px; vertical-align: 2px; }
.download-desc { font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.file-badge {
  flex: 0 0 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--deep); color: var(--accent);
  font: 700 13px/1 var(--display); letter-spacing: 0.04em;
}
.download.is-compact .file-badge { flex-basis: 40px; height: 40px; font-size: 12px; }
.download-actions { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 0 100%; justify-content: flex-end; }
.download.is-compact .download-actions { flex: 0 0 auto; }

/* Chip in: /chip-in and Admin › Chip in. */
.amount-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.amount-choice { position: relative; cursor: pointer; }
.amount-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.amount-choice span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 72px; min-height: 48px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--inset);
  font: 700 18px/1 var(--display); color: var(--text);
}
.amount-choice:hover span { border-color: var(--muted); }
.amount-choice input:checked + span { color: #fff; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--deep); }
.amount-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.amount-other { max-width: 220px; }
.goal { margin-top: 18px; padding: 14px; border-radius: 8px; background: var(--inset); }
.goal-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin: 0 0 10px; }
.goal-head strong { color: #fff; }
.goal-head span { font: 700 16px/1.3 var(--display); color: var(--accent); }
.goal-bar { height: 12px; border-radius: 6px; background: var(--deep); overflow: hidden; }
.goal-bar span { display: block; height: 100%; min-width: 4px; border-radius: 6px; background: var(--accent); }
.goal-note { margin: 8px 0 0; }
.form .goal { margin: 0; }
.supporter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.supporter-list li { display: flex; align-items: center; gap: 10px; font-weight: 600; overflow-wrap: anywhere; }
.supporter-initial {
  flex: 0 0 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: 16px; background: var(--deep); color: var(--accent); font: 700 14px/1 var(--display);
}
.supporter-name-form { margin-top: 14px; }
.supporter-name-form p { margin: 0 0 8px; }
.donation-pending, .donation-started { color: #F2C46B; border-color: rgba(242, 196, 107, 0.5); }
.donation-completed { color: var(--up); border-color: rgba(95, 211, 141, 0.5); }
.donation-failed, .donation-reversed { background: rgba(229, 103, 92, 0.18); color: #FF9A90; border-color: rgba(229, 103, 92, 0.5); }
.stat-row { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.stat-row strong { font: 700 22px/1.2 var(--display); color: #fff; }
.stat-row span { color: var(--muted); font-size: 14px; }
.event-log li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.event-log li:last-child { border-bottom: 0; }
.event-log code, .panel-body code { overflow-wrap: anywhere; }

/* Halloween: /trick-or-treat, the jump scares and Admin › Halloween. */
.tot { max-width: 720px; margin-inline: auto; text-align: center; }
.tot-form { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 6px 0 14px; }
.tot-btn {
  min-width: 150px; min-height: 64px; padding: 0 24px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--accent); background: var(--inset); color: #fff;
  font: 700 26px/1 var(--display); letter-spacing: 0.06em;
}
.tot-btn:nth-child(3) { border-color: var(--accent2); }
.tot-btn:hover, .tot-btn:focus-visible { background: var(--deep); box-shadow: 0 0 18px rgba(242, 145, 61, 0.35); }
.tot-btn:disabled { opacity: 0.6; cursor: wait; }
.tot-left { margin: 0; }
.tot-result { margin: 0 0 18px; padding: 18px 14px; border-radius: 10px; background: var(--inset); }
.tot-result p { margin: 0 0 6px; }
.tot-kind { font: 700 44px/1.1 var(--display); letter-spacing: 0.08em; }
.tot-trick { color: var(--accent2); }
.tot-treat { color: var(--accent); }
.tot-headline { font: 600 20px/1.35 var(--display); color: #fff; overflow-wrap: anywhere; }
.tot-details { color: var(--muted); }
.tot-result audio { display: block; width: 100%; max-width: 320px; margin: 10px auto 0; }
.outcome-treat { color: var(--up); border-color: rgba(95, 211, 141, 0.5); }
.outcome-trick { color: #C9A6F0; border-color: rgba(167, 123, 219, 0.5); }
.sub-title { margin: 18px 0 8px; font: 700 18px/1.25 var(--display); color: #fff; }
.sub-title:first-of-type { margin-top: 8px; }
.input-short { max-width: 140px; }
.sound-name { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sound-name input {
  flex: 1 1 140px; min-width: 0; min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--inset); color: #fff; font: inherit;
}
.sound-name input:focus { border-color: var(--accent); outline: none; }
.admin-table audio { width: 220px; max-width: 100%; height: 36px; }

/* The jump scare: a quick red flicker while the sound plays. */
.scare-flash::after {
  content: ""; position: fixed; inset: 0; z-index: 1000; pointer-events: none;
  background: radial-gradient(circle, rgba(0, 0, 0, 0) 30%, rgba(120, 0, 0, 0.55) 100%);
}
@media (prefers-reduced-motion: no-preference) {
  .scare-flash::after { animation: scare-flicker 0.7s steps(1) 1 both; }
  .scare-flash .site-main { animation: scare-shake 0.35s linear 2; }
  .tot-result.is-new { animation: tot-reveal 0.4s ease-out; }
}
@keyframes scare-flicker {
  0% { background-color: rgba(255, 255, 255, 0.6); }
  15% { background-color: rgba(0, 0, 0, 0.85); }
  30% { background-color: rgba(120, 0, 0, 0.4); }
  50%, 100% { background-color: rgba(0, 0, 0, 0); }
}
@keyframes scare-shake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-6px, 3px); }
  50% { transform: translate(5px, -4px); }
  75% { transform: translate(-3px, -2px); }
}
@keyframes tot-reveal {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- Tablet and up ---------- */

@media (min-width: 761px) {
  :root { --gutter: 20px; }

  .hide-sm, .pill.hide-sm { display: inline-flex; }
  .show-sm { display: none; }

  .header-main { padding-top: 14px; padding-bottom: 14px; }
  .logo { flex: 0 1 210px; min-width: 150px; }

  .banner-inner { padding-top: 20px; padding-bottom: 40px; }
  .banner .crumb-bar { margin-bottom: 28px; }
  .banner-title { font-size: 58px; line-height: 1; }
  .banner-home .banner-inner { padding-top: 64px; padding-bottom: 72px; }
  .banner-home .banner-title { font-size: 60px; line-height: 1.05; }
  .banner-lead { font-size: 19px; }
  .stat-list { margin-top: 36px; }

  .site-main { padding-top: 32px; padding-bottom: 56px; }
  .dash { gap: 40px; }
  .panel-head { padding: 20px 22px 0; }
  .panel-body { padding: 12px 22px 0; }
  .server-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .download-actions { flex: 0 0 auto; }
  .news-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .news-more { margin-top: 20px; }
  .section-title { font-size: 30px; }
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .game-art { height: 110px; padding: 12px 14px; font-size: 44px; }
  .game-body { padding: 12px 14px 16px; }
  .game-body strong { font-size: 20px; }

  .admin-header { margin-bottom: 24px; }
  .admin-title { font-size: 36px; }
  .module-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

  .division-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
  .category-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
  .stream-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .multi-2, .multi-3, .multi-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .senior-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-grid { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
  .perm-group { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .compare { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .cal-month { font-size: 30px; min-width: 230px; }
  .cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
  .cal-head span { padding: 10px 0; text-align: center; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
  .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .cal-day {
    display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 104px; padding: 8px;
    border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text);
  }
  .cal-day:nth-child(7n) { border-right: 0; }
  .cal-day:hover { color: var(--text); background: #10285a; }
  .cal-day.is-outside { opacity: 0.35; }
  .cal-day.is-today .cal-num { color: var(--accent); }
  .cal-day.is-open { background: #10285a; box-shadow: inset 0 0 0 2px var(--accent); }
  .cal-num { font: 700 15px/1.2 var(--display); color: #fff; }
  .cal-chip {
    display: block; padding: 2px 6px; border-radius: 3px; border-left: 3px solid var(--ev);
    background: var(--inset); color: var(--text);
    font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .cal-more { font-size: 12px; color: var(--muted); }
  .cal-agenda { display: none; }
  .cal-day-panel { display: flex; }
  .event-facts dt { flex-basis: 110px; }

  .footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding-top: 18px; padding-bottom: 26px; }
  .footer-links a { min-height: 44px; }
  .version { padding: 0; }
  .copyright { margin-left: auto; padding-top: 0; }
}

/* ---------- Desktop ---------- */

@media (min-width: 1101px) {
  /* The full nav only fits beside the logo and buttons from here up. */
  .site-nav, .site-header.menu-open .site-nav { display: flex; order: 0; flex: 1 1 auto; flex-direction: row; flex-wrap: wrap; gap: 2px; padding: 0; }
  .menu-btn { display: none; }

  .admin-body { flex-direction: row; align-items: flex-start; gap: 24px; }
  .admin-nav, .admin-body.nav-open .admin-nav { display: block; flex: 0 0 220px; }
  .admin-menu-btn { display: none; }
  .admin-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .admin-grid > .admin-span-2 { grid-column: 1 / -1; }

  .split { flex-direction: row; align-items: flex-start; }
  .split-main { flex: 2 1 0; }
  .split-side { flex: 1 1 0; }
  .cal-split .split-main { flex-grow: 2.2; }

  .stream-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .watch { grid-template-columns: minmax(0, 1fr) 340px; }
  .watch .chat-frame { height: auto; }
  .multi { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .multi-chat .chat-frame { height: 560px; }

  .dash-two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .news-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .game-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .senior-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: no-preference) {
  .pill, .row-card, .nav-link { transition: filter 0.15s, background-color 0.15s, color 0.15s; }
}
