/* Full-width question rows, shared by the student screen and teacher preview. */
.questions,
.questions.count-3 {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.questions.count-3 { grid-template-rows: repeat(3, minmax(0, 1fr)); }
.questions.count-3 .question-card:last-child { grid-column: auto; }
.questions .question-card {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 0 16px;
  padding: 12px 16px;
  border-radius: 8px;
}
.questions .q-header {
  grid-area: 1 / 1;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 5px;
  border: 0;
  padding: 0;
  margin: 0;
}
.questions .seat-tag { font-size: 22px; color: var(--green); }
.questions .seat-index { display: none; }
.questions .q-number { font-size: 14px; overflow-wrap: anywhere; }
.questions .q-content {
  grid-area: 1 / 2 / 3 / 3;
  border-left: 1px solid var(--line);
  padding-left: 18px;
  justify-content: center;
  min-width: 0;
  text-align: center;
}
.questions .q-body {
  --fit-min: 22;
  flex: 0 1 auto;
  font-size: clamp(24px, 2.35vw, 44px);
  line-height: 1.45;
  max-height: 100%;
  scrollbar-width: thin;
}
.questions .q-content.has-image { flex-direction: row; align-items: center; }
.questions .q-content.has-image .q-body { flex: 1; }
.questions .q-image { width: 28%; max-width: 28%; height: 100%; max-height: 100%; }
.questions .image-only .q-image { width: 100%; max-width: 100%; }
.questions .q-status {
  grid-area: 2 / 1;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 3px;
  margin-top: 6px;
  font-size: 12px;
}
.questions .q-status strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.questions .expired::after { left: 50%; top: 50%; transform: translate(-50%, -50%); }

/* Keep the display chrome compact so the questions use most of the viewport. */
.reading-board { height: 100dvh; min-height: 0; }
.reading-board .board-head { padding: 12px 20px; gap: 16px; }
.reading-board .board-head > div:first-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 16px;
  min-width: 0;
}
.reading-board .board-title { order: -1; font-size: clamp(22px, 2.1vw, 32px); }
.reading-board .board-eyebrow { margin: 0; font-size: 12px; letter-spacing: 0; }
.reading-board .stage-caption { margin: 0; font-size: 13px; }
.reading-board[data-phase="prep"] .stage-caption { display: none; }
.reading-board .demo-ribbon { font-size: 12px; padding: 2px 5px; }
.reading-board .timer-box { min-width: 0; padding: 6px 12px; gap: 12px; border-radius: 8px; }
.reading-board .timer-box small { font-size: 14px; white-space: nowrap; }
.reading-board .timer-box small + small { display: none; }
.reading-board .timer-num { font-size: 42px; letter-spacing: -.04em; }
.reading-board .board-body { padding: 0 20px 6px; }
.reading-board .board-footer { height: 26px; padding: 0 20px; font-size: 12px; align-items: center; }
.reading-board .board-footer button { font-size: 12px; padding: 2px 6px; }
.reading-board .single-card { padding: 16px 22px; border-radius: 8px; }
.reading-board .single-card .q-header { margin-bottom: 10px; padding-bottom: 10px; }
.reading-board .single-card .q-content { justify-content: center; text-align: center; }
.reading-board .single-card .q-content.has-image { align-items: center; }
.reading-board .single-card .q-body {
  --fit-min: 22;
  flex: 0 1 auto;
  max-height: 100%;
  font-size: clamp(28px, 2.65vw, 50px);
  line-height: 1.5;
}
.reading-board .single-card .q-number { font-size: 14px; }

/* Center requirements, while allowing long instructions to scroll from the top. */
.rules-panel { flex-direction: column; gap: 0; }
.rules-index { display: none; }
.rules-content { flex: 0 0 auto; width: 100%; margin: auto; text-align: center; }
.rules-bottom { justify-content: center; }

.english-duration { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.english-duration label { margin: 0; }
.english-duration input { width: 90px; padding: 10px; }
.english-clock { margin: 12px 0; font-size: clamp(72px, 12vw, 180px); line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--green); }
.english-clock.urgent { color: var(--red); }
.english-prep-panel h2 { margin: 0; }
.english-prep-panel p { margin: 14px 0 0; }
.preview-wrap .english-clock { font-size: clamp(60px, 7vw, 100px); }

/* Larger supporting copy for projection; question typography stays adaptive. */
.student-display .rules-content h2 { font-size: clamp(24px, 1.8vw, 32px); }
.student-display .rules-text { font-size: clamp(22px, 2.2vw, 38px); line-height: 1.75; }
.student-display .rules-bottom { font-size: clamp(17px, 1.2vw, 22px); line-height: 1.6; }
.student-display .offline-panel p { font-size: clamp(22px, 1.8vw, 32px); line-height: 1.7; }
.student-display .lobby-note { font-size: clamp(18px, 1.4vw, 25px); }
.student-display .lobby-seat { font-size: clamp(18px, 1.3vw, 24px); }
.student-display .board-eyebrow { font-size: clamp(14px, 1vw, 18px); }
.student-display .stage-caption { font-size: clamp(16px, 1.1vw, 20px); }
.student-display .demo-ribbon { font-size: 14px; }
.student-display .board-footer { font-size: 14px; }
.student-display .reading-board .board-footer { height: 30px; flex-shrink: 0; }
.student-display .reading-board .board-footer button { font-size: 14px; }
.student-display .reading-board .timer-box small { font-size: 16px; }
.student-display .screen-disconnected { font-size: 18px; }

/* Teachers read one student's question alongside its reference material. */
.teacher-panel { margin: 0; padding: 0; overflow: hidden; }
.teacher-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 16px 22px; background: #f5f8f2; border-bottom: 1px solid var(--line); }
.teacher-picker .active { color: white; background: var(--green); border-color: var(--green); }
.teacher-picker .muted { margin-left: 8px; }
.teacher-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.teacher-label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.teacher-header h2 { display: flex; align-items: center; gap: 16px; margin: 0; font-size: 24px; }
.teacher-header .q-number { font-size: 14px; font-weight: normal; }
.teacher-countdown { font-size: 13px; color: var(--muted); }
.teacher-countdown strong { font-size: 20px; font-variant-numeric: tabular-nums; color: var(--green); }
.teacher-qa { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 310px; }
.teacher-question, .teacher-answer { min-width: 0; padding: 26px; }
.teacher-answer { border-left: 1px solid var(--line); background: #f7faf5; }
.teacher-qa h3 { margin: 0 0 14px; color: var(--green); font-size: 15px; }
.teacher-question-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.teacher-question-head h3 { margin: 0; }
.teacher-qa p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 19px; line-height: 1.85; }
.teacher-question p { font-size: 22px; }
.teacher-followup { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.teacher-image { display: block; max-width: 100%; max-height: 420px; object-fit: contain; margin: 0 auto 20px; }

.modal:has(.roster-editor) { width: min(1400px, 96vw); }
.roster-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.roster-incomplete { color: #976012; background: #fff3d9; }
.roster-table-wrap { max-height: 48vh; }
.roster-table { min-width: 1000px; }
.roster-table th, .roster-table td { padding: 10px 6px; }
.roster-table input, .roster-table textarea, .roster-table select { width: 100%; min-width: 65px; padding: 8px; font-size: 13px; }
.roster-table th:nth-child(1) { width: 120px; }
.roster-table th:nth-child(2) { width: 150px; }
.roster-table th:nth-child(3) { width: 240px; }
.roster-table th:nth-child(4) { width: 90px; }
.roster-table th:nth-child(5) { width: 140px; }
.roster-table th:nth-child(6) { width: 100px; }
.roster-table input:disabled, .roster-table textarea:disabled, .roster-table select:disabled { opacity: 1; background: #f1f4ee; color: #667267; }
.roster-locked { color: var(--muted); font-size: 12px; }
.roster-save { margin-top: 20px; }
.assignment-form { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); }
.assignment-projects { display: flex; flex-wrap: wrap; gap: 16px; flex: 1; }
.phase-control-clock { font-size: 28px; color: var(--green); font-variant-numeric: tabular-nums; }
.comprehensive-seat { font-size: clamp(28px, 4vw, 54px); color: var(--green); margin-bottom: 12px; font-weight: 700; }
.discussion-notice { text-align: center; font-size: clamp(20px, 2.4vw, 32px); color: var(--green); margin-bottom: 10px; }
.board[data-stage="open"] .board-body { display: flex; flex-direction: column; }
.board[data-stage="open"] .single-card { flex: 1; min-height: 0; }

/* Keep confirmations visible inside both normal and embedded browsers. */
.action-confirm { width: min(460px, calc(100vw - 32px)); padding: 28px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: white; box-shadow: 0 20px 70px #122c2633; }
.action-confirm::backdrop { background: #122c2659; }
.action-confirm h2 { margin: 0 0 16px; font-size: 21px; }
.action-confirm p { margin: 0 0 24px; white-space: pre-wrap; line-height: 1.8; }
.action-confirm .row { justify-content: flex-end; gap: 10px; }

/* The operator's embedded preview has the same rows in a smaller surface. */
.preview-wrap .reading-board .board-head { padding: 12px 14px; }
.preview-wrap .reading-board .board-title { font-size: 20px; }
.preview-wrap .reading-board .board-body { padding: 0 14px 6px; }
.preview-wrap .reading-board .board-eyebrow { font-size: 12px; }
.preview-wrap .reading-board .board-eyebrow .sep { padding: 0 5px; }
.preview-wrap .reading-board .timer-num { font-size: 32px; }
.preview-wrap .reading-board .timer-box small { font-size: 12px; }
.preview-wrap .reading-board .board-footer { padding: 0 14px; font-size: 12px; }
.preview-wrap .questions .question-card { grid-template-columns: 76px minmax(0, 1fr); padding: 9px 12px; gap: 0 12px; }
.preview-wrap .questions .q-content { padding-left: 12px; }
.preview-wrap .questions .seat-tag { font-size: 18px; }
.preview-wrap .questions .q-number { font-size: 12px; }
.preview-wrap .questions .q-status strong { font-size: 15px; }
.preview-wrap .questions .q-body { --fit-min: 14; font-size: 22px; }
.preview-wrap .single-card .q-body { --fit-min: 18; font-size: 28px; }

@media (max-width: 760px) {
  .teacher-header, .teacher-picker { padding: 16px; }
  .teacher-qa { grid-template-columns: minmax(0, 1fr); }
  .teacher-question, .teacher-answer { padding: 20px; }
  .teacher-answer { border-left: 0; border-top: 1px solid var(--line); }
  .teacher-question p { font-size: 20px; }
  .reading-board .board-head { padding: 10px 12px; gap: 8px; }
  .reading-board .board-eyebrow { font-size: 12px; }
  .reading-board .board-body { padding: 0 12px 6px; }
  .reading-board .board-footer { padding: 0 12px; font-size: 12px; }
  .reading-board .board-footer > span { display: none; }
  .reading-board .board-footer { justify-content: flex-end; }
  .reading-board .timer-num { font-size: 32px; }
  .questions .question-card { grid-template-columns: 64px minmax(0, 1fr); padding: 9px 10px; gap: 0 10px; }
  .questions .q-content { padding-left: 10px; }
  .questions .seat-tag { font-size: 18px; }
  .questions .q-number { font-size: 12px; }
  .questions .q-body { --fit-min: 18; font-size: 24px; }
  .reading-board .single-card { padding: 12px; }
  .reading-board .single-card .q-body { --fit-min: 18; font-size: 28px; }
}
