:root {
  /* Brand palette sampled from logo.png and banner.jpg */
  --bg: #1b1e25;
  --surface: #232830;
  --surface-2: #2c323c;
  --border: #363d49;
  --text: #eceef2;
  --muted: #9aa3b2;
  --accent: #b5764f;          /* copper monogram */
  --accent-hover: #c98a63;    /* lit copper */
  --accent-deep: #7a4a2f;     /* dark chocolate */
  --gold: #e3c48f;            /* banner tagline */
  --discord: #5865f2;         /* reserved for Discord's own branding */
  --success: #57f287;
  --danger: #ed4245;
  --warning: #fee75c;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #faf7f4;
    --surface: #ffffff;
    --surface-2: #f3eee9;
    --border: #e6ddd4;
    --text: #241c16;
    --muted: #6b5f55;
    --accent: #9c6140;
    --accent-hover: #7a4a2f;
    --gold: #a97f3e;
    --shadow: 0 2px 8px rgba(60, 40, 25, 0.08);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── nav ───────────────────────────────────────────────────────────── */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav .brand {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav .brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: block;
}

.nav .brand:hover { text-decoration: none; }
.nav .spacer { margin-left: auto; }

.nav a.link {
  color: var(--muted);
  font-size: 14px;
  padding: 6px 2px;
}

.nav a.link:hover, .nav a.link.active { color: var(--text); text-decoration: none; }

.lang-switch { display: flex; align-items: center; gap: 2px; }
.lang-switch a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 7px;
  border-radius: 6px;
}
.lang-switch a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.lang-switch a.active { color: var(--accent); background: var(--surface-2); }

.avatar { border-radius: 50%; vertical-align: middle; }

.userchip {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--muted);
}

/* ── layout ────────────────────────────────────────────────────────── */
.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 24px 80px; }
.narrow { max-width: 780px; }

h1 { font-size: 28px; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 19px; margin: 0 0 14px; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 28px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }
.mt { margin-top: 22px; }

/* ── stat tiles ────────────────────────────────────────────────────── */
.stat { text-align: left; }
.stat .label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stat .value {
  font-size: 30px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat .delta { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 10px 18px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { border-color: var(--muted); background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── server cards ──────────────────────────────────────────────────── */
.server-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--text);
}
.server-card:hover { border-color: var(--accent); text-decoration: none; }
.server-card .icon {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: var(--surface-2);
  display: grid; place-items: center;
  font-weight: 700; color: var(--muted);
  flex-shrink: 0;
}
.server-card .icon img { width: 46px; height: 46px; border-radius: 14px; }
.server-card .name { font-weight: 600; }
.server-card .meta { color: var(--muted); font-size: 13px; }

.badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}
.badge.on { color: var(--success); border-color: rgba(87, 242, 135, 0.35); }
.badge.off { color: var(--muted); }

/* ── charts ────────────────────────────────────────────────────────── */
.chart { width: 100%; height: 220px; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart-tip {
  position: fixed;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  box-shadow: var(--shadow);
  z-index: 50;
  white-space: nowrap;
}

/* ── bars / tables ─────────────────────────────────────────────────── */
.bar-row {
  display: grid;
  grid-template-columns: 1fr 3fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
}
.bar-row .name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--surface-2); border-radius: 5px; height: 9px; overflow: hidden; }
.bar-fill { background: var(--accent); height: 100%; border-radius: 5px; }
.bar-row .count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); }
th {
  color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num { font-variant-numeric: tabular-nums; }

.rank { font-weight: 700; color: var(--muted); width: 48px; }
.rank.top1 { color: #ffd700; }
.rank.top2 { color: #c0c0c0; }
.rank.top3 { color: #cd7f32; }

.member { display: flex; align-items: center; gap: 10px; }
.member img { width: 28px; height: 28px; border-radius: 50%; }

/* ── forms ─────────────────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 13px; margin-bottom: 7px; }

input[type="text"], input[type="number"], input[type="email"], input[type="password"], select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { min-height: 80px; resize: vertical; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .title { font-weight: 600; font-size: 14.5px; }
.toggle-row .desc { color: var(--muted); font-size: 13px; }

.switch { position: relative; width: 44px; height: 25px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s;
}
.slider::before {
  content: "";
  position: absolute;
  width: 17px; height: 17px;
  left: 3px; top: 3px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.18s, background 0.18s;
}
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(19px); background: #fff; }

/* ── misc ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: 9px;
  padding: 13px 20px;
  box-shadow: var(--shadow);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.22s;
  z-index: 100;
  font-size: 14px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-left-color: var(--danger); }

.empty { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; flex-wrap: wrap; }
.tabs a {
  padding: 9px 15px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

.hero { text-align: center; padding: 72px 24px 56px; }
.hero h1 { font-size: clamp(32px, 6vw, 46px); margin-bottom: 14px; }
.hero p { color: var(--muted); font-size: 17px; max-width: 580px; margin: 0 auto 30px; }

@media (max-width: 640px) {
  .wrap { padding: 22px 16px 60px; }
  .nav-inner { padding: 12px 16px; gap: 14px; }
  .nav a.link.hide-sm { display: none; }
  .bar-row { grid-template-columns: 1fr 2fr auto; }
}

/* ── config page layout ────────────────────────────────────────────── */
.config-layout { display: grid; grid-template-columns: 200px 1fr; gap: 26px; align-items: start; }

.section-nav {
  position: sticky;
  top: 74px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.section-nav a {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--surface);
}
.section-nav a:hover { color: var(--text); border-color: var(--border); text-decoration: none; }
.section-nav a.active { color: var(--text); background: var(--surface-2); border-color: var(--accent); }

/* Category tabs: only the active section shows -- see settings.js's tab switcher. */
.config-body section.card { display: none; }
.config-body section.card.active { display: block; }

.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; flex: 0 1 auto; }

.btn.small { padding: 6px 13px; font-size: 13px; }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.list-row:last-child { border-bottom: none; }

select[multiple] { padding: 6px; }
select[multiple] option { padding: 4px 6px; border-radius: 4px; }

/* ── member editor drawer ──────────────────────────────────────────── */
.drawer {
  position: fixed;
  inset: auto 0 0 0;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
  z-index: 60;
  animation: slide-up 0.18s ease-out;
}
.drawer-inner { max-width: 820px; margin: 0 auto; padding: 22px 24px 40px; }

@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 860px) {
  .config-layout { grid-template-columns: 1fr; }
  .section-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
  }
  .section-nav a { white-space: nowrap; }
}

/* ── pricing ───────────────────────────────────────────────────────── */
.pricing { align-items: stretch; }

.price-card {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-top: 26px;
}
.price-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }

.ribbon {
  position: absolute;
  top: -11px; left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 13px;
  border-radius: 999px;
  white-space: nowrap;
}

.price-head { text-align: center; margin-bottom: 18px; }
.price-emoji { font-size: 32px; margin-bottom: 6px; }

.price-amount { text-align: center; margin-bottom: 20px; }
.price-amount .big { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; }
.price-amount .per { color: var(--muted); font-size: 15px; }
.price-amount .yearly { color: var(--success); font-size: 13px; margin-top: 5px; font-weight: 600; }

.price-list {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  flex: 1;
  font-size: 14px;
}
.price-list li { padding: 7px 0 7px 24px; position: relative; border-bottom: 1px solid var(--border); }
.price-list li:last-child { border-bottom: none; }
.price-list li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 700; }
.price-list li.no { color: var(--muted); }
.price-list li.no::before { content: "—"; color: var(--muted); }

/* ── footer ────────────────────────────────────────────────────────── */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 48px 24px 30px; }
.footer-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 38px;
}
.footer-brand .n { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.footer-brand p { color: var(--muted); font-size: 13.5px; margin: 11px 0 0; line-height: 1.6; max-width: 280px; }
.footer-col h5 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 13px;
  font-weight: 700;
}
.footer-col a { display: block; color: var(--text); font-size: 14px; margin-bottom: 9px; opacity: 0.82; }
.footer-col a:hover { opacity: 1; text-decoration: none; color: var(--accent); }
.footer-bottom {
  max-width: 1100px;
  margin: 36px auto 0;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}


/* ── motion ────────────────────────────────────────────────────────── */
/* Scoped to .motion, which motion.js adds only when it runs and the user
   has not asked for reduced motion. Without it, nothing is ever hidden. */
.motion .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.22, 0.8, 0.3, 1);
  will-change: opacity, transform;
}
.motion .reveal.in { opacity: 1; transform: none; }

/* Stagger children of a revealed group. */
.motion .reveal.in > * { animation: rise 0.5s cubic-bezier(0.22, 0.8, 0.3, 1) backwards; }
.motion .stagger.in > *:nth-child(1) { animation-delay: 0.04s; }
.motion .stagger.in > *:nth-child(2) { animation-delay: 0.08s; }
.motion .stagger.in > *:nth-child(3) { animation-delay: 0.12s; }
.motion .stagger.in > *:nth-child(4) { animation-delay: 0.16s; }
.motion .stagger.in > *:nth-child(5) { animation-delay: 0.20s; }
.motion .stagger.in > *:nth-child(6) { animation-delay: 0.24s; }
.motion .stagger.in > *:nth-child(7) { animation-delay: 0.28s; }
.motion .stagger.in > *:nth-child(8) { animation-delay: 0.32s; }
.motion .stagger.in > *:nth-child(n+9) { animation-delay: 0.36s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Interactive polish */
.btn { transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.card { transition: border-color 0.16s ease, box-shadow 0.16s ease; }
.server-card { transition: border-color 0.16s ease, transform 0.16s ease; }
.server-card:hover { transform: translateY(-2px); }

.nav { transition: box-shadow 0.2s ease; }
.nav.scrolled { box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18); }

.switch .slider, .switch .slider::before { transition: background 0.18s ease, transform 0.18s ease; }
tbody tr { transition: background 0.12s ease; }

/* Anyone who has asked for less motion gets none of it. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
