:root {
  --ink: #17211d;
  --muted: #5e6b63;
  --paper: #f5f3eb;
  --surface: #fffdf7;
  --line: #d9ded4;
  --forest: #0d5c4b;
  --forest-dark: #074437;
  --lime: #d8f26d;
  --orange: #f39b5a;
  --code: #14241f;
  --shadow: 0 18px 50px rgba(18, 40, 29, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 4%, rgba(216, 242, 109, 0.4), transparent 24rem),
    linear-gradient(135deg, #f5f3eb 0%, #f0f5ec 100%);
  font-family: Georgia, "Times New Roman", serif;
}

button, input, textarea { font: inherit; }

a { color: inherit; }

.site-header {
  min-height: 4.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem max(1.4rem, calc((100% - 76rem) / 2));
  border-bottom: 1px solid rgba(13, 92, 75, 0.14);
  background: rgba(255, 253, 247, 0.83);
  backdrop-filter: blur(12px);
}

.brand, .site-nav { display: flex; align-items: center; gap: 0.85rem; }
.brand { text-decoration: none; font-weight: 700; letter-spacing: -0.03em; }
.brand-mark {
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  border-radius: 0.55rem;
  color: var(--forest-dark);
  background: var(--lime);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800;
}
.site-nav { font-size: 0.92rem; font-family: ui-sans-serif, system-ui, sans-serif; }
.site-nav a, .link-button { text-decoration: none; color: var(--muted); }
.site-nav a:hover, .link-button:hover { color: var(--forest); }
.site-nav form { margin: 0; }
.link-button { border: 0; background: none; cursor: pointer; padding: 0; }
.user-name { padding-left: 0.85rem; border-left: 1px solid var(--line); color: var(--ink); }

main { max-width: 76rem; margin: 0 auto; padding: 2rem 1.4rem 4rem; }

.hero { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(20rem, 0.88fr); gap: 3rem; align-items: center; min-height: 34rem; }
.hero-copy { max-width: 42rem; }
.eyebrow { margin: 0 0 0.65rem; color: var(--forest); font: 700 0.72rem/1.2 ui-sans-serif, system-ui, sans-serif; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 11ch; margin-bottom: 1.2rem; font-size: clamp(3rem, 7vw, 5.8rem); line-height: 0.94; letter-spacing: -0.065em; }
h2 { letter-spacing: -0.035em; }
.hero-lede { max-width: 40rem; margin-bottom: 1.8rem; color: var(--muted); font-size: 1.2rem; line-height: 1.6; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  text-decoration: none;
  cursor: pointer;
  font: 700 0.88rem/1.1 ui-sans-serif, system-ui, sans-serif;
}
.button-primary { color: #fff; background: var(--forest); }
.button-primary:hover { background: var(--forest-dark); }
.button-secondary { color: var(--forest-dark); border-color: var(--forest); background: transparent; }
.button-secondary:hover { background: rgba(13, 92, 75, 0.08); }

.hero-card, .course-card, .teacher-card, .auth-card, .empty-state {
  border: 1px solid rgba(23, 33, 29, 0.12);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.hero-card { padding: 1.45rem; border-radius: 0.8rem; background: var(--code); color: #e5f3e8; transform: rotate(1.5deg); }
.hero-card pre { overflow: auto; margin: 1rem 0 1.6rem; color: var(--lime); font: 0.95rem/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; }
.code-label, .output-label { margin: 0; color: #95a89c; font: 0.68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.08em; text-transform: uppercase; }
.terminal-output { margin: 0.5rem 0 1.8rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.hero-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin: 0; padding-top: 1rem; border-top: 1px solid #365047; }
.hero-facts div { display: grid; gap: 0.25rem; }
.hero-facts dt { color: var(--lime); font: 700 0.65rem/1 ui-sans-serif, system-ui, sans-serif; text-transform: uppercase; }
.hero-facts dd { margin: 0; color: #c3d1c7; font: 0.74rem/1.35 ui-sans-serif, system-ui, sans-serif; }

.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }
.principles article { padding-right: 1rem; }
.step-number { margin-bottom: 1.1rem; color: var(--orange); font: 700 0.75rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.principles h2 { margin-bottom: 0.6rem; font-size: 1.3rem; }
.principles p:not(.step-number) { color: var(--muted); line-height: 1.6; }

.page-heading { display: flex; justify-content: space-between; gap: 2rem; align-items: end; margin: 1.75rem 0 2rem; }
.page-heading h1 { max-width: none; margin-bottom: 0.65rem; font-size: clamp(2.6rem, 5vw, 4.4rem); }
.page-heading p:not(.eyebrow) { max-width: 38rem; color: var(--muted); line-height: 1.55; }
.metric { display: grid; min-width: 8rem; gap: 0.25rem; padding: 1rem 0 1rem 1.25rem; border-left: 3px solid var(--orange); }
.metric strong { font: 700 2.2rem/1 Georgia, serif; }
.metric span { color: var(--muted); font: 0.75rem/1.25 ui-sans-serif, system-ui, sans-serif; }
.metric-large { margin-top: 1.5rem; }

.course-grid, .teacher-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.2rem; }
.course-card, .teacher-card { display: flex; flex-direction: column; min-height: 19rem; padding: 1.4rem; border-radius: 0.65rem; }
.course-card-top { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.course-card h2, .teacher-card h2 { margin-bottom: 0.75rem; font-size: 1.65rem; }
.course-card > p, .teacher-card > p { color: var(--muted); line-height: 1.5; }
.progress-label { color: var(--forest); font: 700 0.82rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.progress-track { height: 0.5rem; overflow: hidden; margin-top: auto; border-radius: 2rem; background: #e7eadf; }
.progress-track span { display: block; height: 100%; background: var(--forest); }
.course-count, .due-date, .empty-note { margin: 0.7rem 0 1rem; font: 0.78rem/1.4 ui-sans-serif, system-ui, sans-serif; }
.course-card .button { align-self: start; }
.empty-state { grid-column: 1 / -1; padding: 2rem; border-radius: 0.65rem; }
.empty-state p { color: var(--muted); }

.learning-shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr) minmax(23rem, 0.92fr); min-height: calc(100vh - 9.5rem); margin: 0 -1.4rem; border: 1px solid var(--line); background: var(--surface); }
.lesson-nav { padding: 1.35rem; border-right: 1px solid var(--line); background: #edf1e8; }
.lesson-nav h2 { margin-bottom: 1.1rem; font-size: 1.1rem; }
.lesson-nav ol { display: grid; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.lesson-nav a { display: flex; gap: 0.55rem; padding: 0.6rem; border-radius: 0.35rem; color: var(--muted); text-decoration: none; font: 0.82rem/1.35 ui-sans-serif, system-ui, sans-serif; }
.lesson-nav a:hover, .lesson-nav a.active { color: var(--forest-dark); background: var(--lime); }
.lesson-nav a span { color: var(--forest); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.lesson-content { padding: 2.2rem clamp(1.35rem, 4vw, 4rem); }
.lesson-content h1 { max-width: none; font-size: clamp(2.4rem, 4vw, 3.75rem); }
.lesson-body { color: #34423a; font-size: 1.08rem; line-height: 1.75; }
.lesson-body p { margin-bottom: 1rem; }
.exercise-brief { margin-top: 2.5rem; padding: 1.25rem; border: 1px solid #c9d8ae; border-radius: 0.5rem; background: #f3f8df; }
.exercise-brief h2 { margin-bottom: 0.5rem; }
.formative-note { margin: 1rem 0 0; color: #53604b; font: 0.78rem/1.5 ui-sans-serif, system-ui, sans-serif; }

.code-panel { display: flex; flex-direction: column; min-height: 0; padding: 1rem; background: var(--code); color: #e5f3e8; }
.code-panel-head, .console-head, .code-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.code-panel-head { margin-bottom: 0.8rem; }
.code-panel h2 { margin: 0; font-size: 1.05rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.save-status, .console-head { color: #9db0a3; font: 0.7rem/1 ui-sans-serif, system-ui, sans-serif; }
.code-editor { width: 100%; min-height: 21rem; resize: vertical; padding: 1rem; border: 1px solid #365047; border-radius: 0.35rem; outline: none; color: #e6f5e8; background: #0b1713; font: 0.9rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; }
.code-editor:focus { border-color: var(--lime); box-shadow: 0 0 0 2px rgba(216, 242, 109, 0.2); }
.code-actions { justify-content: start; margin: 0.9rem 0; }
.console { min-height: 10rem; padding: 0.85rem; border: 1px solid #365047; border-radius: 0.35rem; background: #0b1713; }
.console-head { padding-bottom: 0.65rem; border-bottom: 1px solid #273f35; }
.console pre { overflow: auto; min-height: 5rem; margin: 0.85rem 0 0; color: #d8f26d; white-space: pre-wrap; font: 0.78rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }

.auth-card { max-width: 34rem; margin: 7rem auto; padding: 2rem; border-radius: 0.65rem; }
.auth-card h1 { max-width: none; font-size: 3rem; }
.auth-card p { color: var(--muted); line-height: 1.6; }
.demo-form { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.5rem; }
.flash-stack { margin: 1rem 0; }
.flash { padding: 0.85rem 1rem; border-radius: 0.35rem; color: var(--forest-dark); background: #e5f5d8; font-family: ui-sans-serif, system-ui, sans-serif; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 960px) {
  .learning-shell { grid-template-columns: 13rem minmax(0, 1fr); }
  .code-panel { grid-column: 1 / -1; min-height: 31rem; }
}

@media (max-width: 700px) {
  .site-header { align-items: flex-start; padding: 0.8rem 1rem; }
  .site-nav { flex-wrap: wrap; justify-content: end; }
  .user-name { display: none; }
  main { padding: 1.25rem 1rem 3rem; }
  .hero, .principles, .learning-shell { display: block; }
  .hero { min-height: auto; padding: 2.5rem 0; }
  .hero h1 { font-size: clamp(3rem, 17vw, 4.7rem); }
  .hero-card { margin-top: 2rem; transform: none; }
  .principles article { margin-bottom: 1.5rem; }
  .page-heading { display: block; }
  .metric { margin-top: 1.2rem; }
  .learning-shell { margin: 0 -1rem; }
  .lesson-nav { border-right: 0; border-bottom: 1px solid var(--line); }
  .lesson-nav ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-content { padding: 1.6rem 1rem; }
  .code-panel { min-height: 31rem; }
  .hero-facts { grid-template-columns: 1fr; }
}
