:root {
  --bg: #f3efe6;
  --surface: #fffcf7;
  --ink: #1a2332;
  --muted: #5c6570;
  --line: #e3d9cb;
  --green: #0d7a4b;
  --green-soft: #e5f6ec;
  --terra: #c2512c;
  --terra-soft: #fde8df;
  --navy: #243044;
  --shadow: 0 10px 30px rgba(36, 48, 68, 0.06);
  --radius: 16px;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --mono: "SF Mono", "ui-monospace", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 400px at 10% -10%, #efe4d2 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.5;
}

a { color: inherit; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(243, 239, 230, 0.9);
  backdrop-filter: blur(10px);
}

.brand {
  font-family: var(--serif);
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-nav { display: flex; gap: 0.4rem; }

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.95rem;
}

.site-nav a[aria-current="page"],
.site-nav a:hover {
  background: var(--surface);
  color: var(--ink);
}

.page {
  width: min(1040px, calc(100% - 2rem));
  margin: 0 auto 4rem;
}

.hero { padding: 1.5rem 0 0.5rem; }
.hero-compact { padding-top: 1.25rem; }

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

h1 { font-size: clamp(2.1rem, 4vw, 3.4rem); margin: 0 0 0.6rem; }
h2 { font-size: 1.6rem; margin: 0; }
h3 { font-size: 1.35rem; margin: 0.2rem 0 0.45rem; }

.lede {
  max-width: 42rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin: 1.6rem 0 2rem;
}

.stat, .course-card, .panel, .day-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat { padding: 1rem 1.1rem; }

.stat-label, .course-kicker, .meta, .stat-hint, .fine-print, .legend { color: var(--muted); }

.stat-label {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  margin: 0.2rem 0 0;
  font-family: var(--serif);
  font-size: 2.4rem;
  line-height: 1;
}

.stat-value-sm { font-size: 1.35rem; padding-top: 0.45rem; }
.stat-hint { margin: 0.35rem 0 0; font-size: 0.88rem; }

.course-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 0.9rem;
  margin-top: 0.9rem;
}

.drill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.9rem;
  margin-top: 0.9rem;
}

.course-card {
  display: block;
  padding: 1.25rem 1.3rem 1.15rem;
  text-decoration: none;
}

.course-card p { margin: 0; color: var(--muted); }

.course-kicker {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-cta {
  display: inline-block;
  margin-top: 1rem;
  color: var(--green);
  font-weight: 700;
}

.course-card.is-locked {
  background: transparent;
  box-shadow: none;
  opacity: 0.85;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--terra-soft);
  color: var(--terra);
  letter-spacing: 0.03em;
}

.continue-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 1.4rem 0 2rem;
  padding: 1rem 1.1rem;
  background: var(--navy);
  color: #f7f3ea;
  border-radius: 18px;
}

.continue-bar p { margin: 0.2rem 0 0; color: #d5dbe3; }
.continue-bar h2 { color: white; font-size: 1.45rem; }

.button, .text-button { font: inherit; cursor: pointer; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.15rem;
  background: var(--green);
  color: white;
  text-decoration: none;
  font-weight: 700;
}

.button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.button.light { background: #f4efe4; color: var(--navy); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-right: 0.3rem;
}

.dot-arith { background: var(--navy); }
.dot-words { background: var(--terra); }
.dot-stroop { background: #2f6f9f; }
.dot-count { background: #6b4c9a; }

.week { margin-bottom: 1.1rem; }

.week h3 {
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.45rem;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
}

button.day-card {
  appearance: none;
  border: 1px solid var(--line);
}

.day-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  min-height: 6.4rem;
  padding: 0.7rem 0.65rem;
  text-align: left;
  text-decoration: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-top: 4px solid var(--navy);
}

.day-card.type-word-memory,
.day-card.type-saturday { border-top-color: var(--terra); }
.day-card.type-stroop-test { border-top-color: #2f6f9f; }

.day-num {
  font-family: var(--serif);
  font-size: 1.45rem;
  line-height: 1;
}

.day-dow, .day-type, .badge { font-size: 0.75rem; }
.day-dow { color: var(--muted); }
.day-type { margin-top: auto; }

.badge {
  align-self: flex-start;
  margin-top: 0.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #eef1f4;
  color: var(--muted);
  font-weight: 700;
}

.day-card.is-done { background: var(--green-soft); border-color: #b7e0c8; }
.day-card.is-done .badge { background: var(--green); color: white; }
.day-card.is-current { outline: 2px solid var(--terra); outline-offset: 1px; }
.day-card.is-current .badge { background: var(--terra); color: white; }
.day-card.is-locked {
  box-shadow: none;
  background: transparent;
  opacity: 0.45;
  cursor: not-allowed;
}

#saturday-modal {
  width: min(26rem, calc(100% - 2rem));
  padding: 1.35rem 1.35rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

#saturday-modal::backdrop {
  background: rgba(26, 35, 50, 0.45);
}

#saturday-modal .lede { margin-bottom: 0.2rem; }

.modal-actions {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0 0.8rem;
}

.exercise-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-top: 1.2rem;
}

.timer-block {
  min-width: 11rem;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  background: var(--navy);
  color: white;
  text-align: right;
}

.timer-label {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c9d2dc;
}

.timer-value {
  margin: 0.1rem 0 0;
  font-family: var(--mono);
  font-size: 1.7rem;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.panel { padding: 1.2rem 1.25rem; margin-top: 1rem; }

.benchmark {
  margin: 0.2rem 0 0.4rem;
  font-family: var(--serif);
  font-size: 2rem;
}

.fine-print { margin-top: 1.5rem; font-size: 0.9rem; }

.text-button {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 0;
  text-decoration: underline;
}

.loading, .error { padding: 2rem 0; color: var(--muted); }
.error { color: var(--terra); }

.extra-drills { margin-top: 2rem; }

@media (max-width: 800px) {
  .stats, .course-grid { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .continue-bar { flex-direction: column; align-items: flex-start; }
  .exercise-top { flex-direction: column; }
  .timer-block { width: 100%; text-align: left; }
}

@media (max-width: 520px) {
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-header { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
