:root {
  --bg: #121216; --bg2: #1a1a20; --bg3: #23232b; --line: #2e2e38; --ink: #f1eee6; --ink2: #c4c0b5; --ink3: #8f8b82;
  --gold: #e0b25b; --gold2: #f0cc85; --red: #e07a5f; --green: #7dd3a8; --blue: #8fb4e8; --violet: #b9a3e8;
  --radius: 10px; --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #faf8f3; --bg2: #f2efe7; --bg3: #e8e4d9; --line: #d9d4c7; --ink: #1d1c19; --ink2: #45423b; --ink3: #77736a;
    --gold: #a8761c; --gold2: #8a5f12; --red: #b4472c; --green: #2c8a5b; --blue: #3666a8; --violet: #6a4fb0; color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #faf8f3; --bg2: #f2efe7; --bg3: #e8e4d9; --line: #d9d4c7; --ink: #1d1c19; --ink2: #45423b; --ink3: #77736a;
  --gold: #a8761c; --gold2: #8a5f12; --red: #b4472c; --green: #2c8a5b; --blue: #3666a8; --violet: #6a4fb0; color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: var(--gold); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 3.3rem); margin: 0.2em 0 0.3em; }
h2 { font-size: 1.6rem; margin: 1.6em 0 0.5em; } h3 { font-size: 1.15rem; margin: 1em 0 0.4em; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--bg3); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--bg2); border: 1px solid var(--line); padding: 14px; border-radius: var(--radius); overflow: auto; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; }
nav.top { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(8px); }
nav.top .wrap { display: flex; align-items: center; gap: 18px; height: 58px; overflow-x: auto; }
nav.top .brand { font: 700 1.2rem var(--serif); color: var(--ink); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
nav.top .brand .q { color: var(--gold); }
nav.top a.nl { color: var(--ink2); font-size: 0.95rem; white-space: nowrap; }
nav.top a.nl.on, nav.top a.nl:hover { color: var(--ink); text-decoration: none; }
nav.top .sp { flex: 1; }
footer { border-top: 1px solid var(--line); margin-top: 80px; padding: 28px 0 40px; color: var(--ink3); font-size: 0.9rem; }
footer .wrap { display: flex; gap: 20px; flex-wrap: wrap; }
.muted { color: var(--ink3); } .small { font-size: 0.88rem; } .tiny { font-size: 0.78rem; }
.lead { font-size: 1.2rem; color: var(--ink2); max-width: 46em; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--bg3); color: var(--ink);
  padding: 9px 16px; border-radius: 8px; font: 600 0.95rem var(--sans); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink3); text-decoration: none; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1408; }
.btn.primary:hover { background: var(--gold2); }
.btn.danger { border-color: color-mix(in srgb, var(--red) 60%, var(--line)); color: var(--red); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 860px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3:first-child { margin-top: 0; }
textarea, input[type=text], input[type=email], input[type=number], select {
  width: 100%; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: 1rem/1.5 var(--sans); }
textarea { min-height: 180px; resize: vertical; }
textarea:focus, input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--gold) 50%, transparent); border-color: var(--gold); }
label { display: block; font-weight: 600; margin: 12px 0 6px; font-size: 0.93rem; }
.hint { color: var(--ink3); font-size: 0.85rem; margin-top: 4px; }
.pill { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 0.78rem; color: var(--ink2); }
.pill.gold { border-color: var(--gold); color: var(--gold); }
.lane { border-top: 3px solid var(--gold); }
.lane.b { border-top-color: var(--blue); } .lane.c { border-top-color: var(--green); }
.hero { padding: 64px 0 24px; }
.kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.78rem; color: var(--gold); font-weight: 700; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--bg3); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 8px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.toast.err { border-color: var(--red); }
.hidden { display: none !important; }
.table-wrap { overflow-x: auto; } table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 0.93rem; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { color: var(--ink2); font-weight: 600; }

/* gauges */
.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.gauge { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.gauge .gl { font-size: 0.8rem; color: var(--ink2); font-weight: 600; }
.gauge .gv { font: 700 1.9rem var(--serif); margin: 2px 0 6px; }
.gauge .gv small { font-size: 0.9rem; color: var(--ink3); font-weight: 400; }
.gauge .track { height: 8px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.gauge .fill { height: 100%; border-radius: 99px; transition: width .5s ease; }
.gauge .gs { font-size: 0.78rem; color: var(--ink3); margin-top: 6px; }
.good { color: var(--green); } .warn { color: var(--gold); } .bad { color: var(--red); }

/* tells */
.marked { white-space: pre-wrap; line-height: 1.75; font-size: 1.02rem; }
mark.t { background: transparent; color: inherit; border-bottom: 2px solid; cursor: help; padding: 0 1px; }
mark.t.model { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
mark.t.real_voice { border-color: var(--violet); background: color-mix(in srgb, var(--violet) 14%, transparent); }
mark.t.off_persona { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent); }
mark.t.active { outline: 2px solid var(--gold); }
.tell-list { list-style: none; padding: 0; margin: 0; }
.tell-list li { border-left: 3px solid var(--line); padding: 6px 10px; margin: 6px 0; font-size: 0.9rem; background: var(--bg); border-radius: 0 6px 6px 0; cursor: pointer; }
.tell-list li.model { border-left-color: var(--red); } .tell-list li.real_voice { border-left-color: var(--violet); } .tell-list li.off_persona { border-left-color: var(--blue); }
.tell-list li b { display: block; font-size: 0.8rem; color: var(--ink2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.8rem; color: var(--ink2); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend .m::before { background: var(--red); } .legend .r::before { background: var(--violet); } .legend .o::before { background: var(--blue); }

/* portrait */
.portrait { list-style: none; padding: 0; margin: 0; }
.portrait li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.portrait li span:last-child { color: var(--ink3); font-size: 0.85rem; white-space: nowrap; }

/* app layout */
.app { display: grid; grid-template-columns: 240px 1fr; gap: 20px; margin-top: 20px; }
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } }
.side .plist { list-style: none; padding: 0; margin: 0 0 12px; }
.side .plist li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.side .plist li:hover { background: var(--bg3); } .side .plist li.on { background: var(--bg3); outline: 1px solid var(--gold); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: none; color: var(--ink2); padding: 10px 14px; font: 600 0.95rem var(--sans); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--gold); }
.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .editor { grid-template-columns: 1fr; } }
.para { position: relative; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--bg); }
.para .ptools { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.para .pscore { font-size: 0.75rem; color: var(--ink3); }
.para .ptext { white-space: pre-wrap; line-height: 1.7; }
ins.d { background: color-mix(in srgb, var(--green) 18%, transparent); text-decoration: none; border-radius: 2px; }
del.d { color: var(--ink3); text-decoration: line-through; opacity: .6; }
.lockchip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg3); border: 1px solid var(--line); border-radius: 99px; padding: 2px 4px 2px 10px; font-size: 0.82rem; margin: 3px; }
.lockchip button { background: none; border: none; color: var(--ink3); cursor: pointer; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--ink3); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { display: flex; gap: 10px; flex-wrap: wrap; } .steps .step { flex: 1; min-width: 200px; cursor: pointer; }
.steps .step.on { outline: 2px solid var(--gold); }
.sample-pick { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 8px 0; display: flex; gap: 10px; align-items: flex-start; }
.sample-pick textarea { min-height: 90px; }
.lineup-item { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 10px 0; cursor: pointer; background: var(--bg2); }
.lineup-item:hover { border-color: var(--gold); } .lineup-item.right { border-color: var(--green); } .lineup-item.wrong { border-color: var(--red); }
.price { font: 700 2.2rem var(--serif); } .price small { font-size: 1rem; color: var(--ink3); font-weight: 400; }
.feat { list-style: none; padding: 0; } .feat li { padding: 4px 0; } .feat li::before { content: "— "; color: var(--gold); }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--gold); padding: 10px 14px; border-radius: 0 8px 8px 0; background: var(--bg2); margin: 12px 0; font-size: 0.93rem; }
.acctnum { font: 700 1.6rem var(--mono); letter-spacing: 0.06em; color: var(--gold); }
.doc h1 { font-size: 2.2rem; } .doc { max-width: 780px; }
.stat { font: 700 2rem var(--serif); color: var(--gold); }
details summary { cursor: pointer; color: var(--ink2); }
