:root {
  --bg: #070b12; --panel: #0e1522; --panel-2: #121b2b; --line: #1f2a3d; --ink: #e6ebf2; --muted: #8a97ab;
  --jepela: #2dd4bf; --jepela-deep: #0f766e; --plain: #a3aec0; --gold: #f5c542; --bad: #f05252; --warn: #f59e0b; --good: #34d399;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--jepela); }
button, select, input { font: inherit; }
header.top { padding: 14px 18px 10px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #0b1322, var(--bg)); }
header.top .row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 750; font-size: 18px; }
.brand svg { width: 30px; height: 30px; }
header.top h1 { margin: 0; font-size: 20px; }
header.top h1 span { color: var(--jepela); font-weight: 600; }
.crumbs { margin-left: auto; font-size: 13px; color: var(--muted); }
.lead { margin: 6px 0 0; color: #c7d0dd; max-width: 1000px; }
.banner { display: none; margin: 10px 18px 0; padding: 10px 14px; border-radius: 10px; background: #2a1414; border: 1px solid #5c2323; color: #ffd4d4; }
.banner.show { display: block; }
main { padding: 14px 18px 26px; max-width: 1400px; margin: 0 auto; }
.btn { white-space: nowrap; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: 7px 12px; cursor: pointer; }
.btn:hover { border-color: #33445f; }
.btn.primary { background: var(--jepela-deep); border-color: var(--jepela); color: #fff; font-weight: 650; }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], select { background: #0a1220; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; }
input[type=text] { width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { background: #0f1a2b; border: 1px solid var(--line); color: #c7d0dd; border-radius: 999px; padding: 3px 11px; cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--jepela-deep); color: var(--ink); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.card h2 { margin: 0 0 8px; font-size: 14.5px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card h2 small { color: var(--muted); font-weight: 400; font-size: 12px; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 820px) { .duo { grid-template-columns: 1fr; } }
.agent { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.agent.memory { border-color: #1d4d4a; box-shadow: 0 0 0 1px rgba(45,212,191,.1), 0 18px 50px rgba(0,0,0,.4); }
.agent > .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 13px; background: #0b111c; font-size: 13.5px; }
.agent > .head b { color: var(--plain); }
.agent.memory > .head b { color: var(--jepela); }
.agent > .head .score { color: var(--muted); font-size: 12.5px; }
.agent .stage { position: relative; background: radial-gradient(ellipse at 50% 40%, #16233a, #0a111d 70%); min-height: 230px; }
.agent .body { padding: 10px 13px 12px; }
.q { color: #c7d0dd; font-size: 13px; margin-bottom: 6px; }
.opt { display: grid; grid-template-columns: 140px 1fr 44px; align-items: center; gap: 8px; margin: 4px 0; font-size: 12.5px; }
.opt .name { color: #c7d0dd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt .bar { position: relative; height: 12px; background: #0a1220; border-radius: 6px; border: 1px solid #172236; }
.opt .fill { position: absolute; left: 0; top: 0; bottom: 0; background: #4b5870; border-radius: 6px; transition: width .25s; }
.opt.chosen .fill { background: var(--plain); }
.memory .opt.chosen .fill { background: var(--jepela); }
.opt .ghost { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; opacity: .85; }
.opt .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.opt.chosen .pct { color: var(--ink); font-weight: 650; }
.opt.excluded .name { text-decoration: line-through; color: #6b7588; }
.opt.excluded .fill { background: repeating-linear-gradient(45deg, #3a1f24, #3a1f24 4px, #24151a 4px, #24151a 8px); width: 100% !important; }
.note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.note.warn { color: var(--warn); }
.note.good { color: var(--good); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); margin-right: 4px; white-space: nowrap; }
.tag.pin { border-color: #6b5a1a; color: var(--gold); }
.tag.rule { border-color: #1d4d4a; color: var(--jepela); }
.tag.mem { border-color: #3b3470; color: #b8a6ff; }
.tag.cut { border-color: #5c2323; color: #ff9b9b; }
.why { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 7px; }
.why .line { font-size: 12.3px; margin: 4px 0; color: #c7d0dd; display: flex; gap: 6px; align-items: baseline; }
.why .eff { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.eff.up { color: var(--good); } .eff.down { color: var(--bad); } .eff.zero { color: var(--muted); }
.meta { font-size: 11.5px; color: var(--muted); margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; }
.mem-item { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid #152032; font-size: 12.5px; }
.mem-item:last-child { border-bottom: 0; }
.mem-item .t { flex: 1; color: #c7d0dd; }
.mem-item .when { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; display: block; }
.x { background: none; border: 0; color: #6b7588; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.x:hover { color: var(--bad); }
.row { display: flex; gap: 8px; align-items: center; }
.row + .row { margin-top: 8px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1180px) { .grid-side { grid-template-columns: 1fr; } }
.side { display: flex; flex-direction: column; gap: 14px; }
canvas.chart { width: 100%; height: 170px; display: block; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
details.api { margin-top: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
details.api summary { cursor: pointer; color: #c7d0dd; }
details.api pre { white-space: pre-wrap; word-break: break-word; font: 12px/1.5 ui-monospace, Menlo, monospace; color: #b9c6d8; max-height: 420px; overflow: auto; background: #0a1220; padding: 10px; border-radius: 8px; }
footer.notes { color: var(--muted); font-size: 12.5px; max-width: 1100px; margin: 18px auto 30px; padding: 0 18px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #111a2a; border: 1px solid var(--jepela-deep); color: var(--ink);
  padding: 10px 16px; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.5); max-width: min(680px, 92vw); font-size: 13.5px; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; }
.bubble { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: #fff; color: #111; border-radius: 14px; padding: 5px 12px; font-weight: 650; font-size: 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,.35); white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: #fff; transform: translateX(-50%); }
.badge { position: absolute; right: 10px; top: 10px; background: rgba(0,0,0,.55); border: 1px solid var(--line); border-radius: 9px; padding: 3px 9px; font-size: 12.5px; }
.memory .badge { border-color: var(--jepela-deep); color: var(--jepela); }
.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin-top: 14px; }
.hub a.game { display: block; text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; transition: transform .15s, border-color .15s; }
.hub a.game:hover { transform: translateY(-2px); border-color: var(--jepela-deep); }
.hub .emoji { font-size: 34px; line-height: 1; }
.hub h3 { margin: 10px 0 4px; font-size: 17px; }
.hub p { margin: 0; color: #c7d0dd; font-size: 13.5px; }
