:root {
  color-scheme: dark;
  --bg: #15120f;
  --bg-2: #1b1714;
  --panel: #211c18;
  --panel-2: #2a241f;
  --line: #3a312a;
  --line-2: #4a3f36;
  --text: #f4ede5;
  --muted: #b3a597;
  --faint: #7d7066;
  --accent: #e8a95b;
  --accent-2: #f3c27f;
  --accent-ink: #2b1907;
  --ok: #5fd38d;
  --warn: #f3c04f;
  --bad: #f2777a;
  --blurple: #5865f2;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  /* Discord-like preview */
  --dc-bg: #313338;
  --dc-side: #2b2d31;
  --dc-dark: #1e1f22;
  --dc-text: #dbdee1;
  --dc-muted: #949ba4;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.01em; margin: 0; line-height: 1.15; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
[hidden] { display: none !important; }

/* ── buttons & inputs ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  padding: 10px 16px; border-radius: 10px; font: 600 14px var(--font); cursor: pointer;
  text-decoration: none; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: #342c25; border-color: #5a4c40; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.discord { background: var(--blurple); border-color: var(--blurple); color: #fff; }
.btn.discord:hover { background: #4752c4; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.ok { background: #1f3b2b; border-color: #2c5a3f; color: #b9f3cf; }
.btn.bad { background: #43211f; border-color: #6a302d; color: #ffc9c9; }
.btn.big { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 6px; width: 32px; height: 32px; }

label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
input[type=text], input[type=number], textarea, select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: 15px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 80px; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232, 169, 91, .18); }
.prefixed { position: relative; }
.prefixed > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; font-weight: 600; }
.prefixed > input { padding-left: 28px; }

/* switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 42px; height: 24px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(232, 169, 91, .35); }

/* chips (multi-select role pickers) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--muted); font: 600 13px var(--font); cursor: pointer;
}
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, #99aab5); }
.chip.on { border-color: var(--accent); background: rgba(232, 169, 91, .12); color: var(--text); }
.chip.on::before { content: "✓"; color: var(--accent); font-weight: 800; }
.chip.locked { cursor: default; opacity: .8; }

/* segmented */
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 7px 12px; border-radius: 7px; font: 600 13px var(--font); cursor: pointer; }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; }

/* colors */
.colors { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer; padding: 0; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--c); }
.swatch.custom { background: conic-gradient(#f87171, #fbbf24, #4ade80, #60a5fa, #c084fc, #f87171); position: relative; overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 14px; }
.card h3 { font-size: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.pill.ok { color: #b9f3cf; background: #1d3527; border-color: #2c5a3f; }
.pill.warn { color: #fde6a8; background: #3a2f15; border-color: #5d4b1d; }
.pill.bad { color: #ffc9c9; background: #3d1f1e; border-color: #6a302d; }
.pill.new { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.hint { display: block; gap: 10px; padding: 12px 14px; border-radius: 10px; background: rgba(232, 169, 91, .08); border: 1px solid rgba(232, 169, 91, .25); color: #f1dcc0; font-size: 14px; }
.hint.blue { background: rgba(88, 101, 242, .1); border-color: rgba(88, 101, 242, .35); color: #d0d4ff; }
.hint.bad { background: rgba(242, 119, 122, .08); border-color: rgba(242, 119, 122, .35); color: #ffd6d6; }

/* toasts */
#toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 4px solid var(--ok); padding: 12px 14px; border-radius: 10px; box-shadow: var(--shadow); animation: up .2s ease-out; }
.toast.bad { border-left-color: var(--bad); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.25); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
