:root {
  --primary: #667eea;
  --primary-dark: #5a6fd6;
  --secondary: #764ba2;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1a1a2e;
  --muted: #666;
  --border: #e8e8e8;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #f0ad4e;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  --touch: 44px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-size: 1.15rem;
  font-weight: 700;
}

.menu-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  min-height: var(--touch);
  min-width: var(--touch);
}

.nav-links {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-main {
  display: flex;
  align-items: flex-end;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-left: 0.85rem;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
}

.nav-group:first-child {
  padding-left: 0;
  border-left: none;
}

.nav-group-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.72;
  padding: 0 0.35rem;
  line-height: 1;
}

.nav-group-items {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav-group-active .nav-group-label {
  opacity: 1;
}

.nav-logout {
  margin-left: auto;
  align-self: center;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.92rem;
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.28);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  width: 100%;
}

.page-header {
  margin-bottom: 1.25rem;
}

.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.page-header-row h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  padding: 1rem;
  overflow-y: auto;
  align-items: flex-start;
  justify-content: center;
}

.modal.open {
  display: flex;
}

body.modal-open {
  overflow: hidden;
}

.modal-dialog {
  width: 100%;
  max-width: 640px;
  margin: 1.5rem auto;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}

.modal-dialog.modal-lg {
  max-width: 800px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.modal-header h2 {
  font-size: 1.25rem;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  min-height: var(--touch);
  min-width: var(--touch);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.guide-intro {
  margin-bottom: 1rem;
}

.guide-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: min(60vh, 520px);
  overflow-y: auto;
  padding-right: 0.25rem;
}

.guide-section {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.guide-section:first-child {
  border-top: none;
  padding-top: 0;
}

.guide-section h3 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.guide-path {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.guide-steps {
  margin: 0.5rem 0 0 1.1rem;
  padding: 0;
}

.guide-steps li {
  margin-bottom: 0.35rem;
  line-height: 1.45;
}

.modal .searchable-select-list {
  z-index: 300;
}

.modal-dialog:has(.searchable-select) {
  overflow: visible;
}

.searchable-select {
  position: relative;
}

.searchable-multi-select .searchable-multi-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.searchable-multi-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--text);
  font-size: 0.875rem;
}

.searchable-multi-chip-remove {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
}

.searchable-multi-check {
  display: inline-block;
  width: 1rem;
  margin-right: 0.35rem;
  color: var(--primary);
  font-weight: 700;
}

.searchable-select-option {
  display: flex;
  align-items: flex-start;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
}

.searchable-select-input {
  width: 100%;
}

.searchable-select-list {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  top: calc(100% + 0.25rem);
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.searchable-select-option:hover,
.searchable-select-option.selected {
  background: rgba(37, 99, 235, 0.08);
}

.searchable-select-empty {
  padding: 0.55rem 0.85rem;
  color: var(--muted);
}

.level-hint {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.page-header h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
}

.subtitle {
  color: var(--muted);
  margin-top: 0.35rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.field {
  margin-bottom: 1rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font: inherit;
  min-height: var(--touch);
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.1rem;
  height: 1.1rem;
  min-height: auto;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
  flex-shrink: 0;
}

label.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin-bottom: 0;
  min-height: var(--touch);
}

.field-checkbox {
  display: flex;
  align-items: flex-end;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.btn,
button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem 1.2rem;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch);
  text-decoration: none;
}

.btn-primary,
button[type="submit"] {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
}

.btn-secondary {
  background: var(--primary);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  min-height: auto;
  padding: 0;
}

.btn:disabled,
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.85rem;
  color: var(--muted);
}

.mobile-cards {
  display: none;
}

.mobile-card {
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.mobile-card p {
  margin-bottom: 0.35rem;
}

.loading {
  text-align: center;
  padding: 2rem 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error {
  margin-top: 1rem;
  padding: 1rem;
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 8px;
  color: var(--danger);
}

.success {
  padding: 1rem;
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  color: #155724;
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary);
  color: white;
}

.badge-draft {
  background: var(--muted);
}

.badge-published {
  background: var(--success);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.script-content,
.reading-content {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 1.25rem;
  max-height: 400px;
  overflow-y: auto;
}

.reading-content p {
  margin-bottom: 1rem;
  text-align: justify;
}

.question-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.options-list {
  list-style: none;
}

.options-list li {
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.35rem;
  border-radius: 8px;
  background: white;
  border: 2px solid var(--border);
  cursor: pointer;
  min-height: var(--touch);
  display: flex;
  align-items: center;
}

.options-list li.selected {
  border-color: var(--primary);
  background: #eef1ff;
}

.options-list li.correct {
  background: #d4edda;
  border-color: var(--success);
}

.options-list li.incorrect {
  background: #f8d7da;
  border-color: var(--danger);
}

.timer {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--secondary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.stat-box {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.stat-box .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

.login-card h1 {
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-card .subtitle {
  text-align: center;
  margin-bottom: 1.5rem;
}

@media (min-width: 600px) {
  .field-row {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (min-width: 900px) {
  .field-row.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 0.75rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-main {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .nav-group {
    padding-left: 0;
    border-left: none;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .nav-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .nav-logout {
    margin-left: 0;
    align-self: stretch;
    justify-content: center;
  }

  .topbar-inner {
    flex-wrap: wrap;
  }

  .table-wrap {
    display: none;
  }

  .mobile-cards {
    display: block;
  }

  .assign-toolbar .toolbar-row {
    flex-direction: column;
  }

  .student-syllabus-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.assign-toolbar {
  margin-bottom: 1rem;
}

.toolbar-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.bulk-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.bulk-bar p {
  margin: 0;
  align-self: center;
}

.assign-table select {
  width: 100%;
  max-width: 240px;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  min-height: auto;
  font-size: 0.9rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.assign-card .field {
  margin-top: 0.75rem;
}

.student-syllabus-card {
  margin-bottom: 1rem;
}

.student-syllabus-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.student-syllabus-header h2 {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.student-syllabus-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.meta-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.module-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.module-chip-list li {
  padding: 0.45rem 0;
  border-top: 1px solid var(--border);
}

.module-chip-list li:first-child {
  border-top: none;
}

.chip {
  display: inline-block;
  background: rgba(102, 126, 234, 0.12);
  color: var(--primary-dark);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.35rem;
}

.level-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.level-option {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.level-option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(102, 126, 234, 0.06);
}

.level-option input {
  margin-top: 0.2rem;
}

.module-preview {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.module-preview h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.preview-level {
  margin-bottom: 0.75rem;
}

.preview-level ul {
  margin: 0.35rem 0 0 1.1rem;
}

.exam-modal-body {
  max-height: min(70vh, 640px);
  overflow-y: auto;
}

.exam-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.exam-edit-section {
  margin-bottom: 1rem;
  padding: 1rem;
}

.exam-edit-section h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.actions-cell {
  white-space: nowrap;
}

td.actions-cell {
  vertical-align: middle;
}

div.actions-cell,
.mobile-card .actions-cell {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

td.actions-cell > .btn-link + .btn-link,
td.actions-cell > .btn-link + .subtitle,
td.actions-cell > .btn-link + span {
  margin-left: 0.75rem;
}

td:has(.btn-link) {
  vertical-align: middle;
}

.badge-listening {
  background: #5a67d8;
}

.badge-reading {
  background: #805ad5;
}

.staff-note-preview {
  font-size: 0.88rem;
  color: var(--muted);
  cursor: help;
}

.staff-note-box {
  background: #fff8e6;
  border: 1px solid #f0d78a;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.staff-note-box strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.staff-note-box p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.exam-preview-section {
  margin-top: 1rem;
}

.exam-preview-section h4 {
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.exam-preview-passage {
  margin: 0.75rem 0;
  max-height: 180px;
}

.exam-preview-questions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.exam-preview-questions-title {
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.preview-options-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.preview-options-list li {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.preview-options-list li.correct-answer {
  border-color: var(--success);
  background: rgba(40, 167, 69, 0.08);
}

.answer-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--success);
  white-space: nowrap;
}

.field-hint {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.assignment-stats {
  margin: 1rem 0 1.25rem;
}

.assignment-groups {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.assignment-exam-group {
  padding: 0;
  overflow: hidden;
}

.assignment-exam-header {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(37, 99, 235, 0.04);
}

.assignment-exam-title {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.assignment-exam-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.assignment-exam-summary {
  margin: 0;
}

.assignment-students-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.assignment-student-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.assignment-student-row:last-child {
  border-bottom: none;
}

.assignment-student-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.assignment-student-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  text-align: right;
  flex-shrink: 0;
}

.assignment-score {
  font-weight: 600;
  font-size: 0.95rem;
}

.assignment-submitted {
  font-size: 0.8rem;
  color: var(--muted);
}

.badge.assignment-pending {
  background: #718096;
}

.access-form {
  max-width: 520px;
}

.result-history-row + .result-history-row {
  margin-top: 0.5rem;
}

@media (max-width: 640px) {
  .assignment-student-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .assignment-student-status {
    align-items: flex-start;
    text-align: left;
  }
}

.exam-assign-picker .field {
  margin-bottom: 0.75rem;
}

.exam-assign-picker .exam-level-filter {
  width: 100%;
}

.library-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0 0.75rem;
}

.library-section-header h3 {
  margin: 0;
  font-size: 1rem;
}

.library-question-edit,
.library-script-line {
  margin-bottom: 0.75rem;
  padding: 0.85rem;
}

.library-option-row {
  align-items: flex-end;
}

.syllabus-level-body {
  display: grid;
  gap: 1rem;
  padding: 1rem 1.1rem;
}

@media (min-width: 768px) {
  .syllabus-level-body {
    grid-template-columns: 1fr 1fr;
  }
}

.syllabus-level-section h4 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
}

.syllabus-students-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.syllabus-module-body {
  padding: 1rem 1.1rem;
}

.syllabus-module-body p {
  margin-bottom: 0.65rem;
}

.syllabus-content-preview {
  line-height: 1.45;
}

.syllabus-level-only-card {
  margin-top: 0.75rem;
}

.syllabus-students-list .assignment-student-row {
  padding: 0.75rem 0.9rem;
}

/* OTE Listening UI */
.listening-part-card {
  margin-bottom: 1.25rem;
}

.listening-instruction {
  margin-bottom: 0.75rem;
}

.picture-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.picture-option {
  display: block;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.picture-option.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.25);
}

.picture-option img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.picture-question-block {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.listening-notes {
  margin-top: 1rem;
  padding: 1rem;
}

.notes-example .notes-filled {
  background: var(--text);
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.notes-gap-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.75rem 0;
}

.notes-gap-btn {
  border: 1px solid var(--primary);
  background: white;
  color: var(--primary);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.notes-gap-btn.selected {
  background: var(--text);
  color: white;
  border-color: var(--text);
}

.matching-table {
  margin-top: 1rem;
}

.matching-header,
.matching-row {
  display: grid;
  grid-template-columns: repeat(3, 80px) 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.matching-header-cell {
  text-align: center;
  font-size: 0.8rem;
}

.matching-header-cell img {
  width: 48px;
  height: 48px;
  display: block;
  margin: 0 auto 0.25rem;
}

.matching-btn {
  border: 1px solid var(--primary);
  background: white;
  color: var(--primary);
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.matching-btn.selected {
  background: var(--text);
  color: white;
}

.matching-example .matching-btn {
  opacity: 0.85;
}

.matching-statement {
  padding-left: 0.5rem;
}

.listening-part-form h3 {
  margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
  .matching-header,
  .matching-row {
    grid-template-columns: 1fr;
  }
}

