/* =========================================================
   English Exam — Public Stylesheet
   ========================================================= */

:root {
  --ee-primary: #2563eb;
  --ee-primary-dk: #1d4ed8;
  --ee-success: #16a34a;
  --ee-danger: #dc2626;
  --ee-warning: #d97706;
  --ee-gray-50: #f9fafb;
  --ee-gray-100: #f3f4f6;
  --ee-gray-200: #e5e7eb;
  --ee-gray-400: #9ca3af;
  --ee-gray-600: #4b5563;
  --ee-gray-800: #1f2937;
  --ee-radius: 8px;
  --ee-shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 1px 2px rgba(0, 0, 0, .06);
  --ee-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .1);

  /* Skill colors */
  --ee-listening: #7c3aed;
  --ee-speaking: #db2777;
  --ee-reading: #0891b2;
  --ee-writing: #16a34a;
}

/* ── Reset & Base ─────────────────────────────────────── */
.ee-exam-wrap *,
.ee-result-wrap *,
.ee-login-required * {
  box-sizing: border-box;
}

/* ── SVG Icons ────────────────────────────────────────── */
.ee-icon {
  display: inline-block;
  vertical-align: -0.125em;
  flex-shrink: 0;
}

/* ── Login Required ───────────────────────────────────── */
.ee-login-required {
  display: flex;
  justify-content: center;
  padding: 60px 20px;
}

.ee-login-box {
  text-align: center;
  background: #fff;
  border: 1px solid var(--ee-gray-200);
  border-radius: 16px;
  padding: 48px 40px;
  max-width: 420px;
  box-shadow: var(--ee-shadow-md);
}

.ee-login-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.ee-login-box h2 {
  margin: 0 0 8px;
  color: var(--ee-gray-800);
  font-size: 24px;
}

.ee-login-box p {
  color: var(--ee-gray-600);
  margin-bottom: 28px;
}

.ee-login-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────── */
.ee-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--ee-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  transition: all .15s ease;
}

.ee-btn--primary {
  background: var(--ee-primary);
  color: #fff;
}

.ee-btn--primary:hover {
  background: var(--ee-primary-dk);
  color: #fff;
}

.ee-btn--outline {
  background: #fff;
  color: var(--ee-primary);
  border-color: var(--ee-primary);
}

.ee-btn--outline:hover {
  background: var(--ee-gray-50);
}

.ee-btn--danger {
  background: var(--ee-danger);
  color: #fff;
}

.ee-btn--danger:hover {
  background: #b91c1c;
}

.ee-btn--record {
  background: var(--ee-primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--ee-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0;
}

.ee-btn--recording {
  background: var(--ee-danger) !important;
  animation: ee-pulse 1.2s infinite;
}

@keyframes ee-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .75;
  }
}

/* ── Exam Header ──────────────────────────────────────── */
.ee-exam-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.ee-exam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ee-primary);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--ee-radius);
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--ee-shadow-md);
}

.ee-exam-title {
  font-size: 16px;
  font-weight: 700;
  flex: 1;
}

.ee-exam-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, .1);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 0 16px;
}

.ee-timer--warning .ee-exam-timer {
  background: rgba(217, 119, 6, .3);
}

.ee-timer--danger .ee-exam-timer {
  background: rgba(220, 38, 38, .4);
  animation: ee-pulse .6s infinite;
}

.ee-autosave-status {
  font-size: 12px;
  color: rgba(255, 255, 255, .6);
  min-width: 70px;
  text-align: right;
}

/* ── Section Tabs ─────────────────────────────────────── */
.ee-section-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.ee-tab {
  flex-shrink: 0;
  padding: 8px 18px;
  border: 2px solid var(--ee-gray-200);
  background: #fff;
  border-radius: var(--ee-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ee-gray-600);
  transition: all .15s;
}

.ee-tab:hover {
  border-color: var(--ee-primary);
  color: var(--ee-primary);
}

.ee-tab--active {
  /* background: var(--ee-primary); */
  border-color: var(--ee-primary);
  color: var(--ee-primary);
}

/* ── Section Panel ────────────────────────────────────── */
.ee-section-panel {
  display: none;
}

.ee-section-panel--active {
  display: block;
}

.ee-instructions {
  background: #eff6ff;
  border-left: 4px solid var(--ee-primary);
  padding: 12px 16px;
  border-radius: 0 var(--ee-radius) var(--ee-radius) 0;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--ee-gray-800);
}

/* ── Audio Player ─────────────────────────────────────── */
.ee-audio-player {
  background: #faf5ff;
  border: 1px solid #ddd6fe;
  border-radius: var(--ee-radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.ee-audio-player audio {
  width: 100%;
  margin: 8px 0;
}

.ee-plays-remaining {
  font-size: 13px;
  color: var(--ee-gray-600);
  margin: 0;
}

/* ── Reading layout ───────────────────────────────────── */
.ee-reading-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 768px) {
  .ee-reading-layout {
    grid-template-columns: 1fr;
  }
}

.ee-passage {
  background: var(--ee-gray-50);
  border: 1px solid var(--ee-gray-200);
  border-radius: var(--ee-radius);
  padding: 20px;
  /* position: sticky; */
  /* top: 80px; */
  /* max-height: calc(100vh - 100px); */
  /* overflow-y: auto; */
  margin-bottom: 14px;
}

.ee-passage h4 {
  margin-top: 0;
  color: var(--ee-gray-800);
}

.ee-passage-content {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ee-gray-800);
}

.ee-questions-col {
  min-width: 0;
}

/* ── Question ─────────────────────────────────────────── */
.ee-questions--full {}

.ee-question {
  background: #fff;
  border: 1px solid var(--ee-gray-200);
  border-radius: var(--ee-radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--ee-shadow);
  transition: border-color .15s;
}

.ee-question:focus-within {
  border-color: var(--ee-primary);
}

.ee-question-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ee-q-number {
  font-size: 12px;
  font-weight: 700;
  color: var(--ee-primary);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.ee-q-score {
  font-size: 12px;
  color: var(--ee-gray-400);
}

.ee-question-content {
  font-size: 15px;
  color: var(--ee-gray-800);
  line-height: 1.6;
  margin-bottom: 14px;
}

.ee-hint {
  font-size: 13px;
  color: var(--ee-gray-600);
  font-style: italic;
  margin-bottom: 8px;
}

/* ── Choices ──────────────────────────────────────────── */
.ee-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ee-choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--ee-gray-200);
  border-radius: var(--ee-radius);
  cursor: pointer;
  transition: all .12s;
}

.ee-choice:hover {
  border-color: var(--ee-primary);
  background: #eff6ff;
}

.ee-choice--selected {
  border-color: var(--ee-primary);
  background: #eff6ff;
}

.ee-choice input[type="radio"],
.ee-choice input[type="checkbox"] {
  margin: 2px 0 0;
  flex-shrink: 0;
  cursor: pointer;
}

.ee-choice-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--ee-gray-100);
  border-radius: 50%;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  color: var(--ee-gray-800);
}

.ee-choice--selected .ee-choice-label {
  background: var(--ee-primary);
  color: #fff;
}

.ee-choice-text {
  font-size: 14px;
  color: var(--ee-gray-800);
  line-height: 1.5;
  padding-top: 3px;
}

/* ── Fill Blank ───────────────────────────────────────── */
.ee-fill-blank {
  margin-top: 8px;
}

.ee-fill-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--ee-gray-200);
  border-radius: var(--ee-radius);
  font-size: 15px;
  transition: border-color .15s;
}

.ee-fill-input:focus {
  outline: none;
  border-color: var(--ee-primary);
}

/* ── Essay ────────────────────────────────────────────── */
.ee-essay {
  margin-top: 8px;
}

.ee-essay-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--ee-gray-200);
  border-radius: var(--ee-radius);
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
  min-height: 200px;
  transition: border-color .15s;
  font-family: inherit;
}

.ee-essay-input:focus {
  outline: none;
  border-color: var(--ee-primary);
}

.ee-essay-input.ee-over-limit {
  border-color: var(--ee-danger);
}

.ee-word-count {
  color: var(--ee-primary);
}

/* ── Speaking ─────────────────────────────────────────── */
.ee-speaking {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: var(--ee-radius);
  padding: 16px;
}

.ee-recorder-ui {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ee-recording-status {
  font-size: 14px;
  color: var(--ee-gray-600);
  /* min-height: 20px; */
}

.ee-playback {
  width: 100%;
}

.ee-upload-ok {
  color: var(--ee-success);
  font-size: 13px;
  margin: 0;
}

/* ── Exam Footer ──────────────────────────────────────── */
.ee-exam-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--ee-gray-200);
}

.ee-nav-btns {
  display: flex;
  gap: 8px;
}

/* ── Skill badges ─────────────────────────────────────── */
.ee-skill-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--ee-listening);
}

.ee-skill-listening {
  background: var(--ee-listening);
}

.ee-skill-speaking {
  background: var(--ee-speaking);
}

.ee-skill-reading {
  background: var(--ee-reading);
}

.ee-skill-writing {
  background: var(--ee-writing);
}

/* ── Result page ──────────────────────────────────────── */
.ee-result-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ee-result-hero {
  text-align: center;
  padding: 48px 24px;
  border-radius: 16px;
  margin-bottom: 28px;
  color: #fff;
}

.ee-result-hero--pass {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.ee-result-hero--fail {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.ee-result-hero--pending {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.ee-result-icon {
  font-size: 56px;
  margin-bottom: 12px;
}

.ee-result-hero h2 {
  font-size: 28px;
  margin: 0 0 16px;
}

.ee-total-score {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  background: rgba(255, 255, 255, .2);
  padding: 12px 28px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.ee-score-big {
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
}

.ee-score-max {
  font-size: 20px;
  opacity: .8;
}

/* Skill cards */
.ee-score-breakdown {
  margin-bottom: 28px;
}

.ee-score-breakdown h3 {
  margin-bottom: 16px;
  color: var(--ee-gray-800);
}

.ee-skill-scores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.ee-skill-card {
  background: #fff;
  border: 1px solid var(--ee-gray-200);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--ee-shadow);
}

.ee-skill-card__icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.ee-skill-card__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ee-gray-600);
  margin-bottom: 6px;
}

.ee-skill-card__score {
  font-size: 22px;
  font-weight: 800;
  color: var(--ee-gray-800);
  margin-bottom: 10px;
}

.ee-skill-card__score span {
  font-size: 14px;
  color: var(--ee-gray-400);
}

.ee-skill-bar {
  height: 6px;
  background: var(--ee-gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.ee-skill-bar__fill {
  height: 100%;
  background: var(--ee-primary);
  border-radius: 3px;
  transition: width .6s ease;
}

/* Answer review */
.ee-answer-review h3 {
  color: var(--ee-gray-800);
  margin-bottom: 16px;
}

.ee-review-section {
  margin-bottom: 24px;
}

.ee-review-section h4 {
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ee-gray-200);
  color: var(--ee-gray-800);
}

.ee-review-q {
  background: #fff;
  border-radius: var(--ee-radius);
  border: 1px solid var(--ee-gray-200);
  border-left: 4px solid var(--ee-gray-400);
  margin-bottom: 10px;
  padding: 14px 16px;
}

.ee-review-q--correct {
  border-left-color: var(--ee-success);
}

.ee-review-q--wrong {
  border-left-color: var(--ee-danger);
}

.ee-review-q--manual {
  border-left-color: var(--ee-primary);
}

.ee-review-q__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ee-gray-600);
}

.ee-review-q__content {
  font-size: 14px;
  color: var(--ee-gray-800);
  margin-bottom: 8px;
}

.ee-review-answer {
  font-size: 14px;
  color: var(--ee-gray-600);
  margin-bottom: 6px;
  background: var(--ee-gray-50);
  padding: 8px 12px;
  border-radius: 6px;
}

.ee-teacher-feedback {
  font-size: 13px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 6px;
}

.ee-explanation {
  font-size: 13px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--ee-success);
}

/* Badges */
.ee-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.ee-badge--green {
  background: #dcfce7;
  color: var(--ee-success);
}

.ee-badge--red {
  background: #fee2e2;
  color: var(--ee-danger);
}

.ee-badge--blue {
  background: #dbeafe;
  color: var(--ee-primary);
}

.ee-result-footer {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--ee-gray-200);
}

/* ── Exam list (public) ───────────────────────────────── */
.ee-exam-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.ee-exam-card {
  background: #fff;
  border: 1px solid var(--ee-gray-200);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--ee-shadow);
  transition: box-shadow .15s, transform .15s;
}

.ee-exam-card:hover {
  box-shadow: var(--ee-shadow-md);
  transform: translateY(-2px);
}

.ee-exam-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--ee-gray-800);
}

.ee-exam-card p {
  color: var(--ee-gray-600);
  font-size: 14px;
  margin-bottom: 16px;
}

.ee-exam-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--ee-gray-400);
  margin-bottom: 16px;
}

/* ── Landing page ─────────────────────────────────────── */
.ee-landing {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
  padding: 40px 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ee-landing h2 {
  font-size: 28px;
  color: var(--ee-gray-800);
  margin-bottom: 12px;
}

.ee-landing-meta {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 16px 0 24px;
}

.ee-landing-meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ee-landing-meta-item span:first-child {
  font-size: 24px;
}

.ee-landing-meta-item span:last-child {
  font-size: 13px;
  color: var(--ee-gray-600);
}

.ee-landing-skills {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.ee-landing-desc {
  color: var(--ee-gray-600);
  line-height: 1.6;
  margin-bottom: 32px;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 600px) {
  .ee-exam-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .ee-exam-footer {
    flex-direction: column;
    gap: 12px;
  }

  .ee-nav-btns {
    width: 100%;
    justify-content: space-between;
  }

  #ee-submit-btn {
    width: 100%;
    justify-content: center;
  }

  .ee-section-tabs {
    gap: 6px;
  }
}