:root {
  --bg: #fafafa;
  --bg-alt: #f2f1ee;
  --card: #ffffff;
  --border: #e7e5e0;
  --text: #1c1b1a;
  --text-dim: #6b6863;
  --accent: #0f8a6c;
  --accent-hover: #0b6f58;
  --accent-soft: #dff3ee;
  --green: #1f9d55;
  --green-soft: #e4f6ea;
  --locked: #b5b1a9;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(28,27,26,0.05);
  --shadow-md: 0 6px 20px rgba(28,27,26,0.08);
  --mono: "SF Mono", "Fira Code", Consolas, monospace;
}

* { box-sizing: border-box; }

/* Visually hidden until focused — lets keyboard/screen-reader users jump
   past the nav straight to page content. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 1000;
  font-size: 0.9rem;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(250,250,250,0.85);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.logo {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}
.logo span { color: var(--accent); }

.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a { color: var(--text-dim); font-size: 0.92rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); }

.track-switcher {
  display: flex;
  gap: 2px;
  background: var(--bg-alt);
  padding: 4px;
  border-radius: 999px;
  margin-right: 6px;
}
.track-switcher a {
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
}
.track-switcher a.active { background: var(--card); color: var(--accent); box-shadow: var(--shadow-sm); }
.track-switcher a:not(.active):hover { color: var(--text); }

.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--text-dim); background: var(--card); }

.container { max-width: 1000px; margin: 0 auto; padding: 0 24px; }

.hero {
  text-align: center;
  padding: 100px 24px 50px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 400px;
  background: radial-gradient(ellipse at center, var(--accent-soft) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: 3rem;
  margin: 0 0 18px;
  letter-spacing: -0.03em;
  font-weight: 800;
  line-height: 1.1;
}
.hero h1 span { color: var(--accent); }
.hero p {
  color: var(--text-dim);
  font-size: 1.15rem;
  max-width: 600px;
  margin: 0 auto 34px;
}
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.trust-bar {
  display: flex;
  justify-content: center;
  gap: 36px;
  flex-wrap: wrap;
  padding: 20px 24px 70px;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
}
.trust-bar span { opacity: 0.75; }

.section { padding: 64px 24px; }
.section h2 { font-size: 1.7rem; margin-bottom: 8px; font-weight: 800; letter-spacing: -0.02em; }
.section-sub { color: var(--text-dim); margin-bottom: 36px; font-size: 1.02rem; }
.section-center { text-align: center; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature-card .icon {
  font-size: 1.4rem;
  margin-bottom: 14px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  border-radius: 12px;
}
.feature-card h3 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 700; }
.feature-card p { color: var(--text-dim); font-size: 0.92rem; margin: 0; }

.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.testimonial-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.testimonial-quote { font-size: 0.94rem; color: var(--text); margin-bottom: 16px; }
.testimonial-person { display: flex; align-items: center; gap: 10px; }
.testimonial-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.testimonial-name { font-size: 0.85rem; font-weight: 700; }
.testimonial-role { font-size: 0.78rem; color: var(--text-dim); }

.bundle-banner {
  background: linear-gradient(135deg, rgba(217,100,46,0.06), rgba(55,99,224,0.06));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 24px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.bundle-banner-title { font-weight: 800; font-size: 1.05rem; margin-bottom: 2px; }
.bundle-banner-sub { font-size: 0.88rem; color: var(--text-dim); }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 660px;
  margin: 0 auto;
}
.price-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.price-card.featured { border: 2px solid var(--accent); box-shadow: var(--shadow-md); position: relative; }
.price-card.featured::before {
  content: "Most popular";
  position: absolute;
  top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff;
  font-size: 0.72rem; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
}
.price-card .price { font-size: 2.4rem; font-weight: 800; margin: 8px 0 4px; letter-spacing: -0.02em; }
.price-card .price small { font-size: 0.9rem; color: var(--text-dim); font-weight: 400; }
.price-card ul { list-style: none; padding: 0; margin: 20px 0 26px; text-align: left; color: var(--text-dim); font-size: 0.9rem; }
.price-card li { padding: 7px 0; }
.price-card li::before { content: "✓ "; color: var(--green); font-weight: 700; }

.progress-bar-outer {
  background: var(--border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin: 8px 0 28px;
}
.progress-bar-inner {
  background: var(--accent);
  height: 100%;
  transition: width 0.3s ease;
}

.exercise-list { display: flex; flex-direction: column; gap: 12px; }
.exercise-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.exercise-row:not(.locked):hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.exercise-row.locked { opacity: 0.65; }
.exercise-row .ex-left { display: flex; align-items: center; gap: 14px; }
.exercise-row .ex-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; flex-shrink: 0;
}
.exercise-row.done .ex-num { background: var(--green); color: #fff; }
.exercise-row .ex-title { font-weight: 700; font-size: 0.98rem; }
.exercise-row .ex-tag { font-size: 0.78rem; color: var(--text-dim); }
.exercise-row .lock-icon { color: var(--locked); font-size: 1.1rem; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge.free { background: var(--green-soft); color: var(--green); }

.exercise-page { padding: 44px 24px 90px; }
.exercise-header { margin-bottom: 24px; }
.exercise-header h1 { font-size: 1.7rem; margin: 8px 0; font-weight: 800; letter-spacing: -0.02em; }
.back-link { color: var(--text-dim); font-size: 0.88rem; font-weight: 500; }
.back-link:hover { color: var(--text); }

.prompt-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.prompt-card h3 { margin-top: 0; font-size: 1rem; font-weight: 700; }
.prompt-card .instructions { color: var(--text-dim); font-size: 0.96rem; }

.code-snippet {
  background: #1c1b1a;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: #e7e5e0;
  overflow-x: auto;
  white-space: pre;
  margin: 14px 0;
}

textarea.answer-box {
  width: 100%;
  min-height: 120px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 14px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}
textarea.answer-box:focus { outline: none; border-color: var(--accent); background: var(--card); }

.feedback-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  display: none;
}
.feedback-box.show { display: block; }
.feedback-box.good { background: var(--green-soft); border: 1px solid #b8e6c6; color: #146c37; }
.feedback-box.hint { background: var(--accent-soft); border: 1px solid #f0cbab; color: #8a4218; }

.sheet-wrap {
  margin: 14px 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card);
}

.formula-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.82rem;
}
.fx-cell-ref {
  min-width: 34px;
  padding: 2px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}
.fx-icon { color: var(--text-dim); font-style: italic; }
.fx-value { color: var(--text); white-space: pre; overflow-x: auto; }

.sheet-scroll { overflow-x: auto; }

table.sheet-grid {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--mono);
  font-size: 0.85rem;
}
table.sheet-grid th, table.sheet-grid td {
  border: 1px solid var(--border);
  padding: 0;
  height: 30px;
}
table.sheet-grid th.corner { background: var(--bg-alt); width: 34px; }
table.sheet-grid th.col-h, table.sheet-grid th.row-h {
  background: var(--bg-alt);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.78rem;
  min-width: 76px;
  padding: 4px 8px;
}
table.sheet-grid th.row-h { width: 34px; min-width: 34px; text-align: center; }
table.sheet-grid th.col-h.active, table.sheet-grid th.row-h.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

table.sheet-grid td.cell {
  padding: 4px 10px;
  color: var(--text);
  white-space: nowrap;
}
table.sheet-grid td.cell-num { text-align: right; }
table.sheet-grid td.cell-empty { color: var(--locked); }

table.sheet-grid td.cell-target {
  padding: 0;
  background: var(--accent-soft);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  position: relative;
  z-index: 1;
}
.cell-input {
  width: 100%;
  height: 30px;
  min-width: 90px;
  border: none;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
  padding: 4px 10px;
  outline: none;
}

.paywall {
  text-align: center;
  padding: 64px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.paywall h2 { margin-bottom: 8px; font-weight: 800; }
.paywall p { color: var(--text-dim); margin-bottom: 24px; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(28,27,26,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.modal h3 { margin-top: 0; font-weight: 800; }
.modal .close-modal { margin-top: 16px; color: var(--text-dim); font-size: 0.85rem; cursor: pointer; }

footer {
  text-align: center;
  padding: 36px 24px;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

#nav-auth-slot { display: flex; align-items: center; gap: 12px; }
.streak-badge {
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 5px 12px;
  border-radius: 999px;
}
.nav-username { font-size: 0.88rem; color: var(--text-dim); font-weight: 500; }

.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-field { text-align: left; margin-bottom: 14px; }
.auth-field label { display: block; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 5px; font-weight: 500; }
.auth-field input {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 13px;
  font-size: 0.92rem;
  font-family: inherit;
}
.auth-field input:focus { outline: none; border-color: var(--accent); background: var(--card); }
.auth-error { color: #c0392b; font-size: 0.85rem; margin-top: 8px; min-height: 1em; }

.comments-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}
.comments-card h3 { margin-top: 0; font-size: 1rem; font-weight: 700; }
.comments-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.comment { border-bottom: 1px solid var(--border); padding-bottom: 14px; }
.comment:last-child { border-bottom: none; padding-bottom: 0; }
.comment-head { font-size: 0.88rem; margin-bottom: 4px; }
.comment-date { color: var(--text-dim); font-size: 0.78rem; margin-left: 6px; }
.comment-text { font-size: 0.92rem; color: var(--text); }

@media (max-width: 700px) {
  .feature-grid, .pricing-grid, .testimonial-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.1rem; }
  nav { padding: 12px 16px; flex-wrap: wrap; row-gap: 8px; }
  /* The full nav (track switcher + Exercises + Guides + Pricing + streak +
     username + Account + Log out + Go Pro) is too much for a phone width
     even shrunk down. flex-wrap is a safety net so it can never force the
     page to scroll horizontally; hiding the lower-priority links is what
     actually keeps it to a tidy row or two instead of visibly wrapping. */
  .nav-links { gap: 8px; flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; }
  .nav-links > a[href*="guides" i],
  .nav-links > a[href*="pricing" i] {
    display: none;
  }
  .nav-username { display: none; }
  .track-switcher a { padding: 5px 9px; font-size: 0.76rem; }
  .nav-links .btn { padding: 8px 14px; font-size: 0.85rem; }
}

.practice-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 260px;
  gap: 20px;
  align-items: start;
}

.module-pane {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.module-pane .module-eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.module-pane .module-name {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 800;
}
.module-ex-list { list-style: none; margin: 0; padding: 0; }
.module-ex-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.86rem;
  color: var(--text-dim);
  margin-bottom: 2px;
}
a.module-ex-item { cursor: pointer; }
.module-ex-item:hover { background: var(--bg-alt); color: var(--text); }
.module-ex-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.module-ex-item .ex-check { width: 16px; flex-shrink: 0; text-align: center; font-size: 0.8rem; color: var(--locked); }
.module-ex-item.done .ex-check { color: var(--green); }
.module-ex-item.locked { opacity: 0.55; }

.leaderboard-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 84px;
}
.leaderboard-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.leaderboard-card h4 {
  margin: 0 0 12px;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--accent);
}
.leaderboard-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  padding: 4px 0;
  color: var(--text);
}
.leaderboard-row .lb-name { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-empty { color: var(--locked); font-size: 0.85rem; padding: 4px 0; }
.leaderboard-mine {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  font-weight: 700;
}
.leaderboard-note { margin-top: 8px; font-size: 0.78rem; color: var(--text-dim); }
.leaderboard-note a { color: var(--accent); font-weight: 600; }

.check-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 20;
  transition: background 0.2s, border-color 0.2s;
}
.check-bar.correct { background: var(--green); border-top-color: var(--green); }
.check-bar.correct .check-bar-msg { color: #fff; }
.check-bar-msg { font-size: 0.95rem; font-weight: 700; color: var(--text); min-width: 140px; text-align: right; }
.check-bar-actions { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.check-bar-hint { font-size: 0.74rem; color: var(--text-dim); }
.check-bar.correct .check-bar-hint { color: rgba(255,255,255,0.85); }
.check-bar-skip.hidden { visibility: hidden; }

/* Collapsible module groups — used in both the exercise-page module-pane
   (compact) and the exercises-list page (roomier, via .exercise-list-page). */
.module-list-category {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 16px 0 6px;
}
.module-pane .module-list-category:first-child { margin-top: 0; }
.module-group { border-radius: var(--radius-sm); }
.module-group + .module-group { margin-top: 2px; }
.module-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  list-style: none;
}
.module-summary::-webkit-details-marker { display: none; }
.module-summary:hover { background: var(--bg-alt); }
.module-summary-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.module-summary-count {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  color: var(--text-dim);
  flex-shrink: 0;
}
.module-group[open] > .module-summary { color: var(--accent); }
.module-ex-list { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 6px 14px; }
.module-ex-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.8rem;
}
.module-ex-row:hover { background: var(--bg-alt); color: var(--text); }
.module-ex-row.current { background: var(--accent-soft); color: var(--text); font-weight: 700; }
.module-ex-row.done { color: var(--text); }
.module-ex-row.locked { color: var(--locked); }
.module-ex-icon { width: 14px; flex-shrink: 0; font-size: 0.72rem; text-align: center; color: var(--green); }
.module-ex-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Roomier variant for the exercises-list page */
.exercise-list-page .module-list-category { margin: 22px 0 8px; }
.exercise-list-page .module-list-category:first-child { margin-top: 0; }
.exercise-list-page .module-group {
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.exercise-list-page .module-summary { padding: 14px 16px; font-size: 0.95rem; }
.exercise-list-page .module-summary-count { font-size: 0.8rem; }
.exercise-list-page .module-ex-list { padding: 4px 8px 10px; }
.exercise-list-page .module-ex-row { font-size: 0.88rem; padding: 9px 10px; }

/* Real spreadsheet grid (formula exercises) */
.excel-grid-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
table.excel-grid {
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.88rem;
  background: var(--card);
}
table.excel-grid th,
table.excel-grid td {
  border: 1px solid var(--border);
  padding: 0;
  min-width: 74px;
  height: 34px;
  text-align: center;
}
table.excel-grid thead th {
  background: var(--bg-alt);
  color: var(--text-dim);
  font-weight: 700;
  font-family: inherit;
  font-size: 0.8rem;
}
table.excel-grid thead th.corner { background: var(--bg-alt); }
table.excel-grid tbody th {
  background: var(--bg-alt);
  color: var(--text-dim);
  font-weight: 700;
  font-family: inherit;
  font-size: 0.8rem;
  min-width: 34px;
}
.grid-cell {
  color: var(--text);
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grid-cell.empty { background: var(--card); }
.grid-cell.target {
  background: var(--accent-soft);
  padding: 0;
}
.grid-cell-input {
  width: 100%;
  height: 34px;
  border: 2px solid var(--accent);
  border-radius: 0;
  background: var(--card);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.88rem;
  text-align: center;
  padding: 0 6px;
  box-sizing: border-box;
}
.grid-cell-input:focus { outline: none; border-color: var(--accent-hover); }
.grid-result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  margin-top: 4px;
}
.grid-result-label { color: var(--text-dim); font-weight: 600; }
.grid-result-value { font-family: var(--mono); font-weight: 700; }
.grid-result-value.err { color: var(--accent-hover); font-weight: 500; font-family: inherit; }

/* Mobile layout — kept at the true end of the file on purpose. A @media
   block earlier in the cascade loses ties to a later non-media rule of
   equal specificity, which silently no-ops the override even though the
   media condition matches (this bit us twice while building this file —
   don't move this block back up). */
@media (max-width: 980px) {
  .practice-layout { grid-template-columns: 1fr; }
  .leaderboard-pane { position: static; max-height: none; }
  /* Unsticking the module list at full height would dump all 45 modules
     above the actual exercise, burying it under ~2500px of scroll before
     it's even visible. Keep it a short scrollable strip instead. */
  .module-pane { position: static; max-height: 220px; }
  .exercise-page { padding-bottom: 130px; }
  .check-bar {
    padding: 10px 14px;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .check-bar-msg { min-width: 0; font-size: 0.85rem; }
  .check-bar-skip { padding: 9px 14px; font-size: 0.85rem; }
  .check-bar .btn-primary { padding: 9px 16px; font-size: 0.88rem; }
  /* 16px prevents iOS Safari from auto-zooming the page when a field
     with a smaller font-size is focused. */
  textarea.answer-box,
  textarea.chat-input,
  textarea.code-answer,
  .grid-cell-input,
  .auth-field input {
    font-size: 16px;
  }
}
