:root {
  --ink: #162437;
  --muted: #5a6879;
  --navy: #122a4d;
  --blue: #235fc7;
  --blue-dark: #194a9d;
  --blue-soft: #edf4ff;
  --line: #d8e0e9;
  --line-dark: #b7c2cf;
  --paper: #ffffff;
  --canvas: #f4f6f9;
  --success: #176b43;
  --success-soft: #edf8f2;
  --warning: #76500c;
  --warning-soft: #fff8e7;
  --danger: #a3262a;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(35, 95, 199, .24);
  outline-offset: 2px;
}

.course-header {
  min-height: 72px;
  padding: 13px clamp(20px, 5vw, 72px);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.015em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: .76rem; }
.mark {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #fff;
  font-weight: 850;
  letter-spacing: -.04em;
}
.professor { color: var(--navy); font-size: .9rem; font-weight: 700; text-underline-offset: 3px; }

main { width: min(1120px, calc(100% - 32px)); margin: 38px auto 64px; }
.intro { max-width: 760px; margin-bottom: 24px; }
.eyebrow, .step {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
h1 { margin: 0; font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.08; letter-spacing: -.035em; }
.intro > p:last-child, .view-intro { color: var(--muted); line-height: 1.6; }
.intro > p:last-child { margin: 12px 0 0; font-size: 1rem; }
h2, h3 { color: var(--ink); letter-spacing: -.02em; }
h2 { margin: 0; font-size: 1.3rem; }
h3 { margin: 0; font-size: 1rem; }

.setup-card, .workspace-view, .additional-models {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(20, 39, 68, .055);
}
.setup-card { padding: 24px 28px; }
.setup-heading, .view-heading, .build-header, .generator-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.privacy, .reference-status, .action-state {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .76rem;
  font-weight: 750;
  white-space: nowrap;
}
.privacy { color: var(--success); background: var(--success-soft); }
.reference-status { color: var(--navy); background: var(--blue-soft); }
.setup-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(330px, 1.1fr) minmax(260px, .9fr);
  gap: 18px;
}
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend, .select-field > span, .assumption-grid label > span, #response-label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: .8rem;
  font-weight: 750;
}
.method-switch { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.method {
  min-height: 47px;
  padding: 9px 13px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}
.method:hover { border-color: var(--blue); }
.method.active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-dark); box-shadow: inset 0 0 0 1px var(--blue); }
.method:disabled { cursor: wait; opacity: .55; }
select, input {
  width: 100%;
  min-height: 47px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}
select:focus, input:focus { border-color: var(--blue); outline: 3px solid rgba(35, 95, 199, .13); }
.case-strip {
  margin-top: 17px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.case-strip p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }

.view-tabs { margin: 22px 0 10px; display: flex; gap: 4px; overflow-x: auto; }
.view-tab {
  min-height: 43px;
  padding: 0 17px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}
.view-tab.active { border-bottom-color: var(--blue); color: var(--navy); }
.view-tab:disabled { cursor: not-allowed; color: #98a2ae; }
.workspace-view { padding: 27px 28px 30px; }
.view-intro { max-width: 800px; margin: 12px 0 22px; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.summary-grid > div {
  min-height: 76px;
  padding: 13px 14px;
  border: 1px solid #e4e9ef;
  border-radius: 9px;
  background: #f8fafc;
}
.summary-grid span { display: block; color: var(--muted); font-size: .73rem; }
.summary-grid strong { display: block; margin-top: 6px; font-size: .94rem; line-height: 1.35; }
.peer-panel, .generator-panel { margin-top: 22px; padding-top: 21px; border-top: 1px solid var(--line); }
.peer-panel > p, .generator-heading p { margin: 6px 0 0; color: var(--muted); font-size: .86rem; }
.peer-mode-switch {
  width: min(560px, 100%);
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.peer-mode {
  min-height: 52px;
  padding: 9px 12px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}
.peer-mode small { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; font-weight: 600; }
.peer-mode.active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-dark); box-shadow: inset 0 0 0 1px var(--blue); }
.peer-mode:disabled { cursor: wait; opacity: .55; }
.peer-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.peer-list li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.peer-list li.excluded { border-color: #dfc88f; background: var(--warning-soft); }
.peer-choice { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 9px; align-items: start; cursor: pointer; }
.peer-choice input[type="checkbox"] { width: 17px; min-height: 17px; height: 17px; margin: 2px 0 0; padding: 0; accent-color: var(--blue); }
.peer-choice strong, .peer-choice span { display: block; }
.peer-choice strong { color: var(--navy); }
.peer-choice span { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.peer-reason { min-height: 39px; margin-top: 9px; padding: 8px 10px; font-size: .78rem; }
.peer-selection-status { min-height: 22px; line-height: 1.45; }
.peer-selection-status.ready { color: var(--success); }
.peer-selection-status.warning { color: var(--warning); }
.assumption-grid { margin: 17px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.assumption-grid label { display: block; }
.assumption-grid input { min-height: 44px; }
.status { min-height: 21px; margin: 10px 0 0; color: var(--muted); font-size: .86rem; }
.result-summary { margin: 20px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.result-summary div { padding: 13px; border-radius: 8px; background: var(--blue-soft); }
.result-summary dt { color: var(--muted); font-size: .73rem; }
.result-summary dd { margin: 5px 0 0; color: var(--navy); font-weight: 800; }

.progress-label { text-align: right; }
.progress-label span, .progress-label strong { display: block; }
.progress-label span { color: var(--muted); font-size: .75rem; }
.progress-label strong { margin-top: 3px; color: var(--navy); }
.progress-track { height: 7px; margin: 17px 0 25px; border-radius: 999px; background: #e6ebf1; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .2s ease; }
.build-grid { display: grid; grid-template-columns: 235px minmax(0, 1fr); gap: 24px; align-items: start; }
.stage-panel { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stage-panel h3 { padding: 14px 15px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.stage-panel ol { margin: 0; padding: 6px; list-style: none; }
.stage-panel li + li { margin-top: 2px; }
.stage-panel button {
  width: 100%;
  padding: 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}
.stage-panel button > span:first-child {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e8edf3;
  font-size: .72rem;
  font-weight: 800;
}
.stage-panel button strong, .stage-panel button small { display: block; }
.stage-panel button strong { font-size: .79rem; line-height: 1.3; }
.stage-panel button small { margin-top: 3px; font-size: .68rem; }
.stage-panel button.active { background: var(--blue-soft); color: var(--navy); }
.stage-panel button.active > span:first-child { background: var(--blue); color: #fff; }
.stage-panel button:disabled { cursor: default; opacity: .52; }

.action-card { min-width: 0; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.action-heading { padding: 20px 22px; background: var(--navy); color: #fff; display: flex; justify-content: space-between; gap: 18px; }
.action-heading h3 { color: #fff; font-size: 1.2rem; }
.action-heading .step { color: #acc8fb; }
.action-state { align-self: flex-start; background: rgba(255,255,255,.13); color: #fff; }
.action-state.correct, .action-state.completed_with_help { background: #e5f5eb; color: var(--success); }
.instruction-list { margin: 0; }
.instruction-list > div { padding: 15px 22px; display: grid; grid-template-columns: 145px minmax(0, 1fr); gap: 18px; border-bottom: 1px solid var(--line); }
.instruction-list dt { color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .045em; }
.instruction-list dd { margin: 0; line-height: 1.55; }
.instruction-list code { padding: 3px 6px; border-radius: 4px; background: #f1f4f8; color: var(--navy); font-family: "SFMono-Regular", Consolas, monospace; font-size: .88rem; white-space: normal; overflow-wrap: anywhere; }
.copy-button { margin-left: 8px; padding: 3px 8px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; color: var(--blue); font-size: .72rem; font-weight: 750; cursor: pointer; }
.response-panel { padding: 20px 22px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.response-panel input { max-width: 500px; }
.action-buttons { margin-top: 11px; display: flex; flex-wrap: wrap; gap: 9px; }
.feedback { min-height: 21px; margin: 10px 0 0; color: var(--muted); font-size: .85rem; line-height: 1.45; }
.feedback.success { color: var(--success); font-weight: 650; }
.feedback.error { color: var(--danger); font-weight: 650; }
.feeds { margin: 0; padding: 15px 22px; color: var(--muted); font-size: .84rem; line-height: 1.5; border-bottom: 1px solid var(--line); }
.feeds strong { color: var(--ink); }
.navigation-buttons { padding: 15px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.primary-button, .secondary-button, .confirm-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 17px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.primary-button, .confirm-button { border: 1px solid var(--blue); background: var(--blue); color: #fff; }
.primary-button:hover, .confirm-button:hover { background: var(--blue-dark); }
.secondary-button { border: 1px solid var(--blue); background: #fff; color: var(--blue); }
.secondary-button:hover { background: var(--blue-soft); }
.primary-button:disabled, .secondary-button:disabled, .confirm-button:disabled { opacity: .5; cursor: default; }
.text-button { padding: 5px 0; border: 0; background: transparent; color: var(--blue); font-weight: 750; cursor: pointer; }
.text-button:disabled { color: #98a2ae; cursor: default; }
.text-button.danger { color: var(--danger); }

.progress-table-wrap { margin: 22px 0 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
.progress-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.progress-actions label { cursor: pointer; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: #f5f7fa; color: var(--muted); font-size: .73rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }

.service-note { margin-top: 16px; padding: 14px 17px; border-left: 4px solid #c88e22; background: var(--warning-soft); color: var(--warning); line-height: 1.5; font-size: .86rem; }
.additional-models { margin-top: 24px; padding: 24px 28px; display: grid; grid-template-columns: 1fr 1.25fr; gap: 30px; }
.additional-models p:not(.step) { margin: 8px 0 0; color: var(--muted); line-height: 1.5; font-size: .88rem; }
.download-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.download-grid a { min-height: 74px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--navy); font-size: .84rem; font-weight: 750; text-decoration: none; display: flex; align-items: center; }
.download-grid a:hover { border-color: var(--blue); background: var(--blue-soft); }

.hidden { display: none !important; }
footer {
  min-height: 70px;
  padding: 20px clamp(20px, 5vw, 72px);
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: .83rem;
}
footer a { color: var(--navy); }

@media (max-width: 920px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .peer-list { grid-template-columns: repeat(2, 1fr); }
  .assumption-grid { grid-template-columns: repeat(2, 1fr); }
  .build-grid { grid-template-columns: 205px minmax(0, 1fr); gap: 16px; }
  .instruction-list > div { grid-template-columns: 120px minmax(0, 1fr); }
  .additional-models { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .course-header, footer { align-items: flex-start; flex-direction: column; }
  main { margin-top: 28px; }
  .setup-card, .workspace-view, .additional-models { padding: 21px 18px; }
  .setup-heading, .view-heading, .build-header, .generator-heading { align-items: flex-start; flex-direction: column; }
  .privacy, .reference-status { border-radius: 6px; white-space: normal; }
  .setup-grid, .build-grid { grid-template-columns: 1fr; }
  .case-strip { align-items: flex-start; flex-direction: column; }
  .stage-panel ol { display: grid; grid-template-columns: repeat(2, 1fr); }
  .summary-grid, .peer-list, .result-summary { grid-template-columns: repeat(2, 1fr); }
  .instruction-list > div { grid-template-columns: 1fr; gap: 6px; }
  .download-grid { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .method-switch, .peer-mode-switch, .assumption-grid, .summary-grid, .peer-list, .stage-panel ol { grid-template-columns: 1fr; }
  .view-tab { padding: 0 12px; }
  .navigation-buttons { align-items: stretch; flex-direction: column-reverse; }
  .navigation-buttons button { width: 100%; min-height: 42px; }
}
