* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 40px;
  color: #43464b;
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  color: #43464b;
}
h1 { font-size: 28px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 600; margin: 24px 0 8px; }
h3 { font-size: 16px; font-weight: 600; }
.instructions { color: #444; margin-bottom: 24px; }
.sources-heading { font-family: 'Inter', -apple-system, sans-serif; font-weight: 600; }

/* ---- Student essay rich editor (bold/italic only) ---- */
.essay-editor {
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 3px;
  overflow: hidden;
}
.essay-toolbar {
  display: flex;
  gap: 2px;
  padding: 4px 6px;
  background: #f4f4f4;
  border-bottom: 1px solid #e0e0e0;
}
.essay-toolbar button {
  width: auto;
  margin-top: 0;
  padding: 3px 11px;
  background: #fff;
  color: #43464b;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
}
.essay-toolbar button:hover { border-color: #43464b; }
.essay-input {
  min-height: 320px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  outline: none;
  overflow-y: auto;
  resize: vertical;
}
.essay-input:empty::before {
  content: attr(data-placeholder);
  color: #999;
}
.hidden { display: none; }

.narrow-screen { max-width: 480px; margin: 40px auto 0; }

/* ---- Student login (mirrors the teacher login on the author side) ---- */
#student-login-title { text-align: center; font-size: 36px; margin-bottom: 8px; }
#student-login-tagline { text-align: center; font-family: 'Fraunces', Georgia, serif; font-style: italic; color: #55585d; margin-bottom: 36px; }
#student-login-field { max-width: 340px; margin: 0 auto; }
#student-login-field select { margin-bottom: 10px; }
#student-login-note { font-size: 12px; color: #8a8d92; margin-top: 10px; font-style: italic; }
#code-screen #code-preview { text-align: center; }

/* Student login (code + password) */
input[type="text"], input[type="password"] {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 8px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-sizing: border-box;
}
.pw-subtitle { text-align: center; font-family: 'Fraunces', Georgia, serif; font-style: italic; color: #55585d; margin-bottom: 28px; }
#pw-code-line { text-align: center; color: #55585d; margin-bottom: 12px; }
.login-error { color: #b00020; font-size: 14px; min-height: 18px; margin-top: 8px; }
.text-link {
  width: auto; background: none; border: none; color: #43464b;
  text-decoration: underline; cursor: pointer; padding: 0; margin-top: 16px; font-size: 14px;
}
.text-link:hover { color: #000; }
.signout-line { text-align: center; margin-top: 24px; }
.signout-line.signout-line-tight { margin-top: 8px; }

label { display: block; margin-top: 16px; font-weight: bold; font-size: 14px; }

select, textarea, button {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 8px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 3px;
}

select:disabled { color: #999; background: #f7f7f7; }

textarea {
  min-height: 320px;
  resize: vertical;
}

button {
  margin-top: 20px;
  background: #43464b;
  color: #fff;
  border: none;
  cursor: pointer;
  padding: 10px;
}

button:disabled { background: #ccc; cursor: not-allowed; }

#code-preview { margin-top: 12px; font-weight: bold; }
#word-count { color: #666; font-size: 13px; text-align: right; }
#autosave-status { color: #999; font-size: 12px; text-align: right; margin-top: 2px; }
#paste-warning { color: #b00020; font-size: 13px; }

/* --- Essay screen: full-width header + split panes --- */
#essay-header {
  background: #f4f4f4;
  border-bottom: 1px solid #ccc;
  margin: 0 -20px 24px;
  padding: 20px;
}
#essay-header h1 { margin: 0; }

#essay-body {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

#left-pane, #right-pane { flex: 1 1 50%; min-width: 0; }

#left-pane {
  border-right: 1px solid #ddd;
  padding-right: 32px;
}

#instructions-block ul { padding-left: 20px; margin: 8px 0; }
#instructions-block li { margin-bottom: 8px; }

#doc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 16px;
}

.doc-tab {
  display: inline-block;
  width: auto;
  margin-top: 0;
  padding: 6px 12px;
  border: 1px solid #999;
  border-radius: 3px;
  background: #fff;
  color: #43464b;
  font-size: 14px;
  cursor: pointer;
}

.doc-tab.active {
  background: #43464b;
  color: #fff;
  border-color: #43464b;
  font-weight: bold;
}

#doc-display {
  border-top: 1px solid #ddd;
  padding-top: 12px;
  white-space: pre-wrap;
}
#doc-display h3 { font-size: 15px; margin-bottom: 6px; white-space: normal; }
#doc-display img { max-width: 100%; height: auto; }

#prompt-block {
  border-bottom: 1px solid #ddd;
  padding-bottom: 16px;
  margin-bottom: 8px;
  font-size: 17px;
}

@media (max-width: 800px) {
  #essay-body { flex-direction: column; }
  #left-pane { border-right: none; border-bottom: 1px solid #ddd; padding-right: 0; padding-bottom: 24px; margin-bottom: 24px; }
}

/* ---- Multiple-choice student view ---- */
/* Numbered nav row: black = current, grey = answered, white = unanswered. */
#mc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}
.mc-nav-btn {
  width: 38px;
  height: 38px;
  margin-top: 0;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  color: #43464b;
  font-size: 14px;
  cursor: pointer;
}
.mc-nav-btn:hover { border-color: #43464b; }
.mc-nav-btn.answered { background: #d9d9d9; border-color: #bbb; color: #333; }
.mc-nav-btn.current { background: #43464b; border-color: #43464b; color: #fff; font-weight: bold; }

/* Two-pane question view: stimulus left, question right. */
#mc-pane { display: flex; gap: 32px; align-items: flex-start; }
#mc-pane.mc-single #mc-question-pane { max-width: 760px; }
#mc-stimulus-pane { flex: 1 1 50%; min-width: 0; }
#mc-question-pane { flex: 1 1 50%; min-width: 0; }

#mc-stimulus-note { font-style: italic; color: #444; margin-bottom: 8px; font-size: 14px; }
#mc-stimulus-body {
  background: #f7f7f7;
  border-left: 3px solid #999;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.6;
  max-height: 620px;
  overflow-y: auto;
  white-space: pre-wrap;
}
#mc-stimulus-body img { max-width: 100%; height: auto; }

#mc-question-text { font-weight: bold; margin-bottom: 12px; font-size: 16px; }
.mc-written-box {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
}
.mc-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  margin-top: 4px;
  border: 1px solid #e5e5e5;
  border-radius: 3px;
  cursor: pointer;
  font-weight: normal;
}
.mc-option:hover { background: #f4f4f4; }
.mc-option input { width: auto; margin-top: 3px; }

#mc-footer { display: flex; gap: 10px; margin-top: 24px; }
#mc-footer button { margin-top: 0; width: auto; padding: 10px 20px; }
#mc-prev-btn, #mc-next-btn { background: #fff; color: #43464b; border: 1px solid #ccc; }
#mc-prev-btn:disabled, #mc-next-btn:disabled { color: #bbb; border-color: #eee; cursor: default; }
#mc-nav { align-items: flex-start; }
#mc-submit-btn {
  margin-left: 16px;
  margin-top: 0;
  height: 38px;
  padding: 0 20px;
  background: #43464b;
  color: #fff;
  width: auto;
}
#mc-submit-btn.not-ready { background: #c8c9cc; color: #fff; }

/* ---- Feedback: choice + picker ---- */
.choice-centered { text-align: center; }
.stu-loggedin { color: #8a8d92; font-size: 14px; margin: 8px 0 30px; }
.stu-loggedin strong { color: #43464b; }
#choice-buttons { display: flex; flex-direction: column; gap: 12px; margin: 24px auto 0; max-width: 360px; }
#choice-buttons button { margin-top: 0; }
#choice-feedback-btn { background: #fff; color: #43464b; border: 1px solid #43464b; }
.feedback-picker-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; margin-top: 0; margin-bottom: 10px;
  background: #fff; color: #43464b; border: 1px solid #ddd; border-radius: 6px;
  padding: 16px; text-align: left; cursor: pointer;
}
.feedback-picker-item:hover { border-color: #43464b; }
.fp-title { font-weight: 600; }
.fp-arrow { color: #8a8d92; }
.feedback-view-score { font-size: 16px; color: #43464b; margin-top: 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.fb-mode-tag { font-size: 12px; font-weight: 600; color: #8a5a00; background: #fdf2c4; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }

/* ---- Graded feedback page ---- */
#feedback-view-header { margin-bottom: 24px; }
.fb-card { border: 1px solid #ddd; border-radius: 8px; padding: 18px; margin-bottom: 16px; }
.fb-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.fb-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; background: #43464b; color: #fff;
  border-radius: 5px; font-size: 14px; font-weight: 600; flex: 0 0 auto;
}
.fb-num.written { background: #6b5b95; }
.fb-meta { color: #8a8d92; font-size: 13px; }
.fb-stimulus {
  background: #f7f7f7; border-left: 3px solid #ccc;
  padding: 12px 16px; margin-bottom: 14px; line-height: 1.6;
}
.fb-stim-text { white-space: pre-wrap; }
.fb-stimulus img { max-width: 100%; height: auto; }
.fb-question { font-weight: 600; font-size: 16px; margin-bottom: 14px; }
.fb-result {
  display: inline-block; font-size: 13px; font-weight: 600;
  padding: 3px 12px; border-radius: 12px; margin-bottom: 12px;
}
.fb-result.correct { background: #edf7ed; color: #2e7d32; }
.fb-result.incorrect { background: #fdecec; color: #b00020; }
.fb-option {
  border: 1px solid #e6e6e6; border-radius: 6px;
  padding: 11px 14px; margin-bottom: 8px; font-size: 15px;
}
.fb-option.is-correct { background: #edf7ed; border-color: #cfe8cf; }
.fb-option.is-theirs-wrong { background: #fdecec; border-color: #f5cccc; }
.fb-option.is-theirs-right { background: #edf7ed; border-color: #cfe8cf; }
.fb-response {
  background: #fafafa; border: 1px solid #eee; border-radius: 6px;
  padding: 12px 14px; white-space: pre-wrap; line-height: 1.6; margin-bottom: 10px;
}
.fb-written-score { font-size: 15px; color: #43464b; }
.fb-written-score strong { color: #2e7d32; }
.fb-written-feedback { margin-top: 10px; background: #f4f7fb; border: 1px solid #dce4ef; border-radius: 6px; padding: 10px 12px; }
.fb-written-feedback-label { font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: #3a6ea5; margin-bottom: 3px; }
.fb-written-feedback-text { white-space: pre-wrap; line-height: 1.55; color: #33363b; }
.login-logo { display: block; margin: 0 auto 16px; width: 72px; height: auto; }
/* Logo links back to the homepage (the pitch). Centering moves to the link. */
.login-logo-link { display: block; width: 72px; margin: 0 auto 16px; }
.login-logo-link .login-logo { margin: 0; }

/* ---- Essay feedback (student view): read-only mirror of the grading screen,
   plus the criterion descriptions the grading screen doesn't show. ---- */
.fb-rubric {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 24px;
}
.fb-rubric-row {
  display: flex;
  gap: 16px;
  /* Align to the last line of the criterion: the per-criterion comment (and the
     score) land on the description line when there is one, otherwise on the
     criterion-title line. */
  align-items: flex-end;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
}
.fb-rubric-row:last-child { border-bottom: none; }
.fb-rubric-main { flex: 1; min-width: 0; }
.fb-crit-name { font-weight: 600; color: #43464b; }
.fb-crit-desc { font-size: 13px; color: #666; margin-top: 3px; line-height: 1.5; }
.fb-crit-score { flex: 0 0 auto; font-weight: 600; color: #43464b; white-space: nowrap; }
.fb-crit-feedback { flex: 1.3; min-width: 0; font-size: 13px; color: #666; line-height: 1.5; }
.fb-rubric-row.fb-rubric-jumprope { background: #f7f7f7; }

.fb-general-block, .fb-essay-block { margin-bottom: 24px; }
.fb-general-block h2, .fb-essay-block h2 { font-size: 16px; margin: 0 0 8px; }
.fb-general-body {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 14px 16px;
  white-space: pre-wrap;
  line-height: 1.6;
}
.fb-essay-body {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 14px 16px;
  line-height: 1.6;
  background: #fdfdfd;
}
.fb-essay-body img { max-width: 100%; height: auto; }

/* Teacher's inline comments in the student feedback view. */
.fb-comment-mark { background: #fff3c4; border-bottom: 2px solid #e0b400; cursor: pointer; border-radius: 2px; padding: 0 1px; }
.stu-comment-popup { position: fixed; z-index: 200; max-width: 260px; background: #fff; border: 1px solid #ccc; border-radius: 8px; box-shadow: 0 6px 22px rgba(0,0,0,0.16); padding: 10px 12px; font-size: 14px; line-height: 1.45; display: none; white-space: pre-wrap; }

.fb-nothing-to-review {
  background: #edf7ed;
  border: 1px solid #cfe8cf;
  color: #2e7d32;
  border-radius: 8px;
  padding: 16px 18px;
  font-size: 15px;
  margin: 0;
}

/* ---- Independent-scroll panes on the essay test-taker (wide view only). ---- */
@media (min-width: 801px) {
  #essay-screen:not(.hidden) {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 40px); /* 40px = body's padding-bottom */
  }
  #essay-screen #essay-header { flex: 0 0 auto; }
  #essay-screen #essay-body {
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
  }
  #essay-screen #left-pane,
  #essay-screen #right-pane {
    overflow-y: auto;
    padding-bottom: 24px;
  }
}

/* ── Secure test mode ─────────────────────────────────────────────────────── */
.pin-error { color: #b00020; font-size: 14px; min-height: 18px; margin: 6px 0 0; }

/* Full-screen wall shown the instant a student leaves a secured test. */
.secure-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(20, 20, 24, 0.97);
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 24px;
}
.secure-overlay.hidden { display: none; } /* beat the global .hidden (display:flex above) */
.secure-overlay-inner { max-width: 520px; color: #fff; }
.secure-overlay-strike {
  display: inline-block; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: #ffdada;
  background: rgba(176, 0, 32, 0.5); border: 1px solid #b00020;
  border-radius: 999px; padding: 5px 16px; margin-bottom: 20px;
}
.secure-overlay-inner h2 {
  font-family: 'Fraunces', Georgia, serif; font-size: 34px; margin: 0 0 12px; color: #fff;
}
.secure-overlay-inner p { font-size: 17px; line-height: 1.6; color: #e6e6ea; margin: 0 0 26px; }
.secure-overlay-inner button {
  font-family: inherit; font-size: 17px; font-weight: 600; padding: 14px 32px;
  background: #fff; color: #1a1a1e; border: none; border-radius: 10px; cursor: pointer;
}
.secure-overlay-inner button:hover { background: #e9e9ec; }
.secure-overlay-inner button.hidden { display: none; }
