/* css/components/dashboard.css */

/* ── Mode toggle ── */
.mode-toggle {
  display: flex;
  gap: 4px;
  background: rgba(45, 46, 95, 0.04);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid rgba(45, 46, 95, 0.06);
}

.mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  color: var(--text-medium);
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.5);
}

.mode-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mode-btn.active[data-mode="exam"] {
  background: linear-gradient(135deg, #2D2E5F, #1E9D8E);
  color: white;
}

.mode-btn i {
  font-size: 1rem;
}

/* ── Dashboard reset buttons ── */
.dashboard-reset-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.6;
}

.dashboard-reset-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.reset-test-btn {
  color: rgba(45, 46, 95, 0.4);
  margin-right: 4px;
}

.reset-test-btn:hover {
  color: #2D2E5F;
  background: rgba(45, 46, 95, 0.08);
}

.reset-section-btn {
  color: var(--text-light);
}

.reset-section-btn:hover {
  color: var(--incorrect);
  background: rgba(239, 68, 68, 0.1);
}

.reset-section-btn i,
.reset-test-btn i {
  font-size: 0.8rem;
  background: transparent;
  color: inherit;
}

/* ── Confirmation dialog ── */
.confirm-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30000;
  padding: 20px;
  box-sizing: border-box;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.confirm-dialog {
  background: var(--white);
  border-radius: 16px;
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 30px rgba(45, 46, 95, 0.12);
  animation: fadeInUp 0.2s ease;
}

.confirm-dialog p {
  font-size: 1.05rem;
  color: var(--text-dark);
  margin: 0 0 24px;
  line-height: 1.5;
}

.confirm-dialog-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-dialog-btn {
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.confirm-cancel {
  background: #f1f5f9;
  color: var(--text-medium);
}

.confirm-cancel:hover {
  background: #e2e8f0;
}

.confirm-ok {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
}

.confirm-ok:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* ── Section complete screen ── */
.section-complete-screen {
  max-width: 640px;
  margin: 40px auto;
  text-align: center;
  background: var(--white);
  border-radius: 20px;
  padding: 48px 36px;
  box-shadow: 0 4px 16px rgba(45, 46, 95, 0.08);
  animation: fadeInUp 0.4s ease;
}

.section-complete-icon {
  font-size: 4rem;
  color: var(--completed);
  margin-bottom: 16px;
}

.section-complete-icon.final {
  color: #f59e0b;
}

.section-complete-screen h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.section-complete-screen p {
  color: var(--text-medium);
  margin-bottom: 24px;
}

.section-complete-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
  padding: 16px 24px;
  background: #f0fdf4;
  border-radius: 14px;
  border: 1px solid #bbf7d0;
}

.section-complete-score.final-total {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #fbbf24;
}

.section-complete-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
}

.section-complete-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--completed);
}

.final-total .section-complete-value {
  color: #b45309;
}

.section-complete-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 28px;
}

.btn-next-section,
.btn-final-results {
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
}

.btn-next-section:hover,
.btn-final-results:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn-back-dashboard {
  padding: 12px 24px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  color: var(--text-medium);
}

.btn-back-dashboard:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.final-results-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0;
}

.final-results-section-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #f8fafc;
  border-radius: 10px;
}

.final-results-section-name {
  font-weight: 600;
  color: var(--text-dark);
}

.final-results-section-score {
  font-weight: 700;
  color: var(--primary);
}

/* ── Section complete per-part breakdown ── */
.section-complete-parts-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
  text-align: left;
}

.section-complete-part-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.section-complete-part-name {
  flex: 1;
  font-weight: 600;
  color: var(--text-dark);
  font-size: 0.9rem;
}

.section-complete-part-score {
  font-weight: 700;
  color: var(--primary);
  min-width: 48px;
  text-align: right;
}

.btn-review-part {
  padding: 5px 12px;
  border: 1.5px solid var(--primary);
  border-radius: 8px;
  background: transparent;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-review-part:hover {
  background: var(--primary);
  color: white;
}

/* ── Exam mode badge ── */
.exam-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
  white-space: nowrap;
}

.mode-header {
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  color: var(--text-light);
  font-weight: 600;
  margin: 32px 0 16px;
}

.no-exams {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  padding: 60px 40px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(45, 46, 95, 0.05);
  border: 1px solid rgba(45, 46, 95, 0.04);
  animation: fadeInUp 0.5s ease;
}

.no-exams i {
  font-size: 5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
}

.no-exams h3 {
  font-size: 2rem;
  color: var(--text-dark);
  margin-bottom: 10px;
  font-weight: 700;
}

.no-exams p {
  font-size: 1.2rem;
  color: var(--text-medium);
  background: rgba(45, 46, 95, 0.06);
  display: inline-block;
  padding: 8px 24px;
  border-radius: 40px;
}

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

.exams-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 40px;
}

.exam-item {
  background: var(--white);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.exam-header {
  padding: 20px 24px;
  background: linear-gradient(135deg, #e8f0ff 0%, #d8d0f0 100%);
  color: #2D2E5F;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s;
}

.exam-header:hover {
  filter: brightness(1.05);
}

.exam-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.exam-number {
  font-size: 1.8rem;
  font-weight: 800;
  opacity: 0.8;
}

.exam-title {
  font-family: 'Mileast', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
}

.exam-subtitle {
  font-family: 'Mileast', sans-serif;
  font-style: italic;
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 4px;
}

.exam-progress-badge {
  padding: 6px 12px;
  border-radius: 30px;
  background: rgba(45, 46, 95, 0.08);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.exam-arrow {
  font-size: 1.2rem;
  transition: transform 0.3s;
}

.exam-header.active .exam-arrow {
  transform: rotate(180deg);
}

.exam-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background: var(--bg-light);
}

.exam-content.show {
  max-height: 2000px;
  padding: 24px;
}

.exam-sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.exam-section {
  background: white;
  border-radius: 16px;
  padding: 20px;
  padding-top: 0;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.reset-section-corner-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.2s;
  opacity: 0.5;
}

.reset-section-corner-btn:hover {
  opacity: 1;
  color: var(--primary);
  background: rgba(45, 46, 95, 0.06);
}


.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  position: relative;
}

.section-header i {
  font-size: 1.5rem;
  padding: 12px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, #b39ddb 0%, #ce93d8 100%);
}

.section-icon {
  font-size: 1.3rem !important;
  color: white !important;
  padding: 8px;
  border-radius: 12px;
  background: transparent;
  border: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-icon.reading {
  background: linear-gradient(135deg, #b39ddb 0%, #ce93d8 100%) !important;
  border-color: #b39ddb;
}

.section-icon.listening {
  background: linear-gradient(135deg, #ffcc80 0%, #ffab91 100%) !important;
  border-color: #ffcc80;
}

.section-icon.writing {
  background: linear-gradient(135deg, #a5d6a7 0%, #81c784 100%) !important;
  border-color: #a5d6a7;
}

.section-icon.speaking {
  background: linear-gradient(135deg, #f48fb1 0%, #ef9a9a 100%) !important;
  border-color: #f48fb1;
}

.section-icon:hover {
  transform: scale(1.1);
  filter: brightness(1.15);
}

.section-header h4 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-right: auto;
}

.section-play {
  background: transparent;
  color: var(--primary);
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.1rem;
  margin-left: 8px;
}

.section-play:hover {
  transform: scale(1.2);
  color: var(--secondary);
}

.section-play i {
  font-size: 1.1rem;
  background: transparent;
  color: inherit;
}

.section-parts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.part-number {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  background: #f1f5f9;
  color: var(--text-medium);
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  position: relative;
}

.part-number:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.05);
}

.part-number.completed {
  background: var(--completed);
  color: white;
}

.part-number.in-progress {
  background: var(--in-progress);
  color: white;
  border-color: var(--primary-dark);
  animation: pulseBorder 2s infinite;
}

.part-number.exam-locked {
  cursor: not-allowed;
  opacity: 0.45;
}

.part-number.exam-locked:hover {
  background: #f1f5f9;
  color: var(--text-medium);
  transform: none;
}

.part-number.completed.exam-locked {
  opacity: 1;
  cursor: pointer;
}

.part-number.completed.exam-locked:hover {
  background: var(--completed);
  color: white;
  filter: brightness(1.1);
  transform: scale(1.05);
}

@keyframes pulseBorder {
  0% {
    border-color: var(--primary-dark);
  }
  50% {
    border-color: transparent;
  }
  100% {
    border-color: var(--primary-dark);
  }
}

.section-progress {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-left: 8px;
  font-weight: 500;
}

/* ── Results buttons ── */
.exam-play-btn {
  background: rgba(45, 46, 95, 0.08);
  color: #2D2E5F;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
  margin-right: 4px;
  flex-shrink: 0;
}

.exam-play-btn:hover {
  background: rgba(49, 27, 146, 0.2);
  transform: scale(1.1);
}

.exam-results-btn {
  background: rgba(49, 27, 146, 0.1);
  color: #2D2E5F;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
  margin-right: 4px;
  flex-shrink: 0;
}

.exam-results-btn:hover {
  background: rgba(49, 27, 146, 0.2);
  transform: scale(1.1);
}

.section-results-btn {
  background: transparent;
  color: var(--primary);
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
}

.section-results-btn:hover {
  transform: scale(1.2);
  color: var(--secondary);
}

.section-results-btn i {
  font-size: 1rem;
  background: transparent;
  color: inherit;
}

/* ── Results modal ── */
.results-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  padding: 10px;
  box-sizing: border-box;
}

.results-modal-content {
  background: var(--white, #fff);
  width: 100%;
  max-width: 1100px;
  padding: 24px;
  border-radius: 20px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: fadeInUp 0.3s ease;
  box-sizing: border-box;
  max-height: 95vh;
  overflow-y: auto;
}

.results-modal-content.results-modal-section {
  max-width: 700px;
}

.results-modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-light, #999);
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.2s;
  z-index: 10;
}

.results-modal-close:hover {
  color: var(--text-dark, #333);
}

.results-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, #2D2E5F, #1E9D8E) 1;
}

.results-modal-header h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark, #333);
  margin: 0;
}

.results-exam-level {
  background: linear-gradient(135deg, #2D2E5F, #1E9D8E);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.results-skills-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0;
}

.results-skill-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: #F4F7FF;
  border-radius: 10px;
  border: 1px solid #e8ecf4;
}

.results-skill-row i {
  font-size: 1rem;
  color: #2D2E5F;
  width: 20px;
  text-align: center;
}

.results-skill-name {
  font-weight: 600;
  color: var(--text-dark, #333);
  flex: 1;
}

.results-skill-raw {
  font-size: 0.85rem;
  color: var(--text-light, #999);
  font-weight: 500;
}

.results-skill-scale {
  font-weight: 800;
  font-size: 1.1rem;
  color: #2D2E5F;
  min-width: 36px;
  text-align: right;
}



/* ── Dashboard 3-column layout (Duolingo-style) ── */
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  gap: 24px;
  align-items: start;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
}

.dashboard-left-sidebar,
.dashboard-right-sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  min-width: 0;
}

.dashboard-right-sidebar {
  top: 0px;
}

.dashboard-sidebar-shell {
  transition: width 0.2s ease;
}

.dashboard-sidebar-toggle-left {
  align-self: flex-end;
}

.dashboard-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(45, 46, 95, 0.1);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-medium);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(45, 46, 95, 0.08);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.dashboard-sidebar-toggle:hover {
  background: #fff;
  color: var(--primary);
  transform: translateY(-1px);
}

.dashboard-sidebar-toggle .material-symbols-outlined {
  font-size: 1.2rem;
}

.dashboard-sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.dashboard-sidebar-shell.is-collapsed {
  overflow: visible;
  gap: 0;
}

.dashboard-sidebar-shell.is-collapsed .dashboard-sidebar-content {
  display: none;
}

.dashboard-sidebar-shell.is-collapsed .dashboard-sidebar-toggle {
  position: sticky;
  top: 10px;
}

.dashboard-left-sidebar::-webkit-scrollbar,
.dashboard-right-sidebar::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.dashboard-left-sidebar > *,
.dashboard-right-sidebar > * {
  margin-top: 0;
  margin-bottom: 0;
}

.dashboard-center {
  min-width: 0;
}

@media (max-width: 900px) {
  .dashboard-layout,
  .dashboard-layout.dashboard-layout-right-closed {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px;
    max-width: 100%;
    padding: 0;
  }

  .dashboard-center {
    order: 1;
  }

  .dashboard-left-sidebar {
    order: 2;
  }

  .dashboard-right-sidebar {
    order: 3;
  }

  .dashboard-left-sidebar,
  .dashboard-right-sidebar,
  .dashboard-sidebar-shell {
    width: auto !important;
    overflow: visible;
  }

  .dashboard-sidebar-toggle {
    display: none;
  }

  .dashboard-sidebar-shell.is-collapsed .dashboard-sidebar-content {
    display: flex;
  }

  .dashboard-sidebar-content {
    gap: 12px;
  }

  .sidebar-widget {
    position: static;
    padding: 16px;
    margin-bottom: 0;
  }
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .dashboard-layout,
  .dashboard-layout.dashboard-layout-right-closed {
    display: block;
    padding: 0;
  }

  .dashboard-left-sidebar,
  .dashboard-right-sidebar {
    display: none !important;
  }

  .dashboard-center {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
  }

  .subpage-header {
    align-items: flex-start;
    padding: 14px;
    border-radius: 18px;
    gap: 10px;
  }

  .subpage-title {
    font-size: 1.05rem;
    overflow-wrap: anywhere;
  }

  .subpage-subtitle {
    overflow-wrap: anywhere;
  }

  .exam-header {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
  }

  .exam-header-left {
    min-width: 0;
  }

  .exam-title,
  .exam-subtitle {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .exam-progress-badge {
    flex: 1 1 100%;
    min-width: 0;
  }

  .exam-play-btn,
  .exam-results-btn,
  .exam-arrow {
    flex-shrink: 0;
  }

  .section-header {
    flex-wrap: wrap;
  }

  .section-header h4 {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .results-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .results-modal-content {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .results-modal-header {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .results-modal-header h3 {
    min-width: 0;
    font-size: 1.05rem;
    overflow-wrap: anywhere;
  }

  .grade-carousel-cefr {
    font-size: 2.6rem;
  }
}

/* Sidebar widgets */
.sidebar-widget {
  background: rgba(255,255,255,0.92);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(45, 46, 95, 0.08);
  border: 1px solid rgba(45, 46, 95, 0.08);
  margin-bottom: 16px;
  position: sticky;
  top: 10px;
  z-index: 10;
}

.sidebar-widget-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #2D2E5F;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.sidebar-calculator-widget .sidebar-widget-title i {
  color: #1E9D8E;
  margin-right: 4px;
}

.sidebar-calc-btn {
  background: linear-gradient(135deg, #2D2E5F, #1E9D8E) !important;
}

/* ── Grade Tracker Carousel ── */
.grade-carousel-viewport {
  position: relative;
  min-height: 100px;
}

.grade-carousel-slide {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 0;
  animation: gradeCarouselFadeIn 0.4s ease;
}

.grade-carousel-cefr {
  font-size: 3.5rem;
  font-weight: 900;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-style: italic;
  line-height: 1.1;
  text-align: center;
}

.grade-carousel-raw {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.grade-carousel-skill {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.grade-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.grade-carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d1d5db;
  transition: background 0.3s, transform 0.3s;
}

.grade-carousel-dot.active {
  background: #2D2E5F;
  transform: scale(1.3);
}

@keyframes gradeCarouselFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Level subpage header */
.subpage-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}

.subpage-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 40px;
  border: 2px solid rgba(45, 46, 95, 0.12);
  background: rgba(45, 46, 95, 0.04);
  color: var(--text-medium);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.25s;
  flex-shrink: 0;
  white-space: nowrap;
}

.subpage-back-btn .material-symbols-outlined {
  font-size: 1.2rem;
  line-height: 1;
}

.subpage-back-btn:hover {
  background: rgba(45, 46, 95, 0.08);
  border-color: rgba(45, 46, 95, 0.2);
  transform: translateY(-1px);
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .subpage-back-btn {
    gap: 0;
    min-width: 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 14px;
  }

  .subpage-back-btn .icon-btn-label {
    display: none;
  }

  .subpage-back-btn .material-symbols-outlined {
    font-size: 1.25rem;
  }
}

.subpage-title {
  font-family: 'Mileast', sans-serif;
  font-size: 1.3rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dark);
}

.subpage-subtitle {
  font-size: 0.85rem;
  color: var(--text-medium);
}

.subpage-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 0 8px;
  border-top: 1px solid var(--border-light, #e5e7eb);
  margin-top: 8px;
  flex-wrap: wrap;
}

.pagination-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 2px solid var(--border-light, #e5e7eb);
  background: var(--white);
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-medium);
  cursor: pointer;
  transition: all 0.2s;
}

.pagination-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ── Level Selector Widget ── */
.level-selector-widget {
  padding: 0 !important;
  overflow: hidden;
}

.level-selector-current {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(45, 46, 95, 0.10), rgba(30, 157, 142, 0.10));
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}

.level-selector-current:hover {
  background: linear-gradient(135deg, rgba(45, 46, 95, 0.16), rgba(30, 157, 142, 0.16));
}

.level-selector-current-icon {
  font-size: 2rem;
  color: #2D2E5F;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2D2E5F, #1E9D8E);
  color: white;
  border-radius: 14px;
  flex-shrink: 0;
}

.level-selector-current-code {
  font-size: 1.6rem;
  font-weight: 800;
  color: #2D2E5F;
  line-height: 1.1;
}

.level-selector-current-label {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 500;
}

.level-selector-chevron {
  margin-left: auto;
  color: #2D2E5F;
  font-size: 0.9rem;
  transition: transform 0.3s ease;
}

.level-selector-current[aria-expanded="true"] .level-selector-chevron {
  transform: rotate(180deg);
}

.level-selector-hint {
  font-size: 0.7rem;
  color: #94a3b8;
  text-align: center;
  padding: 4px 0 0;
  letter-spacing: 0.02em;
}

.level-selector-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px 14px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              padding 0.3s ease,
              margin 0.3s ease;
  overflow: hidden;
}

.level-selector-changing-to {
  font-size: 0.72rem;
  font-weight: 700;
  color: #5a7a9a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 6px;
}

.level-selector-carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.level-selector-carousel .sidebar-level-badge {
  margin-bottom: 0;
  flex: 1;
}

.level-selector-arrow {
  background: none;
  border: none;
  cursor: pointer;
  color: #5a7a9a;
  padding: 4px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.level-selector-arrow:hover {
  background: rgba(45, 46, 95, 0.1);
  color: #2D2E5F;
}

.level-selector-arrow .material-symbols-outlined {
  font-size: 1.6rem;
}

.level-selector-preview-badge {
  transition: background 0.2s, color 0.2s;
}

.level-selector-options.level-selector-collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
}

.level-selector-options.level-selector-expanded {
  max-height: 300px;
  opacity: 1;
}

.level-selector-option {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(45, 46, 95, 0.10);
  background: rgba(45, 46, 95, 0.03);
  color: var(--text-medium);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
}

.level-selector-option i {
  width: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: #2D2E5F;
  opacity: 0.7;
}

.level-selector-option:hover {
  background: rgba(45, 46, 95, 0.09);
  border-color: rgba(45, 46, 95, 0.22);
  transform: translateX(3px);
}

.level-selector-option:active {
  transform: translateX(1px) scale(0.98);
}

.level-selector-option.level-selector-active {
  background: linear-gradient(135deg, #2D2E5F, #1E9D8E);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(45, 46, 95, 0.25);
}

.level-selector-option.level-selector-active i {
  color: white;
  opacity: 1;
}



/* ── Guest locked section ─────────────────────────────────────────────── */
.exam-section.guest-locked {
  position: relative;
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}
.exam-section.guest-locked::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: all;
  cursor: pointer;
  z-index: 2;
}
.guest-locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 50px;
  padding: 3px 10px;
  margin-left: 8px;
  vertical-align: middle;
}
.guest-locked-badge i {
  font-size: 0.68rem;
}

/* ── Guest exam locked overlay (non-first exams) ──────────────────────── */
.exam-item.guest-exam-locked {
  position: relative;
  opacity: 0.45;
  pointer-events: none;
}
.exam-item.guest-exam-locked::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: all;
  cursor: pointer;
  z-index: 2;
}

/* ── Premium upgrade banner ───────────────────────────────────────────── */
.premium-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: 16px;
  padding: 18px 22px;
  margin-bottom: 20px;
}
.premium-banner-icon {
  font-size: 2rem;
  flex-shrink: 0;
}
.premium-banner-text {
  flex: 1;
  min-width: 0;
}
.premium-banner-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 3px;
}
.premium-banner-desc {
  font-size: 0.82rem;
  color: var(--text-medium);
  line-height: 1.4;
}
.premium-banner-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
  white-space: nowrap;
}
.premium-banner-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
}
.premium-banner-btn i {
  font-size: 0.8rem;
}

/* ── Sign-in prompt modal (guest gate) ────────────────────────────────── */
.guest-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(45, 46, 95, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.guest-gate-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  margin: 16px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(45, 46, 95, 0.15);
  animation: authCardIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}
.guest-gate-card .guest-gate-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}
.guest-gate-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 8px;
}
.guest-gate-card p {
  font-size: 0.88rem;
  color: var(--text-medium);
  margin: 0 0 24px;
  line-height: 1.5;
}
.guest-gate-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.guest-gate-btns .btn-gate-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.guest-gate-btns .btn-gate-signin:hover {
  background: var(--secondary);
  transform: translateY(-1px);
}
.guest-gate-btns .btn-gate-close {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: transparent;
  color: var(--text-light);
  border: 1px solid #e2e8f0;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.guest-gate-btns .btn-gate-close:hover {
  background: #f8fafc;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Subpage view toggle (By Test / By Exercise Type) ─────────────────── */
.subpage-view-toggle {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: stretch;
  background: rgba(45, 46, 95, 0.04);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid rgba(45, 46, 95, 0.06);
}

.subpage-view-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  color: var(--text-medium);
}

.subpage-view-btn:hover {
  background: rgba(255, 255, 255, 0.5);
}

.subpage-view-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ── Section type tiles ───────────────────────────────────────────────── */
.section-type-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.section-type-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 20px;
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all 0.22s;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.section-type-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.section-type-tile-icon {
  font-size: 2rem !important;
  color: white !important;
  padding: 14px;
  border-radius: 16px;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-type-tile.reading .section-type-tile-icon {
  background: linear-gradient(135deg, #b39ddb 0%, #ce93d8 100%);
  box-shadow: 0 4px 12px rgba(179, 157, 219, 0.4);
}

.section-type-tile.listening .section-type-tile-icon {
  background: linear-gradient(135deg, #ffcc80 0%, #ffab91 100%);
  box-shadow: 0 4px 12px rgba(255, 204, 128, 0.4);
}

.section-type-tile.writing .section-type-tile-icon {
  background: linear-gradient(135deg, #a5d6a7 0%, #81c784 100%);
  box-shadow: 0 4px 12px rgba(165, 214, 167, 0.4);
}

.section-type-tile.speaking .section-type-tile-icon {
  background: linear-gradient(135deg, #f48fb1 0%, #ef9a9a 100%);
  box-shadow: 0 4px 12px rgba(244, 143, 177, 0.4);
}

.section-type-tile-label {
  font-family: 'Mileast', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  flex: 1;
}

.section-type-tile-arrow {
  font-size: 0.9rem;
  color: var(--text-light);
  transition: transform 0.2s;
}

.section-type-tile:hover .section-type-tile-arrow {
  transform: translateX(4px);
  color: var(--primary);
}

/* ── Section exercise list header (back btn + icon + title) ───────────── */
.section-ex-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.section-ex-back-btn {
  background: rgba(45, 46, 95, 0.06);
  border: none;
  color: var(--text-medium);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.section-ex-back-btn:hover {
  background: rgba(45, 46, 95, 0.12);
  color: var(--primary);
}

.section-ex-title {
  font-family: 'Mileast', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: none;
  letter-spacing: 0.03em;
}

/* ── Section exercise item (compact, single-section card) ─────────────── */
.section-ex-item {
  box-shadow: var(--shadow-sm);
}

.section-ex-item-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px 8px;
}

.section-ex-item-info {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.section-ex-item .section-parts {
  padding: 0 20px 14px;
}

@media (max-width: 540px) {
  .mode-toggle,
  .subpage-view-toggle {
    justify-content: center;
    flex-wrap: wrap;
    overflow-x: visible;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }

  .mode-btn,
  .subpage-view-btn {
    flex: 1 1 auto;
    min-width: min(160px, 46vw);
    max-width: 100%;
    padding: 10px 14px;
  }

  .subpage-header {
    align-items: flex-start;
    gap: 10px;
  }

  .subpage-title {
    font-size: 1.2rem;
  }

  .exam-header {
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
  }

  .exam-header-left {
    min-width: 0;
    gap: 12px;
  }

  .exam-number {
    font-size: 1.35rem;
  }

  .exam-title {
    font-size: 1.05rem;
  }

  .exam-subtitle {
    font-size: 0.82rem;
  }

  .exam-progress-badge {
    align-self: stretch;
    justify-content: center;
    font-size: 0.78rem;
    padding: 5px 8px;
  }

  .exam-content.show {
    padding: 14px;
  }

  .exam-section {
    padding: 16px;
    padding-top: 12px;
  }

  .section-header {
    align-items: flex-start;
    gap: 10px;
  }

  .section-header h4 {
    font-size: 1rem;
  }

  .section-parts {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
  }

  .part-number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 0.85rem;
    border-radius: 10px;
  }

  .section-progress {
    width: 100%;
    margin-left: 0;
  }

  .section-ex-item-header {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px 14px 8px;
  }

  .section-ex-item-info {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    flex: 1;
    min-width: 0;
    gap: 8px;
  }

  .section-ex-item .exam-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.98rem;
  }

  .section-ex-item .section-progress {
    width: auto;
    flex-shrink: 0;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .section-ex-item .exam-number {
    flex-shrink: 0;
  }

  .section-ex-item .section-play,
  .section-ex-item .section-results-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    min-height: 36px !important;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .exam-section .section-header {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }

  .exam-section .section-header h4 {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .exam-section .section-header .section-progress {
    width: auto;
    flex-shrink: 0;
    margin-left: 0;
    white-space: nowrap;
    font-size: 0.78rem;
  }

  .exam-section .section-play,
  .exam-section .section-results-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    min-height: 34px !important;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .section-ex-item .section-parts {
    padding: 0 14px 14px;
  }

  .section-type-tiles {
    grid-template-columns: 1fr;
  }
}

/* ── Mixed-test badge (shown in exercise header) ── */
.mixed-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── Mixed-test progress bar (exercise-info row) ── */
.mixed-progress-bar {
  position: relative;
  height: 22px;
  background: #e0e8f8;
  border-radius: 12px;
  overflow: hidden;
  min-width: 140px;
  max-width: 320px;
  flex: 1;
}

.mixed-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 12px;
  transition: width 0.3s ease;
}

.mixed-progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #1e293b;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Mixed-test finish screen ── */
.mixed-test-finish {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 40px 24px;
  gap: 16px;
}

.mixed-test-finish-icon .material-symbols-outlined {
  font-size: 4rem;
  color: #8b5cf6;
}

.mixed-test-finish h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
}

.mixed-test-finish p {
  color: #475569;
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
}

.mixed-test-finish-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.btn-mixed-again,
.btn-mixed-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-mixed-again {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
}

.btn-mixed-home {
  background: #f1f5f9;
  color: #334155;
}

.btn-mixed-again:hover,
.btn-mixed-home:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .btn-mixed-home .icon-btn-label {
    display: none;
  }
}

/* ── Random Test card ── */
.random-test-item {
  border-left: 3px solid #8b5cf6;
  margin-bottom: 16px;
}

.exam-number-random {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  opacity: 0.85;
  color: #8b5cf6;
}

.random-test-btn-generate {
  background: rgba(139, 92, 246, 0.12) !important;
  color: #8b5cf6 !important;
}

.random-test-btn-generate:hover {
  background: rgba(139, 92, 246, 0.25) !important;
}

.random-test-btn-repeat {
  background: rgba(59, 130, 246, 0.1) !important;
  color: #3b82f6 !important;
}

.random-test-btn-repeat:hover {
  background: rgba(59, 130, 246, 0.22) !important;
}

.random-test-empty {
  padding: 16px 20px;
  color: #64748b;
  font-size: 0.9rem;
  font-style: italic;
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .section-icon {
    width: 26px;
    height: 26px;
    min-height: 26px !important;
    padding: 4px;
    border-radius: 9px;
    font-size: 0.92rem !important;
  }

  .exam-section .section-parts,
  .section-ex-item .section-parts {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
  }

  .exam-section .part-number,
  .section-ex-item .part-number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 0.85rem;
    border-radius: 10px;
  }

  .exam-section {
    padding-top: 12px;
  }

  .section-type-tile {
    background: transparent;
    box-shadow: none;
    border: 1px solid rgba(45, 46, 95, 0.1);
    min-height: 68px;
    justify-content: center;
    padding: 10px 8px;
    border-radius: 18px;
  }

  .section-type-tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .section-type-tile-icon {
    width: 46px;
    height: 46px;
    min-height: 46px !important;
    padding: 10px;
    border-radius: 15px;
    font-size: 1.55rem !important;
  }

  .section-type-tile-label,
  .section-type-tile-arrow {
    display: none;
  }

  .section-ex-title {
    flex: 1;
    min-width: 0;
    font-size: 1.05rem;
    line-height: 1.2;
  }

  .section-ex-header {
    gap: 8px;
    padding: 10px;
  }

  .subpage-pagination {
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 20;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 6px;
    margin: 8px auto 0;
    padding: 8px;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid rgba(45, 46, 95, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 24px rgba(45, 46, 95, 0.12);
    -webkit-overflow-scrolling: touch;
  }

  .pagination-btn {
    flex: 0 0 auto;
    min-width: 34px;
    width: 34px;
    height: 34px;
    min-height: 34px !important;
    padding: 0;
    border-radius: 50%;
    font-size: 0.82rem;
  }
}

@media (max-width: 540px) {
  .section-type-tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .dashboard-layout .dashboard-center--subpage {
    padding-bottom: calc(52px + env(safe-area-inset-bottom));
  }

  .dashboard-center--subpage .subpage-pagination {
    bottom: calc(52px + env(safe-area-inset-bottom));
  }
}
