:root {
  --bg: #060914;
  --ink: #e9edf9;
  --muted: #8d96ad;
  --line: rgba(255, 255, 255, 0.09);
  --card: rgba(255, 255, 255, 0.045);
  --card-hi: rgba(255, 255, 255, 0.08);
  --violet: #7c5cff;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --ok: #34d399;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.aurora {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 80vh;
  background:
    radial-gradient(42% 55% at 22% 18%, rgba(124, 92, 255, 0.30), transparent 70%),
    radial-gradient(38% 50% at 78% 8%, rgba(34, 211, 238, 0.20), transparent 70%),
    radial-gradient(30% 40% at 60% 45%, rgba(244, 114, 182, 0.14), transparent 70%);
  filter: blur(30px);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1020px;
  margin: 0 auto;
  padding: 56px 22px 80px;
}

/* ---------- hero ---------- */
.hero { text-align: center; margin-bottom: 34px; }

.pi-badge {
  width: 74px; height: 74px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  font-family: "Times New Roman", Georgia, serif;
  font-size: 46px;
  line-height: 1;
  color: #fff;
  border-radius: 22px;
  background: linear-gradient(140deg, var(--violet), var(--cyan) 70%);
  box-shadow: 0 18px 50px -14px rgba(124, 92, 255, 0.75), inset 0 1px 0 rgba(255,255,255,0.35);
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(26px, 4.4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, #fff 10%, #c9c3ff 55%, #8ee9f8 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sub { margin: 0; color: var(--muted); font-size: 15px; }

/* ---------- panel ---------- */
.panel {
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px 26px 22px;
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 60px -40px rgba(0, 0, 0, 0.9);
}

.row {
  display: grid;
  grid-template-columns: minmax(230px, 0.85fr) 1.15fr;
  gap: 26px;
}

@media (max-width: 720px) { .row { grid-template-columns: 1fr; } }

.field label, .manual label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #b9c1d6;
  margin-bottom: 9px;
}

input[type="date"], input[type="number"], input[type="text"], #manualInput {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 26, 0.7);
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}

input[type="date"]:focus, input[type="number"]:focus, #manualInput:focus {
  border-color: rgba(124, 92, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.16);
}

input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.8); cursor: pointer; }

.hint { margin: 8px 0 0; font-size: 12.5px; color: #7b8399; line-height: 1.55; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chips button {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: #c3cada;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s, background .16s, border-color .16s, color .16s;
}

.chips button:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.chips button:active { transform: scale(0.97); }

.chips button.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(140deg, rgba(124, 92, 255, 0.95), rgba(34, 211, 238, 0.85));
  box-shadow: 0 10px 26px -12px rgba(124, 92, 255, 0.9);
}

.custom-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.custom-line input { max-width: 190px; }
.custom-line .unit { font-size: 13px; color: var(--muted); }

.actions { display: flex; align-items: center; gap: 16px; margin-top: 22px; flex-wrap: wrap; }

.primary {
  position: relative;
  padding: 13px 30px;
  border: none;
  border-radius: 14px;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #8b5cff, #5b8cff 45%, #22d3ee);
  box-shadow: 0 18px 40px -18px rgba(110, 110, 255, 0.95);
  transition: transform .14s, box-shadow .16s, filter .16s;
}

.primary:hover { transform: translateY(-1px); box-shadow: 0 22px 46px -18px rgba(110, 110, 255, 1); }
.primary:active { transform: translateY(0) scale(0.99); }
.primary[disabled] { cursor: progress; filter: saturate(0.55) brightness(0.9); transform: none; }
.stop {
  padding: 13px 22px;
  border-radius: 14px;
  border: 1px solid rgba(255, 120, 120, 0.45);
  background: rgba(255, 90, 90, 0.12);
  color: #ffb4b4;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: inherit;
  cursor: pointer;
  transition: background .16s, color .16s, transform .12s;
}
.stop:hover { background: rgba(255, 90, 90, 0.22); color: #fff; }
.stop:active { transform: scale(0.98); }
.stop:disabled { opacity: 0.55; cursor: progress; }
.stop.force {
  border-color: rgba(255, 70, 70, 0.8);
  background: rgba(255, 60, 60, 0.26);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 70, 70, 0.14);
}

.timer { font-family: var(--mono); font-size: 13px; color: var(--muted); }

.progress { margin-top: 18px; }
.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transition: width .18s ease-out;
}
.progress-text {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  font-family: var(--mono);
}

/* ---------- verdict ---------- */
.verdict { margin-top: 22px; }

.verdict-inner {
  border-radius: 20px;
  padding: 22px 26px;
  border: 1px solid rgba(124, 92, 255, 0.35);
  background:
    linear-gradient(120deg, rgba(124, 92, 255, 0.18), rgba(34, 211, 238, 0.10)),
    rgba(10, 14, 30, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.verdict-line { font-size: 17px; line-height: 1.7; }
.verdict-line b { color: #fff; }
.verdict-line .num {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: #9df0ff;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(34, 211, 238, 0.12);
}
.verdict-meta { margin-top: 6px; font-size: 13px; color: var(--muted); }
.verdict-inner .mini { margin-top: 12px; }

/* ---------- results ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 34px 0 14px;
}
.section-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.meta { margin: 0; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 920px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .cards { grid-template-columns: 1fr; } }

.card {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.028));
  overflow: hidden;
  transition: border-color .18s, transform .18s;
}
.card:hover { border-color: rgba(124, 92, 255, 0.45); transform: translateY(-2px); }

.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--violet), var(--cyan));
  opacity: .8;
}

.card-hit::before { background: linear-gradient(180deg, #34d399, #22d3ee); }
.card-miss { opacity: 0.82; }
.card-miss::before { background: rgba(255, 255, 255, 0.14); }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-top .tag { flex: none; margin-top: 1px; }
.card-name { font-size: 13.5px; font-weight: 600; color: #cdd4e6; }
.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
}
.tag.hit { color: #7ff0c0; border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.10); }

.card-digits {
  margin: 12px 0 4px;
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.12em;
  color: #fff;
}

.card-pos { font-size: 14px; color: #d5dbea; }
.card-pos .big {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  color: #a9f2ff;
  margin-right: 3px;
}
.card-miss .card-pos .big { color: #7b8399; }

.card-sub { margin-top: 4px; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }

.card-actions { margin-top: 12px; display: flex; gap: 8px; }

.mini {
  padding: 6px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #c8cfe0;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.mini:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.mini:disabled { opacity: 0.38; cursor: not-allowed; }
.mini:disabled:hover { background: rgba(255, 255, 255, 0.04); color: #c8cfe0; }

/* ---------- viewer ---------- */
.viewer {
  margin-top: 30px;
  padding: 20px 22px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(6, 9, 20, 0.62);
}

.viewer-nav { display: flex; gap: 8px; }
.viewer-nav button {
  padding: 6px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #c8cfe0;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}
.viewer-nav button:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.digits-box {
  font-family: var(--mono);
  font-size: 15px;
  line-height: 2.1;
  letter-spacing: 0.08em;
  word-break: break-all;
  color: #b9c1d6;
  max-height: 190px;
  overflow-y: auto;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.digits-box mark {
  color: #041016;
  background: linear-gradient(120deg, #7ff0c0, #6be7ff);
  border-radius: 4px;
  padding: 1px 2px;
  font-weight: 700;
}
.viewer-foot { margin-top: 8px; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }

/* ---------- manual ---------- */
.manual { margin-top: 30px; }
.manual-row { display: flex; gap: 10px; }
.manual-row input { font-family: var(--mono); letter-spacing: 0.06em; }
.ghost {
  flex: none;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid rgba(124, 92, 255, 0.5);
  background: rgba(124, 92, 255, 0.12);
  color: #d9d2ff;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.ghost:hover { background: rgba(124, 92, 255, 0.22); color: #fff; }

/* ---------- explain ---------- */
.explain { margin-top: 40px; padding-top: 26px; border-top: 1px solid var(--line); }
.explain h3 { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: #cdd4e6; }
.explain h3 + p { margin-top: 0; }
.explain p { margin: 0 0 18px; font-size: 13.5px; color: #8d96ad; line-height: 1.8; }
.explain b { color: #cfd6e8; }
.explain .hl { color: #7ff0c0; font-family: var(--mono); letter-spacing: 0.1em; }
.explain code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #9aa4bd;
  word-break: break-all;
  display: inline-block;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.footnote { margin-top: 30px; text-align: center; font-size: 12px; color: #5f6779; letter-spacing: 0.04em; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); background-clip: content-box; }

@media (max-width: 560px) {
  .wrap { padding: 36px 14px 60px; }
  .panel { padding: 20px 18px 18px; border-radius: 18px; }
  .manual-row { flex-direction: column; }
  .ghost { width: 100%; }
  .card-digits { font-size: 19px; }
  .verdict-line { font-size: 15.5px; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 40px));
  padding: 12px 20px;
  border-radius: 12px;
  background: rgba(18, 24, 44, 0.94);
  border: 1px solid rgba(124, 92, 255, 0.5);
  color: #e9edf9;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
  z-index: 50;
  animation: toast-in .18s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}