:root {
  --ink: #17212b;
  --muted: #66727f;
  --navy: #16324f;
  --blue: #2563a6;
  --blue-soft: #e9f2fb;
  --paper: #f5f3ee;
  --panel: #fff;
  --line: #dce1e5;
  --success: #176a45;
  --success-soft: #e6f4ed;
  --danger: #a53d35;
  --danger-soft: #fae9e7;
  --accent: #e5a93d;
  --shadow: 0 18px 46px rgba(22, 50, 79, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(229, 169, 61, 0.09), transparent 24rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a { color: inherit; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  background: rgba(245, 243, 238, 0.9);
  border-bottom: 1px solid rgba(22, 50, 79, 0.12);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: var(--navy);
  font-family: Georgia, serif;
  font-size: 27px;
  box-shadow: 0 7px 18px rgba(22, 50, 79, 0.2);
}

.brand strong, .brand small { display: block; }
.brand strong { line-height: 1.1; letter-spacing: 0.01em; }
.brand small { color: var(--muted); font-size: 12px; margin-top: 2px; }

.account-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}

.account-nav form { margin: 0; }
.account-nav a, .link-button { color: var(--blue); }
.link-button { border: 0; background: none; padding: 0; }
.user-name { font-weight: 650; }

.page-main { min-height: calc(100vh - 170px); padding-block: 48px 72px; }

.site-footer {
  padding: 24px 0 34px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(34px, 5vw, 54px); line-height: 1.06; letter-spacing: -0.04em; }
h2 { line-height: 1.2; letter-spacing: -0.02em; }

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.muted { color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.messages { padding-top: 16px; }
.message { padding: 13px 16px; border-radius: 12px; font-weight: 650; }
.message-success { background: var(--success-soft); color: var(--success); }
.message-error { background: var(--danger-soft); color: var(--danger); }
.message-info { background: var(--blue-soft); color: var(--navy); }

.button {
  min-height: 44px;
  border-radius: 11px;
  border: 1px solid transparent;
  padding: 10px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(37, 99, 166, 0.25); outline-offset: 2px; }
.button-primary { color: #fff; background: var(--navy); box-shadow: 0 8px 18px rgba(22, 50, 79, 0.17); }
.button-secondary { color: var(--navy); background: #fff; border-color: #b8c5d0; }
.button-ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.button-wide { width: 100%; }

.login-page .page-main { display: grid; align-items: center; }
.login-layout { display: grid; grid-template-columns: 1.1fr 0.75fr; gap: clamp(36px, 8vw, 110px); align-items: center; }
.login-intro p:not(.eyebrow) { max-width: 640px; font-size: 18px; color: #4d5b68; }
.formula { margin-top: 36px; color: rgba(22, 50, 79, 0.18); font: italic 56px Georgia, serif; }
.login-panel { padding: clamp(24px, 4vw, 38px); }
.login-panel h2 { font-size: 28px; margin-bottom: 7px; }
.stack-form { display: grid; gap: 10px; margin-top: 24px; }
.stack-form label, .annotation-form label { font-size: 13px; font-weight: 750; }
input[type="text"], input[type="password"], textarea {
  width: 100%; border: 1px solid #bcc6ce; border-radius: 10px; background: #fff; color: var(--ink); padding: 12px 13px;
}
.stack-form .button { margin-top: 11px; }
.form-error { margin-top: 18px; padding: 12px; border-radius: 10px; color: var(--danger); background: var(--danger-soft); }
.login-help { color: var(--muted); font-size: 13px; margin: 18px 0 0; }

.page-heading { display: flex; justify-content: space-between; gap: 30px; align-items: flex-end; margin-bottom: 30px; }
.page-heading h1 { margin-bottom: 0; }
.heading-note { max-width: 300px; color: var(--muted); margin-bottom: 7px; }
.homework-list { display: grid; gap: 14px; }
.homework-card {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 25px 28px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.homework-card:hover { transform: translateY(-2px); border-color: #aabcca; box-shadow: var(--shadow); }
.homework-card h2 { margin: 8px 0 7px; font-size: 24px; }
.homework-card p { color: var(--muted); margin-bottom: 0; }
.card-kicker { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 750; }
.status-late { color: var(--danger); background: var(--danger-soft); }
.status-done { color: var(--success); background: var(--success-soft); }
.progress-block { min-width: 145px; padding-left: 22px; border-left: 1px solid var(--line); }
.progress-block strong, .progress-block span { display: block; }
.progress-block strong { font-size: 25px; color: var(--navy); }
.progress-block span { color: var(--muted); font-size: 12px; }
.progress-block .card-arrow { color: var(--blue); font-size: 24px; margin-top: 7px; }
.empty-state { text-align: center; padding: 62px 24px; }
.empty-state p { color: var(--muted); margin-bottom: 0; }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 17px; border-radius: 50%; color: var(--success); background: var(--success-soft); font-size: 25px; }

.back-link { display: inline-block; color: var(--blue); margin-bottom: 25px; text-decoration: none; font-weight: 700; }
.assignment-heading { display: grid; grid-template-columns: 1fr auto; gap: 38px; align-items: end; margin-bottom: 34px; }
.assignment-description { max-width: 760px; color: #4d5b68; font-size: 17px; }
.deadline-card { min-width: 245px; padding: 15px 20px; margin: 0; border-left: 3px solid var(--accent); background: rgba(255,255,255,.65); }
.deadline-card div { display: flex; justify-content: space-between; gap: 18px; }
.deadline-card div + div { margin-top: 7px; }
.deadline-card dt { color: var(--muted); font-size: 12px; }
.deadline-card dd { margin: 0; font-size: 13px; font-weight: 750; text-align: right; }
.task-list { display: grid; gap: 23px; }
.task-card { padding: clamp(20px, 4vw, 34px); scroll-margin-top: 96px; }
.task-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.task-number { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--navy); font: 22px Georgia, serif; }
.task-label { margin-bottom: 2px; color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.task-header h2 { margin: 0; font-size: 22px; }
.task-statement { padding: 24px 0; font-size: 17px; }
.submitted-photos { display: grid; gap: 24px; margin: 0 0 22px; }
.student-photo-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fafafa; }
.annotated-image { position: relative; width: 100%; background: #e8ebed; user-select: none; }
.annotated-image img { display: block; width: 100%; height: auto; }
.annotation-box { position: absolute; z-index: 2; border: 3px solid #e0453b; background: rgba(224, 69, 59, .12); pointer-events: none; }
.annotation-box b { position: absolute; top: -15px; left: -15px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; background: #d93930; font-size: 13px; box-shadow: 0 3px 8px rgba(0,0,0,.22); }
.photo-meta { min-height: 45px; padding: 9px 13px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; background: #fff; }
.photo-meta form { margin: 0; }
.reviewed-label { color: var(--success); font-weight: 750; }
.text-danger { padding: 0; border: 0; color: var(--danger); background: none; font-size: 12px; text-decoration: underline; }
.student-comments { margin: 0; padding: 14px; display: grid; gap: 10px; list-style: none; border-top: 1px solid var(--line); }
.student-comments li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.student-comments li > span, .comment-number { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; background: #d93930; font-size: 12px; font-weight: 800; }
.student-comments p { margin: 2px 0 0; }
.upload-box { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 16px; border: 1px dashed #9babb8; border-radius: 13px; background: #f7fafc; }
.upload-box strong, .upload-box small, .file-selection { display: block; }
.upload-box small { color: var(--muted); }
.file-selection { color: var(--blue); font-size: 12px; margin-top: 3px; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.review-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.review-heading h1 { font-size: clamp(31px, 4vw, 46px); margin-bottom: 8px; }
.review-heading p:last-child { color: var(--muted); margin-bottom: 0; }
.review-count { padding: 7px 11px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 13px; font-weight: 750; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .65fr); gap: 24px; align-items: start; }
.review-canvas-panel { min-width: 0; }
.review-instruction { margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.review-stage { cursor: crosshair; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); touch-action: none; }
.annotation-draft { border-style: dashed; background: rgba(229, 169, 61, .2); }
.review-sidebar { display: grid; gap: 16px; position: sticky; top: 94px; }
.annotation-form { padding: 20px; }
.annotation-form textarea { margin-top: 7px; resize: vertical; }
.form-actions { display: flex; gap: 9px; margin-top: 12px; }
.review-comments { padding: 20px; }
.review-comments h2 { font-size: 19px; margin-bottom: 17px; }
.review-comments ol { display: grid; gap: 18px; padding: 0; margin: 0; list-style: none; }
.review-comments li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.review-comments p { margin-bottom: 5px; }
.review-comments small { display: block; color: var(--muted); margin-bottom: 4px; }

@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 680px); }
  .site-header { position: static; }
  .header-inner { min-height: 68px; }
  .user-name { display: none; }
  .account-nav { gap: 12px; }
  .page-main { padding-block: 32px 52px; }
  .login-layout, .assignment-heading, .review-grid { grid-template-columns: 1fr; }
  .login-intro { display: none; }
  .login-panel { max-width: 470px; width: 100%; margin-inline: auto; }
  .page-heading { display: block; }
  .heading-note { margin-top: 14px; }
  .homework-card { grid-template-columns: 1fr; padding: 20px; gap: 15px; }
  .progress-block { padding: 12px 0 0; border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
  .progress-block strong, .progress-block span { display: initial; }
  .progress-block .card-arrow { margin-top: 0; }
  .assignment-heading { align-items: start; gap: 18px; }
  .deadline-card { min-width: 0; }
  .task-header { grid-template-columns: auto 1fr; }
  .task-header .status { grid-column: 1 / -1; justify-self: start; }
  .upload-box { grid-template-columns: 1fr 1fr; }
  .upload-box > div { grid-column: 1 / -1; }
  .review-heading { align-items: start; flex-direction: column; }
  .review-sidebar { position: static; }
}

@media (max-width: 440px) {
  .brand small { display: none; }
  .task-card { padding: 18px 14px; }
  .upload-box { grid-template-columns: 1fr; }
  .upload-box > div { grid-column: auto; }
  .button { width: 100%; }
  .photo-meta { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
