:root {
  --bg: #0e0d0b;
  --bg2: #15130f;
  --panel: #1a1813;
  --panel2: #211e17;
  --line: #2e2a20;
  --line2: #3b3528;
  --text: #ebe4d3;
  --muted: #a1977f;
  --faint: #6f675a;
  --gold: #d9b45a;
  --gold2: #f0d38a;
  --link: #e3c06a;
  --missing: #d9786a;
  --ok: #7fbf6a;
  --warn: #e0a24a;
  --danger: #d76458;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
  --r: 10px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #efe7d6;
  --bg2: #e6dcc6;
  --panel: #f7f1e4;
  --panel2: #fbf7ee;
  --line: #d8ccb2;
  --line2: #c9b994;
  --text: #2b2418;
  --muted: #6e6149;
  --faint: #9a8c70;
  --gold: #9a7420;
  --gold2: #7a5a12;
  --link: #8a5f12;
  --missing: #b0473a;
  --shadow: 0 10px 30px rgba(80,60,20,.18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(217,180,90,.35); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 16px;
  background: color-mix(in srgb, var(--bg2) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .sigil { font-size: 22px; color: var(--gold); }
.brand b { font-family: var(--display); font-size: 17px; letter-spacing: .08em; }
.brand small { color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search input {
  width: 100%; padding: 8px 12px 8px 34px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); outline: none;
}
.search input:focus { border-color: var(--gold); }
.search::before { content: "⌕"; position: absolute; left: 13px; top: 6px; color: var(--muted); font-size: 16px; }
.search .results {
  position: absolute; top: 42px; left: 0; right: 0; max-height: 60vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); box-shadow: var(--shadow);
  display: none;
}
.search .results.open { display: block; }
.search .results a { display: flex; gap: 10px; padding: 8px 12px; color: var(--text); border-bottom: 1px solid var(--line); }
.search .results a:hover, .search .results a.sel { background: var(--panel2); text-decoration: none; }
.search .results .t { font-weight: 600; }
.search .results .s { color: var(--muted); font-size: 12.5px; }
.live { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.live.off i { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.iconbtn { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; cursor: pointer; color: var(--muted); }
.iconbtn:hover { color: var(--text); border-color: var(--line2); }
.menu-btn { display: none; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 272px 1fr; min-height: calc(100vh - 56px); }
.side {
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
  border-right: 1px solid var(--line); background: var(--bg2); padding: 14px 10px 40px;
}
.side h4 {
  margin: 18px 10px 6px; font: 600 11px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--faint);
}
.side a, .side .tree-toggle {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6px 10px; border-radius: 7px; color: var(--text); font-size: 14px;
  background: none; border: none; cursor: pointer; text-align: left;
}
.side a:hover, .side .tree-toggle:hover { background: var(--panel); text-decoration: none; }
.side a.active { background: var(--panel2); color: var(--gold2); box-shadow: inset 2px 0 0 var(--gold); }
.side .ic { width: 18px; text-align: center; opacity: .9; }
.side .count { margin-left: auto; font-size: 11.5px; color: var(--faint); }
.side .sub { margin-left: 18px; border-left: 1px solid var(--line); padding-left: 6px; }
.side .sub a { font-size: 13px; padding: 4px 10px; color: var(--muted); }
.side .sub a.active { color: var(--gold2); }
.side .gnum { font: 600 11px var(--mono); color: var(--gold); width: 22px; }
.side .caret { margin-left: auto; color: var(--faint); transition: transform .15s; }
.side .open > .tree-toggle .caret { transform: rotate(90deg); }
.side .tree .sub { display: none; }
.side .tree.open .sub { display: block; }

main { min-width: 0; padding: 28px clamp(16px, 4vw, 48px) 80px; }
.page { max-width: 1180px; margin: 0 auto; }

/* ---------- common ---------- */
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: .02em; line-height: 1.2; }
.eyebrow { font: 600 11.5px var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.muted { color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 8px;
  background: var(--panel2); border: 1px solid var(--line2); cursor: pointer; color: var(--text); font-size: 13.5px;
}
.btn:hover { border-color: var(--gold); text-decoration: none; }
.btn.primary { background: var(--gold); color: #1a1408; border-color: var(--gold); font-weight: 600; }
.btn.primary:hover { background: var(--gold2); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--line2); font-size: 12px; color: var(--muted); background: var(--panel); white-space: nowrap;
}
a.chip:hover { color: var(--gold2); border-color: var(--gold); text-decoration: none; }
.chip.game { color: var(--gold2); border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); font-family: var(--mono); font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.wrap .chip { white-space: normal; border-radius: 10px; }
.typebadge { font: 600 11px var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
}
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.empty { padding: 26px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--r); }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 28px 0; }

/* ---------- home ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 14px; padding: 42px 36px; margin-bottom: 28px;
  background:
    radial-gradient(800px 300px at 80% -10%, rgba(217,180,90,.22), transparent 60%),
    radial-gradient(600px 300px at 0% 120%, rgba(160,60,40,.18), transparent 60%),
    var(--panel);
  border: 1px solid var(--line2);
}
.hero h1 { font-size: clamp(30px, 5vw, 50px); margin: 6px 0 8px; }
.hero p { max-width: 720px; color: var(--muted); font-family: var(--serif); font-size: 18px; margin: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 24px; }
.stats div b { display: block; font: 600 26px var(--display); color: var(--gold2); }
.stats div span { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 12px; }
.section-title h2 { margin: 0; font-size: 20px; }
.gamecard { display: block; color: var(--text); position: relative; min-height: 150px; transition: border-color .15s, transform .15s; }
.gamecard:hover { border-color: var(--gold); text-decoration: none; transform: translateY(-2px); }
.gamecard .num { font: 600 34px var(--display); color: color-mix(in srgb, var(--gold) 70%, transparent); line-height: 1; }
.gamecard h3 { margin: 8px 0 4px; font-size: 16px; }
.gamecard p { margin: 0; color: var(--muted); font-size: 13px; }
.gamecard .status { position: absolute; top: 14px; right: 14px; }
.status-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); }
.status-pill.outline { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.status-pill.draft { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.status-pill.seed { color: var(--missing); border-color: color-mix(in srgb, var(--missing) 50%, var(--line)); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.listrow { display: flex; gap: 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.listrow:last-child { border-bottom: none; }

/* ---------- article ---------- */
.art-head { margin-bottom: 22px; }
.art-head h1 { font-size: clamp(28px, 4vw, 42px); margin: 6px 0 6px; }
.art-head .summary { font-family: var(--serif); font-size: 19px; color: var(--muted); font-style: italic; margin: 0 0 12px; }
.art-head .actions { display: flex; gap: 8px; margin-left: auto; }
.art-head .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.art { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 34px; align-items: start; }
.art-aside { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
.infobox { padding: 0; overflow: hidden; }
.infobox img { width: 100%; display: block; aspect-ratio: 4/5; object-fit: cover; object-position: center top; border-bottom: 1px solid var(--line); }
.infobox .portrait-ph {
  aspect-ratio: 4/3; display: grid; place-items: center; font: 600 64px var(--display); color: var(--gold);
  background: radial-gradient(circle at 50% 40%, rgba(217,180,90,.18), transparent 70%), var(--panel2);
  border-bottom: 1px solid var(--line);
}
.infobox h3 { margin: 0; padding: 14px 16px 6px; font-size: 15px; }
.infobox dl { margin: 0; padding: 4px 16px 14px; display: grid; grid-template-columns: 112px 1fr; gap: 7px 10px; font-size: 13.5px; }
.infobox dt { color: var(--muted); }
.infobox dd { margin: 0; }
.infobox .rel { padding: 10px 16px 14px; border-top: 1px solid var(--line); font-size: 13.5px; }
.infobox .rel div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.infobox .rel span { color: var(--muted); }
.side-box h4 { margin: 0 0 8px; font: 600 11px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.side-box a { display: block; padding: 3px 0; }
.toc a { color: var(--muted); font-size: 13px; }
.toc a.h3 { padding-left: 12px; }

/* prose */
.prose { font-family: var(--serif); font-size: 18.5px; line-height: 1.68; }
.prose h2 { font-size: 23px; margin: 34px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 18.5px; margin: 26px 0 8px; }
.prose h4 { font: 600 13px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 22px 0 6px; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 24px; }
.prose li { margin: 4px 0; }
.prose blockquote { margin: 16px 0; padding: 4px 18px; border-left: 3px solid var(--line2); color: var(--muted); }
.prose code { font: 13.5px var(--mono); background: var(--panel2); padding: 1px 5px; border-radius: 4px; }
.prose table { border-collapse: collapse; width: 100%; margin: 14px 0 18px; font-family: var(--ui); font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--panel2); font-weight: 600; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 26px 0; }
.prose > :first-child { margin-top: 0; }
a.wl { color: var(--link); border-bottom: 1px dotted color-mix(in srgb, var(--link) 60%, transparent); }
a.wl:hover { text-decoration: none; border-bottom-style: solid; }
a.wl.missing { color: var(--missing); border-bottom-color: color-mix(in srgb, var(--missing) 60%, transparent); }
.callout {
  margin: 18px 0; padding: 12px 16px; border-radius: 9px; border: 1px solid var(--line2);
  background: var(--panel); font-size: 17px;
}
.callout .ct { font: 600 11.5px var(--ui); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 4px; }
.callout p:last-child { margin-bottom: 0; }
.callout.question { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.callout.question .ct { color: var(--warn); }
.callout.note .ct { color: var(--gold); }
.callout.idea { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.callout.idea .ct { color: var(--ok); }
.callout.secret { border-color: color-mix(in srgb, #b57be0 55%, var(--line)); background: color-mix(in srgb, #b57be0 7%, var(--panel)); }
.callout.secret .ct { color: #c497ea; cursor: pointer; }
.callout.secret:not(.revealed) .cb { filter: blur(6px); user-select: none; cursor: pointer; }
.callout.source { border-style: dashed; }
.callout.source .ct { color: var(--muted); }

.qbox { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.qbox h4 { color: var(--warn); }
.qline { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.qline:last-child { border-bottom: none; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 6px 0 24px; overflow-x: auto; }
.tabs a {
  padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--gold2); border-bottom-color: var(--gold); }
.tabs a .n { font-size: 11px; color: var(--faint); margin-left: 4px; }
.game-num { font: 600 64px/1 var(--display); color: color-mix(in srgb, var(--gold) 55%, transparent); }
.gamehead { display: flex; gap: 22px; align-items: center; }
.pager { display: flex; justify-content: space-between; margin-top: 40px; gap: 10px; }

/* entity cards */
.ecard { display: flex; gap: 12px; color: var(--text); align-items: flex-start; transition: border-color .15s; }
.ecard:hover { border-color: var(--gold); text-decoration: none; }
.ecard .av {
  flex: none; width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center;
  background: var(--panel2); border: 1px solid var(--line2); font: 600 20px var(--display); color: var(--gold); overflow: hidden;
}
.ecard .av img { width: 100%; height: 100%; object-fit: cover; }
.ecard .t { font-weight: 600; }
.ecard .s { color: var(--muted); font-size: 13px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.group-title { margin: 26px 0 10px; font: 600 12px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.group-title::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ---------- editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 26px; align-items: start; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.field input, .field select, .field textarea {
  background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; outline: none; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); }
.field .hint { font-size: 11.5px; color: var(--faint); }
.title-input { font: 600 26px var(--display) !important; padding: 10px 12px !important; }
.body-wrap { border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; background: var(--panel); }
.body-tools { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--panel2); }
.body-tools button { background: none; border: 1px solid transparent; border-radius: 6px; padding: 3px 9px; cursor: pointer; color: var(--muted); font-size: 13px; }
.body-tools button:hover { border-color: var(--line2); color: var(--text); }
.body-tools button.on { color: var(--gold2); border-color: var(--gold); }
.body-split { display: grid; grid-template-columns: 1fr; }
.body-split.preview { grid-template-columns: 1fr 1fr; }
.body-split textarea {
  min-height: 62vh; resize: vertical; border: none; outline: none; background: transparent; padding: 14px 16px;
  font: 14px/1.6 var(--mono); width: 100%;
}
.body-split .pv { display: none; border-left: 1px solid var(--line); padding: 14px 18px; max-height: 70vh; overflow: auto; }
.body-split.preview .pv { display: block; }
.gamepick { display: flex; flex-wrap: wrap; gap: 6px; }
.gamepick label { display: inline-flex; gap: 5px; align-items: center; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line2); cursor: pointer; font: 12px var(--mono); color: var(--muted); }
.gamepick input { display: none; }
.gamepick label.on { color: var(--gold2); border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.relrow { display: grid; grid-template-columns: 1fr 1fr 28px; gap: 6px; margin-bottom: 6px; }
.relrow input { padding: 6px 8px !important; }
.banner { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.err { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--panel)); }

/* ---------- roster ---------- */
.factions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.factions a { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); font-size: 13px; }
.factions a.on { color: #1a1408; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.factions a:hover { text-decoration: none; border-color: var(--gold); }
.factions .race { font-size: 10.5px; opacity: .7; margin-right: 4px; }
.tiers { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.tiercol { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-width: 150px; }
.tiercol .th { padding: 9px 12px; font: 600 12px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: #15120c; display: flex; align-items: center; }
.tiercol .th .n { margin-left: auto; opacity: .7; }
.tiercol .units { padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 80px; }
.unit {
  text-align: left; padding: 7px 10px; border-radius: 7px; background: var(--panel2); border: 1px solid var(--line);
  cursor: pointer; font-size: 13px; border-left: 3px solid var(--tc, var(--line2));
}
.unit:hover { border-color: var(--gold); }
.unit .art { font-size: 10px; color: var(--gold); margin-left: 4px; }
.unit .nt { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.addunit { background: none; border: 1px dashed var(--line2); color: var(--faint); border-radius: 7px; padding: 5px; cursor: pointer; font-size: 12px; }
.addunit:hover { color: var(--text); border-color: var(--gold); }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 16px; }
.modal .foot { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- map ---------- */
.mapwrap {
  position: relative; height: calc(100vh - 210px); min-height: 420px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line2); background: #1a2630; cursor: grab; touch-action: none;
}
.mapwrap.dragging { cursor: grabbing; }
.mapwrap.picking { cursor: crosshair; }
.mapwrap > svg { width: 100%; height: 100%; display: block; }
.mapzoom { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 4px; z-index: 5; }
.mapzoom button { width: 34px; height: 34px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line2); cursor: pointer; color: var(--text); font-size: 17px; }
.maptip {
  position: absolute; z-index: 6; pointer-events: auto; background: var(--panel); border: 1px solid var(--line2);
  border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); font-size: 13px; max-width: 260px;
}
.maptip b { display: block; font-size: 14px; margin-bottom: 2px; }
.maplegend { position: absolute; left: 12px; bottom: 12px; z-index: 5; background: color-mix(in srgb, var(--panel) 90%, transparent); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 12px; font-size: 12px; }
.maplegend span { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; }
.maplegend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- timeline ---------- */
.tl { position: relative; padding-left: 30px; }
.tl::before { content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: linear-gradient(var(--gold), var(--line2)); }
.tl-era { margin: 28px 0 12px -30px; font: 600 13px var(--display); letter-spacing: .1em; color: var(--gold2); text-transform: uppercase; display: flex; align-items: center; gap: 10px; }
.tl-era::before { content: ""; width: 20px; height: 20px; border-radius: 50%; background: var(--bg); border: 2px solid var(--gold); }
.tl-item { position: relative; margin-bottom: 12px; }
.tl-item::before { content: ""; position: absolute; left: -26px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--line2); border: 2px solid var(--bg); }
.tl-item.game::before { background: var(--gold); }
.tl-item .when { font: 12px var(--mono); color: var(--muted); }
.tl-item.game .card { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); background: color-mix(in srgb, var(--gold) 6%, var(--panel)); }
.tl-item h3 { margin: 2px 0 4px; font-size: 16px; }
.tl-item p { margin: 0; color: var(--muted); font-size: 13.5px; }

/* ---------- questions ---------- */
.q { margin-bottom: 12px; }
.q .qt { font-family: var(--serif); font-size: 18px; line-height: 1.45; }
.q .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.q .ans { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--ok); background: var(--panel2); border-radius: 0 8px 8px 0; font-family: var(--serif); font-size: 16.5px; }
.q .ans .who { font: 600 11px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--ok); margin-bottom: 2px; }
.q textarea { width: 100%; min-height: 70px; margin-top: 10px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; outline: none; }
.q textarea:focus { border-color: var(--gold); }
.q.answered { opacity: .82; }
.q.parked { opacity: .6; }
.prio { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid; }
.prio.high { color: var(--missing); border-color: color-mix(in srgb, var(--missing) 50%, transparent); }
.prio.med { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.prio.low { color: var(--muted); border-color: var(--line2); }
.qasker { font-size: 11px; color: var(--faint); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; align-items: center; }
.filters select, .filters input { background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 10px; outline: none; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg a { padding: 6px 12px; color: var(--muted); font-size: 13px; border-right: 1px solid var(--line2); }
.seg a:last-child { border-right: none; }
.seg a.on { background: var(--panel2); color: var(--gold2); }
.seg a:hover { text-decoration: none; color: var(--text); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--panel2); border: 1px solid var(--gold); color: var(--text); padding: 10px 18px; border-radius: 999px;
  box-shadow: var(--shadow); transition: all .25s; z-index: 200; pointer-events: none; font-size: 13.5px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .art, .editor { grid-template-columns: minmax(0, 1fr); }
  .art-aside { position: static; }
  .tiers { grid-template-columns: repeat(6, 160px); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .side { transform: none; }
  .menu-btn { display: inline-block; }
  .brand small, .live span { display: none; }
  .two { grid-template-columns: 1fr; }
  .body-split.preview { grid-template-columns: 1fr; }
  .body-split.preview .pv { border-left: none; border-top: 1px solid var(--line); }
  .hero { padding: 28px 20px; }
  .game-num { font-size: 44px; }
  main { padding: 20px 16px 60px; }
  .prose table { display: block; overflow-x: auto; }
}
@media (max-width: 520px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .brand b { display: none; }
  .search { min-width: 0; }
  .search input { padding-left: 30px; }
  .topbar .btn.primary { padding: 4px 9px; }
  .search .results { position: fixed; left: 12px; right: 12px; top: 54px; }
}

/* ---------- heroes: character select ---------- */
.hero-factions { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 14px; }
.hero-factions a { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); font-size: 13px; white-space: nowrap; }
.hero-factions a:hover { text-decoration: none; border-color: var(--gold); color: var(--text); }
.hero-factions a.on { color: #1a1408; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.hero-factions a .n { font-size: 11px; opacity: .65; margin-left: 2px; }
.hero-factions .race-group { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hero-factions .rg { font: 600 10.5px var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-right: 2px; }
.tierpick { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.tierpick a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; color: var(--muted); font-size: 12.5px; border-right: 1px solid var(--line2); }
.tierpick a:last-child { border-right: none; }
.tierpick a i { width: 9px; height: 9px; transform: rotate(45deg); background: var(--tc); display: inline-block; }
.tierpick a.on { background: var(--panel2); color: var(--gold2); }
.tierpick a:hover { text-decoration: none; color: var(--text); }

.heroes { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.hero-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 6px 6px 8px; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--text);
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.hero-card:hover { transform: translateY(-2px); border-color: var(--tc); }
.hero-card.sel { border-color: var(--tc); box-shadow: 0 0 0 2px var(--tc), 0 0 22px color-mix(in srgb, var(--tc) 45%, transparent); }
.hc-portrait, .hd-portrait {
  position: relative; display: grid; place-items: center; overflow: hidden; border-radius: 7px; aspect-ratio: 3 / 4;
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--tc) 55%, transparent), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--tc) 18%, var(--panel2)), #0b0a08);
  border-bottom: 2px solid var(--tc);
}
.hc-portrait img, .hd-portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.hp-init { font: 600 30px var(--display); color: color-mix(in srgb, var(--tc) 35%, #fff); text-shadow: 0 2px 12px rgba(0,0,0,.6); letter-spacing: .04em; }
.hc-imp { position: absolute; top: 5px; left: 5px; font: 700 9px var(--ui); letter-spacing: .08em; padding: 2px 5px; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff; }
.hc-imp.imp-main-story, .chip.imp-main-story { color: #f0d38a; border-color: color-mix(in srgb, #f0d38a 50%, transparent); }
.hc-imp.imp-side-story, .chip.imp-side-story { color: #8fd0f0; border-color: color-mix(in srgb, #8fd0f0 50%, transparent); }
.hc-imp.imp-game-only, .chip.imp-game-only { color: #b9b0a0; }
.hc-name { font-weight: 600; font-size: 13px; line-height: 1.25; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hc-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pips { display: inline-flex; gap: 3px; margin-top: 3px; }
.pips i { width: 7px; height: 7px; transform: rotate(45deg); background: var(--line2); display: inline-block; }
.pips i.on { background: var(--tc); }

.hero-side { position: sticky; top: 76px; }
.hero-detail { background: var(--panel); border: 1px solid color-mix(in srgb, var(--tc) 55%, var(--line)); border-radius: 14px; overflow: hidden; box-shadow: 0 0 40px color-mix(in srgb, var(--tc) 14%, transparent); }
.hero-detail.empty { padding: 30px; text-align: center; color: var(--muted); border-color: var(--line); }
.hd-portrait { aspect-ratio: 4 / 3.4; border-radius: 0; }
.hd-portrait .hp-init { font-size: 68px; }
.hd-tier { position: absolute; left: 14px; bottom: 12px; font: 600 11px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: #15120c; background: var(--tc); padding: 4px 10px; border-radius: 999px; }
.hd-body { padding: 14px 18px 18px; }
.hd-body h2 { margin: 6px 0 2px; font-size: 24px; }
.hd-title { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 17px; }
.hd-meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.hd-note { margin: 0 0 8px; font-size: 13.5px; }
.hd-bio { font-size: 16px; }
.hd-bio p:last-child { margin-bottom: 0; }

@media (max-width: 1080px) {
  .heroes { grid-template-columns: minmax(0, 1fr); }
  .hero-side { position: static; order: -1; }
  .hero-detail { display: grid; grid-template-columns: 190px minmax(0, 1fr); }
  .hd-portrait { aspect-ratio: auto; min-height: 240px; }
  .hd-portrait .hp-init { font-size: 52px; }
  .hd-bio { max-height: 220px; overflow: auto; }
}
@media (max-width: 520px) {
  .hero-detail { grid-template-columns: 110px minmax(0, 1fr); }
  .hd-portrait { min-height: 170px; }
  .hd-portrait .hp-init { font-size: 36px; }
  .hd-tier { left: 8px; bottom: 8px; font-size: 9.5px; padding: 3px 7px; }
  .hd-body { padding: 10px 12px 12px; }
  .hd-body h2 { font-size: 19px; }
  .hd-bio { font-size: 15px; max-height: 160px; }
  .hero-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .hp-init { font-size: 22px; }
}

/* ---------- images in articles ---------- */
.prose img.md-img { display: block; max-width: 100%; max-height: 70vh; margin: 8px auto 14px; border-radius: 10px; border: 1px solid var(--line2); box-shadow: var(--shadow); cursor: zoom-in; }
.prose img.md-img.zoom { max-height: none; cursor: zoom-out; }

/* ---------- list cards (names only) + A–Z filter ---------- */
.ecard { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; }
.ecard .av { width: 40px; height: 40px; border-radius: 8px; }
.ecard .ec-body { min-width: 0; flex: 1; }
.ecard .t { font-size: 15px; }
.ecard .ec-games { margin-top: 6px; gap: 4px; }
.ecard .chip.game { padding: 1px 7px; font-size: 10.5px; }
.listblock .filters { align-items: center; }
.listblock .lb-q { min-width: 220px; }
.letters { display: flex; flex-wrap: wrap; gap: 3px; }
.letters button {
  min-width: 28px; height: 28px; padding: 0 6px; border-radius: 6px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); font: 600 12px var(--ui);
}
.letters button:hover:not(:disabled) { border-color: var(--gold); color: var(--text); }
.letters button.on { background: var(--gold); border-color: var(--gold); color: #1a1408; }
.letters button:disabled { opacity: .28; cursor: default; }
@media (max-width: 520px) {
  .listblock .lb-q { min-width: 0; width: 100%; }
  .letters button { min-width: 24px; height: 26px; font-size: 11px; }
}

/* ---------- login (cloud copy) ---------- */
.login-card { max-width: 380px; margin: 12vh auto 0; text-align: center; padding: 34px 28px; }
.login-card .brand-big { font-size: 46px; color: var(--gold); line-height: 1; }
.login-card h1 { margin: 10px 0 6px; font-size: 26px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.login-card input { background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 11px 12px; outline: none; font-size: 16px; text-align: center; }
.login-card input:focus { border-color: var(--gold); }
.login-card .btn { justify-content: center; padding: 10px; }

/* ---------- notes ---------- */
.notes-btn { position: relative; font-size: 16px; line-height: 1; padding: 6px 8px; text-decoration: none !important; }
.notes-btn .nb { position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font: 700 10px/17px var(--ui); text-align: center; }
.notes-home { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; color: var(--text); border-color: color-mix(in srgb, var(--gold) 40%, var(--line)); }
.notes-home:hover { text-decoration: none; border-color: var(--gold); }
.notes-home .nh-ic { font-size: 26px; }
.notes-home .nh-txt { flex: 1; min-width: 0; }
.note-new textarea { width: 100%; min-height: 130px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 12px 14px; outline: none; font: 17px/1.5 var(--serif); resize: vertical; }
.note-new textarea:focus { border-color: var(--gold); }
.note-new select { background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 10px; outline: none; }
.note-hint { font-size: 12px; }
.note { margin-bottom: 12px; }
.note.done { opacity: .78; }
.note-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.note-text { font-size: 17px; }
.note-text p:last-child { margin-bottom: 0; }
.note-claude { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--ok); background: var(--panel2); border-radius: 0 8px 8px 0; font-size: 14.5px; }
.note-claude .who { font: 600 11px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--ok); margin-bottom: 4px; }
.note-edit textarea { width: 100%; min-height: 100px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 9px 11px; outline: none; font: 16px/1.5 var(--serif); }
.note-btns { margin-top: 10px; }
@media (max-width: 520px) { .note-hint { display: none; } .notes-home .btn { display: none; } }
