/* ==========================================================================
   Theme palettes. Values match the live forum; every other colour below is
   derived from these so all eight themes keep working.
   ========================================================================== */

:root,
[data-theme="wolf"] {
  --bg: #0c0c0c;
  --page: #070707;
  --menu: #121212;
  --panel: #181818;
  --child: #181818;
  --line: #262626;
  --line2: #363636;
  --text: #e6e6e6;
  --muted: #5a5a5a;
  --hover: #b4b4b4;
  --accent: #750851;
  --title: #d98bb8;
}

[data-theme="carbon"] {
  --page: #080808;
  --menu: #111111;
  --panel: #171717;
  --accent: #9a9a9a;
  --title: #d0d0d0;
  --on-accent: #0c0c0c;
}

[data-theme="blood"] {
  --page: #0a0606;
  --menu: #140c0c;
  --panel: #1b1010;
  --accent: #a01c24;
  --title: #e08a8a;
}

[data-theme="gold"] {
  --page: #0a0804;
  --menu: #14120c;
  --panel: #1b1810;
  --accent: #c4a35a;
  --title: #ead7a0;
  --on-accent: #1a1406;
}

[data-theme="ice"] {
  --page: #05080c;
  --menu: #0e141a;
  --panel: #141c24;
  --accent: #4a8fd4;
  --title: #9ec8f0;
}

[data-theme="venom"] {
  --page: #050a06;
  --menu: #0e1410;
  --panel: #141c16;
  --accent: #3d8b4a;
  --title: #9ed4a6;
}

[data-theme="violet"] {
  --page: #09060c;
  --menu: #140e18;
  --panel: #1a1420;
  --accent: #7b3fa0;
  --title: #c9a0e0;
}

[data-theme="halloween"] {
  --bg: #140c08;
  --page: #100806;
  --menu: #1c100c;
  --panel: #27160f;
  --child: #27160f;
  --line: #5a2a14;
  --line2: #8a4a22;
  --text: #f6ead8;
  --muted: #b18462;
  --hover: #ffd7b0;
  --accent: #ff7a18;
  --title: #ffc56a;
  --on-accent: #1a0a04;
}

/* ==========================================================================
   Tokens
   ========================================================================== */

:root {
  --font-ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: Bahnschrift, "Segoe UI Variable Display", "DIN Alternate", "Barlow Semi Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --font-mono: "Cascadia Code", "Cascadia Mono", Consolas, ui-monospace, "SF Mono", Menlo, monospace;

  --fs-sm: 12px;
  --fs-ui: 13.5px;
  --fs-body: 14.5px;
  --fs-title: 21px;

  --s1: var(--menu);
  --s2: var(--panel);
  --s3: color-mix(in srgb, var(--panel) 90%, var(--text));
  --input: color-mix(in srgb, var(--page) 60%, var(--menu));

  --fg: var(--text);
  --fg-2: color-mix(in srgb, var(--text) 70%, var(--panel));
  --fg-3: color-mix(in srgb, var(--text) 50%, var(--panel));

  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 60%, var(--line2));
  --accent-hi: color-mix(in srgb, var(--accent) 82%, #ffffff);
  --ring: color-mix(in srgb, var(--title) 80%, transparent);
  --on-accent: #ffffff;
  --row-hover: color-mix(in srgb, var(--text) 3%, transparent);

  --danger: #e57373;
  --danger-soft: color-mix(in srgb, #e57373 12%, transparent);
  --ok: #82c99d;
  --warn: #e2b862;

  --r-sm: 4px;
  --r: 6px;
  --pop: 0 14px 36px -10px rgba(0, 0, 0, 0.8);

  --max: 1180px;
  --topbar-h: 52px;
  --nav-h: 52px;
}

/* ==========================================================================
   Base
   ========================================================================== */

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

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--page);
  color-scheme: dark;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--page);
  color: var(--fg);
  font: 400 var(--fs-body)/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; }

::selection { background: color-mix(in srgb, var(--accent) 65%, transparent); color: #fff; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

* { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line2);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

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

.i {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.muted { color: var(--fg-3); font-size: var(--fs-ui); }
.hint { font-size: var(--fs-sm); color: var(--fg-3); }
.dot-sep { margin: 0 6px; color: var(--line2); }

.err,
.ok {
  margin-top: 8px;
  font-size: var(--fs-ui);
}
.err { color: var(--danger); }
.ok { color: var(--ok); }
.err:empty, .ok:empty { display: none; }

#err-file:not(:empty) {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  margin: 0;
  padding: 10px 16px;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: var(--s2);
  box-shadow: var(--pop);
  transform: translateX(-50%);
  animation: toast 4.8s ease forwards;
}

@keyframes toast {
  0% { opacity: 0; }
  5%, 88% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

/* ==========================================================================
   Shell
   ========================================================================== */

.app-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  background: var(--page);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--max);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand { display: inline-flex; align-items: center; gap: 7px; flex: none; }
.brand-mark { position: relative; top: -2px; width: 20px; height: 20px; }
.brand-word { font: 600 18px/1 var(--font-display); color: var(--fg); }
.brand-word b { font-weight: 600; color: var(--title); }

.primary-nav {
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: stretch;
  gap: 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.primary-nav::-webkit-scrollbar { display: none; }

.nav-link {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  padding-top: 3px;
  color: var(--fg-2);
  font: 500 12.5px/1 var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-link:hover { color: var(--fg); }
.nav-link.active { color: var(--fg); }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}
.nav-tool { margin-left: auto; }

.topbar-actions {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
}

.dl-top {
  appearance: none;
  border: 0;
  background: none;
  color: var(--fg-2);
  font-size: var(--fs-ui);
  cursor: pointer;
  white-space: nowrap;
}
.dl-top:hover { color: var(--fg); }
.dl-top:disabled { opacity: 0.6; cursor: progress; }
.dl-top.err { color: var(--danger); }
.ea-top.on { color: var(--title); }

.dl-main {
  height: 30px;
  padding: 0 12px 2px;
  border-radius: var(--r);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.dl-main:hover { background: var(--accent-hi); color: var(--on-accent); }

.bell {
  appearance: none;
  position: relative;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--r);
  background: none;
  color: var(--fg-2);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.bell:hover { color: var(--fg); background: var(--s2); }
.bell svg { margin-top: -2px; }
.bell-dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--title);
  box-shadow: 0 0 0 2px var(--page);
}

.bell-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(340px, calc(100vw - 24px));
  max-height: min(460px, 72vh);
  overflow: auto;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: var(--s2);
  box-shadow: var(--pop);
}
.bell-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--s2);
  font-size: var(--fs-ui);
}
.bell-head strong { font-weight: 600; }
.bell-head a { font-size: var(--fs-sm); color: var(--fg-3); }
.bell-head a:hover { color: var(--title); }
.bell-item {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-ui);
  line-height: 1.4;
  color: var(--fg-2);
}
.bell-item:first-child { border-top: 0; }
.bell-item:hover { background: var(--row-hover); }
.bell-item strong { color: var(--fg); font-weight: 600; }
.bell-item.unread::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 14px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--title);
}
.bell-text { min-width: 0; padding-right: 12px; }
.bell-text span { display: block; margin-top: 2px; font-size: var(--fs-sm); color: var(--fg-3); }
.bell-empty { padding: 20px 14px; color: var(--fg-3); font-size: var(--fs-ui); }

.user-slot { position: relative; display: flex; align-items: center; }
.user-slot:empty { display: none; }
.user-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px 0 2px;
  border: 0;
  border-radius: var(--r);
  background: none;
  color: var(--fg);
  cursor: pointer;
}
.user-btn:hover,
.user-btn[aria-expanded="true"] { background: var(--s2); }
.user-btn-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-ui);
  font-weight: 600;
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 220px;
  padding: 4px 0;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: var(--s2);
  box-shadow: var(--pop);
}
.user-menu-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu-name { font-size: var(--fs-ui); font-weight: 600; }
.user-menu-sub { font-size: var(--fs-sm); color: var(--fg-3); }
a.user-menu-sub:hover { color: var(--title); }
.menu-item {
  appearance: none;
  display: block;
  width: 100%;
  padding: 6px 12px;
  border: 0;
  background: none;
  color: var(--fg-2);
  font-size: var(--fs-ui);
  text-align: left;
  cursor: pointer;
}
.menu-item:hover,
.menu-item:focus-visible { background: var(--row-hover); color: var(--fg); outline: none; }
.menu-item.danger:hover { color: var(--danger); }
.menu-themes {
  display: flex;
  gap: 7px;
  margin: 4px 0;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.theme-dot {
  appearance: none;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.theme-dot:hover { transform: scale(1.15); }
.theme-dot.active { box-shadow: 0 0 0 2px var(--s2), 0 0 0 3px var(--fg); }

.subbar {
  position: relative;
  z-index: 1;
  border-bottom: 1px solid var(--line);
}
.subnav { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.subnav-links {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav-links::-webkit-scrollbar { display: none; }
.subtab {
  position: relative;
  flex: none;
  padding: 9px 0 11px;
  color: var(--fg-3);
  font-size: var(--fs-ui);
  white-space: nowrap;
}
.subtab:hover { color: var(--fg); }
.subtab.active { color: var(--fg); }
.subtab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--fg-3);
}

.page { position: relative; z-index: 1; flex: 1; width: 100%; }
.page-content { max-width: var(--max); margin: 0 auto; padding: 22px 24px 64px; }

/* ==========================================================================
   Page structure
   ========================================================================== */

.page-head { margin-bottom: 16px; }
.page-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
}
.page-head-row .page-title { flex: 1 1 200px; min-width: 0; padding-top: 3px; }
.page-head-row .page-title:has(.file-title) { padding-top: 0; }
.page-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
  font-size: var(--fs-sm);
  color: var(--fg-3);
}
.crumbs a:hover { color: var(--title); }
.crumb-sep { color: var(--line2); }

.kicker { display: none; }

.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 600 var(--fs-title)/1.25 var(--font-display);
  color: var(--fg);
  text-wrap: balance;
}
.page-desc {
  margin-top: 4px;
  font-size: var(--fs-ui);
  color: var(--fg-3);
}
.page-desc .who { vertical-align: baseline; }

.layout-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
.col-main,
.col-side { display: grid; gap: 22px; min-width: 0; }
.narrow { max-width: 760px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.section-title { font-size: var(--fs-body); font-weight: 600; }
.section-link { font-size: var(--fs-sm); color: var(--fg-3); }
.section-link:hover { color: var(--title); }
.section-hint { display: block; margin: -2px 0 10px; }
.sub-title { margin: 16px 0 8px; font-size: var(--fs-ui); font-weight: 600; }

.list {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s2);
  overflow: hidden;
}
.list > * + * { border-top: 1px solid var(--line); }

.list-head {
  display: grid;
  align-items: center;
  gap: 14px;
  padding: 7px 16px 9px;
  background: var(--s1);
  font-size: var(--fs-sm);
  color: var(--fg-3);
}

.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s2);
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 0;
}
.card-head h2 { font-size: var(--fs-body); font-weight: 600; }
.card-desc { margin-top: 2px; font-size: var(--fs-sm); color: var(--fg-3); }
.card-actions { display: flex; gap: 8px; }
.card-body { padding: 12px 16px 16px; }
.card > .card-body:first-child { padding-top: 16px; }

.tag,
.badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border: 1px solid var(--line2);
  border-radius: var(--r-sm);
  color: var(--fg-3);
  font: 600 10px/1 var(--font-ui);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}
.badge.staff { color: var(--title); border-color: var(--accent-line); }
.badge.mod { color: #e7bd79; border-color: rgba(196, 122, 42, 0.5); }
.badge.og { color: #2a1604; background: #e8b55a; border-color: #e8b55a; }
.badge.vip { color: #dcc173; border-color: rgba(201, 162, 39, 0.45); }
.badge.beta { color: #86c3dc; border-color: rgba(58, 122, 154, 0.55); }
.badge.tick-open { color: var(--title); border-color: var(--accent-line); }
.badge.tick-pending { color: #e3c27a; border-color: rgba(212, 179, 106, 0.45); }
.badge.tick-closed { color: var(--fg-3); }
.badge.cfg,
.badge.nade,
.badge.pin,
.badge.lock,
.badge.upd { color: var(--fg-3); }

.pill { font-size: var(--fs-sm); color: var(--fg-3); }
.status-off { font-size: var(--fs-sm); color: var(--danger); }

.notice {
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--fg-3);
  font-size: var(--fs-ui);
}

.empty,
.error-state {
  padding: 28px 16px;
  border: 1px dashed var(--line2);
  border-radius: var(--r);
  text-align: center;
}
.empty strong,
.error-state strong { display: block; font-weight: 600; }
.empty p,
.error-state p { margin-top: 4px; font-size: var(--fs-ui); color: var(--fg-3); }
.empty .btn,
.error-state .btn { margin-top: 12px; }
.card .empty { padding: 16px 0; border: 0; text-align: left; }
.empty-inline { padding: 8px 0; }

.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tool-links { display: flex; gap: 16px; }

/* ==========================================================================
   Buttons and controls
   ========================================================================== */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px 2px;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: var(--s3);
  color: var(--fg);
  font-size: var(--fs-ui);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { border-color: color-mix(in srgb, var(--line2) 60%, var(--text)); }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { border-color: var(--accent-hi); background: var(--accent-hi); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--s3); color: var(--fg); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: var(--danger-soft); }
.btn.on { color: var(--title); border-color: var(--accent-line); background: var(--accent-soft); }
.btn.sm { height: 30px; padding: 0 11px 2px; font-size: var(--fs-sm); }
.btn.lg { height: 40px; }
.btn.wide { width: 100%; }

.link-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg-3);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.link-btn:hover { color: var(--fg); }
.link-btn.danger:hover { color: var(--danger); }
.link-btn.on { color: var(--title); }
.link-btn:disabled { opacity: 0.6; cursor: default; }

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s1);
}
.seg-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px 2px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--fg-3);
  font-size: var(--fs-ui);
  cursor: pointer;
}
.seg-btn:hover { color: var(--fg); }
.seg-btn.active { background: var(--s3); color: var(--fg); }

.toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: none;
  color: var(--fg-2);
  font-size: var(--fs-ui);
  cursor: pointer;
}
.toggle:hover { color: var(--fg); }
.toggle-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line2); }
.toggle.on { color: var(--fg); border-color: var(--accent-line); background: var(--accent-soft); }
.toggle.on .toggle-dot { border-color: var(--title); background: var(--title); }

/* ==========================================================================
   Forms
   ========================================================================== */

.field { display: grid; align-content: start; gap: 6px; min-width: 0; margin-bottom: 14px; }
.field > label { font-size: var(--fs-ui); color: var(--fg-2); }

.field input,
.field select,
.field textarea,
.inline-form input,
.search-field input,
.shout-form input,
.composer textarea,
.dm-compose textarea,
.cfg-mini input,
.invite-card input {
  appearance: none;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: var(--input);
  color: var(--fg);
  font-size: var(--fs-body);
}

.field textarea,
.composer textarea,
.dm-compose textarea {
  height: auto;
  min-height: 110px;
  padding: 10px 12px;
  line-height: 1.55;
  resize: vertical;
}
.field textarea.tall { min-height: 240px; }

.field input:focus,
.field select:focus,
.field textarea:focus,
.inline-form input:focus,
.search-field input:focus,
.shout-form input:focus,
.composer textarea:focus,
.dm-compose textarea:focus,
.cfg-mini input:focus,
.invite-card input:focus {
  outline: none;
  border-color: var(--accent-line);
}

.field input:disabled,
.field input[readonly] { color: var(--fg-3); background: var(--s1); }

::placeholder { color: var(--fg-3); opacity: 0.85; }

.field select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6.5 9.5 12 15l5.5-5.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  cursor: pointer;
}

.field input[type="file"] { height: auto; padding: 6px; font-size: var(--fs-ui); color: var(--fg-2); cursor: pointer; }
.field input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 5px 10px;
  border: 1px solid var(--line2);
  border-radius: var(--r-sm);
  background: var(--s3);
  color: var(--fg);
  font: 600 var(--fs-sm)/1 var(--font-ui);
  cursor: pointer;
}

input.mono { font-family: var(--font-mono); }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

.form-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.form-foot > .err,
.form-foot > .ok,
.form-foot > .hint { margin: 0 auto 0 0; }

.sub-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }

.search-field { position: relative; max-width: 420px; margin-bottom: 14px; }
.search-field .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }
.search-field input { padding-left: 34px; }

.check-row { display: flex; flex-wrap: wrap; gap: 20px; }
.check-line { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-ui); cursor: pointer; }
.check-line input { position: relative; top: 1px; width: 15px; height: 15px; accent-color: var(--accent); }

.switch-line { position: relative; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch-line input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--line2);
  transition: background 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.switch-line input:checked + .switch { background: var(--accent); }
.switch-line input:checked + .switch::after { transform: translateX(14px); }
.switch-line input:focus-visible + .switch { outline: 2px solid var(--ring); outline-offset: 2px; }
.switch-line b { display: block; font-size: var(--fs-ui); font-weight: 600; }
.switch-line small { display: block; font-size: var(--fs-sm); color: var(--fg-3); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ==========================================================================
   People
   ========================================================================== */

.pfp {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: 22%;
  object-fit: cover;
  vertical-align: middle;
  background: color-mix(in srgb, var(--accent) 32%, var(--panel));
  color: var(--title);
  font: 600 13px/1 var(--font-ui);
  text-transform: uppercase;
}
img.pfp { background: var(--menu); }
.pfp.letter { padding-bottom: 0.1em; }
.pfp.tiny { width: 18px; height: 18px; font-size: 9px; }
.pfp.sm { width: 24px; height: 24px; font-size: 11px; }
.pfp.nav { width: 32px; height: 32px; font-size: 13px; }
.pfp.lg { width: 40px; height: 40px; font-size: 16px; }
.pfp.xl { width: 72px; height: 72px; font-size: 28px; }

.who { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; vertical-align: baseline; }
.nick { font-weight: 600; color: var(--fg); }
.userlink:hover .nick:not([style]) { color: var(--title); }
.person { display: inline-flex; }
.usertitle { font-size: var(--fs-sm); color: var(--title); }
.mention { color: var(--title); }
.mention:hover { text-decoration: underline; }

/* ==========================================================================
   Boards and threads
   ========================================================================== */

.col-main > section + section,
.col-main > .list + section { margin-top: 2px; }

.board-list .list-head { grid-template-columns: minmax(0, 1fr) 64px 260px; }
.board-list .list-head span:first-child { padding-left: 32px; }
.board-list .list-head span:nth-child(2) { text-align: center; }

.board {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 64px 260px;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
}
.board:hover { background: var(--row-hover); }
.board:hover .board-name { color: var(--title); }
.board-icon { display: inline-flex; color: var(--fg-3); }
.board-main { min-width: 0; }
.board-name { font-weight: 600; }
.board-desc { margin-left: 8px; font-size: var(--fs-ui); color: var(--fg-3); }
.board-stat { text-align: center; font-size: var(--fs-ui); color: var(--fg-2); }
.board-last { display: grid; min-width: 0; font-size: var(--fs-ui); }
.board-last-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }
.board-last-meta { font-size: var(--fs-sm); color: var(--fg-3); }

.thread-list .list-head { grid-template-columns: minmax(0, 1fr) 64px 150px; }
.thread-list .list-head span:first-child { padding-left: 46px; }
.thread-list .list-head span:nth-child(2) { text-align: center; }

.thread-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 64px 150px;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
}
.thread-row:hover { background: var(--row-hover); }
.thread-row:hover .thread-name { color: var(--title); }
.thread-main { min-width: 0; }
.thread-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.thread-name { font-weight: 600; line-height: 1.35; }
.thread-row.is-locked .thread-name { color: var(--fg-2); }
.row-flag { display: inline-flex; color: var(--fg-3); }
.row-flag .i { width: 14px; height: 14px; }
.row-flag.pin { color: var(--title); }
.thread-meta { margin-top: 2px; font-size: var(--fs-sm); color: var(--fg-3); }
.thread-meta .nick { font-weight: 400; color: var(--fg-2); }
.thread-board { color: var(--fg-2); }
.thread-stat { text-align: center; font-size: var(--fs-ui); color: var(--fg-2); }
.thread-last { display: grid; min-width: 0; font-size: var(--fs-sm); color: var(--fg-3); }
.thread-last-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }

.ticket-row { grid-template-columns: 32px minmax(0, 1fr) 64px 150px; }
.ticket-num { font: var(--fs-ui) var(--font-mono); color: var(--fg-3); }

/* ==========================================================================
   Shoutbox
   ========================================================================== */

.shout-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s2);
}
.shout-card > .section-head { margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.shout-log { display: grid; align-content: start; max-height: 420px; padding: 6px 0; overflow: auto; }
.shout-card.tall .shout-log { min-height: 360px; max-height: min(64vh, 640px); }
.shout { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 5px 14px; }
.shout:hover { background: var(--row-hover); }
.shout-main { min-width: 0; }
.shout-meta { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-sm); }
.shout-meta time { color: var(--fg-3); }
.shout-body { font-size: var(--fs-ui); line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.shout.roll .shout-body { color: var(--fg-2); font-family: var(--font-mono); font-size: var(--fs-sm); }
.shout-del { margin-left: auto; opacity: 0; }
.shout:hover .shout-del,
.shout-del:focus-visible { opacity: 1; }
.shout-empty { padding: 20px 14px; color: var(--fg-3); font-size: var(--fs-ui); }
.shout-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.shout-form input { flex: 1; min-width: 0; }

/* ==========================================================================
   Thread page
   ========================================================================== */

.posts {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s2);
  overflow: hidden;
}

.post {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.post + .post { border-top: 1px solid var(--line); }
.post:target { background: color-mix(in srgb, var(--accent) 6%, transparent); }

.post-author {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--menu) 60%, transparent);
}
.post-author-text { display: grid; gap: 4px; min-width: 0; }
.post-author .person > span { display: grid; gap: 3px; }

.post-main { display: flex; flex-direction: column; min-width: 0; }
.post-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 20px 0;
  font-size: var(--fs-sm);
  color: var(--fg-3);
}
.post-num { margin-left: auto; font-family: var(--font-mono); color: var(--fg-3); }
a.post-num:hover { color: var(--title); }
.op-tag { color: var(--fg-3); }

.post-body {
  flex: 1;
  padding: 6px 20px 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.like-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 0 20px 12px;
}
.like-who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-sm); color: var(--fg-3); }
.like-who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wolf { position: relative; top: 2px; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: 13px; line-height: 1; }
.like-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-left: auto; }

.tick-post.from-staff .post-author { background: color-mix(in srgb, var(--accent) 7%, var(--s1)); }

.attach {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s2);
}
.attach-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; }
.attach-info { flex: 1; min-width: 180px; display: grid; }
.attach-title { font-weight: 600; }
.attach-meta { font-size: var(--fs-sm); color: var(--fg-3); }
.attach-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.attach-body {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 16px;
  padding: 0 16px 16px;
}
.attach-body:has(> pre:only-child) { grid-template-columns: minmax(0, 1fr); }
.attach-label { margin-bottom: 6px; font-size: var(--fs-sm); color: var(--fg-3); }
.attach pre {
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--page);
  color: var(--fg-2);
  font: var(--fs-sm)/1.55 var(--font-mono);
  white-space: pre-wrap;
}
.attach-foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.attach-foot textarea { min-height: 72px; }

.cfg-log { display: grid; gap: 8px; }
.cfg-log article { font-size: var(--fs-ui); line-height: 1.45; color: var(--fg-2); }
.cfg-log strong { color: var(--fg); font-weight: 600; }

.composer { margin-top: 16px; display: grid; gap: 8px; }
.composer-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.composer .err { margin-top: 0; }
.composer.compact { margin: 0 0 12px; }
.composer.compact textarea { min-height: 72px; }

/* ==========================================================================
   Profile
   ========================================================================== */

.mh { margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.mh-banner { position: relative; height: 180px; overflow: hidden; margin-bottom: 16px; border-radius: var(--r); background: var(--s1); }
.mh-banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--bx, 50%) var(--by, 50%);
  transform: scale(var(--bz, 1));
  transform-origin: var(--bx, 50%) var(--by, 50%);
}
.mh-content { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.mh-main { flex: 1; min-width: 220px; display: grid; gap: 4px; }
.mh-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.profile-user { font: 600 var(--fs-title)/1.2 var(--font-display); color: var(--fg); }
.mh-stats { font-size: var(--fs-ui); color: var(--fg-3); }

.comments { margin-top: 4px; }
.comment { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.comment-main { min-width: 0; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: var(--fs-ui); }
.comment-meta time { font-size: var(--fs-sm); color: var(--fg-3); }
.comment-body { margin-top: 2px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.comment-actions { display: flex; gap: 14px; margin-top: 4px; }
.comment-actions:empty { display: none; }

/* ==========================================================================
   Settings
   ========================================================================== */

.settings { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 32px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar-h) + 20px); display: grid; gap: 2px; }
.settings-nav a { padding: 5px 0; color: var(--fg-3); font-size: var(--fs-ui); }
.settings-nav a:hover { color: var(--fg); }

.settings-body { display: grid; min-width: 0; max-width: 760px; }
.settings-body .card,
.settings-body .anchor-block .card {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.settings-body > .card:first-child { border-top: 0; }
.settings-body .card-head { padding: 18px 0 0; }
.settings-body > .card:first-child .card-head { padding-top: 0; }
.settings-body .card-body { padding: 12px 0 20px; }
.anchor-block { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.anchor-block .cfg-account { gap: 0; }

.avatar-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.avatar-edit-text { display: grid; justify-items: start; gap: 6px; }
.avatar-edit .btn input,
.banner-edit .btn input { display: none; }

.color-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.color-edit { padding: 12px; border: 1px solid var(--line); border-radius: var(--r); }
.color-edit > label { font-size: var(--fs-ui); color: var(--fg-2); }
.color-edit .row-actions { gap: 6px; }
.color-edit .row-actions .btn { height: 28px; padding: 0 10px 2px; font-size: var(--fs-sm); }
.color-edit .row-actions label { font-size: var(--fs-sm); color: var(--fg-3); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 24px; min-width: 24px; height: 24px; padding: 0; border: 1px solid var(--line2); border-radius: var(--r-sm); cursor: pointer; }
.swatch.active { outline: 2px solid var(--fg); outline-offset: 2px; }
input[type="color"] {
  width: 40px;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--line2);
  border-radius: var(--r-sm);
  background: var(--input);
  cursor: pointer;
}

.banner-edit { display: grid; gap: 12px; }
.banner-preview {
  display: grid;
  place-items: center;
  height: 180px;
  overflow: hidden;
  border: 1px dashed var(--line2);
  border-radius: var(--r);
  touch-action: none;
  user-select: none;
}
.banner-preview.on { cursor: grab; border-style: solid; }
.banner-preview.drag { cursor: grabbing; }
.banner-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--bx, 50%) var(--by, 50%);
  transform: scale(var(--bz, 1));
  transform-origin: var(--bx, 50%) var(--by, 50%);
  pointer-events: none;
}
.banner-none { color: var(--fg-3); font-size: var(--fs-ui); }
.banner-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.banner-zoom { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 180px; font-size: var(--fs-sm); color: var(--fg-3); }
.banner-zoom input { flex: 1; min-width: 0; accent-color: var(--accent); }

.cfg-account { display: grid; gap: 16px; }
.cfg-block { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.cfg-block:first-child { padding-top: 0; border-top: 0; }
.cfg-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--fs-ui); }
.cfg-row strong { font-weight: 600; }
.cfg-row .btn { height: 28px; padding: 0 10px 2px; font-size: var(--fs-sm); }
.cfg-mini { display: flex; gap: 8px; }
.cfg-mini input { flex: 1; min-width: 0; height: 32px; }
.cfg-mini .btn { height: 32px; }

/* ==========================================================================
   Lists: alerts, members, invites, admin tables, reports
   ========================================================================== */

.alert-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.alert-row:hover { background: var(--row-hover); }
.alert-text { flex: 1; min-width: 0; font-size: var(--fs-ui); color: var(--fg-2); }
.alert-text strong { color: var(--fg); font-weight: 600; }
.alert-text time { display: block; font-size: var(--fs-sm); color: var(--fg-3); }
.alert-row.unread .alert-text { color: var(--fg); }
.unread-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--title); }

.member-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 120px 70px;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
}
.member-card:hover { background: var(--row-hover); }
.member-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.member-who:hover .nick:not([style]) { color: var(--title); }
.member-text { display: grid; min-width: 0; }
.member-stat { font-size: var(--fs-sm); color: var(--fg-3); }
.member-card > .link-btn,
.member-card > .member-stat:last-child { justify-self: end; }

.table-head,
.table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px 110px 80px;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
}
.table-head { padding-top: 7px; padding-bottom: 9px; }
.table-head span:first-child { padding-left: 44px; }
#member-list > * + * { border-top: 1px solid var(--line); }
.table-row:hover { background: var(--row-hover); }
.table-row .member-who > span { display: grid; min-width: 0; }
.table-row .hint { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-num { font-size: var(--fs-ui); }
.cell-muted { font-size: var(--fs-sm); color: var(--fg-3); }

.invite-card {
  display: grid;
  grid-template-columns: 110px minmax(0, 150px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
}
.invite-card.spent { color: var(--fg-3); }
.invite-code { padding: 0; background: none; font-size: var(--fs-ui); color: var(--fg); }
.invite-card.spent .invite-code { color: var(--fg-3); }
.invite-status { font-size: var(--fs-sm); color: var(--fg-3); }
.invite-card input { height: 30px; font-size: var(--fs-sm); color: var(--fg-3); }
.invite-actions { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }

#ea-keys,
#ea-dls,
#ea-dl-hits { display: grid; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
#ea-keys > * + *,
#ea-dls > * + *,
#ea-dl-hits > * + * { border-top: 1px solid var(--line); }
#ea-dl-hits { margin-top: 12px; }
#ea-dl-hits:empty { display: none; }
#ea-keys .invite-card,
#ea-dls .invite-card,
#ea-dl-hits .invite-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: var(--fs-ui);
}
#ea-keys .invite-card label { display: none; }
#ea-keys > .muted,
#ea-dls > .muted,
#ea-dl-hits > .muted { padding: 10px 14px; }
.ea-wallet { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ea-wallet code { padding: 0; background: none; }
.invite-card .muted { font-size: var(--fs-sm); }

.admin-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.admin-col { display: grid; gap: 16px; min-width: 0; }

.file-title { display: inline-flex; align-items: center; gap: 12px; }
.file-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.file-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-ui);
  min-width: 0;
}
.file-row span { color: var(--fg-3); }
.file-row strong { font-weight: 400; text-align: right; word-break: break-word; }

.member-roles { display: flex; flex-wrap: wrap; gap: 8px; }

.action-list { display: grid; }
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.action-row:first-child { padding-top: 0; border-top: 0; }
.action-row:last-child { padding-bottom: 0; }
.action-row b { display: block; font-size: var(--fs-ui); font-weight: 600; }
.action-row span { display: block; font-size: var(--fs-sm); color: var(--fg-3); }
.danger-card { border-color: color-mix(in srgb, var(--danger) 28%, var(--line)); }
.danger-card .card-head h2 { color: var(--danger); }

.report { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 12px 16px; }
.report-meta { font-size: var(--fs-sm); color: var(--fg-3); }
.report-kind { color: var(--danger); }
.report-reason { margin-top: 2px; }
.report-actions { display: flex; align-items: center; gap: 14px; }

.prose { max-width: 66ch; }
.prose ul { margin: 0 0 14px 18px; display: grid; gap: 4px; }
.prose p { margin-bottom: 10px; color: var(--fg-2); }
.prose a { color: var(--title); text-decoration: underline; text-underline-offset: 3px; }
.plain-list { list-style: none; display: grid; gap: 6px; font-size: var(--fs-ui); color: var(--fg-2); }

/* ==========================================================================
   Messages
   ========================================================================== */

.page-content.dm-page { padding-bottom: 20px; }

.dm-app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h) - 110px);
  height: calc(100dvh - var(--topbar-h) - 110px);
  min-height: 440px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s2);
}
.dm-nav { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--s1); }
.dm-nav-top { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dm-nav-top h1 { font-size: var(--fs-body); font-weight: 600; }
.dm-people { flex: 1; display: grid; align-content: start; min-height: 0; overflow: auto; }
.dm-person { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.dm-person > div { min-width: 0; }
.dm-person:hover { background: var(--row-hover); }
.dm-person.active { background: var(--s2); box-shadow: inset 2px 0 0 var(--accent); }
.dm-person .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.dm-none { padding: 18px 14px; font-size: var(--fs-ui); color: var(--fg-3); }

.dm-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.dm-chat-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: var(--fs-ui); }
.dm-chat-top .link-btn { margin-left: auto; }
.dm-log { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 12px 8px; overflow: auto; }
.dm-line { display: flex; align-items: flex-start; gap: 12px; padding: 5px 8px; }
.dm-line.grouped { padding-top: 0; padding-left: 52px; }
.dm-line-meta { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-ui); }
.dm-line-meta .muted { font-size: var(--fs-sm); }
.dm-line-body { line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.dm-compose { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.dm-compose .field { flex: 1 1 100%; margin: 0; }
.dm-compose textarea { flex: 1; min-width: 0; height: 38px; min-height: 38px; max-height: 160px; padding-top: 8px; resize: none; }
.dm-compose .btn { height: 38px; }
.dm-compose .err { flex: 1 1 100%; margin: 0; }
#new-dm { border-top: 0; }
.dm-empty { flex: 1; display: grid; place-items: center; padding: 24px; }
.dm-empty .empty { border: 0; }

/* ==========================================================================
   Login / register
   ========================================================================== */

.app-shell.gate-mode .primary-nav { display: none; }
.app-shell.gate-mode .page-content {
  display: grid;
  justify-items: center;
  align-content: start;
  padding-top: 12vh;
}
.gate { width: min(380px, 100%); }
.gate-card {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s2);
}
.gate-card .seg { display: flex; }
.gate-card .seg-btn { flex: 1; }
.gate-form { display: grid; }
.gate-form .btn + .btn { margin-top: 8px; }
.gate-title { font: 600 var(--fs-title)/1.2 var(--font-display); }
.gate-sub { margin-top: -10px; font-size: var(--fs-ui); color: var(--fg-3); }
.gate-link { display: block; margin-top: 14px; text-align: center; font-size: var(--fs-sm); color: var(--fg-3); }
.gate-link:hover { color: var(--title); }
.invite-note,
.code-hint { margin-bottom: 12px; font-size: var(--fs-ui); color: var(--fg-2); }
.invite-note { color: var(--title); }
.field input.code-input { height: 44px; font: 600 20px/1 var(--font-mono); letter-spacing: 0.4em; text-align: center; }

/* ==========================================================================
   Mention picker
   ========================================================================== */

.mention-box {
  position: absolute;
  z-index: 70;
  min-width: 200px;
  max-height: 260px;
  padding: 4px 0;
  overflow: auto;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: var(--s2);
  box-shadow: var(--pop);
}
.mention-box button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--fg);
  font-size: var(--fs-ui);
  text-align: left;
  cursor: pointer;
}
.mention-box button:hover,
.mention-box button.on { background: var(--row-hover); }

/* ==========================================================================
   Halloween theme decorations
   ========================================================================== */

.hw-sky { display: none; }

[data-theme="halloween"] .hw-sky {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 86% 12%, rgba(255, 186, 92, 0.14), transparent 18%),
    radial-gradient(circle at 8% 110%, rgba(90, 16, 4, 0.3), transparent 36%);
}

.hw-moon {
  position: absolute;
  right: 9%;
  top: 12%;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, #fff1c8, #f0a040 58%, #c45a12);
}
.hw-moon::after {
  content: "";
  position: absolute;
  right: -22px;
  top: 6px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #100806;
}

.pixel-bat { display: none; }

[data-theme="halloween"] .pixel-bat {
  display: block;
  position: fixed;
  left: -50px;
  top: 20%;
  z-index: 8;
  width: 4px;
  height: 4px;
  zoom: 3;
  pointer-events: none;
  background: #17131f;
  box-shadow:
    -4px 0 #ff5a4f, 4px 0 #ff5a4f,
    -16px -4px #17131f, -12px -4px #17131f, -8px -4px #17131f,
    -16px 0 #17131f, -12px 0 #17131f, -8px 0 #17131f,
    -12px 4px #17131f, -8px 4px #17131f,
    -4px 0 #17131f, 0 0 #17131f, 4px 0 #17131f,
    -4px 4px #17131f, 0 4px #17131f, 4px 4px #17131f, 0 8px #17131f,
    -4px -4px #17131f, 4px -4px #17131f,
    8px -4px #17131f, 12px -4px #17131f, 16px -4px #17131f,
    8px 0 #17131f, 12px 0 #17131f, 16px 0 #17131f,
    8px 4px #17131f, 12px 4px #17131f;
  image-rendering: pixelated;
  animation: bat-fly 11s linear infinite, bat-bob 0.7s ease-in-out infinite alternate;
}
[data-theme="halloween"] .pixel-bat.b2 { top: 8%; animation-duration: 15s, 0.8s; animation-delay: -4s, -0.2s; }
[data-theme="halloween"] .pixel-bat.b3 { top: 34%; animation-duration: 13s, 0.62s; animation-delay: -8s, -0.4s; }
[data-theme="halloween"] .pixel-bat.b4 { top: 14%; animation-duration: 17s, 0.9s; animation-delay: -2s, -0.1s; }

@keyframes bat-fly {
  from { left: -60px; }
  to { left: calc(100vw + 60px); }
}

@keyframes bat-bob {
  from { transform: translateY(-7px); }
  to { transform: translateY(7px); }
}

/* ==========================================================================
   Casino
   ========================================================================== */

.game-list .game-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: inherit;
}
.game-row:hover { background: var(--row-hover); }
.game-row b { display: block; font-weight: 600; color: var(--title); }
.game-row .hint { display: block; margin-top: 2px; }
.game-row.is-off b,
.game-row.is-off .hint,
.game-row.is-off .cell-muted { color: var(--fg-3); }

.hist-list .hist-head,
.hist-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 88px 88px;
  gap: 12px;
  align-items: center;
}
.hist-row { padding: 10px 16px; font-size: var(--fs-ui); }
.hist-row b { font-weight: 600; }
.hist-row .hint { display: block; margin-top: 1px; }
.hist-net { text-align: right; font-variant-numeric: tabular-nums; }
.hist-net.up { color: var(--title); }
.hist-net.down { color: var(--fg-3); }
.hist-row .cell-num { text-align: right; }

.cas {
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(280px, 0.85fr);
  gap: 16px;
}

.cas-stage,
.cas-side {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.cas-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 480px;
  padding: 20px;
  background: var(--s1);
}

.cas-side { padding: 16px 18px 20px; background: var(--s2); }
.cas-side h1 { margin: 0 0 4px; font: 600 var(--fs-title)/1.2 var(--font-display); }
.cas-side p.muted { line-height: 1.55; }

.crumb { margin-bottom: 4px; font-size: var(--fs-sm); color: var(--fg-3); }
.crumb a:hover { color: var(--title); }

.cas-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s1);
}
.cas-bar span { font-size: var(--fs-sm); color: var(--fg-3); }
.cas-bar b { font: 600 18px/1 var(--font-display); color: var(--title); }
.page-head-actions .cas-bar { margin: 0; padding: 6px 10px; }

.cas-bets,
.cas-outs,
.cas-hands { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.cas-bets .btn,
.cas-outs .btn { height: 30px; padding: 0 10px 2px; font-size: var(--fs-sm); }
.cas-bets .btn.on,
.cas-outs .btn.on,
.cas-num.on { color: var(--title); border-color: var(--accent-line); background: var(--accent-soft); }
.cas-bet-wrap { display: inline-flex; align-items: center; }
.cas-bet-in {
  width: 92px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s1);
  color: var(--text);
  font: var(--fs-sm)/1 var(--font);
}

.cas-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 14px; }
.cas-legend span {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
}

.cas-sym {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  color: var(--text);
  font: 600 16px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cas-sym.paw,
.cas-sym.fang { color: var(--fg-3); }
.cas-sym.bone,
.cas-sym.moon { color: var(--text); }
.cas-sym.wolf { color: var(--title); }
.cas-sym.alpha { color: var(--accent-hi); }

.cas-result { min-height: 22px; margin-top: 8px; font-weight: 600; color: var(--title); }

.cas-pay { width: 100%; margin-top: 16px; border-collapse: collapse; font-size: var(--fs-sm); }
.cas-pay th,
.cas-pay td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); text-align: left; }
.cas-pay th { font-weight: 400; color: var(--fg-3); }

.cas-felt { justify-content: space-evenly; background: color-mix(in srgb, #1d6b3a 14%, var(--s1)); }
.cas-hands { width: 100%; align-items: flex-end; justify-content: space-between; }
.cas-seat { min-width: 180px; padding: 8px; border-radius: var(--r); }
.cas-seat.on { box-shadow: inset 0 0 0 1px var(--accent-line); }
.cas-wait { font-size: var(--fs-ui); color: var(--fg-3); }

.cas-mission-list { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.cas-mission {
  position: relative;
  width: min(100%, 520px);
  padding: 12px 14px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s2);
}
.cas-mission div { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 12px; }
.cas-mission b { font-weight: 600; }
.cas-mission span,
.cas-mission em { position: relative; z-index: 1; color: var(--fg-3); font-style: normal; }
.cas-mission em { display: block; margin-top: 4px; font-size: var(--fs-ui); }
.cas-mission i { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); }
.cas-mission.done { border-color: var(--accent-line); }
.cas-mission.done b { color: var(--title); }

.cas-card {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  width: 72px;
  height: 100px;
  margin: 8px 8px 0 0;
  padding: 8px;
  border-radius: var(--r-sm);
  background: #f4f1ea;
  color: #1a1a1a;
  font-family: Georgia, serif;
}
.cas-card b { font-size: 20px; }
.cas-card i { align-self: flex-end; font-size: 18px; font-style: normal; }
.cas-card.red { color: #a32020; }
.cas-card.back {
  background: repeating-linear-gradient(45deg, var(--menu) 0 5px, color-mix(in srgb, var(--accent) 70%, var(--menu)) 5px 10px);
}

.cas-nums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 4px;
  width: 100%;
  margin: 10px 0;
}
.rou-board {
  display: grid;
  grid-template-columns: 40px repeat(12, minmax(22px, 1fr));
  grid-template-rows: repeat(3, 32px);
  grid-auto-flow: column;
  gap: 3px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
.cas-num {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--s1);
  color: var(--text);
  cursor: pointer;
  font-size: var(--fs-sm);
}
.cas-num.red { background: #7a1820; color: #fff; border-color: transparent; }
.cas-num.green {
  grid-row: 1 / span 3;
  height: auto;
  background: #1d6b3a;
  color: #fff;
  border-color: transparent;
}
.cas-num.on { outline: 2px solid var(--title); outline-offset: -1px; }
.cas-spot {
  margin-top: 14px;
  font: 600 22px/1 var(--font-display);
  color: var(--title);
  text-align: center;
}
.cas-spot.red { color: #c4472a; }
.cas-spot.green { color: #3d8a48; }
.cas-limit { margin-bottom: 8px; }
.cas-limit span { min-width: 72px; color: var(--fg-3); font-size: var(--fs-sm); }
.cas-limit input { width: 110px; }

.plinko { position: relative; overflow: hidden; border-radius: var(--r); background: var(--page); }
.plinko-peg {
  position: absolute;
  z-index: 1;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #c8c8c8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.plinko-ball {
  position: absolute;
  z-index: 3;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid #b5b5b5;
  background: #f2f2f2;
  pointer-events: none;
}
.plinko-slot {
  position: absolute;
  z-index: 2;
  width: 30px;
  height: 22px;
  margin-left: -15px;
  border-radius: 3px;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.plinko-slot.on { outline: 2px solid #fff; }

.whl-wrap { position: relative; width: min(100%, 440px); margin: 0; aspect-ratio: 1; --rim: 158px; }
.spin-whl { width: min(100%, 460px); --rim: 166px; }
.rou-whl { width: min(100%, 420px); --rim: 150px; }

.whl {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 6px solid var(--line2);
}
.whl-n {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  margin: -9px 0 0 -36px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}
.whl-n.tiny { width: 24px; margin-left: -12px; font-size: 11px; }
.whl-pointer {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: -2px;
  margin-left: -9px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 18px solid var(--title);
}
.whl-hub {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  border: 1px solid var(--line2);
  background: var(--menu);
  pointer-events: none;
}

.cas-machine {
  display: flex;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 560px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s2);
}
.reel-win {
  position: relative;
  flex: 1;
  height: 128px;
  overflow: hidden;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--menu);
}
.reel-win::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent 28%, transparent 72%, rgba(0, 0, 0, 0.4));
  pointer-events: none;
}
.reel-strip .cas-sym {
  width: 100%;
  min-width: 0;
  height: 128px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: 16px;
}

.cas-fan { min-height: 112px; perspective: 600px; }
.cas-card.deal { animation: cas-deal 0.45s ease both; }

@keyframes cas-deal {
  from { transform: translateY(-40px) rotateY(-80deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}
/* ==========================================================================
   Advent calendar
   ========================================================================== */

.advent-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 18px;
}
.advent-door {
  position: relative;
  display: grid;
  place-items: center;
  gap: 4px;
  aspect-ratio: 1;
  padding: 8px 4px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s1);
  color: var(--fg-3);
  font: 600 18px/1 var(--font-display);
}
.advent-door small {
  font: 600 10px/1 var(--font-ui);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.advent-door.upcoming { cursor: default; }
.advent-door.available {
  color: var(--title);
  border-color: var(--accent-line);
  background: color-mix(in srgb, var(--accent) 10%, var(--s1));
  cursor: pointer;
}
.advent-door.available:hover { background: color-mix(in srgb, var(--accent) 16%, var(--s1)); }
.advent-door.claimed { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.advent-door.missed { opacity: 0.42; cursor: default; }
.advent-door.open { animation: advent-open 0.32s ease; }
.advent-mark {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--title);
}
@keyframes advent-open {
  from { transform: rotateY(-16deg) scale(0.97); opacity: 0.55; }
  to { transform: none; opacity: 1; }
}
.advent-toast {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r);
  background: var(--s2);
}
.advent-toast.reveal { animation: advent-open 0.28s ease; }
.advent-toast strong { display: block; font: 600 var(--fs-title)/1.2 var(--font-display); }
.advent-toast p { margin-top: 4px; color: var(--fg-2); }
.advent-banner {
  margin: -8px 0 14px;
  font-size: var(--fs-sm);
  color: var(--title);
}
.advent-admin-days { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.advent-admin-days th,
.advent-admin-days td { padding: 6px 4px; text-align: left; border-bottom: 1px solid var(--line); }
.advent-admin-days input,
.advent-admin-days select { width: 100%; }
.wardrobe-slot { margin-bottom: 10px; }
.wardrobe-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.pfp-frame {
  flex: none;
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  padding: 2px;
  border-radius: 26%;
  line-height: 0;
  vertical-align: middle;
}
.pfp-frame.tiny { width: 18px; height: 18px; padding: 1px; }
.pfp-frame.sm { width: 24px; height: 24px; padding: 2px; }
.pfp-frame.nav { width: 32px; height: 32px; }
.pfp-frame.lg { width: 40px; height: 40px; padding: 3px; }
.pfp-frame.xl { width: 72px; height: 72px; padding: 4px; }
.pfp-frame > .pfp { width: 100%; height: 100%; border-radius: 18%; }
.pfp-frame.advent-frame-wreath {
  background:
    repeating-conic-gradient(
      from 8deg,
      #2a5530 0 20deg,
      #9a2f2f 20deg 26deg,
      #2a5530 26deg 48deg,
      #c4a056 48deg 52deg
    );
  box-shadow: inset 0 0 0 1px #16321c;
}
.pfp-frame.advent-frame-wreath > .pfp {
  box-shadow: 0 0 0 1px #1a331c;
}

.nick.name-frost,
.profile-user.name-frost {
  text-shadow: 0 0 8px rgba(130, 198, 255, 0.55), 0 1px 0 rgba(210, 236, 255, 0.3);
}
.nick.name-frost:not([style]),
.profile-user.name-frost:not([style]) {
  color: #d7eeff;
}

.badge.advent-ember {
  color: #2a1206;
  background: #e08a3c;
  border-color: #c56e28;
}

.mh.advent-bg-night {
  position: relative;
  margin-bottom: 20px;
  padding: 28px 12px 12px;
  border: 1px solid color-mix(in srgb, #c4a056 30%, var(--line));
  border-radius: calc(var(--r) + 2px);
  overflow: hidden;
  background:
    radial-gradient(1.5px 1.5px at 8% 18%, rgba(255, 248, 220, 0.85), transparent 2px),
    radial-gradient(1px 1px at 22% 10%, rgba(255, 255, 255, 0.7), transparent 1.5px),
    radial-gradient(1.5px 1.5px at 71% 14%, rgba(255, 248, 220, 0.65), transparent 2px),
    radial-gradient(1px 1px at 91% 28%, rgba(220, 235, 255, 0.6), transparent 1.5px),
    radial-gradient(1px 1px at 38% 8%, rgba(255, 255, 255, 0.45), transparent 1.5px),
    radial-gradient(90px 50px at 96% 0%, rgba(244, 212, 140, 0.14), transparent 70%),
    linear-gradient(180deg, #0a1224 0%, #141c32 55%, #1a1824 100%);
}
.mh.advent-bg-night::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, #f6ead0, #d8c48a 58%, transparent 72%);
  box-shadow: 0 0 18px rgba(244, 228, 193, 0.14);
  pointer-events: none;
}
.mh.advent-bg-night .mh-banner {
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
}
.mh.advent-bg-night .mh-content {
  position: relative;
  z-index: 1;
  padding: 10px 12px;
  border-radius: var(--r);
  background: color-mix(in srgb, var(--page) 90%, #0a1224);
}


/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1080px) {
  .layout-split { grid-template-columns: minmax(0, 1fr) 280px; }
  .board-list .list-head { grid-template-columns: minmax(0, 1fr) 64px 200px; }
  .board { grid-template-columns: 18px minmax(0, 1fr) 64px 200px; align-items: start; }
  .board-desc { display: block; margin-left: 0; }
  .board-icon { margin-top: 3px; }
  .board-stat { line-height: 22px; }
  .topbar-inner { gap: 20px; }
}

@media (max-width: 920px) {
  .layout-split,
  .admin-grid,
  .settings { grid-template-columns: minmax(0, 1fr); }
  .col-side { order: 2; }

  .settings-nav {
    position: static;
    display: flex;
    gap: 18px;
    overflow-x: auto;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav a { flex: none; white-space: nowrap; }
  .settings-body > .card:first-child .card-head { padding-top: 12px; }

  .cas { grid-template-columns: minmax(0, 1fr); }
  .cas-stage { min-height: 280px; }
  .whl-wrap,
  .spin-whl,
  .rou-whl { --rim: 118px; width: min(100%, 320px); }
  .hist-list .hist-head { display: none; }
  .hist-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }
  .hist-row .cell-muted { grid-column: 1; }
  .hist-row .cell-num { display: none; }
  .rou-board { overflow-x: auto; min-width: 0; }

  .thread-list .list-head span:last-child { display: none; }
  .thread-row,
  .ticket-row { grid-template-columns: 32px minmax(0, 1fr) 48px; }
  .thread-last { display: none; }
  .thread-list .list-head { grid-template-columns: minmax(0, 1fr) 48px; }
}

@media (max-width: 720px) {
  .advent-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  :root { --topbar-h: 92px; --nav-h: 42px; }

  .topbar { height: auto; }
  .topbar-inner { flex-wrap: wrap; gap: 0 12px; height: auto; padding: 0 14px; }
  .brand { height: 48px; }
  .topbar-actions { margin-left: auto; gap: 10px; }
  .primary-nav {
    order: 3;
    flex: 1 0 100%;
    height: var(--nav-h);
    margin: 0 -14px;
    padding: 0 14px;
    border-top: 1px solid var(--line);
  }
  .nav-tool { margin-left: 0; }
  .user-btn-name { display: none; }
  .ea-top { display: none; }
  .user-menu,
  .bell-panel { position: fixed; top: 50px; right: 10px; }

  .subnav { padding: 0 14px; }

  .page-content { padding: 16px 14px 64px; }

  .board-list .list-head { display: none; }
  .board { grid-template-columns: 18px minmax(0, 1fr) auto; padding: 11px 14px; }
  .board-last { grid-column: 2 / -1; }
  .board-stat { font-size: var(--fs-sm); line-height: 24.5px; color: var(--fg-3); }

  .thread-row,
  .ticket-row { padding: 10px 14px; gap: 12px; }
  .thread-list .list-head { gap: 12px; padding-left: 14px; padding-right: 14px; }
  .thread-list .list-head span:first-child { padding-left: 44px; }

  .post { grid-template-columns: minmax(0, 1fr); }
  .post-author {
    flex-direction: row;
    align-items: center;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .post-author .pfp.lg,
  .post-author .pfp-frame.lg { width: 32px; height: 32px; font-size: 13px; }
  .post-author-text { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .post-author .person > span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .post-meta { padding: 10px 14px 0; }
  .post-body { padding: 4px 14px 12px; }
  .like-bar { padding: 0 14px 12px; }
  .like-actions { margin-left: 0; }

  .attach-body { grid-template-columns: minmax(0, 1fr); }

  .field-grid,
  .color-grid,
  .file-grid { grid-template-columns: minmax(0, 1fr); }

  .mh-banner { height: 120px; }

  .member-card { grid-template-columns: minmax(0, 1fr) auto; }
  .member-card > .member-stat:nth-of-type(1),
  .member-card > .member-stat:nth-of-type(2) { display: none; }

  .table-head { display: none; }
  .table-row { grid-template-columns: minmax(0, 1fr) auto; }
  .table-row [data-label="posts"],
  .table-row [data-label="last seen"] { display: none; }

  .invite-card { grid-template-columns: minmax(0, 1fr) auto; }
  .invite-card input { grid-column: 1 / -1; grid-row: 3; }
  .invite-status { grid-column: 1; }

  .report { grid-template-columns: minmax(0, 1fr); gap: 8px; }

  .action-row { flex-direction: column; align-items: flex-start; gap: 8px; }

  .dm-app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100dvh - var(--topbar-h) - 90px);
  }
  .dm-nav { border-right: 0; border-bottom: 1px solid var(--line); }
  .dm-people { max-height: 120px; }

  .app-shell.gate-mode { --topbar-h: 49px; }
  .app-shell.gate-mode .page-content { padding-top: 8vh; }

  .field input,
  .field select,
  .field textarea,
  .inline-form input,
  .search-field input,
  .shout-form input,
  .composer textarea,
  .dm-compose textarea { font-size: 16px; }
}


@media (hover: none) {
  .shout-del { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .plinko-ball {
    transition-duration: 90ms !important;
  }
}
