/* ═══ RESET & BASE ══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:     #0f766e;
  --primary-lt:  #ccfbf1;
  --primary-dk:  #0d5f58;
  --accent:      #f59e0b;
  --danger:      #ef4444;
  --danger-lt:   #fee2e2;
  --success:     #22c55e;
  --success-lt:  #dcfce7;
  --warning:     #f59e0b;
  --warning-lt:  #fef3c7;
  --gray-50:     #f9fafb;
  --gray-100:    #f3f4f6;
  --gray-200:    #e5e7eb;
  --gray-400:    #9ca3af;
  --gray-600:    #4b5563;
  --gray-800:    #1f2937;
  --header-h:    60px;
  --radius:      12px;
  --shadow:      0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ═══ HEADER ══════════════════════════════════════════════════════════════════ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: var(--shadow);
}

.app-header.hidden { display: none; }

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
}

.header-logo { font-size: 22px; }

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-student-name {
  font-weight: 600;
  font-size: 13px;
}

.header-class-name {
  font-size: 12px;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 2px 10px;
  border-radius: 99px;
}

.btn-logout {
  background: none;
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-logout:hover { background: var(--danger-lt); border-color: var(--danger); color: var(--danger); }

/* ═══ MAIN CONTAINER ══════════════════════════════════════════════════════════ */
#app {
  min-height: 100vh;
}

#app.with-header {
  padding-top: var(--header-h);
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 28px 20px;
}

.container-wide {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 20px;
}

/* ═══ LOADING ══════════════════════════════════════════════════════════════════ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 12px;
  color: var(--gray-400);
}

.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ═══ LOGIN PAGE ══════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ccfbf1 50%, #f0fdf4 100%);
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
}

.login-logo-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

.login-logo-sub {
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 2px;
}

.login-error {
  background: var(--danger-lt);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }

/* ═══ FORM ELEMENTS ══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  color: var(--gray-800);
  background: #fff;
  transition: border-color .15s;
  outline: none;
}

.form-input:focus { border-color: var(--primary); }
.form-input::placeholder { color: var(--gray-400); }

.form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  color: var(--gray-800);
  background: #fff;
  transition: border-color .15s;
  outline: none;
  resize: vertical;
  min-height: 240px;
  line-height: 1.7;
  font-family: inherit;
}

.form-textarea:focus { border-color: var(--primary); }

.form-hint {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* ═══ BUTTONS ════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  justify-content: center;
}
.btn-primary:hover { background: var(--primary-dk); }
.btn-primary:disabled { opacity: .7; cursor: not-allowed; }

.btn-outline {
  background: #fff;
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
  width: auto;
}
.btn-outline:hover { background: var(--gray-100); }

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-600);
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 16px;
  transition: color .15s;
}
.btn-back:hover { color: var(--primary); }

.btn-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}

/* ═══ TOAST ══════════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  animation: slideIn .25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  max-width: 320px;
}

.toast-success { background: #1a1a2e; color: #fff; }
.toast-error   { background: var(--danger); color: #fff; }
.toast-info    { background: var(--primary); color: #fff; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ═══ PAGE HEADER ════════════════════════════════════════════════════════════ */
.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--gray-400);
}

/* ═══ SKILL BADGES ═══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}

.badge-reading   { background: #dbeafe; color: #1d4ed8; }
.badge-listening { background: #fce7f3; color: #be185d; }
.badge-writing   { background: #fef9c3; color: #854d0e; }
.badge-speaking  { background: #f0fdf4; color: #166534; }
.badge-done      { background: var(--success-lt); color: #166534; }
.badge-pending   { background: var(--gray-100); color: var(--gray-600); }
.badge-overdue   { background: var(--danger-lt); color: var(--danger); }

/* ═══ ASSIGNMENT LIST ════════════════════════════════════════════════════════ */
.assignment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assignment-card {
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}

.assignment-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.assignment-card.done {
  border-color: var(--gray-200);
  opacity: .85;
}

.assignment-card-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.assignment-card-body {
  flex: 1;
  min-width: 0;
}

.assignment-card-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.assignment-card-deadline {
  font-size: 12px;
  color: var(--gray-400);
}

.assignment-card-deadline.overdue {
  color: var(--danger);
  font-weight: 600;
}

.assignment-card-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.score-pill {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}

.score-label {
  font-size: 10px;
  color: var(--gray-400);
  text-align: right;
}

/* ═══ ASSIGNMENT PAGE ════════════════════════════════════════════════════════ */
.assignment-page {
  padding-top: var(--header-h);
}

.assignment-toolbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: var(--header-h);
  z-index: 50;
}

.assignment-toolbar-title {
  font-weight: 700;
  font-size: 15px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assignment-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  height: calc(100vh - var(--header-h) - 53px);
}

.content-pane {
  overflow-y: auto;
  padding: 24px;
  border-right: 1px solid var(--gray-200);
}

.answer-pane {
  overflow-y: auto;
  padding: 24px;
  background: var(--gray-50);
}

/* Single column layout for writing/speaking */
.assignment-content.single-col {
  grid-template-columns: 1fr;
  height: auto;
}

.assignment-content.single-col .content-pane {
  border-right: none;
  border-bottom: 1px solid var(--gray-200);
  max-height: 40vh;
}

.assignment-content.single-col .answer-pane {
  min-height: 50vh;
}

/* Reading/Listening full text */
.reading-text {
  font-size: 14px;
  line-height: 1.9;
  color: var(--gray-800);
  white-space: pre-wrap;
  font-family: Georgia, 'Times New Roman', serif;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-400);
  margin-bottom: 16px;
}

/* ═══ AUDIO PLAYER ═══════════════════════════════════════════════════════════ */
.audio-player-box {
  background: var(--primary-lt);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.audio-player-icon { font-size: 24px; }

.audio-player-box audio {
  flex: 1;
  height: 36px;
}

/* ═══ ANSWER GRID ════════════════════════════════════════════════════════════ */
.answer-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answer-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.q-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-400);
  width: 30px;
  flex-shrink: 0;
}

.answer-input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}

.answer-input:focus { border-color: var(--primary); }
.answer-input.correct { border-color: var(--success); background: var(--success-lt); }
.answer-input.wrong   { border-color: var(--danger); background: var(--danger-lt); }

/* ═══ WRITING AREA ═══════════════════════════════════════════════════════════ */
.prompt-box {
  background: var(--primary-lt);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  border-left: 4px solid var(--primary);
}

.word-count {
  text-align: right;
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 6px;
}

.word-count.warning { color: var(--warning); }
.word-count.ok      { color: var(--success); }

/* ═══ SPEAKING AREA ══════════════════════════════════════════════════════════ */
.cue-card {
  background: linear-gradient(135deg, #f0fdf4, #ccfbf1);
  border: 1.5px solid var(--primary-lt);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.recorder-area {
  background: #fff;
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 16px;
  transition: border-color .15s;
}

.recorder-area.recording {
  border-color: var(--danger);
  background: var(--danger-lt);
}

.recorder-area.has-audio {
  border-color: var(--success);
  background: var(--success-lt);
}

.record-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 99px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 12px;
}

.record-btn.idle { background: var(--primary); color: #fff; }
.record-btn.idle:hover { background: var(--primary-dk); }
.record-btn.recording-active { background: var(--danger); color: #fff; animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .7; }
}

.record-timer {
  font-size: 20px;
  font-weight: 800;
  color: var(--danger);
  margin-bottom: 8px;
  display: none;
}

.recorder-area.recording .record-timer { display: block; }

.audio-preview {
  margin-top: 12px;
}

.audio-preview audio {
  width: 100%;
  border-radius: 8px;
}

.recorder-hint {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 8px;
}

.upload-link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  font-size: 12px;
}

/* ═══ SUBMIT BAR ══════════════════════════════════════════════════════════════ */
.submit-bar {
  padding: 16px 24px;
  background: #fff;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  bottom: 0;
}

.submit-bar-info {
  font-size: 12px;
  color: var(--gray-400);
}

/* ═══ RESULT PAGE ════════════════════════════════════════════════════════════ */
.result-header {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  text-align: center;
}

.score-display {
  margin: 16px 0;
}

.score-number {
  font-size: 72px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.score-band {
  font-size: 14px;
  color: var(--gray-400);
  margin-top: 4px;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-800);
}

.stat-label {
  font-size: 11px;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.result-answers {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
}

.result-table th {
  background: var(--gray-50);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-400);
  font-weight: 600;
  border-bottom: 1px solid var(--gray-200);
}

.result-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}

.result-table tr:last-child td { border-bottom: none; }

.result-correct { color: var(--success); font-weight: 700; }
.result-wrong   { color: var(--danger);  font-weight: 700; }

.result-actions { text-align: right; white-space: nowrap; }
.btn-result-action {
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  margin-left: 4px;
  transition: all .15s;
}
.btn-result-action:hover { background: var(--gray-100); border-color: var(--gray-400); }

.explanation-row { background: var(--gray-50); }
.explanation-row.hidden { display: none; }
.explanation-content {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.6;
}
.explanation-label { font-weight: 700; margin-right: 6px; color: var(--gray-800); }

@keyframes locateFlash {
  0%, 60% { background: #fef08a; }
  100%     { background: transparent; }
}
.locate-flash {
  background: #fef08a;
  border-radius: 2px;
  animation: locateFlash 2.5s ease-out forwards;
}

.vocab-result-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.vocab-result-item {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}

.vocab-result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
}
.vocab-result-header:hover { background: var(--gray-50); }

.vocab-result-word {
  font-weight: 700;
  color: var(--primary-dk);
  flex: 1;
}

.vocab-result-toggle {
  font-size: 10px;
  color: var(--gray-400);
}

.vocab-result-detail {
  padding: 8px 12px 10px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}
.vocab-result-detail.hidden { display: none; }

.vocab-result-def {
  font-size: 13px;
  color: var(--gray-800);
  line-height: 1.5;
}

.vocab-result-example {
  font-size: 12px;
  color: var(--gray-400);
  font-style: italic;
  margin-top: 4px;
}

.pending-feedback {
  background: var(--warning-lt);
  border: 1.5px solid var(--warning);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 24px;
}

.pending-feedback-icon { font-size: 24px; flex-shrink: 0; }

.pending-feedback-text h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.pending-feedback-text p {
  font-size: 13px;
  color: var(--gray-600);
}

.submitted-content {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.8;
}

/* ═══ EMPTY STATE ════════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.empty-desc  { font-size: 13px; color: var(--gray-400); }

/* ═══ SECTION LABEL ══════════════════════════════════════════════════════════ */
.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-400);
  margin-bottom: 10px;
}

/* ═══ HEADER EXTRAS ══════════════════════════════════════════════════════════ */
.btn-switch-class {
  background: var(--primary-lt);
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-switch-class:hover { background: var(--primary); color: #fff; }

.btn-full { width: 100%; justify-content: center; }

/* ═══ CLASS SELECT PAGE ══════════════════════════════════════════════════════ */
.class-select-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ccfbf1 50%, #f0fdf4 100%);
}

.class-select-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  padding: 32px 28px;
  width: 100%;
  max-width: 420px;
}

.class-select-header {
  text-align: center;
  margin-bottom: 24px;
}

.class-select-avatar {
  font-size: 40px;
  margin-bottom: 10px;
}

.class-select-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.class-select-sub {
  font-size: 13px;
  color: var(--gray-400);
}

.class-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.class-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
  font-size: 14px;
}

.class-card:hover {
  border-color: var(--primary);
  background: var(--primary-lt);
}

.class-card-icon { font-size: 24px; flex-shrink: 0; }
.class-card-name { font-weight: 700; flex: 1; }
.class-card-arrow { font-size: 20px; color: var(--gray-400); }

/* ═══ RESPONSIVE ═════════════════════════════════════════════════════════════ */
@media (max-width: 680px) {
  .assignment-content {
    grid-template-columns: 1fr;
    height: auto;
  }
  .content-pane {
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
    max-height: 45vh;
  }
  .assignment-toolbar {
    padding: 10px 16px;
  }
  .container { padding: 20px 16px; }
  .login-card { padding: 28px 20px; }
  .result-stats { gap: 16px; }
  .score-number { font-size: 56px; }
  .header-class-name { display: none; }
}

/* ═══ WRITING FEEDBACK (graded view) ════════════════════════════════════════ */
.score-chip {
  background: var(--primary);
  color: #fff;
  border-radius: 99px;
  padding: 4px 14px;
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex-shrink: 0;
}
.score-chip-val  { font-size: 18px; font-weight: 800; }
.score-chip-label { font-size: 11px; opacity: .8; }

.feedback-ann-clickable {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.feedback-ann-clickable:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

@keyframes annFlash {
  0%, 50% { background: #fde68a; outline: 3px solid #f59e0b; border-radius: 2px; }
  100%     { background: #fef08a; outline: none; }
}
.ann-flash { animation: annFlash 1.5s ease-out forwards; }

.feedback-essay {
  position: relative;
}

.feedback-hint {
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #92400e;
  background: #fef3c7;
  padding: 2px 8px;
  border-radius: 99px;
  margin-left: 8px;
}

/* Annotation highlights (read-only, same visual as teacher) */
.ann-highlight {
  background: #fef08a;
  border-bottom: 2px solid #eab308;
  border-radius: 2px;
  padding: 1px 0;
  cursor: default;
}

.ann-marker {
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  background: #ca8a04;
  padding: 1px 4px;
  border-radius: 99px;
  margin-left: 2px;
  vertical-align: super;
  line-height: 1;
}

/* Overall feedback box */
.feedback-overall {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  border-left: 4px solid var(--primary);
  margin-bottom: 4px;
}

/* Per-annotation cards */
.feedback-annotations {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}

.feedback-ann-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  border-left: 3px solid #eab308;
}

.feedback-ann-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.feedback-ann-number {
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: #ca8a04;
  padding: 2px 7px;
  border-radius: 99px;
  flex-shrink: 0;
  margin-top: 1px;
}

.feedback-ann-quote {
  font-size: 12px;
  color: var(--gray-400);
  font-style: italic;
  line-height: 1.5;
}

.feedback-ann-comment {
  font-size: 14px;
  line-height: 1.7;
  color: var(--gray-800);
  white-space: pre-wrap;
}

/* ═══ HIGHLIGHT ══════════════════════════════════════════════════════════════ */
.student-highlight {
  color: #1f2937;
  cursor: pointer;
  border-radius: 2px;
  padding: 0 1px;
  transition: opacity .2s;
}
.student-highlight:hover { opacity: .7; }
.hl-yellow { background: #fef08a; border-bottom: 1.5px solid #eab308; }
.hl-green  { background: #bbf7d0; border-bottom: 1.5px solid #22c55e; }
.hl-blue   { background: #bfdbfe; border-bottom: 1.5px solid #3b82f6; }
.hl-pink   { background: #fbcfe8; border-bottom: 1.5px solid #ec4899; }

.highlight-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
}
.hl-label { font-size: 11px; color: var(--gray-400); margin-right: 2px; }
.hl-btn {
  background: none;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 3px;
  transition: all .15s;
}
.hl-btn:hover { background: var(--gray-100); }
.hl-btn-active { background: var(--gray-100); border-color: var(--gray-600); }
