:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-muted: #f0f3f1;
  --text: #1f2925;
  --muted: #5e6964;
  --line: #d9e0dc;
  --primary: #246b53;
  --primary-dark: #1c5642;
  --primary-soft: #e7f1ec;
  --accent: #8a5412;
  --focus: #2563eb;
  --danger: #a93636;
  --warning-soft: #fff5e8;
  --danger-soft: #fff0f0;
  --shadow: 0 1px 3px rgba(31, 41, 37, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

body.access-locked .app-shell,
body.access-locked .modal-overlay {
  display: none;
}

.access-overlay {
  display: none;
}

body.access-locked .access-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--bg);
}

.access-card {
  display: grid;
  width: min(100%, 360px);
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.access-card h2 {
  margin-bottom: 4px;
}

.auth-card label,
.teacher-create-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.auth-card form,
.account-card {
  display: grid;
  gap: 14px;
}

.totp-qr {
  width: 240px;
  max-width: 100%;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.account-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0;
}

.account-details dt { color: var(--muted); }
.account-details dd { margin: 0; font-weight: 700; }
.account-summary { color: var(--muted); font-size: 14px; }

.teacher-dashboard {
  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 18px;
}

.teacher-header,
.teacher-create-form {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.teacher-workspace-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.teacher-workspace-nav .tab-button { flex: 1 1 140px; }
.teacher-workspace-content { display: grid; gap: 16px; }
.teacher-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.teacher-filter-grid label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
.teacher-notification-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.teacher-student-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.teacher-create-form { flex-wrap: wrap; }
.teacher-create-form h2 { width: 100%; }
.teacher-create-form label { flex: 1 1 220px; }
.teacher-create-form[data-auth-form="daily-assignment"] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
}
[data-assignment-school-scope] {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
[data-assignment-school-scope] legend { font-weight: 700; }
[data-auth-form="daily-assignment"] .checkbox-row { display: flex; align-items: center; }
.daily-assignment-panel .inline-alert { white-space: pre-wrap; }
.structured-import-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 16px;
}
.structured-import-form label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
.structured-import-summary { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-bottom: 16px; }
.structured-import-document { display: grid; gap: 10px; margin-bottom: 16px; }
.structured-import-document pre {
  max-height: min(55vh, 620px);
  overflow: auto;
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: #17231e;
  color: #f4fbf7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.teacher-resources,
.resource-student-form,
.structured-resource-preview,
.vocabulary-candidate-promotions { display: grid; gap: 14px; margin-bottom: 16px; }
.formal-file-resource-create > p,
.formal-file-upload-form > div { flex: 1 1 100%; }
.formal-file-upload-form,
.category-administration,
.category-admin-list { display: grid; gap: 14px; }
.formal-file-upload-form label,
.category-create-form label,
.category-admin-row label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
.formal-file-upload-state { min-height: 1.4em; color: var(--primary-dark); font-weight: 700; }
.resource-file-remove { justify-self: start; margin: 0 0 16px; }
.category-create-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(100px, 160px) auto;
  align-items: end;
  gap: 12px;
}
.category-admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(100px, 140px) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}
.category-admin-row > small { grid-column: 1 / -1; color: var(--muted); }
.category-admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.teacher-resource-page { display: grid; gap: 16px; min-width: 0; }
.teacher-resource-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.teacher-resource-tabs { display: flex; gap: 8px; }
.teacher-resource-tabs [aria-pressed="true"],
.teacher-category-select[aria-current="true"] { background: var(--primary-dark); color: white; }
.teacher-resource-create > summary { width: fit-content; cursor: pointer; }
.teacher-resource-create-entries { display: grid; gap: 12px; margin-top: 16px; }
.teacher-resource-create-entries > details > summary { cursor: pointer; padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-weight: 700; }
.teacher-resource-student-picker label { display: grid; gap: 8px; max-width: 480px; font-weight: 700; }
.teacher-resource-browser { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.teacher-resource-browser > * { min-width: 0; }
.teacher-category-tree { overflow: auto; max-height: 55vh; }
.teacher-category-tree ul { list-style: none; padding-left: 14px; margin: 4px 0; border-left: 1px solid var(--line); }
.teacher-category-tree > ul { padding-left: 0; border-left: 0; }
.teacher-category-node { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; }
.teacher-category-toggle { width: 28px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; }
.teacher-category-toggle:hover,
.teacher-category-toggle:focus-visible { background: var(--surface-muted); color: var(--primary-dark); }
.teacher-category-toggle-spacer { width: 28px; }
.teacher-category-select { display: flex; gap: 8px; justify-content: space-between; text-align: left; width: 100%; padding: 10px; border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; overflow-wrap: anywhere; }
.teacher-category-select > span { min-width: 0; }
.teacher-category-select:hover { outline: 1px solid var(--primary-dark); }
.teacher-category-context h3 { overflow-wrap: anywhere; }
.category-panel-heading,
.resource-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.category-panel-heading h2,
.resource-list-heading h2 { margin: 0; }
.system-root-badge { display: inline-block; padding: 3px 7px; border-radius: 999px; background: var(--surface-muted); color: var(--muted); font-size: 12px; vertical-align: middle; }
.resource-file-name { display: inline-flex; align-items: center; gap: 7px; }
.resource-placement-form { margin-top: 4px; }
.resource-placement-form > p { margin: 0; }
.teacher-resource-browser .category-create-form,
.teacher-resource-browser .category-admin-row { grid-template-columns: minmax(0, 1fr); }
.teacher-resource-group { min-width: 0; margin: 12px 0; }
.teacher-resource-group > summary { cursor: pointer; font-weight: 700; padding: 8px 0; overflow-wrap: anywhere; }
.teacher-resource-group > summary small { font-weight: 400; color: var(--muted); }
.teacher-resource-group .teacher-resource-group { margin-left: 14px; padding-left: 12px; border-left: 2px solid var(--line); }
@media (max-width: 900px) {
  .teacher-resource-browser { grid-template-columns: minmax(0, 1fr); }
}
.resource-student-list { display: grid; gap: 8px; }
.resource-preview-section { border-top: 1px solid var(--line); padding-top: 12px; }
.resource-preview-section:first-of-type { border-top: 0; }
.resource-preview-question,
.resource-preview-block { margin-top: 12px; }
.structured-resource-preview pre {
  margin: 6px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.vocabulary-candidate-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}
.vocabulary-candidate-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.vocabulary-candidate-card h3,
.vocabulary-candidate-card p { margin: 0; }
.vocabulary-candidate-card > header small { color: var(--muted); text-align: right; }
.vocabulary-promotion-state {
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e8eef0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.vocabulary-promotion-state.current { background: #dff3e8; color: #17643b; }
.vocabulary-promotion-state.invalid { background: #fff0d8; color: #8a4b08; }
.vocabulary-promotion-actions,
.vocabulary-candidate-search,
.vocabulary-candidate-create,
.vocabulary-search-result-list,
.vocabulary-orphaned-list { display: grid; gap: 12px; }
.vocabulary-promotion-actions details,
.vocabulary-orphaned-list {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.vocabulary-promotion-actions summary,
.vocabulary-orphaned-list > summary { cursor: pointer; font-weight: 800; }
.vocabulary-candidate-search,
.vocabulary-candidate-create { margin-top: 12px; }
.vocabulary-candidate-search label,
.vocabulary-candidate-create > label:not(.checkbox-row) { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
.vocabulary-promotion-progress { min-height: 1.4em; color: var(--primary-dark); font-weight: 700; }
.vocabulary-search-result {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.vocabulary-search-result .secondary-button { justify-self: start; }
.vocabulary-canonical-entry {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 0;
}
.vocabulary-canonical-entry div { min-width: 0; }
.vocabulary-canonical-entry dt { color: var(--muted); font-size: 12px; font-weight: 800; }
.vocabulary-canonical-entry dd { margin: 3px 0 0; overflow-wrap: anywhere; }
@media (max-width: 820px) {
  .structured-import-form { grid-template-columns: 1fr; align-items: stretch; }
  .category-create-form,
  .category-admin-row { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .category-admin-actions { align-items: end; }
  .teacher-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .teacher-notification { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .student-management-header { align-items: stretch; flex-direction: column; }
  .student-management-header .primary-button { width: 100%; }
  .category-create-form,
  .category-admin-row { grid-template-columns: 1fr; }
  .teacher-filter-grid { grid-template-columns: 1fr; }
  .vocabulary-candidate-card > header { flex-direction: column; }
  .vocabulary-candidate-card > header small { text-align: left; }
  .vocabulary-canonical-entry { grid-template-columns: 1fr; }
}
.table-scroll { overflow-x: auto; }
.student-table { width: 100%; border-collapse: collapse; }
.student-table th, .student-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.teacher-notifications ul { display: grid; gap: 8px; padding: 0; list-style: none; }
.teacher-notification { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; border-radius: 8px; background: var(--surface-muted); }
.teacher-notification.unread { border-left: 4px solid var(--primary); }
.teacher-notification.read { color: var(--muted); }
.archived-students > summary,
.student-data-tools > summary,
.satisfactory-read-aloud > summary { cursor: pointer; font-weight: 800; }
.student-management-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.student-management-header h2,
.student-management-header p,
.student-status-section h2 { margin: 0; }
.student-management-header p { margin-top: 6px; color: var(--muted); }
.student-management-header .primary-button { flex: 0 0 auto; }
.student-status-section { display: grid; gap: 12px; }
.archived-students .table-scroll { margin-top: 14px; }
.student-data-tools .student-restore-form {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.student-restore-form > p { flex: 1 1 100%; margin: 0; }
.teacher-student-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(32, 33, 36, 0.52);
}
.teacher-student-modal-overlay[hidden] { display: none; }
.teacher-student-create-modal {
  display: grid;
  gap: 14px;
}
.teacher-student-create-modal h2,
.teacher-student-create-modal p { margin: 0; }
.teacher-student-create-modal label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}
.teacher-learning-page,
.teacher-student-learning,
.teacher-student-learning > section { display: grid; gap: 12px; }
.teacher-learning-context h2,
.teacher-learning-context p,
.teacher-learning-overview h3,
.teacher-learning-overview p { margin: 0; }
.teacher-learning-context p:last-child,
.teacher-learning-overview p { margin-top: 6px; color: var(--muted); }
.teacher-learning-overview { display: grid; gap: 12px; }
.teacher-learning-overview tr.selected { background: var(--primary-soft); }
.teacher-learning-overview tr.selected .teacher-student-link { color: var(--primary-dark); }
.teacher-student-learning[data-learning-detail] {
  margin-top: 4px;
  padding-top: 18px;
  border-top: 2px solid var(--line);
}
.teacher-learning-detail-header { margin-bottom: 4px; }
.teacher-learning-detail-header h2,
.teacher-learning-detail-header p { margin: 0; }
.teacher-learning-detail-header p:last-child { margin-top: 4px; color: var(--muted); }
.permanent-delete-panel { border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.permanent-delete-panel.danger-zone { border-width: 2px; }
.permanent-delete-panel label { display: grid; gap: 8px; max-width: 520px; }
.learning-day h3,
.learning-day h4 { margin: 0 0 8px; }
.learning-day ul { display: grid; gap: 6px; margin: 0; }
.read-aloud-diagnostic header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

.submission-dashboard {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  display: grid;
  gap: 16px;
  padding: 20px;
}

.submission-upload-form,
.submission-history,
.teacher-submissions,
.teacher-submission-detail {
  display: grid;
  gap: 14px;
}

.submission-drop-zone {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px 18px;
  border: 2px dashed #9dbbad;
  border-radius: 10px;
  background: var(--surface-muted);
  cursor: pointer;
  text-align: center;
}

.submission-drop-zone:hover,
.submission-drop-zone.dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.submission-drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.submission-drop-zone strong { color: var(--primary-dark); font-size: 18px; }
.submission-drop-zone span,
.submission-drop-zone small { color: var(--muted); }

.submission-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.submission-history-item > div { display: grid; gap: 4px; min-width: 0; }
.submission-history-item > div strong { overflow-wrap: anywhere; }
.submission-history-item > div span { color: var(--muted); font-size: 14px; }

.submission-status,
.pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.submission-status.pending,
.pending-badge { color: #84560b; background: #fff1cb; }
.submission-status.approved { color: #1b5c43; background: #dff0e7; }
.submission-status.rejected { color: #983c1d; background: #ffe5da; }
.submission-reason,
.submission-cleaned { grid-column: 1 / -1; margin: 0; }
.submission-cleaned { color: var(--muted); }
.submission-success { border-color: #9fcab8; background: #e8f5ee; }
.submission-page-error { min-height: auto; }
.submission-section-title { display: flex; justify-content: space-between; gap: 12px; }
.submission-section-title h2,
.submission-section-title p { margin-top: 0; }
.submission-table small { color: var(--muted); }

.submission-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.submission-detail-meta p { flex-basis: 100%; margin: 0; }
.submission-pdf-preview { width: 100%; min-height: 55vh; border: 1px solid var(--line); border-radius: 8px; background: white; }
.submission-audio-preview { width: 100%; }
.submission-review-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.student-resource-list,
.student-structured-resource { display: grid; gap: 14px; }
.student-resource-card { display: grid; gap: 8px; }
.student-resource-card h2 { margin: 6px 0; }
.student-resource-scope {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
}
.student-resource-scope.selected { background: var(--warning-soft); color: var(--accent); }
.student-resource-section,
.student-resource-question,
.student-resource-reviews { display: grid; gap: 10px; }
.student-resource-section { padding: 16px; border-radius: 12px; background: var(--surface); }
.student-resource-question { padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.student-resource-question header { display: flex; align-items: center; gap: 8px; }
.student-resource-question-number { font-weight: 800; }
.student-resource-material,
.student-resource-answer,
.student-resource-explanation,
.student-resource-review { padding: 12px; border-radius: 8px; background: var(--surface-muted); }
.student-resource-markdown > :first-child { margin-top: 0; }
.student-resource-markdown > :last-child { margin-bottom: 0; }
.student-resource-options { display: grid; gap: 8px; }
.student-resource-file { display: grid; gap: 12px; }
.student-pdf-preview { display: grid; gap: 10px; min-width: 0; }
.student-pdf-preview-status { margin: 0; color: var(--muted); }
.student-pdf-preview-viewport {
  width: 100%;
  min-height: 48vh;
  overflow: auto;
  background: #eef1f4;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.student-pdf-preview-viewport canvas {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  background: white;
}
.student-pdf-preview-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  text-align: center;
}
.student-pdf-preview-controls[hidden] { display: none; }
.student-pdf-preview-controls span { color: var(--muted); font-size: 14px; }
.student-pdf-reader-open { justify-self: start; }
.student-pdf-reader[hidden] { display: none; }
.student-pdf-reader {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #e6eaed;
}
.student-pdf-reader-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.student-pdf-reader-toolbar > strong { overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.student-pdf-reader-zoom { display: flex; align-items: center; gap: 8px; }
.student-pdf-reader-zoom span { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; }
.student-pdf-reader-scroll {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.student-pdf-reader-pages { display: grid; gap: 16px; min-width: 100%; padding: 12px; }
.student-pdf-reader-page {
  position: relative;
  justify-self: center;
  overflow: hidden;
  border: 1px solid #cbd2d7;
  background: white;
  box-shadow: 0 2px 8px rgba(31, 41, 37, .12);
}
.student-pdf-reader-page canvas { display: block; background: white; }
.student-pdf-reader-page canvas[hidden] { display: none; }
.student-pdf-reader-page-label {
  position: absolute;
  right: 8px;
  bottom: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(31, 41, 37, .78);
  color: white;
  font-size: 12px;
}

@media (max-width: 620px) {
  .submission-dashboard { width: calc(100vw - 16px); max-height: calc(100vh - 16px); padding: 14px; }
  .submission-history-item { grid-template-columns: minmax(0, 1fr); }
  .submission-status { justify-self: start; }
  .submission-pdf-preview { min-height: 48vh; }
  .student-pdf-preview-controls { grid-template-columns: 1fr 1fr; }
  .student-pdf-preview-controls span { grid-column: 1 / -1; grid-row: 1; }
  .student-pdf-reader-toolbar { grid-template-columns: auto minmax(0, 1fr); }
  .student-pdf-reader-zoom { grid-column: 1 / -1; justify-content: center; }
  .student-pdf-reader-zoom .secondary-button { min-height: 44px; padding: 8px 16px; }
}
.compact-input { min-width: 150px; min-height: 42px; font-size: 16px; }

@media (max-width: 700px) {
  .teacher-header { align-items: stretch; flex-direction: column; }
  .student-table { min-width: 820px; }
}

.access-input {
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  font-size: 20px;
}

.access-input:focus {
  border-color: var(--focus);
  outline: none;
}

.access-error {
  min-height: 22px;
  margin: 0;
  color: var(--danger);
  font-size: 15px;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 88px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  background: rgba(247, 245, 239, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.18;
}

h2 {
  margin: 0 0 14px;
  font-size: 22px;
  line-height: 1.25;
}

h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.3;
}

.main-content {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 16px;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 22px rgba(32, 33, 36, 0.08);
}

.nav-button,
.primary-button,
.secondary-button,
.danger-button,
.option-button,
.tab-button,
.icon-text-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.nav-button {
  min-height: 52px;
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 16px;
}

.nav-button.active {
  color: #fff;
  background: var(--primary);
}

.primary-button {
  padding: 12px 18px;
  color: #fff;
  background: var(--primary);
  font-size: 17px;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-button {
  padding: 10px 14px;
  color: var(--primary-dark);
  background: #e6f1ec;
  border-color: #c7ded4;
  font-size: 15px;
}

.danger-button {
  padding: 12px 16px;
  color: #fff;
  background: var(--danger);
  font-size: 16px;
}

.icon-text-button {
  padding: 9px 12px;
  color: var(--text);
  background: var(--surface-muted);
  border-color: var(--line);
}

.panel,
.card,
.question-panel,
.result-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.result-scope {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.panel {
  padding: 16px;
}

.stack {
  display: grid;
  gap: 14px;
}

.hero-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.hero-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-box {
  padding: 12px;
  background: var(--surface-muted);
  border-radius: 8px;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.question-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 15px;
}

.timer {
  color: var(--accent);
  font-weight: 800;
}

.prompt {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.45;
}

.prompt-sub {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.options {
  display: grid;
  gap: 12px;
}

.option-button {
  width: 100%;
  min-height: 58px;
  padding: 14px;
  color: var(--text);
  background: #fff;
  border-color: var(--line);
  font-size: 17px;
  line-height: 1.35;
  text-align: left;
}

.option-button.selected {
  border-color: var(--focus);
  background: #eaf3fb;
}

.option-button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.answer-input {
  width: 100%;
  min-height: 58px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 20px;
  line-height: 1.4;
}

.answer-input:focus {
  border-color: var(--focus);
  outline: none;
}

.test-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.test-actions .primary-button {
  grid-column: 1 / -1;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.result-actions button {
  min-height: 52px;
}

.progress-dots {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}

.dot {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
}

.dot.done {
  background: var(--primary);
}

.dot.current {
  background: var(--accent);
}

.last-review-panel {
  margin-top: 14px;
}

.last-round-line {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

.review-words-grid .empty-state {
  grid-column: 1 / -1;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.source-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.word-source-tabs {
  margin-bottom: 10px;
}

.unit-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.unit-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.unit-picker-label {
  margin: 2px 0 -2px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.unit-option {
  min-height: 48px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
}

.unit-option.selected {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.scope-line,
.daily-last-time {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.unit-select-label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.unit-select {
  min-height: 48px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
}

.listen-button {
  justify-self: start;
  min-height: 50px;
  padding: 10px 14px;
  color: var(--primary-dark);
  background: #e6f1ec;
  border: 1px solid #c7ded4;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 800;
}

.test-mode-note,
.result-status {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.test-mode-note strong,
.result-status strong {
  font-size: 17px;
}

.test-mode-note span,
.result-status span {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.test-mode-note.needs-correction,
.test-mode-note.consolidation,
.test-mode-note.cautious,
.result-status.needs-work {
  border-color: #e5c68f;
  background: var(--warning-soft);
}

.result-status.passed {
  border-color: #b9d8ca;
  background: var(--primary-soft);
}

.test-task-summary {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.45;
}

.test-task-summary strong {
  color: var(--text);
}

.active-test-mode {
  margin-bottom: 12px;
  color: var(--primary-dark);
  font-size: 16px;
  font-weight: 800;
}

.daily-summary-panel {
  margin-top: 14px;
}

.daily-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.daily-summary-head h2,
.daily-status,
.daily-source-list p {
  margin: 0;
}

.daily-summary-head span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.daily-status {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.55;
}

.daily-source-list {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-radius: 8px;
}

.daily-source-list p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.daily-round-list {
  border-top: 1px solid var(--line);
}

.daily-overview {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-radius: 8px;
}

.daily-overview p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.daily-overview strong {
  color: var(--text);
  font-size: 18px;
}

.daily-round-item {
  display: grid;
  gap: 4px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.daily-round-item.compact {
  gap: 3px;
  padding: 9px 0;
}

.daily-record-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.daily-round-item strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}

.daily-round-item span {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.daily-round-item.incomplete strong {
  color: #9a5e14;
}

.daily-result-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 14px !important;
  font-weight: 800;
}

.daily-result-badge.qualified,
.daily-result-badge.excellent {
  color: var(--primary-dark);
  background: #e6f1ec;
}

.daily-result-badge.completed,
.daily-result-badge.needs_work {
  color: #8b3b18;
  background: #fff0e8;
}

.daily-result-badge.pending {
  color: var(--muted);
  background: var(--surface-muted);
}

.readaloud-round-complete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #bdd9cd;
  border-radius: 8px;
  background: #e6f1ec;
}

.readaloud-round-complete div {
  display: grid;
  gap: 3px;
}

.readaloud-round-complete strong {
  color: var(--primary-dark);
  font-size: 17px;
}

.readaloud-round-complete span {
  color: var(--muted);
  font-size: 15px;
}

.tab-button {
  padding: 10px 8px;
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 15px;
}

.tab-button.active {
  color: #fff;
  background: var(--primary);
}

.card-list {
  display: grid;
  gap: 12px;
}

.card-list.words {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.card {
  padding: 14px;
}

.card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.word-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.word-title button {
  flex: 1;
  min-width: 0;
  padding: 0;
  color: var(--primary-dark);
  background: transparent;
  border: 0;
  font-size: 20px;
  font-weight: 800;
  text-align: left;
}

.word-card {
  min-height: 52px;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 52px;
}

.word-card h3 {
  margin-bottom: 0;
  color: var(--primary-dark);
  font-size: 17px;
  line-height: 1.25;
}

.word-card.expanded {
  grid-column: 1 / -1;
  border-color: #bdd9cd;
}

.word-card.expanded h3 {
  font-size: 22px;
}

.word-card .icon-text-button {
  margin-top: 8px;
}

.load-more-row {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.forms-line {
  color: var(--accent) !important;
  font-size: 15px !important;
  font-weight: 800;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 8px;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.badge.weak {
  color: #8b3b18;
  background: #fff0e8;
  border-color: #f2c3a9;
}

.badge.mastered {
  color: var(--primary-dark);
  background: #e6f1ec;
  border-color: #bdd9cd;
}

.article-button {
  width: 100%;
  padding: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
}

.local-calibration-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  color: var(--text);
  background: #fff8e8;
  border: 1px solid #efd39a;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.local-calibration-switch.active {
  background: #e6f1ec;
  border-color: #bdd9cd;
}

.local-calibration-switch div {
  display: grid;
  gap: 4px;
}

.local-calibration-switch strong {
  font-size: 17px;
}

.local-calibration-switch span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.article-detail-header {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.article-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.article-title-row h2 {
  margin: 0;
}

.compact-button {
  width: auto;
  min-height: 42px;
  padding: 10px 14px;
  white-space: nowrap;
}

audio {
  width: 100%;
}

.article-reader {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 18px;
  line-height: 1.95;
}

.article-sentence-wrap {
  display: inline;
}

.article-sentence {
  display: inline;
  min-height: 34px;
  margin: 0 2px 8px 0;
  padding: 2px 4px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.7;
  text-align: left;
}

.article-sentence.active {
  color: var(--primary-dark);
  background: #dceee7;
}

.inline-structure {
  color: var(--accent);
  font-weight: 800;
}

.sentence-detail {
  display: block;
  margin: 8px 0 14px;
  padding: 12px;
  background: #fbfaf6;
  border-left: 4px solid var(--primary);
  border-radius: 0 8px 8px 0;
  font-size: 16px;
  line-height: 1.6;
}

.structure-slash {
  display: block;
  margin-bottom: 8px;
  color: var(--primary-dark);
  font-weight: 800;
}

.sentence-translation {
  display: block;
  color: var(--text);
}

.library-vocab-list {
  gap: 10px;
}

.library-vocab-card {
  display: block;
}

.library-vocab-main {
  display: grid;
  gap: 4px;
}

.library-vocab-word {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  color: var(--primary-dark);
  background: transparent;
  border: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
  text-align: left;
}

.inline-alert {
  padding: 12px;
  color: #8b3b18;
  background: #fff0e8;
  border: 1px solid #f2c3a9;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.5;
}

.readaloud-view {
  padding-bottom: 8px;
}

.readaloud-list {
  display: grid;
  gap: 12px;
}

.readaloud-card {
  display: grid;
  gap: 12px;
}

.readaloud-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.readaloud-status {
  justify-content: flex-end;
}

.readaloud-card .readaloud-en {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.55;
}

.readaloud-card .readaloud-zh,
.readaloud-card .readaloud-placeholder {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

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

.readaloud-assessment {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fbfaf6;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.5;
}

.readaloud-assessment.pending {
  color: var(--primary-dark);
  background: #e6f1ec;
  border-color: #bdd9cd;
  font-weight: 800;
}

.readaloud-assessment.unavailable {
  color: #8b3b18;
  background: #fff0e8;
  border-color: #f2c3a9;
}

.assessment-score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.assessment-level {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #e6f1ec;
  border: 1px solid #bdd9cd;
  border-radius: 8px;
}

.assessment-level span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.assessment-level strong {
  color: var(--primary-dark);
  font-size: 18px;
}

.assessment-score {
  display: grid;
  gap: 2px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.assessment-score span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.assessment-score strong {
  color: var(--primary-dark);
  font-size: 22px;
  line-height: 1.1;
}

.low-score-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.low-score-words strong {
  margin-right: 2px;
}

.low-score-word {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 3px 8px;
  color: #8b3b18;
  background: #fff0e8;
  border: 1px solid #f2c3a9;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
}

.article-readaloud-summary {
  display: grid;
  gap: 12px;
  border-color: #bdd9cd;
  background: #fbfffb;
}

.article-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.article-summary-head h3 {
  margin: 0;
}

.article-summary-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--primary-dark);
  background: #e6f1ec;
  border: 1px solid #bdd9cd;
  border-radius: 8px;
}

.article-summary-hero span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.article-summary-hero strong {
  font-size: 34px;
  line-height: 1;
}

.article-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.article-summary-metric strong {
  font-size: 20px;
}

.article-summary-note {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.assessment-attempts {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.assessment-feedback {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: #fff;
  border-left: 3px solid var(--primary);
}

.assessment-feedback p {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
}

.word-issue-list,
.weakest-sentences {
  display: grid;
  gap: 8px;
}

.word-issue {
  min-height: 40px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid #d5a153;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1.45;
}

.word-issue.critical {
  color: #8b3b18;
  background: #fff7f2;
  border-left-color: #c9673d;
}

.word-issue.system {
  color: var(--muted);
  border-left-color: var(--line-strong);
}

.weakest-sentence-button {
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 10px;
  width: 100%;
  min-height: 52px;
  padding: 9px 10px;
  color: var(--text);
  text-align: left;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.weakest-sentence-button > strong {
  justify-self: end;
  color: var(--primary-dark);
  font-size: 17px;
}

.weakest-sentence-button small {
  grid-column: 1 / -1;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readaloud-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.readaloud-actions button {
  min-height: 48px;
  padding-right: 10px;
  padding-left: 10px;
}

.calibration-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fbfaf6;
  border: 1px dashed var(--accent);
  border-radius: 8px;
}

.calibration-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.calibration-summary {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #eef7f0;
  border: 1px solid #b9dac0;
  border-radius: 8px;
  color: var(--text);
}

.calibration-summary span {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.calibration-summary .continuity-ok {
  color: #276235;
  font-weight: 800;
}

.calibration-summary .continuity-warning {
  color: #9a4f07;
  font-weight: 800;
}

.calibration-summary button {
  justify-self: start;
  min-height: 42px;
}

.boundary-overview {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f7fbff;
  border: 1px solid #c8d8eb;
  border-radius: 8px;
}

.boundary-overview-head {
  display: grid;
  gap: 4px;
}

.boundary-overview-head span {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.boundary-list {
  display: grid;
  gap: 8px;
}

.boundary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.boundary-row strong {
  color: var(--primary-dark);
}

.boundary-row em {
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
}

.boundary-row.boundary-verified {
  border-color: #b9dac0;
}

.boundary-row button {
  min-height: 40px;
  padding: 7px 10px;
  font-size: 14px;
}

.file-input-label {
  display: inline-grid;
  place-items: center;
  min-height: 48px;
  text-align: center;
  cursor: pointer;
}

.file-input-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.calibration-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  background: #fbfaf6;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.calibration-time {
  grid-column: 1 / -1;
  color: var(--primary-dark);
  font-size: 15px;
  font-weight: 800;
}

.calibration-boundary {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.calibration-controls button {
  min-height: 42px;
  padding: 8px;
  font-size: 15px;
}

.calibration-controls button.fine-adjust {
  background: #ffffff;
  border-style: dotted;
  font-size: 14px;
}

.readaloud-card.verified-timing {
  border-color: #b9dac0;
  background: #fbfffb;
}

.waveform-placeholder {
  padding: 10px;
  color: var(--muted);
  background: #fbfaf6;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

.sentence-waveform {
  position: relative;
  height: 74px;
  padding: 8px 6px;
  background: #fbfaf6;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.waveform-bars {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 1px;
}

.waveform-bar {
  flex: 1 1 1px;
  min-width: 1px;
  max-height: 100%;
  background: #c9c5bb;
  border-radius: 2px;
}

.waveform-bar.active {
  background: var(--primary);
}

.waveform-marker {
  position: absolute;
  top: 4px;
  bottom: 4px;
  z-index: 1;
  width: 2px;
  border-radius: 999px;
}

.waveform-marker.start {
  background: var(--focus);
}

.waveform-marker.end {
  background: var(--danger);
}

.sentence-list {
  display: grid;
  gap: 10px;
}

.sentence-card {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sentence-en {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.55;
}

.sentence-zh {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  color: var(--text);
  border-top: 1px dashed var(--line);
  font-size: 16px;
  line-height: 1.6;
}

.sentence-card.open .sentence-zh {
  display: block;
}

details {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

summary {
  min-height: 36px;
  cursor: pointer;
  font-weight: 800;
}

.structure-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.structure-item {
  padding: 8px;
  background: var(--surface-muted);
  border-radius: 8px;
  line-height: 1.45;
}

.result-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.wrong-list {
  display: grid;
  gap: 10px;
}

.wrong-item {
  padding: 12px;
  background: #fff7f3;
  border: 1px solid #f0c7b4;
  border-radius: 8px;
}

.wrong-item p {
  margin: 4px 0 0;
  font-size: 15px;
}

.empty-state {
  padding: 22px 14px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.6;
  text-align: center;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(32, 33, 36, 0.52);
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: min(100%, 420px);
  padding: 18px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
}

.modal p {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.6;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .daily-record-title {
    align-items: flex-start;
  }

  .daily-record-title strong {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .readaloud-round-complete {
    align-items: stretch;
    flex-direction: column;
  }

  .readaloud-round-complete .primary-button {
    width: 100%;
  }

  .article-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-button {
    width: 100%;
  }

  .readaloud-card-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (min-width: 720px) {
  .main-content {
    padding: 22px;
  }

  .hero-panel,
  .question-panel,
  .result-panel,
  .panel {
    padding: 22px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .test-actions {
    grid-template-columns: 1fr 1fr 1.2fr;
  }

  .test-actions .primary-button {
    grid-column: auto;
  }

  .boundary-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Unified student-facing interface */
body {
  line-height: 1.55;
}

button {
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.main-content:focus {
  outline: none;
}

.app-shell {
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

.topbar {
  padding: 0;
  background: rgba(245, 247, 246, 0.96);
  backdrop-filter: none;
}

.topbar-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: min(100%, 960px);
  min-height: 72px;
  margin: 0 auto;
  padding: 10px 16px;
  gap: 12px;
}

.page-identity {
  min-width: 0;
}

.eyebrow {
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 500;
}

h1 {
  font-size: 22px;
  line-height: 1.3;
}

h2 {
  margin-bottom: 12px;
  font-size: 20px;
  line-height: 1.4;
}

h3 {
  font-size: 18px;
  line-height: 1.45;
}

.main-content {
  width: min(100%, 960px);
  padding: 16px;
}

.bottom-nav {
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -1px 3px rgba(31, 41, 37, 0.08);
}

.nav-button,
.primary-button,
.secondary-button,
.danger-button,
.option-button,
.tab-button,
.icon-text-button {
  min-height: 48px;
  border-radius: 6px;
  font-weight: 650;
}

.nav-button {
  min-height: 52px;
  background: transparent;
  border-color: transparent;
}

.nav-button.active {
  background: var(--primary);
}

.primary-button {
  background: var(--primary);
  font-size: 16px;
}

.secondary-button {
  color: var(--primary-dark);
  background: var(--surface);
  border-color: var(--line);
  font-size: 16px;
}

.icon-text-button {
  color: var(--primary-dark);
  background: var(--surface-muted);
  border-color: var(--line);
  font-size: 16px;
}

.primary-button:disabled,
.secondary-button:disabled,
.option-button:disabled,
.icon-text-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.export-button {
  min-height: 44px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  white-space: nowrap;
}

.panel,
.card,
.question-panel,
.result-panel {
  border-color: var(--line);
  box-shadow: none;
}

.panel,
.question-panel,
.result-panel {
  padding: 16px;
}

.stack {
  gap: 16px;
}

.section-heading,
.subsection-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2,
.subsection-heading h3 {
  margin: 0;
}

.section-kicker {
  margin: 0 0 2px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 650;
}

.subsection-heading {
  padding-top: 4px;
}

.subsection-heading span,
.section-count,
.task-limit,
.control-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.section-count,
.task-limit,
.mode-label {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  white-space: nowrap;
}

.hero-panel {
  gap: 16px;
  padding: 20px 16px;
}

.hero-panel p {
  max-width: 680px;
  line-height: 1.65;
}

.start-test-button {
  width: 100%;
  min-height: 54px;
}

.stats-grid {
  gap: 0;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.stat-box {
  padding: 12px 8px 4px;
  background: transparent;
  border-radius: 0;
}

.stat-box:nth-child(even) {
  border-left: 1px solid var(--line);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
}

.stat-label {
  font-size: 14px;
}

.last-review-panel {
  margin-top: 0;
}

.last-round-line {
  padding: 12px 14px;
  background: var(--surface-muted);
  border-radius: 6px;
}

.review-words-grid {
  grid-template-columns: 1fr !important;
}

.question-panel,
.result-panel {
  width: min(100%, 760px);
  margin: 0 auto;
}

.active-test-panel {
  gap: 16px;
}

.question-meta {
  font-size: 15px;
}

.question-position {
  color: var(--text);
  font-weight: 650;
}

.timer {
  min-width: 58px;
  color: var(--accent);
  text-align: right;
}

.progress-dots {
  gap: 4px;
}

.dot {
  height: 5px;
}

.prompt {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
}

.option-button {
  min-height: 58px;
  border-color: var(--line);
  font-weight: 600;
}

.option-button.selected {
  color: #173e31;
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: inset 4px 0 0 var(--primary);
}

.question-progress-copy {
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.test-actions button {
  min-height: 50px;
}

.wrong-item {
  padding: 14px;
  background: var(--danger-soft);
  border-color: #efcaca;
}

.wrong-item strong {
  font-size: 18px;
}

.empty-state {
  background: transparent;
  border-color: var(--line);
}

.tabs {
  gap: 4px;
  padding: 4px;
  background: var(--surface-muted);
  border-radius: 8px;
}

.tab-button {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  font-size: 15px;
}

.tab-button.active {
  color: var(--primary-dark);
  background: var(--surface);
  border-color: var(--line);
}

.words-heading,
.library-heading {
  margin-bottom: 16px;
}

.card-list.words {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.card-list.words.phrase-grid {
  grid-template-columns: 1fr;
}

.word-card {
  display: grid;
  min-width: 0;
  min-height: 58px;
  align-content: center;
  padding: 12px;
  background: var(--surface);
}

.word-card h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.word-card.expanded {
  align-content: start;
  padding: 16px;
  background: #fbfdfc;
  border-color: #b9d2c8;
}

.word-card.expanded h3 {
  font-size: 21px;
}

.word-card p {
  overflow-wrap: break-word;
}

.forms-line {
  color: var(--accent) !important;
  font-weight: 650;
}

.badge {
  min-height: 26px;
  color: var(--muted);
  background: var(--surface-muted);
  border-color: transparent;
  font-weight: 600;
}

.badge.status-badge,
.badge.mastered {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.badge.weak,
.low-score-word {
  color: #75440b;
  background: var(--warning-soft);
  border-color: #efd6af;
}

.article-list {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.article-button {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  font-weight: 600;
}

.article-button:last-child {
  border-bottom: 0;
}

.article-order {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 6px;
  font-size: 14px;
}

.article-name {
  min-width: 0;
}

.article-arrow {
  color: var(--muted);
  font-size: 24px;
  font-weight: 400;
}

.local-calibration-switch {
  padding: 12px 14px;
  background: var(--surface-muted);
  border-color: var(--line);
  box-shadow: none;
}

.article-detail-view {
  justify-items: center;
}

.article-detail-view > * {
  width: min(100%, 720px);
}

.article-detail-header {
  gap: 12px;
  margin-bottom: 0;
}

.back-button {
  justify-self: start;
  width: auto;
  min-height: 44px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
}

.article-title-row h2 {
  font-size: 22px;
  overflow-wrap: break-word;
}

.article-audio {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-radius: 8px;
}

.article-reader {
  padding: 20px;
  border-color: var(--line);
  box-shadow: none;
  font-size: 18px;
  line-height: 1.9;
}

.article-sentence {
  margin-right: 1px;
  padding: 2px 3px;
  font-weight: 600;
  line-height: 1.85;
}

.article-sentence.active {
  background: var(--primary-soft);
}

.inline-structure,
.structure-slash {
  color: var(--accent);
  font-weight: 650;
}

.sentence-detail {
  background: var(--surface-muted);
  border-left-color: var(--primary);
}

.article-vocabulary {
  padding: 16px;
}

.library-vocab-list {
  gap: 0;
}

.library-vocab-card {
  padding: 12px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.library-vocab-word {
  font-weight: 650;
}

.readaloud-view {
  width: min(100%, 760px);
  margin: 0 auto;
}

.mode-label {
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-size: 14px;
  font-weight: 650;
}

.readaloud-progress {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.readaloud-progress div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.readaloud-progress span {
  color: var(--muted);
  font-size: 14px;
}

.readaloud-progress progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  accent-color: var(--primary);
}

.readaloud-progress progress::-webkit-progress-bar {
  background: var(--surface-muted);
  border-radius: 999px;
}

.readaloud-progress progress::-webkit-progress-value {
  background: var(--primary);
  border-radius: 999px;
}

.readaloud-card {
  gap: 10px;
  padding: 16px;
  border-left: 3px solid #c8d8d1;
}

.readaloud-card-head {
  align-items: center;
}

.readaloud-card-head .badge-row {
  margin-top: 0;
}

.sentence-number {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.readaloud-en {
  font-weight: 650;
  line-height: 1.6;
}

.readaloud-assessment {
  background: var(--surface-muted);
  border-color: transparent;
}

.readaloud-assessment.pending,
.article-summary-hero,
.assessment-level {
  background: var(--primary-soft);
  border-color: #c5dcd2;
}

.article-readaloud-summary {
  background: var(--surface);
  border-color: var(--line);
}

.assessment-score {
  border-color: var(--line);
}

.assessment-score strong,
.article-summary-hero strong {
  font-weight: 700;
}

.modal {
  border: 1px solid var(--line);
  box-shadow: 0 12px 36px rgba(31, 41, 37, 0.18);
}

@media (hover: hover) {
  .primary-button:not(:disabled):hover,
  .nav-button.active:hover {
    background: var(--primary-dark);
  }

  .secondary-button:not(:disabled):hover,
  .icon-text-button:not(:disabled):hover,
  .article-button:hover,
  .tab-button:not(.active):hover {
    background: var(--surface-muted);
  }

  .option-button:not(:disabled):hover {
    border-color: #aebbb5;
    background: #fbfdfc;
  }
}

@media (max-width: 520px) {
  .article-title-row {
    align-items: center;
    flex-direction: row;
    gap: 12px;
  }

  .article-title-row h2 {
    font-size: 20px;
  }

  .compact-button {
    flex: 0 0 auto;
    width: auto;
  }

  .back-button {
    min-height: 36px;
    padding: 5px 8px;
  }

  .readaloud-card-head {
    align-items: center;
    flex-direction: row;
  }

  .readaloud-status {
    justify-content: flex-end;
  }

  .subsection-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

@media (min-width: 720px) {
  .main-content {
    padding: 24px 22px 32px;
  }

  .panel,
  .question-panel,
  .result-panel {
    padding: 24px;
  }

  .stat-box {
    padding: 12px 14px 4px;
    border-left: 1px solid var(--line);
  }

  .stat-box:first-child {
    border-left: 0;
  }

  .card-list.words.word-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .card-list.words.phrase-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-vocab-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
  }
}

@media (min-width: 900px) {
  .app-shell {
    padding-bottom: 0;
  }

  .topbar-inner {
    grid-template-columns: auto minmax(300px, 1fr) auto;
    min-height: 76px;
    padding: 10px 0;
  }

  .bottom-nav {
    position: static;
    justify-self: center;
    width: min(100%, 420px);
    padding: 4px;
    background: var(--surface-muted);
    border: 0;
    border-radius: 8px;
    box-shadow: none;
  }

  .nav-button {
    min-height: 40px;
    font-size: 15px;
  }

  .nav-button.active {
    color: var(--primary-dark);
    background: var(--surface);
    border-color: var(--line);
  }

  .export-button {
    min-height: 40px;
  }

  .card-list.words.word-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .hero-panel {
    padding: 28px;
  }
}

@media (min-width: 1100px) {
  .card-list.words.word-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

/* Learning progress */
.bottom-nav {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.progress-view {
  display: grid;
  gap: 16px;
  padding-bottom: 8px;
}

.progress-hero {
  display: grid;
  gap: 18px;
  padding: 20px 16px;
  overflow: hidden;
  background: #f4faf6;
  border: 1px solid #cfe0d6;
}

.progress-hero h2 {
  margin-bottom: 8px;
  font-size: 22px;
}

.progress-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.progress-hero-summary,
.progress-overview-main,
.progress-scope-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.progress-hero-summary > div:not(.progress-ring) {
  display: grid;
  gap: 3px;
}

.progress-hero-summary strong {
  font-size: 25px;
  line-height: 1.15;
}

.progress-hero-summary span,
.progress-hero-summary em {
  color: var(--muted);
  font-size: 16px;
  font-style: normal;
  line-height: 1.4;
}

.progress-ring {
  --progress-value: 0;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 92px;
  aspect-ratio: 1;
  padding: 8px;
  background: conic-gradient(var(--primary) calc(var(--progress-value) * 1%), #dbe5df 0);
  border-radius: 50%;
}

.progress-ring > div {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 6px;
  background: var(--surface);
  border-radius: 50%;
  text-align: center;
}

.progress-ring strong {
  color: var(--primary-dark);
  font-size: 20px;
  line-height: 1;
}

.progress-ring span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.progress-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.progress-overview-grid {
  display: grid;
  gap: 14px;
}

.progress-overview-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.progress-overview-card.outside {
  border-top: 4px solid #246b53;
}

.progress-overview-card.school {
  border-top: 4px solid #8a5412;
}

.progress-overview-main h3,
.progress-scope-main h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.progress-overview-main p,
.progress-scope-main p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.progress-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.progress-status-item {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 6px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.progress-status-item:last-child {
  border-right: 0;
}

.progress-status-item strong {
  font-size: 20px;
  line-height: 1;
}

.progress-status-item span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.progress-status-item.mastered strong { color: #246b53; }
.progress-status-item.learning strong { color: #9a650d; }
.progress-status-item.review strong { color: #b34a27; }
.progress-status-item.new strong { color: #68756f; }

.progress-milestones {
  display: grid;
  gap: 7px;
}

.milestone-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.milestone {
  min-height: 30px;
  padding: 5px;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.milestone.reached {
  color: #1d5f47;
  background: #e6f1ec;
  border-color: #a9cdbb;
}

.progress-milestones p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.progress-collection-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid #246b53;
  border-radius: 8px;
}

.progress-collection-header.school {
  border-top-color: #8a5412;
}

.progress-collection-header h2 {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.28;
}

.progress-collection-header p:not(.section-kicker) {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.progress-collection-summary {
  display: grid;
  gap: 3px;
  min-width: 68px;
  color: var(--primary-dark);
  text-align: right;
}

.progress-collection-header.school .progress-collection-summary {
  color: #8a5412;
}

.progress-collection-summary strong {
  font-size: 25px;
  line-height: 1;
}

.progress-collection-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-scope-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.progress-scope-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid #246b53;
  border-radius: 8px;
  overflow: hidden;
}

.progress-scope-card.school {
  border-top-color: #8a5412;
}

.progress-scope-toggle {
  display: grid;
  align-content: start;
  gap: 11px;
  width: 100%;
  min-height: 212px;
  padding: 13px;
  color: var(--text);
  background: transparent;
  border: 0;
  text-align: left;
}

.progress-scope-toggle:hover {
  background: #f7faf8;
}

.progress-scope-card-topline,
.progress-scope-metrics,
.progress-scope-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.progress-scope-order {
  display: inline-grid;
  place-items: center;
  min-width: 25px;
  min-height: 25px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}

.progress-scope-card.school .progress-scope-order {
  color: #8a5412;
  background: #fff1d8;
}

.progress-scope-percent {
  color: var(--primary-dark);
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
}

.progress-scope-card.school .progress-scope-percent {
  color: #8a5412;
}

.progress-scope-main {
  min-width: 0;
}

.progress-scope-source {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.progress-scope-main h3 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: normal;
  word-break: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.progress-scope-bar {
  height: 7px;
  overflow: hidden;
  background: #dce7e1;
  border-radius: 999px;
}

.progress-scope-bar span {
  display: block;
  min-width: 0;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.progress-scope-card.school .progress-scope-bar {
  background: #f2e4cb;
}

.progress-scope-card.school .progress-scope-bar span {
  background: #a7671b;
}

.progress-scope-metrics {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.progress-scope-metrics span:last-child {
  text-align: right;
}

.progress-scope-footer {
  align-items: flex-start;
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.progress-scope-footer > span:first-child {
  flex: 1 1 auto;
}

.progress-scope-readaloud {
  flex: 0 0 auto;
  color: var(--primary-dark);
  font-weight: 800;
  white-space: nowrap;
}

.progress-details {
  display: grid;
  gap: 14px;
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.progress-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.progress-filter {
  min-height: 38px;
  padding: 7px 10px;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
}

.progress-filter:hover,
.progress-filter.active {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: #a8cbbb;
}

.progress-detail-view {
  gap: 16px;
}

.progress-detail-hero {
  display: grid;
  gap: 16px;
  padding: 18px 16px;
  border-top: 4px solid #246b53;
}

.progress-detail-hero.school {
  border-top-color: #8a5412;
}

.progress-detail-title h2 {
  margin: 0 0 7px;
  font-size: 22px;
  line-height: 1.32;
}

.progress-detail-title > p:not(.section-kicker) {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.progress-detail-summary {
  display: flex;
  gap: 14px;
  align-items: center;
}

.progress-detail-summary > div:not(.progress-ring) {
  display: grid;
  gap: 3px;
}

.progress-detail-summary strong {
  font-size: 25px;
  line-height: 1.15;
}

.progress-detail-summary span,
.progress-detail-summary em {
  color: var(--muted);
  font-size: 15px;
  font-style: normal;
  line-height: 1.4;
}

.progress-detail-readaloud {
  display: grid;
  gap: 7px;
  padding: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.article-readaloud-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 0;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.article-readaloud-progress span:first-child {
  color: var(--text);
}

.progress-detail-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.progress-detail-actions .primary-button,
.progress-detail-actions .secondary-button {
  width: 100%;
}

.progress-word-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.progress-word-card {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  min-height: 104px;
  padding: 11px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.progress-word-card:hover {
  border-color: #a7cabb;
}

.progress-word-card > strong {
  color: var(--primary-dark);
  font-size: 17px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.progress-word-card > span:not(.progress-word-status) {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.progress-word-status {
  justify-self: start;
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
}

.progress-word-card.mastered .progress-word-status { color: #1b5c43; background: #dff0e7; }
.progress-word-card.learning .progress-word-status { color: #84560b; background: #fff1cb; }
.progress-word-card.review .progress-word-status { color: #983c1d; background: #ffe5da; }
.progress-word-card.new .progress-word-status { color: #5f6c66; background: #e5e9e7; }

.progress-word-card.expanded {
  grid-column: 1 / -1;
  background: #fff;
  border-color: #aacbbb;
}

.progress-word-card.expanded > strong {
  font-size: 21px;
}

.progress-word-card .icon-text-button {
  justify-self: start;
  margin-top: 4px;
}

.progress-grade-select {
  margin-bottom: 0;
}

@media (min-width: 620px) {
  .progress-overview-grid,
  .progress-scope-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .progress-word-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 720px) {
  .progress-scope-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .bottom-nav {
    width: min(100%, 560px);
  }

  .progress-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 26px;
  }

  .progress-hero > .progress-status-grid,
  .progress-hero > .progress-milestones {
    grid-column: 1 / -1;
  }

  .progress-scope-list { gap: 14px; }

  .progress-collection-header {
    padding: 22px;
  }

  .progress-detail-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 24px;
  }

  .progress-detail-hero > .progress-status-grid,
  .progress-detail-hero > .progress-milestones,
  .progress-detail-hero > .progress-detail-readaloud,
  .progress-detail-hero > .progress-detail-actions {
    grid-column: 1 / -1;
  }

  .progress-word-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1120px) {
  .progress-scope-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 359px) {
  .progress-scope-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* R1B teacher desktop shell */
.teacher-dashboard.teacher-workspace {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  width: 100%;
  height: min(920px, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
  margin: auto 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(31, 41, 37, 0.14);
  transition: grid-template-columns 160ms ease;
}

.teacher-dashboard.teacher-workspace.teacher-sidebar-collapsed {
  grid-template-columns: 82px minmax(0, 1fr);
}

.teacher-workspace-sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 22px;
  padding: 18px 14px;
  overflow-y: auto;
  color: #f6fbf8;
  background: #173f33;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.teacher-sidebar-heading,
.teacher-workspace-brand,
.teacher-account-control,
.teacher-account-identity {
  display: flex;
  align-items: center;
}

.teacher-sidebar-heading {
  justify-content: space-between;
  gap: 10px;
}

.teacher-workspace-brand {
  min-width: 0;
  gap: 10px;
  font-weight: 800;
}

.teacher-brand-mark,
.teacher-account-mark,
.teacher-nav-symbol {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  font-weight: 800;
}

.teacher-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: #173f33;
  background: #d8eee4;
}

.teacher-brand-label,
.teacher-nav-label,
.teacher-sidebar-toggle-label {
  white-space: nowrap;
}

.teacher-sidebar-toggle {
  display: inline-flex;
  min-width: 36px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  color: inherit;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-weight: 700;
}

.teacher-workspace-nav {
  display: grid;
  align-content: start;
  gap: 7px;
  margin: 0;
}

.teacher-nav-item {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.teacher-nav-symbol {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  color: #d8eee4;
  background: rgba(255, 255, 255, 0.1);
}

.teacher-nav-item.active {
  color: #173f33;
  background: #edf7f2;
}

.teacher-nav-item.active .teacher-nav-symbol {
  color: #fff;
  background: var(--primary);
}

.teacher-sidebar-toggle:focus-visible,
.teacher-nav-item:focus-visible,
.teacher-account-logout:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

.teacher-sidebar-collapsed .teacher-sidebar-heading {
  flex-direction: column;
}

.teacher-sidebar-collapsed .teacher-brand-label,
.teacher-sidebar-collapsed .teacher-nav-label,
.teacher-sidebar-collapsed .teacher-sidebar-toggle-label {
  display: none;
}

.teacher-sidebar-collapsed .teacher-workspace-brand,
.teacher-sidebar-collapsed .teacher-nav-item {
  justify-content: center;
}

.teacher-sidebar-collapsed .teacher-nav-item {
  padding-inline: 8px;
}

.teacher-workspace-main {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.teacher-workspace-topbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 82px;
  padding: 15px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.teacher-page-identity h1,
.teacher-page-identity p {
  margin: 0;
}

.teacher-account-control {
  min-width: 0;
  gap: 9px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.teacher-account-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
}

.teacher-account-identity {
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
}

.teacher-account-identity strong,
.teacher-account-identity small {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-account-identity small { color: var(--muted); }

.teacher-account-logout {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #e5bcbc;
  border-radius: 7px;
  color: var(--danger);
  background: var(--surface);
  cursor: pointer;
  font-weight: 700;
}

.teacher-workspace-message,
.teacher-workspace-error {
  flex: 0 0 auto;
  margin: 14px 22px 0;
}

.teacher-workspace-error:empty { display: none; }

.teacher-workspace-content {
  display: grid;
  min-width: 0;
  min-height: 0;
  gap: 16px;
  padding: 20px 22px 24px;
  overflow: auto;
}

.teacher-workspace-content > .teacher-dashboard,
.teacher-workspace-content > .submission-dashboard {
  width: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: visible;
}

@media (max-width: 760px) {
  .teacher-dashboard.teacher-workspace,
  .teacher-dashboard.teacher-workspace.teacher-sidebar-collapsed {
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr);
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
  }

  .teacher-workspace-sidebar {
    gap: 10px;
    padding: 10px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .teacher-sidebar-heading { min-height: 34px; }
  .teacher-sidebar-toggle { display: none; }
  .teacher-workspace-nav { display: flex; overflow-x: auto; }
  .teacher-nav-item,
  .teacher-sidebar-collapsed .teacher-nav-item {
    min-width: 72px;
    flex: 1 0 72px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 6px;
    font-size: 12px;
    text-align: center;
  }

  .teacher-sidebar-collapsed .teacher-brand-label,
  .teacher-sidebar-collapsed .teacher-nav-label {
    display: inline;
  }

  .teacher-workspace-topbar {
    min-height: auto;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 12px 14px;
  }

  .teacher-account-control { margin-left: auto; }
  .teacher-account-identity small { display: none; }
  .teacher-workspace-content { padding: 14px; }
  .teacher-workspace-message,
  .teacher-workspace-error { margin-inline: 14px; }
  .teacher-workspace .teacher-filter-grid,
  .teacher-workspace .structured-import-form { grid-template-columns: minmax(0, 1fr); }
}

/* R1A student shell and mobile account reachability */
body.access-locked .access-overlay {
  display: flex;
  align-items: safe center;
  justify-content: center;
  overflow-y: auto;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}

.account-card {
  width: min(100%, 460px);
  margin: auto 0;
}

.student-account-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.student-account-tools h3 {
  grid-column: 1 / -1;
  margin: 0;
}

.topbar-inner {
  grid-template-columns: minmax(0, 1fr) auto;
}

.account-entry:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 76px;
  max-width: min(46vw, 220px);
  min-height: 44px;
  padding: 8px 10px;
  overflow: hidden;
  white-space: nowrap;
}

.account-entry-label {
  flex: 0 0 auto;
  font-weight: 750;
}

.account-summary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 420px) {
  .student-account-tools {
    grid-template-columns: minmax(0, 1fr);
  }

  .student-account-tools h3 {
    grid-column: auto;
  }
}

@media (max-width: 359px) {
  .topbar-inner {
    min-height: 64px;
    padding-inline: 10px;
  }

  .account-entry:not([hidden]) {
    min-width: 64px;
    max-width: 78px;
    padding-inline: 8px;
  }

  .account-summary {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .bottom-nav {
    gap: 2px;
    padding-inline: 4px;
  }

  .nav-button {
    min-width: 0;
    padding-inline: 2px;
    font-size: 14px;
  }
}

@media (min-width: 900px) {
  .app-shell {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .topbar-inner {
    width: min(100%, 960px);
    padding-inline: 16px;
  }

  .bottom-nav {
    position: fixed;
    right: auto;
    bottom: 0;
    left: 50%;
    width: min(100%, 720px);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -1px 3px rgba(31, 41, 37, 0.08);
  }

  .nav-button {
    min-height: 48px;
  }

  .nav-button.active {
    color: #fff;
    background: var(--primary);
    border-color: transparent;
  }
}

/* Managed Read Aloud keeps the existing Resource detail and calibration styles. */
.managed-read-aloud-editor { display: grid; gap: 1rem; }
.managed-authoring-fields { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 1rem; }
.managed-authoring-fields > label, .managed-authoring-fields .readaloud-card > label { display: grid; gap: .5rem; }
.managed-authoring-fields textarea { width: 100%; resize: vertical; }
.managed-authoring-fields .readaloud-card { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.managed-authoring-fields .waveform-bars { gap: 0; }
.managed-authoring-fields .waveform-bar { min-width: 0; }
.managed-authoring-fields:disabled { opacity: .72; }
.managed-readiness { overflow-wrap: anywhere; }
.managed-read-aloud-editor small { font-size: .7em; overflow-wrap: anywhere; }

/* R6D2: Library views organize the existing Category tree. */
.library-lanes { display: flex; flex-wrap: wrap; gap: 12px; }
.library-category { margin: 12px 0; padding: 0 0 0 16px; border-left: 2px solid var(--line, #dce4e8); }
.library-category > summary { cursor: pointer; padding: 10px 0; font-weight: 700; }
.library-category .student-resource-card { margin: 10px 0; }
.legacy-library { margin-top: 24px; }
.legacy-library > summary { cursor: pointer; font-weight: 700; }

/* R7B: compact learning help and page switching. */
.teacher-page-identity:has(.learning-help) { position: relative; }
.learning-help { display: inline-block; }
.learning-help summary { cursor: pointer; border: 1px solid currentColor; border-radius: 50%; width: 1.5em; text-align: center; }
.learning-help p { max-width: 36rem; font-size: .9rem; }
[data-learning-page-context] nav { display: flex; flex-wrap: wrap; gap: .5rem; }
[data-plan-preview] td { white-space: normal; }
.teacher-page-identity:has(.learning-help) h1 { display: inline-block; margin-right: .5rem; }

/* Four independent vocabulary scopes. */
.progress-library-button {
  display: grid;
  grid-template-columns: minmax(5em, 1fr) minmax(5em, 3fr) minmax(7em, 1fr);
  gap: 12px;
  align-items: center;
  padding: 16px;
  color: inherit;
  background: transparent;
  border: 1px solid #dce4e8;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
}
.progress-library-button progress { width: 100%; accent-color: #267d74; }
.special-test-setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.special-test-setup select { padding: 8px; margin: 8px; }
.special-test input { max-width: 100%; }
@media (max-width: 520px) {
  .progress-library-button { grid-template-columns: 1fr; gap: 8px; }
}

/* FR3: the teacher workspace occupies the browser viewport. */
body.access-locked .access-overlay:has([data-teacher-workspace]) { padding: 0; overflow: hidden; }
.teacher-dashboard.teacher-workspace {
  width: 100%; max-width: none; height: 100dvh; max-height: 100dvh;
  margin: 0; border: 0; border-radius: 0; box-shadow: none;
}
.assignment-date-navigation { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.assignment-date-navigation label { display: grid; gap: 6px; }
[data-auth-form="daily-assignment"], [data-auth-form="plan-date"] { align-items: stretch; flex-direction: column; }
[data-auth-form="daily-assignment"] > *, [data-auth-form="plan-date"] > * { max-width: 100%; }

/* Teacher learning status: current libraries adapt to the available width. */
.teacher-vocabulary-progress { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 16px; padding: 16px 0; }
.teacher-vocabulary-progress progress { width: 100%; accent-color: var(--accent, #19856c); }
[data-weak-library] li { margin: 6px 0; }
nav[aria-label="学生学习详情"] { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
nav[aria-label="学生学习详情"] [aria-current="page"] button { font-weight: 700; outline: 2px solid #19856c; }

.teacher-learning-overview td { vertical-align: top; }
.teacher-learning-overview td:first-child { padding-top: 28px; }
.learning-help { position: relative; vertical-align: middle; }
.learning-help summary { display: grid; place-items: center; width: 1.6em; height: 1.6em; line-height: 1; list-style: none; }
.learning-help summary::-webkit-details-marker { display: none; }
.learning-help p { position: absolute; top: 100%; left: 0; z-index: 5; width: min(30rem, 65vw); padding: 12px; background: #fff; border: 1px solid #dbe4df; border-radius: 8px; box-shadow: 0 4px 16px #0002; }

/* FR5A: lifecycle folders and explicit object menus. */
.resource-folder-row { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 10px; border-bottom: 1px solid #e2e8f0; }
.resource-open, .resource-breadcrumb button { border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit; overflow-wrap: anywhere; }
.resource-open:hover, .resource-breadcrumb button:hover { color: #2563eb; text-decoration: underline; }
.resource-breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.resource-context-menu { min-width: 42px; }
.resource-context-menu > summary { cursor: pointer; list-style: none; text-align: center; font-size: 24px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 0 12px; }
.resource-context-actions { display: grid; gap: 4px; padding: 8px; min-width: 130px; border: 1px solid #cbd5e1; border-radius: 8px; background: white; }
.resource-context-actions button { cursor: pointer; background: transparent; border: 0; padding: 8px; text-align: left; font: inherit; }
.resource-context-actions button:hover { background: #eff6ff; }
.resource-context-actions button:disabled { opacity: .45; cursor: default; }
.teacher-resource-browser > *, .resource-folder-contents { min-width: 0; }

/* Student-centered resource permissions. */
.permission-tree details { margin: 0.6rem 0; }
.permission-tree summary { cursor: pointer; padding: 0.5rem; font-weight: 600; }
.permission-branch { margin-left: 1.25rem; padding-left: 0.75rem; border-left: 1px solid #d9e2ec; }
.permission-tree .checkbox-row { padding: 0.5rem; }
.permission-tree small { margin-left: 0.5rem; color: #52667a; }

/* Repair 6: keep all grammatical positions and the active clock visible. */
.irregular-normal-test { gap: 12px; }
.irregular-normal-test p, .irregular-normal-test h2 { margin: 0; }
.irregular-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; font-weight: 700; }
.irregular-status [role="timer"] { color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.irregular-positions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.irregular-positions > div { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.irregular-positions label { display: block; margin-top: 6px; }
.irregular-positions .answer-input { min-height: 44px; padding: 8px 10px; }
.irregular-positions .answer-input:disabled { background: #f3f5f4; color: var(--muted); }
@media (max-width: 600px) {
  .irregular-positions { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .irregular-normal-test { gap: 8px; }
}

/* Repair 9: free-test overview; configuration stays inside each type. */
.free-practice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.free-practice-entry { display: grid; gap: 8px; padding: 18px; border: 1px solid var(--border, #d8e3e6); border-radius: 14px; color: inherit; text-decoration: none; background: var(--surface, #fff); }
.free-practice-entry strong { font-size: 1.1rem; }
.free-practice-entry span { line-height: 1.6; }
.free-practice-entry:hover { border-color: currentColor; }
.free-practice-entry:focus-visible { outline: 3px solid #277c85; outline-offset: 3px; }

/* The three-form chain is the single irregular browsing/playback control. */
.irregular-group-playback {
  display: block; width: 100%; padding: 12px 0; border: 0;
  background: transparent; color: inherit; text-align: left;
  font: inherit; font-size: 1.2rem; font-weight: 700; cursor: pointer;
}
.irregular-group-playback:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

/* A family is one browsing and playback unit; layout never changes node order. */
.family-card { padding: 14px; }
.family-open { display: block; width: 100%; border: 0; padding: 12px 0; background: transparent; color: inherit; text-align: left; font: inherit; font-weight: 700; font-size: 1.2rem; cursor: pointer; }
.family-chain { font-size: 15px; line-height: 30px; }
.family-node { display: inline-block; max-width: 100%; vertical-align: top; overflow-wrap: anywhere; }
.family-pos { color: var(--muted, #596a64); font-size: 0.85em; }
.family-controls { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.family-controls button { font: inherit; cursor: pointer; }
.family-controls [hidden] { display: none; }
@media (max-width: 600px) {
  .family-card.family-expanded { grid-column: 1 / -1; }
  .family-chain:not(.family-chain-full) { max-height: 60px; overflow: hidden; }
  .family-chain { font-size: 14px; }
}

/* Teacher vocabulary management uses the existing resource workspace. */
.vm-management { max-width: 1120px; margin: 0 auto; }
.vm-management fieldset, .vm-target, .vm-placement { border: 1px solid #d7e1e7; border-radius: 12px; padding: 1rem; margin: 1rem 0; }
.vm-management dl { display: grid; grid-template-columns: minmax(100px, 180px) 1fr; gap: .5rem 1rem; }
.vm-management dt { color: #5f6c79; }
.vm-management dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.vm-management button { margin: .3rem; }
.vm-items { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; }
.vm-management [data-vm-error] { color: #a12727; }
.vm-management [data-vm-confirmation] { border: 2px solid #238378; }
.vm-management label { display: grid; gap: .3rem; }
@media (max-width: 600px) { .vm-management dl { grid-template-columns: 1fr; } }
/* Visible primary destinations share the available width. */
.bottom-nav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
/* Learning status: reserve most of each student row for a variable number of libraries. */
.teacher-learning-overview .student-table { min-width: 0; table-layout: fixed; }
.teacher-learning-overview th:first-child { width: 20%; }
@media (max-width: 600px) {
  .teacher-learning-overview th:first-child { width: 30%; }
  .teacher-learning-overview .teacher-vocabulary-progress { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
}

/* Assignment authoring uses the existing workspace buttons at every width. */
.assignment-confirm-dialog {
  width: min(440px, calc(100vw - 32px));
  box-sizing: border-box;
  border: 1px solid #c4d1cb;
  border-radius: 14px;
  padding: 24px;
  color: #183d32;
  box-shadow: 0 16px 60px #16392f30;
}
.assignment-confirm-dialog::backdrop { background: #102e2455; }
.assignment-confirm-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
[data-plan-students], [data-assignment-read-aloud] { display: grid; gap: 10px; }
[data-plan-students] .checkbox-row, [data-assignment-read-aloud] .checkbox-row { display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
[data-assigned-rows] p { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
