/* --- Colors -----------------------------------------------------------------
   Light by default; dark follows the system unless a theme is picked
   (data-theme on <html>). The accent color comes from data-accent. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9ecf1;
  --text: #101828;
  --muted: #667085;
  --border: #e4e7ec;
  --danger: #d92d20;
  --ok: #079455;
  --ink: #000;
  --shadow: 0 1px 2px rgb(16 24 40 / 5%);
  --shadow-lift: 0 12px 32px rgb(16 24 40 / 12%), 0 2px 6px rgb(16 24 40 / 6%);
  --radius: 12px;
  --radius-sm: 8px;
  --gap: 16px;
  --pad: 20px;
  --topbar: 56px;
  --sidebar: 252px;

  --accent: #5865f2;
  --accent-2: #8b5cf6;
  --accent-text: #ffffff;

  /* Case actions. */
  --c-ban: #ef4444;
  --c-softban: #f43f5e;
  --c-unban: #22c55e;
  --c-kick: #f97316;
  --c-timeout: #f59e0b;
  --c-untimeout: #14b8a6;
  --c-warn: #eab308;
  --c-note: #3b82f6;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014;
    --surface: #161920;
    --surface-2: #1d2129;
    --surface-3: #262b35;
    --text: #eceef2;
    --muted: #98a2b3;
    --border: #2a2f3a;
    --danger: #f97066;
    --ok: #47cd89;
    --ink: #fff;
    --shadow: 0 1px 2px rgb(0 0 0 / 35%);
    --shadow-lift: 0 16px 40px rgb(0 0 0 / 50%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1014;
  --surface: #161920;
  --surface-2: #1d2129;
  --surface-3: #262b35;
  --text: #eceef2;
  --muted: #98a2b3;
  --border: #2a2f3a;
  --danger: #f97066;
  --ok: #47cd89;
  --ink: #fff;
  --shadow: 0 1px 2px rgb(0 0 0 / 35%);
  --shadow-lift: 0 16px 40px rgb(0 0 0 / 50%);
  color-scheme: dark;
}

[data-accent="violet"] { --accent: #7c3aed; --accent-2: #d946ef; }
[data-accent="pink"] { --accent: #db2777; --accent-2: #f97316; }
[data-accent="orange"] { --accent: #ea580c; --accent-2: #eab308; }
[data-accent="gold"] { --accent: #b45309; --accent-2: #f43f5e; }
[data-accent="green"] { --accent: #059669; --accent-2: #06b6d4; }
[data-accent="cyan"] { --accent: #0891b2; --accent-2: #6366f1; }
[data-accent="red"] { --accent: #e11d48; --accent-2: #f97316; }

[data-density="compact"] {
  --gap: 10px;
  --pad: 14px;
  --font-base: 13.5px;
}

/* Text size (Appearance > Text size) scales everything set in rem (see html below). */

[data-text="small"] { --text-scale: 0.9; }
[data-text="large"] { --text-scale: 1.1; }
[data-text="xlarge"] { --text-scale: 1.22; }

/* Feature colors, used by icon chips and stat tiles. */
.tone-blue { --tone: #3b82f6; }
.tone-pink { --tone: #ec4899; }
.tone-red { --tone: #ef4444; }
.tone-amber { --tone: #f59e0b; }
.tone-green { --tone: #10b981; }
.tone-purple { --tone: #8b5cf6; }
.tone-cyan { --tone: #06b6d4; }
.tone-gray { --tone: #64748b; }
.tone-accent { --tone: var(--accent); }

.act-ban { --act: var(--c-ban); }
.act-softban { --act: var(--c-softban); }
.act-unban { --act: var(--c-unban); }
.act-kick { --act: var(--c-kick); }
.act-timeout { --act: var(--c-timeout); }
.act-untimeout { --act: var(--c-untimeout); }
.act-warn { --act: var(--c-warn); }
.act-note { --act: var(--c-note); }

/* Ticket history dots (tickets/ticketLog.js events). */
.tk-opened { --act: var(--c-unban); }
.tk-closed { --act: #5865f2; }
.tk-reopened { --act: var(--c-warn); }
.tk-memberAdded { --act: #10b981; }
.tk-memberRemoved { --act: var(--c-kick); }
.tk-renamed { --act: var(--c-note); }
.tk-deleted { --act: var(--c-ban); }

/* --- Base --------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  font-size: calc(var(--font-base, 14.5px) * var(--text-scale, 1));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  /* A soft wash of the accent colors behind everything, so pages don't sit on flat grey. */
  background:
    radial-gradient(1100px 520px at 85% -120px, color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%),
    radial-gradient(900px 480px at -10% -80px, color-mix(in srgb, var(--accent-2) 8%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 1rem/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 12px;
}

h3 {
  font-size: 0.95rem;
  margin: 18px 0 8px;
}

a {
  color: var(--accent);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 0;
}

kbd {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font: 600 0.72rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

.icon {
  flex: none;
  width: 18px;
  height: 18px;
}

.icon.small {
  width: 16px;
  height: 16px;
}

.icon.tiny {
  width: 14px;
  height: 14px;
}

.muted,
.help {
  color: var(--muted);
}

.help {
  font-size: 0.86rem;
  margin: 0 0 10px;
}

.error-text {
  color: var(--danger);
}

.danger-text {
  color: var(--danger) !important;
}

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

/* --- Top bar ------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar);
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}

/* A thin accent stripe under the top bar. */
.topbar::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 750;
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  border-radius: 8px;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent);
}

.brand span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.nav-toggle {
  display: none;
}

.search-button {
  justify-content: flex-start;
  gap: 8px;
  width: min(340px, 40vw);
  min-height: 36px;
  margin-inline-start: 24px;
  padding: 4px 8px 4px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
}

.search-button:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--text);
}

.search-label {
  flex: 1;
  text-align: start;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: auto;
}

.account {
  position: relative;
}

.account-button {
  gap: 8px;
  min-height: 38px;
  padding: 3px 8px 3px 4px;
  background: transparent;
  border: 1px solid transparent;
  font-weight: 600;
}

.account-button:hover,
.account-button[aria-expanded="true"] {
  background: var(--surface-2);
  border-color: var(--border);
}

.avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar.placeholder {
  display: inline-grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: color-mix(in srgb, var(--accent) 80%, var(--ink));
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.account-name {
  max-width: 18ch;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

/* Dropdowns: the account menu and the server switcher. */
.menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  min-width: 240px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  animation: pop 0.12s ease-out;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

.menu-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-weight: 500;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-2);
}

.menu-item .icon {
  color: var(--muted);
}

.menu-item select {
  min-height: 30px;
  padding: 2px 8px;
}

.main {
  margin: 0 auto;
  padding: 32px 20px 120px;
}

/* --- Controls ------------------------------------------------------------------ */

button,
.button,
select,
input,
textarea {
  font: inherit;
  color: inherit;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  overflow-wrap: break-word;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

button:active,
.button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Only a button waiting on a request shows the progress cursor (setBusy in app.js). */
button[aria-busy="true"] {
  cursor: progress;
}

.primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 65%, var(--accent-2)));
  color: var(--accent-text);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent);
}

.primary:hover {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 88%, var(--ink)), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
}

.ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
}

.ghost:hover {
  background: var(--surface-2);
}

.danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
}

.danger:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.small {
  min-height: 30px;
  padding: 2px 10px;
  font-size: 0.86rem;
}

/* "icon small" is a size, not a small button. */
svg.small {
  min-height: 0;
  padding: 0;
}

.big {
  min-height: 44px;
  padding: 10px 24px;
  font-size: 1.02rem;
}

.icon-button {
  min-height: 36px;
  width: 36px;
  padding: 0;
  background: transparent;
  border-color: var(--border);
}

.icon-button:hover {
  background: var(--surface-2);
}

.link-button {
  min-height: 0;
  padding: 2px 4px;
  background: none;
  color: var(--accent);
  font-weight: 600;
}

select,
input,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 7px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

select:hover,
input:hover,
textarea:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.language,
select.auto {
  width: auto;
}

textarea {
  resize: vertical;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* An on/off switch: <span class="switch"><input type="checkbox"></span>, or
   <label class="switch"><input type="checkbox"> text</label>. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.switch input {
  appearance: none;
  position: relative;
  flex: none;
  width: 40px;
  height: 22px;
  min-height: 0;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.switch input::before {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 30%);
  transition: inset-inline-start 0.15s ease;
}

.switch input:checked {
  background: var(--accent);
}

.switch input:checked::before {
  inset-inline-start: 20px;
}

/* --- Cards and layout ------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--pad);
}

.content > * + *,
form.settings > * + * {
  margin-top: var(--gap);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chip-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--tone, var(--accent)) 13%, transparent);
  color: color-mix(in srgb, var(--tone, var(--accent)) 85%, var(--ink));
}

.chip-icon.sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.chip-icon.sm .icon {
  width: 16px;
  height: 16px;
}

.chip-icon.lg {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.chip-icon.lg .icon {
  width: 22px;
  height: 22px;
}

/* Page headers and number tiles get a solid, glossy chip. */
.hero .chip-icon.lg,
.stat .chip-icon {
  background: linear-gradient(135deg, var(--tone, var(--accent)), color-mix(in srgb, var(--tone, var(--accent)) 60%, #1e1b4b));
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 25%),
    0 6px 16px color-mix(in srgb, var(--tone, var(--accent)) 35%, transparent);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.toolbar .help {
  margin: 0;
}

.toolbar input[type="search"] {
  flex: 1 1 200px;
  width: auto;
}

/* Page header: a tinted band in the page's color with a few soft shapes on the far side. */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 22px 24px;
  border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 22%, var(--border));
  border-radius: calc(var(--radius) + 4px);
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--tone, var(--accent)) 13%, var(--surface)) 0%, var(--surface) 70%);
  box-shadow: var(--shadow);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 28%;
  pointer-events: none;
  background: linear-gradient(135deg, var(--tone, var(--accent)), var(--accent-2));
  opacity: 0.12;
  transform: rotate(18deg);
}

.hero::before {
  width: 190px;
  height: 190px;
  inset-inline-end: -40px;
  top: -70px;
}

.hero::after {
  width: 96px;
  height: 96px;
  inset-inline-end: 150px;
  bottom: -58px;
  opacity: 0.08;
  transform: rotate(-12deg);
}

.hero h1 {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* The overview header, painted in the server's gradient with its icon. */
.hero-banner {
  border: none;
  color: #fff;
  box-shadow: 0 14px 34px rgb(16 24 40 / 16%);
}

.hero-banner::before {
  inset: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  transform: none;
  opacity: 1;
  background: radial-gradient(rgb(255 255 255 / 16%) 1.4px, transparent 1.6px) 0 0 / 16px 16px;
  mask-image: linear-gradient(100deg, transparent 35%, #000 85%);
}

.hero-banner::after {
  width: 220px;
  height: 220px;
  inset-inline-end: 40px;
  bottom: -150px;
  background: #fff;
  opacity: 0.12;
}

.hero.hero-banner p {
  color: rgb(255 255 255 / 85%);
}

.hero-banner .guild-icon {
  border: 3px solid rgb(255 255 255 / 85%);
  box-shadow: 0 8px 20px rgb(0 0 0 / 20%);
}

.hero-banner .guild-icon.placeholder {
  background: rgb(255 255 255 / 22%);
  color: #fff;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.hero p {
  margin: 4px 0 0;
  max-width: 75ch;
  color: var(--muted);
}

.hero-extra {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* On / off badge for a feature. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

.status.on {
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  border-color: color-mix(in srgb, var(--ok) 30%, transparent);
  color: color-mix(in srgb, var(--ok) 85%, var(--ink));
}

.status.on::before {
  opacity: 1;
}

.guide-soon {
  margin-left: 8px;
  vertical-align: middle;
}

/* "Coming soon": a feature that isn't out yet (the AI assistant). */
.status.soon,
.nav-soon {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: color-mix(in srgb, var(--accent) 85%, var(--ink));
}

.nav-soon {
  flex: none;
  padding: 1px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 650;
  white-space: nowrap;
}

.section-title {
  margin-top: 28px;
}

.login {
  max-width: 420px;
  margin: 10vh auto 0;
  padding: 36px 28px;
  text-align: center;
  display: grid;
  gap: 14px;
  justify-items: center;
}

/* The login card opens with an accent band behind the logo. */
.login {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-top: 52px;
}

.login::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 96px;
  z-index: -1;
  background:
    radial-gradient(rgb(255 255 255 / 20%) 1.3px, transparent 1.5px) 0 0 / 12px 12px,
    linear-gradient(120deg, var(--accent), var(--accent-2));
}

.login-art img {
  display: block;
  border: 4px solid var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lift);
}

.loading,
.empty {
  text-align: center;
  padding: 24px;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-inline-end: 8px;
  vertical-align: -3px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Placeholders while a page loads. */
.skeleton {
  display: grid;
  gap: 14px;
}

.sk {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.sk-title {
  width: 40%;
  height: 30px;
}

.sk-line {
  width: 65%;
  height: 14px;
  margin-bottom: 10px;
}

.sk-card {
  height: 180px;
  border-radius: var(--radius);
}

.sk-card.short {
  height: 110px;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.badge,
.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-accent {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
  color: color-mix(in srgb, var(--accent) 80%, var(--ink));
}

.badge-pink {
  background: rgb(236 72 153 / 12%);
  border-color: rgb(236 72 153 / 25%);
  color: color-mix(in srgb, #db2777 80%, var(--ink));
}

.badge-red {
  background: rgb(239 68 68 / 12%);
  border-color: rgb(239 68 68 / 25%);
  color: color-mix(in srgb, #dc2626 80%, var(--ink));
}

.badge-amber {
  background: rgb(245 158 11 / 13%);
  border-color: rgb(245 158 11 / 28%);
  color: color-mix(in srgb, #b45309 80%, var(--ink));
}

.badge-cyan {
  background: rgb(6 182 212 / 12%);
  border-color: rgb(6 182 212 / 25%);
  color: color-mix(in srgb, #0e7490 80%, var(--ink));
}

.badge-green {
  background: rgb(16 185 129 / 12%);
  border-color: rgb(16 185 129 / 25%);
  color: color-mix(in srgb, #047857 80%, var(--ink));
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* --- Servers -------------------------------------------------------------------- */

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap);
}

.server {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.server:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: var(--shadow-lift);
}

.server-banner {
  position: relative;
  height: 64px;
}

/* Halftone dots over the server gradient, fading in from the far side. */
.server-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(rgb(255 255 255 / 20%) 1.3px, transparent 1.5px) 0 0 / 12px 12px;
  mask-image: linear-gradient(100deg, transparent 30%, #000 90%);
}

.banner-muted.server-banner::after {
  content: none;
}

.server-body {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 14px;
}

.server-body .guild-icon {
  margin-top: -20px;
  border: 3px solid var(--surface);
}

.server.faded {
  opacity: 0.75;
}

.server-name {
  flex: 1;
  min-width: 0;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
  padding-top: 8px;
}

.server-body .badge {
  margin-top: 8px;
}

.banner-0 { background: linear-gradient(120deg, #6366f1, #ec4899); }
.banner-1 { background: linear-gradient(120deg, #06b6d4, #3b82f6); }
.banner-2 { background: linear-gradient(120deg, #f97316, #e11d48); }
.banner-3 { background: linear-gradient(120deg, #10b981, #84cc16); }
.banner-4 { background: linear-gradient(120deg, #8b5cf6, #06b6d4); }
.banner-5 { background: linear-gradient(120deg, #f59e0b, #ef4444); }
.banner-6 { background: linear-gradient(120deg, #ec4899, #f59e0b); }
.banner-7 { background: linear-gradient(120deg, #14b8a6, #6366f1); }
.banner-muted { background: repeating-linear-gradient(135deg, var(--surface-2) 0 12px, var(--border) 12px 24px); }

.guild-icon {
  flex: none;
  border-radius: 30%;
  object-fit: cover;
}

.guild-icon.xs {
  width: 24px;
  height: 24px;
  font-size: 0.65rem;
}

.guild-icon.sm {
  width: 34px;
  height: 34px;
  font-size: 0.75rem;
}

.guild-icon.md {
  width: 48px;
  height: 48px;
}

.guild-icon.lg {
  width: 56px;
  height: 56px;
}

.guild-icon.placeholder {
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 750;
}

/* --- One server: sidebar and pages ------------------------------------------------ */

.in-guild .main {
  max-width: none;
  padding: 0;
}

.guild-layout {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar));
}

.sidebar {
  position: sticky;
  top: var(--topbar);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - var(--topbar));
  height: calc(100dvh - var(--topbar));
  padding: 14px 12px 24px;
  overflow-y: auto;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  scrollbar-width: thin;
}

.content {
  width: 100%;
  padding: 28px 32px 120px;
}

/* On wide screens settings cards flow into two columns, filled top to bottom
   like a masonry wall, so pages use the whole width without gaps under short cards. */
.settings-cards > * + * {
  margin-top: var(--gap);
}

@media (min-width: 1400px) {
  .settings-cards {
    columns: 2;
    column-gap: var(--gap);
  }

  .settings-cards > * {
    break-inside: avoid;
    margin: 0 0 var(--gap);
  }

  .settings-cards > * + * {
    margin-top: 0;
  }

  /* Side-by-side editors with a live preview need the full width. */
  .settings-cards > .embed-layout,
  .settings-cards > .span-all {
    column-span: all;
  }

  /* A page with one card keeps it full width. */
  .settings-cards:has(> :only-child) {
    columns: auto;
  }
}

@media (min-width: 2300px) {
  .settings-cards:not(:has(> :only-child)) {
    columns: 3;
  }
}

.nav-scrim {
  display: none;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  font-weight: 600;
}

.switcher-wrap {
  position: relative;
}

.switcher {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: start;
}

.switcher:hover,
.switcher[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.switcher-text {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.switcher-text strong,
.switcher-text .muted {
  overflow-wrap: anywhere;
}

.switcher-text .muted {
  font-size: 0.78rem;
  font-weight: 500;
}

.switcher-menu {
  inset-inline: 0;
  min-width: 0;
}

.nav {
  display: grid;
  gap: 14px;
}

.nav-section {
  display: grid;
  gap: 1px;
}

.nav-heading {
  margin: 0 10px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Sidebar groups fold open and shut from their heading. */
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 8px);
  min-height: 28px;
  margin: 0 4px 2px;
  padding: 4px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  box-shadow: none;
  text-align: start;
  cursor: pointer;
}

.nav-group-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-count {
  min-width: 1.6em;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.68rem;
  letter-spacing: 0;
  text-align: center;
}

.nav-chevron {
  transition: transform 0.15s ease;
}

.collapsible-nav.collapsed .nav-chevron {
  transform: rotate(-90deg);
}

[dir="rtl"] .collapsible-nav.collapsed .nav-chevron {
  transform: rotate(90deg);
}

.collapsible-nav:not(.collapsed) .nav-count {
  visibility: hidden;
}

.collapsible-nav.collapsed > .nav-link {
  display: none;
}

.nav:has(.collapsible-nav) {
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  color: color-mix(in srgb, var(--text) 85%, var(--muted));
  text-decoration: none;
  font-weight: 550;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link.active {
  position: relative;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent) 4%, transparent));
  color: color-mix(in srgb, var(--accent) 85%, var(--ink));
  font-weight: 650;
}

.nav-link.active::before {
  content: "";
  position: absolute;
  inset-block: 7px;
  inset-inline-start: -12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(var(--accent), var(--accent-2));
}

[dir="rtl"] .nav-link.active::before {
  border-radius: 4px 0 0 4px;
}

/* Each page keeps its own color in the sidebar. */
.nav-icon {
  display: inline-grid;
  place-items: center;
  color: color-mix(in srgb, var(--tone) 80%, var(--muted));
}

.nav-link:hover .nav-icon {
  color: var(--tone);
}

.nav-link.active .nav-icon {
  color: inherit;
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent);
}

.sidebar-note {
  margin: 0 6px;
}

/* --- Search (Ctrl+K) -------------------------------------------------------------- */

dialog.search {
  width: min(620px, calc(100vw - 24px));
  margin: 12vh auto auto;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

.search-input,
.search-input:focus,
.search-input:hover {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 6px 0;
  font-size: 1.05rem;
  color: var(--text);
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: min(420px, 55vh);
  overflow-y: auto;
}

.search-results li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.search-results li > .grow {
  display: grid;
  line-height: 1.3;
}

.search-results li .muted {
  font-size: 0.8rem;
}

.search-results li.selected {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.search-results li.empty {
  justify-content: center;
  cursor: default;
}

/* Keyboard shortcuts ("?") */
dialog.shortcuts {
  width: min(420px, calc(100vw - 32px));
  padding: 20px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
}

dialog.shortcuts h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.shortcut-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
  align-items: center;
  margin: 0 0 16px;
}

.shortcut-list dt {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.shortcut-list dd {
  margin: 0;
}

/* Pinned pages at the top of the sidebar */
.nav-pinned {
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}

.pin-page[aria-pressed="true"] {
  color: var(--accent);
}

/* --- Overview -------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--gap);
}

.stat {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 6px;
  color: var(--text);
  text-decoration: none;
  background:
    radial-gradient(160px 110px at 100% 0%, color-mix(in srgb, var(--tone) 13%, transparent), transparent 70%),
    var(--surface);
}

/* A strip of the tile's color along the top. */
.stat::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--tone), color-mix(in srgb, var(--tone) 30%, var(--accent-2)));
}

a.stat {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

a.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

a.stat:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.stat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-weight: 550;
  color: var(--muted);
  font-size: 0.86rem;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 8px;
}

.feature {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 550;
  text-decoration: none;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.feature:hover {
  border-color: color-mix(in srgb, var(--tone, var(--accent)) 45%, var(--border));
  background: color-mix(in srgb, var(--tone, var(--accent)) 6%, var(--surface));
}

.feature.on {
  border-color: color-mix(in srgb, var(--tone) 35%, var(--border));
  background: linear-gradient(120deg, color-mix(in srgb, var(--tone) 11%, var(--surface)), var(--surface) 80%);
}

/* A feature tile with a quick on/off switch: the switch sits over the status pill's spot. */
.feature-cell {
  position: relative;
  display: grid;
}

.feature-cell .feature {
  padding-inline-end: 62px;
}

.feature-cell .feature .status {
  display: none;
}

.feature-switch {
  position: absolute;
  inset-inline-end: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.checkup-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.checkup-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--amber, #f59e0b) 35%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--amber, #f59e0b) 7%, var(--surface));
}

.checkup-list li > svg {
  flex: none;
  color: var(--amber, #f59e0b);
}

.checkup-list li > .grow {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.checkup.ok {
  padding-block: 12px;
}

/* A page's permission warning (permissionSlot in app.js). */
.perm-warn {
  border-color: color-mix(in srgb, var(--amber, #f59e0b) 45%, var(--border));
}

.perm-warn.soft {
  border-color: var(--border);
}

.perm-warn .checkup-list li.optional {
  border-style: dashed;
  background: var(--surface);
}

.perm-warn .checkup-list li.optional > svg {
  color: var(--muted, currentColor);
}

.perm-warn-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0 0;
}

.perm-warn-foot .help {
  flex: 1 1 240px;
  min-width: 0;
}

.checkup-ok {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.activity-filters {
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.activity-filters select {
  flex: 0 1 14em;
}

.activity-filters input {
  flex: 1 1 14em;
  min-width: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: var(--gap);
}

.grid-2 > .card {
  margin: 0;
}

/* --- Developer section (/dev) ---------------------------------------------------- */

.dev-page {
  display: grid;
  gap: var(--gap);
  max-width: 1500px;
  margin: 0 auto;
  min-width: 0;
}

.dev-page > .hero {
  margin-bottom: 0;
}

.dev-tabs {
  justify-self: start;
}

.dev-tabs .segment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  border-radius: 9px;
}

.dev-tabs .segment[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dev-body,
.dev-stack {
  display: grid;
  gap: var(--gap);
  min-width: 0;
}

.dev-toolbar {
  flex-wrap: wrap;
  align-items: center;
}

.dev-toolbar select {
  width: auto;
  flex: 0 1 auto;
}

.dev-body > button {
  justify-self: center;
}

.dev-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1000px) {
  .dev-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dev-stack > .card {
  margin: 0;
}

.dev-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.dev-note.warn {
  color: var(--text);
  border-color: color-mix(in srgb, #f59e0b 45%, var(--border));
  background: color-mix(in srgb, #f59e0b 10%, var(--surface));
}

.dev-subtitle {
  margin: 18px 0 8px;
  font-size: 0.95rem;
}

.dev-kvs {
  display: grid;
  gap: 6px;
  margin: 0;
}

.dev-kv {
  display: grid;
  grid-template-columns: minmax(8em, 12em) minmax(0, 1fr);
  gap: 12px;
}

.dev-kv dt {
  color: var(--muted);
}

.dev-kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* A row of bars (commands per day, errors per hour). */
.dev-bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: end;
  gap: 3px;
  height: 84px;
  margin-bottom: 14px;
}

.dev-bar {
  height: var(--fill);
  min-height: 2px;
  border-radius: 3px 3px 1px 1px;
  background: var(--tone);
}

.dev-bar.zero {
  background: var(--surface-3);
}

.dev-errors,
.dev-list {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.dev-errors li {
  display: grid;
  gap: 2px;
  font-size: 0.9rem;
}

.dev-errors code {
  overflow-wrap: anywhere;
}

.dev-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dev-list li > a,
.dev-list li > span.grow {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dev-list time {
  flex: none;
  font-size: 0.85rem;
}

.dev-guild-link {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.dev-guild-link:hover .grow {
  text-decoration: underline;
}

.dev-servers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr));
  gap: var(--gap);
}

.dev-server {
  display: grid;
  gap: 12px;
  margin: 0;
  align-content: start;
  min-width: 0;
}

.dev-server-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.dev-server-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  flex: 1;
  min-width: 0;
}

.dev-server-name strong {
  flex-basis: 100%;
  overflow-wrap: anywhere;
}

.dev-server-name code {
  font-size: 0.8rem;
}

.dev-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px 16px;
}

.dev-fact {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dev-fact-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.dev-fact-value {
  overflow-wrap: anywhere;
}

.dev-fact-value code {
  font-size: 0.75rem;
}

.dev-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dev-invite {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dev-invite-link {
  flex: 1 1 14em;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

.dev-invite .help {
  flex-basis: 100%;
  margin: 0;
}

/* Above a server's pages when a developer opened it without managing it. */
.dev-view-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--gap);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, #8b5cf6 45%, var(--border));
  background: color-mix(in srgb, #8b5cf6 10%, var(--surface));
}

.dev-view-banner .grow {
  min-width: 12em;
}

@media (max-width: 600px) {
  .dev-kv {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .dev-server-head {
    flex-wrap: wrap;
  }

  .dev-server-head .button {
    width: 100%;
    justify-content: center;
  }

  .dev-list li {
    flex-wrap: wrap;
  }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.legend-chip {
  min-height: 28px;
  padding: 2px 11px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--act) 40%, transparent);
  background: color-mix(in srgb, var(--act) 12%, transparent);
  color: color-mix(in srgb, var(--act) 70%, var(--ink));
  font-size: 0.84rem;
}

.legend-chip[aria-pressed="false"] {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--act);
}

.legend-chip[aria-pressed="false"] .legend-dot {
  background: var(--border);
}

.chart {
  position: relative;
  padding-top: 18px;
}

.chart svg {
  display: block;
  width: 100%;
  height: 190px;
  overflow: visible;
}

.chart .grid {
  stroke: var(--border);
  stroke-dasharray: 3 4;
  vector-effect: non-scaling-stroke;
}

.chart .seg {
  fill: var(--act);
}

.chart .bar-hit {
  fill: transparent;
}

.chart .bar:hover .bar-hit {
  fill: color-mix(in srgb, var(--accent) 8%, transparent);
}

.chart-max {
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.meters {
  display: grid;
  gap: 8px;
}

.meter-row {
  display: grid;
  grid-template-columns: minmax(90px, 9rem) 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}

.meter-row:hover {
  background: var(--surface-2);
}

.meter-label {
  font-weight: 550;
  font-size: 0.9rem;
}

.meter,
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.meter-fill,
.progress-fill {
  display: block;
  height: 100%;
  width: var(--fill);
  border-radius: inherit;
}

.meter-fill {
  background: var(--act);
}

.meter-fill.command-fill {
  background: var(--accent);
}

.progress-fill {
  background: var(--accent);
}

.meter-value {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* Every row shares one label column, as wide as the longest label up to 60% of
   the card, so names like "/quarantine release" stay on one line and all the
   bars start at the same place. */
.meters.aligned {
  grid-template-columns: fit-content(60%) minmax(48px, 1fr) auto;
  column-gap: 12px;
}

.meters.aligned > .meter-row {
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
}

.meters.aligned .meter-value {
  text-align: end;
}

.leaders,
.recent,
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.leaders a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}

.leaders a:hover {
  background: var(--surface-2);
}

.rank {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 700;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.rank-1 { background: #fde68a; color: #78350f; }
.rank-2 { background: #e2e8f0; color: #1e293b; }
.rank-3 { background: #fed7aa; color: #7c2d12; }

.leader-name {
  flex: 1;
  min-width: 0;
  font-weight: 550;
  overflow-wrap: anywhere;
}

.recent {
  margin-bottom: 12px;
}

.recent li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.recent li:last-child {
  border-bottom: none;
}

.recent-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.recent-text > * {
  overflow-wrap: anywhere;
}

.recent-text .muted {
  font-size: 0.85rem;
}

.recent-date {
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Overview: each latest case is one link to that case. */
.recent-links li {
  display: block;
  padding: 0;
}

.recent-link {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 -8px;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}

.recent-link:hover {
  background: var(--surface-2);
}

.recent-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.recent-link .pill {
  flex: none;
  min-width: 5.5em;
  text-align: center;
}

.recent-link .recent-date {
  display: grid;
  justify-items: end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

.recent-number {
  font-weight: 650;
}

.recent-chevron {
  flex: none;
  color: var(--muted);
  transition: transform 0.15s ease, color 0.15s ease;
}

.recent-link:hover .recent-chevron,
.recent-link:focus-visible .recent-chevron {
  color: var(--accent);
  transform: translateX(2px);
}

:dir(rtl) .recent-chevron {
  transform: scaleX(-1);
}

:dir(rtl) .recent-link:hover .recent-chevron,
:dir(rtl) .recent-link:focus-visible .recent-chevron {
  transform: scaleX(-1) translateX(2px);
}

/* Overview: the five list cards in fixed places, sized by the space the
   content area has (not the window, since the sidebar takes some of it). Cards
   in a row stretch to the same height. */
.overview-lists-frame {
  container-type: inline-size;
}

.overview-lists {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
}

.overview-lists > .card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
}

.overview-lists > .card > .button {
  align-self: flex-start;
  margin-top: auto;
}

@container (min-width: 620px) {
  .overview-lists {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-lists .ol-recent {
    grid-column: 1 / -1;
  }

  .overview-lists:not(.has-commands) .ol-actions {
    grid-column: 1 / -1;
    order: 1;
  }
}

@container (min-width: 1100px) {
  .overview-lists {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .overview-lists.has-commands .ol-recent { grid-column: span 7; }
  .overview-lists.has-commands .ol-commands { grid-column: span 5; }
  .overview-lists.has-commands :is(.ol-actions, .ol-mods, .ol-members) { grid-column: span 4; }

  .overview-lists:not(.has-commands) .ol-recent { grid-column: span 8; }
  .overview-lists:not(.has-commands) .ol-actions { grid-column: span 4; order: 0; }
  .overview-lists:not(.has-commands) :is(.ol-mods, .ol-members) { grid-column: span 6; }
}

/* One case in a window (Cases page, ?case=12). */
dialog.case-window {
  width: min(580px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
  border-top: 4px solid var(--act);
}

.case-window-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px 20px;
  border-bottom: 1px solid var(--border);
}

.case-window-head h2 {
  flex: 1;
  margin: 0;
  font-size: 1.15rem;
}

.case-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 12px 20px;
  margin: 0;
  padding: 16px 20px;
}

.case-facts dt {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.case-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.case-facts .case-reason {
  white-space: pre-wrap;
}

.case-person {
  display: inline-grid;
  margin-inline-end: 10px;
}

.case-person .name {
  font-weight: 700;
}

.case-person .id {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.case-window-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}

.case-number-link {
  font-weight: 650;
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 3px;
}

.case-number-link:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.setup .toolbar {
  margin-bottom: 8px;
}

.setup .card-title {
  margin: 0;
}

.steps {
  margin-top: 12px;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}

.step-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  color: #fff;
}

.steps li.done .step-mark {
  background: var(--ok);
  border-color: var(--ok);
}

.steps li.done > .grow,
.steps li.skipped > .grow {
  color: var(--muted);
}

.steps li.skipped > .grow {
  text-decoration: line-through;
}

.step-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.setup.folded .toolbar {
  margin-bottom: 0;
}

/* --- Activity --------------------------------------------------------------------- */

.activity {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.activity-row {
  display: flex;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}

.activity-row:last-child {
  border-bottom: none;
}

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.activity-head a {
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
}

.activity-head .muted {
  font-size: 0.82rem;
}

.activity-summary {
  margin: 2px 0 0;
}

.activity-lines {
  margin: 6px 0 0;
  padding-inline-start: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

/* --- Settings --------------------------------------------------------------------- */

.field {
  display: grid;
  gap: 5px;
  margin-bottom: 16px;
  max-width: 760px;
}

.field:last-child {
  margin-bottom: 0;
}

.field .help {
  margin: 0;
}

.field-label {
  font-weight: 700;
}

.switch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.switch-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
}

.switch-card:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.switch-text {
  display: grid;
  gap: 2px;
}

.switch-text .help {
  margin: 0;
}

.checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 4px 16px;
}

.checks.scroll {
  max-height: 340px;
  overflow-y: auto;
  padding: 10px;
  background: var(--surface-2);
  border-radius: 12px;
}

.checks .empty {
  grid-column: 1 / -1;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 2px 6px;
  border-radius: 8px;
  cursor: pointer;
}

.check:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.check input {
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  accent-color: var(--accent);
  flex: none;
}

.check-list .link-button {
  font-size: 0.85rem;
}

.check span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.role-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--role-color, #99aab5);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--role-color, #99aab5) 25%, transparent);
}

.save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--border));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 25%, transparent), var(--shadow-lift);
  font-weight: 700;
  animation: rise 0.18s ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* --- Tables (cases, roles) -------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
}

.table-wrap.flush {
  padding: 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  padding: 10px 12px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-2);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover td {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.cases .act-row td:first-child {
  border-inline-start: 4px solid var(--act);
}

.cases .number {
  white-space: nowrap;
}

.cases .date {
  min-width: 110px;
  font-size: 0.85rem;
  color: var(--muted);
}

.cases .number {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.cases .person {
  min-width: 130px;
}

.person-button {
  display: grid;
  justify-items: start;
  gap: 0;
  min-height: 0;
  padding: 2px 6px;
  margin: -2px -6px;
  border-radius: 8px;
  background: none;
  font-weight: inherit;
  text-align: start;
}

.person-button:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.person-button .name {
  font-weight: 700;
  word-break: break-word;
}

.person-button .id {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.cases .reason {
  min-width: 180px;
  white-space: pre-wrap;
  word-break: break-word;
}

.action-cell {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.duration {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.row-actions {
  display: grid;
  gap: 6px;
  white-space: nowrap;
}

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  background: color-mix(in srgb, var(--act) 16%, transparent);
  color: color-mix(in srgb, var(--act) 68%, var(--ink));
}

/* Roles grouped by their exact permissions (Permissions page). */
.perm-groups {
  display: grid;
  gap: 6px;
}

.perm-group-section {
  margin: 12px 0 2px;
  font-size: 0.9rem;
}

.perm-group-section:first-child {
  margin-top: 4px;
}

.perm-group {
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.perm-group.kind-admin {
  border-inline-start-color: rgb(239 68 68 / 70%);
}

.perm-group.kind-power {
  border-inline-start-color: rgb(245 158 11 / 70%);
}

.perm-group > summary {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.perm-group > summary::-webkit-details-marker {
  display: none;
}

.perm-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.perm-group-head .badges {
  flex: 1;
  min-width: 0;
}

/* The arrow that shows a group opens. */
.perm-group-head::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.perm-group[open] .perm-group-head::after {
  transform: rotate(-135deg);
}

.perm-group-everyday {
  font-size: 0.82rem;
}

/* An open group lists all its roles below, so the preview hides. */
.perm-group[open] .perm-group-preview {
  display: none;
}

.perm-group .role-chip {
  background: var(--surface);
}

.perm-group .role-chip .badge {
  padding: 0 6px;
  font-size: 0.72rem;
}

.perm-group .role-chip.more {
  color: var(--muted);
}

.perm-group-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.perm-group-body h4 {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.perm-group-lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 16px;
}

.perm-group-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

/* --- Case filters ----------------------------------------------------------------- */

.filter-panel .legend {
  margin-bottom: 4px;
}

.more-filters summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
  margin-top: 8px;
  width: fit-content;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.filter-grid .field {
  margin: 0;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.filter-chip {
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: color-mix(in srgb, var(--accent) 80%, var(--ink));
  font-size: 0.82rem;
}

.filter-chip:hover {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: var(--danger);
}

.push-end {
  margin-inline-start: auto;
}

/* --- Dialogs and messages ------------------------------------------------------- */

dialog {
  width: min(520px, calc(100vw - 32px));
  color: var(--text);
}

dialog::backdrop {
  background: rgb(10 10 20 / 55%);
  backdrop-filter: blur(3px);
}

dialog textarea {
  margin-top: 4px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 3px;
  gap: 3px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.segment {
  min-height: 32px;
  padding: 4px 14px;
  background: none;
  color: var(--muted);
}

.segment[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatch {
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}

.swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 3px var(--text);
}

.accent-blurple { --swatch: #5865f2; }
.accent-violet { --swatch: #7c3aed; }
.accent-pink { --swatch: #db2777; }
.accent-orange { --swatch: #ea580c; }
.accent-gold { --swatch: #b45309; }
.accent-green { --swatch: #059669; }
.accent-cyan { --swatch: #0891b2; }
.accent-red { --swatch: #e11d48; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  box-shadow: var(--shadow-lift);
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

.toast.warn {
  background: var(--amber, #f59e0b);
  color: #1f1300;
}

/* --- Small screens ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .in-guild .nav-toggle {
    display: inline-flex;
  }

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

  .sidebar {
    position: fixed;
    inset-block: var(--topbar) 0;
    inset-inline-start: 0;
    z-index: 40;
    width: min(300px, 86vw);
    /* Stretch between the top bar and the bottom of the screen. The desktop
       align-self: start also applies to fixed boxes in current browsers, and
       would size the drawer to all its links, leaving nothing to scroll. */
    align-self: stretch;
    height: auto;
    max-height: none;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg, 0 10px 40px rgba(0, 0, 0, 0.25));
  }

  [dir="rtl"] .sidebar {
    transform: translateX(105%);
  }

  .nav-open .sidebar {
    transform: none;
  }

  .nav-open .nav-scrim {
    display: block;
    position: fixed;
    inset: var(--topbar) 0 0 0;
    z-index: 39;
    width: auto;
    height: auto;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.45);
  }

  .content {
    padding: 20px 16px 120px;
  }

  .search-button {
    width: auto;
    margin-inline-start: auto;
  }

  .search-button .search-label,
  .search-button kbd {
    display: none;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding-inline: 12px;
  }

  .brand span {
    display: none;
  }

  .hero {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .hero-text {
    flex-basis: calc(100% - 64px);
  }

  .hero-extra {
    width: 100%;
  }

  h1 {
    font-size: 1.35rem;
  }

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

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .push-end {
    margin-inline-start: 0;
  }
}

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

/* --- Automod ---------------------------------------------------------------------- */

.rules {
  display: grid;
  gap: 10px;
}

.rule {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.rule:has(.rule-head input:checked) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.rule-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  align-items: start;
  gap: 12px;
  margin-top: 12px;
}

.rule-body .field {
  margin-bottom: 0;
}

/* Time zone picker: a button showing the chosen zone, opening a search box,
   quick picks and every zone grouped by region (offset and time there now). */
.tz-field {
  margin-top: 16px;
}

.tz-trigger {
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 7px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  color: var(--text);
  font-weight: 400;
  text-align: start;
}

.tz-trigger:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.tz-field.open .tz-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.tz-summary {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  min-width: 0;
}

.tz-summary .muted {
  font-size: 0.85rem;
}

.tz-chevron {
  transition: transform 0.15s ease;
}

.tz-field.open .tz-chevron {
  transform: rotate(180deg);
}

.tz-panel {
  display: grid;
  gap: 8px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  animation: pop 0.12s ease-out;
}

.tz-panel[hidden] {
  display: none;
}

.tz-search {
  position: relative;
  display: flex;
  align-items: center;
}

.tz-search > .icon {
  position: absolute;
  inset-inline-start: 11px;
  color: var(--muted);
  pointer-events: none;
}

.tz-search input {
  padding-inline-start: 36px;
}

.tz-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tz-quick:empty {
  display: none;
}

.tz-chip {
  min-height: 30px;
  padding: 4px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}

.tz-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.tz-chip.on {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-color: var(--accent);
}

.tz-list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(340px, 50vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tz-group {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 10px 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tz-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 8rem 16px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tz-option.active {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.tz-option[aria-selected="true"] .tz-city {
  font-weight: 700;
}

.tz-city {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tz-offset {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.tz-time {
  font-size: 0.85rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: end;
}

.tz-tick {
  color: var(--accent);
}

.tz-list .empty {
  padding: 16px;
  text-align: center;
}

.tz-count {
  font-size: 0.8rem;
  text-align: end;
}

@media (max-width: 520px) {
  .tz-option {
    grid-template-columns: minmax(0, 1fr) auto 16px;
    row-gap: 0;
  }

  .tz-time {
    grid-row: 2;
    grid-column: 1;
    text-align: start;
  }

  .tz-tick {
    grid-row: 1;
    grid-column: 3;
  }
}

.rule-body .field.wide {
  grid-column: 1 / -1;
  max-width: none;
}

.rule:not(:has(.rule-head input:checked)) .rule-body {
  opacity: 0.6;
}

/* Simple view: presets and one switch per rule. */
.am-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
}

.am-preset {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  text-align: start;
  white-space: normal;
  cursor: pointer;
}

.am-preset:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.am-preset[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

.am-preset-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.am-preset .help {
  margin: 0;
}

.am-points {
  margin: 4px 0 0;
  padding-inline-start: 18px;
  font-size: 0.85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.am-points li + li {
  margin-top: 2px;
}

.am-points strong {
  color: var(--text);
  font-weight: 600;
}

.am-quick-rules {
  display: grid;
  gap: 8px;
}

.am-quick-rule strong {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.am-quick-rule .badge {
  font-weight: 500;
}

/* Advanced view: each rule's fine-tuning, folded away until opened. */
.am-fine-tune {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}

.am-fine-tune > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.am-fine-tune[open] > summary {
  color: var(--text);
}

.am-fine-tune-body {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.am-fine-tune-body .field,
.am-fine-tune-body .field-label {
  margin: 0;
}

/* --- Community ------------------------------------------------------------------ */

.message-box {
  display: grid;
  gap: 2px;
}

.char-count {
  justify-self: end;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* The variable picker under message boxes (variableTools in app.js). */
.message-with-variables {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.variable-tools {
  display: grid;
  gap: 6px;
}

.variable-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.variable-bar-label {
  font-size: 12px;
  color: var(--muted);
  margin-inline-end: 2px;
  cursor: help;
}

button.variable-chip {
  min-height: 0;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  cursor: pointer;
}

button.variable-chip:hover,
button.variable-chip:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
}

.variable-warning {
  display: grid;
  gap: 2px;
  font-size: 13px;
  color: var(--danger);
}

.variable-warning[hidden],
.variable-preview[hidden] {
  display: none;
}

.variable-warning > span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.variable-preview {
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.variable-preview-label {
  font-weight: 600;
  margin-inline-end: 6px;
}

textarea.has-variable-problem,
input.has-variable-problem {
  border-color: var(--danger);
}

.panel-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  font-size: 0.85rem;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 10px;
}

.panel-list li {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.panel-list .badge {
  background: var(--surface);
  border: 1px solid var(--border);
}

/* Role panel editor: the form beside a Discord-style preview. */
.role-panel-heading {
  margin: 4px 0 12px;
  font-size: 1rem;
}

.role-panel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
  gap: 20px;
  align-items: start;
}

.role-panel-side {
  display: grid;
  gap: 8px;
  position: sticky;
  top: 16px;
}

/* Color roles: one row per color, and the list picture on a checkerboard so
   its transparent background shows. */
.color-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.color-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.color-row > input.grow {
  min-width: 140px;
  flex: 1 1 160px;
}

.color-number {
  min-width: 2.5em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.color-swatch {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.color-inputs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.color-inputs input[type="color"],
.check.inline {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

/* Color roles: the create wizard */
.color-samples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.color-sample {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  min-width: 0;
}

.color-sample.dark {
  background: #313338;
  color: #dbdee1;
}

.color-sample.light {
  background: #ffffff;
  color: #313338;
}

.color-sample .muted {
  color: inherit;
  opacity: 0.7;
}

.color-sample-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.color-sample-name.gradient {
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

.color-wizard textarea {
  font-family: var(--font-mono, ui-monospace, monospace);
}

.color-review .color-row code {
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

.color-problems {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.color-problem {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--danger);
}

.color-problem .icon {
  flex: none;
  margin-top: 2px;
}

.color-preview-image {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: #36393f;
  background-image: linear-gradient(45deg, #2f3136 25%, transparent 25%, transparent 75%, #2f3136 75%),
    linear-gradient(45deg, #2f3136 25%, transparent 25%, transparent 75%, #2f3136 75%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

.role-panel-roles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.role-panel-role {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.role-panel-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 120px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.role-panel-role .role-panel-emoji {
  width: 7.5rem;
}

.role-panel-role .role-panel-label {
  min-width: 140px;
  flex: 1 1 160px;
}

.role-panel-role .row-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 4px;
  margin-left: auto;
}

.role-panel-editor > .toolbar {
  margin-top: 16px;
}

@media (max-width: 860px) {
  .role-panel-layout {
    grid-template-columns: 1fr;
  }

  .role-panel-side {
    position: static;
  }
}

/* --- Custom commands ------------------------------------------------------------ */

.tag-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.tag-row {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.tag-row input,
.tag-row textarea {
  background: var(--surface);
}

.tag-slash {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}

.tag-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.tag-row .toolbar {
  flex-wrap: nowrap;
}

.tag-list,
.tag-row {
  min-width: 0;
}

.tag-row .tag-name {
  width: 0;
  min-width: 0;
  flex: 1;
}

/* Templates: ready-made custom commands and auto-responders. */
.template-example {
  margin: 0 0 12px;
  padding: 8px 12px;
  font-size: 0.86rem;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.template-tile {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.template-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.template-icon {
  font-size: 1.3rem;
  line-height: 1.6rem;
}

.template-text {
  display: grid;
  min-width: 0;
}

.template-preview {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.template-body {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.tag-row.template-new {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
  transition: box-shadow 0.3s, border-color 0.3s;
}

.responder-row .toolbar {
  flex-wrap: wrap;
}

.responder-row .responder-trigger {
  flex: 1 1 180px;
  min-width: 0;
}

.responder-row select {
  width: auto;
}

.responder-row .responder-channel select {
  max-width: 220px;
}

@media (max-width: 560px) {
  .responder-row .responder-match,
  .responder-row .responder-channel,
  .responder-row .responder-channel select {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
  }
}

.boost-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.boost-row select {
  width: 100%;
}

.boost-row .boost-multiplier {
  width: 80px;
}

/* --- Scheduled messages ----------------------------------------------------------- */

.scheduled-form .grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: start;
  margin-bottom: 12px;
}

.scheduled-form textarea {
  width: 100%;
}

.scheduled-actions {
  justify-content: flex-end;
}

.scheduled-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.scheduled-row {
  min-width: 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.scheduled-content {
  margin: 8px 0 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* --- Members ---------------------------------------------------------------------- */

.tip.danger {
  background: rgb(239 68 68 / 10%);
  border-color: color-mix(in srgb, #ef4444 40%, var(--border));
}

.stack {
  display: grid;
  gap: var(--gap);
  align-content: start;
}

.stack > .card {
  margin: 0;
}

.member-avatar {
  flex: none;
  border-radius: 50%;
  object-fit: cover;
}

.member-avatar.md {
  width: 40px;
  height: 40px;
}

.member-avatar.lg {
  width: 72px;
  height: 72px;
}

.member-avatar.placeholder {
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.member-avatar.lg.placeholder {
  font-size: 1.5rem;
}

.member-names {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.member-names > * {
  overflow-wrap: anywhere;
}

.member-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.member-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.member-header .badges {
  margin-top: 6px;
}

.member-list {
  list-style: none;
  margin: 0;
  padding: 6px;
}

.member-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}

.member-list a:hover {
  background: var(--surface-2);
}

.member-list .member-names {
  flex: 1;
}

.member-list .muted {
  font-size: 0.85rem;
}

.member-grid {
  align-items: start;
}

/* Members page list: a grid of columns on wide screens, cards on phones. */
.member-filters .member-filter-row {
  margin: 10px 0 8px;
}

.member-flag[hidden],
.member-filters .field[hidden] {
  display: none;
}

.member-table {
  overflow: hidden;
  padding: 0;
}

.member-flag {
  --act: var(--tone);
}

.member-table[aria-busy="true"] .member-rows {
  opacity: 0.55;
  transition: opacity 0.15s;
}

.member-row {
  display: grid;
  grid-template-columns: minmax(200px, 2.4fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(140px, 2fr) minmax(110px, 1.2fr);
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
}

.member-table.left .member-row {
  grid-template-columns: minmax(200px, 2.4fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(110px, 1.2fr);
}

.member-head {
  padding-block: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.member-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.member-rows li + li {
  border-top: 1px solid var(--border);
}

a.member-row:hover,
a.member-row:focus-visible {
  background: var(--surface-2);
}

.member-who {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.member-who .member-names {
  flex: 1;
}

.member-name-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.member-who .muted {
  font-size: 0.85rem;
}

.member-cell {
  min-width: 0;
  font-size: 0.9rem;
}

.member-roles,
.member-cases {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.role-chip.small {
  padding: 1px 8px;
  font-size: 0.78rem;
  max-width: 100%;
}

.role-chip.small .role-name {
  overflow-wrap: anywhere;
}

.role-chip.more {
  color: var(--muted);
}

.member-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px 16px;
  text-align: center;
}

.member-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.pager-numbers {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.member-pager button.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.member-pager .pager-of {
  font-size: 0.85rem;
}

@media (max-width: 760px) {
  .member-head {
    display: none;
  }

  .member-row,
  .member-table.left .member-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px 14px;
  }

  .member-who,
  .member-roles,
  .member-cases {
    grid-column: 1 / -1;
  }

  .member-cell[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex-basis: 100%;
  }

  .member-pager .pager-word,
  .member-pager .pager-of {
    display: none;
  }

  .member-filters .filter-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* Roles and cases explain themselves; "no cases" is left out to keep cards short. */
  .member-roles[data-label]::before,
  .member-cases[data-label]::before {
    display: none;
  }

  .member-cases.muted {
    display: none;
  }
}

.member-summary {
  margin-bottom: 12px;
}

.timeline {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 0;
}

.timeline li {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  position: relative;
  padding-bottom: 14px;
}

.timeline li:not(:last-child)::before {
  content: "";
  position: absolute;
  inset-inline-start: 6px;
  top: 16px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-dot {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--act, var(--accent));
}

.timeline-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.timeline-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
}

.timeline-reason {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.timeline-by {
  font-size: 0.8rem;
}

.role-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.history-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* --- Leveling --------------------------------------------------------------------- */

.reward-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
  min-width: 0;
}

.reward-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}

.reward-row input,
.reward-row select {
  background: var(--surface);
}

.reward-row .reward-level {
  width: 5.5em;
  flex: none;
}

.reward-role {
  min-width: 0;
}

.threshold-row {
  flex-wrap: wrap;
  align-items: flex-start;
}

/* A step reads as a sentence: "When a member gets [3] warnings within [30] days → [Time out] for [1] [hours]". */
.threshold-sentence {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

.threshold-part {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.threshold-part > span {
  white-space: nowrap;
}

.threshold-part input {
  width: 4.5em;
}

.threshold-row select {
  width: auto;
  min-width: 0;
}

.threshold-row > button {
  margin-inline-start: auto;
}

/* What counts as a warning, and what doesn't. */
.step-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.step-counts-col {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
}

.step-counts-col strong {
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-counts-green strong .icon {
  color: #10b981;
}

.step-counts-muted strong .icon {
  color: var(--muted);
}

.step-counts-col ul {
  margin: 6px 0 0;
  padding-inline-start: 18px;
  color: var(--muted);
}

/* "What this means": the steps as sentences. */
.step-preview {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-size: 14px;
}

.step-preview ol {
  margin: 6px 0 0;
  padding-inline-start: 20px;
}

.step-preview li + li {
  margin-top: 3px;
}

.step-preview .help {
  margin: 8px 0 0;
}

.step-problem {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  color: #dc2626;
  font-weight: 600;
}

.step-suggest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.step-suggest .help {
  flex: 1 1 260px;
  margin: 0;
}

.am-warn-steps .link-button {
  display: inline-block;
  margin-top: 8px;
}

.reward-role select {
  width: 100%;
}

.leaderboard {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.leaderboard li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  min-width: 0;
}

.leaderboard li:nth-child(odd) {
  background: var(--surface-2);
}

.board-rank {
  width: 2.5em;
  flex: none;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.board-name {
  display: grid;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.board-name strong,
.board-name .muted {
  overflow-wrap: anywhere;
}

.board-name:hover strong {
  text-decoration: underline;
}

.board-progress {
  width: 120px;
  flex: none;
}

.pager {
  margin-top: 12px;
}

.center {
  text-align: center;
}

@media (max-width: 600px) {
  .board-progress {
    display: none;
  }

  .reward-row {
    flex-wrap: wrap;
  }

  .reward-role {
    flex-basis: 100%;
    order: 3;
  }
}

.leaderboard .progress {
  background: var(--border);
}

.leaderboard .badge {
  min-width: 5.5em;
  text-align: center;
}

/* --- Tickets ---------------------------------------------------------------------- */

/* --- Staff statistics -------------------------------------------------------------- */

/* Each kind of staff work, in the activity chart and its legend. */
.sk-cases { --act: #ec4899; }
.sk-claimed { --act: #06b6d4; }
.sk-closed { --act: #10b981; }
.sk-reports { --act: #ef4444; }
.sk-appeals { --act: #f59e0b; }

.staff-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.staff-link .grow {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.staff-link:hover strong {
  text-decoration: underline;
}

.staff-range {
  flex-wrap: wrap;
  align-items: center;
}

.staff-range .help {
  margin: 0;
  min-width: 14em;
}

.staff-tiles {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.staff-cards {
  display: grid;
  gap: var(--gap, 16px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  align-items: start;
}

.staff-cards > .card {
  margin: 0;
}

/* "All staff statistics" under the Overview's busiest moderators. */
.card-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 0.88rem;
}

/* The badge on each row keeps to one line and its own width. */
.leaderboard .staff-count {
  flex: none;
  min-width: 0;
  white-space: nowrap;
}

.action-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.action-chip {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: color-mix(in srgb, var(--act) 14%, transparent);
  color: color-mix(in srgb, var(--act) 70%, var(--ink));
  white-space: nowrap;
}

.staff-table .num {
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.staff-table .staff-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sort-head {
  all: unset;
  cursor: pointer;
  white-space: nowrap;
}

.sort-head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

th[aria-sort="descending"] .sort-head {
  color: var(--accent);
}

/* Phones: each person is a small card of label and number pairs. */
@media (max-width: 640px) {
  .staff-table thead {
    display: none;
  }

  .staff-table,
  .staff-table tbody,
  .staff-table tr,
  .staff-table th,
  .staff-table td {
    display: block;
  }

  .staff-table tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }

  .staff-table .staff-name {
    grid-column: 1 / -1;
    padding: 0;
    border: 0;
  }

  .staff-table td,
  .staff-table td.num {
    display: grid;
    padding: 0;
    border: 0;
    text-align: start;
  }

  .staff-table td:not(.staff-name)::before {
    content: attr(data-label);
    font-size: 0.75rem;
    color: var(--muted);
  }
}

.ticket-filters {
  flex-wrap: wrap;
}

.ticket-filters input[type="search"] {
  min-width: 12em;
}

.ticket-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 4px;
}

.ticket-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.ticket-row:hover {
  background: var(--surface-2);
}

.ticket-number {
  width: 3.5em;
  flex: none;
  font-variant-numeric: tabular-nums;
}

.ticket-main {
  display: grid;
  flex: 1;
  min-width: 0;
}

.ticket-subject,
.ticket-main .muted {
  overflow-wrap: anywhere;
}

.ticket-title {
  margin: 0;
  font-size: 1.4rem;
}

.ticket-subject-full {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0 0 12px;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.transcript {
  margin: 0;
  padding: 12px;
  max-height: 70vh;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.transcript-frame {
  display: block;
  width: 100%;
  height: min(75vh, 900px);
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

/* --- Country -----------------------------------------------------------------------
   One grid for the whole page so every card lines up. Wide screens: "What members
   pick" and the guide editor in the main column; the channel card, the post card
   and the preview in a side column of the same width all the way down. Narrow
   screens: one column, preview above the editor like the other message editors. */

.country-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "where"
    "places"
    "preview"
    "guide"
    "post";
  gap: var(--gap);
  align-items: start;
}

.country-layout > .card {
  margin: 0;
}

.country-where {
  grid-area: where;
}

.country-places {
  grid-area: places;
}

.country-post {
  grid-area: post;
}

.country-guide {
  grid-area: guide;
}

.country-preview {
  grid-area: preview;
}

.country-layout .field {
  max-width: none;
}

/* The last field, toolbar or tip in a card adds no space under itself, so the
   cards' bottom padding matches their top. */
.country-layout .card > :last-child {
  margin-bottom: 0;
}

@media (min-width: 1200px) {
  .country-layout {
    grid-template-columns: minmax(0, 1fr) clamp(320px, 34%, 440px);
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "places where"
      "places post"
      "guide preview";
  }

  /* Its bottom lines up with the post card beside it. */
  .country-places {
    align-self: stretch;
  }

  .country-preview {
    position: sticky;
    top: 72px;
  }
}

/* When the card has room, continents sit two to a row; an open one takes the full row. */
.country-places {
  container-type: inline-size;
}

@container (min-width: 480px) {
  .country-places .place-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .country-places .place-groups > .place-search,
  .country-places .place-group[open] {
    grid-column: 1 / -1;
  }
}

/* --- Anti-nuke ---------------------------------------------------------------------
   The switch and what happens across the top, then the limits and the trusted
   people side by side on wide screens, stacked on narrow ones. */

.antinuke-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}

.antinuke-layout > .tip {
  margin: 0;
}

.antinuke-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.antinuke-status .switch-card {
  padding: 14px 16px;
}

.antinuke-status .field {
  margin: 0;
}

@media (min-width: 1100px) {
  .antinuke-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }

  .antinuke-layout > .tip,
  .antinuke-layout > .antinuke-status {
    grid-column: 1 / -1;
  }

  .antinuke-status {
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
    align-items: center;
  }
}

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

.limit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 600;
  min-width: 0;
}

.limit input {
  width: 72px;
  flex: none;
  text-align: center;
}

@media (max-width: 520px) {
  .limit-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card-title > .count-pill {
  margin-inline-start: auto;
}

.tag-list:has(> .trusted-row) {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.trusted-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.trusted-who {
  display: grid;
  gap: 4px;
  min-width: 0;
}

/* Display names can be long or decorative: they get their own line and wrap. */
.trusted-name {
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.trusted-name:empty {
  display: none;
}

.trusted-id {
  width: 100%;
  background: var(--surface);
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.add-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-weight: 600;
}

.add-row:hover:not(:disabled) {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.add-row:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Ban appeals */
.appeal-page {
  max-width: 640px;
  margin: 6vh auto 0;
  padding: 28px;
  display: grid;
  gap: 14px;
}

.appeal-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.appeal-head h1 {
  margin: 0;
  font-size: 1.4rem;
  overflow-wrap: anywhere;
}

.appeal-form {
  display: grid;
  gap: 14px;
}

.appeal-form .button.big,
.appeal-form button.big {
  justify-self: start;
}

.appeal-answer {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.appeal-answer:first-of-type {
  border-top: 0;
}

.appeal-answer p {
  margin: 4px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.link-row input {
  flex: 1;
  min-width: 0;
}

/* Ticket categories (a collapsible card on the Tickets page) */
.collapsible > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}

.collapsible > summary::-webkit-details-marker {
  display: none;
}

.collapsible > summary::after {
  content: "";
  margin-inline-start: auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.collapsible[open] > summary::after {
  transform: rotate(-135deg);
}

.collapsible > summary .muted {
  font-weight: 400;
}

.collapsible[open] > summary {
  margin-bottom: 12px;
}

/* Ticket panel editor */
.ticket-editor {
  display: grid;
  gap: var(--gap);
  min-width: 0;
}

.editor-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.editor-section + .editor-section {
  padding-top: var(--gap);
  border-top: 1px solid var(--border);
}

.editor-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1rem;
}

.editor-section .field {
  max-width: none;
}

/* Step-by-step editors (the ticket panel): a numbered step bar, one step shown at
   a time, and Back / Next / Save underneath. */
.wizard .wizard-panel {
  padding-top: 0;
  border-top: 0;
}

.wizard-panel > .help:first-of-type {
  margin-top: -4px;
}

.wizard-steps {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  scrollbar-width: none;
}

.wizard-steps li {
  flex: 1 1 0;
  min-width: 0;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: start;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
}

.wizard-step:hover {
  color: var(--text);
  background: var(--surface);
}

.wizard-step[aria-current="step"] {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.wizard-step-number {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 0.78rem;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.wizard-step[aria-current="step"] .wizard-step-number {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
}

.wizard-step.done .wizard-step-number {
  color: var(--accent-text);
  background: var(--ok);
  border-color: var(--ok);
}

.wizard-nav {
  padding-top: var(--gap);
  border-top: 1px solid var(--border);
}

.wizard-nav button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wizard-position {
  font-size: 0.85rem;
}

/* On phones only the open step keeps its name. */
@media (max-width: 640px) {
  .wizard-steps {
    flex-wrap: wrap;
    overflow: visible;
  }

  .wizard-steps li {
    flex: 0 0 auto;
    min-width: 0;
  }

  .wizard-steps li:has([aria-current="step"]) {
    flex: 1 1 auto;
  }

  .wizard-step:not([aria-current="step"]) .wizard-step-label {
    display: none;
  }

  .wizard-position {
    display: none;
  }
}

.wizard-review {
  display: grid;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.wizard-review-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.6fr) 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
}

.wizard-review-row + .wizard-review-row {
  border-top: 1px solid var(--border);
}

.wizard-review dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.wizard-review dd {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.wizard-review dd > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 640px) {
  .wizard-review-row {
    grid-template-columns: 1fr auto;
  }

  .wizard-review dt {
    grid-column: 1 / -1;
  }
}

.color-dot {
  flex: none;
  width: 14px;
  height: 14px;
  background: var(--swatch);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
}

/* Colour chooser: picker, hex box, eyedropper, swatches and a reset. */
.color-chooser {
  display: grid;
  gap: 6px;
}

.color-chooser-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.color-chooser input[type="color"] {
  width: 44px;
  min-height: 36px;
  padding: 2px;
  cursor: pointer;
}

.color-chooser .color-hex {
  width: calc(7ch + 32px);
  min-width: calc(7ch + 32px);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}

.color-chooser .color-hex:invalid {
  border-color: var(--danger);
}

.color-chooser .swatch {
  cursor: pointer;
}

.color-status:empty {
  display: none;
}

.category-row {
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}

.category-row > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.category-row > summary::-webkit-details-marker {
  display: none;
}

.category-row > summary::before {
  content: "▸";
  color: var(--muted);
  transition: transform 0.15s ease;
}

.category-row[open] > summary {
  margin-bottom: 12px;
}

.category-row[open] > summary::before {
  transform: rotate(90deg);
}

.category-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.category-row :is(input, select, textarea) {
  background: var(--surface);
}

.category-row .field {
  max-width: none;
  margin-bottom: 10px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0 12px;
}

.category-grid .category-emoji-field {
  min-width: 0;
}

.question-list .tag-list {
  margin-top: 0;
}

.question-row {
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.question-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.7fr) minmax(0, 0.7fr);
  gap: 0 10px;
  align-items: end;
}

.question-row .field {
  margin-bottom: 6px;
}

@media (max-width: 900px) {
  .question-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .question-grid .field:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .category-grid {
    grid-template-columns: 1fr;
  }
}

/* Buttons, dropdowns and thread names in the Discord previews */
.discord-buttons {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.discord-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.discord-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 2px 16px;
  border-radius: 8px;
  background: #4e5058;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
}

.discord-button.primary {
  background: #5865f2;
}

.discord-button.success {
  background: #248046;
}

.discord-button.danger {
  background: #da373c;
}

.discord-select {
  max-width: 400px;
}

.discord-select-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #1e1f22;
  border: 1px solid #1e1f22;
  border-radius: 4px 4px 0 0;
  color: #949ba4;
  font-size: 0.875rem;
}

.discord-select-options {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  background: #2b2d31;
  border: 1px solid #1e1f22;
  border-top: 0;
  border-radius: 0 0 4px 4px;
}

.discord-select-options li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.875rem;
}

.discord-select-options li > span:last-child {
  display: grid;
  min-width: 0;
}

.discord-select-options strong {
  color: #f2f3f5;
  font-weight: 500;
}

.discord-select-options .muted {
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.discord-thread-name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #3f4147;
  color: #f2f3f5;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.embed-side > .card + .card {
  margin-top: var(--gap);
}

/* Embed builder */
.embed-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  gap: var(--gap);
  align-items: start;
}

.embed-form > * + * {
  margin-top: var(--gap);
}

.embed-side {
  position: sticky;
  top: 72px;
}

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

.embed-grid .field,
.embed-form .field {
  max-width: none;
  align-content: start;
}

.link-bar {
  flex-wrap: nowrap;
}

.link-bar input {
  min-width: 0;
}

@media (max-width: 640px) {
  .link-bar {
    flex-wrap: wrap;
  }
}

/* Welcome page: the embed under each message box. */
.welcome-embed {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.welcome-embed-body {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.welcome-embed-body .embed-color-row {
  margin-bottom: 0;
}

.embed-color-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.embed-color-row input[type="color"] {
  width: 44px;
  min-height: 34px;
  padding: 2px;
}

.swatches {
  display: flex;
  gap: 6px;
}

.swatch {
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--swatch);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}

.embed-field-row {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.embed-field-row :is(input, textarea) {
  background: var(--surface);
}

.embed-actions {
  position: sticky;
  bottom: 12px;
}

.embed-actions[hidden] {
  display: flex;
}

.sent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
}

.sent-row:hover {
  background: var(--surface-2);
}

/* A feed's edit form opens under its row, full width. */
.feed-row {
  flex-wrap: wrap;
}

/* A feed's message box with its "using the default" note and reset button. */
.feed-message {
  max-width: 760px;
  margin-bottom: 16px;
}

.feed-message .field {
  margin-bottom: 0;
}

.feed-message .toolbar {
  margin: 8px 0 0;
}

/* A YouTube feed's switches: videos, Shorts, live streams. */
.feed-types {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 4px 0 2px;
}

.feed-youtube .field {
  max-width: 760px;
}

.feed-youtube-messages {
  margin-bottom: 16px;
}

.feed-youtube-messages > summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 12px;
}

.feed-editor {
  flex-basis: 100%;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

/* Form feeds: the setup steps and the script to paste into the form. */
.form-setup {
  display: grid;
  gap: 10px;
}

.form-steps {
  margin: 0;
  padding-inline-start: 20px;
  line-height: 1.6;
}

.form-script {
  width: 100%;
  min-height: 220px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
  overflow: auto;
  resize: vertical;
}

/* The preview looks like Discord's dark theme whatever the dashboard's theme. */
.embed-preview {
  background: #313338;
  color: #dbdee1;
  border-radius: 10px;
  padding: 14px 12px;
  overflow: hidden;
}

.discord-message {
  display: flex;
  gap: 12px;
  font-size: 0.95rem;
  line-height: 1.375;
}

.discord-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: none;
}

.discord-body {
  min-width: 0;
  flex: 1;
}

.discord-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.discord-head strong {
  color: #f2f3f5;
}

.discord-head .muted {
  color: #949ba4;
  font-size: 0.75rem;
}

.discord-bot-tag {
  background: #5865f2;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

.discord-content,
.discord-embed-description,
.discord-embed-field div {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.embed-preview a {
  color: #00a8fc;
}

.embed-preview code {
  background: #2b2d31;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.85em;
}

.embed-preview .mention {
  background: rgba(88, 101, 242, 0.3);
  color: #c9cdfb;
  padding: 0 2px;
  border-radius: 3px;
}

.embed-preview .muted {
  color: #949ba4;
}

.discord-embed {
  display: flex;
  gap: 16px;
  max-width: 432px;
  margin-top: 6px;
  padding: 10px 14px 14px 12px;
  background: #2b2d31;
  border-left: 4px solid var(--embed-color, #1e1f22);
  border-radius: 4px;
}

.discord-embed.no-color {
  border-left-color: #1e1f22;
}

.discord-embed-main {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 6px;
}

.discord-embed-author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #f2f3f5;
}

.discord-embed-author img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.discord-embed-title {
  font-weight: 700;
  color: #f2f3f5;
}

.discord-embed-description {
  font-size: 0.875rem;
}

.discord-embed-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.discord-embed-field {
  grid-column: 1 / -1;
  font-size: 0.875rem;
  min-width: 0;
}

.discord-embed-field.inline {
  grid-column: auto;
}

.discord-embed-field strong {
  color: #f2f3f5;
}

.discord-embed-field > strong {
  display: block;
  margin-bottom: 2px;
}

.discord-embed-image {
  max-width: 100%;
  border-radius: 4px;
  margin-top: 4px;
}

.discord-embed-thumbnail {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  flex: none;
}

.discord-embed-footer {
  font-size: 0.75rem;
  color: #b5bac1;
}

@media (max-width: 1100px) {
  .embed-layout {
    grid-template-columns: 1fr;
  }

  .embed-side {
    position: static;
    order: -1;
  }
}

@media (max-width: 640px) {
  .embed-grid {
    grid-template-columns: 1fr;
  }
}

.link-bar > .muted {
  white-space: nowrap;
}

.small-text {
  font-size: 0.82rem;
}

/* Server stats */
.segmented.wrap {
  display: flex;
  flex-wrap: wrap;
}
.counter-edit {
  display: flex;
  gap: 8px;
  align-items: center;
}
.counter-edit input {
  flex: 1;
  min-width: 0;
}
.counter-row .counter-edit {
  margin-bottom: 4px;
}

/* Sticky messages */
.ticket-main .sticky-preview {
  white-space: pre-line;
}
@media (min-width: 640px) {
  .sent-row .row-actions {
    grid-auto-flow: column;
  }
}

/* Leaderboard periods */
.board-head {
  flex-wrap: wrap;
  row-gap: 8px;
}

/* Backup page: what a restore would change. */
.backup-review {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.backup-review h3 {
  margin: 12px 0 6px;
  font-size: 0.95rem;
}

.backup-list {
  margin: 0 0 8px;
  padding-left: 20px;
  display: grid;
  gap: 4px;
}

/* --- Permissions ---------------------------------------------------------------- */

.perm-tabs .segment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.preset-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
}

.preset-option:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.preset-option input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 2px 0 0;
  padding: 0;
  flex: none;
  box-shadow: none;
  accent-color: var(--accent);
}

.preset-text {
  display: grid;
  gap: 4px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.preset-text strong {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.preset-text .help {
  margin: 0;
}

/* Country page: the places members can pick */
.place-groups {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.place-search {
  max-width: 360px;
}

.place-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 0 12px;
}

.place-group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
}

.place-group[open] {
  padding-bottom: 12px;
}

.place-count {
  margin-inline-start: auto;
  color: var(--muted);
  font-size: 0.9em;
}

.place-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 4px 12px;
  margin: 8px 0 14px;
}

.place-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 32px;
  overflow-wrap: anywhere;
}

.place-option input {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
}

.place-option[hidden],
.place-group[hidden] {
  display: none;
}

.preset-points {
  margin: 4px 0 0;
  padding-inline-start: 18px;
  font-size: 0.85rem;
  color: var(--muted);
}

.preset-points li + li {
  margin-top: 2px;
}

.perm-roles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 14px;
}

.perm-current {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.perm-current .help {
  margin: 0;
}

.perm-review {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
}

.perm-review h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.change-list {
  display: grid;
  gap: 6px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.change-list li {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow-wrap: anywhere;
}

.change-values,
.command-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-width: 0;
}

.command-chips code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 0.8rem;
}

.command-rules {
  display: grid;
  gap: 6px;
}

.command-rule {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.command-rule > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.command-rule > summary::-webkit-details-marker {
  display: none;
}

.command-rule > summary::after {
  content: "";
  margin-inline-start: auto;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.command-rule[open] > summary::after {
  transform: rotate(-135deg);
}

.command-rule .badges {
  min-width: 0;
}

.command-name {
  font-weight: 700;
}

.command-rule-body {
  display: grid;
  gap: 12px;
  padding: 4px 12px 12px;
}

.command-rule-body .field {
  margin: 0;
}

.command-rule-body .checks.scroll {
  max-height: 220px;
  background: var(--surface);
}

.route-group + .route-group {
  margin-top: 14px;
}

.route-group h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.route-grid {
  display: grid;
  align-items: end;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0 14px;
}

.route-grid .field-label {
  overflow-wrap: anywhere;
}

.route-grid .field,
.route-grid .field:last-child {
  margin: 0 0 12px;
}

/* "Where each log goes" on the Logging page */
.route-sections {
  display: grid;
  gap: 10px;
}

.route-section {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  min-width: 0;
}

.route-summary {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.route-summary .help {
  font-weight: 400;
  overflow-wrap: anywhere;
}

.route-section .toolbar {
  margin-bottom: 10px;
}

.route-children {
  padding-inline-start: 14px;
  border-inline-start: 2px solid var(--border);
  margin-inline-start: 4px;
}

/* --- Guide ---------------------------------------------------------------------- */

.guide-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--gap);
}

.guide-parts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: var(--gap);
}

.guide-groups {
  display: grid;
  gap: var(--gap);
}

.guide-group-title {
  margin: 12px 0 0;
  font-size: 1.1rem;
}

.guide-part-card {
  display: grid;
  align-content: start;
  gap: 6px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.guide-part-card .chip-icon {
  margin-bottom: 6px;
}

.guide-part-card strong {
  font-size: 1.05rem;
}

.guide-part-card .muted {
  font-size: 0.88rem;
}

.guide-count {
  margin-top: 4px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.guide-part-card:hover,
.guide-row:hover,
.guide-pager-link:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow-lift);
}

.guide-part-card:hover {
  transform: translateY(-2px);
}

.guide-list {
  display: grid;
  gap: 10px;
}

.guide-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px var(--pad);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.guide-row > .grow {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.guide-row .muted {
  font-size: 0.88rem;
}

.guide-row-part {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.guide-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.guide-crumbs a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.guide-crumbs [aria-current] {
  color: var(--text);
  font-weight: 600;
}

[dir="rtl"] .guide-crumbs .icon,
[dir="rtl"] .guide-pager .icon {
  transform: scaleX(-1);
}

.guide-siblings {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--gap);
}

.guide-sibling {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.guide-sibling:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.guide-sibling[aria-current] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

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

.guide-body > p,
.guide-body .tip {
  margin: 0;
}

.guide-steps,
.guide-tips {
  margin: 6px 0 0;
  padding-inline-start: 22px;
  display: grid;
  gap: 6px;
}

.guide-table td:first-child {
  width: 34%;
  font-weight: 600;
}

.guide-commands td:first-child {
  font-weight: 400;
}

.guide-table td code,
.guide-body li code,
.guide-body p code,
.guide-row code,
.hero p code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  font: 0.85em ui-monospace, SFMono-Regular, Menlo, monospace;
}

.guide-command-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.guide-command-links strong {
  margin-inline-end: 4px;
}

.guide-command-links .guide-sibling {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 500;
}

.guide-usages {
  display: grid;
  gap: 12px;
}

.guide-usage {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}

.guide-usage h3 {
  margin: 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.guide-usage h3 code {
  font: 600 0.95rem ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--accent);
}

.guide-usage > p {
  margin: 0;
}

.guide-options td:first-child {
  width: 26%;
  white-space: nowrap;
}

.guide-flag {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: 1px;
}

.guide-flag.required {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.guide-example pre {
  margin: 6px 0 0;
  padding: 10px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font: 0.85rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.guide-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.guide-pager-link {
  display: grid;
  gap: 4px;
  padding: 14px var(--pad);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.guide-pager-link .muted {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
}

.guide-pager-link.next {
  text-align: end;
}

.guide-pager-link.next .muted {
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .guide-pager {
    grid-template-columns: 1fr;
  }

  /* Each row of a guide table becomes a small block: the command, then what it does. */
  .guide-table thead {
    display: none;
  }

  .guide-table tr {
    display: grid;
    border-bottom: 1px solid var(--border);
  }

  .guide-table tbody tr:last-child {
    border-bottom: none;
  }

  .guide-table td,
  .guide-table td:first-child {
    width: auto;
    border-bottom: none;
  }

  .guide-table td:first-child {
    padding-bottom: 2px;
  }

  .guide-table td:last-child {
    padding-top: 2px;
  }
}

/* --- Landing page (logged out) ------------------------------------------------------
   One calm column on a moving background: drifting color clouds, a faint dot
   grid and a few butterflies (all fixed, aria-hidden and never clickable).
   Blocks with .reveal fade up as they scroll in, but only under .landing.motion,
   which app.js sets when motion is allowed, so nothing is ever left hidden.
   Every animation uses transform or opacity only, and the reduced-motion rules
   (device setting or Appearance > Motion) stop all of it. */

.landing {
  --brand-pink: #d9469f;
  --brand-gold: #ffd166;
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 72px;
  max-width: 1180px;
  margin: 0 auto;
}

/* The background: fixed, so it never adds height or scrollbars. */
.landing-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.landing-aurora {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  opacity: 0.55;
  will-change: transform;
}

.landing-aurora-1 {
  top: -38vmax;
  left: -22vmax;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 42%, transparent), transparent);
  animation: aurora-a 26s ease-in-out infinite alternate;
}

.landing-aurora-2 {
  top: -30vmax;
  right: -28vmax;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--brand-pink) 34%, transparent), transparent);
  animation: aurora-b 32s ease-in-out infinite alternate;
}

.landing-aurora-3 {
  bottom: -46vmax;
  left: 18vmax;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent-2) 30%, transparent), transparent);
  animation: aurora-c 38s ease-in-out infinite alternate;
}

@keyframes aurora-a {
  to {
    transform: translate(18vmax, 14vmax) scale(1.15);
  }
}

@keyframes aurora-b {
  to {
    transform: translate(-16vmax, 20vmax) scale(0.9);
  }
}

@keyframes aurora-c {
  to {
    transform: translate(10vmax, -22vmax) scale(1.2);
  }
}

.landing-dots {
  position: absolute;
  inset: 0;
  background: radial-gradient(color-mix(in srgb, var(--text) 13%, transparent) 1px, transparent 1.4px) 0 0 / 22px 22px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, #000, transparent 75%);
}

/* Butterflies drifting across the background. */
.landing-bg-fly {
  position: absolute;
  --flap: 0.42s;
  opacity: 0.5;
  animation: fly-drift var(--drift, 30s) ease-in-out infinite;
}

.landing-bg-fly .fly {
  width: 30px;
  height: 24px;
}

.landing-bg-fly-1 { top: 14%; left: 6%; --drift: 28s; }
.landing-bg-fly-2 { top: 9%; right: 9%; --drift: 34s; animation-delay: -9s; }
.landing-bg-fly-3 { top: 52%; left: 3%; --drift: 31s; animation-delay: -17s; }
.landing-bg-fly-4 { top: 64%; right: 5%; --drift: 36s; animation-delay: -4s; }
.landing-bg-fly-5 { top: 36%; left: 48%; --drift: 40s; animation-delay: -22s; opacity: 0.32; }
.landing-bg-fly-6 { bottom: 8%; left: 30%; --drift: 33s; animation-delay: -13s; opacity: 0.35; }

.landing-bg-fly-2 .fly,
.landing-bg-fly-5 .fly {
  width: 22px;
  height: 18px;
}

@keyframes fly-drift {
  0%,
  100% {
    transform: translate(0, 0) rotate(-6deg);
  }
  25% {
    transform: translate(46px, -34px) rotate(8deg);
  }
  50% {
    transform: translate(90px, 6px) rotate(-4deg);
  }
  75% {
    transform: translate(38px, 30px) rotate(10deg);
  }
}

/* Scroll-in: fade and lift, staggered by --reveal-delay. */
.landing.motion .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.6s ease var(--reveal-delay, 0s),
    transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) var(--reveal-delay, 0s);
}

.landing.motion .reveal.seen {
  opacity: 1;
  transform: none;
}

/* --- Hero: the words on the left, a little Discord chat on the right. */
.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: 48px;
  padding: 40px 0 8px;
}

.landing-copy {
  display: grid;
  justify-items: start;
  gap: 18px;
  animation: hero-in 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes hero-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

.landing-hero h1 {
  margin: 0;
  font-size: clamp(3rem, 9vw, 5.4rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.045em;
}

/* The name in a slowly shifting violet-pink-gold gradient. */
.landing-wordmark {
  background: linear-gradient(100deg, var(--accent), var(--brand-pink) 40%, var(--brand-gold) 55%, var(--brand-pink) 70%, var(--accent)) 0 0 / 250% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  animation: wordmark-shift 9s ease-in-out infinite alternate;
}

@keyframes wordmark-shift {
  to {
    background-position: 100% 0;
  }
}

.landing-lead {
  margin: 0;
  max-width: 24ch;
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.landing-tagline {
  margin: 0;
  max-width: 52ch;
  font-size: 1.06rem;
  line-height: 1.6;
  color: var(--muted);
}

.landing-error {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, #ef4444 14%, var(--surface));
  color: color-mix(in srgb, #ef4444 70%, var(--text));
  font-weight: 600;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

/* The main button: the brand gradient with a soft shine passing over it. */
.landing-invite,
.landing-invite:hover {
  position: relative;
  overflow: hidden;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--brand-pink));
  color: #fff;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 38%, transparent);
}

.landing-invite::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / 35%) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: shine 4.5s ease-in-out 1.2s infinite;
  pointer-events: none;
}

@keyframes shine {
  0%,
  65% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

.landing-invite:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px color-mix(in srgb, var(--accent) 45%, transparent);
}

.landing-login,
.landing-login:hover {
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.landing-login:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.landing-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.landing-points li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.landing-points .icon {
  width: 16px;
  height: 16px;
  padding: 2px;
  border-radius: 50%;
  background: color-mix(in srgb, #10b981 18%, transparent);
  color: #10b981;
}

/* The bot's live badge above the name. */
.landing-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(8px);
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text);
}

.landing-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.landing-status.on::before {
  background: #10b981;
  box-shadow: 0 0 0 4px rgb(16 185 129 / 22%);
  animation: pulse 2s ease-in-out infinite;
}

.landing-status.off::before {
  background: #ef4444;
}

.landing-status-uptime {
  padding-inline-start: 8px;
  border-inline-start: 1px solid var(--border);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 7px rgb(16 185 129 / 0%);
  }
}

/* A Discord-style window, gently floating, with the bot's messages popping in. */
.landing-art {
  position: relative;
}

.landing-art::before {
  content: "";
  position: absolute;
  inset: 8% -4% -6% 6%;
  z-index: -1;
  border-radius: 32px;
  background: linear-gradient(135deg, var(--accent), var(--brand-pink));
  opacity: 0.35;
  transform: rotate(4deg);
}

.landing-chat {
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 18px;
  background: #313338;
  color: #dbdee1;
  box-shadow: 0 30px 70px rgb(16 12 40 / 30%), 0 6px 18px rgb(16 12 40 / 16%);
  animation: float 7s ease-in-out infinite;
}

.landing-chat-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgb(0 0 0 / 30%);
  background: #2b2d31;
  font-size: 0.88rem;
  font-weight: 650;
  color: #f2f3f5;
}

/* Three window dots. */
.landing-chat-dots {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f87171;
  box-shadow: 16px 0 0 #fbbf24, 32px 0 0 #34d399;
  margin-inline-end: 34px;
}

.landing-chat-body {
  display: grid;
  gap: 16px;
  padding: 18px 18px 22px;
}

.landing-demo {
  display: flex;
  gap: 12px;
  animation: demo-in 0.5s cubic-bezier(0.2, 0.8, 0.3, 1.2) var(--reveal-delay, 0s) both;
}

@keyframes demo-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

.landing-demo img {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.landing-demo > div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.landing-demo-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 650;
  color: #f2f3f5;
}

.landing-demo-bot {
  padding: 0 5px;
  border-radius: 4px;
  background: #5865f2;
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.5;
  text-transform: uppercase;
}

.landing-demo-embed {
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border-inline-start: 4px solid var(--tone);
  border-radius: 4px;
  background: #2b2d31;
  font-size: 0.84rem;
}

.landing-demo-embed strong {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #f2f3f5;
}

.landing-demo-embed .icon {
  width: 15px;
  height: 15px;
  color: var(--tone);
}

@keyframes float {
  50% {
    transform: translateY(-8px);
  }
}

/* --- The live numbers: one frosted band, split into cells. */
.landing-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 8px);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 20px 50px color-mix(in srgb, var(--accent) 12%, transparent), var(--shadow);
}

.landing-stat {
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 22px;
}

.landing-stat + .landing-stat {
  border-inline-start: 1px solid var(--border);
}

.landing-stat .chip-icon {
  margin-bottom: 6px;
}

.landing-stat strong {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.landing-stat span:last-child {
  font-size: 0.85rem;
  color: var(--muted);
}

.landing-stat.tone-green strong {
  color: var(--tone);
}

.sk-stat {
  height: 112px;
  margin: 1px;
}

/* The 30-day uptime: one bar a day (also on the Status page). */
.landing-uptime {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 18px 22px 16px;
  border-top: 1px solid var(--border);
}

.landing-uptime-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 16px;
  font-size: 0.9rem;
}

.landing-uptime-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.landing-uptime-live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
}

.landing-uptime-live.on::before {
  background: #10b981;
  box-shadow: 0 0 0 3px rgb(16 185 129 / 25%);
  animation: pulse 2s ease-in-out infinite;
}

.uptime-bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  height: 30px;
}

.uptime-bar {
  border-radius: 4px;
  background: var(--border);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.uptime-bar:hover {
  transform: scaleY(1.12);
  filter: brightness(1.1);
}

.uptime-bar.up {
  background: #10b981;
}

.uptime-bar.dip {
  background: #f59e0b;
}

.uptime-bar.down {
  background: #ef4444;
}

.landing-uptime-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
}

/* --- Four promises in a quiet row under the numbers. */
.landing-promises {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin: -32px 0 0;
  padding: 0;
  list-style: none;
}

.landing-promise {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.landing-promise > div {
  display: grid;
  gap: 2px;
}

.landing-promise strong {
  font-size: 0.95rem;
}

.landing-promise span:not(.chip-icon) {
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--muted);
}

/* The "we never sell your data" banner under the promises. */
.landing-nosale {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: -36px;
  padding: 18px 22px;
  border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--tone) 8%, transparent);
}

.landing-nosale > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.landing-nosale strong {
  font-size: 1.05rem;
}

.landing-nosale span:not(.chip-icon) {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
}

@media (max-width: 760px) {
  .landing-nosale {
    align-items: flex-start;
    margin-top: -28px;
    padding: 16px;
    gap: 12px;
  }
}

/* --- Sections. */
.landing-section {
  display: grid;
  gap: 24px;
  scroll-margin-top: 84px;
}

.landing-section-head {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.landing-section h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.landing-intro {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.04rem;
}

/* Features: small glassy tiles that light up in their color on hover. */
.landing-features {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.landing-feature {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px);
}

.landing-feature,
.landing.motion .landing-feature.reveal.seen {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.landing-feature:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--tone) 45%, var(--border));
  background: color-mix(in srgb, var(--tone) 7%, var(--surface));
  box-shadow: 0 16px 34px color-mix(in srgb, var(--tone) 20%, transparent);
}

.landing-feature .chip-icon {
  transition: transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.landing-feature:hover .chip-icon {
  transform: rotate(-8deg) scale(1.12);
}

.landing-feature h3 {
  margin: 4px 0 0;
  font-size: 1.02rem;
}

.landing-feature p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

/* The whole feature card opens its guide page. */
.landing-feature-link {
  color: inherit;
  text-decoration: none;
}

.landing-feature-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.landing-feature:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.landing-feature-link:focus-visible {
  outline: none;
}

/* How it works: three numbered cards joined by a dashed line. */
.landing-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.landing-steps::before {
  content: "";
  position: absolute;
  top: 42px;
  inset-inline: 16%;
  border-top: 2px dashed color-mix(in srgb, var(--accent) 35%, transparent);
}

.landing-step {
  position: relative;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 8px;
  margin: 0;
  padding: 22px 22px 24px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px);
  text-align: center;
}

.landing-step-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--brand-pink));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 0 0 6px var(--surface), 0 8px 18px color-mix(in srgb, var(--accent) 35%, transparent);
}

.landing-step h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  font-size: 1.08rem;
}

.landing-step h3 .icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.landing-step p {
  flex: 1;
  margin: 0;
  color: var(--muted);
}

.landing-step .landing-step-action {
  margin-top: 8px;
}

.landing-step .landing-step-action:not(.landing-invite) {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

/* Questions: native <details>, so they work without script and by keyboard. */
.landing-faq {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.landing-faq details {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px);
}

.landing-faq details[open] {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.landing-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.landing-faq summary::-webkit-details-marker {
  display: none;
}

.landing-faq summary::after {
  content: "+";
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  color: var(--accent);
  font-weight: 700;
  transition: transform 0.2s ease;
}

.landing-faq details[open] summary::after {
  transform: rotate(45deg);
}

.landing-faq details > p {
  margin: 0;
  padding: 0 20px 18px;
  color: var(--muted);
}

/* What each invite permission is for, inside the last question. */
.landing-perms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  padding: 0 20px 20px;
}

.landing-perm {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.landing-perm h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 0.98rem;
}

.landing-perm p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.landing-perm-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* The closing call to action: a full-color band with butterflies passing by. */
.landing-cta {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  justify-items: center;
  gap: 22px;
  padding: 56px 32px;
  border-radius: calc(var(--radius) + 14px);
  color: #fff;
  text-align: center;
  background: linear-gradient(120deg, var(--accent), var(--brand-pink) 60%, color-mix(in srgb, var(--brand-pink) 60%, var(--brand-gold))) 0 0 / 200% 200%;
  box-shadow: 0 24px 60px color-mix(in srgb, var(--accent) 30%, transparent);
  animation: cta-shift 12s ease-in-out infinite alternate;
}

.landing-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(rgb(255 255 255 / 22%) 1.2px, transparent 1.6px) 0 0 / 20px 20px;
  mask-image: radial-gradient(ellipse at center, #000 10%, transparent 75%);
}

@keyframes cta-shift {
  to {
    background-position: 100% 100%;
  }
}

.landing-cta h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.landing-cta p {
  margin: 6px 0 0;
  color: rgb(255 255 255 / 88%);
  font-size: 1.05rem;
}

.landing-cta .landing-actions {
  justify-content: center;
}

.landing-cta .landing-invite,
.landing-cta .landing-invite:hover {
  background: #fff;
  color: color-mix(in srgb, var(--accent) 80%, #000);
  box-shadow: 0 10px 26px rgb(0 0 0 / 20%);
}

.landing-cta .landing-invite::after {
  background: linear-gradient(110deg, transparent 30%, color-mix(in srgb, var(--accent) 18%, transparent) 50%, transparent 70%);
}

.landing-cta .landing-login,
.landing-cta .landing-login:hover {
  background: rgb(255 255 255 / 14%);
  color: #fff;
  border-color: rgb(255 255 255 / 45%);
}

.landing-cta-fly {
  position: absolute;
  z-index: -1;
  --flap: 0.36s;
  opacity: 0.8;
  pointer-events: none;
  animation: fly-drift 22s ease-in-out infinite;
}

.landing-cta-fly .fly {
  width: 34px;
  height: 28px;
}

.landing-cta-fly-1 { top: 18%; left: 7%; }
.landing-cta-fly-2 { bottom: 14%; right: 12%; animation-delay: -8s; }
.landing-cta-fly-3 { top: 12%; right: 26%; animation-delay: -15s; opacity: 0.55; }

@media (max-width: 1100px) {
  .landing-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    padding-top: 16px;
    text-align: center;
  }

  .landing-copy {
    justify-items: center;
  }

  .landing-actions,
  .landing-points {
    justify-content: center;
  }

  .landing-art {
    width: min(100%, 520px);
    text-align: start;
  }

  .landing-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .landing-stat:nth-child(3n + 1) {
    border-inline-start: 0;
  }

  .landing-stat:nth-child(n + 4) {
    border-top: 1px solid var(--border);
  }

  .landing-features,
  .landing-promises {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .landing {
    gap: 56px;
  }

  .landing-lead {
    max-width: none;
  }

  /* The tilted glow behind the chat window would poke past the screen's edge. */
  .landing-hero {
    overflow-x: clip;
  }

  .landing-bg-fly-3,
  .landing-bg-fly-5,
  .landing-bg-fly-6 {
    display: none;
  }

  .landing-chat-body {
    gap: 12px;
    padding: 14px;
  }

  .landing-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .landing-stat:nth-child(n) {
    border-inline-start: 0;
    border-top: 0;
  }

  .landing-stat:nth-child(even) {
    border-inline-start: 1px solid var(--border);
  }

  .landing-stat:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

  .landing-stat {
    padding: 16px;
  }

  .landing-uptime {
    padding: 16px;
  }

  .uptime-bars {
    gap: 2px;
    height: 26px;
  }

  .landing-promises {
    margin-top: -24px;
    gap: 18px;
  }

  /* On phones the features become a short list: icon beside the title. */
  .landing-features,
  .landing-steps,
  .landing-promises {
    grid-template-columns: 1fr;
  }

  .landing-feature {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 14px;
    row-gap: 2px;
    padding: 14px 16px;
  }

  .landing-feature > .chip-icon {
    grid-row: span 2;
  }

  .landing-feature h3 {
    margin: 0;
  }

  .landing-steps::before {
    top: 24px;
    bottom: 24px;
    inset-inline: auto;
    left: 50%;
    border-top: 0;
    border-inline-start: 2px dashed color-mix(in srgb, var(--accent) 35%, transparent);
  }

  .landing-step .landing-step-action {
    justify-self: stretch;
  }

  .landing-actions,
  .landing-actions .button {
    width: 100%;
  }

  .landing-perms {
    padding: 0 14px 14px;
  }

  .landing-cta {
    padding: 40px 20px;
  }
}

/* The public guide: the guide pages without the server sidebar. */
.public-guide {
  display: grid;
  gap: var(--gap);
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.public-guide-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.landing-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: -24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.landing-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
}

.landing-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.landing-footer :is(a, .link-button) {
  padding: 0;
  text-decoration: none;
  color: var(--muted);
  font-weight: 550;
}

.landing-footer :is(a, .link-button):hover {
  color: var(--accent);
}

/* The footer on every public page: about text, then link columns. */
.site-footer {
  align-items: flex-start;
  margin-top: 0;
}

.site-footer-about {
  display: grid;
  gap: 6px;
  max-width: 36ch;
}

.site-footer-about p {
  margin: 0;
}

.site-footer-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, auto));
  gap: 16px 48px;
}

.site-footer-column {
  display: grid;
  align-content: start;
  gap: 6px;
}

.site-footer-column h3 {
  margin: 0 0 2px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

/* Status and the changelog: public pages with the guide's width. */
.public-page {
  display: grid;
  gap: var(--gap);
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.public-page h1 {
  margin: 8px 0 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.02em;
}

.status-body {
  display: grid;
  gap: var(--gap);
}

.status-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 1.05rem;
}

.status-banner.up {
  background: color-mix(in srgb, var(--green, #23a55a) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--green, #23a55a) 40%, var(--border));
}

.status-banner.down {
  background: color-mix(in srgb, var(--red, #f23f43) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--red, #f23f43) 40%, var(--border));
}

.status-banner .muted {
  margin-inline-start: auto;
  font-size: 0.88rem;
}

.status-components {
  display: grid;
  padding: 0;
}

.status-component {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
}

.status-component + .status-component {
  border-top: 1px solid var(--border);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green, #23a55a);
}

.status-component.down .status-dot {
  background: var(--red, #f23f43);
}

.status-uptime-total {
  margin: 0 0 12px;
}

.status-uptime-total strong {
  font-size: 1.6rem;
}

.status-uptime .landing-uptime {
  padding: 0;
  border: 0;
  background: none;
}

.status-monitor h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.status-monitor p {
  margin: 0 0 10px;
  color: var(--muted);
}

.status-monitor code {
  word-break: break-all;
}

.changelog {
  display: grid;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.changelog-entry h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.changelog-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
}

.changelog-tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: color-mix(in srgb, var(--accent) 60%, var(--text));
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.changelog-tag:hover,
.changelog-tag:focus-visible {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

.changelog-change {
  margin-top: 14px;
}

.changelog-change h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.changelog-entry ul {
  margin: 0;
  padding-inline-start: 20px;
  display: grid;
  gap: 4px;
  overflow-wrap: anywhere;
}

.changelog-entry summary {
  cursor: pointer;
  list-style-position: outside;
}

.changelog-entry summary h2 {
  display: inline-block;
}

.changelog-titles {
  display: block;
  font-size: 0.92rem;
}

details[open] > summary .changelog-titles {
  display: none;
}

/* Linked versions land below the sticky top bar. */
.changelog > li {
  scroll-margin-top: 84px;
}

.changelog-older-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: calc(var(--gap) * 1.5) 0 var(--gap);
}

.changelog-older-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

@media (max-width: 760px) {
  .site-footer-columns {
    grid-template-columns: 1fr;
  }

  .status-component {
    grid-template-columns: auto 1fr auto;
  }

  .status-component > .muted {
    grid-column: 2 / 3;
    grid-row: 2;
    font-size: 0.85rem;
  }
}

/* --- Terms and Privacy pages (src/dashboard/legal) --------------------------- */

.legal {
  max-width: 76ch;
  margin: 0 auto;
  line-height: 1.65;
}

.legal h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.legal h2 {
  margin: 40px 0 8px;
  font-size: 1.3rem;
  font-weight: 750;
  scroll-margin-top: 80px;
}

.legal h3 {
  margin: 24px 0 4px;
  font-size: 1.02rem;
  font-weight: 700;
}

.legal p,
.legal ul {
  margin: 8px 0;
}

.legal li + li {
  margin-top: 4px;
}

.legal a {
  color: var(--accent);
}

.legal code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 0.9em;
}

.legal-updated {
  color: var(--muted);
}

.legal-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 24px 0;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.92rem;
}

.legal-toc a {
  text-decoration: none;
  font-weight: 550;
}

.legal-table {
  overflow-x: auto;
}

.legal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.legal :is(th, td) {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: start;
  vertical-align: top;
}

.legal-placeholder {
  color: var(--danger);
}

.legal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  padding: 24px 20px 40px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.legal-footer a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 550;
}

.legal-footer a:hover,
.legal-footer a[aria-current] {
  color: var(--accent);
}

/* --- Landing page links in the top bar ------------------------------------------- */

.topnav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  margin-inline-start: 28px;
  min-width: 0;
}

.topnav[hidden] {
  display: none;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.topnav-links .link-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.topnav-links .link-button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.topbar-login,
.topnav-invite,
.topnav-dashboard {
  min-height: 36px;
  white-space: nowrap;
}

#account:has(.topbar-login) {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The buttons sit next to the account controls on the far side. */
.topnav-links {
  margin-inline-end: auto;
}

@media (max-width: 1000px) {
  .topnav-links {
    display: none;
  }
}

@media (max-width: 600px) {
  .topnav {
    margin-inline-start: auto;
  }

  .topnav-invite,
  .topnav-dashboard {
    display: none;
  }
}

/* Test messages: "Send test" rows at the bottom of cards, and the automod tester. */
.test-row {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.test-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.automod-test-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.automod-test-results:empty {
  display: none;
}
.automod-test-line {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow-wrap: anywhere;
}
.automod-test-line.ok {
  color: var(--ok);
}
.automod-test-line.danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.automod-test-line.muted {
  color: var(--muted);
}

/* --- Readability pass: every width from 320px phones to wide monitors ------------ */

/* Long words, links and IDs wrap instead of being cut off or pushing the page wide. */
.card,
.help,
.muted,
.hero,
.legal-page {
  overflow-wrap: break-word;
}

/* Paragraphs keep a comfortable line length on wide screens. */
.help,
.card > p,
.checkup-list li > .grow {
  max-width: 120ch;
}

.stat {
  align-content: start;
}

.stat-label {
  padding-top: 2px;
}

/* Setup checklist: on wide screens the steps sit in columns so the buttons stay
   next to the step they belong to; on phones the buttons drop under the text. */
@media (min-width: 1400px) {
  .setup .steps {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
    column-gap: 32px;
  }
}

@media (max-width: 520px) {
  .steps li {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .steps li > .grow {
    flex: 1 1 calc(100% - 40px);
  }

  .step-actions {
    flex-direction: row;
    margin-inline-start: 32px;
    justify-content: flex-start;
  }
}

/* Short lists (latest cases, member history): on phones the badge and date share
   the first line and the text gets the full width under them. */
@media (max-width: 520px) {
  .recent li,
  .recent-link {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 4px;
  }

  .recent-links li {
    display: block;
  }

  .recent-link .recent-date {
    display: flex;
    gap: 6px;
  }

  .recent-chevron {
    order: 1;
  }

  .case-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .case-facts dd + dt {
    margin-top: 10px;
  }

  .recent-text {
    order: 2;
    flex-basis: 100%;
  }

  .recent-date {
    order: 1;
    margin-inline-start: auto;
  }
}

/* Very narrow phones: the step wizard shows numbered circles only (the step's
   name is the heading right under it), so all five fit on one line. */
@media (max-width: 420px) {
  .wizard-steps li,
  .wizard-steps li:has([aria-current="step"]) {
    flex: 1 1 0;
  }

  .wizard-step {
    justify-content: center;
    padding-inline: 4px;
  }

  .wizard-step .wizard-step-label {
    display: none;
  }
}

/* Smaller placeholder text on phones so hints fit inside their boxes. */
@media (max-width: 640px) {
  input::placeholder,
  textarea::placeholder {
    font-size: 0.88em;
  }
}

/* Cases: on phones and small tablets each case becomes a card with labelled lines,
   so no column is hidden off the side of the screen. */
@media (max-width: 900px) {
  .table.cases thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .table.cases,
  .table.cases tbody,
  .table.cases tr,
  .table.cases td {
    display: block;
    width: auto;
    min-width: 0;
  }

  .table.cases tr {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    border-inline-start: 4px solid var(--act, var(--border));
  }

  .table.cases tbody tr:last-child {
    border-bottom: none;
  }

  .table.cases td {
    padding: 0;
    border: none;
  }

  .cases .act-row td:first-child {
    border-inline-start: none;
  }

  .table.cases td.number {
    align-self: center;
  }

  .table.cases td.action {
    align-self: center;
  }

  .table.cases td.action .action-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .table.cases td.person,
  .table.cases td.reason,
  .table.cases td.date,
  .table.cases td.actions-cell {
    grid-column: 1 / -1;
  }

  .table.cases td[data-label]:not(.number):not(.action)::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .table.cases .row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .table.cases tbody tr:hover td {
    background: none;
  }
}

/* --- Livelier pages: shared touches for every server page -----------------------
   The page's color (tone-* on .content, from NAV) tints the top of the page,
   page headers get a group eyebrow and a row of "glance" facts, cards built
   with card() get a soft wash in their color, and empty lists get a friendly
   placeholder instead of a grey line. All of it is styling: nothing moves. */

.content {
  position: relative;
  isolation: isolate;
}

/* A soft glow in the page's color behind the header. */
.content::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: 420px;
  pointer-events: none;
  background:
    radial-gradient(700px 300px at 78% -40px, color-mix(in srgb, var(--tone, var(--accent)) 12%, transparent), transparent 70%),
    radial-gradient(520px 260px at 8% -60px, color-mix(in srgb, var(--accent-2) 7%, transparent), transparent 70%);
}

/* Pages arrive with a short rise, the cards one after another. */
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.content > .hero,
.settings-cards > * {
  animation: rise-in 0.36s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.settings-cards > :nth-child(2) { animation-delay: 0.04s; }
.settings-cards > :nth-child(3) { animation-delay: 0.08s; }
.settings-cards > :nth-child(4) { animation-delay: 0.12s; }
.settings-cards > :nth-child(5) { animation-delay: 0.16s; }
.settings-cards > :nth-child(n + 6) { animation-delay: 0.2s; }

/* Page header: a bigger icon, the sidebar group above the title, dots on the far side. */
.hero {
  padding: 26px 28px;
  gap: 20px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--tone, var(--accent)) 15%, var(--surface)) 0%, color-mix(in srgb, var(--tone, var(--accent)) 3%, var(--surface)) 55%, var(--surface) 80%);
}

/* A field of dots in the page's color, fading in toward the far side. */
.hero:not(.hero-banner)::before {
  inset: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  transform: none;
  opacity: 1;
  background: radial-gradient(color-mix(in srgb, var(--tone, var(--accent)) 30%, transparent) 1.3px, transparent 1.6px) 0 0 / 16px 16px;
  mask-image: linear-gradient(100deg, transparent 45%, #000 95%);
}

.hero:not(.hero-banner) .chip-icon.lg {
  align-self: flex-start;
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.hero:not(.hero-banner) .chip-icon.lg .icon {
  width: 26px;
  height: 26px;
}

.hero-eyebrow {
  display: block;
  margin-bottom: 2px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--tone, var(--accent)) 75%, var(--ink));
}

/* Glance chips: how the page is set up right now. */
.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.hero-fact {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: 100%;
  padding: 6px 12px 6px 6px;
  border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 20%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 2px rgb(16 24 40 / 4%);
}

.hero-fact-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--tone, var(--accent)) 14%, transparent);
  color: color-mix(in srgb, var(--tone, var(--accent)) 85%, var(--ink));
}

.hero-fact-icon .icon {
  width: 15px;
  height: 15px;
}

.hero-fact-text {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.hero-fact-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.hero-fact-value {
  font-size: 0.9rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.hero-fact.is-on .hero-fact-value {
  color: color-mix(in srgb, var(--ok) 85%, var(--ink));
}

.hero-fact.is-off .hero-fact-value,
.hero-fact.is-unset .hero-fact-value {
  color: var(--muted);
  font-weight: 600;
}

.hero-fact.is-off .hero-fact-icon,
.hero-fact.is-unset .hero-fact-icon {
  background: var(--surface-2);
  color: var(--muted);
}

/* Cards made with card(): a wash of their color behind the title and a divider under it. */
.card.toned {
  background:
    radial-gradient(520px 120px at 0 0, color-mix(in srgb, var(--tone) 8%, transparent), transparent 70%),
    var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card.toned:hover,
.card.toned:focus-within {
  border-color: color-mix(in srgb, var(--tone) 28%, var(--border));
  box-shadow: 0 6px 22px color-mix(in srgb, var(--tone) 9%, transparent), var(--shadow);
}

.card.toned > .card-title {
  margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 16px;
  padding: 14px var(--pad);
  border-bottom: 1px solid color-mix(in srgb, var(--tone) 14%, var(--border));
}

/* Card title chips: solid and glossy, like the header's. */
.card-title > .chip-icon {
  background: linear-gradient(135deg, var(--tone, var(--accent)), color-mix(in srgb, var(--tone, var(--accent)) 62%, #1e1b4b));
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 25%),
    0 4px 10px color-mix(in srgb, var(--tone, var(--accent)) 28%, transparent);
}

/* Empty lists: a dashed box with a little sparkle, instead of a lone grey line. */
p.empty {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-block: 8px;
  padding: 26px 20px;
  border: 1.5px dashed color-mix(in srgb, var(--tone, var(--accent)) 28%, var(--border));
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 0, color-mix(in srgb, var(--tone, var(--accent)) 7%, transparent), transparent 70%),
    color-mix(in srgb, var(--surface-2) 55%, transparent);
  color: var(--muted);
  font-weight: 550;
}

p.empty::before {
  content: "✦";
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tone, var(--accent)) 22%, transparent), color-mix(in srgb, var(--accent-2) 14%, transparent));
  color: color-mix(in srgb, var(--tone, var(--accent)) 85%, var(--ink));
  font-size: 1.1rem;
}

p.empty[hidden] {
  display: none;
}

/* Rows in lists and toggles lift a little under the pointer. */
:is(.tag-row, .switch-row, .feed-row, .rule):hover {
  border-color: color-mix(in srgb, var(--tone, var(--accent)) 30%, var(--border));
}

@media (max-width: 600px) {
  .hero {
    padding: 20px 18px;
  }

  .hero:not(.hero-banner) .chip-icon.lg {
    width: 46px;
    height: 46px;
    border-radius: 13px;
  }

  .hero-fact {
    flex: 1 1 140px;
  }
}

/* "Good to know": the page's guide topic in short, at the end of settings pages. */
.guide-side-block + .guide-side-block {
  margin-top: 16px;
}

.guide-side-block h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--tone, var(--accent)) 70%, var(--muted));
}

.guide-side-commands,
.guide-side-tips {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-side-commands li {
  display: grid;
  gap: 3px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-inline-start: 3px solid color-mix(in srgb, var(--tone, var(--accent)) 55%, var(--border));
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.88rem;
}

.guide-side-commands code {
  justify-self: start;
  max-width: 100%;
  font-weight: 650;
  color: color-mix(in srgb, var(--tone, var(--accent)) 80%, var(--ink));
  overflow-wrap: anywhere;
}

.guide-side-commands span {
  color: var(--muted);
}

.guide-side-tips li {
  position: relative;
  padding-inline-start: 22px;
  font-size: 0.9rem;
  color: color-mix(in srgb, var(--text) 85%, var(--muted));
}

.guide-side-tips li::before {
  content: "✦";
  position: absolute;
  inset-inline-start: 2px;
  top: 0;
  color: var(--tone, var(--accent));
}

.guide-side > .button {
  margin-top: 16px;
}

.guide-side > .tip {
  margin-top: 0;
}

/* Pages with their own cards (feeds, scheduled, sticky...) put "Good to know" beside them. */
.page-main > * + *,
.page-side > * + * {
  margin-top: var(--gap);
}

@media (min-width: 1400px) {
  .page-columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    gap: var(--gap);
    align-items: start;
  }

  .page-side {
    position: sticky;
    top: calc(var(--topbar) + 16px);
  }
}

@media (max-width: 1399px) {
  .page-side {
    margin-top: var(--gap);
  }
}

/* The rumble style's full-color headers: glass chips in white. */
[data-style="rumble"] .hero-eyebrow {
  color: rgb(255 255 255 / 85%);
}

[data-style="rumble"] .hero-fact {
  border: 2px solid var(--outline);
  background: rgb(255 255 255 / 92%);
  color: #1b1530;
  box-shadow: var(--pop-sm);
}

[data-style="rumble"] .hero-fact-label {
  color: #5b5470;
}

[data-style="rumble"] .card.toned > .card-title {
  border-bottom-width: 2px;
}

/* --- Rumble style ------------------------------------------------------------------
   An optional game-style look (Appearance > Style): chunky Lilita One headings,
   bold outlines, hard comic shadows and full-color page headers. Everything here
   sits under data-style="rumble" on <html>, so the clean style is untouched.
   Lilita One is under the SIL Open Font License (fonts/LilitaOne-OFL.txt). */

@font-face {
  font-family: "Lilita One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/lilita-one-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Lilita One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/lilita-one-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root[data-style="rumble"] {
  --display: "Lilita One", "Arial Black", system-ui, sans-serif;
  --pop: 4px 4px 0 var(--outline);
  --pop-sm: 2px 2px 0 var(--outline);
  --radius: 14px;
}

/* Warm paper in light mode, deep purple at night. */
@media (prefers-color-scheme: light) {
  :root[data-style="rumble"]:not([data-theme="dark"]) {
    --bg: #fff6e6;
    --surface-2: #fff3dd;
    --border: #eadbc2;
    --outline: #24183f;
  }
}

:root[data-style="rumble"][data-theme="light"] {
  --bg: #fff6e6;
  --surface-2: #fff3dd;
  --border: #eadbc2;
  --outline: #24183f;
}

@media (prefers-color-scheme: dark) {
  :root[data-style="rumble"]:not([data-theme="light"]) {
    --bg: #130f20;
    --surface: #1c1730;
    --surface-2: #241e3b;
    --surface-3: #2e2749;
    --border: #3a3158;
    --outline: #050309;
  }
}

:root[data-style="rumble"][data-theme="dark"] {
  --bg: #130f20;
  --surface: #1c1730;
  --surface-2: #241e3b;
  --surface-3: #2e2749;
  --border: #3a3158;
  --outline: #050309;
}

[data-style="rumble"] body {
  background:
    radial-gradient(color-mix(in srgb, var(--outline) 9%, transparent) 1.1px, transparent 1.4px) 0 0 / 18px 18px,
    radial-gradient(1100px 520px at 85% -120px, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(900px 480px at -10% -80px, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

[data-style="rumble"] :is(h1, h2, .brand span, .stat-value, .guide-part-card strong, .landing h1) {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.01em;
}

[data-style="rumble"] h2 {
  font-size: 1.2rem;
}

[data-style="rumble"] .topbar {
  border-bottom: 2px solid var(--outline);
}

[data-style="rumble"] .topbar::after {
  bottom: -6px;
  height: 4px;
}

[data-style="rumble"] .sidebar {
  border-inline-end: 2px solid var(--outline);
}

/* Cards, menus and dialogs: a bold outline and a hard offset shadow. */
[data-style="rumble"] :is(.card, .menu, dialog.search, .switcher) {
  border: 2px solid var(--outline);
  box-shadow: var(--pop);
}

[data-style="rumble"] :is(.server, a.stat, .guide-part-card):hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--outline);
}

/* Page headers turn into full-color banners. */
[data-style="rumble"] .hero {
  border: 2px solid var(--outline);
  box-shadow: 6px 6px 0 var(--outline);
  color: #fff;
}

/* The overview keeps the server's own gradient. */
[data-style="rumble"] .hero:not(.hero-banner) {
  background: linear-gradient(120deg, var(--tone, var(--accent)), color-mix(in srgb, var(--tone, var(--accent)) 50%, var(--accent-2)));
}

[data-style="rumble"] .hero::before {
  inset: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  transform: none;
  opacity: 1;
  background: radial-gradient(rgb(255 255 255 / 22%) 1.5px, transparent 1.8px) 0 0 / 14px 14px;
  mask-image: linear-gradient(100deg, transparent 30%, #000 85%);
}

/* A diagonal slash across the far end. */
[data-style="rumble"] .hero::after {
  width: 90px;
  height: 260%;
  inset-inline-end: 120px;
  top: -80%;
  bottom: auto;
  border-radius: 0;
  background: #fff;
  opacity: 0.14;
  transform: rotate(24deg);
}

[data-style="rumble"] .hero h1 {
  font-size: 2rem;
  text-shadow: 2px 2px 0 rgb(0 0 0 / 28%);
}

[data-style="rumble"] .hero p {
  color: rgb(255 255 255 / 90%);
}

[data-style="rumble"] .hero .chip-icon.lg {
  background: #fff;
  color: color-mix(in srgb, var(--tone, var(--accent)) 85%, #000);
  border: 2px solid var(--outline);
  box-shadow: var(--pop-sm);
}

[data-style="rumble"] .hero .guild-icon {
  border: 2px solid var(--outline);
  box-shadow: var(--pop-sm);
}

/* Icon chips become solid stickers. */
[data-style="rumble"] .chip-icon {
  background: var(--tone, var(--accent));
  color: #fff;
  border: 2px solid var(--outline);
  box-shadow: var(--pop-sm);
}

[data-style="rumble"] .stat::before {
  height: 6px;
}

[data-style="rumble"] .stat-value {
  font-size: 2.1rem;
}

[data-style="rumble"] :is(.primary, .ghost, .danger) {
  border: 2px solid var(--outline);
  box-shadow: var(--pop-sm);
  font-weight: 700;
}

[data-style="rumble"] :is(.primary, .ghost, .danger):hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--outline);
}

[data-style="rumble"] :is(.primary, .ghost, .danger):active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

[data-style="rumble"] .nav-link.active {
  background: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
  color: #fff;
  border: 2px solid var(--outline);
  box-shadow: var(--pop-sm);
}

[data-style="rumble"] .nav-link.active::before {
  content: none;
}

[data-style="rumble"] .nav-heading {
  font-family: var(--display);
  font-weight: 400;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--accent) 60%, var(--muted));
}

[data-style="rumble"] .feature {
  border-width: 2px;
}

[data-style="rumble"] .feature.on {
  border-color: var(--outline);
  box-shadow: var(--pop-sm);
}

[data-style="rumble"] :is(.status.on, .count-pill) {
  border: 2px solid var(--outline);
}

[data-style="rumble"] .server-banner {
  border-bottom: 2px solid var(--outline);
}

[data-style="rumble"] .server-body .guild-icon {
  border: 2px solid var(--outline);
}

[data-style="rumble"] .login::before {
  border-bottom: 2px solid var(--outline);
}

[data-style="rumble"] .login-art img {
  border: 2px solid var(--outline);
  box-shadow: var(--pop);
}

[data-style="rumble"] .landing-chat {
  border: 2px solid var(--outline);
  box-shadow: 6px 6px 0 var(--outline);
}

[data-style="rumble"] :is(.landing-section h2, .landing-cta h2) {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}

[data-style="rumble"] :is(.landing-stats, .landing-feature, .landing-step, .landing-cta) {
  border: 2px solid var(--outline);
  box-shadow: var(--pop);
}

[data-style="rumble"] .landing-uptime {
  border-top: 2px solid var(--outline);
}

[data-style="rumble"] .uptime-bar:not(.none) {
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / 18%);
}

[data-style="rumble"] .landing-stat strong {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.9rem;
}

[data-style="rumble"] .landing-step-number {
  border: 2px solid var(--outline);
  font-family: var(--display);
  font-weight: 400;
}

/* Branding page: the bot's profile card and an embed in the chosen colour. */
.brand-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .brand-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.brand-column {
  display: grid;
  gap: 16px;
  min-width: 0;
}

#brandingColor {
  width: 64px;
  flex: none;
}

.brand-preview + .help {
  margin-top: 10px;
}

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

.brand-preview {
  display: grid;
  gap: 16px;
}

.brand-card {
  position: relative;
  background: #232428;
  border-radius: 10px;
  overflow: hidden;
}

.brand-banner {
  aspect-ratio: 5 / 2;
  background: var(--brand);
}

.brand-banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-avatar {
  position: relative;
  display: block;
  width: 80px;
  height: 80px;
  margin: -40px 0 0 14px;
  border-radius: 50%;
  border: 5px solid #232428;
  background: #232428;
  object-fit: cover;
}

.brand-card-body {
  padding: 8px 14px 14px;
}

.brand-name {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #f2f3f5;
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}


.app-badge {
  display: inline-block;
  padding: 0 4px;
  border-radius: 4px;
  background: #5865f2;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.5;
  vertical-align: middle;
}

.brand-embed {
  margin-top: 4px;
  padding: 10px 12px;
  background: #2b2d31;
  border-left: 4px solid var(--brand);
  border-radius: 4px;
}

.brand-embed p {
  margin: 4px 0 0;
  font-size: 0.9rem;
}

/* --- Emoji picker (emojiInput) ---------------------------------------------------- */

.emoji-input {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.emoji-input .emoji-value {
  flex: 1;
  min-width: 0;
}

/* The button comes after the text box in the page (so a click on the field's label
   focuses the text box), but shows first. */
.emoji-trigger {
  order: -1;
  flex: none;
  width: 38px;
  min-height: 38px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--muted);
}

.emoji-trigger:hover,
.emoji-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--surface-2);
}

.emoji-shown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.emoji-char {
  font-size: 1.35rem;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
}

.emoji-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.emoji-picker {
  position: absolute;
  z-index: 45;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  display: flex;
  flex-direction: column;
  /* As wide as the field on phones, at most 352px. */
  width: min(352px, 100%);
  min-width: 260px;
  max-height: min(420px, 70vh);
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  animation: pop 0.12s ease-out;
}

.emoji-picker[hidden] {
  display: none;
}

.emoji-search,
.emoji-tabs,
.emoji-hint {
  flex: none;
}

.emoji-tabs {
  display: flex;
  gap: 2px;
  margin: 6px 0 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.emoji-tabs[hidden] {
  display: none;
}

.emoji-tab {
  flex: none;
  width: 32px;
  min-height: 32px;
  padding: 0;
  background: none;
}

.emoji-tab .emoji-char {
  font-size: 1.1rem;
}

.emoji-tab:hover {
  background: var(--surface-2);
}

.emoji-list {
  position: relative;
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.emoji-section-title {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 6px 2px 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.emoji-section .help {
  margin: 2px 2px 8px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 2px;
  padding-bottom: 6px;
}

.emoji-option {
  min-height: 36px;
  padding: 0;
  background: none;
  border-radius: var(--radius-sm);
}

.emoji-option:hover,
.emoji-option:focus-visible {
  background: var(--surface-3);
  outline: none;
}

.emoji-option:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}

.emoji-option[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}

.emoji-hint {
  min-height: 1.5em;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.emoji-none {
  padding: 16px 4px;
  text-align: center;
}

/* --- Leveling: level curve graph -------------------------------------------- */

.curve-card .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.curve-advanced {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 12px 0;
}

.curve-advanced summary {
  cursor: pointer;
  font-weight: 600;
}

.curve-advanced[open] summary {
  margin-bottom: 10px;
}

.curve-advanced .help.error {
  color: var(--danger);
}

.curve-toolbar {
  flex-wrap: wrap;
  margin-top: 12px;
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.inline-field input {
  width: 6rem;
}

.curve-chart {
  margin: 12px 0 4px;
  padding-inline-start: 44px;
}

.curve-plot {
  position: relative;
  touch-action: pan-y;
}

.curve-plot svg {
  display: block;
  width: 100%;
  height: 220px;
  overflow: visible;
}

.curve-plot .grid {
  stroke: var(--border);
  stroke-dasharray: 3 4;
  vector-effect: non-scaling-stroke;
}

.curve-base {
  stroke: var(--muted);
  stroke-opacity: 0.5;
  vector-effect: non-scaling-stroke;
}

.curve-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.curve-this {
  stroke: var(--accent);
}

.curve-standard {
  stroke: var(--muted);
  stroke-dasharray: 6 5;
}

.curve-guide {
  stroke: var(--muted);
  vector-effect: non-scaling-stroke;
}

/* A circle in a stretched SVG would turn oval, so the dot is a zero-length round-capped line. */
.curve-dot {
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.curve-y {
  position: absolute;
  inset-inline-end: calc(100% + 8px);
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.curve-x {
  position: relative;
  height: 1.2rem;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

.curve-x span {
  position: absolute;
  transform: translateX(-50%);
}

[dir="rtl"] .curve-x span {
  transform: translateX(50%);
}

.curve-tip {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  max-width: min(320px, 90%);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lift);
  font-size: 0.8rem;
  color: var(--text);
  pointer-events: none;
}

[dir="rtl"] .curve-tip {
  transform: translateX(50%);
}

.curve-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--muted);
}

.curve-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.curve-key {
  display: inline-block;
  width: 18px;
  border-top: 2px solid var(--accent);
}

.curve-key-standard {
  border-top: 2px dashed var(--muted);
}

.curve-math h3 {
  margin: 16px 0 6px;
  font-size: 0.95rem;
}

.curve-math p {
  margin: 4px 0;
  color: var(--muted);
}

.curve-table td,
.curve-table th {
  white-space: nowrap;
}

.counter-edit .message-with-variables {
  flex: 1;
}

/* A ticket's 1-5 star rating (tickets/support.js). */
.rating-stars {
  color: #f0b232;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Logging page: the server-log events, one block per group. */
.log-event-group {
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.log-event-group h3 {
  margin: 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.log-event-group .toolbar {
  flex-wrap: wrap;
}

/* Channel automation: rows of a channel plus its own numbers or emoji. They
   wrap onto more lines on narrow screens instead of squeezing the fields. */
.automation-rows {
  display: grid;
  gap: 10px;
}
.automation-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.automation-row .field.compact {
  margin: 0;
  flex: 1 1 140px;
  min-width: 0;
}
.automation-row .field.compact:first-child {
  flex: 2 1 200px;
}
.automation-row .field.compact select,
.automation-row .field.compact input {
  width: 100%;
}
.automation-row > button {
  flex: 0 0 auto;
}
.automation-editor .toolbar {
  margin-top: 10px;
  flex-wrap: wrap;
}

/* --- Ticket panels: the list and the several-roles chooser ----------------------- */
.panel-list li.selected {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.panel-list .badge.warn {
  background: color-mix(in srgb, var(--amber, #f0b232) 14%, transparent);
  border-color: color-mix(in srgb, var(--amber, #f0b232) 35%, transparent);
  color: var(--ink);
}

.role-chooser {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  min-width: 0;
}

.role-chooser .role-chips {
  min-height: 28px;
  align-items: center;
}

.role-chooser .role-chip {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.role-chip-remove {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  margin-right: -4px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.role-chip-remove:hover,
.role-chip-remove:focus-visible {
  background: color-mix(in srgb, var(--ink) 12%, transparent);
}

.role-chooser-add {
  width: 100%;
}

.category-roles {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

.ticket-panels .panel-list li > p {
  margin: 0;
}

.ticket-panels .panel-list .toolbar {
  flex-wrap: wrap;
}

/* Quotes page: the card preview and the quote book. */
.quote-preview {
  margin-top: 12px;
}

.quote-card-image {
  display: block;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 1200 / 630;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.quote-card-image[hidden] {
  display: none;
}

.quote-filters > input,
.quote-filters > select {
  min-width: 0;
  flex: 1 1 200px;
}

.quote-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.quote-row {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}

.quote-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.quote-head > .grow {
  overflow-wrap: anywhere;
}

.quote-row textarea {
  width: 100%;
  resize: vertical;
}

/* --- AI assistant: knowledge base ------------------------------------------ */

.kb-list {
  display: grid;
  gap: 8px;
}

.kb-articles,
.kb-matches {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.kb-article {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}

.kb-article.kb-new {
  border-style: dashed;
  background: transparent;
}

.kb-article input,
.kb-article textarea {
  width: 100%;
  min-width: 0;
}

.kb-article input {
  font-weight: 600;
}

.kb-article textarea {
  resize: vertical;
}

.kb-matches li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-wrap: anywhere;
}

/* --- AI assistant: customization ------------------------------------------- */

#aiInstructions,
#aiAvoidTopics,
#aiUrgentWords,
#aiHighWords,
.ai-panel textarea,
.ai-sample {
  width: 100%;
  min-width: 0;
  resize: vertical;
}

.ai-count {
  display: block;
  text-align: end;
  margin-top: 4px;
}

.ai-priorities {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 12px;
  margin-top: 12px;
}

.ai-priorities .field {
  margin-bottom: 0;
}

.ai-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  min-width: 0;
}

.ai-panel > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.ai-panel[open] > summary {
  margin-bottom: 10px;
}

.ai-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
  gap: 10px;
}

.ai-panel-grid .field {
  margin-bottom: 0;
}

.ai-rules {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ai-rules li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.45;
}

.ai-rules li .icon {
  flex: none;
  margin-top: 3px;
  color: var(--muted);
}

.ai-try-output,
.ai-prompt {
  min-width: 0;
}

.ai-try-output:not(:empty) {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.ai-try-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.ai-prompt details {
  margin-top: 10px;
}

.ai-prompt summary {
  cursor: pointer;
  font-weight: 600;
}

.ai-prompt-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 420px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
}

/* --- Appearance menu: more styles and choices ------------------------------------
   Everything here hangs off data-* attributes on <html> set by applyAppearance()
   in app.js: data-style (glass, soft, neon), data-font, data-text, data-corners,
   data-bg, data-headers and data-motion. A custom accent is set as --accent on
   <html> itself. "Style's own" choices set nothing, so each style keeps its look. */

/* The menu: a row of small style tiles, then one row per choice (name on the
   left, buttons on the right), with the rarely changed ones folded away. Sized
   to fit a laptop or phone screen without scrolling. */
dialog.appearance {
  width: min(600px, calc(100vw - 20px));
  max-height: calc(100dvh - 20px);
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* The form fills the dialog, so clicks on the dialog itself are on the backdrop. */
dialog.appearance > form {
  padding: 14px 18px 16px;
}

dialog.appearance::backdrop {
  /* Lighter than other dialogs, so changes show on the page behind. */
  background: rgb(10 10 20 / 22%);
  backdrop-filter: none;
}

.appearance-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.appearance .appearance-top h2 {
  margin: 0;
  font-size: 1.1rem;
}

.appearance-rows {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.appearance-row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  align-items: center;
  gap: 4px 12px;
}

.appearance-label {
  font-size: 0.88rem;
  font-weight: 600;
}

.appearance-label[title] {
  text-decoration: underline dotted color-mix(in srgb, var(--muted) 60%, transparent);
  text-underline-offset: 3px;
  cursor: help;
}

.appearance .segmented {
  justify-self: start;
  padding: 2px;
  gap: 2px;
  border-radius: 10px;
}

.appearance .segment {
  min-height: 28px;
  padding: 3px 10px;
  font-size: 0.85rem;
}

.appearance .swatches {
  gap: 6px;
}

.appearance .swatch {
  width: 28px;
  height: 28px;
  border-width: 2px;
}

.appearance .swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--text);
}

.appearance-more {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.appearance-more > summary {
  width: fit-content;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 650;
  color: color-mix(in srgb, var(--accent) 75%, var(--muted));
}

.appearance-more .appearance-rows {
  margin-top: 10px;
}

.appearance .actions {
  margin-top: 14px;
}

.style-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.style-card {
  display: grid;
  justify-items: start;
  gap: 4px;
  min-height: 0;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: start;
  font-weight: 500;
}

.style-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.style-card[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.style-card strong {
  padding-inline: 2px;
  font-size: 0.82rem;
}

/* Phones: smaller style tiles, all in one row. */
@media (max-width: 520px) {
  dialog.appearance > form {
    padding: 12px 14px 14px;
  }

  /* Name and buttons share a line when they fit, else the buttons wrap below. */
  .appearance-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
  }

  .appearance-label {
    min-width: 5.5rem;
  }

  .appearance-rows {
    gap: 10px;
  }

  .style-cards {
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 5px;
  }

  .style-card {
    justify-items: center;
    padding: 4px;
  }

  .style-card strong {
    font-size: 0.72rem;
  }

  .appearance .style-sample {
    height: 30px;
    padding: 3px;
    gap: 3px;
  }
}

/* A tiny drawing of each style: a header bar and two cards. */
.style-sample {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
  height: 38px;
  padding: 4px;
  border-radius: 7px;
  background: var(--surface-2);
  overflow: hidden;
}

.style-sample span {
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.style-sample span:first-child {
  grid-column: 1 / -1;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 30%, var(--surface)), var(--surface));
}

.style-rumble .style-sample {
  background: #fff6e6;
}

.style-rumble .style-sample span {
  border: 2px solid #24183f;
  border-radius: 5px;
  box-shadow: 2px 2px 0 #24183f;
  background: #fff;
}

.style-rumble .style-sample span:first-child {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
}

.style-glass .style-sample {
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--accent) 70%, transparent), transparent 60%),
    radial-gradient(circle at 85% 80%, color-mix(in srgb, var(--accent-2) 70%, transparent), transparent 60%),
    var(--surface-2);
}

.style-glass .style-sample span {
  background: rgb(255 255 255 / 45%);
  border-color: rgb(255 255 255 / 60%);
}

.style-soft .style-sample span {
  border: none;
  border-radius: 9px;
  box-shadow: 0 3px 8px rgb(16 24 40 / 10%);
}

.style-neon .style-sample {
  background: #0b0b16;
}

.style-neon .style-sample span {
  background: #14142a;
  border-color: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent);
}

.style-neon .style-sample span:first-child {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 45%, #14142a), #14142a);
}

/* The custom color swatch: a rainbow ring with a picker on top. */
.swatch-custom {
  position: relative;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  background:
    radial-gradient(circle, var(--swatch, transparent) 45%, transparent 47%),
    conic-gradient(#ef4444, #f59e0b, #eab308, #22c55e, #06b6d4, #3b82f6, #8b5cf6, #ec4899, #ef4444);
}

.swatch-custom .icon {
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 50%));
}

.swatch-custom input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.swatch-custom:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Fonts. */
[data-font="system"] body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;
}

[data-font="friendly"] body {
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Trebuchet MS", "Segoe UI", "Noto Sans Arabic", sans-serif;
}

[data-font="serif"] body {
  font-family: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, Cambria, "Noto Serif", "Noto Naskh Arabic", serif;
}

[data-font="mono"] body {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Noto Sans Mono", monospace;
  letter-spacing: -0.01em;
}

/* Corners. */
:root[data-corners="sharp"] {
  --radius: 4px;
  --radius-sm: 3px;
}

:root[data-corners="round"] {
  --radius: 20px;
  --radius-sm: 12px;
}

/* --- Glass: frosted, see-through panels over a colorful backdrop. */
:root[data-style="glass"] {
  --surface: rgb(255 255 255 / 62%);
  --surface-2: rgb(255 255 255 / 45%);
  --border: rgb(255 255 255 / 70%);
  --shadow: 0 8px 28px rgb(31 38 135 / 10%);
}

@media (prefers-color-scheme: dark) {
  :root[data-style="glass"]:not([data-theme="light"]) {
    --surface: rgb(26 28 40 / 58%);
    --surface-2: rgb(40 44 60 / 45%);
    --border: rgb(255 255 255 / 10%);
    --shadow: 0 8px 28px rgb(0 0 0 / 35%);
  }
}

:root[data-style="glass"][data-theme="dark"] {
  --surface: rgb(26 28 40 / 58%);
  --surface-2: rgb(40 44 60 / 45%);
  --border: rgb(255 255 255 / 10%);
  --shadow: 0 8px 28px rgb(0 0 0 / 35%);
}

[data-style="glass"] body {
  background:
    radial-gradient(900px 600px at 90% 0%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 65%),
    radial-gradient(800px 600px at 0% 30%, color-mix(in srgb, var(--accent-2) 32%, transparent), transparent 65%),
    radial-gradient(700px 500px at 60% 100%, color-mix(in srgb, var(--accent) 22%, var(--accent-2) 20%), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

[data-style="glass"] :is(.card, .topbar, .sidebar, .hero, .menu, dialog, .save-bar, .switcher) {
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
}

[data-style="glass"] :is(input, select, textarea) {
  background-color: color-mix(in srgb, var(--surface) 80%, transparent);
}

/* --- Soft: rounder, airy and borderless. */
:root[data-style="soft"] {
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 2px 6px rgb(16 24 40 / 4%), 0 10px 30px rgb(16 24 40 / 7%);
  --gap: 20px;
}

[data-style="soft"] :is(.card, .hero) {
  border-color: transparent;
}

[data-style="soft"] :is(button, .button):not(.segment, .swatch, .style-card, .icon-button, .nav-toggle, .nav-group-toggle, .chip-link) {
  border-radius: 999px;
}

[data-style="soft"] .card.toned > .card-title {
  border-bottom-color: transparent;
  padding-bottom: 4px;
}

[data-style="soft"] .chip-icon {
  border-radius: 50%;
}

/* --- Neon: glowing edges and gradient titles. */
:root[data-style="neon"] {
  --glow: color-mix(in srgb, var(--accent) 45%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root[data-style="neon"]:not([data-theme="light"]) {
    --bg: #07070f;
    --surface: #0f0f1d;
    --surface-2: #161628;
    --surface-3: #1f1f36;
    --border: #2a2a48;
  }
}

:root[data-style="neon"][data-theme="dark"] {
  --bg: #07070f;
  --surface: #0f0f1d;
  --surface-2: #161628;
  --surface-3: #1f1f36;
  --border: #2a2a48;
}

[data-style="neon"] :is(.card, .hero) {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent), 0 0 22px color-mix(in srgb, var(--accent) 14%, transparent);
}

[data-style="neon"] .card:hover {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 30px var(--glow);
}

[data-style="neon"] :is(.hero h1, .card-title) {
  background: linear-gradient(90deg, var(--text) 20%, color-mix(in srgb, var(--accent) 70%, var(--text)), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-style="neon"] .card-title > * {
  /* Chips and buttons inside a title keep their own colors. */
  -webkit-text-fill-color: initial;
}

[data-style="neon"] .primary {
  box-shadow: 0 0 18px var(--glow);
}

[data-style="neon"] .nav-link.active {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 0 16px color-mix(in srgb, var(--accent) 20%, transparent);
}

[data-style="neon"] .topbar::after {
  box-shadow: 0 0 14px var(--accent);
}

/* --- Backgrounds. "Style's own" sets nothing. */
[data-bg="plain"] body,
[data-bg="plain"][data-style] body {
  background: var(--bg);
}

[data-bg="dots"] body,
[data-bg="dots"][data-style] body {
  background:
    radial-gradient(color-mix(in srgb, var(--accent) 22%, transparent) 1.1px, transparent 1.4px) 0 0 / 20px 20px,
    radial-gradient(1100px 520px at 85% -120px, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

[data-bg="mesh"] body,
[data-bg="mesh"][data-style] body {
  background:
    radial-gradient(900px 640px at 100% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 65%),
    radial-gradient(760px 600px at 0% 40%, color-mix(in srgb, var(--accent-2) 26%, transparent), transparent 65%),
    radial-gradient(800px 520px at 70% 100%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

/* --- Bold page headers: each page's header painted in its own color. */
[data-headers="bold"] .hero:not(.hero-banner) {
  border-color: transparent;
  background: linear-gradient(120deg, var(--tone, var(--accent)), color-mix(in srgb, var(--tone, var(--accent)) 55%, var(--accent-2)));
  color: #fff;
  box-shadow: 0 14px 34px color-mix(in srgb, var(--tone, var(--accent)) 25%, transparent);
}

[data-headers="bold"] .hero:not(.hero-banner)::before {
  background: radial-gradient(rgb(255 255 255 / 22%) 1.3px, transparent 1.6px) 0 0 / 16px 16px;
}

[data-headers="bold"] .hero:not(.hero-banner) :is(p, .hero-eyebrow) {
  color: rgb(255 255 255 / 88%);
}

[data-headers="bold"] .hero:not(.hero-banner) h1 {
  color: #fff;
  background: none;
  -webkit-text-fill-color: #fff;
}

[data-headers="bold"] .hero:not(.hero-banner) .chip-icon.lg {
  background: rgb(255 255 255 / 95%);
  color: color-mix(in srgb, var(--tone, var(--accent)) 85%, #000);
}

[data-headers="bold"] .hero-fact {
  border-color: rgb(255 255 255 / 40%);
  background: rgb(255 255 255 / 92%);
  color: #101828;
}

[data-headers="bold"] .hero-fact-label {
  color: #667085;
}

/* --- Reduced motion, picked in the menu (the device setting is honored already). */
[data-motion="reduce"] *,
[data-motion="reduce"] *::before,
[data-motion="reduce"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* --- Raid protection ------------------------------------------------------------- */

.raid-status {
  display: grid;
  gap: 16px;
}

.raid-status.raid-locked {
  border-color: color-mix(in srgb, #ef4444 45%, var(--border));
  background: linear-gradient(180deg, rgb(239 68 68 / 8%), transparent 60%), var(--surface);
}

.raid-status.raid-pending {
  border-color: color-mix(in srgb, #f59e0b 45%, var(--border));
}

.raid-state {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.raid-state .help {
  margin: 2px 0 0;
}

.raid-headline {
  margin: 0;
  font-size: 1.15rem;
}

.raid-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 12px;
}

.raid-action {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.raid-action .help {
  margin: 0;
}

.raid-action .toolbar {
  flex-wrap: wrap;
  gap: 8px;
}

.raid-lock-row input {
  flex: 1 1 180px;
  min-width: 0;
}

.raid-tiles {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.raid-switches {
  display: grid;
  gap: 8px;
}

.raid-switches.is-off {
  opacity: 0.55;
}

.raid-switch {
  display: grid;
  gap: 6px;
}

.raid-switch > .field {
  margin: 0 0 0 44px;
}

.raid-then {
  margin: 14px 0 8px;
}

.raid-alert-where {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
}

.raid-chart .seg.raid-join {
  fill: var(--accent);
}

.raid-chart .seg.raid-spike {
  fill: #ef4444;
}

.raid-joins {
  display: grid;
  gap: 2px;
}

.raid-join {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.raid-join:hover {
  background: var(--surface-2);
}

.raid-join-who {
  display: grid;
  min-width: 0;
}

.raid-join-who strong {
  overflow-wrap: anywhere;
}

.raid-join .badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.raid-checks,
.raid-events,
.raid-facts {
  margin: 0;
  padding: 0;
  list-style: none;
}

.raid-checks {
  display: grid;
  gap: 8px;
}

.raid-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.raid-check .grow {
  display: grid;
  gap: 2px;
}

.raid-check-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  background: var(--muted);
}

.raid-check.ok .raid-check-icon {
  background: #22c55e;
}

.raid-check.warn {
  border-color: color-mix(in srgb, #f59e0b 45%, var(--border));
  background: rgb(245 158 11 / 7%);
}

.raid-check.warn .raid-check-icon {
  background: #f59e0b;
}

.raid-check-value {
  flex: none;
  max-width: 40%;
  font-weight: 600;
  text-align: end;
  overflow-wrap: anywhere;
}

.raid-facts {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

.raid-facts li {
  position: relative;
  padding-inline-start: 18px;
}

.raid-facts li::before {
  content: "";
  position: absolute;
  inset-inline-start: 4px;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.raid-events {
  display: grid;
  gap: 2px;
  max-height: 520px;
  overflow-y: auto;
}

.raid-event {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
}

.raid-event:last-child {
  border-bottom: 0;
}

.raid-event time {
  flex: none;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .raid-check {
    flex-wrap: wrap;
  }

  .raid-check-value {
    max-width: none;
    width: 100%;
    padding-inline-start: 34px;
    text-align: start;
  }

  .raid-switch > .field {
    margin-inline-start: 0;
  }
}

/* --- Butterflies: the page loader and the easter eggs (public/fun.js) -------------
   Everything decorative is aria-hidden and pointer-events: none. Less motion
   (the device setting or Appearance > Motion) stops every animation here
   through the rules above, and fun.js skips the swarms. */

.fly {
  display: block;
  width: 48px;
  height: 38px;
  overflow: visible;
}

.fly .wing {
  transform-box: fill-box;
  animation: fly-flap var(--flap, 0.28s) ease-in-out infinite alternate;
}

.fly .wing-left {
  transform-origin: right center;
}

.fly .wing-right {
  transform-origin: left center;
}

.fly .wing-outer {
  fill: var(--fly-a, var(--accent));
}

.fly .wing-inner {
  fill: var(--fly-b, var(--accent-2));
  opacity: 0.85;
}

.fly .fly-body {
  fill: color-mix(in srgb, var(--fly-a, var(--accent)) 30%, #1a1033);
}

.fly .fly-antennae {
  fill: none;
  stroke: color-mix(in srgb, var(--fly-a, var(--accent)) 30%, #1a1033);
  stroke-width: 1.1;
  stroke-linecap: round;
}

@keyframes fly-flap {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0.28);
  }
}

@keyframes fly-bob {
  50% {
    transform: translateY(-9px) rotate(-4deg);
  }
}

/* The loader. Fades in after a moment, so quick pages never flash it. */
.flutter-loader {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  min-height: min(62vh, 460px);
  padding: 32px 16px;
  text-align: center;
  animation: flutter-in 0.35s ease-out 0.18s both;
}

@keyframes flutter-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.flutter-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 160px;
  height: 140px;
}

.flutter-trail {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent), color-mix(in srgb, var(--accent-2) 12%, transparent) 45%, transparent 70%);
  filter: blur(4px);
  animation: flutter-glow 2.4s ease-in-out infinite;
}

@keyframes flutter-glow {
  50% {
    transform: scale(1.14);
    opacity: 0.65;
  }
}

.flutter-main {
  position: relative;
  display: block;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  animation: fly-bob 1.6s ease-in-out infinite;
}

.flutter-main .fly {
  width: 76px;
  height: 61px;
  filter: drop-shadow(0 8px 12px color-mix(in srgb, var(--accent) 35%, transparent));
}

.flutter-main.boop {
  animation: flutter-boop 0.45s ease-out;
}

@keyframes flutter-boop {
  40% {
    transform: translateY(-18px) scale(1.14) rotate(10deg);
  }
}

.flutter-orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;
  animation: flutter-orbit 6s linear infinite;
}

.flutter-friend {
  position: absolute;
  animation: flutter-orbit 6s linear infinite reverse;
}

.flutter-friend .fly {
  --flap: 0.19s;
  width: 24px;
  height: 19px;
}

.flutter-friend-one {
  top: 0;
  left: calc(50% - 12px);
}

.flutter-friend-two {
  bottom: 4px;
  left: 6%;
}

.flutter-friend-two .fly {
  width: 18px;
  height: 14px;
}

@keyframes flutter-orbit {
  to {
    transform: rotate(360deg);
  }
}

.flutter-loader.zoomies .fly {
  --flap: 0.08s;
}

.flutter-loader.zoomies :is(.flutter-orbit, .flutter-friend) {
  animation-duration: 1.4s;
}

.flutter-status {
  margin: 6px 0 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
  font-size: 1.05rem;
}

.flutter-tip {
  min-height: 1.5em;
  max-width: 46ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.flutter-tip.swap {
  animation: flutter-tip 0.4s ease-out;
}

@keyframes flutter-tip {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

.flutter-slow {
  max-width: 48ch;
  margin: 10px 0 0;
  padding: 8px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.9rem;
}

/* A swarm across the screen (Konami code, special days, the 404 game). */
.fly-swarm {
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow: hidden;
  pointer-events: none;
}

.fly-swarm-one {
  position: absolute;
  top: 0;
  left: 0;
  animation: fly-swarm var(--d) cubic-bezier(0.35, 0.05, 0.55, 1) var(--delay) both;
}

.fly-swarm-one .fly {
  width: calc(42px * var(--s));
  height: calc(34px * var(--s));
  animation: fly-wobble 0.7s ease-in-out infinite alternate;
}

@keyframes fly-swarm {
  from {
    transform: translate(var(--x0), var(--y0));
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  50% {
    transform: translate(var(--xm), var(--ym));
  }
  to {
    transform: translate(var(--x1), var(--y1));
  }
}

@keyframes fly-wobble {
  from {
    transform: rotate(-14deg) translateY(-4px);
  }
  to {
    transform: rotate(16deg) translateY(4px);
  }
}

/* One butterfly following the pointer (type "flutter"). */
.fly-follower {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 70;
  pointer-events: none;
  transition: opacity 0.6s;
  will-change: transform;
}

.fly-follower .fly {
  width: 40px;
  height: 32px;
}

.fly-follower.leaving {
  opacity: 0;
}

/* One landing on a search box (search for "butterfly"). */
.fly-landed {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  animation: fly-land 4.2s ease-in-out both;
}

.fly-landed .fly {
  --flap: 0.6s;
  width: 34px;
  height: 28px;
}

@keyframes fly-land {
  from {
    transform: translate(70px, -70px) rotate(25deg);
    opacity: 0;
  }
  22%,
  82% {
    transform: none;
    opacity: 1;
  }
  to {
    transform: translate(-50px, -90px) rotate(-20deg);
    opacity: 0;
  }
}

/* The logo: a hop per click, a loop on the fifth. */
.brand,
.landing-footer-brand {
  position: relative;
}

.logo-hop {
  animation: logo-hop 0.4s ease-out;
}

.logo-loop {
  animation: logo-loop 0.9s cubic-bezier(0.5, -0.3, 0.4, 1.3);
}

@keyframes logo-hop {
  40% {
    transform: translateY(-5px) rotate(-10deg);
  }
}

@keyframes logo-loop {
  50% {
    transform: translateY(-10px) rotate(200deg) scale(1.2);
  }
  to {
    transform: rotate(360deg);
  }
}

/* A special day's badge on the logo (fun.js seasonFor). */
.season-badge {
  position: absolute;
  top: -7px;
  left: 17px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 30%));
  animation: season-sway 2.8s ease-in-out infinite;
}

[dir="rtl"] .season-badge {
  right: 17px;
  left: auto;
}

@keyframes season-sway {
  50% {
    transform: rotate(14deg) translateY(-1px);
  }
}

/* What a found secret says. */
.fun-toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  z-index: 71;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(540px, calc(100vw - 32px));
  padding: 10px 16px 10px 12px;
  border-radius: 14px;
  background: linear-gradient(120deg, #6d4ff0, #c43a8e);
  color: #fff;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: var(--shadow-lift);
  transform: translateX(-50%);
  animation: fun-toast-in 0.35s ease-out;
}

.fun-toast[hidden] {
  display: none;
}

.fun-toast .fly {
  --fly-a: #fff;
  --fly-b: #ffd166;
  flex: none;
  width: 30px;
  height: 24px;
}

@keyframes fun-toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
}

/* Appearance menu: a secret style's card. */
.style-card.style-secret {
  border-style: dashed;
  border-color: #f59e0b;
}

.style-monarch .style-sample {
  background: linear-gradient(135deg, #2a0f3d, #4c1d95);
}

.style-monarch .style-sample span {
  background: #1b1028;
  border-color: #f59e0b;
}

.style-monarch .style-sample span:first-child {
  background: linear-gradient(90deg, #f59e0b, #ea580c 60%, #7c3aed);
}

/* --- Monarch: the secret style (click the logo 5 times). Warm amber wings on
   deep violet. It brings its own accent unless a custom color is picked. */
:root[data-style="monarch"]:not([data-accent="custom"]) {
  --accent: #ea6c0a;
  --accent-2: #7c3aed;
  --accent-text: #ffffff;
}

:root[data-style="monarch"] {
  --bg: #fff8f0;
  --surface-2: #fff1e2;
  --surface-3: #fde4c8;
  --border: #f3d9bc;
}

@media (prefers-color-scheme: dark) {
  :root[data-style="monarch"]:not([data-theme="light"]) {
    --bg: #110a1a;
    --surface: #1a1027;
    --surface-2: #231636;
    --surface-3: #2f1d47;
    --border: #3d2659;
  }
}

:root[data-style="monarch"][data-theme="dark"] {
  --bg: #110a1a;
  --surface: #1a1027;
  --surface-2: #231636;
  --surface-3: #2f1d47;
  --border: #3d2659;
}

[data-style="monarch"] body {
  background-image:
    radial-gradient(ellipse at 8% -10%, rgb(245 158 11 / 16%), transparent 50%),
    radial-gradient(ellipse at 100% 0%, rgb(124 58 237 / 18%), transparent 45%);
  background-attachment: fixed;
}

[data-style="monarch"] :is(.card, .hero) {
  box-shadow: inset 0 3px 0 color-mix(in srgb, var(--accent) 80%, transparent), var(--shadow);
}

[data-style="monarch"] :is(.hero h1, .card-title) {
  background: linear-gradient(90deg, var(--text) 25%, color-mix(in srgb, var(--accent) 80%, var(--text)), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-style="monarch"] .card-title > * {
  -webkit-text-fill-color: initial;
}

[data-style="monarch"] .primary {
  background: linear-gradient(120deg, #f59e0b, #ea580c 55%, #c2410c);
  color: #fff;
}

[data-style="monarch"] .topbar::after {
  background: linear-gradient(90deg, #f59e0b, #ea580c, #7c3aed);
}

/* --- The 404 page (src/dashboard/notFound.html) ----------------------------------- */
.not-found {
  display: grid;
  gap: 24px;
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 16px 56px;
}

.not-found-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.not-found-code {
  display: flex;
  align-items: center;
  gap: 0.08em;
  margin: 0;
  background: linear-gradient(120deg, #7c5cff, #d9469f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(4.5rem, 16vw, 8rem);
  font-weight: 800;
  line-height: 1;
}

.not-found-fly {
  --fly-a: #7c5cff;
  --fly-b: #ffd166;
  width: 0.9em;
  height: 0.72em;
  animation: fly-bob 1.6s ease-in-out infinite;
}

.not-found h1 {
  margin: 0;
  font-size: 1.7rem;
}

.not-found-text {
  max-width: 46ch;
  margin: 0;
  color: var(--muted);
}

.not-found-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.catch-game {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.catch-game h2 {
  margin: 0;
  font-size: 1.1rem;
}

.catch-score {
  margin: 0;
  color: var(--muted);
}

.catch-field {
  position: relative;
  width: 100%;
  height: 260px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle at 20% 80%, color-mix(in srgb, #10b981 18%, transparent), transparent 40%),
    radial-gradient(circle at 80% 30%, color-mix(in srgb, #d9469f 14%, transparent), transparent 40%),
    var(--surface-2);
}

.catch-field .catch-fly {
  position: absolute;
  min-height: 0;
  padding: 6px;
  border: none;
  border-radius: 50%;
  background: none;
  box-shadow: none;
  cursor: pointer;
  translate: -50% -50%;
  transition:
    left 0.9s ease-in-out,
    top 0.9s ease-in-out;
}

.catch-fly .fly {
  width: 44px;
  height: 36px;
}

.catch-fly:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.catch-fly.caught {
  animation: catch-pop 0.26s ease-out forwards;
}

@keyframes catch-pop {
  to {
    opacity: 0;
    transform: scale(1.7);
  }
}

/* Type "rabble": the logo and every butterfly cycle through colors. */
.fun-rainbow :is(.brand img, .landing-footer-brand img, .fly) {
  animation: fun-hue 2.4s linear infinite;
}

@keyframes fun-hue {
  to {
    filter: hue-rotate(360deg);
  }
}

/* Double-click the Online/Offline badge: a heartbeat. */
.landing-status.fun-pulse {
  animation: fun-pulse 0.9s ease-out 2;
}

@keyframes fun-pulse {
  15% {
    transform: scale(1.18);
  }
  30% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.12);
  }
}

/* The napping butterfly, after 90 quiet seconds. */
.fly-sleeper {
  position: fixed;
  top: calc(var(--topbar) + 12px);
  right: 12px;
  z-index: 5;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 4px;
  border: none;
  border-radius: 50%;
  background: none;
  box-shadow: none;
  cursor: pointer;
  opacity: 0.85;
  animation: flutter-in 0.6s ease-out both;
}

[dir="rtl"] .fly-sleeper {
  right: auto;
  left: 12px;
}

.fly-sleeper .fly {
  --flap: 2.6s;
  width: 30px;
  height: 24px;
  transform: rotate(-12deg);
}

.fly-zzz {
  position: absolute;
  top: -10px;
  right: -6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  animation: fly-zzz 2.4s ease-in-out infinite;
}

@keyframes fly-zzz {
  50% {
    transform: translate(4px, -5px);
    opacity: 0.4;
  }
}

.fly-sleeper.waking {
  animation: fly-wake 0.9s ease-in forwards;
}

.fly-sleeper.waking .fly-zzz {
  display: none;
}

@keyframes fly-wake {
  to {
    transform: translate(-60px, -120px) rotate(-30deg);
    opacity: 0;
  }
}

/* --- Basic and Advanced views (pageViews in app.js) ----------------------------- */

.content[data-view="basic"] .only-advanced,
.content[data-view="advanced"] .only-basic,
.content[data-view="list"] .only-setup,
.content[data-view="setup"] .only-list {
  display: none !important;
}

.page-view-switch .segment {
  min-width: 5.5em;
}

.advanced-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  border-style: dashed;
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}

.advanced-hint-text {
  display: grid;
  flex: 1 1 320px;
  gap: 8px;
  min-width: 0;
}

.advanced-hint-text > strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.advanced-hint-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-link {
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: none;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 550;
}

.chip-link:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
}

/* Plans: the Pro badge, "Pro raises this" notes and the Overview's plan card. */
.pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-inline-start: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #d946ef);
  white-space: nowrap;
}

.plan-note {
  margin-block: 6px 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, #7c3aed 8%, transparent);
  border: 1px solid color-mix(in srgb, #7c3aed 20%, transparent);
}

.plan-perks {
  margin: 0 0 10px;
  padding-inline-start: 1.2em;
}

.plan-perks li + li {
  margin-top: 2px;
}

/* The Pro page: one centred column, never wider than reads well. */
.pro-wrap {
  max-width: 1080px;
  margin-inline: auto;
  display: grid;
  gap: 16px;
}

.pro-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (min-width: 1000px) {
  .pro-page {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pro-page > .pro-span {
    grid-column: 1 / -1;
  }

  .pro-page .plan-compare-wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Selectors carry .pro-page so they beat the base .pro-faq rule below. */
  .pro-page .pro-faq {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .pro-page > .pro-span .pro-servers {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

.pro-subscriptions,
.pro-servers {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.pro-subscription {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.pro-subscription-main,
.pro-subscription-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.pro-subscription-price {
  margin-inline-start: auto;
  font-weight: 650;
}

.pro-subscription-meta {
  font-size: 0.9rem;
}

.pro-lead {
  font-size: 1.02rem;
  margin-top: 0;
}

.badge-warn {
  background: rgb(245 158 11 / 12%);
  border-color: rgb(245 158 11 / 30%);
  color: color-mix(in srgb, #d97706 85%, var(--ink));
}

.badge-danger {
  background: rgb(239 68 68 / 12%);
  border-color: rgb(239 68 68 / 30%);
  color: color-mix(in srgb, #dc2626 85%, var(--ink));
}

/* The plans to choose from. */
.pro-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-block: 12px;
}

.pro-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.pro-option.featured {
  border-color: color-mix(in srgb, #7c3aed 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, #7c3aed 30%, transparent), 0 12px 30px -18px #7c3aed;
}

.pro-option-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pro-option-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.pro-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0;
}

.pro-price strong {
  font-size: 1.9rem;
  line-height: 1.1;
}

.pro-option .help {
  margin: 0;
}

.pro-option-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  flex: 1;
}

.pro-option-list li {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.pro-option-list .icon,
.plan-yes .icon {
  color: #22c55e;
  flex: none;
  margin-top: 3px;
}

.pro-option > button {
  justify-content: center;
}

.pro-more {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.pro-more summary {
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

/* "1 of 3 used" over the server list. */
.pro-meter {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.pro-meter-text {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
}

.pro-meter-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.pro-meter-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #d946ef);
  transition: width 0.4s ease;
}

/* Free vs Pro. */
.plan-compare-wrap {
  overflow-x: auto;
  display: grid;
  gap: 4px 20px;
  align-items: start;
}

.plan-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.plan-compare th,
.plan-compare td {
  padding: 5px 8px;
  text-align: start;
  border-bottom: 1px solid var(--border);
}

.plan-compare td {
  text-align: center;
  white-space: nowrap;
}

.plan-compare thead th:not(:first-child) {
  text-align: center;
}

.plan-compare tbody th {
  font-weight: 500;
}

.plan-compare .plan-pro-col {
  background: color-mix(in srgb, #7c3aed 7%, transparent);
}

.plan-compare-group th {
  padding-top: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.plan-yes {
  display: inline-flex;
}

.plan-free-badge {
  font-size: 0.7rem;
}

/* "Free" next to a server's name, and "Free: 25 · Pro: 50" by a count. */
.plan-free-chip {
  display: inline-flex;
  align-items: center;
  margin-inline-start: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 650;
  vertical-align: middle;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

.pro-badge.trial {
  background: linear-gradient(135deg, #0ea5e9, #7c3aed);
}

.server-badges {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: none;
  margin-top: 8px;
}

.server-body .server-badges .badge {
  margin-top: 0;
}

.server-badges .pro-badge,
.server-badges .plan-free-chip {
  margin-inline-start: 0;
}

.plan-hint {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  text-decoration: none;
}

.plan-hint:hover {
  color: var(--accent);
  text-decoration: underline;
}

.pro-faq {
  display: grid;
  gap: 6px;
}

.pro-faq details {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}

.pro-faq summary {
  cursor: pointer;
  font-weight: 600;
}

.pro-faq p {
  margin: 8px 0 2px;
  color: var(--muted);
  line-height: 1.55;
}

.pro-subscription.ended {
  opacity: 0.7;
}

.pro-server {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.pro-server.wanted {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

.pro-server-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .pro-server {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .pro-server > :nth-child(n + 3) {
    grid-column: 2;
    justify-self: start;
  }
}

.dev-plan {
  flex-basis: 100%;
}

.dev-plan summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
}

.dev-plan[open] summary {
  color: var(--text);
}

.dev-plan-fields {
  display: grid;
  grid-template-columns: minmax(0, 15em) minmax(0, 1fr);
  gap: 8px;
  margin-block: 8px;
}

.dev-plan .toolbar {
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 520px) {
  .dev-plan-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The landing page's Free and Pro section. */
.landing-plans {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: stretch;
}

.landing-plan {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  align-content: start;
  gap: 12px;
  margin: 0;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.landing-plan:hover {
  transform: translateY(-4px);
}

.landing-plan.pro {
  border-color: color-mix(in srgb, #7c3aed 50%, var(--border));
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, #d946ef 16%, transparent), transparent 60%),
    radial-gradient(90% 80% at 0% 100%, color-mix(in srgb, #7c3aed 18%, transparent), transparent 60%),
    color-mix(in srgb, var(--surface) 85%, transparent);
  box-shadow: 0 18px 40px -22px #7c3aed;
}

.landing-plan.pro:hover {
  box-shadow: 0 24px 50px -20px #7c3aed;
}

.landing-plan h3 {
  margin: 0;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.landing-plan-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}

.landing-plan-price strong {
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: -0.02em;
}

.landing-plan-price span,
.landing-plan-for {
  color: var(--muted);
  margin: 0;
}

.landing-plan-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.landing-plan-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.landing-plan-list .icon {
  color: #22c55e;
  flex: none;
  margin-top: 2px;
}

.landing-plan-limits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, #7c3aed 8%, transparent);
  border: 1px solid color-mix(in srgb, #7c3aed 22%, transparent);
  font-size: 0.9rem;
}

.landing-plan-limits > span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.landing-plan .landing-actions {
  margin-top: 4px;
}

.landing-plan-note {
  margin: 14px auto 0;
  max-width: 720px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.landing-plan-fly {
  position: absolute;
  z-index: -1;
  --flap: 0.4s;
  opacity: 0.55;
  pointer-events: none;
  animation: fly-drift 24s ease-in-out infinite;
}

.landing-plan-fly .fly {
  width: 30px;
  height: 24px;
}

.landing-plan-fly-1 { top: 10%; right: 8%; }
.landing-plan-fly-2 { bottom: 12%; right: 30%; animation-delay: -11s; opacity: 0.35; }

@media (max-width: 860px) {
  .landing-plans {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .landing-plan,
  .landing-plan:hover {
    transform: none;
    transition: none;
  }

  .landing-plan-fly {
    animation: none;
  }
}

/* --- Pro: the gold-violet look ------------------------------------------------------
   The Pro badge, a Pro server's Overview header with its butterfly, and the two
   Pro styles in the Appearance menu (locked without Pro). */
.pro-badge {
  background: linear-gradient(135deg, #f5b83d, #a855f7 55%, #7c3aed);
  text-shadow: 0 1px 1px rgb(0 0 0 / 25%);
}

.pro-badge.mini {
  margin-inline-start: 4px;
  padding: 0 5px;
  font-size: 0.62rem;
}

.hero.hero-pro {
  position: relative;
  border-color: color-mix(in srgb, #f5b83d 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, #a855f7 25%, transparent), var(--shadow);
}

.hero.hero-pro::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, #f5b83d, #a855f7, #7c3aed);
  pointer-events: none;
}

.pro-hero-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pro-hero-mark .pro-fly {
  --fly-a: #f5b83d;
  --fly-b: #a855f7;
  width: 44px;
  height: 36px;
  animation: fly-bob 2.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .pro-hero-mark .pro-fly {
    animation: none;
  }
}

:root[data-motion="reduce"] .pro-hero-mark .pro-fly {
  animation: none;
}

.style-card.style-pro {
  border-color: color-mix(in srgb, #f5b83d 60%, var(--border));
}

.style-card.style-pro[aria-disabled="true"] {
  opacity: 0.65;
}

.style-regal .style-sample {
  background: linear-gradient(135deg, #1a0f2e, #3b1d6e);
}

.style-regal .style-sample span {
  background: #241538;
  border-color: #f5b83d;
}

.style-regal .style-sample span:first-child {
  background: linear-gradient(90deg, #f5b83d, #a855f7);
}

.style-aurora .style-sample {
  background: linear-gradient(135deg, #062a2a, #1e1b4b);
}

.style-aurora .style-sample span {
  background: #0b1f2e;
  border-color: #2dd4bf;
}

.style-aurora .style-sample span:first-child {
  background: linear-gradient(90deg, #2dd4bf, #6366f1);
}

/* Regal: gold on royal violet. */
:root[data-style="regal"]:not([data-accent="custom"]) {
  --accent: #a855f7;
  --accent-2: #f5b83d;
  --accent-text: #ffffff;
}

:root[data-style="regal"] {
  --bg: #fbf7ff;
  --surface-2: #f5edff;
  --surface-3: #ebdcff;
  --border: #e2cff8;
}

@media (prefers-color-scheme: dark) {
  :root[data-style="regal"]:not([data-theme="light"]) {
    --bg: #0e0918;
    --surface: #160f26;
    --surface-2: #1f1534;
    --surface-3: #2a1d45;
    --border: #3a2a5c;
  }
}

:root[data-style="regal"][data-theme="dark"] {
  --bg: #0e0918;
  --surface: #160f26;
  --surface-2: #1f1534;
  --surface-3: #2a1d45;
  --border: #3a2a5c;
}

[data-style="regal"] body {
  background-image:
    radial-gradient(ellipse at 0% -10%, rgb(245 184 61 / 14%), transparent 50%),
    radial-gradient(ellipse at 100% 0%, rgb(168 85 247 / 18%), transparent 45%);
  background-attachment: fixed;
}

[data-style="regal"] :is(.card, .hero) {
  box-shadow: inset 0 2px 0 color-mix(in srgb, #f5b83d 70%, transparent), var(--shadow);
}

[data-style="regal"] .primary {
  background: linear-gradient(120deg, #a855f7, #7c3aed 60%, #6d28d9);
  color: #fff;
}

[data-style="regal"] .topbar::after {
  background: linear-gradient(90deg, #f5b83d, #a855f7, #7c3aed);
}

/* Aurora: northern lights, teal into indigo. */
:root[data-style="aurora"]:not([data-accent="custom"]) {
  --accent: #14b8a6;
  --accent-2: #6366f1;
  --accent-text: #ffffff;
}

:root[data-style="aurora"] {
  --bg: #f3fbfb;
  --surface-2: #e6f6f5;
  --surface-3: #d3efec;
  --border: #c6e6e3;
}

@media (prefers-color-scheme: dark) {
  :root[data-style="aurora"]:not([data-theme="light"]) {
    --bg: #061217;
    --surface: #0b1b22;
    --surface-2: #10252e;
    --surface-3: #16313c;
    --border: #1f4250;
  }
}

:root[data-style="aurora"][data-theme="dark"] {
  --bg: #061217;
  --surface: #0b1b22;
  --surface-2: #10252e;
  --surface-3: #16313c;
  --border: #1f4250;
}

[data-style="aurora"] body {
  background-image:
    radial-gradient(ellipse at 10% -10%, rgb(45 212 191 / 16%), transparent 50%),
    radial-gradient(ellipse at 90% 0%, rgb(99 102 241 / 16%), transparent 45%);
  background-attachment: fixed;
}

[data-style="aurora"] .primary {
  background: linear-gradient(120deg, #14b8a6, #0ea5e9 55%, #6366f1);
  color: #fff;
}

[data-style="aurora"] .topbar::after {
  background: linear-gradient(90deg, #2dd4bf, #0ea5e9, #6366f1);
}

/* The card style picker (Leveling, Welcome & leave). */
.card-look {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.card-look-preview {
  width: 100%;
  max-width: 560px;
  height: auto;
  border-radius: 14px;
  background: var(--surface-2);
}

.card-look-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Pro page extras: the launch offer, early-supporter note, gifts, referrals
   and the free Pro program. */
.pro-launch,
.pro-early {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, #f5b83d 55%, var(--border));
  border-radius: 14px;
  background: linear-gradient(120deg, color-mix(in srgb, #f5b83d 14%, var(--surface)), color-mix(in srgb, #a855f7 14%, var(--surface)));
}

.pro-launch p {
  margin: 2px 0 0;
}

.pro-gifts,
.dev-requests-list {
  display: grid;
  gap: 8px;
  margin: 8px 0;
  padding: 0;
  list-style: none;
}

.pro-gift {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pro-gift code {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.pro-redeem,
.pro-program {
  display: grid;
  gap: 8px;
  max-width: 560px;
}

.pro-refer {
  display: flex;
  gap: 8px;
  max-width: 560px;
}

.pro-refer input {
  flex: 1;
  min-width: 0;
}

.dev-requests {
  margin-top: 16px;
}

.dev-request {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.dev-request-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dev-request-about {
  margin: 6px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* --- Partners: the home page's section and /partners (partners.js). */
.partner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

/* One partner centres instead of stretching across the page. */
.landing .partner-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 380px));
  justify-content: center;
}

.partner-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  align-content: start;
  gap: 12px;
  margin: 0;
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--tone) 30%, var(--border));
  border-radius: calc(var(--radius) + 6px);
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--tone) 14%, transparent), transparent 60%),
    color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px);
  scroll-margin-top: 84px;
}

.partner-card,
.landing.motion .partner-card.reveal.seen {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.partner-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--tone) 55%, var(--border));
  box-shadow: 0 18px 40px -22px var(--tone);
}

.partner-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.partner-logo {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 8px 20px -10px var(--tone);
}

.partner-name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.partner-name h3 {
  margin: 0;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.partner-name .muted {
  font-size: 0.9rem;
}

.partner-tagline {
  margin: 0;
  font-weight: 600;
}

.partner-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.partner-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.partner-since {
  margin: 0;
  font-size: 0.85rem;
}

.landing-partners-more {
  display: flex;
  justify-content: center;
  margin: 0;
}

/* /partners: the "Become a partner" card. */
.partners-join {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  border-color: color-mix(in srgb, var(--tone) 35%, var(--border));
  background:
    radial-gradient(90% 120% at 0% 0%, color-mix(in srgb, var(--tone) 12%, transparent), transparent 60%),
    var(--surface);
}

.partners-join > div {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.partners-join h2,
.partners-join p {
  margin: 0;
}

.partners-join p {
  color: var(--muted);
}

@media (max-width: 560px) {
  .partners-join {
    flex-direction: column;
    gap: 12px;
  }

  .partner-links .button {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .partner-card,
  .partner-card:hover {
    transition: none;
    transform: none;
  }
}
