/* ============================================================
   UNDERDOG — design tokens
   ink background · violet brand · green/red strictly = money
   Space Grotesk (display) / Inter (UI) / JetBrains Mono (data)
   ============================================================ */
:root {
  --ink: #0b0e14;
  --ink-2: #0e131c;
  --panel: #141b27;
  --panel-2: #19212f;
  --line: #232d3e;
  --line-soft: #1b2434;

  --text: #e6eaf2;
  --muted: #7a879f;
  --faint: #4f5a70;

  --violet: #8b7bf7;
  --violet-lo: #b6abff;
  --violet-dim: #5a4fb0;

  --green: #34d9a0;
  --red: #ff6b6b;
  --amber: #f2b450;

  --radius: 12px;
  --radius-sm: 8px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --disp: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 78% -8%, rgba(139, 123, 247, 0.10), transparent 60%),
    var(--ink);
  color: var(--text);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.mark {
  font-family: var(--disp);
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: 18px;
  color: var(--text);
}
.mark::before {
  content: "▲";
  color: var(--violet);
  margin-right: 9px;
  font-size: 12px;
  vertical-align: middle;
}
.tag { color: var(--muted); font-size: 12.5px; letter-spacing: 0.02em; }
.status { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.status .live { color: var(--green); }
.status .down { color: var(--red); }

/* ---------- console ---------- */
.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 28px 24px 60px; flex: 1; }

.console {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.field { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.windowfield { flex: 0 0 92px; }
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.field input, .field select {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.field input::placeholder { color: var(--faint); }
.field input:focus, .field select:focus { border-color: var(--violet-dim); }
.field select { cursor: pointer; }

.run {
  background: var(--violet);
  color: #14101f;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--disp);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  padding: 12px 22px;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, opacity 0.15s;
}
.run:hover { background: var(--violet-lo); }
.run:active { transform: translateY(1px); }
.run:disabled { opacity: 0.55; cursor: progress; }

.hint { color: var(--faint); font-size: 12px; margin: 12px 2px 0; font-family: var(--mono); }

/* ---------- messages ---------- */
.msg {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
}
.msg.err { border-left-color: var(--red); color: #ffb3b3; }

/* ---------- result ---------- */
.result { margin-top: 26px; display: grid; gap: 16px; }

/* verdict hero — the signature element */
.verdict {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 26px;
  align-items: center;
  background:
    linear-gradient(180deg, rgba(139,123,247,0.06), transparent 55%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}
.gauge { position: relative; width: 168px; height: 168px; }
.gauge svg { transform: rotate(-90deg); }
.gauge .track { fill: none; stroke: var(--line); stroke-width: 12; }
.gauge .arc { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.7,.2,1); }
.gauge .num {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.gauge .score { font-family: var(--mono); font-weight: 700; font-size: 42px; line-height: 1; }
.gauge .of { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-top: 4px; letter-spacing: 0.1em; }

.verdict-body h2 {
  font-family: var(--disp);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.verdict-body .line { font-size: 19px; font-weight: 500; line-height: 1.4; margin: 0 0 16px; }
.risk-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line);
}
.risk-pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.risk-Low      { color: var(--green);  border-color: rgba(52,217,160,0.4); }
.risk-Low .dot { background: var(--green); }
.risk-Medium      { color: var(--amber); border-color: rgba(242,180,80,0.4); }
.risk-Medium .dot { background: var(--amber); }
.risk-High      { color: #ff9a6b; border-color: rgba(255,154,107,0.4); }
.risk-High .dot { background: #ff9a6b; }
.risk-Very.High { color: var(--red); }   /* fallback */
.risk-VeryHigh      { color: var(--red); border-color: rgba(255,107,107,0.4); }
.risk-VeryHigh .dot { background: var(--red); }

/* metric grid */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
}
.card .k {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); margin-bottom: 9px;
}
.card .v { font-family: var(--mono); font-size: 21px; font-weight: 700; line-height: 1.1; }
.card .sub { font-family: var(--mono); font-size: 11.5px; color: var(--faint); margin-top: 5px; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* section panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.panel h3 {
  font-family: var(--disp); font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted);
  margin: 0 0 16px;
}

/* risk bars */
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 44px; align-items: center; gap: 12px; }
.bar-row .lab { font-size: 13px; color: var(--text); }
.bar-track { height: 7px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; animation: growbar 0.9s cubic-bezier(.2,.7,.2,1) both; }
@keyframes growbar { from { width: 0; } }
.bar-row .val { font-family: var(--mono); font-size: 12.5px; text-align: right; color: var(--muted); }

/* cadence inline */
.cadence { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cad { text-align: left; }
.cad .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 8px; }
.cad .v { font-family: var(--mono); font-size: 19px; font-weight: 700; }
.cad .u { color: var(--faint); font-size: 12px; font-weight: 400; }

/* token table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: right; font-weight: 500; color: var(--muted);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0 10px 10px; border-bottom: 1px solid var(--line);
}
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-soft); font-family: var(--mono); }
.tbl tr:last-child td { border-bottom: none; }
.mint { color: var(--violet-lo); }
.mint a { color: inherit; text-decoration: none; }
.mint a:hover { text-decoration: underline; }
.chip {
  font-family: var(--mono); font-size: 10px; padding: 2px 7px; border-radius: 5px;
  border: 1px solid var(--line);
}
.chip.win { color: var(--green); }
.chip.loss { color: var(--red); }
.chip.open { color: var(--amber); }
.chip.scratch { color: var(--faint); }

/* loading */
.loading { display: flex; align-items: center; gap: 12px; color: var(--muted); font-family: var(--mono); font-size: 13px; padding: 30px 4px; }
.spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--violet);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.fade { animation: fade 0.45s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* footer */
.foot {
  display: flex; justify-content: space-between;
  padding: 16px 24px; border-top: 1px solid var(--line-soft);
  color: var(--faint); font-family: var(--mono); font-size: 11px;
}

@media (max-width: 760px) {
  .console { flex-direction: column; align-items: stretch; }
  .windowfield { flex: 1; }
  .verdict { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .verdict-body { text-align: center; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .cadence { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 110px 1fr 40px; }
  .tbl .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, .gauge .arc, .bar-fill { transition: none !important; animation: none !important; }
}
