
/* Self-hosted brand faces (variable woff2, latin). Served from /fonts/ under font-src 'self'.
   Missing glyphs (CJK/emoji in guild names) fall back per-glyph to system-ui. */
@font-face { font-family:'Cinzel'; font-style:normal; font-weight:600 900; font-display:swap; src:url(/fonts/cinzel.woff2) format('woff2'); }
@font-face { font-family:'Hanken Grotesk'; font-style:normal; font-weight:400 700; font-display:swap; src:url(/fonts/hanken.woff2) format('woff2'); }
@font-face { font-family:'Hanken Grotesk'; font-style:italic; font-weight:400 700; font-display:swap; src:url(/fonts/hanken-italic.woff2) format('woff2'); }

/* ── "Hunter's Medallion" — the brand shared with geraldoftrivia.com + the marketing site.
   Warm oiled-leather ink / witcher steel / amber-gold (gold = premium = the prize). Fully
   tokenised: the two :root blocks below carry the whole theme; selectors reference the vars. */
:root {
  /* Locked DARK to match the marketing site (geraldoftrivia.com is dark-only). Was light-dark adaptive,
     which showed a cream theme on light-mode devices — same brand, but did not match the site. */
  color-scheme: dark;
  --bg:#14110D; --surface:#1E1913; --fg:#E7E0D2; --muted:#9A917F; --faint:#6E6552;
  --line:#352B20; --field:#1A150E; --field-line:#3E3327; --field-2:#241D15;
  --accent:#E6A94C; --accent-weak:#2A2114; --ok:#86B06A; --err:#E0785C;
  --gold:#E6A94C; --gold-hi:#F6CF84; --gold-deep:#C47E26;
  --radius:10px; --ring:0 0 0 3px rgba(230,169,76,.32);
  --shadow:0 1px 2px rgba(0,0,0,.5), 0 6px 20px rgba(0,0,0,.4);
}
* { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; background:var(--bg); color:var(--fg);
  font:15px/1.6 "Hanken Grotesk", 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; }
strong { font-weight:650; }
.muted { color:var(--muted); }

/* top brand bar — quiet, one hairline */
.topbar { position:sticky; top:0; z-index:10; background:var(--bg); border-bottom:1px solid var(--line); }
.topbar .inner { max-width:50rem; margin:0 auto; padding:.75rem 1.25rem; }
.brand { display:inline-flex; align-items:center; gap:.55rem; font-family:"Cinzel",Georgia,serif; font-weight:700; font-size:1.08rem; letter-spacing:.04em; color:var(--fg); }
.brand:hover { text-decoration:none; }
/* the cat sigil — a struck-coin housecat (School of the Cat), inline SVG so the CSP stays imageless */
.brand .logo { width:1.75rem; height:1.75rem; border-radius:50%; display:grid; place-items:center; color:#1c1408;
  background:linear-gradient(180deg,var(--gold-hi),var(--gold-deep)); border:1px solid var(--gold-deep);
  box-shadow:inset 0 1px 1px rgba(255,240,210,.5), 0 1px 3px rgba(0,0,0,.25); }
.brand .logo svg { width:64%; height:64%; fill:currentColor; }
.brand .tag { font-family:"Hanken Grotesk",sans-serif; font-weight:450; color:var(--faint); font-size:.8rem; letter-spacing:0; border-left:1px solid var(--line); padding-left:.55rem; }
main { max-width:50rem; margin:0 auto; padding:2.2rem 1.25rem 6rem; }

/* breadcrumb */
.crumbs { display:flex; flex-wrap:wrap; align-items:center; gap:.45rem; font-size:.82rem; margin:0 0 1.4rem; color:var(--faint); }
.crumbs a { color:var(--muted); }
.crumbs a:hover { color:var(--accent); text-decoration:none; }
.crumbs .sep { color:var(--faint); }
.crumbs .here { color:var(--fg); font-weight:600; }

/* page heading */
.page-h { margin:0 0 .25rem; font-family:"Cinzel",Georgia,serif; font-size:1.7rem; font-weight:700; letter-spacing:.01em; }
.page-sub { margin:0 0 2.5rem; color:var(--muted); }

/* two-column section — title/desc left, fields right; whitespace + a hairline do the grouping */
.group, .panel, .mode { background:var(--surface); border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow); }
.group { display:grid; grid-template-columns:13rem 1fr; gap:.5rem 3rem; padding:2.1rem 2.2rem; margin:0 0 1.5rem; }
.group-head h2 { margin:0; font-size:1rem; font-weight:680; letter-spacing:-.01em; }
.group-head p { margin:.35rem 0 0; color:var(--muted); font-size:.85rem; line-height:1.5; }
.group-body { min-width:0; }
.panel { padding:.6rem 1.5rem; margin:.2rem 0 0; }
@media (max-width:640px) {
  .group { grid-template-columns:1fr; gap:1rem; padding:1.25rem 1.2rem; }
  /* .mode-body prefix so these WIN over the base subgroup/sg-head rules defined later in the file
     (equal specificity + later source order = base wins, which left the TIMING/ANSWERS label eating an
     8rem column on mobile and squeezing the controls until Save overflowed the screen). */
  .mode-body .subgroup { grid-template-columns:1fr; gap:.3rem; }
  .mode-body .sg-head { padding-top:0; }
}

/* setting rows — borderless list, hairline divided, label left / control right */
.setting { display:flex; align-items:center; justify-content:space-between; gap:1.1rem 1.5rem; flex-wrap:wrap;
  padding:1.2rem 0; border-top:1px solid var(--line); }
.group-body > .setting:first-child, .sg-body > .setting:first-child { border-top:0; padding-top:.1rem; }
.setting > label { display:flex; flex-direction:column; gap:.15rem; flex:1 1 15rem; min-width:0; }
.setting .name { font-weight:600; line-height:1.35; }
.setting .hint { font-size:.81rem; color:var(--muted); line-height:1.45; }
.setting .control { display:flex; align-items:center; gap:.5rem; flex:0 0 auto; }
/* -webkit-appearance:none is load-bearing on iOS Safari: without it, inputs/selects render with NATIVE
   chrome (bulky, light system colors) that clashes with the dark theme — looked fine on desktop Chrome,
   terrible on iPhone. font-size:16px stops iOS from auto-zooming the page on input focus. */
.setting input, .setting select { -webkit-appearance:none; appearance:none;
  padding:.45rem .55rem; font:inherit; font-size:16px; color:var(--fg); background:var(--field);
  border:1px solid var(--field-line); border-radius:8px; min-width:0; }
.setting input { width:12rem; max-width:48vw; }
.setting input[type=number] { width:7rem; font-variant-numeric:tabular-nums; }
/* appearance:none removes the native dropdown arrow, so draw our own with two CSS gradients (CSP blocks
   img/data: URIs, so no SVG background). */
.setting select { min-width:9rem; padding-right:2rem;
  background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:right 1.05rem center,right .72rem center; background-size:.36rem .36rem,.36rem .36rem; background-repeat:no-repeat; }
.setting input:focus, .setting select:focus { outline:none; border-color:var(--accent); box-shadow:var(--ring); }

/* the per-row Save stays quiet until you engage the row (hover / focus-within), never a wall of blue */
.setting .save { -webkit-appearance:none; appearance:none; opacity:0; transform:translateX(-.25rem); transition:opacity .12s, transform .12s;
  background:var(--accent); color:#fff; border:0; border-radius:8px; padding:.45rem .8rem; font:inherit; font-weight:600; cursor:pointer; }
.setting:hover .save, .setting:focus-within .save { opacity:1; transform:none; }
.setting .save:focus-visible { outline:none; box-shadow:var(--ring); }
.setting.reset { justify-content:flex-start; padding-top:1.1rem; }
.setting.reset .control { flex:1 1 auto; }
.setting.reset .save { opacity:1; transform:none; background:transparent; color:var(--muted); border:1px solid var(--field-line); padding:.4rem .75rem; }
.setting.reset .save:hover { color:var(--err); border-color:var(--err); }

/* buttons (primary CTAs + ghost) */
.btn { -webkit-appearance:none; appearance:none; display:inline-flex; align-items:center; gap:.4rem; font:inherit; font-weight:620; cursor:pointer;
  padding:.55rem 1rem; border:1px solid transparent; border-radius:var(--radius);
  background:var(--accent); color:#fff; transition:filter .12s, box-shadow .12s; }
.btn:hover { filter:brightness(1.07); text-decoration:none; }
.btn:focus-visible { outline:none; box-shadow:var(--ring); }
.btn-lg { padding:.7rem 1.25rem; font-size:1rem; }
.btn-sm { padding:.4rem .75rem; font-size:.85rem; }
.btn.ghost { background:transparent; color:var(--muted); border-color:var(--field-line); }
.btn.ghost:hover { filter:none; color:var(--fg); background:var(--field-2); }
/* the Upgrade CTA — gold, so Premium reads as a prize */
.btn.gold { color:#1c1408; border-color:var(--gold-deep);
  background:linear-gradient(180deg,var(--gold-hi),var(--gold) 46%,var(--gold-deep));
  box-shadow:0 1px 0 rgba(255,240,205,.5) inset, 0 4px 14px rgba(196,126,38,.28); }
.btn.gold:hover { filter:brightness(1.05); }

/* nav list (servers / channels) — quiet rows, hover highlight, no boxes */
.nav-list { list-style:none; margin:.2rem 0 0; padding:0; }
.nav-row { display:flex; align-items:center; gap:.85rem; padding:.7rem .6rem; margin:0 -.6rem; border-radius:10px; color:var(--fg); }
.nav-row:hover { background:var(--field-2); text-decoration:none; }
.nav-row .ic { flex:0 0 auto; width:1.95rem; height:1.95rem; display:grid; place-items:center; border-radius:8px;
  background:var(--field-2); color:var(--muted); font-weight:700; font-size:.95rem; }
.nav-row:hover .ic { background:var(--accent-weak); color:var(--accent); }
.nav-row .nc-main { display:flex; flex-direction:column; min-width:0; }
.nav-row .nc-name { font-weight:600; }
.nav-row .nc-sub { color:var(--muted); font-size:.8rem; }
.nav-row .chev { margin-left:auto; color:var(--faint); font-size:1.3rem; line-height:1; }

/* collapsible game-mode sections — hairline rows, no box */
.modes { margin:.2rem 0 0; }
.mode { margin:0 0 1.3rem; overflow:hidden; }
.mode > summary { list-style:none; cursor:pointer; display:flex; align-items:center; gap:.55rem;
  padding:1.15rem 1.5rem; font-weight:650; font-size:1.02rem; user-select:none; }
.mode > summary::-webkit-details-marker { display:none; }
.mode > summary::after { content:"⌄"; color:var(--faint); font-size:1.1rem; transition:transform .15s; }
.mode[open] > summary { border-bottom:1px solid var(--line); }
.mode[open] > summary::after { transform:rotate(180deg); }
.mode > summary:hover { color:var(--accent); }
.mode > summary .ic-mode { font-size:1.1rem; }
.mode > summary .count { margin-left:auto; color:var(--muted); font-weight:450; font-size:.82rem; }
.mode-body { padding:.6rem 1.5rem 1.5rem; }
.subgroup { display:grid; grid-template-columns:8rem 1fr; gap:.4rem 2.5rem; padding:1.5rem 0; border-top:1px solid var(--line); }
.mode-body > .subgroup:first-child { border-top:0; padding-top:.8rem; }
.sg-head { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--faint); padding-top:.65rem; }
.sg-body { min-width:0; }

/* badges */
.badge { display:inline-flex; align-items:center; gap:.25rem; padding:.12rem .5rem; border-radius:999px;
  font-size:.72rem; font-weight:680; letter-spacing:.02em; }
.badge.premium { background:var(--accent-weak); color:var(--accent); }
.badge.free { background:var(--field-2); color:var(--muted); }
.badge.active { background:rgba(31,138,76,.14); color:var(--ok); }

/* plan row + read-only stat rows */
.plan { display:flex; align-items:center; gap:.7rem; flex-wrap:wrap; margin:0 0 1rem; }
.stats { margin-top:.2rem; }
.stat { display:flex; align-items:baseline; justify-content:space-between; gap:1rem; padding:.55rem 0; border-top:1px solid var(--line); }
.stats .stat:first-child { border-top:0; }
.stat .k { color:var(--muted); font-size:.88rem; }
.stat .k .note { color:var(--faint); font-size:.8rem; }
.stat .v { font-weight:680; font-variant-numeric:tabular-nums; }

/* flash */
.flash { display:flex; align-items:center; gap:.5rem; padding:.7rem .9rem; border-radius:var(--radius);
  margin:0 0 1.5rem; font-size:.9rem; }
.flash .fi { font-weight:750; }
.flash.ok { background:rgba(31,138,76,.1); color:var(--ok); }
.flash.err { background:rgba(208,52,44,.1); color:var(--err); }

/* §5 personality (banter v2) — the knob segmented controls, the color textarea, the directions list. */
.knobs { flex-direction:column; align-items:stretch; gap:.6rem; }
.knobrow { display:flex; align-items:center; gap:1rem; flex-wrap:wrap; }
.knobname { min-width:7rem; font-weight:600; text-transform:capitalize; }
.knobs .seg { display:inline-flex; border:1px solid var(--field-line); border-radius:9px; overflow:hidden; }
.knobs .segopt { margin:0; display:inline-flex; }
.knobs .segopt input { position:absolute; opacity:0; width:0; height:0; }
.knobs .segopt span { display:block; padding:.35rem .9rem; color:var(--muted); cursor:pointer; user-select:none;
  border-left:1px solid var(--field-line); text-transform:lowercase; font-size:.9rem; }
.knobs .segopt:first-child span { border-left:0; }
.knobs .segopt:has(input:checked) span { background:var(--accent); color:#fff; font-weight:600; }
.knobs .segopt input:focus-visible + span { outline:2px solid var(--accent); outline-offset:-2px; }
.knobs .control { margin-top:.2rem; }
/* §5 personality (banter v2) — the additional-color textarea + the specific-directions list. */
.setting.col { align-items:stretch; }
.setting.col > label { flex:1 1 100%; }
.control.wide { width:100%; flex:1 1 100%; align-items:flex-start; }
.control.wide textarea { -webkit-appearance:none; appearance:none; width:100%; resize:vertical; min-height:4.5rem;
  background:var(--field); color:var(--fg); border:1px solid var(--field-line); border-radius:9px; padding:.55rem .7rem;
  font:inherit; line-height:1.5; }
.control.wide textarea:focus { outline:none; border-color:var(--accent); box-shadow:var(--ring); }
.control.wide .save { opacity:1; transform:none; }
.dirlist { list-style:none; margin:.3rem 0 .9rem; padding:0; display:flex; flex-direction:column; gap:.45rem; }
.dirlist li { display:flex; align-items:center; gap:.9rem; }
.dirtext { flex:1; min-width:0; overflow-wrap:anywhere; }
.dirrm { flex:0 0 auto; }
.dirrm .save { opacity:1; transform:none; background:transparent; color:var(--muted); border:1px solid var(--field-line); padding:.3rem .65rem; }
.dirrm .save:hover { color:var(--err); border-color:var(--err); }

/* misc */
.empty { color:var(--muted); padding:1rem 0; }
code { background:var(--field-2); border-radius:5px; padding:.08rem .35rem; font-size:.88em; }
.signout { margin-top:2.5rem; }

/* responsive — touch + small screens */
@media (hover:none) { .setting .save { opacity:1; transform:none; } }  /* no hover → keep Save discoverable */
@media (max-width:560px) {
  main { padding:1.3rem 1rem 4rem; }
  .page-h { font-size:1.45rem; }
  .page-sub { margin-bottom:1.4rem; }
  .group { padding:1.4rem 1.2rem; }
  .setting { align-items:stretch; }
  .setting .control { width:100%; }
  .setting .save { opacity:1; transform:none; }       /* always visible, no hover to rely on */
  .setting input, .setting select { flex:1 1 auto; width:100%; max-width:100%; }
  .setting input[type=number] { width:100%; }
  .setting.reset .save { flex:0 0 auto; width:auto; }
  .mode > summary .count { display:none; }             /* reclaim width on narrow */
}

/* hero (login / error) */
.hero { max-width:26rem; margin:3rem auto; text-align:center; background:var(--surface); border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow); padding:2.3rem 1.9rem; }
.hero-logo { font-size:2.8rem; }
/* the login coin — same cat sigil, larger */
.hero-logo.coin { width:3.6rem; height:3.6rem; margin:0 auto; border-radius:50%; display:grid; place-items:center; color:#1c1408;
  background:linear-gradient(180deg,var(--gold-hi),var(--gold-deep)); border:1px solid var(--gold-deep);
  box-shadow:0 0 0 4px var(--surface), 0 0 0 5px var(--gold-deep), 0 8px 20px rgba(0,0,0,.2); }
.hero-logo.coin svg { width:58%; height:58%; fill:currentColor; }
.hero h1 { margin:.7rem 0 .4rem; font-family:"Cinzel",Georgia,serif; font-weight:700; font-size:1.75rem; letter-spacing:.01em; }
.hero p { color:var(--muted); }
.hero .btn { margin-top:.6rem; }
