/* Bizarre Bouncer dashboard. One dark theme, tokens on :root. */

:root {
  --ground: #0D1017;
  --rail: #090C11;
  --sidebar: #11151D;
  --surface: #151A23;
  --surface-2: #1C2330;
  --surface-3: #232B3A;
  --field: #0F131B;
  --line: #222A38;
  --line-soft: #1A202B;
  --line-strong: #2E3850;
  --text: #E8ECF3;
  --text-2: #DCE2EC;
  --muted: #AEB8C8;
  --faint: #9AA6B8;
  --fainter: #8692A6;
  --knob-off: #3A4458;
  --accent: #F4C95D;
  --accent-hover: #FFE39E;
  --on-accent: #1A1405;
  --accent-soft: #3A2F12;
  --accent-line: #3A3220;
  --danger: #F28B82;
  --danger-soft: #3A1C1C;
  --ok-bg: #1E3A2C;
  --ok-line: #2F6B4D;
  --ok-text: #CFF5DF;
  --blurple: #5865F2;
  --radius: 14px;
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
html, body { margin: 0; background: var(--ground); color: var(--text); font-family: var(--font-body); font-size: 15px; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
p { margin: 0; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: 600 14px var(--font-body); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { background: transparent; }
.btn-lg { min-height: 48px; padding: 12px 22px; border-radius: 10px; font-size: 16px; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn-icon { min-height: 36px; padding: 6px 8px; }
.inline-form { display: inline-flex; margin: 0; }
.link-btn { border: 0; background: none; padding: 4px 6px; color: var(--muted); font: 500 13px var(--font-body); text-decoration: underline; cursor: pointer; border-radius: 6px; }
.link-btn:hover { color: var(--text); background: var(--surface-2); }

/* ---------------------------------------------------------------- fields */
.field { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--field); color: var(--text); font: 400 14px var(--font-body); }
.field:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea.field { min-height: 88px; resize: vertical; line-height: 1.5; }
select.field { appearance: auto; }
.field-suffix { display: flex; align-items: center; gap: 8px; }
.field-suffix span { color: var(--faint); font-size: 14px; }
.field.invalid, .invalid .field { border-color: var(--danger); }

.switch { appearance: none; position: relative; flex-shrink: 0; width: 44px; height: 26px; margin: 0; border-radius: 13px; background: var(--knob-off); cursor: pointer; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text); transition: left .15s, background .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { left: 21px; background: var(--on-accent); }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 6px 4px 12px; border-radius: 16px; background: var(--surface-3); color: var(--text); font-size: 13px; }
.chip button { width: 24px; height: 24px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }
.chip button:hover { background: var(--knob-off); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-empty { font-size: 13px; color: var(--fainter); }
.chips:not(:empty) + .chips-empty { display: none; }
.add-row { display: flex; gap: 8px; }

.error-text { font-size: 13px; color: var(--danger); }
.notice { padding: 10px 14px; border-radius: 10px; font-size: 14px; line-height: 1.5; }
.notice-warn { background: var(--accent-soft); color: var(--accent); }
.notice-error { background: var(--danger-soft); color: var(--danger); }

/* ---------------------------------------------------------------- app shell */
.app { min-height: 100vh; display: flex; }
.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; width: 76px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 0; background: var(--rail); border-right: 1px solid var(--line-soft); }
.rail-home { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 16px; background: var(--surface); color: var(--accent); }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--surface-3); }
.guild-btn { position: relative; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 16px; background: var(--surface-2); color: var(--text); font: 700 15px var(--font-display); text-decoration: none; overflow: hidden; transition: border-radius .15s; }
.guild-btn img { width: 100%; height: 100%; object-fit: cover; }
.guild-btn:hover { border-radius: 12px; color: var(--text); }
.guild-btn[aria-current="page"] { border-radius: 12px; background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 2px var(--accent); }
.guild-btn.add { background: transparent; border: 2px dashed var(--line-strong); color: var(--muted); font-size: 22px; }

.layout { flex-grow: 1; display: flex; min-width: 0; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; width: 248px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; padding: 20px 14px; background: var(--sidebar); border-right: 1px solid var(--line-soft); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 6px; }
.sidebar-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sidebar-title strong { font: 700 18px var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-title span { font-size: 12px; line-height: 1.4; color: var(--faint); }
.nav-toggle { display: none; }
.side-nav { display: flex; flex-direction: column; gap: 16px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 0 12px 6px; font: 600 11px var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--fainter); }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 7px 12px; border-radius: 8px; color: var(--muted); font: 500 14px var(--font-body); text-decoration: none; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--surface-3); color: var(--accent); }
.nav-link span:first-child { flex-grow: 1; }
.dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; border: 1.5px solid var(--knob-off); }
.dot.on { border-color: var(--accent); background: var(--accent); }
.nav-sub { display: flex; flex-direction: column; margin: 2px 0 6px 20px; padding-left: 10px; border-left: 1px solid var(--line-strong); }
.nav-sub a { padding: 5px 10px; border-radius: 6px; color: var(--faint); font-size: 13px; line-height: 1.35; text-decoration: none; }
.nav-sub a:hover { background: var(--surface-2); color: var(--text); }
.nav-sub a.active { color: var(--text); box-shadow: inset 2px 0 0 var(--accent); border-radius: 0 6px 6px 0; margin-left: -11px; padding-left: 21px; }
.pill { padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--faint); font-size: 12px; font-weight: 600; }
.pill.on { background: var(--accent-soft); color: var(--accent); }
.me { position: sticky; bottom: -20px; margin: auto -14px -20px; padding: 12px 24px 20px; border-radius: 0; border-top: 1px solid var(--line-soft); background: var(--sidebar); display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--surface); }
.avatar { width: 32px; height: 32px; flex-shrink: 0; border-radius: 16px; background: var(--knob-off); display: flex; align-items: center; justify-content: center; font: 700 13px var(--font-display); overflow: hidden; }
.avatar img { width: 100%; height: 100%; }
.me-name { flex-grow: 1; min-width: 0; }
.me-name div:first-child { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-name div:last-child { font-size: 12px; color: var(--faint); }

.content { flex-grow: 1; min-width: 0; padding: 32px 40px 140px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-direction: column; gap: 6px; max-width: 920px; }
.crumbs { font-size: 13px; color: var(--faint); }
.page-head h1 { font: 700 34px/1.15 var(--font-display); }
.page-head p { font-size: 15px; line-height: 1.55; color: var(--muted); }

/* ---------------------------------------------------------------- overview */
.stack { display: flex; flex-direction: column; gap: 24px; max-width: 1120px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 13px; color: var(--faint); }
.stat-value { font: 700 30px var(--font-display); }
.stat-note { font-size: 12px; color: var(--fainter); }
.block-title { font: 600 18px var(--font-display); }
.block { display: flex; flex-direction: column; gap: 12px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.module-link { align-self: flex-start; }
.modules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.module { padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.module-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.module-head h3 { font: 600 16px var(--font-body); }
.module p { font-size: 13px; line-height: 1.5; color: var(--muted); flex-grow: 1; }
.module form { margin: 0; display: flex; }
.table-card { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.case-row { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid #1E2533; }
.case-row:last-child { border-bottom: 0; }
.case-num { width: 52px; font-size: 13px; color: var(--faint); }
.badge { min-width: 72px; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; text-align: center; background: var(--accent-soft); color: var(--accent); text-transform: capitalize; }
.badge-ban { background: var(--danger-soft); color: var(--danger); }
.case-who { flex-grow: 1; font-size: 14px; min-width: 0; }
.case-who span { color: var(--faint); }
.empty { padding: 20px; color: var(--faint); font-size: 14px; }

/* ---------------------------------------------------------------- settings cards */
.cards { display: flex; flex-direction: column; gap: 20px; max-width: 920px; }
.card { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); scroll-margin-top: 24px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid #1E2533; }
.card-head h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font: 600 18px var(--font-display); }
.card-head p.premium-note { margin-top: 8px; color: var(--faint); font-size: 13px; }
.card-body.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-body.grid .row { border-bottom: 1px solid var(--line-soft); gap: 12px; padding: 12px 24px; }
.card-body.grid > .row:nth-child(odd), .card-body.grid > fieldset:nth-child(odd) > .row { border-right: 1px solid var(--line-soft); }
.card-body.grid > .row:nth-last-child(-n+2):nth-child(odd), .card-body.grid > .row:nth-last-child(-n+2):nth-child(odd) + .row,
.card-body.grid > fieldset:nth-last-child(-n+2):nth-child(odd) > .row, .card-body.grid > fieldset:nth-last-child(-n+2):nth-child(odd) + fieldset > .row { border-bottom: 0; }
.card-body.grid .row-control { width: auto; }
.card-body.grid > fieldset { display: contents; }
.card-head p { margin-top: 4px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.card-body { display: flex; flex-direction: column; transition: opacity .15s; }
.card:has(.card-head .switch:not(:checked)) .card-body { opacity: .55; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 24px; border-bottom: 1px solid var(--line-soft); }
.row:last-child { border-bottom: 0; }
.card-body > fieldset:not(:last-child) > .row:last-child { border-bottom: 1px solid var(--line-soft); }
.row.wide { flex-direction: column; align-items: stretch; gap: 12px; }
.row-label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-label label, .row-label .label { font-size: 14px; font-weight: 600; }
.row-label small { font-size: 13px; line-height: 1.45; color: var(--faint); }
.row-control { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.row-control.auto { width: auto; align-items: flex-end; }
.row.wide .row-control { width: 100%; }

/* message editor */
.vars { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.vars-label { font-size: 12px; color: var(--fainter); margin-right: 2px; }
.var { min-height: 30px; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--accent-line); background: #1E1A10; color: var(--accent); font: 400 12px var(--font-mono); cursor: pointer; }
.var:hover { background: #2C2512; border-color: var(--accent); }
.vars .link-btn { margin-left: auto; }
.legend { border-radius: 10px; background: var(--field); border: 1px solid #1E2533; overflow: hidden; }
.legend > p { padding: 10px 14px; font-size: 13px; line-height: 1.5; color: var(--muted); border-bottom: 1px solid #1E2533; }
.legend table { width: 100%; border-collapse: collapse; font-size: 13px; }
.legend th { padding: 8px 14px; font-weight: 600; text-align: left; color: var(--fainter); }
.legend td { padding: 8px 14px; border-top: 1px solid var(--line-soft); color: var(--text-2); }
.legend td:first-child { color: var(--accent); white-space: nowrap; font-family: var(--font-mono); }
.legend td:last-child { color: var(--faint); }
.legend-tips { padding: 10px 14px; border-top: 1px solid #1E2533; display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.legend-tips strong { color: var(--text-2); }
.legend-tips code { font-family: var(--font-mono); color: var(--accent); }
.preview { display: flex; gap: 10px; padding: 12px; border-radius: 10px; background: var(--field); border: 1px solid #1E2533; }
.bot-avatar { width: 32px; height: 32px; flex-shrink: 0; border-radius: 16px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font: 700 13px var(--font-display); }
.bot-name { font-size: 13px; font-weight: 600; }
.app-tag { margin-left: 4px; padding: 1px 5px; border-radius: 4px; background: var(--blurple); color: #fff; font-size: 10px; }
.preview-text { font-size: 14px; line-height: 1.5; color: var(--text-2); word-break: break-word; }
.preview-text .mention { padding: 0 2px; border-radius: 3px; background: rgba(88, 101, 242, .3); color: #C9CDFB; }

/* structured lists (escalation steps, feeds) */
.steps { display: flex; flex-direction: column; gap: 8px; }
.step { display: grid; grid-template-columns: 110px 1fr 1fr 40px; gap: 8px; align-items: center; }
.step-head { font-size: 12px; color: var(--fainter); }
.feed { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 10px; background: var(--field); border: 1px solid #1E2533; }
.feed-grid { display: grid; grid-template-columns: 130px 1fr 1fr 1fr 40px; gap: 8px; align-items: end; }
.feed-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--fainter); }
.step-2 { grid-template-columns: 110px 1fr 40px; }
.response-grid { grid-template-columns: 1.4fr 1fr 1fr 40px; }
.panel-grid { grid-template-columns: 1.4fr 1fr 1fr 40px; }
.stacked-label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--fainter); }
.picker-list { display: flex; flex-direction: column; gap: 8px; }
.feed-status { font-size: 13px; color: var(--faint); }
.feed-status.error { color: var(--danger); }
.feed-status.ok { color: var(--ok-text); }

/* ---------------------------------------------------------------- cases, leaderboard, history */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .field { width: auto; min-width: 180px; }
.filters input.field { flex-grow: 1; max-width: 360px; }
.case-row .case-mod { font-size: 13px; color: var(--faint); white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid #1E2533; font-size: 13px; color: var(--faint); }
.pager div { display: flex; gap: 8px; }
.lb-row { display: grid; grid-template-columns: 48px 40px minmax(0, 1fr) 90px minmax(120px, 220px); align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid #1E2533; }
.lb-row:last-child { border-bottom: 0; }
.lb-rank { font: 700 16px var(--font-display); color: var(--faint); text-align: center; }
.lb-row:nth-child(1) .lb-rank { color: var(--accent); }
.lb-row:nth-child(2) .lb-rank, .lb-row:nth-child(3) .lb-rank { color: var(--text-2); }
.lb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-level { font-size: 13px; color: var(--muted); }
.lb-bar { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--faint); }
.lb-bar span { display: block; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.lb-bar span i { display: block; height: 100%; background: var(--accent); }
.history { display: flex; flex-direction: column; gap: 12px; }
.change { padding: 14px 20px; border-bottom: 1px solid #1E2533; display: flex; flex-direction: column; gap: 8px; }
.change:last-child { border-bottom: 0; }
.change-head { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.change-head .avatar { width: 24px; height: 24px; font-size: 11px; }
.change-head time { margin-left: auto; font-size: 13px; color: var(--faint); white-space: nowrap; }
.change-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.change-list li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr); gap: 12px; }
.change-path { color: var(--muted); }
.change-val { color: var(--text-2); word-break: break-word; }
.change-val del { color: var(--danger); text-decoration: line-through; }
.change-val ins { color: var(--ok-text); text-decoration: none; }
.source { padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--muted); }
.public-board { max-width: 920px; margin: 0 auto; padding: 40px 16px 80px; display: flex; flex-direction: column; gap: 24px; }
.public-board header { display: flex; align-items: center; gap: 16px; }
.public-board header h1 { font: 700 30px var(--font-display); }
.public-board header .guild-btn { flex-shrink: 0; }

/* ---------------------------------------------------------------- save bar and toasts */
.savebar { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 160%); width: min(640px, calc(100% - 32px)); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 12px 12px 20px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: 0 12px 32px rgba(0, 0, 0, .45); visibility: hidden; transition: transform .2s, visibility .2s; z-index: 20; }
form.dirty .savebar { transform: translate(-50%, 0); visibility: visible; }
.savebar span { font-size: 14px; font-weight: 500; }
.savebar div { display: flex; gap: 8px; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 30; pointer-events: none; }
.toast { padding: 12px 20px; border-radius: var(--radius); background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-text); font-size: 14px; font-weight: 500; animation: toast-in .2s ease-out; }
.toast.error { background: var(--danger-soft); border-color: #6B2F2F; color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.htmx-request .savebar .btn-primary { opacity: .6; pointer-events: none; }

/* ---------------------------------------------------------------- landing and server picker */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { max-width: 1280px; width: 100%; margin: 0 auto; padding-left: 48px; padding-right: 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 20px; padding-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--accent); text-decoration: none; }
.brand span { font: 700 22px var(--font-display); color: var(--text); }
.topnav { display: flex; align-items: center; gap: 24px; font-size: 15px; }
.topnav a:not(.btn) { color: var(--muted); text-decoration: none; }
.hero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 56px; align-items: center; padding-top: 72px; padding-bottom: 88px; }
.hero h1 { font: 800 64px/1.02 var(--font-display); letter-spacing: -.02em; }
.hero-copy { display: flex; flex-direction: column; gap: 24px; }
.hero-copy > p { max-width: 540px; font-size: 18px; line-height: 1.6; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-demo { border-radius: 18px; background: var(--surface); border: 1px solid var(--line); padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 12px; }
.msg .bot-avatar { width: 40px; height: 40px; border-radius: 20px; font-size: 15px; }
.embed { border-radius: 6px; background: var(--surface-2); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: inset 4px 0 0 var(--accent); }
.embed-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; font-size: 13px; }
.embed-grid div div { color: var(--faint); }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding-bottom: 80px; }
.feature { padding: 24px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.feature h2 { font: 600 20px var(--font-display); }
.feature p { font-size: 15px; line-height: 1.6; color: var(--muted); }
.footer { margin-top: auto; border-top: 1px solid var(--line-soft); }
.footer .wrap { padding-top: 24px; padding-bottom: 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--fainter); }
.picker { display: flex; flex-direction: column; gap: 24px; padding-top: 40px; padding-bottom: 80px; }
.picker-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.picker-head h1 { font: 700 34px var(--font-display); }
.guild-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.guild-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.guild-card .guild-btn { flex-shrink: 0; }
.guild-card-name { flex-grow: 1; min-width: 0; }
.guild-card-name strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-card-name span { font-size: 13px; color: var(--faint); }

@media (max-width: 1100px) {
  .guild-grid, .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .rail { display: none; }
  .layout { flex-direction: column; }
  .sidebar { position: static; height: auto; width: auto; border-right: 0; border-bottom: 1px solid var(--line-soft); padding: 14px 16px; }
  .nav-toggle { display: inline-flex; }
  .js .sidebar:not(.open) .side-nav, .js .sidebar:not(.open) .me { display: none; }
  .me { position: static; margin: 0; padding: 10px; border-radius: 10px; border-top: 0; background: var(--surface); }
  .card-body.grid { grid-template-columns: minmax(0, 1fr); }
  .card-body.grid > .row:nth-child(odd), .card-body.grid > fieldset:nth-child(odd) > .row { border-right: 0; }
  .card-body.grid .row { flex-direction: row; align-items: center; }
  .content { padding: 20px 16px 120px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modules, .guild-grid, .hero, .features { grid-template-columns: minmax(0, 1fr); }
  .row { flex-direction: column; align-items: stretch; }
  .row-control, .row-control.auto { width: 100%; align-items: stretch; }
  .wrap { padding-left: 16px; padding-right: 16px; }
  .hero { padding-top: 40px; padding-bottom: 48px; }
  .hero h1 { font-size: 44px; }
  .step { grid-template-columns: 80px 1fr 1fr 40px; }
  .feed-grid { grid-template-columns: minmax(0, 1fr); }
  .lb-row { grid-template-columns: 36px 32px minmax(0, 1fr) 70px; }
  .lb-bar { display: none; }
  .change-list li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .embed-grid { grid-template-columns: minmax(0, 1fr); }
  .case-row { flex-wrap: wrap; gap: 6px 12px; }
  .case-who { order: 3; flex-basis: 100%; }
}

/* ------------------------------------------------------------------ look and feel */

[hidden] { display: none !important; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.locked { opacity: .6; }
fieldset.locked .row { cursor: not-allowed; }
.premium-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 600 11px var(--font-body); white-space: nowrap; }
.premium-badge.locked { background: var(--surface-2); color: var(--faint); }
.row-label .premium-badge { margin: 2px 0; align-self: flex-start; }

.cpick { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.cpick-hex { width: 112px; font-family: var(--font-mono); text-transform: uppercase; }
.cpick-hex::placeholder { text-transform: none; font-family: var(--font-body); }
.cpick-swatch { position: relative; width: 40px; height: 40px; flex-shrink: 0; padding: 4px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--field); cursor: pointer; }
.cpick-swatch:hover { border-color: var(--muted); }
.cpick-swatch span { display: block; width: 100%; height: 100%; border-radius: 5px; background: var(--c, #5865F2); }
.cpick-swatch.inherit span { background: repeating-linear-gradient(-45deg, var(--c, #5865F2) 0 5px, transparent 5px 8px); opacity: .8; }
.cpick-swatch[aria-expanded="true"] { border-color: var(--accent); }
.cpick-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: 248px; display: flex; flex-direction: column; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
.cpick-pop.up { top: auto; bottom: calc(100% + 8px); }
.cpick-pop.right { left: auto; right: 0; }
.cpick-sv { position: relative; height: 140px; border-radius: 8px; cursor: crosshair; touch-action: none; background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(var(--hue, 235) 100% 50%)); }
.cpick-thumb { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); pointer-events: none; }
.cpick-hue { width: 100%; height: 14px; margin: 0; appearance: none; border-radius: 7px; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); cursor: pointer; }
.cpick-hue::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; background: transparent; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.cpick-hue::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; background: transparent; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.cpick-presets { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cpick-presets button { aspect-ratio: 1; padding: 0; border: 1px solid rgba(255, 255, 255, .12); border-radius: 6px; background: var(--c); cursor: pointer; }
.cpick-presets button:hover { transform: scale(1.1); }
.cpick-presets button.current { outline: 2px solid var(--text); outline-offset: 1px; }
.cpick-clear { align-self: flex-start; }
.emoji-input .field { width: 150px; }

.button-editor { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 10px 12px; align-items: end; }
.button-editor label, .button-style { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--fainter); }
.button-preview-wrap { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.style-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.style-chip { position: relative; display: inline-flex; padding: 6px 12px; border-radius: 6px; color: #fff; font: 500 13px var(--font-body); cursor: pointer; outline: 2px solid transparent; outline-offset: 2px; }
.style-chip input { position: absolute; opacity: 0; pointer-events: none; }
.style-chip:has(input:checked) { outline-color: var(--accent); }
.style-chip:has(input:focus-visible) { outline-color: var(--text); }
.style-primary { background: #5865F2; }
.style-secondary { background: #4E5058; }
.style-success { background: #248046; }
.style-danger { background: #DA373C; }
.dc-button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 2px 16px; border-radius: 4px; color: #fff; font: 500 14px var(--font-body); }

.upload { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.upload-preview { display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; overflow: hidden; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); font-size: 11px; }
.upload-preview.banner, .upload-preview.embed { width: 200px; height: 72px; border-radius: 8px; }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload-actions label.btn { cursor: pointer; }
.upload-status { font-size: 12px; color: var(--faint); }
.upload progress { width: 140px; accent-color: var(--accent); }

.template-editor { gap: 12px; }
.inline-switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.embed-editor { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-left: 3px solid var(--line-strong); border-radius: 0 10px 10px 0; background: var(--field); }
.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; align-items: end; }
.tpl-grid label, .tpl-grid .lbl { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--fainter); }
fieldset.rich { display: flex; flex-direction: column; gap: 12px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: 10px; }
fieldset.rich legend { display: flex; align-items: center; gap: 8px; padding: 0 6px; font-size: 12px; color: var(--muted); }
fieldset.rich:disabled > :not(legend) { opacity: .55; }
fieldset.persona .upload-preview { width: 48px; height: 48px; }

.preview-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex-grow: 1; }
img.bot-avatar { object-fit: cover; }
.dc-embed { display: flex; gap: 12px; max-width: 520px; padding: 10px 14px 12px 12px; border-left: 4px solid #5865F2; border-radius: 4px; background: #2B2D31; }
.dc-embed-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex-grow: 1; }
.dc-embed-author { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #F2F3F5; }
.dc-embed-author .dc-pic { width: 22px; height: 22px; }
.dc-embed-title { font-size: 15px; font-weight: 700; color: #F2F3F5; word-break: break-word; }
.dc-embed-title.link { color: #00A8FC; }
.dc-embed-desc { font-size: 14px; line-height: 1.45; color: #DBDEE1; word-break: break-word; }
.dc-embed-desc .mention { padding: 0 2px; border-radius: 3px; background: rgba(88, 101, 242, .3); color: #C9CDFB; }
.dc-embed-image { max-width: 100%; max-height: 260px; margin-top: 6px; border-radius: 6px; object-fit: contain; align-self: flex-start; }
.dc-embed-footer { font-size: 12px; color: #B5BAC1; }
.dc-pic { display: inline-block; flex-shrink: 0; border-radius: 50%; background: #5865F2 center / cover no-repeat; }
.dc-pic.empty { background-image: radial-gradient(circle at 50% 38%, #DBDEE1 0 22%, transparent 23%), radial-gradient(circle at 50% 100%, #DBDEE1 0 38%, transparent 39%); }
.dc-embed-thumb { width: 64px; height: 64px; border-radius: 8px; }
.dc-embed-thumb.empty { border-radius: 50%; }

.test-send { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.test-send select { width: auto; min-width: 180px; }
.test-status { font-size: 13px; }

.panel-look { display: grid; grid-template-columns: 150px repeat(2, minmax(0, 1fr)) auto; gap: 8px; align-items: end; }
.panel-look label, .panel-look .lbl { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--fainter); }
.role-rows { display: flex; flex-direction: column; gap: 8px; }
.role-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 120px 110px minmax(0, 1.2fr) 40px; gap: 6px; align-items: center; }
.role-row .emoji-input .field { width: 100%; }

@media (max-width: 1100px) {
  .role-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-look { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .button-editor, .panel-look, .role-row, .tpl-grid { grid-template-columns: minmax(0, 1fr); }
}
