:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #17203a;
  --muted: #667085;
  --line: #e4e9f2;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --ok: #059669;
  --err: #dc2626;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 28px 20px 80px; }

header.app {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 6px;
}
header.app h1 { font-size: 26px; margin: 0; letter-spacing: -.02em; }
header.app .tag {
  font-size: 12px; color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 3px 10px; font-weight: 600;
}
p.sub { color: var(--muted); margin: 4px 0 22px; font-size: 14px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 18px;
}
.card h2 { font-size: 15px; margin: 0 0 4px; }
.card .hint { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }

.dropzone {
  border: 2px dashed #c7d0e0; border-radius: var(--radius);
  padding: 34px 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .big { font-size: 15px; font-weight: 600; }
.dropzone .small { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.file-pill {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
  border-radius: 999px; padding: 6px 14px; font-size: 13px;
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
label.f { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
select, input[type=number] {
  width: 100%; padding: 9px 11px; font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px; background: #fff; outline: none;
}
select:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 5px 13px; font-size: 12.5px; cursor: pointer; color: var(--muted);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  font-size: 14.5px; font-weight: 600; padding: 12px 22px; cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--accent); border: 1px solid var(--line); }

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(135deg, #eef2ff, #ecfeff);
  border: 1px solid #c7d2fe; border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 18px;
}
.banner .trophy { font-size: 26px; }
.banner .who { font-size: 16px; font-weight: 700; }
.banner .why { font-size: 13px; color: var(--muted); }

table.metrics { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.metrics th, table.metrics td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.metrics th:first-child, table.metrics td:first-child { text-align: left; }
table.metrics th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.metrics tr.winner td { background: #f0fdf4; font-weight: 700; }
.badge {
  display: inline-block; font-size: 11px; font-weight: 700; border-radius: 999px;
  padding: 2px 9px; margin-left: 8px; vertical-align: middle;
}
.badge.win { background: #d1fae5; color: var(--ok); }
.badge.fail { background: #fee2e2; color: var(--err); }

.chart { width: 100%; height: 420px; }
.chart.tall { height: 480px; }

.model-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 14px; }
.model-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 12.5px; }
.model-card h4 { margin: 0 0 6px; font-size: 13.5px; }
.model-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.model-card dt { color: var(--muted); }
.model-card dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.model-card .err { color: var(--err); font-family: inherit; }

.status-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; }
.spinner {
  width: 16px; height: 16px; border: 2.5px solid #c7d0e0; border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  border-radius: 10px; padding: 12px 14px; font-size: 13.5px; margin-top: 12px;
}
.note { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.hidden { display: none !important; }
.flexrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mt { margin-top: 16px; }
footer { color: var(--muted); font-size: 12px; text-align: center; margin-top: 30px; }
