:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c2430;
  --muted: #5b6672;
  --line: #d9dee5;
  --accent: #1f6feb;
  --ok: #1a7f37;
  --ok-bg: #e8f5ec;
  --bad: #c0392b;
  --bad-bg: #fdecea;
  --shadow: 0 1px 3px rgba(20, 30, 45, 0.08), 0 6px 18px rgba(20, 30, 45, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 24px 16px 64px;
}

h1 { font-size: 1.5rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 24px 0 10px; }
.muted { color: var(--muted); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Landing card ---------- */
.card {
  max-width: 480px;
  margin: 6vh auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.start-form { display: grid; gap: 16px; margin-top: 20px; }
.start-form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.9rem; }
.start-form input {
  font-size: 1rem;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.start-form input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

button {
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 18px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }
button:disabled { opacity: 0.6; cursor: default; }

/* ---------- Sheet ---------- */
.sheet-wrap { max-width: 760px; margin: 0 auto; }
.sheet-header { margin-bottom: 8px; }
.instructions {
  background: #eef4ff;
  border: 1px solid #d6e4ff;
  color: #2b4a7e;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 0.9rem;
}

.paper-link { margin: 10px 0 0; }
.paper-link a {
  display: inline-block;
  font-weight: 600;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: #eef4ff;
}
.paper-link a:hover { background: #e2edff; text-decoration: none; }
.solutions-link { margin-top: 18px; }

.part-title {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 4px;
  letter-spacing: 0.02em;
}

.rows {
  column-count: 2;
  column-gap: 28px;
  margin-top: 8px;
}
@media (max-width: 560px) { .rows { column-count: 1; } }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 8px;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}
.row:hover { background: #f7f9fc; }

.num {
  width: 2.4em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--muted);
}

.bubbles { display: flex; gap: 6px; }
/* hide the native radio; the label is the bubble */
.bubbles input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.bubble {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  user-select: none;
  padding: 3px;
}
.bubble-dot {
  width: 22px;
  height: 22px;
  border: 2px solid #9aa6b3;
  border-radius: 50%;
  display: inline-block;
  transition: background 0.08s, border-color 0.08s;
}
.bubble-letter { font-size: 0.8rem; color: var(--muted); width: 0.9em; }

.bubbles input[type="radio"]:checked + .bubble .bubble-dot {
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: inset 0 0 0 3px #fff;
}
.bubbles input[type="radio"]:focus-visible + .bubble .bubble-dot {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Action bar ---------- */
.actionbar {
  position: sticky;
  bottom: 0;
  margin-top: 24px;
  padding: 14px 0;
  background: linear-gradient(to top, var(--bg) 70%, rgba(244, 245, 247, 0));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.counter { color: var(--muted); font-variant-numeric: tabular-nums; }
.actionbar .link { font-weight: 600; }

/* ---------- Results ---------- */
.score-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 16px 0 8px;
}
.score-card {
  flex: 1 1 160px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
}
.sc-label { color: var(--muted); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.sc-value { font-size: 1.8rem; font-weight: 700; margin-top: 4px; }
.sc-extra { color: var(--accent); font-weight: 600; min-height: 1.2em; }

.review { margin-top: 8px; }
.review-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-bottom: 6px;
}
.review-item.ok { background: var(--ok-bg); border-color: #cfe8d6; }
.review-item.bad { background: var(--bad-bg); border-color: #f6d3ce; }
.ri-num { width: 2.4em; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.ri-mark { font-weight: 700; width: 1.2em; }
.review-item.ok .ri-mark { color: var(--ok); }
.review-item.bad .ri-mark { color: var(--bad); }
.ri-correct { font-weight: 600; color: var(--ok); }
.ri-exp { flex-basis: 100%; color: var(--muted); font-size: 0.9rem; padding-left: 3.6em; }

@media print {
  body { background: #fff; padding: 0; }
  .actionbar { display: none; }
  .score-card, .review-item { box-shadow: none; }
}
