:root {
  --bg: #0b0f14;
  --panel: #121821;
  --panel-2: #0f151d;
  --text: #e8eef6;
  --muted: #9aa7b2;
  --accent: #5fd3b3;
  --accent-2: #7aa2f7;
  --border: #1f2a36;
  --warning: #f7c06a;
  --danger: #f17a7a;
  --mono: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
  --sans: "Sora", "Space Grotesk", "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 800px at 10% -10%, #1a2431 0%, #0b0f14 55%) fixed;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.45;
}

header {
  padding: 18px 24px 10px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: 0.3px;
}

header .header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

header .header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
}

.select-label {
  font-size: 12px;
  color: var(--muted);
}

.select {
  appearance: none;
  border: 1px solid rgba(122, 162, 247, 0.35);
  background: rgba(122, 162, 247, 0.10);
  color: #dfe7f1;
  padding: 8px 34px 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1;
}

.select:focus {
  outline: 2px solid rgba(95, 211, 179, 0.25);
  outline-offset: 2px;
}

.select {
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(232, 238, 246, 0.8) 50%),
    linear-gradient(135deg, rgba(232, 238, 246, 0.8) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

header .meta {
  color: var(--muted);
  font-size: 13px;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px 24px;
  display: grid;
  gap: 14px;
}

.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.card p {
  margin: 0 0 10px;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  background: rgba(95, 211, 179, 0.12);
  color: var(--accent);
  border: 1px solid rgba(95, 211, 179, 0.2);
}

.notice {
  border-left: 4px solid var(--warning);
  padding: 12px 14px;
  background: rgba(247, 192, 106, 0.08);
  color: #f7e1b1;
  border-radius: 10px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  position: sticky;
  top: 0;
  background: #111822;
  color: #d2dae4;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(31,42,54,0.7);
  color: #dfe7f1;
  vertical-align: top;
}

.table tbody tr:hover {
  background: rgba(122, 162, 247, 0.06);
}

.table .evidence {
  color: #cfd9e6;
}

.table .evidence a {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px solid rgba(122, 162, 247, 0.35);
}

.table .evidence a:hover {
  border-bottom-color: rgba(122, 162, 247, 0.75);
}

.steps {
  margin: 0;
  padding-left: 18px;
  color: #dfe7f1;
}

.steps li {
  margin: 4px 0;
  color: #dfe7f1;
}

.steps code {
  font-family: var(--mono);
  font-size: 12px;
  color: #cfe5ff;
}

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.kv .item {
  padding: 12px;
  border-radius: 12px;
  background: rgba(122, 162, 247, 0.08);
  border: 1px solid rgba(122, 162, 247, 0.2);
}

.kv .item .label {
  font-size: 12px;
  color: var(--muted);
}

.kv .item .value {
  font-size: 14px;
  margin-top: 6px;
}

pre {
  background: #0c1219;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: #cfe5ff;
  font-family: var(--mono);
  white-space: pre-wrap;
}

.tabs {
  display: flex;
  gap: 10px;
  margin: 10px 0 14px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid rgba(122, 162, 247, 0.35);
  background: rgba(122, 162, 247, 0.10);
  color: #dfe7f1;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}

.tab.active {
  border-color: rgba(95, 211, 179, 0.55);
  background: rgba(95, 211, 179, 0.12);
  color: var(--accent);
}

footer {
  color: var(--muted);
  font-size: 12px;
  padding: 0 24px 24px;
}

/* Compact ranked table layout (top-10 fits in a single viewport on load). */
.table-compact .rank {
  width: 52px;
  color: #d2dae4;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table-compact .tactic {
  width: 370px;
}

.tactic-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.15;
}

.tactic-text {
  font-weight: 600;
  color: #e8eef6;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid rgba(122, 162, 247, 0.35);
  background: rgba(122, 162, 247, 0.10);
  color: #dfe7f1;
  white-space: nowrap;
}

.table-compact .score {
  width: 86px;
  white-space: nowrap;
}

.score-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.table-compact .signals {
  width: 210px;
}

.sig {
  display: grid;
  grid-template-columns: 44px 26px 1fr;
  gap: 8px;
  align-items: center;
  margin: 2px 0;
}

.sig-k {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.sig-v {
  color: #dfe7f1;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.sig-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(154, 167, 178, 0.16);
  overflow: hidden;
}

.sig-bar i {
  display: block;
  height: 100%;
  background: rgba(122, 162, 247, 0.85);
}

.table-compact .evidence {
  width: 360px;
  font-size: 11px;
  line-height: 1.18;
  max-width: 360px;
  max-height: 46px;
  overflow: hidden;
}

.table-compact tr.row {
  cursor: pointer;
}

.table-compact tr.row:focus {
  outline: 2px solid rgba(95, 211, 179, 0.25);
  outline-offset: -2px;
}

.th-tip {
  position: relative;
  padding-right: 24px;
}

.tipdot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(232, 238, 246, 0.9);
  background: rgba(122, 162, 247, 0.18);
  border: 1px solid rgba(122, 162, 247, 0.28);
}

.tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(12, 18, 25, 0.96);
  border: 1px solid rgba(31,42,54,0.9);
  color: #dfe7f1;
  font-size: 12px;
  line-height: 1.25;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  pointer-events: none;
  white-space: pre-line;
}

.details td {
  padding: 10px 12px;
}

.details-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 10px 8px 6px;
}

.details-col {
  background: rgba(15, 21, 29, 0.55);
  border: 1px solid rgba(31,42,54,0.7);
  border-radius: 12px;
  padding: 10px 10px 8px;
}

.details-h {
  font-size: 12px;
  color: #d2dae4;
  margin: 0 0 8px;
  font-weight: 600;
}

.details-notes,
.details-evidence {
  color: #cfd9e6;
  font-size: 12px;
  line-height: 1.25;
}

.evcards {
  display: grid;
  gap: 8px;
}

.evbrief {
  background: rgba(10, 15, 20, 0.55);
  border: 1px solid rgba(31,42,54,0.70);
  border-radius: 12px;
  padding: 10px 10px 8px;
  margin-bottom: 10px;
}

.evbrief-h {
  font-size: 12px;
  font-weight: 700;
  color: rgba(232, 238, 246, 0.94);
  margin-bottom: 8px;
}

.evbrief-k {
  font-size: 11px;
  font-weight: 650;
  color: rgba(154, 167, 178, 0.95);
  margin-top: 8px;
}

.evbrief-v {
  margin-top: 6px;
  color: rgba(207, 217, 230, 0.95);
  font-size: 12px;
  line-height: 1.25;
}

.evbrief-list {
  margin: 6px 0 0;
  padding-left: 18px;
  color: rgba(207, 217, 230, 0.95);
  font-size: 12px;
  line-height: 1.25;
}

.evbrief-list li {
  margin: 4px 0;
}

.evbrief-empty {
  margin-top: 6px;
  color: rgba(154, 167, 178, 0.9);
  font-size: 12px;
}

.evcard {
  background: rgba(10, 15, 20, 0.45);
  border: 1px solid rgba(31,42,54,0.65);
  border-radius: 12px;
  padding: 8px 10px;
}

.ev-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.ev-head a {
  color: rgba(122, 162, 247, 0.95);
  text-decoration: none;
  font-weight: 650;
}

.ev-head a:hover {
  text-decoration: underline;
}

.ev-meta {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.ev-title {
  color: rgba(232, 238, 246, 0.92);
  font-size: 12px;
  margin-top: 4px;
}

.ev-sum {
  color: rgba(207, 217, 230, 0.92);
  font-size: 12px;
  margin-top: 4px;
}

.evclaims {
  margin: 6px 0 0;
  padding-left: 18px;
  color: rgba(207, 217, 230, 0.92);
  font-size: 12px;
  line-height: 1.25;
}

.evclaims li {
  margin: 4px 0;
}

.steps-compact {
  margin: 0;
  padding-left: 18px;
  color: #dfe7f1;
  font-size: 12px;
  line-height: 1.25;
}

.steps-compact li {
  margin: 4px 0;
}

.details-hint {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  padding: 2px 2px 0;
}

@media (max-width: 980px) {
  .details-wrap {
    grid-template-columns: 1fr;
  }
  .table-compact .signals {
    display: none;
  }
  .table-compact .tactic {
    width: auto;
  }
  .table-compact .evidence {
    width: auto;
    max-width: none;
  }
}
