/* nyanity — terminal-cute redesign, derived from the in-game menu.
   monospace everywhere, thin borders, muted pink accent, subtle motion. */
:root {
  color-scheme: dark;
  --bg: #0b070a;
  --bg-2: #100a0f;
  --panel: #150e14;
  --panel-2: #1b121a;
  --field: #0d080c;
  --line: #2b1d28;
  --line-2: #453042;
  --text: #ece0e8;
  --muted: #9c8494;
  --faint: #66545f;
  --accent: #d98cae;
  --accent-dim: #a95b86;
  --accent-glow: rgba(217, 140, 174, .14);
  --ok: #7ddc9a;
  --danger: #e97979;
  --radius: 6px;
  /* JetBrains Mono stays first for anyone who has it installed locally; no
     webfont is fetched, so there is no render-blocking third-party request. */
  --mono: ui-monospace, 'JetBrains Mono', 'Cascadia Code', Menlo, Consolas, 'Liberation Mono', monospace;
  --gutter: 28px;
  --pad-top: 40px;
  --tabbar-h: 52px;
}
@media (max-width: 720px) {
  :root { --gutter: 16px; --pad-top: 24px; }
}

/* ---------- global search strip ---------- */
.global-search-toggle {
  appearance: none; width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  color: var(--muted); background: transparent; border: 1px solid transparent;
  border-radius: var(--radius); font: 20px/1 var(--mono); cursor: pointer;
}
.global-search-toggle:hover { color: var(--text); background: var(--panel-2); border-color: var(--line-2); }
.global-searchbar {
  position: fixed; z-index: 39; top: calc(var(--tabbar-h) + env(safe-area-inset-top, 0px));
  left: 0; right: 0; min-height: 50px; display: flex; align-items: center; gap: 10px;
  padding: 7px max(18px, calc((100vw - 1200px) / 2));
  background: rgba(13,8,12,.97); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.global-searchbar[hidden] { display: none; }
.global-searchbar > span { color: var(--accent); font-size: 12px; white-space: nowrap; }
.global-searchbar input { flex: 1; min-width: 0; padding-block: 7px; }
.global-search-close { appearance: none; border: 0; background: transparent; color: var(--muted); font: 20px var(--mono); cursor: pointer; }
body.search-open { padding-top: calc(var(--tabbar-h) + 50px + env(safe-area-inset-top, 0px)); }

/* ---------- global timed banners ---------- */
.site-banners { display: grid; gap: 8px; margin: 26px 0 4px; }
.site-banner {
  min-width: 0; display: grid; grid-template-columns: auto minmax(0,1fr) auto auto;
  align-items: center; gap: 12px; padding: 10px 12px;
  color: var(--text); background: linear-gradient(90deg, rgba(217,140,174,.12), var(--panel));
  border: 1px solid rgba(217,140,174,.32); border-radius: var(--radius);
}
.site-banner-mark { width: 22px; height: 22px; display: grid; place-items: center; color: var(--field); background: var(--accent); border-radius: 50%; font-weight: 700; }
.site-banner p { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.site-banner-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.site-banner-time b { color: var(--accent); font-weight: 500; }
.site-banner > button { appearance: none; border: 0; background: transparent; color: var(--faint); font: 18px var(--mono); cursor: pointer; }
.site-banner > button:hover { color: var(--text); }

/* ---------- staff panel ---------- */
.staff-tabs { display: flex; gap: 5px; margin: -2px 0 18px; padding-bottom: 8px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.staff-tabs a { padding: 7px 13px; color: var(--muted); border: 1px solid transparent; border-radius: var(--radius); }
.staff-tabs a:hover, .staff-tabs a.active { color: var(--text); background: var(--panel-2); border-color: var(--line-2); }
.permission-roles { display: grid; grid-template-columns: repeat(5,minmax(150px,1fr)); gap: 9px; }
.permission-role { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--field); overflow: hidden; }
.permission-role header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px; border-bottom: 1px solid var(--line); }
.permission-role header .btn { padding: 4px 8px; font-size: 10px; }
.permission-role > div { display: grid; gap: 7px; padding: 9px; }
.permission-role label, .category-permissions label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.permission-role input, .category-permissions input { width: auto; }
.category-permissions { display: grid; gap: 9px; }
.category-permissions > form { display: grid; grid-template-columns: minmax(220px,1fr) 2fr auto; align-items: center; gap: 15px; padding: 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--field); }
.category-permissions small { display: block; color: var(--faint); }
.category-permissions fieldset { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; border: 0; }
.member-filters { display: grid; grid-template-columns: minmax(220px,1fr) 210px auto; align-items: center; gap: 8px; margin-bottom: 12px; }
.member-filters input, .member-filters select { padding-block: 7px; }
.member-filters > span { color: var(--faint); font-size: 10px; white-space: nowrap; }
.member-filters > span b { color: var(--text); }
.member-list-head { display: grid; grid-template-columns: minmax(160px,1fr) 100px 110px 100px 90px; gap: 10px; padding: 0 12px 5px 36px; color: var(--faint); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.staff-users { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--field); }
.staff-user { background: var(--field); }
.staff-user + .staff-user { border-top: 1px solid var(--line); }
.staff-user-summary { display: grid; grid-template-columns: 14px minmax(160px,1fr) 100px 110px 100px 90px; align-items: center; gap: 10px; min-width: 0; padding: 8px 12px; cursor: pointer; list-style: none; }
.staff-user-summary::-webkit-details-marker { display: none; }
.staff-user-summary:hover { background: var(--panel-2); }
.staff-user[open] > .staff-user-summary { background: var(--panel-2); border-bottom: 1px solid var(--line); }
.staff-user-arrow { color: var(--accent); font-size: 16px; transition: transform .12s ease; }
.staff-user[open] .staff-user-arrow { transform: rotate(90deg); }
.member-name { min-width: 0; display: flex; align-items: baseline; gap: 7px; }
.member-name strong { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.member-name small, .staff-user-summary time { color: var(--faint); font-size: 9px; white-space: nowrap; }
.member-membership, .member-state { color: var(--muted); font-size: 10px; }
.member-state.moderated { color: var(--danger); }
.staff-user-summary[hidden], .staff-user[hidden] { display: none; }
.staff-user-grid { display: grid; grid-template-columns: 1fr 1.25fr; }
.staff-user-grid > section { min-width: 0; padding: 14px; }
.staff-user-grid > section + section { border-left: 1px solid var(--line); }
.staff-user h3, .wave-form + h3 { margin: 0 0 10px; color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.staff-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.staff-detail-head a { font-size: 10px; }
.inline-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.staff-form { display: grid; gap: 9px; margin-top: 12px; }
.staff-form label, .wave-form label, .voucher-single label, .banner-form label {
  display: grid; gap: 5px; color: var(--muted); font-size: 11px;
}
.duration { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.duration label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.checkline { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px !important; }
.checkline input { width: auto; }
.membership-now { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.membership-now b { color: var(--accent); }
.countdown { color: var(--accent); }
.sanction-list { display: flex; flex-wrap: wrap; gap: 7px; }
.sanction-list form { display: inline-flex; align-items: stretch; }
.sanction-chip { padding: 5px 8px; color: var(--danger); border: 1px solid rgba(233,121,121,.3); border-radius: 4px 0 0 4px; font-size: 10px; }
.sanction-list form button { appearance: none; color: var(--muted); background: var(--panel-2); border: 1px solid rgba(233,121,121,.3); border-left: 0; border-radius: 0 4px 4px 0; font: 10px var(--mono); cursor: pointer; }
.muted { color: var(--faint); }
.voucher-single { display: grid; grid-template-columns: minmax(240px,1fr) 220px auto; gap: 9px; align-items: end; }
.panel-body > hr { height: 1px; margin: 20px 0; border: 0; background: var(--line); }
.wave-form { display: grid; grid-template-columns: repeat(4,minmax(130px,1fr)); gap: 10px; align-items: end; }
.voucher-admin-list, .voucher-inbox, .banner-admin-list { display: grid; gap: 10px; }
.voucher-admin, .voucher-card, .banner-admin { padding: 12px; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.voucher-admin > header, .voucher-card > header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.voucher-admin > header time { margin-left: auto; color: var(--faint); font-size: 11px; }
.voucher-status { padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 10px; color: var(--muted); font-size: 10px; }
.status-open { color: var(--accent); }.status-submitted { color: #d9b76a; }.status-approved { color: var(--ok); }.status-declined { color: var(--danger); }
.voucher-admin dl { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 6px 14px; margin: 12px 0; }
.voucher-admin dt { color: var(--muted); }.voucher-admin dd { margin: 0; white-space: pre-wrap; }
.review-actions { display: flex; gap: 8px; }
.review-actions form { margin: 0; }
.voucher-card .form { margin-top: 14px; }
.voucher-card .form label > span { color: var(--faint); font-size: 10px; }
.banner-form { display: grid; grid-template-columns: 160px repeat(3,120px) auto; gap: 10px; align-items: end; }
.banner-form .banner-text { grid-column: 1 / -1; }
.banner-admin { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.banner-admin p { margin: 8px 0 2px; }.banner-admin small { color: var(--faint); }.banner-admin.inactive { opacity: .55; }
.audit-table { overflow-x: auto; }
.audit-head, .audit-row { min-width: 920px; display: grid; grid-template-columns: 145px 110px 170px 110px minmax(300px,1fr); gap: 12px; align-items: center; padding: 8px 10px; }
.audit-head { color: var(--faint); border-bottom: 1px solid var(--line); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.audit-row { border-bottom: 1px solid var(--line); font-size: 11px; }
.audit-row > * { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-row time, .audit-row > span { color: var(--muted); }

.people-list { display: grid; gap: 3px; }
.person-row { min-width: 0; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 6px; border-radius: var(--radius); color: var(--muted); }
.person-row:hover { color: var(--text); background: var(--panel-2); }
.person-row svg { display: block; }
.person-row span { min-width: 0; }
.person-row b, .person-row small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.person-row b { color: var(--text); font-size: 11px; }.person-row small { color: var(--faint); font-size: 9px; }
.person-row i { color: var(--accent); font-style: normal; }

@media (max-width: 780px) {
  .site-banner { grid-template-columns: auto minmax(0,1fr) auto; }
  .site-banner-time { grid-column: 2; }
  .staff-user-grid { grid-template-columns: 1fr; }
  .staff-user-grid > section + section { border-left: 0; border-top: 1px solid var(--line); }
  .member-list-head { grid-template-columns: minmax(120px,1fr) 85px 95px 90px; }
  .member-list-head span:last-child, .staff-user-summary time { display: none; }
  .staff-user-summary { grid-template-columns: 14px minmax(120px,1fr) 85px 95px 90px; }
  .voucher-single, .wave-form, .banner-form { grid-template-columns: 1fr 1fr; }
  .voucher-single > :first-child, .banner-form .banner-text { grid-column: 1 / -1; }
  .permission-roles { grid-template-columns: 1fr 1fr; }
  .category-permissions > form { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .global-searchbar > span { display: none; }
  .voucher-single, .wave-form, .banner-form { grid-template-columns: 1fr; }
  .voucher-single > :first-child, .banner-form .banner-text { grid-column: auto; }
  .voucher-admin dl { grid-template-columns: 1fr; }.voucher-admin dd { margin-bottom: 7px; }
  .permission-roles { grid-template-columns: 1fr; }
  .member-filters { grid-template-columns: 1fr; }
  .member-list-head { grid-template-columns: minmax(100px,1fr) 75px 75px; padding-left: 36px; }
  .member-list-head span:nth-child(3), .member-membership { display: none; }
  .staff-user-summary { grid-template-columns: 14px minmax(100px,1fr) 75px 75px; }
}
* { box-sizing: border-box; }
html {
  background: var(--bg);
  scrollbar-gutter: stable;
  /* keep #post and #reply anchors clear of the fixed top bar */
  scroll-padding-top: calc(var(--tabbar-h) + 16px);
}
body {
  margin: 0;
  min-height: 100svh;
  color: var(--text);
  background:
    radial-gradient(1200px 400px at 50% -120px, rgba(169, 91, 134, .12), transparent),
    var(--bg);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  /* room for the fixed tab bar at the top, plus the notch area on mobile */
  padding-top: calc(var(--tabbar-h) + env(safe-area-inset-top, 0px));
  padding-bottom: 48px;
}
::selection { background: var(--accent-glow); color: #fff; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #f2c3d8; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* faint scanline / crt layer */
.crt {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.014) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

/* Padding, not margin: a top margin here collapses through <body> and leaves
   the first row of content jammed against the viewport edge. */
.page {
  width: 100%;
  max-width: calc(1200px + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--pad-top) var(--gutter) 0;
}

/* ---------- bottom tab bar (cheat-menu style) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; height: var(--tabbar-h);
  padding-top: env(safe-area-inset-top, 0px);
  box-sizing: content-box;
  background: rgba(13, 8, 12, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.tabbar-brand {
  font-weight: 700; letter-spacing: .18em; color: var(--text); font-size: 13px;
  padding-right: 14px; border-right: 1px solid var(--line); white-space: nowrap;
}
.tabbar-brand:hover { color: #fff; }
.tabbar-brand.active { color: var(--accent); }
.tabbar-tabs { display: flex; gap: 6px; overflow-x: auto; flex: 1; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: var(--radius);
  color: var(--muted); font-size: 12.5px; white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.tab:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.tab.active {
  color: #ffd9e8;
  background: linear-gradient(180deg, rgba(217,140,174,.18), rgba(217,140,174,.08));
  border-color: rgba(217,140,174,.35);
  box-shadow: inset 0 0 12px rgba(217,140,174,.06);
}
.tab-dot {
  width: 7px; height: 7px; border-radius: 2px;
  border: 1px solid var(--accent-dim);
  transition: background-color .12s ease, box-shadow .12s ease;
}
.tab.active .tab-dot, .tab:hover .tab-dot {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(217,140,174,.7);
}
.tabbar-account { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.tabbar-profile {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 4px 8px 4px 4px; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--muted); font-size: 12px;
}
.tabbar-profile:hover, .tabbar-profile.active { color: var(--text); background: var(--panel-2); border-color: var(--line-2); }
.tabbar-profile img { width: 30px; height: 30px; display: block; }
.tabbar-profile span { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabbar-logout {
  width: 36px; height: 36px; display: grid; place-items: center;
  color: var(--faint); border: 1px solid transparent; border-radius: var(--radius);
}
.tabbar-logout svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar-logout:hover { color: var(--danger); background: var(--panel-2); border-color: var(--line-2); }
.tab-badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  display: inline-grid; place-items: center; font-size: 10px; font-weight: 700;
  color: #2a0d1c; background: var(--accent);
  box-shadow: 0 0 10px rgba(217,140,174,.5);
}
.tab-badge.hidden { display: none; }
.tab-badge.pop { animation: badgepop .35s ease; }
@keyframes badgepop { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ---------- panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
}
.panel-label {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-bottom: 1px solid var(--line);
}
.panel-glyph { color: var(--accent); transition: transform .2s ease; }
.panel:hover .panel-glyph { transform: translateX(2px); }
.panel-body { padding: 14px; }
.panel-hint { margin: 0 0 10px; color: var(--faint); font-size: 12px; }
.empty { color: var(--faint); font-style: italic; margin: 8px 0; }

/* ---------- crumbs & headings ---------- */
.crumb {
  color: var(--faint); font-size: 12.5px; margin-bottom: 18px;
  display: flex; align-items: center; flex-wrap: wrap;
}
.crumb-sep { color: var(--faint); }
.crumb-root, .crumb-part { color: var(--muted); }
a.crumb-root:hover, a.crumb-part:hover {
  color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}
.crumb-part:last-of-type { color: var(--text); }
.caret {
  display: inline-block; width: 8px; height: 14px; margin-left: 6px;
  background: var(--accent); vertical-align: -2px;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: .01em; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }

/* ---------- buttons & forms ---------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  cursor: pointer; transition: all .12s ease;
}
.btn:hover { border-color: var(--accent-dim); color: #fff; box-shadow: 0 0 10px rgba(217,140,174,.12); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  color: #ffe9f2; border-color: rgba(217,140,174,.5);
  background: linear-gradient(180deg, rgba(217,140,174,.22), rgba(217,140,174,.1));
}
.btn.primary:hover { box-shadow: 0 0 14px rgba(217,140,174,.25); }
/* Inline commit buttons (send, search) — same size wherever they appear. */
.btn-action { padding: 7px 18px; min-width: 84px; justify-content: center; flex: none; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
input, textarea {
  font: inherit; color: var(--text);
  background: var(--field); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 12px; outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
select {
  font: inherit; color: var(--text); appearance: none;
  background: var(--field); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 34px 9px 12px; outline: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
select:focus { border-color: var(--accent-dim); box-shadow: 0 0 0 2px rgba(217,140,174,.15); }
input:focus, textarea:focus { border-color: var(--accent-dim); box-shadow: 0 0 0 2px rgba(217,140,174,.15); }
textarea { resize: vertical; }
.form-error { color: var(--danger); font-size: 12.5px; margin: 0 0 10px; }
.form-alt { color: var(--faint); font-size: 12px; margin: 4px 0 0; }
.flash {
  padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius);
  background: rgba(125,220,154,.08); border: 1px solid rgba(125,220,154,.3); color: var(--ok);
}
/* Transient client-side notice, for failures with no form status line to use. */
.toast {
  position: fixed; z-index: 60; bottom: max(18px, env(safe-area-inset-bottom, 0px));
  left: 50%; transform: translateX(-50%); max-width: min(90vw, 420px);
  padding: 9px 14px; border-radius: var(--radius); font-size: 12.5px;
  background: var(--panel); border: 1px solid var(--line-2); color: var(--text);
  box-shadow: 0 6px 20px rgba(0,0,0,.45);
}
.toast[hidden] { display: none; }
.toast[data-kind="error"] { border-color: rgba(233,121,121,.4); color: var(--danger); }
.auth-wrap { max-width: 420px; margin: 40px auto; }
.auth-panel .panel-body { padding: 18px; }

/* ---------- landing ---------- */
.landing {
  min-height: 62vh; display: grid; grid-template-columns: 1.2fr .8fr;
  gap: 40px; align-items: center;
}
@media (max-width: 860px) { .landing { grid-template-columns: 1fr; } }
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: .12em; display: flex; align-items: center; gap: 8px; }
.landing h1 {
  font-size: clamp(48px, 8vw, 84px); margin: 8px 0 12px; font-weight: 700;
  /* line-height:1 clips descenders once the gradient is clipped to the text */
  letter-spacing: .02em; line-height: 1.18; padding-bottom: .06em;
  background: linear-gradient(180deg, #fff, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.glitch { position: relative; }
.glitch::after {
  content: attr(data-text); position: absolute; inset: 0;
  color: var(--accent); opacity: 0; clip-path: inset(40% 0 40% 0);
  animation: glitch 6s linear infinite; pointer-events: none;
}
@keyframes glitch {
  0%, 93%, 100% { opacity: 0; transform: none; }
  94% { opacity: .8; transform: translate(-2px, 1px); clip-path: inset(10% 0 60% 0); }
  95.5% { opacity: .8; transform: translate(2px, -1px); clip-path: inset(60% 0 10% 0); }
  97% { opacity: 0; }
}
.landing-copy { color: var(--muted); max-width: 52ch; }
.heart { color: var(--accent); animation: beat 2.4s ease-in-out infinite; display: inline-block; }
@keyframes beat { 0%, 88%, 100% { transform: none; } 92% { transform: scale(1.25); } 96% { transform: scale(1.05); } }
.landing-actions { display: flex; gap: 12px; margin-top: 22px; }
.term-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0,0,0,.4);
  animation: float 7s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.term-top {
  display: flex; gap: 6px; align-items: center; padding: 9px 12px;
  border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.term-top i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.term-top i:first-child { background: var(--accent-dim); }
.term-title { margin-left: 8px; color: var(--faint); font-size: 11px; }
.term-body { padding: 14px; font-size: 12.5px; }
.term-body p { margin: 4px 0; color: var(--muted); }
.term-body b { color: var(--accent); font-weight: 400; }
.term-body .ok, .ok { color: var(--ok); }

/* ---------- home grid ---------- */
.home-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } }
.status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 8px rgba(125,220,154,.8);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .45; box-shadow: 0 0 2px rgba(125,220,154,.4); } }
.online-list { display: flex; flex-wrap: wrap; gap: 8px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 20px;
  font-size: 12px; color: var(--muted); background: var(--field);
}
.cat-side-list { display: flex; flex-direction: column; }
.cat-side-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 8px; border-radius: var(--radius); color: var(--muted); font-size: 12.5px;
  transition: background-color .1s ease, color .1s ease;
}
.cat-side-row:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.cat-side-name::before { content: "› "; color: var(--accent-dim); }
.cat-side-count { color: var(--faint); font-size: 11px; }

/* ---------- IRC-style shoutbox ---------- */
.irc { display: flex; flex-direction: column; }
@keyframes slidein { from { opacity: 0; transform: translateY(4px); } }

.irc-topic {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 8px 14px; font-size: 11.5px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-bottom: 1px solid var(--line);
}
.irc-chan { color: var(--accent); font-weight: 700; }
.irc-topic-text {
  color: var(--faint); min-width: 0; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.irc-count { color: var(--muted); white-space: nowrap; font-size: 11px; }

.irc-main { display: grid; grid-template-columns: 1fr 148px; min-height: 0; }
.irc-log {
  height: 340px; overflow-y: auto; padding: 10px 12px;
  background: var(--field); font-size: 12.5px;
}

/* time | nick | text — the irssi column layout */
.irc-line {
  display: grid; grid-template-columns: 42px 104px 1fr; gap: 10px;
  margin: 0; padding: 1px 0; line-height: 1.55;
}
.irc-line[data-fresh] { animation: slidein .18s ease; }
.irc-ts { color: var(--faint); font-size: 11px; padding-top: 1px; }
.irc-nick {
  text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font: inherit; font-weight: 500; appearance: none; border: 0; padding: 0;
  color: inherit; background: none; cursor: pointer;
}
.irc-nick:hover, .irc-user-nick:hover { text-decoration: underline; text-underline-offset: 2px; }
.irc-line:not(.action):not(.sys) .irc-nick::before { content: "<"; color: var(--faint); }
.irc-line:not(.action):not(.sys) .irc-nick::after { content: ">"; color: var(--faint); }
.irc-sigil { color: var(--faint); }
.irc-content { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.irc-text { color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.irc-text code {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 3px; padding: 0 4px; font-size: 12px;
}
.irc-text .quote { color: var(--ok); }
.irc-line.action .irc-nick { color: var(--accent); }
.irc-line.action .irc-text { color: var(--accent-dim); font-style: italic; }
.irc-line.sys .irc-nick { color: var(--faint); }
.irc-line.sys .irc-text { color: var(--muted); white-space: pre-wrap; }

/* nick colours, hashed client- and server-side to the same index */
.irc-nick[data-c="0"], .irc-user-nick[data-c="0"], .irc-you[data-c="0"] { color: #d98cae; }
.irc-nick[data-c="1"], .irc-user-nick[data-c="1"], .irc-you[data-c="1"] { color: #b6a4e8; }
.irc-nick[data-c="2"], .irc-user-nick[data-c="2"], .irc-you[data-c="2"] { color: #7ec8c0; }
.irc-nick[data-c="3"], .irc-user-nick[data-c="3"], .irc-you[data-c="3"] { color: #e0a878; }
.irc-nick[data-c="4"], .irc-user-nick[data-c="4"], .irc-you[data-c="4"] { color: #8fbde8; }
.irc-nick[data-c="5"], .irc-user-nick[data-c="5"], .irc-you[data-c="5"] { color: #cf8fd0; }
.irc-nick[data-c="6"], .irc-user-nick[data-c="6"], .irc-you[data-c="6"] { color: #9dcf8a; }
.irc-nick[data-c="7"], .irc-user-nick[data-c="7"], .irc-you[data-c="7"] { color: #e8909a; }

.irc-users {
  list-style: none; margin: 0; padding: 10px 8px;
  border-left: 1px solid var(--line); background: var(--panel);
  overflow-y: auto; font-size: 12px;
}
.irc-user { display: flex; gap: 4px; min-width: 0; padding: 1px 4px; border-radius: 3px; }
.irc-user:hover { background: var(--panel-2); }
.irc-user-nick {
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  appearance: none; border: 0; padding: 0; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.irc-user.role-owner .irc-sigil { color: var(--accent); }
.irc-user.role-admin .irc-sigil { color: var(--danger); }
.irc-user.role-mod .irc-sigil { color: #d9b76a; }
.irc-user.role-developer .irc-sigil { color: var(--ok); }

/* connection status in the topic bar */
.irc-status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 11px; }
.irc-status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--faint);
  transition: background-color .2s ease, box-shadow .2s ease;
}
.irc-status[data-conn="live"] .irc-status-dot { background: var(--ok); box-shadow: 0 0 8px rgba(125,220,154,.7); }
.irc-status[data-conn="live"] .irc-status-text { color: var(--ok); }
.irc-status[data-conn="polling"] .irc-status-dot { background: var(--warning, #d9a96a); }
.irc-status[data-conn="polling"] .irc-status-text { color: var(--faint); }
.irc-status[data-conn="connecting"] .irc-status-dot { animation: pulse 1.2s ease-in-out infinite; }
.irc-status-text { color: var(--faint); }

/* @mentions */
.mention { color: var(--accent-dim); }
.mention.me {
  color: #ffe4ef; background: rgba(217,140,174,.18);
  border-radius: 3px; padding: 0 3px; font-weight: 500;
}
.irc-line.pinged { background: rgba(217,140,174,.06); box-shadow: inset 2px 0 0 var(--accent-dim); }

/* Message actions, replies and reactions */
.irc-line { position: relative; }
.irc-actions {
  position: absolute; right: 4px; top: -18px; z-index: 3;
  display: flex; align-items: center; padding: 2px;
  opacity: 0; pointer-events: none;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius);
  transition: opacity .1s ease;
}
.irc-line:hover .irc-actions, .irc-actions:focus-within { opacity: 1; pointer-events: auto; }
.irc-actions button {
  appearance: none; width: 28px; height: 25px; padding: 0; border: 0; border-radius: 3px;
  background: transparent; color: var(--muted); font: inherit; cursor: pointer;
}
.irc-actions button:hover { color: var(--accent); background: var(--panel); }
.irc-actions .irc-frame { position: static; opacity: 1; line-height: normal; }
.irc-actions .irc-frame.on { color: var(--accent); }
.irc-reply-context {
  display: block; max-width: 100%; margin: 0 0 2px; padding: 0;
  border: 0; background: none; color: var(--faint); font: inherit; font-size: 10.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.irc-reply-context span { color: var(--accent-dim); margin-right: 7px; }
.irc-reply-context:hover { color: var(--muted); }
.irc-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.irc-reaction {
  appearance: none; padding: 1px 6px; border: 1px solid var(--line); border-radius: 9px;
  color: var(--muted); background: var(--panel); font-size: 13px; cursor: pointer;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.irc-reaction span { font-family: var(--mono); font-size: 10.5px; }
.irc-reaction:hover, .irc-reaction.mine { color: var(--text); border-color: var(--accent-dim); background: var(--accent-glow); }
.irc-line.flash-line { background: var(--accent-glow); transition: background-color .2s ease; }

.irc-replying {
  display: flex; justify-content: space-between; gap: 12px; padding: 6px 12px;
  color: var(--faint); font-size: 11px; border-top: 1px solid var(--line); background: var(--panel-2);
}
.irc-replying b { color: var(--accent); font-weight: 500; }
.irc-replying button { appearance: none; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.irc-replying.hidden, .reaction-picker.hidden { display: none; }
.reaction-picker {
  position: fixed; z-index: 90; display: flex; gap: 2px; padding: 5px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius);
}
.reaction-picker button {
  appearance: none; width: 34px; height: 32px; border: 0; border-radius: 4px;
  background: transparent; font-size: 17px; cursor: pointer;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.reaction-picker button:hover { background: var(--panel); transform: translateY(-1px); }

.user-card {
  width: min(340px, calc(100vw - 32px)); padding: 18px;
  color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius);
}
.user-card::backdrop { background: rgba(6, 3, 5, .7); }
.user-card-close {
  position: absolute; right: 8px; top: 6px; appearance: none; border: 0;
  color: var(--muted); background: none; font: inherit; font-size: 19px; cursor: pointer;
}
.user-card-head { display: flex; align-items: center; gap: 12px; }
.user-card-avatar { line-height: 0; }
.user-card-identity { display: flex; flex-direction: column; min-width: 0; }
.user-card-identity strong { font-size: 14px; }
.user-card-identity span { color: var(--muted); font-size: 11px; }
.user-card-stats { margin: 14px 0; color: var(--muted); font-size: 11.5px; }

.irc-input {
  display: flex; gap: 10px; align-items: center;
  padding: 9px 12px; border-top: 1px solid var(--line); background: var(--panel);
}
.irc-you { white-space: nowrap; font-size: 12.5px; }
.irc-input input { flex: 1; min-width: 0; border: none; background: transparent; padding: 5px 0; }
.irc-input input:focus { box-shadow: none; }

@media (max-width: 700px) {
  .irc-main { grid-template-columns: 1fr; }
  .irc-users { display: none; }
  .irc-line { grid-template-columns: 38px 84px 1fr; gap: 8px; }
  .irc-topic-text { display: none; }
  .tabbar-profile span { display: none; }
}

/* ---------- inline search box ---------- */
.searchbox {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
  padding: 6px 6px 6px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .12s ease;
}
.searchbox:focus-within { border-color: var(--accent-dim); }
.searchbox-glyph { color: var(--accent); }
.searchbox input { flex: 1; min-width: 0; border: none; background: transparent; padding: 5px 0; }
.searchbox input:focus { box-shadow: none; }
/* The sidebar copy is narrower, but the control keeps the same proportions
   as the composer's send button rather than swallowing the input. */
.searchbox.stacked { margin: 0; }
.searchbox.stacked input { min-width: 0; }

/* ---------- forum index (MyBB-style table) ---------- */
.cat-table { display: flex; flex-direction: column; }
.cat-head, .cat-row {
  display: grid; grid-template-columns: 1fr 80px 80px 110px; gap: 12px;
  align-items: center; padding: 10px 12px;
}
.cat-head {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); border-bottom: 1px solid var(--line);
}
.cat-row { color: var(--muted); border-bottom: 1px solid var(--line); transition: background-color .1s ease; }
.cat-row:last-child { border-bottom: none; }
.cat-row:hover { background: var(--panel-2); text-decoration: none; }
.cat-cell-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cat-name { color: var(--accent); font-weight: 500; font-size: 14px; }
.cat-row:hover .cat-name { color: #f2c3d8; text-shadow: 0 0 10px rgba(217,140,174,.35); }
.cat-desc { font-size: 12px; color: var(--muted); }
.cat-roles { font-size: 11px; color: var(--faint); }
.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.cat-last { font-size: 11.5px; color: var(--faint); text-align: right; }
@media (max-width: 640px) {
  .cat-head { display: none; }
  .cat-row { grid-template-columns: 1fr auto; }
  .cat-row .num:nth-of-type(2), .cat-last { display: none; }
}

/* ---------- thread rows ---------- */
.tlist { display: flex; flex-direction: column; }
.trow {
  display: grid; grid-template-columns: 18px 1fr auto auto auto; gap: 14px;
  align-items: center; padding: 9px 10px; border-radius: var(--radius);
  color: var(--muted); font-size: 12.5px;
  transition: background-color .1s ease;
}
.trow:hover { background: var(--panel-2); text-decoration: none; }
.trow + .trow { border-top: 1px solid var(--line); }
.trow + .trow:hover { border-radius: var(--radius); }
.trow-glyph { color: var(--accent-dim); }
.pin { color: var(--accent); }
.trow-title {
  color: var(--text); font-weight: 500; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; gap: 8px; align-items: center;
}
.trow:hover .trow-title { color: #fff; }
.trow-meta { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.trow-meta.num { text-align: right; }
.trow-save { color: var(--faint); cursor: pointer; }
.trow-save:hover { color: var(--danger); }
.trow-save.pending { opacity: .5; pointer-events: none; }
.chip {
  font-size: 10px; padding: 2px 7px; border-radius: 3px;
  background: rgba(217,140,174,.1); color: var(--accent);
  border: 1px solid rgba(217,140,174,.25); white-space: nowrap;
}
@media (max-width: 720px) {
  .trow { grid-template-columns: 14px 1fr auto; }
  .trow-meta:nth-of-type(2), .trow-meta:nth-of-type(3) { display: none; }
}

/* ---------- thread pagination ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0; font-size: 13px; }
.pager-link, .pager-cur {
  min-width: 30px; padding: 5px 9px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--muted); text-decoration: none;
}
.pager-link:hover { color: var(--text); border-color: var(--line-2); background: var(--panel-2); }
.pager-cur { color: var(--accent); border-color: var(--accent-dim); font-weight: 700; }

/* ---------- posts (MyBB-style postbit) ---------- */
.post-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.post {
  display: grid; grid-template-columns: 170px 1fr;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; animation: slidein .2s ease;
}
.post:target { border-color: var(--accent-dim); }

.postbit {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 12px; min-width: 0;
  background: var(--panel-2); border-right: 1px solid var(--line); text-align: center;
}
/* The SVG carries its own fill, border and radius, so the wrapper only
   handles layout and the hover glow. */
.postbit-avatar {
  display: block; border-radius: var(--radius);
  transition: box-shadow .15s ease, transform .15s ease;
}
.postbit-avatar:hover { box-shadow: 0 0 14px rgba(217,140,174,.3); transform: translateY(-1px); }
.postbit-name {
  color: var(--text); font-weight: 500; font-size: 13px; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.postbit-name:hover { color: var(--accent); }
.postbit-name.role-owner::before { content: "★ "; color: var(--accent); }
.postbit-name.role-admin::before { content: "▲ "; color: var(--danger); }
.postbit-name.role-mod::before { content: "■ "; color: #d9b76a; }
.postbit-name.role-developer::before { content: "◆ "; color: var(--ok); }
.postbit-role {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  padding: 1px 8px; border-radius: 3px; color: var(--faint);
  border: 1px solid var(--line);
}
.postbit-role.role-owner { color: var(--accent); border-color: rgba(217,140,174,.4); }
.postbit-role.role-admin { color: var(--danger); border-color: rgba(233,121,121,.35); }
.postbit-role.role-mod { color: #d9b76a; border-color: rgba(217,183,106,.35); }
.postbit-role.role-developer { color: var(--ok); border-color: rgba(125,220,154,.3); }
.postbit-stats {
  margin: 6px 0 0; width: 100%; display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid var(--line); padding-top: 8px;
  font-size: 11px; color: var(--faint);
}
.postbit-stats > div { display: flex; justify-content: space-between; gap: 8px; }
.postbit-stats dt { color: var(--faint); }
.postbit-stats dd { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }

.post-main { display: flex; flex-direction: column; min-width: 0; }
.post-bar {
  display: flex; align-items: center; gap: 12px; padding: 8px 14px;
  border-bottom: 1px solid var(--line); font-size: 11.5px;
}
.post-time { color: var(--faint); }
.post-num { margin-left: auto; color: var(--faint); }
.post-num:hover { color: var(--accent); }
.post-body { padding: 14px; flex: 1; overflow-wrap: anywhere; }

/* ---------- rendered markdown ---------- */
.md .soundcloud-embed {
  width: 100%;
  max-width: 720px;
  margin: 12px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--field);
}
.soundcloud-tools { height: 30px; display: flex; align-items: center; justify-content: space-between; padding: 0 9px; border-bottom: 1px solid var(--line); background: var(--panel-2); font-size: 10px; }
.soundcloud-tools button { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.soundcloud-tools button:hover { color: var(--text); }
.md .soundcloud-embed iframe {
  display: block;
  width: 100%;
  height: 166px;
  border: 0;
}
.md .soundcloud-embed.floating {
  position: fixed; z-index: 45; right: 18px; bottom: 18px; width: min(520px, calc(100vw - 36px));
  margin: 0; box-shadow: 0 0 0 1px var(--bg), 0 12px 35px rgba(0,0,0,.5);
}
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h3, .md h4, .md h5, .md h6 {
  margin: 18px 0 8px; font-weight: 700; line-height: 1.3;
  color: var(--text); letter-spacing: .01em;
}
.md h3 { font-size: 16px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.md h4 { font-size: 14.5px; }
.md h5, .md h6 { font-size: 13px; color: var(--muted); }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.md strong { color: #fff; }
.md em { color: var(--muted); }
.md del { color: var(--faint); }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md li::marker { color: var(--accent-dim); }
.md input[type="checkbox"] { accent-color: var(--accent-dim); margin-right: 4px; }
.md blockquote {
  margin: 0 0 10px; padding: 2px 0 2px 12px; color: var(--muted);
  border-left: 2px solid var(--accent-dim); background: rgba(217,140,174,.04);
}
.md code {
  background: var(--field); border: 1px solid var(--line);
  border-radius: 3px; padding: 1px 5px; font-size: 12.5px; color: var(--accent-3, #f2c3d8);
}
.md pre {
  margin: 0 0 12px; padding: 12px; overflow-x: auto;
  background: var(--field); border: 1px solid var(--line); border-radius: var(--radius);
}
.md pre code { background: none; border: none; padding: 0; color: var(--text); font-size: 12.5px; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.md img { max-width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); }
.md table {
  border-collapse: collapse; margin: 0 0 12px; font-size: 12.5px;
  display: block; overflow-x: auto; max-width: 100%;
}
.md th, .md td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.md th { background: var(--panel-2); color: var(--muted); font-weight: 500; }

.md-hint { margin: -4px 0 0; font-size: 11px; color: var(--faint); line-height: 2; }
.md-hint code {
  background: var(--field); border: 1px solid var(--line);
  border-radius: 3px; padding: 1px 5px; color: var(--muted);
}
.post-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 6px 14px; border-top: 1px solid var(--line);
}
.post-act {
  appearance: none; background: none; border: none; font: inherit;
  font-size: 11px; color: var(--faint); cursor: pointer;
  padding: 2px 6px; border-radius: 3px; transition: color .1s ease, background-color .1s ease;
}
.post-act:hover { color: var(--accent); background: var(--panel-2); }

@media (max-width: 640px) {
  .post { grid-template-columns: 1fr; }
  .postbit {
    flex-direction: row; align-items: center; text-align: left; gap: 10px;
    border-right: none; border-bottom: 1px solid var(--line); padding: 10px 12px;
  }
  /* the SVG has a viewBox, so it scales down cleanly */
  .postbit-avatar { flex: none; }
  .postbit-avatar .avatar { width: 34px; height: 34px; }
  .postbit-stats { display: none; }
}

/* ---------- inbox ---------- */
.notif-list { display: flex; flex-direction: column; }
.notif {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: start;
  padding: 10px; border-radius: var(--radius); color: var(--muted);
  transition: background-color .1s ease;
}
.notif + .notif { border-top: 1px solid var(--line); }
.notif:hover { background: var(--panel-2); text-decoration: none; }
.notif-glyph { color: var(--accent-dim); text-align: center; }
.notif.unread { background: rgba(217,140,174,.05); box-shadow: inset 2px 0 0 var(--accent); }
.notif.unread .notif-glyph { color: var(--accent); }
.notif-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-head { color: var(--text); font-size: 12.5px; }
.notif-head b { color: var(--accent); font-weight: 500; }
.notif-head i { color: var(--muted); font-style: normal; }
.notif-excerpt {
  color: var(--faint); font-size: 11.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-time { color: var(--faint); font-size: 11px; white-space: nowrap; }
@media (max-width: 560px) { .notif-time { display: none; } }

/* ---------- framed chat message ---------- */
.frame { margin: 0; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.frame-inner {
  position: relative; width: 100%; padding: 18px 20px 14px;
  background:
    linear-gradient(180deg, rgba(217,140,174,.07), transparent 60%),
    var(--field);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(217,140,174,.08);
}
.frame-quote {
  position: absolute; top: -2px; left: 8px;
  font-size: 34px; color: rgba(217,140,174,.28); line-height: 1;
}
.frame-body {
  margin: 0 0 10px; padding-left: 16px; color: var(--text);
  font-size: 14px; overflow-wrap: anywhere;
}
.frame-cap {
  display: flex; gap: 10px; align-items: baseline; justify-content: flex-end;
  font-size: 11.5px; color: var(--faint);
}
.frame-nick { font-weight: 500; }
.frame-nick::before { content: "— "; color: var(--faint); }
.frame-remove { font-size: 11px; padding: 4px 10px; }

/* ---------- settings ---------- */
.settings-form { display: flex; flex-direction: column; gap: 2px; }
.setting {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 8px; border-radius: var(--radius); cursor: pointer;
  transition: background-color .1s ease;
}
.setting:hover { background: var(--panel-2); }
.setting + .setting { border-top: 1px solid var(--line); }
.setting input[type="checkbox"] { accent-color: var(--accent-dim); width: 15px; height: 15px; flex: none; }
.setting-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.setting-label { color: var(--text); font-size: 12.5px; }
.setting-hint { color: var(--faint); font-size: 11px; }
.setting-test {
  appearance: none; font: inherit; font-size: 11px; cursor: pointer;
  padding: 3px 10px; border-radius: 3px; flex: none;
  color: var(--muted); background: var(--field); border: 1px solid var(--line);
  transition: color .1s ease, border-color .1s ease;
}
.setting-test:hover { color: var(--accent); border-color: var(--accent-dim); }
.setting-range { cursor: default; }
.setting-range input[type="range"] { accent-color: var(--accent-dim); flex: 1; max-width: 220px; }
.setting-out { color: var(--muted); font-size: 11.5px; min-width: 26px; text-align: right; font-variant-numeric: tabular-nums; }
.settings-status { margin: 6px 0 0; padding-left: 8px; font-size: 11px; color: var(--faint); min-height: 1em; }

/* ---------- avatars ---------- */
.avatar { display: block; }
.postbit-avatar, .profile-avatar { line-height: 0; }

/* ---------- avatar builder ---------- */
.avatar-form { width: 100%; }
.avatar-builder {
  display: grid;
  grid-template-columns: 168px minmax(0, 720px);
  justify-content: center;
  align-items: start;
  gap: 24px;
  padding: 6px 0;
}

.avatar-preview {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 18px 12px 14px; background: var(--field);
  border: 1px solid var(--line); border-radius: var(--radius);
  position: sticky; top: calc(var(--tabbar-h) + 16px);
}
.avatar-preview-box { line-height: 0; }
.avatar-preview-sizes {
  display: flex; align-items: flex-end; gap: 12px;
  padding-top: 12px; border-top: 1px solid var(--line); width: 100%; justify-content: center;
}
.avatar-preview-sizes > span { line-height: 0; }
.avatar-preview-hint {
  margin: 0; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint);
}

.avatar-controls {
  min-width: 0;
  overflow: hidden;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.avatar-controls .setting {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 58px;
  padding: 11px 14px;
  border-radius: 0;
}
.avatar-controls .setting + .setting { border-top: 1px solid var(--line); }
.avatar-controls .setting:hover { background: var(--panel); }
.setting-field { cursor: default; }
.setting-choice { cursor: default; }
.setting-control { min-width: 0; }
.setting-control > input[type="text"] { width: min(100%, 260px); }
.setting-toggle .setting-control { display: flex; justify-content: flex-start; }

.glyph-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.glyph-preset {
  appearance: none; font: inherit; font-size: 12px; cursor: pointer;
  padding: 4px 9px; border-radius: 3px;
  color: var(--muted); background: var(--field); border: 1px solid var(--line);
  transition: color .1s ease, border-color .1s ease, background-color .1s ease;
}
.glyph-preset:hover { color: var(--accent); border-color: var(--accent-dim); background: var(--panel-2); }

.color-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.swatch {
  width: 20px; height: 20px; padding: 0; cursor: pointer; border-radius: 3px;
  background: var(--sw); border: 1px solid rgba(0,0,0,.4);
  transition: transform .1s ease, box-shadow .1s ease;
}
.swatch:hover { transform: translateY(-1px); }
.swatch.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent); }
input[type="color"] {
  width: 34px; height: 26px; padding: 2px; cursor: pointer;
  background: var(--field); border: 1px solid var(--line); border-radius: 3px;
}

.segmented { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg {
  padding: 5px 12px; font-size: 11.5px; color: var(--muted); cursor: pointer;
  background: var(--field); transition: color .1s ease, background-color .1s ease;
}
.seg + .seg { border-left: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg:hover { color: var(--text); background: var(--panel-2); }
.seg.on {
  color: #ffd9e8; background: linear-gradient(180deg, rgba(217,140,174,.22), rgba(217,140,174,.1));
}
.seg:focus-within { color: var(--text); }

/* With an uploaded image in use, the generated-avatar controls still work but
   no longer affect anything visible, so they recede rather than vanish. */
.avatar-form[data-has-image] .generated-only { opacity: .4; }
.avatar-form[data-has-image] .generated-only:focus-within { opacity: 1; }

.upload-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.upload-pick { cursor: pointer; font-size: 12px; padding: 6px 14px; }
.upload-name {
  color: var(--faint); font-size: 11.5px; min-width: 0; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upload-remove { font-size: 11px; padding: 5px 10px; }
.upload-remove:hover { border-color: var(--danger); color: var(--danger); }
.upload-status { margin: 6px 0 0; font-size: 11.5px; color: var(--faint); min-height: 1em; }
.upload-status[data-kind="ok"] { color: var(--ok); }
.upload-status[data-kind="error"] { color: var(--danger); }

.avatar-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.avatar-note {
  margin: 0; padding: 9px 14px; font-size: 11.5px; color: var(--warning, #d9a96a);
  background: rgba(217,169,106,.07); border-top: 1px solid rgba(217,169,106,.25);
}
.avatar-controls > .settings-status { margin: 0; padding: 0 14px 10px; background: var(--panel); }

@media (max-width: 820px) {
  .avatar-builder { grid-template-columns: 1fr; gap: 14px; }
  .avatar-preview {
    position: static;
    display: grid;
    grid-template-columns: auto auto 1fr;
    justify-content: start;
    gap: 14px;
  }
  .avatar-preview-sizes { width: auto; padding: 0 0 0 14px; border-top: 0; border-left: 1px solid var(--line); }
  .avatar-preview-hint { align-self: center; }
}

@media (max-width: 580px) {
  .avatar-controls .setting { grid-template-columns: 1fr; gap: 8px; }
  .setting-control > input[type="text"] { width: 100%; }
  .upload-row { align-items: flex-start; flex-wrap: wrap; }
  .upload-name { flex-basis: 100%; order: 3; }
  .avatar-preview { grid-template-columns: auto 1fr; }
  .avatar-preview-hint { grid-column: 1 / -1; }
}

/* ---------- profile ---------- */
.profile-grid { display: flex; gap: 18px; align-items: center; }
.profile-avatar { flex: none; border-radius: var(--radius); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
