:root {
  --bg: #0a0a0f;
  --panel: #13131b;
  --card: #1a1a24;
  --line: #2a2a36;
  --text: #f3f1ee;
  --muted: #a4a2ae;
  --accent: #ff3d6e;
  --accent-2: #ffb03b;
  --good: #3ddc97;
  --ok: #ffb03b;
  --bad: #ff5468;
  --radius: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  background: radial-gradient(80% 50% at 100% 0%, rgba(255, 61, 110, .16), transparent 60%), var(--bg);
  color: var(--text); font: 400 1rem/1.55 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2 { margin: 0; line-height: 1.05; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }

.top { padding-top: clamp(2rem, 6vw, 4rem); padding-bottom: 1.5rem; }
.eyebrow { margin: 0; font: 600 .75rem/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
.top h1 { margin: .6rem 0 .8rem; font-size: clamp(2.2rem, 8vw, 4rem); font-weight: 900; letter-spacing: -.03em; }
.lead { margin: 0; max-width: 58ch; color: #dcd9e2; font-size: clamp(1rem, 3.4vw, 1.15rem); }

.layout { display: grid; gap: 1rem; padding-bottom: 2rem; }
@media (min-width: 960px) { .layout { grid-template-columns: 5fr 7fr; align-items: start; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1rem, 3vw, 1.5rem); }
.panel h2 { font-size: 1.15rem; font-weight: 800; }
.hint { display: block; margin: .6rem 0 .8rem; color: var(--muted); font-size: .9rem; }
code { font-family: var(--mono); font-size: .85em; background: rgba(255, 255, 255, .06); padding: .1rem .35rem; border-radius: 5px; color: var(--text); }

textarea {
  width: 100%; min-height: 15rem; resize: vertical; padding: .9rem;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  font: 400 .85rem/1.6 var(--mono);
}
textarea:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 1rem 0; }
.options label { display: grid; gap: .35rem; font-size: .8rem; color: var(--muted); }
select { width: 100%; padding: .6rem .7rem; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: .9rem; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.btn {
  min-height: 46px; padding: .7rem 1.2rem; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .22); background: transparent; color: var(--text);
  font: 700 .95rem var(--font); transition: transform .15s, border-color .2s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--text); }
.btn--primary { border: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #0a0a0f; }
.btn--small { min-height: 36px; padding: .4rem .9rem; font-size: .85rem; }
.errors { margin: 1rem 0 0; padding: .75rem .9rem; border-radius: 10px; background: rgba(255, 84, 104, .12); color: #ffb3bd; font-size: .9rem; }

.result-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.summary { margin: .5rem 0 1rem; color: var(--muted); font-size: .92rem; }
.summary b { color: var(--text); }

.set { list-style: none; margin: 0; padding: 0; }
.track {
  display: grid; grid-template-columns: 2rem 1fr; gap: .15rem .75rem; align-items: center;
  padding: .7rem .8rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.pos { grid-row: span 2; font: 800 1.1rem var(--mono); color: var(--accent); text-align: center; }
.title { font-weight: 700; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: .3rem .7rem; font-size: .82rem; }
.key { font-family: var(--mono); color: var(--accent-2); }
.muted { color: var(--muted); }
.transition {
  display: flex; justify-content: space-between; gap: .5rem; margin: .1rem 0 .1rem 1.2rem;
  padding: .45rem .8rem; border-left: 2px solid; font-size: .8rem;
}
.q-good { border-color: var(--good); color: var(--good); }
.q-ok { border-color: var(--ok); color: var(--ok); }
.q-bad { border-color: var(--bad); color: var(--bad); }
.empty { color: var(--muted); padding: 1rem 0; }

.viz { display: grid; gap: 1rem; margin-top: 1.25rem; }
@media (min-width: 640px) { .viz { grid-template-columns: 1fr 1fr; align-items: start; } }
figure { margin: 0; padding: .9rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
figcaption { margin-bottom: .5rem; font: 600 .7rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
svg { display: block; width: 100%; height: auto; }

.seg { fill: #15151d; stroke: #2e2e3b; stroke-width: 1; }
.seg.on { fill: rgba(255, 61, 110, .22); stroke: rgba(255, 61, 110, .55); }
.lbl { font: 600 10px var(--mono); text-anchor: middle; fill: #6e6c7a; }
.lbl.on { fill: var(--text); }
.hub { fill: var(--bg); stroke: #2e2e3b; }
.hub-txt { font: 700 10px var(--mono); letter-spacing: .2em; text-anchor: middle; fill: #6e6c7a; }
.path { fill: none; stroke: var(--accent-2); stroke-width: 2; stroke-linejoin: round; opacity: .85; }
.dot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.num { font: 800 9px var(--mono); text-anchor: middle; fill: #0a0a0f; }

.axis { stroke: var(--line); }
.target { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .7; }
.energy { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.edot { fill: var(--accent-2); }
.cap { font: 500 8px var(--mono); fill: var(--muted); }

.foot { padding-bottom: 2rem; color: var(--muted); font-size: .85rem; }

@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
