:root {
  --bg: #0a0a0c;
  --card: #131316;
  --card-2: #18181b;
  --text: #e4e4e7;
  --text-dim: #a1a1aa;
  --muted: #71717a;
  --line: #27272a;
  --green: #10b981;
  --green-dim: #064e3b;
  --red: #ef4444;
  --red-dim: #4c1d1d;
  --amber: #f59e0b;
  --blue: #60a5fa;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--sans); }
body { line-height: 1.5; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header { padding: 36px 0 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { font-size: 32px; color: var(--green); line-height: 1; }
.brand h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.tag { margin: 8px 0 16px; color: var(--text-dim); font-size: 14px; }
.header-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.header-actions button {
  background: var(--green); color: #04231a; border: none; padding: 8px 14px;
  border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 13px;
}
.header-actions button:hover { filter: brightness(1.1); }
.muted { color: var(--muted); font-size: 12px; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 24px 0 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { color: var(--text); font-size: 22px; font-weight: 700; margin-top: 4px; }

.controls { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.filters, .sort { display: flex; gap: 8px; align-items: center; }
.controls label { color: var(--muted); font-size: 12px; }
.controls select {
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px; font-size: 13px;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; margin: 16px 0 48px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.card:hover { transform: translateY(-2px); border-color: #3f3f46; }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.card h3 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); color: var(--text-dim); text-transform: capitalize; }
.badge.crossed { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.badge.not-crossed { background: var(--red-dim); border-color: var(--red); color: var(--red); }
.badge.pending { background: var(--card-2); border-color: var(--line); color: var(--muted); }

.gauge { position: relative; height: 32px; background: var(--card-2); border-radius: 6px; overflow: hidden; margin: 12px 0 8px; }
.gauge .bar { position: absolute; top: 0; left: 0; bottom: 0; background: linear-gradient(90deg, #2563eb, #60a5fa); border-radius: 6px; }
.gauge .bar.crossed { background: linear-gradient(90deg, var(--green-dim), var(--green)); }
.gauge .baseline { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #fbbf24; }
.gauge .baseline-label { position: absolute; top: -22px; transform: translateX(-50%); font-size: 10px; color: #fbbf24; white-space: nowrap; }
.gauge .sota-label { position: absolute; bottom: -22px; right: 0; font-size: 11px; color: var(--text-dim); }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 8px; font-size: 13px; color: var(--text-dim); margin-top: 16px; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--text); }

.card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-dim); display: flex; justify-content: space-between; }
.card-foot .gap-positive { color: var(--green); font-weight: 600; }
.card-foot .gap-negative { color: var(--red); font-weight: 600; }

.description { color: var(--text-dim); font-size: 13px; margin: 4px 0 8px; }

/* modal */
.modal-root { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal { position: relative; max-width: 780px; width: 96%; max-height: 86vh; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0; font-size: 20px; }
.modal header button { background: transparent; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer; }
.modal #modalBody { overflow-y: auto; padding: 20px; }

.spark { width: 100%; height: 140px; background: var(--card-2); border-radius: 8px; padding: 8px; box-sizing: border-box; margin: 8px 0 16px; }

.history-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.history-table th, .history-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.history-table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.history-table td.score { font-family: var(--mono); }

.source-list { margin: 8px 0; padding: 0; list-style: none; font-size: 13px; }
.source-list li { padding: 4px 0; }
.source-list .pill { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 4px; background: var(--card-2); border: 1px solid var(--line); color: var(--text-dim); margin-right: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.source-list .pill.live { color: var(--green); border-color: var(--green); }
.source-list .pill.paper { color: var(--blue); border-color: var(--blue); }

.footer-sources { margin: 32px 0 48px; padding-top: 16px; border-top: 1px solid var(--line); }
.footer-sources h2 { margin: 0 0 8px; font-size: 16px; color: var(--text-dim); }

.site-footer { margin: 24px auto 32px; font-size: 12px; }

@media (max-width: 720px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  .controls { flex-direction: column; align-items: stretch; }
}
