:root {
  --touch-size: 44px;
  --workspace-tabs-height: 58px;
  --workspace-controls-height: 64px;
  --paper: #f6f5f0;
  --surface: #fff;
  --ink: #192d30;
  --muted: #5f7273;
  --line: #dce3df;
  --green: #245e4c;
  --green-light: #edf5ed;
  --rust: #a94a33;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.65;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: var(--green);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
summary,
select {
  outline-offset: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible,
select:focus-visible {
  outline: 3px solid #b77438;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: clamp(1.8rem, 3.3vw, 3.1rem);
  line-height: 1.15;
  letter-spacing: -0.045em;
  font-weight: 600;
  margin-bottom: 18px;
}
h2 {
  font-size: 1.5rem;
  line-height: 1.3;
  letter-spacing: -0.025em;
  font-weight: 600;
}
h3 {
  font-size: 1rem;
  font-weight: 650;
}
p {
  margin-bottom: 18px;
}
.site-header {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4vw;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 650;
  text-decoration: none;
}
.brand-mark {
  background: var(--rust);
  color: white;
  border-radius: 10px;
  width: 34px;
  height: 36px;
  text-align: center;
  font:
    600 1.6rem Georgia,
    serif;
}
.site-header nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.site-header form {
  margin: 0;
}
.text-button {
  background: none;
  border: 0;
  padding: 6px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 4px;
  font-size: 0.88rem;
}
.site-footer {
  padding: 36px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.page-shell {
  max-width: 1180px;
  margin: auto;
  padding: 54px 28px;
}
.narrow {
  max-width: 780px;
}
.eyebrow {
  display: block;
  letter-spacing: 0.15em;
  font-size: 0.68rem;
  font-weight: 750;
  color: var(--green);
  margin-bottom: 16px;
}
.lede {
  font-size: 1.15rem;
  color: var(--muted);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.84rem;
}
.welcome {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}
.chapter-token {
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 2.1rem;
}
.chapter-token span {
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  line-height: 1.6;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  margin-bottom: 52px;
}
.panel {
  padding: 32px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 24px;
}
.dashboard-grid .panel {
  margin: 0;
}
.continue-panel {
  background: var(--green-light);
}
.panel p {
  max-width: 580px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  line-height: 1.4;
}
.primary {
  background: var(--green);
  color: #fff;
}
.secondary {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}
.quiet {
  background: transparent;
  color: var(--muted);
}
.secondary-link {
  display: inline-block;
  margin: 12px;
  font-size: 0.9rem;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-title .eyebrow {
  margin-bottom: 8px;
}
.lesson-list {
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.lesson-list li {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}
.lesson-list li:last-child {
  border: 0;
}
.lesson-number {
  font: 500 1rem var(--mono);
  color: var(--muted);
  min-width: 26px;
}
.lesson-title {
  font-size: 1.05rem;
  text-decoration: none;
  font-weight: 600;
  color: var(--ink);
}
.lesson-list p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.status-pill {
  font-size: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 5px 10px;
  white-space: nowrap;
  margin-left: auto;
  background: #fff;
}
.status-pill.complete {
  color: var(--green);
  background: var(--green-light);
}
.roadmap {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
  color: var(--muted);
}
.skill-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.skill-card {
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 8px;
  text-decoration: none;
}
.skill-card span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}
.workspace {
  max-width: 1500px;
  margin: auto;
  padding: 28px 3vw;
}
.workspace-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
}
.workspace-heading .eyebrow {
  margin: 16px 0 6px;
}
.workspace-heading h1 {
  font-size: 2rem;
  margin: 0;
}
.workbench {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(450px, 1.15fr);
  gap: 28px;
  align-items: start;
}
.lesson-panel {
  background: white;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.lesson-panel h2 {
  font-size: 1.3rem;
}
.lesson-panel p {
  font-size: 0.93rem;
}
.example,
pre {
  font-family: var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.85rem;
}
.example {
  padding: 20px;
  border-radius: 8px;
  background: #edf2ef;
  color: #264936;
}
.task-card {
  border-left: 3px solid var(--rust);
  background: #fcf5ed;
  padding: 20px;
  margin: 26px 0;
}
.task-card .eyebrow {
  color: var(--rust);
  margin-bottom: 9px;
}
.task-card p:last-child {
  margin-bottom: 0;
}
.coding-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  overflow: clip;
}
.editor-topbar {
  display: flex;
  justify-content: space-between;
  padding: 13px 20px;
  background: #152c31;
  color: #b1c8c5;
  font: 0.75rem var(--mono);
  border-bottom: 1px solid #35494d;
}
.file-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #dc9275;
  border-radius: 50%;
  margin-right: 6px;
}
.editor-host {
  background: #183036;
  min-height: 310px;
}
.cm-editor {
  min-height: 310px;
  font-family: var(--mono);
  font-size: 16px;
}
.cm-scroller {
  min-height: 310px;
}
.source-fallback {
  width: 100%;
  min-height: 300px;
  background: #183036;
  color: white;
  font: 16px var(--mono);
  padding: 20px;
}
.editor-toolbar {
  display: flex;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  gap: 8px;
}
.editor-toolbar > div {
  display: flex;
  gap: 8px;
}
.results {
  padding: 20px;
  min-height: 150px;
}
.output-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.output-header h3 {
  margin-bottom: 12px;
}
.output-header span {
  font-size: 0.75rem;
  color: var(--muted);
}
.console {
  color: var(--muted);
  max-height: 280px;
  overflow: auto;
}
.check-row {
  padding: 12px;
  border-radius: 6px;
  background: #eef6ef;
  margin-top: 8px;
  font-size: 0.85rem;
}
.check-row.failed {
  background: #fcf0e8;
}
.check-row pre {
  margin-bottom: 0;
  font-size: 0.78rem;
}
.help-panel {
  border-top: 1px solid var(--line);
  padding: 20px;
  background: #fcfcf9;
}
details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 12px;
  min-height: var(--touch-size);
  padding-block: 8px;
}
details + details {
  margin-top: 18px;
}
.help-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.help-text {
  margin-bottom: 0;
}
.workspace-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
}
.history {
  padding: 0 20px 20px;
}
.sign-in {
  max-width: 440px;
  margin: 72px auto;
}
.sign-in h1 {
  font-size: 2.4rem;
}
label {
  display: block;
  margin-top: 14px;
  font-size: 0.85rem;
  font-weight: 600;
}
input[type="email"],
input[type="password"],
select {
  display: block;
  width: 100%;
  border: 1px solid #a6b8af;
  border-radius: 6px;
  padding: 10px;
  background: white;
  margin: 8px 0 18px;
}
input[type="submit"] {
  margin: 12px 0;
}
.flash {
  padding: 14px 24px;
  background: var(--green-light);
  margin: 0;
}
.error {
  color: #8a302b;
  background: #fbe9e5;
}
.skip-link {
  position: absolute;
  left: -1000px;
}
.skip-link:focus {
  left: 10px;
  top: 10px;
  background: white;
  padding: 12px;
  z-index: 5;
}
.editor-shortcuts {
  margin: 0;
  padding: 6px 16px;
  background: #183036;
  color: #b1c8c5;
  font-size: 0.72rem;
}

/* Keep every exercise reachable and its completion status visible at all widths. */
.curriculum-list,
.exercise-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.curriculum-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.curriculum-lesson + .curriculum-lesson {
  border-top: 1px solid var(--line);
}
.lesson-overview {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 24px;
  color: var(--ink);
  text-decoration: none;
}
.lesson-description {
  flex: 1;
  min-width: 0;
}
.lesson-objective {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}
.exercise-list {
  padding: 0 24px 18px 72px;
}
.exercise-list li + li {
  border-top: 1px solid var(--line);
}
.exercise-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 12px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
}
.exercise-name {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
}
.exercise-number {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-right: 12px;
}
.lesson-overview:hover,
.exercise-link:hover {
  background: var(--green-light);
}
.lesson-overview:focus-visible,
.exercise-link:focus-visible {
  outline-offset: -4px;
}
.workspace-heading .exercise-completion {
  display: inline-block;
}
/* Shared sizing: touch controls, readable inputs, and shrinkable grid children. */
[hidden] {
  display: none !important;
}
button,
.button,
input[type="submit"] {
  min-height: var(--touch-size);
}
input[type="email"],
input[type="password"],
input[type="search"],
select {
  min-height: var(--touch-size);
  font-size: 1rem;
  min-width: 0;
  max-width: 100%;
}
input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #a6b8af;
  border-radius: 6px;
  background: white;
}
.site-header nav a,
.brand {
  min-height: var(--touch-size);
  display: inline-flex;
  align-items: center;
}
.site-header nav a {
  padding-block: 8px;
}
.site-header {
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}
.site-footer {
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.phone-only {
  display: none;
}
.lesson-panel,
.results,
.help-panel,
.lesson-list li > div {
  min-width: 0;
}
.lesson-title,
.exercise-name,
.lesson-objective,
.output-header,
.help-text,
.workspace-heading,
.skill-card {
  overflow-wrap: anywhere;
}
.help-actions,
.workspace-next,
.output-header,
.editor-topbar {
  flex-wrap: wrap;
}
.editor-topbar {
  gap: 8px;
}
.editor-toolbar {
  background: var(--surface);
}
.editor-toolbar > div {
  flex-wrap: wrap;
}
.results {
  scroll-margin-top: calc(
    var(--workspace-tabs-height) + var(--workspace-controls-height) + 12px
  );
}
.secondary-link {
  min-height: var(--touch-size);
  display: inline-flex;
  align-items: center;
}

/* Course sections use native disclosure controls, with search across all lessons. */
.course-search {
  margin-bottom: 24px;
}
.course-search label {
  margin-bottom: 8px;
}
.search-controls {
  display: flex;
  gap: 8px;
}
.search-controls input {
  flex: 1;
  width: 0;
}
.course-search [role="status"] {
  margin: 8px 0;
}
.course-module {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 16px;
}
.course-module + .course-module {
  margin-top: 0;
}
.module-summary {
  padding: 18px 20px;
  margin: 0;
}
.module-summary .module-name {
  font-size: 1.05rem;
}
.module-summary .muted {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  margin-left: 18px;
}
.course-module .curriculum-list {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
}
.lesson-list li {
  flex-wrap: wrap;
}
.lesson-list li > div {
  flex: 1;
}
.lesson-list .lesson-title {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-size);
}

@media (max-width: 850px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .chapter-token {
    display: none;
  }
  .site-header {
    height: auto;
    min-height: 76px;
    flex-wrap: wrap;
    padding-block: 16px;
    gap: 16px;
  }
  .site-header nav {
    gap: 16px;
  }
  .page-shell {
    padding: 32px 20px;
  }
  .lesson-list li {
    padding: 20px;
    gap: 12px;
  }
  .section-title {
    align-items: start;
    flex-direction: column;
  }
  .sign-in {
    margin: 40px auto;
    width: calc(100% - 40px);
  }
  .welcome {
    margin-bottom: 18px;
  }
  .workspace-heading .exercise-completion {
    margin-left: 0;
  }

  .phone-only {
    display: inline-flex;
  }
  .workspace {
    padding: 18px max(12px, env(safe-area-inset-right)) 24px
      max(12px, env(safe-area-inset-left));
  }
  .workspace-heading {
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
  }
  .workspace-heading h1 {
    font-size: 1.65rem;
  }
  .workspace-heading .eyebrow {
    letter-spacing: 0.09em;
  }
  .workspace-heading > div > a {
    display: inline-flex;
    align-items: center;
    min-height: var(--touch-size);
  }
  .workspace-tabs {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: calc(6px + env(safe-area-inset-top)) 4px 6px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    margin-bottom: 12px;
  }
  .workspace-tabs button {
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--green);
    font-weight: 650;
    background: transparent;
  }
  .workspace-tabs button[aria-selected="true"] {
    background: var(--green);
    color: white;
  }
  .workbench {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .lesson-panel {
    padding: 20px 16px;
  }
  .lesson-panel p {
    font-size: 1rem;
  }
  .example {
    padding: 14px;
  }
  .task-card {
    padding: 16px;
    margin-block: 20px;
  }
  .task-card p + p {
    margin-top: 14px;
  }
  .lesson-panel > .button {
    width: 100%;
    margin-top: 20px;
  }
  .coding-panel {
    overflow: visible;
  }
  .editor-toolbar {
    position: sticky;
    top: var(--workspace-tabs-height);
    z-index: 10;
    padding: 8px;
    border-radius: 10px 10px 0 0;
    flex-wrap: nowrap;
    align-items: center;
  }
  .editor-toolbar > div {
    gap: 4px;
    flex: 1;
  }
  .editor-toolbar .button {
    padding: 10px 8px;
    font-size: 0.85rem;
  }
  .editor-toolbar .text-button {
    font-size: 0.8rem;
  }
  .editor-topbar {
    padding: 12px;
  }
  .editor-host,
  .cm-editor,
  .cm-scroller {
    min-height: 0;
  }
  .cm-editor {
    height: clamp(180px, 48dvh, 440px);
    font-size: 16px;
  }
  .cm-scroller {
    overflow: auto;
    overscroll-behavior: contain;
  }
  .code-keys {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 6px;
    background: #183036;
    scrollbar-width: thin;
    scrollbar-color: #839b9b #183036;
  }
  .code-keys button {
    flex-shrink: 0;
    min-width: var(--touch-size);
    padding: 6px 10px;
    background: #25454c;
    border: 1px solid #527078;
    border-radius: 5px;
    color: #fff;
    font-family: var(--mono);
    touch-action: manipulation;
  }
  .editor-shortcuts {
    display: none;
  }
  .results,
  .help-panel {
    padding: 16px;
  }
  .help-panel {
    border-top: 0;
    border-radius: 10px;
  }
  .help-panel > .button {
    margin-top: 20px;
  }
  .help-actions {
    gap: 8px;
  }
  .workspace-next {
    padding: 12px;
    gap: 8px;
  }
  .workspace-next > a {
    flex: 1;
    text-align: center;
    margin: 0;
  }
  .history {
    padding: 0 16px 16px;
  }
  .panel {
    padding: 24px 20px;
  }
  .skill-card {
    flex: 1 1 160px;
  }
}
@media (max-width: 700px) {
  .site-header {
    min-height: 68px;
    gap: 8px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: 10px;
  }
  .brand {
    font-size: 1rem;
    gap: 8px;
  }
  .brand-mark {
    width: 30px;
    height: 32px;
    font-size: 1.4rem;
  }
  .site-header nav {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }
  .site-header nav a,
  .site-header nav button {
    padding: 10px 12px;
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
  .page-shell {
    padding: 28px 16px;
  }
  .sign-in {
    margin: 28px auto;
    width: calc(100% - 32px);
  }
  .dashboard-grid {
    gap: 16px;
    margin-bottom: 28px;
  }
  .continue-panel .button,
  .practice-panel .button {
    width: 100%;
  }
  .continue-panel .secondary-link {
    margin: 12px 0 0;
  }
  .module-summary {
    padding: 16px;
  }
  .lesson-overview {
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 12px;
  }
  .lesson-description {
    flex-basis: calc(100% - 42px);
  }
  .lesson-overview > .status-pill {
    margin-left: 38px;
  }
  .exercise-link .status-pill {
    margin-left: 0;
  }
  .lesson-overview .lesson-objective {
    display: none;
  }
  .exercise-list {
    padding: 0 8px 12px;
  }
  .exercise-number {
    margin-right: 6px;
  }
  .exercise-link {
    gap: 10px;
    padding: 12px 8px;
  }
  .lesson-list li {
    padding: 16px;
    gap: 10px;
  }
  .lesson-list li > a.small {
    flex-basis: 100%;
    min-height: var(--touch-size);
    padding: 8px 0 8px 36px;
  }
  .section-title h2 {
    margin-bottom: 8px;
  }
  .section-title {
    margin-bottom: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}

.project-files {
  background: var(--surface);
  padding: 12px;
}
.project-files select {
  width: 100%;
  margin-bottom: 8px;
}
.project-files input {
  width: 100%;
  margin-bottom: 8px;
}
.project-files p {
  margin: 8px 0 0;
}
.generated-files button {
  margin: 4px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
