:root {
  --ink: #1c2a33;
  --muted: #4a5a64;
  --paper: #f6f1e8;
  --card: #fffdf8;
  --line: #e3d9c8;
  --teal: #0f6e6b;
  --teal-dark: #0b5553;
  --gold: #c9842a;
  --rose: #b54a3c;
  --good: #1f7a4d;
  --good-bg: #e8f6ee;
  --bad: #9b2f2f;
  --bad-bg: #fdeeee;
  --shadow: 0 8px 24px rgba(28, 42, 51, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { font-size: 18px; }
body {
  margin: 0;
  font-family: "Segoe UI", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #e8f3f1 0%, transparent 50%),
    var(--paper);
  line-height: 1.45;
  min-height: 100vh;
}

.wrap { width: min(720px, calc(100% - 32px)); margin: 0 auto; padding: 20px 0 64px; }

header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1.25rem;
}
.mark {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  font-weight: 800;
}
.tag { color: var(--muted); font-size: 0.78rem; }

h1 { font-size: 1.7rem; letter-spacing: -0.03em; margin: 8px 0 10px; }
h2 { font-size: 1.25rem; margin: 0 0 8px; letter-spacing: -0.02em; }
p.lead { color: var(--muted); margin: 0 0 22px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.grid { display: grid; gap: 12px; }
.subjects { margin-top: 8px; }

.choice, .subject-card, button, .btn {
  font: inherit;
  cursor: pointer;
}
.subject-card, .quiz-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}
.subject-card:hover, .quiz-card:hover { border-color: #b9d5d3; }
.kicker {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 4px;
}
.meta { color: var(--muted); font-size: 0.88rem; margin: 6px 0 0; }

.name-row { display: flex; gap: 8px; margin: 0 0 22px; flex-wrap: wrap; }
input[type="text"], input[type="number"] {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  width: 100%;
  max-width: 280px;
}
.btn, a.btn { text-decoration: none; display: inline-block; }
.name-row button, .btn, .nav-btn {
  background: var(--teal);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 650;
}
.btn.secondary, .nav-btn.secondary {
  background: transparent;
  color: var(--teal-dark);
  border: 1px solid #b7d0ce;
}
.btn.wide { width: 100%; }

.progress {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}
.bar { height: 8px; background: #e8efe8; border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.bar > span { display: block; height: 100%; background: var(--teal); width: 0; transition: width 0.2s ease; }

.stem { font-size: 1.08rem; margin: 0 0 14px; }
.options { display: grid; gap: 8px; }
.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px;
}
.option.on { border-color: var(--teal); background: #eef7f6; }
.option .letter {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 8px;
  background: #eef2f1;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.option.on .letter { background: var(--teal); color: #fff; }

.actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.hidden { display: none !important; }

.score-hero {
  text-align: center;
  padding: 8px 0 6px;
}
.score-hero .big {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--teal-dark);
}
.review { display: grid; gap: 12px; margin-top: 18px; }
.review-item { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.review-item.ok { background: var(--good-bg); border-color: #c5e6d2; }
.review-item.bad { background: var(--bad-bg); border-color: #f3c8c8; }
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.ok .badge { color: var(--good); }
.bad .badge { color: var(--bad); }
.explain { margin: 8px 0 0; color: var(--ink); }
.correct-line { margin: 6px 0 0; font-weight: 650; }

.feedback {
  margin-top: 22px;
  padding: 18px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px dashed #cfc3ae;
}
.feedback ol { padding-left: 20px; }
footer.site {
  margin-top: 36px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}
a { color: var(--teal-dark); }

@media (max-width: 520px) {
  html { font-size: 17px; }
  h1 { font-size: 1.45rem; }
  .wrap { width: min(720px, calc(100% - 24px)); }
}

.figure { margin: 0 0 14px; }
.fig-cap { margin: 0 0 8px; color: var(--muted); font-size: 0.88rem; }
.clock-svg { display: block; margin: 0 auto 4px; }
.frac-bar {
  display: grid;
  max-width: 280px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  height: 36px;
  background: #fff;
}
.frac-bar span { border-right: 1px solid var(--ink); }
.frac-bar span:last-child { border-right: 0; }
.frac-bar span.on { background: var(--teal); }
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  background: #fff;
}
.data-table caption { caption-side: top; text-align: left; font-weight: 650; margin: 0 0 6px; }
.data-table th, .data-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.data-table th { background: #eef4f3; }
.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  max-width: 320px;
  font-size: 0.78rem;
  text-align: center;
}
.cal .dow { font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal .day { padding: 6px 0; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.cal .day.empty { background: transparent; border-color: transparent; }
.cal .day.hi { background: var(--teal); color: #fff; border-color: var(--teal); font-weight: 700; }
