:root {
  --bg: #fafafa;
  --card: #fff;
  --ink: #1a1a2e;
  --mut: #6b7280;
  --line: #e5e7eb;
  --brand: #4f46e5;
  --brand-soft: #eef2ff;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --bad: #dc2626;
  --bad-soft: #fef2f2;
  --rung: #6366f1;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; }
header.app-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
header h1 { font-size: 1.35rem; }
.sub { color: var(--mut); font-size: .88rem; }
nav.tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line); padding-bottom: 10px;
}
nav.tabs button {
  padding: 7px 14px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; cursor: pointer; font-size: .85rem; color: var(--ink);
}
nav.tabs button:hover { border-color: var(--brand); color: var(--brand); }
nav.tabs button.active {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px; margin-bottom: 14px;
}
.card h2 { font-size: 1.05rem; margin-bottom: 8px; }
.card h3 { font-size: .95rem; margin: 12px 0 6px; }
.muted { color: var(--mut); font-size: .88rem; }
.badge {
  display: inline-block; font-size: .72rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; margin-right: 6px; vertical-align: middle;
}
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 700px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
.stat {
  background: #f9fafb; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px;
}
.stat .lab {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--mut);
}
.stat .val { font-size: 1.35rem; font-weight: 700; }
button.btn {
  padding: 7px 14px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; cursor: pointer; font-size: .85rem; color: var(--ink);
}
button.btn:hover { border-color: var(--brand); color: var(--brand); }
button.btn.primary {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
button.btn.primary:hover { filter: brightness(1.05); color: #fff; }
button.btn.danger { border-color: var(--bad); color: var(--bad); }
button.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
textarea.answer {
  width: 100%; min-height: 160px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; font-size: .92rem;
  font-family: inherit; resize: vertical; line-height: 1.45;
}
textarea.answer:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=text], input[type=number], input[type=date], select {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-size: .9rem; background: #fff;
}
.timer-bar {
  position: sticky; top: 0; z-index: 20;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 14px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
}
.timer-bar .clock { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer-bar .clock.warn { color: var(--warn); }
.timer-bar .clock.bad { color: var(--bad); }
.step {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; margin-bottom: 10px; background: #fafafa;
}
.step .why {
  margin-top: 8px; padding: 8px 10px; background: var(--brand-soft);
  border-radius: 6px; font-size: .88rem;
}
.step .why label { display: block; font-weight: 600; margin-bottom: 4px; color: var(--brand); }
.hint-box {
  margin-top: 8px; padding: 10px; background: var(--warn-soft);
  border-radius: 6px; font-size: .88rem; border-left: 3px solid var(--warn);
}
.model {
  margin-top: 10px; padding: 12px; background: var(--ok-soft);
  border-radius: 8px; border-left: 3px solid var(--ok); font-size: .9rem;
  white-space: pre-wrap;
}
.rubric-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid #f3f4f6; font-size: .9rem;
}
.rubric-item:last-child { border-bottom: none; }
.rubric-item.auto-pass { color: var(--ok); }
.rubric-item.auto-fail { color: var(--bad); }
.rung-track {
  display: flex; gap: 4px; margin: 8px 0 4px; flex-wrap: wrap;
}
.rung-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; border: 2px solid var(--line);
  background: #fff; color: var(--mut);
}
.rung-dot.done { background: var(--ok); color: #fff; border-color: var(--ok); }
.rung-dot.current { background: var(--brand); color: #fff; border-color: var(--brand); }
.rung-dot.locked { opacity: .4; }
.topic-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 0; border-bottom: 1px solid #f3f4f6;
}
.topic-row:last-child { border-bottom: none; }
.paper-q {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; margin-bottom: 10px;
}
.paper-q.part-label {
  background: #f9fafb; font-weight: 600; font-size: .85rem; color: var(--mut);
}
.confidence {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0;
}
.confidence button {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 600;
}
.confidence button.picked {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.cal-chart {
  display: flex; align-items: flex-end; gap: 4px; height: 120px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.cal-bar {
  flex: 1; min-width: 8px; background: var(--brand-soft);
  border-radius: 4px 4px 0 0; position: relative;
}
.cal-bar .fill {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--brand); border-radius: 4px 4px 0 0;
}
.today-item {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 8px; background: #fff;
}
.today-item .kind {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--mut); font-weight: 600;
}
.hidden { display: none !important; }
.foot { color: var(--mut); font-size: .78rem; margin-top: 18px; }
.verdict {
  padding: 12px 14px; border-radius: 8px; margin-top: 10px; font-weight: 600;
}
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); }
.verdict.bad { background: var(--bad-soft); color: var(--bad); }
.table-wrap { overflow-x: auto; }
table.simple { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.simple th {
  text-align: left; color: var(--mut); font-size: .75rem; text-transform: uppercase;
  letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--line);
}
table.simple td { padding: 6px 8px; border-bottom: 1px solid #f3f4f6; }
.drill-input {
  width: 90px; padding: 5px 7px; border: 1px solid var(--line);
  border-radius: 6px; font-size: .9rem;
}
.stem {
  white-space: pre-wrap; font-size: .92rem; margin: 8px 0 12px;
  padding: 10px 12px; background: #f9fafb; border-radius: 8px; border: 1px solid var(--line);
}
.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: .88rem; z-index: 50;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.settings-row {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-top: 8px; font-size: .88rem;
}
.settings-row label { color: var(--mut); }
.module-pick {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.module-pick button {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; cursor: pointer; font-size: .85rem;
}
.module-pick button.active {
  background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600;
}
.module-pick button.stub { opacity: .55; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.choice-row label {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
  cursor: pointer; font-size: .88rem;
}
.choice-row label.picked { border-color: var(--brand); background: var(--brand-soft); }
.d-risk {
  background: var(--bad-soft); border: 1px solid #fecaca; border-left: 4px solid var(--bad);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 14px;
}
.d-risk h2 { color: var(--bad); font-size: 1rem; margin-bottom: 6px; }
.d-risk ul { margin: 6px 0 0 18px; font-size: .9rem; }
.d-risk li { margin: 4px 0; }
.coverage-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid #f3f4f6; font-size: .88rem;
}
.coverage-row .path { word-break: break-all; }
.part1-fail {
  background: var(--bad-soft); color: var(--bad); font-weight: 700;
  padding: 10px 12px; border-radius: 8px; margin: 10px 0;
}
.lesson-loop {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin: 10px 0 4px; font-size: .78rem;
}
.lesson-loop .step-pill {
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--mut); font-weight: 600;
}
.lesson-loop .step-pill.active {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.lesson-loop .step-pill.done {
  background: var(--ok-soft); color: var(--ok); border-color: #a7f3d0;
}
.lesson-loop .arrow { color: var(--mut); font-size: .7rem; }
.thought-exp {
  border: 1px dashed var(--brand); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 14px; background: var(--brand-soft);
}
.thought-exp .tag {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--brand); font-weight: 700; margin-bottom: 6px;
}
.spine-bar {
  height: 8px; border-radius: 999px; background: #e5e7eb; overflow: hidden;
  margin: 8px 0 4px;
}
.spine-bar .fill {
  height: 100%; background: linear-gradient(90deg, var(--brand), var(--ok));
  border-radius: 999px; transition: width .25s ease;
}
.phase-block {
  border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 10px; overflow: hidden; background: #fff;
}
.phase-block summary {
  cursor: pointer; padding: 12px 14px; font-weight: 600;
  list-style: none; display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; background: #f9fafb;
}
.phase-block summary::-webkit-details-marker { display: none; }
.phase-block .phase-body { padding: 8px 14px 12px; border-top: 1px solid var(--line); }
.lesson-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 0; border-bottom: 1px solid #f3f4f6; font-size: .88rem;
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row .status-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  background: #d1d5db;
}
.lesson-row .status-dot.progress { background: var(--warn); }
.lesson-row .status-dot.done { background: var(--ok); }
.lesson-row .status-dot.paper { background: var(--brand); }
.break-machine .rubric-toggle {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 0; font-size: .88rem; cursor: pointer;
}
.break-machine .score-live {
  font-size: 1.25rem; font-weight: 700; margin: 8px 0;
  font-variant-numeric: tabular-nums;
}
