:root {
  color-scheme: light;
  --ink: #18211f;
  --muted: #69736e;
  --paper: #f5f5ef;
  --card: #fffefa;
  --line: #e5e8df;
  --green: #315d4c;
  --green-dark: #24493b;
  --mint: #e8f0e9;
  --gold: #d6a949;
  --danger: #9c382f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.55;
}
a { color: inherit; }
.topbar {
  height: 76px;
  padding: 0 clamp(20px, 6vw, 88px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 250, .85);
}
.brand { display: flex; gap: 11px; align-items: center; text-decoration: none; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--green); color: white; font-size: 21px; }
nav { display: flex; gap: clamp(16px, 3vw, 34px); }
nav a, .back-link { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
nav a, .nav-logout button { min-height: 44px; display: inline-flex; align-items: center; }
nav a:hover, .back-link:hover { color: var(--green); }
.page { width: min(100% - 40px, 980px); margin: 0 auto; padding: 56px 0 80px; }
.hero { max-width: 740px; margin: 0 0 38px; }
.eyebrow { margin: 0 0 12px; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .13em; }
h1, h2, h3 { font-family: Inter, ui-sans-serif, system-ui, sans-serif; line-height: 1.2; letter-spacing: -.035em; }
h1 { max-width: 760px; margin: 0 0 16px; font-size: clamp(34px, 5.3vw, 56px); font-weight: 700; }
h2 { margin: 0 0 8px; font-size: 21px; }
.lead { max-width: 620px; margin: 0; color: var(--muted); font-size: 18px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.choice-card { min-height: 260px; padding: 27px; display: flex; flex-direction: column; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 16px; text-decoration: none; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.choice-card:hover { transform: translateY(-3px); border-color: #b6c9bb; box-shadow: 0 12px 28px rgba(25, 55, 42, .08); }
.card-icon { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 22px; border-radius: 13px; background: var(--mint); color: var(--green); font-size: 22px; }
.choice-card .eyebrow { margin-bottom: 8px; }
.choice-card h2 { margin-bottom: 8px; }
.choice-card p:not(.eyebrow) { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.text-link { margin-top: auto; color: var(--green); font-size: 14px; font-weight: 700; }
.privacy-note { color: var(--muted); font-size: 13px; }
.hero + .choice-grid + .privacy-note { max-width: 730px; margin-top: 28px; }
.back-link { display: inline-block; margin-bottom: 30px; }
.form-heading { max-width: 700px; margin-bottom: 24px; }
.form-heading h1 { font-size: clamp(32px, 4.5vw, 44px); }
.form-heading > p:last-child { margin: 0; color: var(--muted); }
.panel { padding: clamp(20px, 4vw, 30px); background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.form-stack { display: flex; flex-direction: column; gap: 22px; }
form.form-stack { gap: 16px; }
label { display: flex; flex-direction: column; gap: 8px; color: var(--ink); font-size: 14px; font-weight: 600; }
label small, .task-check small, .task-option small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
input, textarea, select { width: 100%; border: 1px solid #d7ddd3; border-radius: 9px; background: #fff; color: var(--ink); font: inherit; font-size: 15px; outline: none; }
input { min-height: 46px; padding: 10px 12px; }
select { min-height: 46px; padding: 10px 12px; }
textarea { resize: vertical; min-height: 98px; padding: 12px; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: #639278; box-shadow: 0 0 0 3px rgba(69, 123, 92, .13); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.button { min-height: 48px; padding: 12px 19px; display: inline-flex; justify-content: center; align-items: center; gap: 10px; border: 0; border-radius: 9px; background: var(--green); color: #fff; font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; transition: background .16s ease, transform .16s ease; }
.button:hover { background: var(--green-dark); transform: translateY(-1px); }
.button-secondary { border: 1px solid #cbd8cd; background: #f8fbf7; color: var(--green); }
.button-secondary:hover { background: var(--mint); color: var(--green-dark); }
.alert { margin: 0 0 16px; padding: 13px 16px; border: 1px solid #ebc1bb; border-radius: 10px; background: #fff3f1; color: var(--danger); font-size: 14px; }
.notice { margin: 16px 0; padding: 14px 16px; border: 1px solid #ead9a9; border-radius: 10px; background: #fff9e9; color: #68521e; font-size: 14px; }
.alias-form { display: flex; flex-direction: row; align-items: end; gap: 14px; margin-bottom: 20px; }
.alias-form label { flex: 1; }
.assignment-source { color: var(--muted); font-size: 13px; }
.history-link { margin: 5px 0 0; text-align: center; font-size: 14px; }
.history-link a { color: var(--green); font-weight: 700; text-decoration: none; }
.history-link a:hover { text-decoration: underline; }
.history-list { display: flex; flex-direction: column; gap: 13px; }
.history-count { margin: 0; color: var(--muted); font-size: 13px; }
.history-card { display: flex; flex-direction: column; gap: 18px; }
.history-card-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.history-card-heading h2 { margin: 0; }
.duration-pill { padding: 5px 11px; border-radius: 99px; background: var(--mint); color: var(--green); font-size: 12px; font-weight: 700; white-space: nowrap; }
.history-section h3 { margin: 0 0 7px; color: var(--muted); font-family: inherit; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.history-section p { margin: 0; }
.history-section ul { margin: 0; padding-left: 20px; }
.history-section li { padding: 3px 0; }
.history-section li span { display: block; color: var(--muted); font-size: 13px; }
.reflection { padding: 12px 14px; border-radius: 9px; background: #f3f5f0; }
.task-inbox { display: flex; flex-direction: column; gap: 11px; }
.teacher-task-row { display: flex; flex-direction: row; gap: 14px; align-items: flex-start; padding: 19px 22px; }
.task-dot { flex: 0 0 10px; width: 10px; height: 10px; margin-top: 8px; border-radius: 50%; background: var(--gold); }
.task-meta { margin: 0 0 3px; color: var(--muted); font-size: 12px; }
.teacher-task-text { margin: 0; font-weight: 600; }
.teacher-task-status { margin: 0; }
.completion-button { width: 42px; height: 42px; padding: 0; border: 1px solid #cbd8cd; border-radius: 50%; background: #fff; color: var(--green); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.completion-button:hover { background: var(--mint); }
.is-complete .completion-button { border-color: var(--green); background: var(--green); color: #fff; }
.is-complete .teacher-task-text { color: var(--muted); text-decoration: line-through; }
.task-status-label { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.nav-user { color: var(--green); font-size: 13px; font-weight: 700; }
.nav-logout { margin: 0; }
.nav-logout button { border: 0; padding: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.nav-logout button:hover { color: var(--green); }
.auth-panel { max-width: 470px; }
.auth-panel h1 { font-size: clamp(30px, 4vw, 40px); }
.auth-panel .form-stack { margin-top: 24px; text-align: left; }
.auth-switch { margin: 22px 0 0; font-size: 13px; }
.auth-switch a { color: var(--green); font-weight: 700; }
.auth-form { max-width: 620px; }
.invite-form { max-width: 520px; margin-bottom: 24px; }
.invite-form h2 { margin: 0; }
.invite-panel { max-width: 620px; margin-bottom: 24px; }
.invite-panel h2 { margin: 0 0 12px; }
.invite-code { display: block; padding: 15px; border-radius: 9px; background: var(--mint); color: var(--green-dark); font-size: 22px; font-weight: 800; letter-spacing: .12em; text-align: center; }
.student-list { max-width: 620px; }
.student-list h2 { margin: 24px 0 12px; }
.student-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 9px; padding: 15px 19px; }
.student-row span { color: var(--muted); font-size: 13px; }
.task-list { margin: 0; padding: 20px; border: 1px solid var(--line); border-radius: 12px; }
.task-list legend { padding: 0 8px; font-weight: 700; }
.task-option { display: flex; flex-direction: row; align-items: flex-start; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.task-option:last-child { border-bottom: 0; }
.task-option input, .task-check input { width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; accent-color: var(--green); }
.task-option span { display: block; }
.task-option small { margin-top: 3px; }
.task-edit { padding: 19px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.task-edit + .task-edit { margin-top: 3px; }
.task-check { flex-direction: row; align-items: flex-start; gap: 11px; margin-bottom: 16px; cursor: pointer; }
.task-check span { display: block; }
.task-check small { margin-top: 2px; }
.source-line { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.section-title { display: flex; gap: 13px; align-items: flex-start; }
.section-title p { margin: 0; color: var(--muted); font-size: 13px; }
.step { display: grid; place-items: center; flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--mint); color: var(--green); font-size: 13px; font-weight: 700; }
.optional { color: var(--muted); font-size: 12px; font-weight: 400; }
.success-panel { max-width: 620px; margin: 20px auto; padding: clamp(25px, 5vw, 44px); border: 1px solid var(--line); border-radius: 18px; background: var(--card); text-align: center; }
.success-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 18px; border-radius: 50%; background: var(--mint); color: var(--green); font-size: 26px; font-weight: 700; }
.success-panel h1 { margin: 0 auto 10px; font-size: clamp(30px, 4vw, 40px); }
.success-panel > p:not(.eyebrow) { color: var(--muted); }
.success-panel code { display: block; overflow-wrap: anywhere; margin: 18px 0 24px; padding: 12px; border-radius: 8px; background: #f2f4ee; color: var(--green-dark); font-size: 12px; }
.button-row { display: flex; justify-content: center; gap: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
footer { padding: 20px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 12px; }

@media (max-width: 680px) {
  .topbar { height: auto; min-height: 70px; padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 16px max(20px, env(safe-area-inset-left)); align-items: flex-start; gap: 14px; flex-direction: column; }
  nav { gap: 10px 18px; flex-wrap: wrap; }
  .page { padding: 36px 0 max(80px, env(safe-area-inset-bottom)); }
  .choice-grid, .two-col { grid-template-columns: 1fr; }
  .choice-card { min-height: 230px; }
  .alias-form { align-items: stretch; flex-direction: column; }
  .button-row { flex-direction: column; }
}
