:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c2330;
  --muted: #5d6778;
  --border: #dde1e8;
  --accent: #1f6feb;
  --accent-soft: #e7f0ff;
  --solved: #f1f3f6;
  --error: #b42318;
  --error-soft: #fdecea;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c;
    --card: #1a2029;
    --text: #e6e9ef;
    --muted: #9aa4b5;
    --border: #2d3542;
    --accent: #5b9dff;
    --accent-soft: #1d2c45;
    --solved: #222a35;
    --error: #ff8a80;
    --error-soft: #3a1f1f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
h1 { margin: 0; font-size: 1.6rem; }
.sub { margin: 4px 0 0; color: var(--muted); }
.formula { font-family: ui-monospace, Consolas, monospace; color: var(--text); white-space: nowrap; }
.actions { display: flex; gap: 8px; }

.btn {
  font: inherit; padding: 6px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px;
}
h2 { margin: 0 0 12px; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
h3 { margin: 0 0 10px; font-size: 1rem; }
.step {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: .85rem;
}

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.nuclide-row { align-items: flex-end; gap: 32px; }
.nuclide-row .field { flex: 0 1 280px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols.three { grid-template-columns: repeat(3, 1fr); }
.cols.tight { gap: 10px; }
@media (max-width: 680px) {
  .cols, .cols.three { grid-template-columns: 1fr; }
  .cols.tight { grid-template-columns: 1fr 1fr; }
}
.course { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.course .field { margin-bottom: 0; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; position: relative; min-width: 0; }
.field > span { font-size: .85rem; color: var(--muted); }
input, select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text); width: 100%; min-width: 0;
  font-variant-numeric: tabular-nums;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field.solved input, .course.solved input { background: var(--solved); font-weight: 600; }
.field.driver input { border-color: var(--accent); background: var(--accent-soft); }
.field.driver > span::after {
  content: "input"; margin-left: 6px; padding: 0 6px; border-radius: 4px; font-size: .72rem;
  background: var(--accent); color: #fff;
}

.res-summary { display: flex; gap: 32px; flex-wrap: wrap; margin-top: 16px; }
.big { display: flex; flex-direction: column; }
.big .label { font-size: .85rem; color: var(--muted); }
.big .value { font-size: 1.7rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.big .eq { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.half-life { margin-bottom: 10px; }
.half-life .value { font-size: 1.4rem; }

.status { margin: 0 0 16px; padding: 8px 12px; border-radius: 8px; background: var(--solved); color: var(--muted); }
.status.ok { color: #067647; background: #e7f6ec; }
.status.bad { color: var(--error); background: var(--error-soft); }
@media (prefers-color-scheme: dark) {
  .status.ok { color: #75e0a7; background: #16301f; }
}
.hint { color: var(--muted); font-size: .88rem; margin: 0 0 12px; }
.hint.note { margin: 10px 0 0; }
.error { color: var(--error); background: var(--error-soft); padding: 8px 12px; border-radius: 8px; margin: 4px 0 0; }

.foot { color: var(--muted); font-size: .8rem; text-align: center; }

@media print {
  body { background: #fff; color: #000; }
  .actions, .hint, .status { display: none !important; }
  .card { break-inside: avoid; border-color: #999; }
  .big .value { color: #000; }
}
