/* ============================================================
   Shaheen Academy — styles.css
   Mobile-first, responsive. Palette: deep emerald + gold.
   Sections:
     1. Tokens & base
     2. Header
     3. Layout & cards
     4. Buttons & tap targets
     5. Home widgets (streak, XP, tracks)
     6. Lists (courses, chapters, lessons)
     7. Lesson typography
     8. Quiz
     9. Progress bars
    10. Certificate (+ print styles — ONLY the certificate prints)
    11. Search
    12. Bottom nav
    13. Utilities, focus, motion
    14. Auto-update prompt
   ============================================================ */

/* ---------- 1. Tokens & base ---------- */
:root {
  --emerald: #046a4d;
  --emerald-dark: #034d38;
  --emerald-deep: #023325;
  --emerald-soft: #e7f3ee;
  --gold: #c9a227;
  --gold-light: #f3e6b3;
  --gold-dark: #8a6d1a;
  --bg: #f4f8f6;
  --card: #ffffff;
  --ink: #14332a;
  --muted: #5c736b;
  --line: #dce8e2;
  --danger: #b3402f;
  --danger-soft: #fbeeea;
  --ok: #046a4d;
  --ok-soft: #e7f3ee;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(3, 77, 56, 0.08);
  --nav-h: 64px;
  --header-h: 60px;
  --font-ui: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-urdu: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 0.5em; color: var(--emerald-deep); }
p { margin: 0 0 1em; }
a { color: var(--emerald); }

/* Urdu text: right-to-left Nastaliq with generous line height */
.ur, [lang="ur"] {
  font-family: var(--font-urdu);
  direction: rtl;
  text-align: right;
  line-height: 2.2;
}

/* ---------- 2. Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-h); /* grows with content — never clips brand text over the utility bar */
  background: linear-gradient(135deg, var(--emerald-dark), var(--emerald));
  display: flex;
  align-items: center;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  min-height: 44px;
  min-width: 0; /* allow shrink in the header row on narrow screens */
}

.brand-mark svg { display: block; border-radius: 8px; }

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-weight: 700; font-size: 1.1rem; letter-spacing: 0.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; /* never wraps/splits over the utility bar */
}
.brand-tagline { font-size: 0.75rem; color: var(--gold-light); letter-spacing: 0.4px; }

/* ---------- 3. Layout & cards ---------- */
#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card-link:active { transform: scale(0.99); }

.empty { text-align: center; color: var(--muted); }
.empty .big { font-size: 2.4rem; display: block; margin-bottom: 8px; }

.page-title { font-size: 1.5rem; margin-bottom: 4px; }
.page-sub { color: var(--muted); margin-bottom: 14px; }

.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--emerald); text-decoration: none; }

/* ---------- 4. Buttons & tap targets ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 2px solid transparent;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: scale(0.98); }

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

.btn-gold { background: var(--gold); color: var(--emerald-deep); }
.btn-gold:hover { background: var(--gold-dark); color: #fff; }

.btn-outline { background: #fff; color: var(--emerald); border-color: var(--emerald); }
.btn-outline:hover { background: var(--emerald-soft); }

.btn-block { display: flex; width: 100%; }

.btn[disabled], .btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn-row .btn { flex: 1 1 140px; }

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-soon { background: var(--line); color: var(--muted); }
.badge-gold { background: var(--gold-light); color: var(--gold-dark); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-board { background: var(--emerald-soft); color: var(--emerald-deep); }

/* Board picker (school track): horizontally scrollable chips, reuses .cat-chip */
.board-row {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 4px 2px 10px; margin: 2px -2px 0;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.board-row::-webkit-scrollbar { display: none; }
.board-row .cat-chip { flex: 0 0 auto; }
.board-count { margin: 0 0 12px; }

/* ---------- 5. Home widgets ---------- */
.greeting { font-size: 1.35rem; margin-bottom: 2px; }
.greeting-sub { color: var(--muted); margin-bottom: 14px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat-card {
  background: linear-gradient(135deg, var(--emerald-dark), var(--emerald));
  color: #fff;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card .stat-num { font-size: 1.9rem; font-weight: 700; color: var(--gold-light); }
.stat-card .stat-label { font-size: 0.8rem; opacity: 0.9; }
.stat-card.flame { background: linear-gradient(135deg, #7a3b00, #c46a00); }
.stat-card.flame .stat-num { color: #ffe9c4; }

.level-card .level-head { display: flex; justify-content: space-between; align-items: baseline; }
.level-name { font-weight: 700; font-size: 1.1rem; color: var(--emerald-deep); }
.level-xp { font-size: 0.85rem; color: var(--muted); }
.level-next { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

.track-card { display: flex; gap: 14px; align-items: center; }
.track-icon {
  font-size: 2rem;
  width: 60px; height: 60px; flex: 0 0 60px;
  display: flex; align-items: center; justify-content: center;
  background: var(--emerald-soft);
  border-radius: var(--radius-sm);
}
.track-body { flex: 1; min-width: 0; }
.track-body h3 { margin: 0 0 2px; font-size: 1.05rem; }
.track-tagline { font-size: 0.85rem; color: var(--muted); margin: 0 0 8px; }
.track-arrow { color: var(--gold-dark); font-size: 1.4rem; }

.resume-card {
  background: linear-gradient(135deg, var(--gold-light), #fff);
  border: 2px solid var(--gold);
}

/* ---------- 6. Lists ---------- */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  min-height: 56px;
  text-decoration: none;
  color: inherit;
}
.list-item:last-child { border-bottom: 0; }
.list-item .li-icon { font-size: 1.5rem; flex: 0 0 auto; }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; margin: 0; }
.list-item .li-sub { font-size: 0.85rem; color: var(--muted); margin: 2px 0 0; }
.list-item .li-meta { font-size: 0.8rem; color: var(--muted); text-align: right; flex: 0 0 auto; }
.list-item.disabled { opacity: 0.65; }

.check { color: var(--ok); font-weight: 700; }

/* ---------- 7. Lesson typography ---------- */
.lesson-body { font-size: 1.05rem; }
.lesson-body h2, .lesson-body h3 { color: var(--emerald-dark); margin-top: 1.4em; }
.lesson-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.lesson-body table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 0.95rem; }
.lesson-body th, .lesson-body td { border: 1px solid var(--line); padding: 8px; text-align: left; }
.lesson-body th { background: var(--emerald-soft); }
.lesson-body blockquote {
  border-left: 4px solid var(--gold);
  margin: 1em 0; padding: 8px 14px;
  background: #fffdf4; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.lesson-nav { display: flex; gap: 10px; margin-top: 18px; }
.lesson-nav .btn { flex: 1; }

/* ---------- 8. Quiz ---------- */
.quiz-progress { margin-bottom: 14px; }
.quiz-qcount { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.quiz-question { font-size: 1.2rem; font-weight: 600; color: var(--emerald-deep); margin-bottom: 16px; }

.quiz-options { display: grid; gap: 10px; }
.quiz-option {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 1rem; font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.quiz-option .opt-key {
  flex: 0 0 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--emerald-soft); color: var(--emerald-dark);
  font-weight: 700; font-size: 0.9rem;
}
.quiz-option:not(.locked):hover { border-color: var(--emerald); }
.quiz-option.locked { cursor: default; }
.quiz-option.correct { border-color: var(--ok); background: var(--ok-soft); }
.quiz-option.correct .opt-key { background: var(--ok); color: #fff; }
.quiz-option.wrong { border-color: var(--danger); background: var(--danger-soft); }
.quiz-option.wrong .opt-key { background: var(--danger); color: #fff; }
.quiz-option.dim { opacity: 0.6; }

.quiz-explain {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: #fffdf4;
  border: 1px solid var(--gold);
  font-size: 0.95rem;
}
.quiz-explain strong { color: var(--gold-dark); }

.quiz-result { text-align: center; }
.quiz-score-ring {
  width: 120px; height: 120px; margin: 8px auto 12px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 700;
  background: conic-gradient(var(--emerald) var(--pct, 0%), var(--line) 0);
  position: relative;
}
.quiz-score-ring::before {
  content: "";
  position: absolute; inset: 12px;
  background: #fff; border-radius: 50%;
}
.quiz-score-ring span { position: relative; color: var(--emerald-deep); }

/* ---------- 9. Progress bars ---------- */
.pbar {
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.pbar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--emerald), var(--gold));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.pbar-label { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* ---------- 10. Certificate ---------- */
.cert-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.name-input {
  width: 100%; min-height: 48px;
  padding: 10px 16px;
  font-family: inherit; font-size: 1.05rem;
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  margin: 8px 0 4px;
}
.name-input:focus { border-color: var(--emerald); outline: none; }

.certificate {
  background: #fffdf6;
  border: 6px double var(--gold);
  border-radius: 8px;
  padding: 36px 28px;
  text-align: center;
  margin: 18px 0;
  box-shadow: var(--shadow);
  position: relative;
}
.certificate::before {
  content: "";
  position: absolute; inset: 8px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  pointer-events: none;
}
.cert-brand { color: var(--emerald-dark); font-weight: 700; letter-spacing: 2px; font-size: 0.9rem; text-transform: uppercase; }
.cert-mark { margin: 10px auto; }
.cert-title { font-size: 2rem; color: var(--gold-dark); margin: 6px 0; font-weight: 700; }
.cert-name {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 1.9rem;
  color: var(--emerald-deep);
  border-bottom: 2px solid var(--gold);
  display: inline-block;
  padding: 0 24px 6px;
  margin: 8px 0 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.cert-course { font-size: 1.1rem; font-weight: 600; color: var(--ink); }
.cert-date { color: var(--muted); font-size: 0.9rem; margin-top: 10px; }
.cert-disclaimer {
  margin-top: 22px;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  line-height: 1.5;
}
.cert-check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cert-check:last-child { border-bottom: 0; }

/* Print: ONLY the certificate prints — chrome, nav and actions are hidden */
@media print {
  .app-header, .bottom-nav, .cert-actions, .no-print { display: none !important; }
  body { background: #fff; padding: 0; }
  #app { max-width: none; padding: 0; margin: 0; }
  .certificate { box-shadow: none; margin: 0; page-break-inside: avoid; }
  .card { box-shadow: none; border: 0; }
}

/* ---------- 11. Search ---------- */
.search-form { display: flex; gap: 8px; margin-bottom: 14px; }
.search-input {
  flex: 1; min-height: 48px;
  padding: 10px 16px;
  font-family: inherit; font-size: 1rem;
  border: 2px solid var(--line); border-radius: 999px;
  background: #fff;
}
.search-input:focus { border-color: var(--emerald); outline: none; }
.search-result .li-icon { font-size: 1.2rem; }
.result-kind {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--gold-dark); background: var(--gold-light);
  padding: 2px 8px; border-radius: 999px; margin-left: 8px;
}
mark { background: var(--gold-light); border-radius: 3px; padding: 0 2px; }

/* ---------- 12. Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  box-shadow: 0 -2px 10px rgba(3, 77, 56, 0.06);
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--muted);
  min-height: var(--nav-h);
  font-size: 0.72rem; font-weight: 600;
}
.bottom-nav .nav-icon { font-size: 1.35rem; line-height: 1; }
.bottom-nav a.active { color: var(--emerald); }
.bottom-nav a.active .nav-icon {
  background: var(--emerald-soft);
  border-radius: 999px;
  padding: 2px 14px;
}

/* ---------- 13. Utilities, focus, motion ---------- */
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.mt { margin-top: 14px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

@media (min-width: 560px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .page-title { font-size: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- 14. v2 dynamic features ---------- */
/* Top utility bar: live date (left) + visitor location (right) */
.utility-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--emerald-deep); color: #eaf5f0;
  font-size: 0.78rem;
  padding: 6px 16px;
  padding-top: calc(6px + env(safe-area-inset-top, 0px));
}
.utility-bar .util-item {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#util-date { font-weight: 600; letter-spacing: 0.2px; }
#util-location { color: var(--gold-light); }

/* Header auth area */
.app-header { justify-content: space-between; }
#auth-area { margin-left: auto; flex: 0 0 auto; }
.auth-join {
  background: var(--gold); color: var(--emerald-deep);
  border: 0; border-radius: 999px; padding: 9px 16px;
  font-family: inherit; font-weight: 700; font-size: 0.88rem; cursor: pointer;
  min-height: 40px; white-space: nowrap;
}
.auth-join:active { transform: scale(0.97); }

.auth-user { position: relative; }
.auth-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff; border-radius: 999px; padding: 5px 12px 5px 5px;
  font-family: inherit; cursor: pointer; min-height: 44px; max-width: 200px;
}
.auth-avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  background: var(--gold); color: var(--emerald-deep);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
}
.auth-avatar.big { width: 52px; height: 52px; flex-basis: 52px; font-size: 1.4rem; }
.auth-name {
  font-weight: 600; font-size: 0.9rem; max-width: 88px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.auth-role { font-size: 0.7rem; padding: 2px 8px; }
.auth-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); min-width: 190px; z-index: 100;
  padding: 6px;
}
.auth-menu a, .auth-menu button {
  display: block; width: 100%; text-align: left; box-sizing: border-box;
  padding: 11px 12px; border-radius: 8px; text-decoration: none;
  color: var(--ink); font-family: inherit; font-size: 0.95rem; font-weight: 500;
  background: none; border: 0; cursor: pointer; min-height: 44px;
}
.auth-menu a:hover, .auth-menu button:hover { background: var(--emerald-soft); }

/* Modals (auth dialog) */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(2, 51, 37, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; width: 100%; max-width: 480px;
  max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 22px 20px 28px; position: relative;
}
@media (min-width: 560px) {
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { border-radius: 20px; }
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--bg); color: var(--muted); font-size: 1.1rem; cursor: pointer;
}
.modal-title { margin: 0 0 12px; padding-right: 40px; }
.tabs {
  display: flex; gap: 8px; margin-bottom: 16px;
  background: var(--bg); padding: 4px; border-radius: 999px;
}
.tab {
  flex: 1; border: 0; background: none; border-radius: 999px;
  padding: 10px; font-family: inherit; font-weight: 600; font-size: 0.92rem;
  color: var(--muted); cursor: pointer; min-height: 44px;
}
.tab.active { background: #fff; color: var(--emerald-deep); box-shadow: var(--shadow); }

/* Role selector cards */
.role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.role-card {
  border: 2px solid var(--line); background: #fff; border-radius: var(--radius-sm);
  padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-family: inherit; cursor: pointer; min-height: 84px;
}
.role-card .role-icon { font-size: 1.7rem; line-height: 1; }
.role-card .role-label { font-weight: 700; font-size: 0.85rem; color: var(--ink); }
.role-card.selected { border-color: var(--emerald); background: var(--emerald-soft); box-shadow: 0 0 0 1px var(--emerald); }

/* v2 form fields */
.v2-label { display: block; font-size: 0.88rem; font-weight: 600; margin: 12px 0 4px; color: var(--emerald-deep); }
.v2-input {
  width: 100%; min-height: 48px; padding: 10px 14px; box-sizing: border-box;
  font-family: inherit; font-size: 1rem; color: var(--ink);
  border: 2px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
.v2-input:focus { border-color: var(--emerald); outline: none; }
.auth-error {
  background: var(--danger-soft); color: var(--danger);
  border-radius: var(--radius-sm); padding: 10px 14px; margin: 12px 0; font-size: 0.92rem;
}
.auth-notice {
  background: var(--gold-light); color: var(--gold-dark);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.92rem; margin: 0 0 12px;
}
.demo-note { font-size: 0.8rem; color: var(--muted); text-align: center; margin: 12px 0 0; }
.demo-tag {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--line); color: var(--muted); border-radius: 999px; padding: 3px 9px;
  white-space: nowrap;
}
.demo-tag.mine { background: var(--gold-light); color: var(--gold-dark); }

/* Daily visitor counter card */
.visitor-card {
  background: linear-gradient(135deg, var(--emerald-deep), var(--emerald));
  border: 0; text-align: center; color: #fff;
}
.visitor-num { font-size: 2.2rem; font-weight: 700; color: var(--gold-light); }
.visitor-label { font-size: 0.95rem; opacity: 0.92; }
.visitor-card .visitor-demo { margin-top: 8px; }
.visitor-demo-tag {
  display: inline-block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.6px;
  border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 999px;
  padding: 2px 10px; opacity: 0.75;
}

/* Live class cards */
.class-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 12px;
}
.class-top { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.class-title { margin: 0 0 6px; font-size: 1.08rem; }
.class-meta { color: var(--muted); font-size: 0.9rem; margin: 0 0 12px; line-height: 1.7; }

/* Account / dashboards */
.acct-head { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.row-form { display: flex; gap: 8px; }
.row-form .v2-input { flex: 1; min-width: 0; }
.row-form .btn { flex: 0 0 auto; }
.kid-list { display: grid; gap: 10px; margin-top: 12px; }
.kid-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px;
}
.kid-body { flex: 1; min-width: 0; }
.icon-btn {
  border: 0; background: none; color: var(--muted); font-size: 1rem;
  cursor: pointer; min-width: 44px; min-height: 44px;
}

.btn-sm { min-height: 40px; padding: 6px 14px; font-size: 0.88rem; }

/* Mockup classroom */
.room-backdrop { align-items: stretch; padding: 0; }
.room {
  background: #0e1a15; color: #eaf5f0; width: 100%; max-width: 560px; margin: 0 auto;
  height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
@media (min-width: 560px) {
  .room-backdrop { align-items: center; padding: 20px; }
  .room { border-radius: 16px; height: auto; max-height: 92vh; max-height: 92dvh; }
}
.room-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.live-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #ff4d4d; flex: 0 0 auto;
  animation: live-blink 1.2s infinite;
}
@keyframes live-blink { 50% { opacity: 0.35; } }
.live-text { font-weight: 700; font-size: 0.8rem; color: #ff8080; letter-spacing: 0.6px; white-space: nowrap; }
.room-title {
  flex: 1; font-weight: 600; font-size: 0.92rem; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.room .btn-outline {
  color: #fff; border-color: rgba(255, 255, 255, 0.4); background: transparent;
}
.room-video {
  background: #000; border-radius: var(--radius-sm);
  aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.12); margin-bottom: 10px; flex: 0 0 auto;
}
.room-video-inner { padding: 16px; color: #cfe3d9; }
.room-video-icon { font-size: 2.2rem; }
.room-video p { margin: 6px 0; }
.room-chat {
  background: rgba(255, 255, 255, 0.06); border-radius: var(--radius-sm);
  height: 180px; min-height: 140px; overflow-y: auto; padding: 10px; margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto;
}
.chat-msg { max-width: 88%; display: flex; flex-direction: column; gap: 2px; }
.chat-from { font-size: 0.72rem; font-weight: 700; opacity: 0.75; }
.chat-text {
  background: rgba(255, 255, 255, 0.12); border-radius: 10px;
  padding: 8px 12px; font-size: 0.92rem; overflow-wrap: anywhere;
}
.chat-msg.chat-teacher { align-self: flex-start; }
.chat-msg.chat-teacher .chat-text { background: rgba(4, 106, 77, 0.55); }
.chat-msg.chat-student { align-self: flex-start; }
.chat-msg.chat-you { align-self: flex-end; align-items: flex-end; }
.chat-msg.chat-you .chat-text { background: rgba(201, 162, 39, 0.35); }
.chat-msg.chat-sys { align-self: center; text-align: center; }
.chat-msg.chat-sys .chat-text { background: none; font-size: 0.8rem; opacity: 0.7; }
.room-form { display: flex; gap: 8px; margin-bottom: 10px; flex: 0 0 auto; }
.room-form .v2-input {
  flex: 1; min-width: 0;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2); color: #fff;
}
.room-form .v2-input::placeholder { color: rgba(255, 255, 255, 0.5); }
.room-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.room-actions .btn { flex: 1; }
.room-actions .btn-gold { border-color: var(--gold); }
.room .demo-note { color: rgba(255, 255, 255, 0.55); }

/* Print: utility bar and modals never print (certificate-only rule stands) */
@media print {
  .utility-bar, .modal-backdrop { display: none !important; }
}

/* ============================================================
   Section 15 — v3 pages: footer, about, contact/FAQ, blog
   ============================================================ */

/* Site footer */
.site-footer {
  max-width: var(--content-max, 720px);
  margin: 26px auto 0;
  padding: 18px 16px 8px;
  text-align: center;
  border-top: 1px solid var(--line);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin-bottom: 10px; }
.footer-links a { color: var(--emerald-deep); font-weight: 600; font-size: 0.92rem; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-note { color: var(--muted); font-size: 0.82rem; margin: 0 0 6px; }

/* About page */
.about-tracks { display: grid; gap: 12px; }
.about-mini { margin: 0; }
.about-mini .big { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.about-mini h3 { margin: 0 0 4px; }
.honesty { border-left: 4px solid var(--gold); }
.tight-list { margin: 0; padding-left: 20px; }
.tight-list li { margin-bottom: 8px; line-height: 1.55; }

/* Contact + FAQ */
.v2-textarea { resize: vertical; min-height: 110px; font-family: inherit; }
.faq { display: grid; gap: 8px; }
.faq-item {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); overflow: hidden;
}
.faq-item summary {
  cursor: pointer; padding: 12px 14px; font-weight: 700;
  color: var(--emerald-deep); list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.2rem; color: var(--gold-dark); flex: 0 0 auto; }
.faq-item[open] summary::after { content: "–"; }
.faq-item p { margin: 0; padding: 0 14px 14px; line-height: 1.6; color: var(--ink); }

/* Blog list */
.cat-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cat-chip {
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--emerald-deep); font-size: 0.85rem; font-weight: 600; text-decoration: none;
}
.cat-chip.active { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.blog-list { display: grid; gap: 12px; }
.blog-card { margin: 0; }
.blog-title { margin: 8px 0 4px; font-size: 1.12rem; line-height: 1.4; }
.blog-meta { color: var(--muted); font-size: 0.8rem; margin: 0 0 8px; }
.blog-excerpt { margin: 0 0 10px; line-height: 1.6; color: var(--ink); font-size: 0.94rem; }
.blog-read { color: var(--emerald); font-weight: 700; font-size: 0.9rem; }

/* Blog post */
.post { margin-bottom: 14px; }
.post-title { font-size: 1.45rem; line-height: 1.35; margin: 10px 0 6px; }
.post-meta { color: var(--muted); font-size: 0.85rem; margin: 0 0 12px; }
.post-lede {
  font-size: 1.02rem; line-height: 1.65; color: var(--emerald-deep);
  border-left: 3px solid var(--gold); padding-left: 12px; margin: 0 0 16px;
}
.post-body { font-size: 0.97rem; line-height: 1.75; color: var(--ink); }
.post-body h3 { margin: 22px 0 8px; font-size: 1.08rem; color: var(--emerald-deep); }
.post-body p { margin: 0 0 12px; }
.post-body ul, .post-body ol { margin: 0 0 12px; padding-left: 22px; }
.post-body li { margin-bottom: 7px; }
.post-body a { color: var(--emerald); font-weight: 600; }
.post-body strong { color: var(--ink); }

/* Home blog teaser */
.teaser-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.teaser-head h2 { font-size: 1.1rem; }
.teaser-link {
  display: block; padding: 10px 0; border-top: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.teaser-link strong { display: block; color: var(--emerald-deep); font-size: 0.95rem; margin-bottom: 3px; }
.teaser-link .small { font-size: 0.78rem; }

/* v3 counter upgrade: pulsing LIVE dot + visible tick animation */
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #e5484d; margin-right: 6px; vertical-align: baseline;
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.72); }
}
#visitor-count, #learning-now { display: inline-block; }
.tick-flash { animation: tickFlash 0.6s ease; }
@keyframes tickFlash {
  0% { transform: scale(1.14); color: #8a6d1a; }
  100% { transform: scale(1); }
}
.visitor-sub { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

/* ============================================================
   Section 16 — Mock Test (v4): hero card, hub, timer, palette,
   results, chapter breakdown, answer review.
   ============================================================ */
.mock-hero {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, var(--emerald-dark) 0%, var(--emerald) 70%, #05906a 100%);
  color: #fff; border: none; margin: 14px 0 4px; padding: 16px 18px;
  box-shadow: 0 4px 16px rgba(3, 77, 56, 0.25);
}
.mock-hero-icon { font-size: 2rem; line-height: 1; }
.mock-hero-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mock-hero-title { font-weight: 700; font-size: 1.15rem; }
.mock-hero-sub { font-size: 0.82rem; opacity: 0.85; }
.mock-hero .track-arrow { color: var(--gold-light); font-size: 1.6rem; }

.timer-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--emerald-deep); color: #fff; border-radius: var(--radius-sm);
  padding: 10px 14px; margin: 10px 0; position: sticky; top: 0; z-index: 5;
}
.mock-timer { font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.mock-timer.timer-danger { color: #ffb4a8; animation: livePulse 1s ease-in-out infinite; }
.mock-warn {
  background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger);
  border-radius: var(--radius-sm); padding: 8px 12px; margin: 0 0 10px; font-size: 0.85rem;
}

.palette { margin: 10px 0; }
.palette summary {
  cursor: pointer; font-weight: 600; color: var(--emerald-dark);
  padding: 8px 4px; font-size: 0.95rem;
}
.palette-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 8px; padding: 10px 2px 4px;
}
.pal-btn {
  aspect-ratio: 1; border-radius: 10px; border: 2px solid var(--line);
  background: #fff; color: var(--muted); font-weight: 700; font-size: 0.9rem;
  cursor: pointer; min-height: 40px;
}
.pal-btn.ans { background: var(--emerald-soft); border-color: var(--emerald); color: var(--emerald-deep); }
.pal-btn.cur { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-light); color: var(--ink); }

.quiz-option.picked { border-color: var(--emerald); background: var(--emerald-soft); }
.quiz-option.picked .opt-key { background: var(--emerald); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }

.mock-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0;
}
.mock-stat {
  background: var(--bg); border-radius: var(--radius-sm); padding: 10px 4px; text-align: center;
}
.mock-stat-num { font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.mock-stat-num.ok { color: var(--ok); }
.mock-stat-num.bad { color: var(--danger); }
.mock-stat-label { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

.ch-row { margin: 12px 0; }
.ch-row-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; font-size: 0.9rem; margin-bottom: 4px;
}
.ch-row .small { font-size: 0.82rem; }

.review-item { margin: 12px 0; }
.review-item .quiz-question { font-size: 1rem; }

/* ---------- 14. Auto-update prompt (added 2026-10-18) ---------- */
/* Fixed bar shown when a newer site version is ready. On mobile it
   floats above the bottom nav; on desktop it docks bottom-right. */
.sa-update-toast {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom, 0px));
  z-index: 9999;
  display: flex; align-items: center; gap: 10px;
  background: var(--emerald-deep);
  color: #ffffff;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  animation: sa-toast-in 0.35s ease-out;
}
.sa-update-toast[hidden] { display: none; }
.sa-update-msg { flex: 1; font-size: 0.9rem; font-weight: 600; line-height: 1.35; }
.sa-update-btn {
  flex: none;
  background: var(--gold);
  color: var(--emerald-deep);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
.sa-update-btn:disabled { opacity: 0.7; cursor: default; }
@keyframes sa-toast-in {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@media (min-width: 640px) {
  .sa-update-toast {
    left: auto; right: 24px;
    bottom: 24px;
    max-width: 400px;
  }
}
