:root {
  --bg: #0f0d17;
  --bg-2: #171425;
  --card: #1c1830;
  --card-2: #241f3b;
  --line: #312a4d;
  --text: #ece8f6;
  --muted: #a49cbc;
  --accent: #ffb661;
  --accent-2: #a98bff;
  --ok: #6fd3a0;
  --warn: #f5c16c;
  --bad: #f07a7a;
  --discord: #5865f2;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #faf7f2;
    --bg-2: #f2ede4;
    --card: #ffffff;
    --card-2: #f7f3ec;
    --line: #e6dfd2;
    --text: #221d33;
    --muted: #6d6680;
    --accent: #d9771f;
    --accent-2: #6d4fe0;
    --shadow: 0 8px 24px rgba(60, 40, 10, .08);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.halo {
  position: fixed; inset: -30vh -20vw auto; height: 80vh; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 182, 97, .18), transparent 70%),
              radial-gradient(closest-side at 30% 60%, rgba(169, 139, 255, .14), transparent 70%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: Fraunces, Georgia, serif; font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(30px, 6vw, 48px); }
h2 { font-size: 20px; }
.top, main, .foot { width: 100%; max-width: 1040px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.top { display: flex; align-items: center; justify-content: space-between; padding-top: 18px; padding-bottom: 18px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font: 600 20px Fraunces, Georgia, serif; }
.brand:hover { text-decoration: none; }
#nav { display: flex; align-items: center; gap: 10px; }
main { flex: 1; padding-top: 12px; padding-bottom: 40px; outline: none; }
.foot { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; padding-top: 18px; padding-bottom: 28px;
  color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.loading { color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); padding: 10px 16px; border-radius: 999px; font: 500 14px Inter, sans-serif;
  cursor: pointer; transition: transform .08s ease, background .15s ease; }
.btn:hover { background: var(--card-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.btn.primary { background: var(--discord); border-color: var(--discord); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { padding: 14px 22px; font-size: 16px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }

.hero { padding: 36px 0 28px; max-width: 640px; }
.hero p { color: var(--muted); font-size: 17px; margin: 0 0 22px; }
.hero .privacy-note { margin-top: 12px; font-size: 13px; }
.notice { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 12px;
  padding: 12px 14px; margin: 0 0 18px; }
.notice.bad { border-left-color: var(--bad); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h2 { display: flex; align-items: center; gap: 8px; }
.card .sub { color: var(--muted); font-size: 13px; }
.feature .icon { font-size: 22px; }
.feature p { color: var(--muted); margin: 6px 0 0; }

.welcome { display: flex; align-items: center; gap: 14px; margin: 8px 0 22px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--card-2); border: 2px solid var(--line); object-fit: cover; flex: none; }
.avatar.small { width: 30px; height: 30px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 8px 0 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--card-2); border: 1px solid var(--line); }
.badge.premium { background: linear-gradient(90deg, #ffb661, #f08a4b); color: #2a1600; border: 0; }
.badge.ok { color: var(--ok); } .badge.off { color: var(--muted); } .badge.bad { color: var(--bad); }
.meter { margin: 12px 0 4px; }
.meter .label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.bar { height: 8px; background: var(--card-2); border-radius: 999px; overflow: hidden; margin-top: 5px; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: inherit; }
.soon li { color: var(--muted); margin: 4px 0; }
.soon { padding-left: 18px; margin: 8px 0 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.menu { position: relative; }
.menu > button { display: flex; align-items: center; gap: 8px; background: transparent; border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px 4px 4px; color: var(--text); font: 500 14px Inter, sans-serif; cursor: pointer; }
.menu .pop { position: absolute; right: 0; top: calc(100% + 8px); background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 210px; display: none; z-index: 5; }
.menu.open .pop { display: block; }
.pop button, .pop a { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text);
  padding: 9px 12px; border-radius: 8px; font: 14px Inter, sans-serif; cursor: pointer; }
.pop button:hover, .pop a:hover { background: var(--card-2); text-decoration: none; }

.policy { max-width: 760px; }
.policy section { margin: 0 0 26px; }
.policy p, .policy li { color: var(--text); }
.policy ul { padding-left: 20px; }
.policy code { background: var(--card-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 24px; }
.toc a { font-size: 13px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); opacity: 0; background: var(--card-2);
  border: 1px solid var(--line); padding: 10px 16px; border-radius: 999px; transition: .2s ease; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .menu > button span { display: none; }
  .hero { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* -- navigation ------------------------------------------------------------------- */
.navlinks { display: flex; gap: 4px; }
.navlink { color: var(--muted); padding: 7px 12px; border-radius: 999px; font-weight: 500; font-size: 14px; }
.navlink:hover { color: var(--text); background: var(--card); text-decoration: none; }
.navlink.current { color: var(--text); background: var(--card-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #2a1600; font-weight: 600; }
.btn.accent:hover { filter: brightness(1.06); background: var(--accent); }
.btn.disabled, .btn:disabled { opacity: .5; pointer-events: none; }
.badge.warn { color: var(--warn); }

/* -- lists --------------------------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 18px; }
.page-head h1 { margin: 0; font-size: clamp(26px, 5vw, 36px); }
.page-head .row { margin: 0; }
.back { display: inline-block; margin-bottom: 6px; }
.entity { display: flex; flex-direction: column; }
.entity.is-active { border-color: var(--accent); }
.entity-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.entity-head h2 { margin: 0; font-size: 20px; }
.entity-head h2 a { color: var(--text); }
.entity .blurb { flex: 1; margin: 10px 0 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.entity .row { margin-top: 12px; }
.empty { text-align: center; padding: 36px 18px; }

/* -- editor ------------------------------------------------------------------------- */
.form-section { margin: 0 0 16px; scroll-margin-top: 16px; }
.field { margin: 16px 0 0; display: flex; flex-direction: column; gap: 6px; }
.field:first-of-type { margin-top: 8px; }
.field-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.field label { font-weight: 600; }
.req { color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; }
.count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.count.near { color: var(--warn); }
input, textarea, select {
  width: 100%; background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: 15px/1.5 Inter, system-ui, sans-serif; transition: border-color .15s ease;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(169, 139, 255, .18); }
::placeholder { color: var(--muted); opacity: .7; }
.savebar { position: sticky; bottom: 12px; z-index: 4; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 8px 8px 18px; box-shadow: var(--shadow); }
.savebar #dirty { margin-right: auto; color: var(--warn); }
.tip { margin-top: 14px; }
.toc { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 8px 0; }

@media (max-width: 560px) {
  .navlinks { display: none; }
  .savebar { border-radius: 14px; }
}
