:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #647089;
  --line: rgba(36, 50, 84, 0.12);
  --card: rgba(255,255,255,0.82);
  --blue: #4169ff;
  --purple: #8d5cff;
  --gold: #d99b27;
  --green: #11a87d;
  --red: #d94b4b;
  --shadow: 0 24px 80px rgba(37, 52, 94, 0.17);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(245, 248, 255, 0.94), rgba(253, 247, 239, 0.92)),
    radial-gradient(circle at top left, rgba(91, 117, 255, 0.36), transparent 34rem),
    radial-gradient(circle at 82% 10%, rgba(186, 122, 255, 0.30), transparent 28rem),
    #f7f8fc;
  overflow-x: hidden;
}
.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(22px);
  opacity: .38;
  pointer-events: none;
  z-index: 0;
}
.orb-a { width: 20rem; height: 20rem; background: #7fa2ff; left: -5rem; top: 9rem; }
.orb-b { width: 28rem; height: 28rem; background: #ffd996; right: -9rem; top: 22rem; }
.shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto 60px;
}
.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.78);
  box-shadow: var(--shadow);
  border-radius: 30px;
  backdrop-filter: blur(18px);
}
.hero {
  display: grid;
  grid-template-columns: 1.3fr .92fr;
  gap: 26px;
  align-items: end;
  padding: 34px;
}
.eyebrow, .card-kicker {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 800;
  color: var(--blue);
  font-size: 12px;
}
h1, h2, p { margin-top: 0; }
h1 {
  font-size: clamp(38px, 6vw, 74px);
  line-height: .93;
  letter-spacing: -.055em;
  margin: 10px 0 20px;
  max-width: 760px;
}
h2 {
  font-size: 22px;
  letter-spacing: -.025em;
  margin: 4px 0 0;
}
.hero p {
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
  margin: 0;
}
.name-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
  background: rgba(255,255,255,.7);
  border: 1px solid var(--line);
}
label span {
  display: block;
  color: #66718a;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
  margin: 0 0 6px;
}
input, select, button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  background: white;
  color: var(--ink);
}
input { font-size: 30px; font-weight: 850; letter-spacing: -.04em; }
select { color: #3e4960; }
button {
  cursor: pointer;
  border: none;
  color: white;
  font-weight: 850;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  box-shadow: 0 14px 36px rgba(65,105,255,.28);
}
button:disabled { opacity: .58; cursor: wait; }
.dashboard {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 20px;
  margin-top: 20px;
}
.dashboard > .card { padding: 24px; }
.winner-card { grid-column: span 1; }
.models-card { grid-row: span 2; }
.table-card, .viz-card, .pareto-card, .method-card { min-height: 260px; }
.card-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.status-pill {
  border-radius: 999px;
  padding: 8px 12px;
  background: #edf2ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.status-pill.loading { background: #fff4dd; color: #a66600; }
.status-pill.ok { background: #e8fbf3; color: #078862; }
.status-pill.error { background: #ffecec; color: #bd3333; }
.winner-main {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-top: 12px;
}
.winner-hanzi {
  font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", serif;
  font-size: clamp(68px, 10vw, 112px);
  font-weight: 900;
  letter-spacing: -.07em;
  line-height: .9;
  background: linear-gradient(135deg, #101827, #4169ff 60%, #a46510);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.winner-pinyin {
  color: var(--purple);
  font-size: 22px;
  font-weight: 800;
  margin-top: 14px;
}
.winner-meaning {
  color: var(--muted);
  line-height: 1.55;
  margin: 10px 0 0;
}
.seal {
  flex: 0 0 142px;
  width: 142px;
  height: 142px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  text-align: center;
  position: relative;
  color: #6f4210;
  background: radial-gradient(circle at 30% 25%, #fff3bd, #f4c65d 45%, #c47d1b 100%);
  border: 5px solid #fff2c3;
  box-shadow: inset 0 0 0 3px rgba(119,73,8,.18), 0 16px 44px rgba(176,110,22,.25);
}
.seal::before {
  content: "";
  position: absolute;
  inset: -12px;
  background: conic-gradient(from 0deg, #d99b27 0 8deg, transparent 8deg 13deg, #d99b27 13deg 21deg, transparent 21deg 27deg);
  border-radius: inherit;
  z-index: -1;
}
.seal-score { font-size: 44px; font-weight: 950; line-height: .9; }
.seal-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 950; }
.metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 22px;
}
.metric-row > div {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.62);
}
.metric-row span { display:block; font-size: 26px; font-weight: 900; }
.metric-row small { color: var(--muted); font-weight: 700; }
.model-runs { display: grid; gap: 12px; }
.model-run {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.65);
  padding: 14px;
}
.model-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.model-name { font-weight: 900; }
.model-candidate {
  font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", serif;
  font-size: 38px;
  font-weight: 900;
  margin: 8px 0 2px;
}
.model-detail { color: var(--muted); font-size: 13px; line-height: 1.45; }
.conf-bar {
  height: 9px;
  border-radius: 999px;
  background: #e8edf7;
  overflow: hidden;
  margin-top: 12px;
}
.conf-bar > i { display:block; height:100%; width: var(--w); background: linear-gradient(90deg, var(--blue), var(--green), #f2b84b); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: #66718a; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.name-cell { font-weight: 900; font-size: 20px; white-space: nowrap; }
.score-badge { display:inline-flex; padding: 6px 9px; border-radius: 999px; background:#edf2ff; color: var(--blue); font-weight: 900; }
.token-heatmap {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-content: start;
  min-height: 120px;
}
.token {
  --p: .5;
  border-radius: 10px;
  padding: 8px 9px;
  color: color-mix(in srgb, #1d2333 calc(var(--p) * 100%), white);
  background: color-mix(in srgb, #eef2ff calc(var(--p) * 100%), #ffbe55);
  border: 1px solid rgba(32, 42, 73, .08);
  font-weight: 850;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.caption { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
#paretoSvg { width: 100%; height: 255px; display: block; }
.axis { stroke: rgba(36, 50, 84, .22); stroke-width: 2; }
.gridline { stroke: rgba(36, 50, 84, .08); stroke-width: 1; }
.dot { fill: url(#dotGradient); stroke: white; stroke-width: 3; filter: drop-shadow(0 8px 12px rgba(65,105,255,.25)); }
.dot-label { font-size: 18px; font-weight: 900; fill: #1e2a44; font-family: "PingFang SC", "Noto Sans CJK SC", sans-serif; }
.axis-label { fill: #7a849a; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.method-card ol { margin: 14px 0 0; padding-left: 22px; color: var(--muted); line-height: 1.7; }
.error-box {
  background: #fff0f0;
  color: #a42525;
  border: 1px solid #ffd0d0;
  border-radius: 16px;
  padding: 12px;
  font-size: 14px;
}
.skeleton {
  background: linear-gradient(90deg, #eef2fb, #fff, #eef2fb);
  background-size: 220% 100%;
  animation: shimmer 1.1s infinite linear;
  color: transparent !important;
  border-radius: 14px;
}
@keyframes shimmer { to { background-position: -220% 0; } }
@media (max-width: 940px) {
  .hero, .dashboard { grid-template-columns: 1fr; }
  .models-card { grid-row: auto; }
  .winner-main { align-items: start; }
}
@media (max-width: 620px) {
  .shell { width: min(100vw - 18px, 1180px); margin-top: 10px; }
  .hero, .dashboard > .card { padding: 18px; border-radius: 24px; }
  .winner-main { flex-direction: column; }
  .metric-row { grid-template-columns: repeat(2, 1fr); }
  .seal { width: 126px; height: 126px; }
}
