/* ===========================
   MCQ student section – one CSS for login, test, register, forgot, dashboard.
   Change font site-wide: edit the body font-family line below.
   =========================== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@100..900&display=swap');

* { box-sizing: border-box; }
:root { --app-content-padding-x: 16px; }
html { min-height: 100%; scrollbar-gutter: stable; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, 'Noto Sans Devanagari', sans-serif;
  background: #eef2f7;
  min-height: 100vh;
  padding: 15px var(--app-content-padding-x);
  color: #333;
}

/* Container: fixed top margin, no vertical center */
.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 0;
  min-width: 0;
  box-sizing: border-box;
}

/* Card: unified look (gap 15px everywhere) */
.card {
  background: #fff;
  padding: 24px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  margin-bottom: 15px;
}

.card:last-child { margin-bottom: 0; }

/* Disable copy/select on question content (user-side only) */
.no-copy-content {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Links inside cards */
.card a { color: #007bff; font-weight: 600; text-decoration: none; }
.card a:hover { text-decoration: underline; }

.msg { margin: 10px 0; }
.msg-success { color: #0d6832; font-weight: 600; margin: 10px 0; }
.msg-error { color: #c00; font-weight: 600; margin: 10px 0; }
.hint { font-size: 14px; color: #666; margin: 8px 0; }

.dashboard-subtitle { margin: -4px 0 0; font-size: 15px; color: #666; font-weight: normal; }

/* Headings */
h1, h2 {
  text-align: center;
  margin-top: 0;
  color: #1a2a44;
}

/* Inputs / Buttons */
input, select, button {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 16px;
}

/* Test page: multi-level mockup blocks */
.test-type-block { margin-bottom: 16px; }
.block-label { display: block; font-size: 14px; font-weight: 600; color: #444; margin-bottom: 8px; }
.choice-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.pill {
  padding: 10px 18px; border-radius: 8px; border: 1px solid #ccc; background: #f8f9fa;
  font-size: 15px; font-weight: 600; cursor: pointer; color: #333;
}
.pill:hover { background: #e9ecef; border-color: #adb5bd; }
.pill[aria-pressed="true"] { background: #007bff; color: #fff; border-color: #007bff; }
.test-flow-block { margin: 16px 0; padding: 12px 0; border-top: 1px solid #eee; }
.test-flow-block.test-flow-block-first { padding-bottom: 0; margin-bottom: 0; }
.test-flow-block.test-flow-block-first .flow-row { margin-bottom: 0; }
.test-flow-block .flow-select { margin: 4px 0 8px; }
.flow-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.flow-row .block-label { display: inline; margin-bottom: 0; min-width: 68px; font-size: 13px; }
.flow-row .flow-select { margin: 0; flex: 0 1 auto; min-width: 110px; max-width: 180px; padding: 6px 10px; font-size: 14px; }
.flow-actions { display: flex; gap: 10px; margin-top: 12px; }
.flow-actions .btn-flow { flex: 1; padding: 10px; font-size: 14px; }
.paper-list { margin-top: 12px; }
.mockup-divider { margin: 20px 0 16px; border: 0; border-top: 1px solid #ddd; }
.section-label { font-size: 1rem; font-weight: 600; color: #555; margin: 0 0 10px; text-align: left; }
.hint-filter { font-size: 13px; color: #666; margin: 8px 0 0; }
#testListMessage a { color: #0d6efd; text-decoration: underline; }
#testListMessage a:hover { color: #0a58ca; }
.progress-save-status.progress-save-error { color: #991b1b; }
.progress-save-status a { color: #0d6efd; text-decoration: underline; }
.progress-save-status a:hover { color: #0a58ca; }

/* Dashboard: rank block above stats (full width like buttons) */
.dashboard-rank-block { margin-top: 20px; margin-bottom: 4px; width: 100%; }
.dashboard-rank-block.dashboard-rank-block-after-links { margin-top: 16px; margin-bottom: 4px; }
/* Reserve height so async rank/stats fetch does not jump the layout */
#statsRankCard.stats-rank-card-wrap { min-height: 11.5rem; box-sizing: border-box; }
.stats-rank-card-wrap { min-width: 0; width: 100%; }

/* Dashboard: quick links after Start Test */
.dashboard-extra-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.dashboard-extra-links a {
  flex: 1;
  min-width: 8em;
  padding: 12px;
  margin: 0;
  text-align: center;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 16px;
  text-decoration: none;
  color: #1a2a44 !important;
  background: #f8f9fa;
  font-weight: 600;
  box-sizing: border-box;
}
.dashboard-extra-links a:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  color: #1a2a44 !important;
}
.stats-rank-card { width: 100%; box-sizing: border-box; }

/* Dashboard: stats section (tabular) */
.dashboard-stats { margin-top: 12px; padding-top: 16px; border-top: 1px solid #eee; text-align: left; }
.dashboard-stats .section-label { margin-bottom: 12px; }
.stats-summary-wrap { min-width: 0; }
.stats-rank-card {
  background: linear-gradient(145deg, #f0f4ff 0%, #e8eeff 100%);
  border: 1px solid #c5d4f7;
  border-radius: 12px; padding: 20px; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stats-rank-label { font-size: 13px; font-weight: 600; color: #374151; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.stats-rank-value { font-size: 2.25rem; font-weight: 800; color: #1e40af; line-height: 1.1; }
.stats-rank-of { font-size: 14px; color: #4b5563; margin-top: 4px; }
.stats-rank-encourage { font-size: 13px; color: #555; margin: 14px 0 10px; line-height: 1.4; }
.stats-rank-link { display: inline-block; font-size: 14px; font-weight: 600; color: #2563eb; text-decoration: none; }
.stats-rank-link:hover { text-decoration: underline; }
.stats-summary-wrap { margin-bottom: 0; }
.stats-daily-wrap { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats-table th, .stats-table td { padding: 10px 12px; text-align: left; border: 1px solid #e0e0e0; }
.stats-table th { background: #f5f5f5; font-weight: 600; color: #444; }
.stats-table tbody tr:nth-child(even) { background: #fafafa; }
.stats-summary-table { max-width: 320px; }
.stats-rank-hint { font-size: 12px; color: #666; margin: 8px 0 0; }
.stats-daily-table td:last-child { word-break: break-word; max-width: 200px; }
.stats-details-cell { vertical-align: top; line-height: 1.4; }
/* Same tab strip as Admin → Settings (stats modal, My Tests, etc.) */
.settings-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin-top: 12px;
  margin-bottom: 16px;
  border-bottom: 2px solid #dee2e6;
  padding-bottom: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.dashboard-stats .settings-tabs,
.stats-summary-wrap .settings-tabs {
  width: 100%;
  justify-content: flex-start;
  box-sizing: border-box;
}
.settings-tabs a {
  padding: 10px 14px;
  text-decoration: none;
  color: #555;
  font-weight: 600;
  font-size: 14px;
  border-radius: 6px 6px 0 0;
  flex-shrink: 0;
  white-space: nowrap;
}
.settings-tabs a:hover { background: #f1f3f5; color: #1a2a44; }
.settings-tabs a.active { background: #007bff; color: #fff; }
.settings-tab-panel { display: none; text-align: left; min-width: 0; max-width: 100%; box-sizing: border-box; }
.settings-tab-panel.active { display: block; }
.settings-tab-panel h3 { margin-top: 0; text-align: left; }
/* .card links default to blue — inactive tabs stay gray like Settings */
.card .settings-tabs a { color: #555; }
.card .settings-tabs a:hover { color: #1a2a44; }
.card .settings-tabs a.active { color: #fff; }
.stats-summary-wrap .settings-tab-panel { padding-top: 4px; }
.stats-summary-wrap .settings-tab-panel.active { overflow-x: auto; min-width: 0; }
html[data-theme="dark"] .settings-tabs { border-bottom-color: #3a3f48; }
html[data-theme="dark"] .settings-tabs a { color: #c2c6ce; }
html[data-theme="dark"] .settings-tabs a:hover { background: #3a3f48; color: #f2f3f5; }
html[data-theme="dark"] .settings-tabs a.active { background: #3a7bd4; color: #fff; }

/* My Tests forms: label + control on one row (grid — avoids global input{width:100%} breaking flex) */
.my-tests-form {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.my-tests-form .profile-row {
  display: grid;
  grid-template-columns: minmax(100px, 34%) minmax(0, 1fr);
  gap: 10px 12px;
  align-items: center;
  margin: 0 0 14px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.my-tests-form .profile-row.profile-row-align-start {
  align-items: start;
}
.my-tests-form .profile-row.profile-row-align-start label {
  padding-top: 10px;
}
.my-tests-form .profile-row label {
  margin: 0;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.my-tests-form .profile-row input,
.my-tests-form .profile-row select,
.my-tests-form .profile-row textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
}
.my-tests-form .profile-row input[type="file"] {
  padding: 8px 10px;
  font-size: 14px;
  width: 100%;
  max-width: 100%;
}
.my-tests-form .profile-row input[type="number"] {
  width: 100%;
  max-width: 9rem;
  justify-self: start;
}
.my-tests-form .profile-row textarea {
  min-height: 4.5rem;
  resize: vertical;
}
.my-tests-form > .hint {
  margin-bottom: 14px;
}
.my-tests-form-footer {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
.my-tests-form button.primary {
  width: auto;
  max-width: 100%;
  margin-top: 0;
}
html[data-theme="dark"] .my-tests-form .profile-row label {
  color: #c2c6ce;
}

/* My Tests — AI Generate: stepped sections + optional advanced */
.ai-flow-intro {
  margin-bottom: 12px;
  line-height: 1.45;
}
.ai-quota-hint {
  margin-bottom: 4px;
}
.ai-form-section {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid #e8eaed;
}
.ai-form-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.ai-form-section-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: #1a2a44;
  text-align: left;
}
.ai-form-section-hint {
  margin: 0 0 10px;
  font-size: 13px;
}
.ai-form-advanced {
  margin: 16px 0 0;
  padding: 10px 12px;
  background: #f5f7fa;
  border-radius: 8px;
  border: 1px solid #e8eaed;
}
.ai-form-advanced-summary {
  cursor: pointer;
  font-weight: 600;
  color: #333;
  list-style: none;
}
.ai-form-advanced-summary::-webkit-details-marker {
  display: none;
}
.ai-form-advanced[open] .ai-form-advanced-summary {
  margin-bottom: 10px;
}
.ai-form-actions {
  margin-top: 18px;
}
.ai-engine-note {
  margin: 4px 0 0;
  font-size: 13px;
}
html[data-theme="dark"] .ai-form-section {
  border-top-color: #3a3f48;
}
html[data-theme="dark"] .ai-form-section-title {
  color: #f5f6f8;
}
html[data-theme="dark"] .ai-form-advanced {
  background: #2d3139;
  border-color: #3a3f48;
}
html[data-theme="dark"] .ai-form-advanced-summary {
  color: #e2e4e8;
}

@media (max-width: 520px) {
  .my-tests-form .profile-row {
    grid-template-columns: 1fr;
    gap: 6px 0;
    align-items: stretch;
  }
  .my-tests-form .profile-row.profile-row-align-start {
    align-items: stretch;
  }
  .my-tests-form .profile-row.profile-row-align-start label {
    padding-top: 0;
  }
  .my-tests-form .profile-row label {
    margin-bottom: 2px;
  }
  .my-tests-form .profile-row input[type="number"] {
    max-width: 100%;
    justify-self: stretch;
  }
}

.stats-trend-table { width: 100%; table-layout: fixed; }
/* Date column wider to avoid overflow; Score and % columns thinner */
.stats-trend-table th:nth-child(1), .stats-trend-table td:nth-child(1) { width: 26%; min-width: 88px; }
.stats-trend-table th:nth-child(2), .stats-trend-table td:nth-child(2) { word-break: break-word; overflow-wrap: break-word; }
.stats-trend-table th:nth-child(3), .stats-trend-table td:nth-child(3) { width: 14%; }
.stats-trend-table th:nth-child(4), .stats-trend-table td:nth-child(4) { width: 10%; }
.stats-trend-label { font-size: 14px; font-weight: 600; color: #555; margin: 16px 0 8px; }
.stats-trend-table { margin-top: 0; }
.stats-empty { font-size: 14px; color: #666; margin: 0; padding: 10px 0; }
.leaderboard-intro { font-size: 14px; color: #555; margin: 0 0 16px; }
.leaderboard-table { margin-top: 0; }

/* Test page: glassy (iOS-style) dropdown – wrapper shows blur */
.select-glass-wrap {
  margin: 10px 0;
  padding: 2px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(200, 220, 255, 0.5) 0%, rgba(230, 238, 255, 0.6) 100%);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 4px 16px rgba(0,0,0,0.08);
}
#testSelect {
  display: block;
  width: 100%;
  padding: 12px;
  margin: 0;
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
#testSelect:hover,
#testSelect:focus {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(255, 255, 255, 0.9);
  outline: none;
}

button {
  background: #007bff;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: bold;
}

button:hover { background: #0056b3; }
button:disabled { background: #9bbcf5; cursor: not-allowed; }

/* Topbar (inside card or standalone) */
.topbar {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  margin-bottom: 16px;
}

.topbar-left { flex: 0 1 auto; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.edit-profile-link { margin-left: 4px; font-weight: normal; font-size: 13px; }
.user-mobile { flex: 1; text-align: left; font-weight: 600; }
.logout-link {
  flex: 0 0 auto;
  text-decoration: none;
  color: #007bff;
  font-weight: 600;
}
.logout-link:hover { text-decoration: underline; }


/* Login topbar (above card) */
.login-topbar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
}
.login-topbar a { text-decoration: none; font-weight: 600; color: #007bff; }
.login-links { text-align: center; margin-top: 10px; font-size: 14px; }
.login-links a { color: #007bff; }

/* Status / Result */
#result { text-align: center; max-width: 560px; margin: 0 auto; }

/* Quiz */
#quiz {
  display: none;
  text-align: left;
  max-width: 560px;
  margin: 0 auto;
}
.question { font-size: 18px; margin-bottom: 15px; line-height: 1.5; }

/* PYQ just after last option, above feedback/explanation */
.question-pyq { font-size: 14px; margin: 12px 0 16px; text-align: right; }
.question-pyq .pyq-badge { background: #e8f0fe; color: #1a56db; padding: 2px 8px; border-radius: 4px; font-weight: 600; }

/* Options – shared by dashboard quiz (#quiz) and demo test (#demoQuiz) */
.option,
#quiz .option,
#demoQuiz .option {
  display: grid;
  grid-template-columns: 14px 20px 1fr;
  align-items: center;
  gap: 0 10px;
  padding: 10px;
  margin: 8px 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}
.option:hover { background: #f8f9fa; }
.option input { width: auto; margin: 0; }
/* Radio – small, same for actual test and demo; 2px padding so it never gets 14px from input rules */
.option input[type="radio"],
#quiz .option input[type="radio"],
#demoQuiz .option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  padding: 2px;
  border: 1px solid #666;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
}
.option input[type="radio"]:checked,
#quiz .option input[type="radio"]:checked,
#demoQuiz .option input[type="radio"]:checked {
  background: #007bff;
  border-color: #007bff;
  box-shadow: inset 0 0 0 1.5px #fff;
}
.option.disabled { pointer-events: none; }
.option.correct { background: #d4edda; border-color: #28a745; }
.option.wrong { background: #f8d7da; border-color: #dc3545; }
.opt-key { font-weight: bold; }
.opt-text { line-height: 1.3; word-break: break-word; }

/* Progress */
.progress-wrap { margin-bottom: 15px; }
.progress-text { font-size: 14px; text-align: right; margin-bottom: 6px; }
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(0,0,0,0.1);
  border-radius: 10px;
  overflow: hidden;
}
.progress-fill { height: 100%; width: 0%; background: #28a745; }

/* Feedback (quiz and demo: same box style for correct answer + explanation) */
#feedback,
#demoFeedback {
  display: none;
  padding: 12px;
  margin-top: 12px;
  border-radius: 8px;
  font-weight: 600;
}
#feedback.correct,
#demoFeedback.correct { background: #d4edda; color: #155724; }
#feedback.wrong,
#demoFeedback.wrong { background: #f8d7da; color: #721c24; }

/* Lang toggle */
.lang-label { font-size: 14px; margin-right: 8px; color: #555; }
.lang-btn {
  padding: 6px 12px;
  margin-left: 4px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.lang-btn.active { background: #007bff; color: #fff; border-color: #007bff; }

/* ===========================
   Admin pages (shared)
   =========================== */
body.admin-page { padding: 15px var(--app-content-padding-x); }
body.admin-page .card { max-width: 560px; margin: 0 auto 15px; }
body.admin-page .top-links {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 14px;
}
body.admin-page .top-links a { color: #007bff; text-decoration: underline; font-weight: 600; }

/* Admin dashboard stats/buttons/sections: defined only in mcqs/admin/style.css so production look is consistent. */

/* ===========================
   Mobile
   =========================== */
@media (max-width: 768px) {
  /* Same container width on homepage, MCQ and admin: single padding variable, reserve scrollbar */
  :root { --app-content-padding-x: 12px; }
  html { overflow-y: scroll; scrollbar-gutter: stable; }
  body { padding: 15px var(--app-content-padding-x); }
  body.admin-page { padding: 15px var(--app-content-padding-x); }
  .page-wrapper { width: 100%; box-sizing: border-box; }
  .site-container { width: 100%; max-width: 100%; box-sizing: border-box; padding: 0; }

  .container { max-width: 100%; width: 100%; box-sizing: border-box; padding: 0; }
  .card { padding: 20px; border-radius: 12px; }
  body.admin-page .card { padding: 20px; }

  h1, h2 { font-size: 20px; line-height: 1.3; }

  input, select, button { padding: 14px; font-size: 16px; }
  /* Option row: compact on mobile; small radio */
  .option {
    padding: 8px 10px;
    min-height: 40px;
    grid-template-columns: 14px 18px 1fr;
    gap: 0 8px;
  }
  .option input[type="radio"] {
    width: 10px;
    height: 10px;
    padding: 2px;
  }
  .option input[type="radio"]:checked {
    box-shadow: inset 0 0 0 1.5px #fff;
  }

  .question { font-size: 17px; }

  #nextBtn {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 999;
    width: auto !important;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
  }
  #quiz { padding-bottom: 80px !important; }

  .user-mobile, .logout-link { font-size: 13px; }
  .btn-demo-end-register { padding: 14px; }

  /* Header/footer: single logo visible, smaller size on mobile */
  .site-header .site-brand .site-logo-wrap {
    position: relative;
    min-height: 26px;
    display: flex;
    align-items: center;
  }
  .site-header .site-brand .site-logo-wrap .site-logo {
    max-height: 26px;
    width: auto;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
  }
  .site-header .site-brand .site-logo-wrap .site-logo-light,
  .site-header .site-brand .site-logo-wrap .site-logo:only-of-type { display: block !important; }
  .site-header .site-brand .site-logo-wrap .site-logo-dark { display: none !important; }
  html[data-theme="dark"] .site-header .site-brand .site-logo-wrap .site-logo-light { display: none !important; }
  html[data-theme="dark"] .site-header .site-brand .site-logo-wrap .site-logo-dark { display: block !important; }

  .site-footer .footer-site-name.site-brand .site-logo-wrap {
    position: relative;
    min-height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .site-footer .footer-site-name.site-brand .site-logo-wrap .site-logo {
    max-height: 22px;
    width: auto;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
  .site-footer .footer-site-name.site-brand .site-logo-wrap .site-logo-light,
  .site-footer .footer-site-name.site-brand .site-logo-wrap .site-logo:only-of-type { display: block !important; }
  .site-footer .footer-site-name.site-brand .site-logo-wrap .site-logo-dark { display: none !important; }
  html[data-theme="dark"] .site-footer .footer-site-name.site-brand .site-logo-wrap .site-logo-light { display: none !important; }
  html[data-theme="dark"] .site-footer .footer-site-name.site-brand .site-logo-wrap .site-logo-dark { display: block !important; }
}

/* Page wrapper: desktop 3-column (left ad | content | right ad), mobile single column */
.page-wrapper {
  max-width: 100%;
  margin: 0 auto;
}
@media (min-width: 1024px) {
  .page-wrapper {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: center;
    max-width: 1280px;
    gap: 20px;
  }
  .page-wrapper .site-container {
    flex: 0 0 560px;
    max-width: 560px;
    min-width: 0;
  }
  .ad-slot-left,
  .ad-slot-right {
    flex: 0 0 160px;
    min-width: 160px;
    max-width: 160px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  .ad-slot-left.ad-align-middle,
  .ad-slot-right.ad-align-middle { justify-content: center; }
  .ad-slot-left.ad-align-bottom,
  .ad-slot-right.ad-align-bottom { justify-content: flex-end; }
  .ad-slot-left .ad-slot-inner,
  .ad-slot-right .ad-slot-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
  .ad-slot-left.ad-pos-center .ad-slot-inner,
  .ad-slot-right.ad-pos-center .ad-slot-inner { align-items: center; }
  .ad-slot-left.ad-pos-right .ad-slot-inner,
  .ad-slot-right.ad-pos-right .ad-slot-inner { align-items: flex-end; }
  .ad-slot-left,
  .ad-slot-right { box-sizing: border-box; }
}
@media (max-width: 1023px) {
  .ad-slot-left,
  .ad-slot-right {
    display: none !important;
  }
}

/* Ad slots: shared */
.ad-slot { margin: 0; }
.ad-slot-link { display: block; }
.ad-slot-inner { width: 100%; }
.ad-slot-img { max-width: 100%; height: auto; display: block; vertical-align: middle; border-radius: 6px; object-fit: contain; }
.ad-slot-below_header,
.ad-slot-above_footer { margin: 15px 0; display: flex; flex-direction: column; align-items: center; }
.ad-slot-below_header.ad-pos-left,
.ad-slot-above_footer.ad-pos-left { align-items: flex-start; }
.ad-slot-below_header.ad-pos-right,
.ad-slot-above_footer.ad-pos-right { align-items: flex-end; }
.ad-slot-below_header.ad-align-middle .ad-slot-inner,
.ad-slot-above_footer.ad-align-middle .ad-slot-inner { align-self: center; }
.ad-slot-below_header .ad-slot-img,
.ad-slot-above_footer .ad-slot-img { margin: 0 auto; }
.ad-slot-between_cards { margin: 15px 0; display: flex; flex-direction: column; align-items: center; }
.ad-slot-between_cards.ad-pos-left { align-items: flex-start; }
.ad-slot-between_cards.ad-pos-right { align-items: flex-end; }
.ad-slot-between_cards .ad-slot-img { margin: 0 auto; }
.ad-slot-between_questions { margin: 16px 0; text-align: center; padding: 12px; background: #f8f9fa; border-radius: 8px; }
.ad-slot-between_questions .ad-slot-img { margin: 0 auto; max-height: 120px; }

/* Site header/footer (same as root) */
.site-container { max-width: 560px; margin: 0 auto; padding: 0; }
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; padding: 14px 20px; border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1); margin-bottom: 15px;
  height: 68px;
  box-sizing: border-box;
}
.site-header .site-name,
.site-header .site-brand { font-size: 1.25rem; font-weight: 700; color: #1a2a44; line-height: 1.2; }
.site-header a.site-name,
.site-header a.site-brand { text-decoration: none; color: #1a2a44; }
.site-header a.site-name:hover,
.site-header a.site-brand:hover { text-decoration: underline; }
.site-header .site-brand .site-logo-wrap { display: flex; align-items: center; min-height: 32px; }
.site-header .site-brand .site-logo { max-height: 32px; width: auto; display: block; height: auto; }
.site-header .site-brand .site-logo-light,
.site-header .site-brand .site-logo:only-of-type { display: block; }
.site-header .site-brand .site-logo-dark { display: none !important; }
html[data-theme="dark"] .site-header .site-brand .site-logo-light { display: none !important; }
html[data-theme="dark"] .site-header .site-brand .site-logo-dark { display: block !important; }
.site-header .site-brand .site-brand-fallback { display: none; }
.site-header .site-brand.logo-fallback-visible .site-logo-wrap { display: none; }
.site-header .site-brand.logo-fallback-visible .site-brand-fallback { display: inline; }
.site-header a.site-brand:hover { text-decoration: none; }
.site-header .site-brand.logo-fallback-visible:hover { text-decoration: underline; }
.site-header .header-menu-wrap { position: relative; z-index: 20; display: flex; align-items: center; gap: 4px; }
.site-header .dark-mode-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: none; background: transparent;
  color: #1a2a44; cursor: pointer; border-radius: 6px;
}
.site-header .dark-mode-toggle:hover { background: #f0f0f0; }
.site-header .dark-mode-toggle .icon-sun { display: none; }
.site-header .dark-mode-toggle .icon-moon { display: block; }
html[data-theme="dark"] .site-header .dark-mode-toggle .icon-sun { display: block; }
html[data-theme="dark"] .site-header .dark-mode-toggle .icon-moon { display: none; }
.site-header .menu-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: none; background: transparent;
  color: #1a2a44; cursor: pointer; border-radius: 6px;
}
.site-header .menu-toggle:hover { background: #f0f0f0; }
.site-header .header-menu {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 4px;
  min-width: 180px; background: #fff; border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15); padding: 8px 0; z-index: 10;
}
.site-header .header-menu.open { display: block; }
.site-header .header-menu a {
  display: block; padding: 10px 16px; color: #0066cc; text-decoration: none; font-size: 15px;
}
.site-header .header-menu a:hover { background: #f4f6f8; }
.site-header .header-menu .menu-group {
  padding: 8px 16px 4px; border-bottom: 1px solid #eee;
}
.site-header .header-menu .menu-group:last-of-type { border-bottom: none; }
.site-header .header-menu .menu-group-label {
  display: block; font-size: 12px; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 4px; padding: 0;
}
.site-header .header-menu .menu-sub {
  list-style: none; margin: 0; padding: 0 0 4px 0;
}
.site-header .header-menu .menu-sub li { margin: 0; }
.site-header .header-menu .menu-sub a {
  display: block; padding: 6px 0 6px 8px; font-size: 14px; color: #0066cc; text-decoration: none;
}
.site-header .header-menu .menu-sub a:hover { background: #f4f6f8; }
.site-footer {
  background: #fff; color: #333; text-align: center; padding: 16px 20px; font-size: 13px;
  margin-top: 15px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.site-footer .footer-block { display: block; margin-top: 6px; }
.site-footer .footer-block:first-child { margin-top: 0; }
.site-footer .footer-site-name { font-weight: 700; color: #1a2a44; font-size: 1.05em; text-align: center; }
.site-footer .footer-site-name.site-brand { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; }
.site-footer .footer-site-name.site-brand .site-logo-wrap { display: flex; align-items: center; justify-content: center; }
.site-footer .footer-site-name.site-brand .site-logo { max-height: 28px; width: auto; display: block; }
.site-footer .footer-site-name.site-brand .site-logo-light { display: block; }
.site-footer .footer-site-name.site-brand .site-logo-dark { display: none !important; }
html[data-theme="dark"] .site-footer .footer-site-name.site-brand .site-logo-light { display: none !important; }
html[data-theme="dark"] .site-footer .footer-site-name.site-brand .site-logo-dark { display: block !important; }
.site-footer .footer-site-name.site-brand .site-brand-fallback { display: none; }
.site-footer .footer-site-name.site-brand.logo-fallback-visible .site-logo-wrap { display: none; }
.site-footer .footer-site-name.site-brand.logo-fallback-visible .site-brand-fallback { display: inline; }
.site-footer .footer-headline { color: #444; font-size: 0.95em; }
.site-footer .footer-sep { color: #999; }
.site-footer .footer-link { color: #0066cc; text-decoration: none; }
.site-footer .footer-link:hover { text-decoration: underline; }
.site-footer .footer-copy { color: #555; }

/* Index: consistent spacing (Header → Demo → Login → Footer) */
.index-page .card { margin-bottom: 15px; }
.index-page .card:last-child { margin-bottom: 0; }
.site-header { margin-bottom: 15px; }
.site-footer { margin-top: 15px; }

/* Index: features card + demo CTA */
.index-features-card { text-align: left; }
.index-features-title { font-size: 1.1rem; margin: 0 0 10px 0; color: #1a2a44; text-align: center; }
.index-features-list { list-style: none; padding: 0; margin: 0; }
.index-features-list li { position: relative; padding: 6px 0 6px 22px; font-size: 14px; color: #444; }
.index-features-list li::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 6px; height: 6px; background: #0d6b3a; border-radius: 50%; }
.index-demo-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.index-demo-text { font-size: 15px; color: #444; }
.btn-demo-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0d6b3a;
  color: #fff !important;
  padding: 6px 30px;
  border-radius: 8px;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 14px;
  border: none;
  line-height: 1.2;
}
.btn-demo-index:hover { background: #0a552e; color: #fff !important; text-decoration: none !important; }

/* Dark mode – high-contrast light text on dark background */
html[data-theme="dark"] body { background: #1a1d23; color: #f2f3f5; }
html[data-theme="dark"] .card { background: #252830; box-shadow: 0 4px 12px rgba(0,0,0,0.3); color: #f2f3f5; }
html[data-theme="dark"] .card p,
html[data-theme="dark"] .card .question,
html[data-theme="dark"] .opt-text,
html[data-theme="dark"] .opt-key,
html[data-theme="dark"] .pill,
html[data-theme="dark"] .dashboard-subtitle,
html[data-theme="dark"] .index-features-list li,
html[data-theme="dark"] .index-demo-text,
html[data-theme="dark"] .progress-text { color: #f2f3f5; }
html[data-theme="dark"] h1, html[data-theme="dark"] h2 { color: #f5f6f8; }
html[data-theme="dark"] .site-header { background: #252830; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
html[data-theme="dark"] .site-header .site-name, html[data-theme="dark"] .site-header a.site-name,
html[data-theme="dark"] .site-header .site-brand, html[data-theme="dark"] .site-header a.site-brand { color: #f5f6f8; }
html[data-theme="dark"] .site-header .menu-toggle:hover,
html[data-theme="dark"] .site-header .dark-mode-toggle:hover { background: #3a3f48; }
html[data-theme="dark"] .site-header .menu-toggle,
html[data-theme="dark"] .site-header .dark-mode-toggle { color: #f5f6f8; }
html[data-theme="dark"] .site-header .header-menu { background: #252830; box-shadow: 0 4px 15px rgba(0,0,0,0.4); }
html[data-theme="dark"] .site-header .header-menu a { color: #7ab4ff; }
html[data-theme="dark"] .site-header .header-menu a:hover { background: #3a3f48; }
html[data-theme="dark"] .site-header .header-menu .menu-group-label { color: #c2c6ce; }
html[data-theme="dark"] .site-header .header-menu .menu-sub a { color: #7ab4ff; }
html[data-theme="dark"] .site-header .header-menu .menu-group { border-bottom-color: #3a3f48; }
html[data-theme="dark"] .site-footer { background: #252830; color: #d8dce4; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
html[data-theme="dark"] .site-footer .footer-site-name,
html[data-theme="dark"] .site-footer .footer-site-name.site-brand .site-brand-fallback { color: #f5f6f8; }
html[data-theme="dark"] .site-footer .footer-headline,
html[data-theme="dark"] .site-footer .footer-copy { color: #d8dce4; }
html[data-theme="dark"] .site-footer .footer-link { color: #7ab4ff; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea {
  background: #2d3139; border-color: #3a3f48; color: #f2f3f5;
}
html[data-theme="dark"] .hint, html[data-theme="dark"] .block-label, html[data-theme="dark"] .hint-filter,
html[data-theme="dark"] .section-label, html[data-theme="dark"] .stats-rank-label { color: #c2c6ce; }
html[data-theme="dark"] .stats-rank-of, html[data-theme="dark"] .stats-rank-encourage, html[data-theme="dark"] .stats-rank-hint,
html[data-theme="dark"] .stats-empty, html[data-theme="dark"] .leaderboard-intro, html[data-theme="dark"] .stats-trend-label,
html[data-theme="dark"] .lang-label { color: #c2c6ce; }
html[data-theme="dark"] .card a { color: #7ab4ff; }
html[data-theme="dark"] .msg-success { color: #86efac; }
html[data-theme="dark"] .msg-error { color: #f5a5a5; }
html[data-theme="dark"] .option { border-color: #3a3f48; color: #f2f3f5; }
html[data-theme="dark"] .option:hover { background: #2d3139; }
html[data-theme="dark"] .option:focus-within { background: #2d3139; border-color: #4a4f58; outline: none; }
html[data-theme="dark"] .option.correct { background: #1e4620; border-color: #2e7d32; color: #e8f5e9; }
html[data-theme="dark"] .option.wrong { background: #5c2a2a; border-color: #c62828; color: #ffcdd2; }
html[data-theme="dark"] #feedback.correct, html[data-theme="dark"] #demoFeedback.correct { background: #1e4620; color: #c8e6c9; }
html[data-theme="dark"] #feedback.wrong, html[data-theme="dark"] #demoFeedback.wrong { background: #5c2a2a; color: #ffcdd2; }
html[data-theme="dark"] .progress-bar { background: rgba(255,255,255,0.15); }
html[data-theme="dark"] .question-pyq .pyq-badge { background: #1e3a5f; color: #7ab4ff; }
/* Quiz: Next and End Test buttons – dark mode */
html[data-theme="dark"] #quiz button,
html[data-theme="dark"] #quiz button#nextBtn {
  background: #3a7bd4;
  color: #fff;
  border: none;
}
html[data-theme="dark"] #quiz button:hover,
html[data-theme="dark"] #quiz button#nextBtn:hover { background: #2d6ac4; }
html[data-theme="dark"] #quiz button:disabled { background: #4a4f58; color: #9ca3af; cursor: not-allowed; }
html[data-theme="dark"] #quiz button#endTestBtn {
  background: #b91c1c !important;
  color: #fff;
}
html[data-theme="dark"] #quiz button#endTestBtn:hover { background: #991b1b !important; }
html[data-theme="dark"] .stats-rank-card { background: linear-gradient(145deg, #2d3139 0%, #252830 100%); border-color: #3a3f48; }
html[data-theme="dark"] .stats-rank-value { color: #7ab4ff; }
html[data-theme="dark"] .stats-table th, html[data-theme="dark"] .stats-table td { color: #f2f3f5; }
html[data-theme="dark"] .stats-table th { background: #2d3139; }
html[data-theme="dark"] .stats-table tbody tr:nth-child(even) { background: #2a2e36; }
html[data-theme="dark"] .dashboard-stats { border-top-color: #3a3f48; }
html[data-theme="dark"] .dashboard-extra-links a {
  background: #2d3139;
  border-color: #3a3f48;
  color: #f2f3f5 !important;
}
html[data-theme="dark"] .dashboard-extra-links a:hover {
  background: #3a3f48;
  border-color: #4a4f58;
  color: #f2f3f5 !important;
}
/* Dashboard: available test box – dark background and light text */
html[data-theme="dark"] .select-glass-wrap {
  background: linear-gradient(135deg, rgba(45, 49, 57, 0.95) 0%, rgba(37, 40, 48, 0.98) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 4px 16px rgba(0,0,0,0.3);
}
html[data-theme="dark"] #testSelect {
  background: #2d3139;
  color: #f2f3f5;
  border-color: #3a3f48;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
html[data-theme="dark"] #testSelect:hover,
html[data-theme="dark"] #testSelect:focus {
  background: #3a3f48;
  border-color: #4a4f58;
  color: #f2f3f5;
  outline: none;
}
html[data-theme="dark"] #testSelect option {
  background: #252830;
  color: #f2f3f5;
}
html[data-theme="dark"] .logout-link, html[data-theme="dark"] .login-topbar a { color: #7ab4ff; }
html[data-theme="dark"] .topbar-left, html[data-theme="dark"] .user-mobile { color: #f2f3f5; }
html[data-theme="dark"] .index-features-title { color: #f5f6f8; }

/* DOB / Attempt-details required modal – dark mode */
html[data-theme="dark"] .dob-required-overlay { background: rgba(0,0,0,0.7); }
html[data-theme="dark"] .dob-required-box {
  background: #252830;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  color: #f2f3f5;
}
html[data-theme="dark"] .dob-required-box p { color: #e2e4e8; }
html[data-theme="dark"] .dob-required-box a.btn-dob-profile {
  background: #3a7bd4;
  color: #fff;
}
html[data-theme="dark"] .dob-required-box a.btn-dob-profile:hover { background: #2d6ac4; color: #fff; }
html[data-theme="dark"] .dob-required-box button.btn-dob-cancel {
  background: #3a3f48;
  color: #e2e4e8;
}
html[data-theme="dark"] .dob-required-box button.btn-dob-cancel:hover { background: #4a4f58; color: #f2f3f5; }

/* Profile page – section boxes and labels dark mode */
html[data-theme="dark"] .profile-section {
  background: #252830;
  border: 1px solid #3a3f48;
  color: #f2f3f5;
}
html[data-theme="dark"] .profile-section h3 { color: #f5f6f8; }
html[data-theme="dark"] .profile-row label { color: #c2c6ce; }
html[data-theme="dark"] .profile-row .readonly { color: #a8adb4; }
html[data-theme="dark"] .profile-actions button { background: #2d3139; border-color: #3a3f48; color: #f2f3f5; }
html[data-theme="dark"] .profile-actions button:hover { background: #3a3f48; }
html[data-theme="dark"] .personal-details-grid label { color: #c2c6ce; }
html[data-theme="dark"] .personal-details-grid input { background: #2d3139; border-color: #3a3f48; color: #f2f3f5; }
html[data-theme="dark"] .card a[href="dashboard"],
html[data-theme="dark"] .card a[href="profile"] { color: #7ab4ff; }

/* Profile Video Library tab – dark mode */
html[data-theme="dark"] #tab-videos .video-lib-existing-section .hint { background: #2d3139; border-color: #3a3f48; color: #c2c6ce; }
html[data-theme="dark"] #tab-videos .video-lib-existing-details { border-color: #3a3f48; }
html[data-theme="dark"] #tab-videos .video-lib-details-summary { background: #2d3139 !important; color: #f2f3f5; }
html[data-theme="dark"] #tab-videos .video-lib-details-summary .hint { color: #a8adb4; }
html[data-theme="dark"] #tab-videos .video-lib-existing-details .video-lib-arrow { border-left-color: transparent; border-right-color: transparent; border-top-color: #a8adb4; }
html[data-theme="dark"] #tab-videos .video-lib-existing-body { background: #252830 !important; border-top-color: #3a3f48; color: #f2f3f5; }
html[data-theme="dark"] #tab-videos .video-lib-existing-body .hint { color: #a8adb4; }
html[data-theme="dark"] #tab-videos .video-lib-existing-body label { color: #c2c6ce; }
html[data-theme="dark"] #tab-videos .video-lib-existing-body input { background: #2d3139; border-color: #3a3f48; color: #f2f3f5; }
html[data-theme="dark"] #tab-videos .video-lib-video-list li { background: #2d3139; border-color: #3a3f48; color: #f2f3f5; }
html[data-theme="dark"] #tab-videos .video-lib-video-list li a { color: #7ab4ff; }
html[data-theme="dark"] #tab-videos #video-lib-add-playlist-form { background: #252830 !important; border-color: #3a3f48; }
html[data-theme="dark"] #tab-videos #add-playlist-type-hint { color: #a8adb4; }
html[data-theme="dark"] #tab-videos #add-playlist-form label { color: #c2c6ce; }
html[data-theme="dark"] #tab-videos #add-playlist-form input { background: #2d3139; border-color: #3a3f48; color: #f2f3f5; }
html[data-theme="dark"] #tab-videos #add-playlist-form select { background: #2d3139; border-color: #3a3f48; color: #f2f3f5; }

/* Profile datepicker (Air Datepicker) dark mode */
html[data-theme="dark"] .air-datepicker-global-container,
html[data-theme="dark"] .air-datepicker-global-container .air-datepicker {
  background: #252830;
  border-color: #3a3f48;
  color: #f2f3f5;
}
html[data-theme="dark"] .air-datepicker-body--day-name,
html[data-theme="dark"] .air-datepicker-body--day-name span,
html[data-theme="dark"] .air-datepicker-body--cell,
html[data-theme="dark"] .air-datepicker-nav--title,
html[data-theme="dark"] .air-datepicker-nav--action,
html[data-theme="dark"] .air-datepicker-body--cells-months .air-datepicker-body--cell,
html[data-theme="dark"] .air-datepicker-body--cells-years .air-datepicker-body--cell {
  color: #f2f3f5 !important;
}
html[data-theme="dark"] .air-datepicker-body--cell.-other-month- { color: #6b7280 !important; }
html[data-theme="dark"] .air-datepicker-body--cell.-current- { color: #7ab4ff; }
