/* Exam UI — CDI IELTS Simulator */
/* Split-screen Reading / Full-width Listening */

.exam-body {
  overflow: hidden;
  font-family: 'Inter', 'Plus Jakarta Sans', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.exam-body .noise,
.exam-body .grid-bg,
.exam-body .corner-bracket {
  display: none;
}

.hidden {
  display: none !important;
}

/* --- Intro --- */
.exam-intro {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.exam-intro-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.exam-intro-sub {
  margin: 0 0 2rem;
  font-size: 1rem;
  color: var(--color-text-muted);
}

.exam-intro-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  max-width: 20rem;
  margin-bottom: 1rem;
}

.exam-intro-field span {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.exam-intro-field input,
.exam-intro-field select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.exam-intro-field input:focus,
.exam-intro-field select:focus {
  outline: none;
  border-color: var(--color-accent);
}

.exam-intro .hero-cta {
  margin-top: 1.5rem;
}

/* --- Main --- */
.exam-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* --- Header (Timer Bar) --- */
.exam-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-bottom: 2px solid var(--color-border);
  background: var(--color-surface);
}

.exam-header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.exam-section-label {
  font-weight: 700;
  font-size: 1rem;
}

.exam-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.25rem;
}

.exam-timer.warning {
  color: #dc2626;
}

.exam-header-right {
  display: flex;
  gap: 0.5rem;
}

.exam-header-btn {
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.exam-header-btn:hover {
  background: var(--color-accent);
  color: var(--color-bg);
}

.exam-header-btn.active {
  background: var(--color-accent);
  color: var(--color-bg);
}

/* --- Content --- */
.exam-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.exam-section {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.exam-section.active {
  display: flex;
}

/* Listening: Full-width */
.exam-listening {
  flex-direction: column;
}

.exam-back-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
}

.exam-back-link:hover {
  color: var(--color-accent);
}

.exam-audio-panel {
  padding: 1rem 1.5rem;
  border-bottom: 2px solid var(--color-border);
  background: var(--color-surface);
}

.exam-audio-progress-wrap {
  margin-bottom: 0.75rem;
}

.exam-audio-progress {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-border);
  cursor: pointer;
}

.exam-audio-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--color-accent);
  border-radius: 50%;
  cursor: pointer;
}

.exam-audio-progress::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--color-accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.exam-audio-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.exam-audio-btn {
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.exam-audio-btn:hover {
  background: var(--color-accent);
  color: var(--color-bg);
}

.exam-audio-part {
  font-weight: 700;
  font-size: 1rem;
}

.exam-questions-area {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9375rem;
}

/* --- PDF-matching layout --- */
.exam-part {
  margin-bottom: 2.5rem;
}

.exam-part-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.exam-part-title {
  font-size: 1rem;
}

.exam-part-range {
  font-size: 0.9375rem;
}

.exam-part-instruction {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

/* Part 1: Enquiry Form */
.exam-form-title {
  text-align: center;
  margin-bottom: 1.5rem;
  font-weight: 700;
  line-height: 1.4;
}

.exam-form {
  max-width: 36rem;
}

.exam-form-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.exam-form-label {
  flex: 0 0 auto;
  min-width: 10rem;
}

.exam-form-static {
  flex: 1;
}

.exam-form-row-note .exam-form-label {
  min-width: 16rem;
}

.exam-form-input-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.exam-form-input-wrap input {
  flex: 0 1 12rem;
  min-width: 6rem;
}

/* Part 2 & 3: MCQ blocks */
.exam-question-block {
  margin-bottom: 2rem;
}

.exam-subheader {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.exam-topic {
  text-align: center;
  margin-bottom: 1rem;
  font-weight: 700;
}

.exam-mcq {
  margin-bottom: 1.25rem;
}

.exam-mcq-question {
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.exam-mcq-num {
  font-weight: 700;
  margin-right: 0.25rem;
}

.exam-mcq-options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-left: 1.5rem;
}

.exam-mcq-options .exam-question-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}

.exam-mcq-options .exam-question-option input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

/* Highlight box */
.exam-highlight-box {
  border: 2px solid var(--color-border);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  max-width: 24rem;
}

.exam-highlight-title {
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.exam-highlight-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 2rem;
  font-size: 0.875rem;
}

/* Tea Parties table */
.exam-tea-parties {
  margin-top: 1rem;
}

.exam-tea-title {
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.exam-tea-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.exam-tea-num {
  flex: 0 0 2rem;
  font-weight: 700;
}

.exam-tea-name {
  flex: 0 0 12rem;
}

.exam-tea-row input {
  flex: 0 1 8rem;
  min-width: 5rem;
}

/* Part 3: Two-letter questions */
.exam-twoletter-question {
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.exam-twoletter-options {
  margin-bottom: 0.75rem;
  margin-left: 1rem;
}

.exam-twoletter-options > div {
  margin-bottom: 0.25rem;
}

.exam-twoletter-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.exam-twoletter-row input {
  flex: 0 1 6rem;
  min-width: 4rem;
}

/* Part 4: Notes */
.exam-notes-title {
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
}

.exam-notes {
  line-height: 1.6;
}

.exam-notes p {
  margin: 0 0 0.5rem;
}

.exam-notes-bullet {
  padding-left: 1rem;
}

.exam-notes-inline {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.exam-notes-input {
  flex: 0 1 10rem;
  min-width: 5rem;
  max-width: 12rem;
}


/* --- Questions --- */
.exam-questions {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.exam-question {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.exam-question:last-child {
  border-bottom: none;
}

.exam-question-label {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.exam-question-input {
  padding: 0.35rem 0.5rem;
  font-family: inherit;
  font-size: 0.9375rem;
  border: 1px solid var(--color-border);
  border-bottom: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.exam-form .exam-question-input,
.exam-tea-row .exam-question-input,
.exam-twoletter-row .exam-question-input {
  max-width: 20rem;
}

.exam-question-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.exam-question-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.exam-question-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}

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

.exam-navigator {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.exam-nav-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.exam-nav-btn:hover {
  background: var(--color-accent);
  color: var(--color-bg);
}

.exam-nav-btn.answered {
  background: var(--color-accent);
  color: var(--color-bg);
}

.exam-finish-btn {
  padding: 0.5rem 1.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  border: 2px solid var(--color-border);
  background: var(--color-cta-bg);
  color: var(--color-cta-text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.exam-finish-btn:hover {
  background: var(--color-cta-text);
  color: var(--color-cta-bg);
}

/* --- Modal --- */
.exam-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}

.exam-modal-content {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  padding: 2rem;
  max-width: 24rem;
}

.exam-modal-content h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.exam-modal-content p {
  margin: 0 0 1.5rem;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.exam-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.exam-modal-btn {
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.exam-modal-btn.primary {
  background: var(--color-cta-bg);
  color: var(--color-cta-text);
}

.exam-modal-btn.primary:hover {
  background: var(--color-cta-text);
  color: var(--color-cta-bg);
}

/* --- Header extras --- */
.exam-logo {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--color-text-muted);
}

.exam-header-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.exam-timer-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.exam-timer-toggle {
  padding: 0.25rem 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.exam-timer-toggle:hover {
  background: var(--color-accent);
  color: var(--color-bg);
}

.exam-header-icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  position: relative;
}

.exam-header-icon-btn:hover {
  background: var(--color-accent);
  color: var(--color-bg);
  transform: scale(1.05);
}

.exam-header-icon-btn .theme-icon {
  position: absolute;
  transition: opacity 0.2s;
}

.exam-header-icon-btn .theme-icon.moon {
  display: none;
}

[data-theme='dark'] .exam-header-icon-btn .theme-icon.sun {
  display: none;
}

[data-theme='dark'] .exam-header-icon-btn .theme-icon.moon {
  display: inline;
}

/* --- Section Nav Buttons --- */
.exam-next-section-btn,
.exam-prev-section-btn {
  padding: 0.5rem 1.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  border: 2px solid var(--color-border);
  background: var(--color-cta-bg);
  color: var(--color-cta-text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.exam-next-section-btn:hover,
.exam-prev-section-btn:hover {
  background: var(--color-cta-text);
  color: var(--color-cta-bg);
  transform: translateY(-1px);
}

.exam-prev-section-btn {
  background: var(--color-surface);
  color: var(--color-text);
}

.exam-prev-section-btn:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

/* --- Intro Email --- */
.exam-intro-email {
  margin-top: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.8125rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.02em;
  color: #86efac;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(134, 239, 172, 0.35);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.exam-intro-email strong {
  color: #bbf7d0;
  font-weight: 700;
}

/* --- Footer Layout --- */
.exam-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  border-top: 2px solid var(--color-border);
  background: var(--color-surface);
  gap: 1rem;
}

.exam-footer-left,
.exam-footer-right {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.exam-footer-left {
  min-width: 5rem;
}

.exam-footer-right {
  min-width: 8rem;
  justify-content: flex-end;
}

/* --- Reading Section --- */

/* Reading Tabs */
.reading-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  background: var(--color-surface);
  padding: 0 1rem;
}

.reading-tab {
  padding: 0.625rem 1.25rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.reading-tab:hover {
  color: var(--color-text);
}

.reading-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

/* Highlight Toolbar */
.reading-highlight-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.75rem;
}

.highlight-label {
  font-weight: 600;
  color: var(--color-text-muted);
  margin-right: 0.25rem;
}

.highlight-btn {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--color-border);
  cursor: pointer;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, box-shadow 0.1s;
}

.highlight-btn:hover {
  transform: scale(1.1);
}

.highlight-btn.active {
  box-shadow: 0 0 0 2px var(--color-accent);
}

.highlight-yellow {
  background: #fef08a;
  color: #713f12;
}

.highlight-green {
  background: #bbf7d0;
  color: #14532d;
}

.highlight-pink {
  background: #fecdd3;
  color: #881337;
}

.highlight-clear {
  background: var(--color-surface);
  color: var(--color-text-muted);
}

/* Reading Split */
.exam-reading-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.exam-reading-passage {
  overflow: auto;
  padding: 1.5rem;
  font-size: 0.9375rem;
  line-height: 1.8;
  border-right: 2px solid var(--color-border);
}

.exam-reading-passage p {
  margin: 0 0 1rem;
}

.reading-passage-title {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0 0 1rem;
  text-align: center;
}

.reading-divider {
  border: none;
  border-top: 2px solid var(--color-border);
  margin: 2rem 0;
}

.exam-reading-questions-panel {
  overflow: auto;
  padding: 1.5rem;
}

.reading-q-heading {
  font-size: 1rem;
  font-weight: 800;
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-border);
}

.reading-q-heading:first-child {
  margin-top: 0;
}

.reading-options-list {
  margin: 0.5rem 0 1rem 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.reading-options-list > div {
  margin-bottom: 0.2rem;
}

.reading-tfng-row {
  margin-bottom: 1.25rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.reading-tfng-text {
  margin-bottom: 0.625rem;
  line-height: 1.6;
  font-size: 0.9375rem;
}

.reading-tfng-options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tfng-option {
  cursor: pointer;
}

.tfng-option input[type="radio"] {
  display: none;
}

.tfng-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 2px solid var(--color-border);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
}

.tfng-badge:hover {
  border-color: var(--color-text-muted);
}

.tfng-option input[type="radio"]:checked + .tfng-true {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}

.tfng-option input[type="radio"]:checked + .tfng-false {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.tfng-option input[type="radio"]:checked + .tfng-ng {
  background: #6b7280;
  color: #fff;
  border-color: #6b7280;
}

/* Reading MCQ */
.reading-mcq {
  margin-bottom: 1.25rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.reading-mcq .exam-mcq-options {
  margin-top: 0.5rem;
}

.reading-passage-content.hidden,
.reading-questions-content.hidden {
  display: none;
}

/* Highlight styling for both passages and questions */
.exam-reading-passage mark,
.exam-reading-questions-panel mark {
  padding: 1px 2px;
  border-radius: 2px;
  transition: background-color 0.15s;
}

/* Inline blanks styling */
.inline-text-block {
  line-height: 2.2;
  font-size: 0.9375rem;
}

.inline-blank-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0 2px;
  vertical-align: baseline;
}

.inline-blank-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-accent);
  min-width: 1.1em;
  text-align: right;
}

.inline-blank {
  display: inline-block;
  width: 70px;
  padding: 2px 4px;
  border: none;
  border-bottom: 1.5px solid var(--color-text);
  background: transparent;
  font-family: inherit;
  font-size: 0.875em;
  text-align: center;
  color: var(--color-text);
  transition: border-color 0.15s;
}

.inline-blank:focus {
  outline: none;
  border-bottom-color: var(--color-accent);
}

.exam-part-instruction {
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

/* Indicate text is selectable for highlighting */
.exam-reading-passage,
.exam-reading-questions-panel {
  user-select: text;
}

.exam-reading-passage p,
.exam-reading-questions-panel .reading-tfng-text,
.exam-reading-questions-panel .exam-mcq-question,
.exam-reading-questions-panel .exam-part-instruction,
.exam-reading-questions-panel .reading-q-heading {
  cursor: text;
}

.reading-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.reading-input-label {
  font-size: 0.9375rem;
  min-width: 0;
}

.reading-input {
  flex: 1;
  max-width: 200px;
  border: none;
  border-bottom: 1px solid var(--color-text);
  background: transparent;
  padding: 2px 4px;
}

.reading-input:focus {
  outline: none;
  border-bottom-color: var(--color-accent);
}

.reading-input-row .exam-question-input {
  flex: 0 0 10rem;
  min-width: 6rem;
}

/* --- Writing Section --- */
.exam-writing {
  flex-direction: column;
}

.exam-writing-content {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
}

.writing-task {
  max-width: 72rem;
  margin: 0 auto 3rem;
}

.writing-task-title {
  font-size: 1.125rem;
  font-weight: 800;
  margin: 0 0 0.5rem;
}

.writing-task-prompt {
  font-size: 0.9375rem;
  line-height: 1.6;
  margin: 0 0 0.75rem;
}

.writing-task-instruction {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin: 0 0 1rem;
  font-style: italic;
}

/* Side-by-side layout */
.writing-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  min-height: 20rem;
}

.writing-split-left {
  display: flex;
  flex-direction: column;
}

.writing-split-right {
  display: flex;
  flex-direction: column;
}

.writing-task-image {
  display: block;
  max-width: 100%;
  border: 2px solid var(--color-border);
  margin-bottom: 1rem;
}

.writing-textarea {
  width: 100%;
  flex: 1;
  padding: 1rem;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.7;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  resize: vertical;
  min-height: 14rem;
  transition: border-color 0.15s;
}

.writing-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.writing-word-count {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: right;
}

/* --- Thank You Screen --- */
.exam-thankyou {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--color-bg);
}

.exam-thankyou-card {
  text-align: center;
  max-width: 28rem;
  width: 100%;
}

.exam-thankyou-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  border: 3px solid var(--color-accent);
  color: var(--color-accent);
  animation: fadeUp 0.5s ease both;
}

.exam-thankyou-title {
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  animation: fadeUp 0.5s ease 0.1s both;
}

.exam-thankyou-sub {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin: 0 0 0.5rem;
  animation: fadeUp 0.5s ease 0.15s both;
}

.exam-thankyou-note {
  font-size: 1.125rem;
  margin: 0 0 2rem;
  animation: fadeUp 0.5s ease 0.2s both;
}

.exam-thankyou-cta {
  animation: fadeUp 0.5s ease 0.3s both;
}

/* --- Disabled audio buttons --- */
.exam-audio-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.exam-audio-btn:disabled:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

/* --- Smooth scrollbar --- */
.exam-questions-area::-webkit-scrollbar {
  width: 6px;
}

.exam-questions-area::-webkit-scrollbar-track {
  background: transparent;
}

.exam-questions-area::-webkit-scrollbar-thumb {
  background: var(--color-border);
}

.exam-questions-area::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* --- Input hover/focus polish --- */
.exam-question-input {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.exam-question-input:hover {
  border-color: var(--color-text-muted);
}

.exam-question-input:focus {
  box-shadow: 0 2px 0 var(--color-accent);
}

/* --- Animations --- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Scrollbar polish for all scrollable panels --- */
.exam-reading-passage::-webkit-scrollbar,
.exam-reading-questions-panel::-webkit-scrollbar,
.exam-writing-content::-webkit-scrollbar {
  width: 6px;
}

.exam-reading-passage::-webkit-scrollbar-track,
.exam-reading-questions-panel::-webkit-scrollbar-track,
.exam-writing-content::-webkit-scrollbar-track {
  background: transparent;
}

.exam-reading-passage::-webkit-scrollbar-thumb,
.exam-reading-questions-panel::-webkit-scrollbar-thumb,
.exam-writing-content::-webkit-scrollbar-thumb {
  background: var(--color-border);
}

.exam-reading-passage::-webkit-scrollbar-thumb:hover,
.exam-reading-questions-panel::-webkit-scrollbar-thumb:hover,
.exam-writing-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* --- Mobile responsive --- */
@media (max-width: 768px) {
  .exam-header {
    padding: 0.5rem 1rem;
  }

  .exam-header-left {
    gap: 0.75rem;
  }

  .exam-audio-panel {
    padding: 0.75rem 1rem;
  }

  .exam-audio-controls {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .exam-questions-area {
    padding: 1rem;
  }

  .exam-form-row {
    flex-direction: column;
    gap: 0.25rem;
  }

  .exam-form-row-note .exam-form-label {
    min-width: auto;
  }

  .exam-form-label {
    min-width: auto;
  }

  .exam-footer {
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .exam-footer-left,
  .exam-footer-right {
    min-width: auto;
  }

  .exam-navigator {
    justify-content: center;
    order: -1;
    flex-basis: 100%;
  }

  .exam-nav-btn {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.6875rem;
  }

  .exam-tea-row {
    flex-wrap: wrap;
  }

  .exam-tea-name {
    flex: 0 0 auto;
  }

  .exam-reading-split {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .exam-reading-passage {
    border-right: none;
    border-bottom: 2px solid var(--color-border);
  }

  .reading-tfng-options {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .reading-input-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .reading-input-row .exam-question-input {
    flex: none;
    width: 100%;
  }

  .exam-writing-content {
    padding: 1rem;
  }

  .writing-split {
    grid-template-columns: 1fr;
  }

  .reading-tabs {
    padding: 0 0.5rem;
  }

  .reading-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
}
