﻿@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@600;700;800&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600;700&display=swap");
/* Dancing Script has no Cyrillic: names typed in Cyrillic fall back to this script face (same calligraphic look) instead of a random system font. */
@import url("https://fonts.googleapis.com/css2?family=Marck+Script&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&display=swap");

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #ffffff;
  color: #1E2A38;
}

[hidden] {
  display: none !important;
}

.results-page {
  min-height: calc(100vh - 90px);
  padding: 32px 6% 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(243, 246, 252, 0.95), rgba(243, 246, 252, 0.75)),
    repeating-linear-gradient(
      0deg,
      rgba(14, 37, 61, 0.06) 0px,
      rgba(14, 37, 61, 0.06) 1px,
      transparent 1px,
      transparent 28px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(14, 37, 61, 0.06) 0px,
      rgba(14, 37, 61, 0.06) 1px,
      transparent 1px,
      transparent 28px
    );
}

.results-fullpage {
  width: min(980px, 100%);
}

.results-shell {
  background: #ffffff;
  border: 1px solid rgba(16, 35, 54, 0.18);
  border-radius: 26px;
  padding: 30px 28px 34px;
  box-shadow: 0 28px 70px rgba(12, 26, 40, 0.18);
  font-family: "Manrope", "Segoe UI", "Segoe UI Variable", sans-serif;
  position: relative;
}

.results-shell::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(19, 41, 63, 0.08);
  border-radius: 20px;
  pointer-events: none;
}

.results-headline {
  margin: 0 0 14px;
  text-align: center;
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: 0.4px;
  color: #102740;
}

.results-lead {
  margin: 0 auto 18px;
  max-width: 540px;
  text-align: center;
  color: #43556d;
  font-size: 1.02rem;
  line-height: 1.5;
  padding: 14px 18px;
  border: 1px solid rgba(18, 42, 64, 0.16);
  border-radius: 14px;
  background: #f7f9fc;
}

.results-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0 auto 18px;
  max-width: 520px;
}

.results-toggle-btn {
  border: 1px solid rgba(18, 42, 64, 0.2);
  background: #ffffff;
  color: #1e3348;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.results-toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(17, 34, 52, 0.15);
}

.results-toggle-btn.is-active {
  background: #102a42;
  color: #ffffff;
  border-color: #102a42;
  box-shadow: 0 10px 22px rgba(10, 26, 41, 0.2);
}

.results-note {
  margin: 0 auto 22px;
  max-width: 620px;
  text-align: center;
  color: #1f3a55;
  font-weight: 600;
  padding: 14px 16px;
  border-radius: 14px;
  background: #eef3f8;
  border: 1px solid rgba(18, 42, 64, 0.12);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.results-card {
  border: 1px solid rgba(16, 37, 58, 0.2);
  border-radius: 18px;
  padding: 18px 16px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
  box-shadow: 0 10px 20px rgba(13, 27, 42, 0.08);
}

.results-score {
  width: 84px;
  height: 84px;
  border-radius: 16px;
  border: 1px solid rgba(16, 37, 58, 0.2);
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: #122d46;
  background: #f3f6fb;
}

.results-card-info h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: #102740;
}

.results-card-info p {
  margin: 0;
  color: #4a5f76;
  font-size: 0.96rem;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .results-page {
    padding: 24px 5% 40px;
  }

  .results-shell {
    padding: 24px 20px 26px;
  }

  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 901px) {
  #presentation-open-btn {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .results-toggle {
    grid-template-columns: 1fr;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .results-score {
    width: 72px;
    height: 72px;
    font-size: 1.4rem;
  }
}

@media (max-width: 900px) {
  header {
    padding: 16px 5%;
  }

  .hero-header {
    min-height: auto;
    --logo-size: 180px;
  }

  .hero {
    padding: 40px 6% 28px;
  }

  .hero-info-grid {
    grid-template-columns: 1fr;
  }

  .hero-image img {
    aspect-ratio: 16 / 9;
  }

  .levels {
    padding: 44px 6%;
  }

  .header-actions {
    position: static;
    margin-top: 12px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-subscription {
    grid-template-columns: 1fr;
  }

  .profile-extras-grid {
    grid-template-columns: 1fr;
  }

  .profile-modal-card,
  .achievements-modal-card,
  .leaderboard-modal-card {
    width: min(94vw, 560px);
    max-height: 92vh;
  }

  .results-modal-card {
    padding: 0 20px 28px;
  }

  .results-modal-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 80px;
  }

  .results-modal-tile:nth-child(3n + 2) {
    --tile-offset: 0px;
  }

  .results-modal-subtitle--spaced {
    margin-top: 110px;
  }
}

@media (max-width: 640px) {
  header {
    padding: 12px 5%;
  }

  header .btn {
    position: static;
    padding: 10px 16px;
    font-size: 1rem;
  }

  .hero-header {
    --logo-size: 140px;
  }

  .hero-header.is-compact {
    padding: 10px 6%;
  }

  .header-actions {
    gap: 8px;
  }

  .header-actions .btn {
    padding: 8px 12px;
    font-size: 0.95rem;
  }

  .hero-info-card h3 {
    font-size: 1.5rem;
  }

  .hero-info-card p {
    font-size: 0.98rem;
  }

  .hero-image img {
    aspect-ratio: 16 / 10;
  }

  .levels h2 {
    font-size: 1.85rem;
  }

  .knowledge-test-note {
    font-size: 1.35rem;
  }

  .knowledge-test-btn {
    width: 100%;
    max-width: 320px;
  }

  .profile-mentor-card {
    padding: 12px 14px;
  }

  .profile-mentor-avatar {
    width: 52px;
    height: 52px;
  }

  .achievements-modal-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .achievements-modal-head-right {
    flex-wrap: wrap;
  }

  .leaderboard-modal-header {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .leaderboard-modal-close {
    align-self: center;
  }

  .results-modal-tiles {
    grid-template-columns: 1fr;
    margin-top: 48px;
  }

  .results-modal-tile {
    transform: translateY(0);
  }

  .results-modal-subtitle--spaced {
    margin-top: 40px;
  }
}

header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 8%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  position: relative;
  overflow: clip;
  --header-bg-image: url("../../assets/images/space_2.jpg");
  background-color: var(--header-bg-color, #ffffff);
}

header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--header-bg-image);
  background-size: cover;
  background-position: center 80%;
  background-repeat: no-repeat;
  z-index: 0;
  pointer-events: none;
}

/* Light theme — swap the night-sky "space.png" cosmic backdrop for a bright
   daytime counterpart: a custom-generated sunrise-over-Earth banner
   ("sky.png", same 2.5:1 framing as space.png) so every header keeps its
   brand identity (planet curve + open sky for the logo) but feels airy
   and light instead of dark. */
[data-theme="light"] header {
  --header-bg-image: url("../../assets/images/sky.jpg");
}

/* Shift the crop window of "sky.png" downward so the Earth's curve
   (framed along the bottom edge of the source artwork) peeks into view
   instead of being cropped off by the default center-anchored "cover". */
[data-theme="light"] header::before {
  background-position: center bottom;
}

header > * {
  position: relative;
  z-index: 1;
}

.hero-header {
  position: sticky;
  top: 0;
  /* !important + a clearly-dominant value: reports of the quick-links row
     (now normal in-flow content on desktop, no longer a separate fixed
     bar) painting ON TOP of this sticky header mid-scroll instead of
     disappearing behind it like every other block, on a real device —
     not reproducible headless, and the DOM/z-index math here says the
     header (was z-index:20, no !important) should already win, but
     leave zero room for doubt rather than chase an unreproducible
     compositing quirk further. Stays below 998/999 (#mobile-nav-backdrop /
     #mobile-nav-drawer), which must still cover the header when opened. */
  z-index: 960 !important;
  --header-bg-color: #e3e7ec;
  --header-max-vh: 45;
  --header-min-px: 90;
  min-height: calc(var(--header-max-vh) * 1vh);
  --logo-size-max: 252;
  --logo-size-min: 95;
  --logo-size: 252px;
  overflow: clip;
  will-change: transform;
  transform: translateZ(0);
  transition: min-height 0.45s ease, padding 0.45s ease, box-shadow 0.45s ease;
}

.hero-header::before {
  transition: opacity 0.45s ease;
}

/* ── Shooting stars canvas ── */
.header-comet-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ── Levitation keyframe ── */
@keyframes levitate {
  0%   { transform: translateY(0px) rotate(var(--lm-rotate, 0deg)); }
  50%  { transform: translateY(-14px) rotate(var(--lm-rotate, 0deg)); }
  100% { transform: translateY(0px) rotate(var(--lm-rotate, 0deg)); }
}

/* ── Landmarks layer ── */
.header-landmarks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.landmark {
  position: absolute;
  width: auto;
  opacity: 0.88;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
  animation: levitate var(--lm-dur, 4s) ease-in-out infinite;
  animation-delay: var(--lm-delay, 0s);
  transition: opacity 0.5s ease, scale 0.5s ease;
  will-change: transform;
}

/* Each statue: own rotation, speed and delay */
.lm-1 { left:  2%;  top: 8%;  height: 155px; --lm-rotate: -3deg; --lm-dur: 4.2s; --lm-delay: 0s;    }
.lm-2 { left: 18%;  top: 28%; height: 105px; --lm-rotate:  2deg; --lm-dur: 3.6s; --lm-delay: -1.1s; }
.lm-3 { left: 42%;  top:  4%; height: 185px; --lm-rotate: -1deg; --lm-dur: 5.0s; --lm-delay: -0.6s; }
.lm-4 { right: 15%; top: 22%; height: 115px; --lm-rotate:  3deg; --lm-dur: 3.9s; --lm-delay: -1.8s; }
.lm-5 { right:  1%; top: 10%; height: 150px; --lm-rotate: -2deg; --lm-dur: 4.5s; --lm-delay: -0.3s; }

/* On scroll — fade and shrink */
.hero-header.is-compact .landmark {
  opacity: 0;
  scale: 0.1;
}

/* Earth at the bottom of the header */
.header-earth {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1100px;
  pointer-events: none;
  z-index: 2;
  transition: transform 0.5s ease, opacity 0.5s ease;
}

.hero-header.is-compact .header-earth {
  opacity: 0;
  transform: translateX(-50%) translateY(40px);
}

.logo {
  font-weight: bold;
  font-size: 2rem;
  text-align: center;
  transition: font-size 0.45s ease;
  font-family: "Dancing Script", "Marck Script", "Segoe Script", "Brush Script MT", cursive;
  letter-spacing: 0.3px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logo img {
  height: var(--logo-size, 95px);
  width: auto;
  display: block;
  transition: height 0.45s ease;
}
.hero-header .logo img {
  will-change: height;
}

/* Dark theme gets the white-outlined CitizenX mark - the plain black
   artwork (correct on this site's light backgrounds) reads as almost
   invisible against a dark header, same reasoning as the certificate's
   own logo_citizen_x_white.png (see certificate.js). content: url()
   swaps the rendered image while every existing size/layout rule above
   keeps applying, since the <img> is still a normal replaced element.
   Uses its own logo_citizen_x_white_thin.png rather than reusing the
   certificate's file: the header renders the logo far larger (the
   certificate draws it at a fixed 118px tall - see certificate.js -
   while the header can run past 250px), so the certificate's outline
   was scaled up to a visibly thick ring here. A thinner outline reads
   as too faint at the certificate's small size, so this is a separate
   asset rather than a shared one - tried sharing first, thinning it
   for the header made it nearly invisible on the certificate. */
[data-theme="dark"] .logo img {
  content: url("../../assets/images/logo_citizen_x_white_thin.png");
}

.level-header,
.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
}

.article-reader-body .level-header,
/* User feedback: the lesson video page felt cramped with the header
   permanently pinned above a tall video player - let it scroll away like
   the article reader already does, rather than eating vertical space the
   whole time. */
.lesson-player-body .level-header {
  position: relative;
}

.level-header {
  min-height: 72px;
  padding: 8px 8%;
  --logo-size: 72px;
  --header-bg-color: #ffffff;
}

.admin-header {
  min-height: 72px;
  padding: 8px 8%;
  --logo-size: 72px;
  --header-bg-color: #e3e7ec;
}

/* Comet canvas for course/lesson/admin/results headers — same look as the
   homepage header, scaled down to suit the slimmer bar */
.level-header-comet-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.level-header .btn {
  top: 50%;
  transform: translateY(-50%);
}

@media (min-width: 900px) {
  .level-header .btn {
    padding: 16px 36px;
    font-size: 1.15rem;
  }
}

.level-header .btn:hover {
  transform: translateY(-50%);
}

.level-header .logo {
  position: relative;
  z-index: 2;
}

header .btn {
  position: absolute;
  right: 4%;
  top: 14px;
  background: #ffffff;
  color: #1E2A38;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.1rem;
}

.header-actions {
  position: absolute;
  top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions-left {
  left: 4%;
  right: auto;
}

.header-actions-right {
  right: 4%;
  left: auto;
}

.header-actions .btn {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.header-actions .btn[hidden] {
  display: none !important;
}

.header-actions #admin-panel-btn,
.header-actions #profile-btn {
  position: relative;
  top: auto;
  transform: none;
}

/* Show these header buttons immediately if the <head> pre-paint script (or
   the real updateLoginButton() check right after) says the user is logged
   in with a matching role - avoids "Login" + a beat of nothing, then
   Mentor/Admin panel/Classes popping in, on every single page load. The ID
   selectors here out-specificity .header-actions .btn[hidden] above even
   though it's also !important, so this wins regardless of whether the
   hidden attribute is still physically on the element.
   Desktop only: below 721px these same buttons get hidden again once
   logged in anyway (see .mobile-logged-in rules in admin-quiz-news.css -
   the drawer covers Profile/Students/Admin/Classes there), so there's
   nothing worth pre-empting on mobile. */
@media (min-width: 721px) {
  html[data-auth="in"] .header-actions #profile-btn {
    display: inline-flex !important;
  }
  html[data-auth="in"][data-role="mentor"] .header-actions #mentor-students-btn {
    display: inline-flex !important;
  }
  html[data-auth="in"][data-role="school_admin"] .header-actions #school-admin-btn {
    display: inline-flex !important;
  }
  html[data-auth="in"][data-role="admin"] .header-actions #admin-panel-btn {
    display: inline-flex !important;
  }
}

@media (min-width: 901px) {
  .hero-header .header-actions.header-actions-right #admin-panel-btn {
    position: relative;
    top: 0;
  }
}

.profile-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 45, 0.44);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1200;
}

.profile-modal.is-open {
  display: flex;
}

.profile-modal-card {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: #f4f7fb;
  border-radius: 20px;
  border: 1px solid #cfdae6;
  padding: 14px;
  box-shadow: 0 28px 64px rgba(10, 25, 50, 0.22);
}

.team-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 45, 0.44);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1300;
}

.team-modal.is-open {
  display: flex;
}

.team-modal-card {
  width: 100vw;
  height: 100dvh;
  background: #ffffff;
  border-radius: 0;
  border: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.team-modal-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 12px
    max(14px, env(safe-area-inset-left));
  border-bottom: 1px solid #e2eaf3;
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
}

.team-modal-topbar-spacer {
  min-width: 120px;
}

.team-modal-topbar-center {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.team-modal-logo {
  height: 54px;
  width: auto;
  display: block;
  object-fit: contain;
}

.team-modal-count {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.9rem;
  background: linear-gradient(135deg, #102a42, #184a7a);
  color: #ffffff;
}

.team-modal-topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  justify-self: end;
}

.team-modal-edit-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 900 !important;
}

.team-modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 16px 22px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(180deg, rgba(243, 246, 252, 0.85), rgba(243, 246, 252, 0.65)),
    repeating-linear-gradient(
      0deg,
      rgba(14, 37, 61, 0.05) 0px,
      rgba(14, 37, 61, 0.05) 1px,
      transparent 1px,
      transparent 28px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(14, 37, 61, 0.05) 0px,
      rgba(14, 37, 61, 0.05) 1px,
      transparent 1px,
      transparent 28px
    );
}

.team-card-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.team-card-actions .btn {
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 900;
  border: 1px solid rgba(16, 35, 54, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: #15314f;
}

.team-card-actions .team-card-more-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(217, 119, 6, 0.26);
}

.team-card-actions .team-card-delete-btn {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #ffffff;
  border-color: transparent;
}

.admin-team-mini-delete {
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 12px 22px rgba(185, 28, 28, 0.22);
}

.team-member-card {
  width: min(860px, 100%);
  max-height: 92vh;
  padding: 12px 12px 16px;
}

.team-member-modal {
  z-index: 1400;
}

.team-member-hero {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 10px 6px 6px;
}

.team-member-avatar {
  width: 206px;
  height: 206px;
  border-radius: 50%;
  border: 3px solid #1f3a52;
  background: linear-gradient(135deg, #e7edf3, #cfd8e2);
  flex: 0 0 206px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2b4e72;
  font-weight: 900;
  font-size: 2.1rem;
  box-shadow: 0 4px 18px rgba(15,42,69,.15);
}

.team-member-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.team-member-hero-text {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.team-member-header {
  margin: 0;
  color: #132943;
  font-weight: 900;
  font-size: 1.6rem;
  line-height: 1.15;
}

.team-member-subheader {
  margin: 0;
  color: #24415f;
  font-size: 1.02rem;
  line-height: 1.45;
}

.team-member-section {
  margin-top: 14px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid #cfdae6;
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
}

.team-member-section-title {
  margin: 0 0 10px;
  color: #143456;
}

.team-member-achievements {
  margin: 0;
  padding-left: 18px;
  color: #31475c;
  line-height: 1.55;
}

.admin-team-edit-grid {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 16px;
  margin-top: 14px;
}

.admin-team-edit-avatar {
  display: grid;
  gap: 10px;
  align-content: start;
  justify-items: center;
}

#admin-team-edit-avatar-preview,
.admin-team-edit-avatar-fallback {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 1px solid #d9e1ee;
  background: #f3f6fb;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #1c2a4a;
  object-fit: cover;
}

.admin-team-edit-avatar-fallback {
  font-size: 2rem;
}

.admin-team-edit-fields {
  display: grid;
  gap: 10px;
}

.admin-team-edit-textarea {
  resize: vertical;
}

.admin-team-edit-flag-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 2px;
}

.admin-team-edit-flag-preview {
  flex-shrink: 0;
}

#admin-team-edit-flag-preview,
#admin-organization-flag-preview,
.admin-team-edit-flag-fallback {
  width: 64px;
  height: 44px;
  border-radius: 6px;
  border: 1px solid #d9e1ee;
  background: #f3f6fb;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: #1c2a4a;
  object-fit: cover;
}

.admin-team-edit-flag-controls {
  display: grid;
  gap: 6px;
  flex: 1;
}

@media (max-width: 700px) {
  .team-member-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .team-member-avatar {
    width: 176px;
    height: 176px;
    flex-basis: 176px;
  }
  .admin-team-edit-grid {
    grid-template-columns: 1fr;
  }
}

.achievements-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 45, 0.44);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1250;
}

.achievements-modal.is-open {
  display: flex;
}

.achievements-modal-card {
  width: min(580px, 100%);
  max-height: 88vh;
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #cfdae6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

[data-theme="dark"] .achievements-modal-card {
  background: linear-gradient(160deg, #0f1e38 0%, #0a1628 100%);
  border-color: rgba(255, 255, 255, 0.1);
}

.achievements-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px 10px;
  flex-shrink: 0;
}

.achievements-modal-header h3 {
  margin: 0;
  color: #143456;
  font-size: 1.35rem;
}

[data-theme="dark"] .achievements-modal-header h3 {
  color: #e8f0fa;
}

.achievements-modal-head-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.achievements-xp-pill {
  background: linear-gradient(135deg, #f0c96a, #f5a623);
  color: #5a3a00;
  font-weight: 800;
  font-size: 0.82rem;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.achievements-level-pill {
  background: linear-gradient(135deg, #6a7cf0, #8a5cf5);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.82rem;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

[data-theme="dark"] .achievements-level-pill {
  background: linear-gradient(135deg, #4d5bd9, #6f3fd1);
}

.achievements-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 12px;
  flex-shrink: 0;
}

.achievements-progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #dde9f5;
  overflow: hidden;
}

[data-theme="dark"] .achievements-progress-track {
  background: rgba(255, 255, 255, 0.1);
}

.achievements-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2e7d55, #56c992);
  transition: width 0.5s ease;
  width: 0%;
}

.achievements-progress-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: #4a6a8a;
  white-space: nowrap;
}

[data-theme="dark"] .achievements-progress-count {
  color: #8db0d0;
}

.achievements-tabs {
  display: flex;
  gap: 6px;
  padding: 0 18px 12px;
  flex-shrink: 0;
  overflow-x: auto;
}

.ach-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid #cfdae6;
  background: transparent;
  color: #4a6a8a;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.ach-tab:hover {
  background: #eaf2ff;
  border-color: #a0bfdf;
}

.ach-tab.is-active {
  background: #143456;
  color: #fff;
  border-color: #143456;
}

[data-theme="dark"] .ach-tab {
  border-color: rgba(255, 255, 255, 0.15);
  color: #8db0d0;
}

[data-theme="dark"] .ach-tab:hover {
  background: rgba(255, 255, 255, 0.07);
}

[data-theme="dark"] .ach-tab.is-active {
  background: #1e4a8a;
  border-color: #2d6abf;
  color: #e8f0fa;
}

.achievements-modal-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 4px 18px 18px;
  overflow-y: auto;
  flex: 1;
}

@media (max-width: 480px) {
  .achievements-modal-list {
    grid-template-columns: 1fr;
  }
}

.ach-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #7a8a9b;
  font-size: 0.9rem;
  padding: 24px 0;
}

.achievements-modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.achievements-leaderboard-btn {
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: none;
  background: linear-gradient(135deg, #2fa7ff, #1682cf);
  color: #ffffff;
  font-weight: 700;
}

.achievements-leaderboard-btn:hover {
  filter: brightness(1.04);
}

.leaderboard-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 45, 0.44);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1260;
}

.leaderboard-modal.is-open {
  display: flex;
}

.leaderboard-modal-card {
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 20px;
  border: 1px solid #dce8f6;
  padding: 0;
  box-shadow: 0 20px 48px rgba(16, 38, 74, 0.14);
}

[data-theme="dark"] .leaderboard-modal-card {
  background: linear-gradient(160deg, #0f1e35 0%, #091525 100%);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55);
}

.leaderboard-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5edf8;
  border-radius: 20px 20px 0 0;
}

[data-theme="dark"] .leaderboard-modal-header {
  background: linear-gradient(135deg, #0a1628 0%, #0e2d5a 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.leaderboard-modal-header h3 {
  margin: 0;
  color: #143456;
  font-size: 1rem;
  font-weight: 800;
}

[data-theme="dark"] .leaderboard-modal-header h3 {
  color: #ffffff;
}

.leaderboard-modal-close {
  box-shadow: none;
  padding: 5px 12px;
  font-size: 0.8rem;
}

[data-theme="dark"] .leaderboard-modal-close {
  background: rgba(255, 255, 255, 0.14) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.28) !important;
  border-radius: 10px !important;
  color: #fff !important;
  box-shadow: none !important;
}

[data-theme="dark"] .leaderboard-modal-close:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  transform: none !important;
}

.leaderboard-scope-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 16px 0;
  flex-shrink: 0;
}

.leaderboard-scope-tabs[hidden] {
  display: none;
}

.leaderboard-scope-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid #cfdae6;
  background: transparent;
  color: #4a6a8a;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.leaderboard-scope-tab:hover {
  background: #eaf2ff;
  border-color: #a0bfdf;
}

.leaderboard-scope-tab.is-active {
  background: #143456;
  color: #fff;
  border-color: #143456;
}

[data-theme="dark"] .leaderboard-scope-tab {
  border-color: rgba(255, 255, 255, 0.15);
  color: #8db0d0;
}

[data-theme="dark"] .leaderboard-scope-tab:hover {
  background: rgba(255, 255, 255, 0.07);
}

[data-theme="dark"] .leaderboard-scope-tab.is-active {
  background: #1e4a8a;
  border-color: #2d6abf;
  color: #e8f0fa;
}

.leaderboard-modal-list {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid #e2ecf8;
  border-left: 4px solid #dde8f5;
  background: #f8fafd;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-size: 0.9rem;
  cursor: pointer;
}

.leaderboard-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 38, 74, 0.1);
}

.leaderboard-row:focus {
  outline: 3px solid rgba(47, 167, 255, 0.4);
  outline-offset: 2px;
}

.leaderboard-row.is-you {
  border-left-color: #3b82f6;
  background: #eff6ff;
  border-color: #bdd8ff;
  border-left-color: #3b82f6;
}

.leaderboard-row.is-top-1 {
  border-left-color: #f59e0b;
  background: #fffbee;
  border-color: #fde68a;
  border-left-color: #f59e0b;
}

.leaderboard-row.is-top-2 {
  border-left-color: #94a3b8;
  background: #f8fafc;
  border-color: #e2e8f0;
  border-left-color: #94a3b8;
}

.leaderboard-row.is-top-3 {
  border-left-color: #d97706;
  background: #fff8f0;
  border-color: #fed7aa;
  border-left-color: #d97706;
}

.leaderboard-rank {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: #3a5a7a;
  min-width: 52px;
}

.leaderboard-rank-text {
  min-width: 28px;
}

.leaderboard-medal {
  font-size: 1.05rem;
}

.leaderboard-name {
  flex: 1;
  font-weight: 700;
  color: #1a3456;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.leaderboard-name-text {
  font-size: 0.92rem;
}

.leaderboard-meta {
  font-size: 0.75rem;
  color: #6a8aaa;
  font-weight: 500;
}

.leaderboard-points {
  font-weight: 800;
  font-size: 0.82rem;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  padding: 4px 10px;
  border-radius: 999px;
  min-width: 72px;
  text-align: center;
}

.leaderboard-row.is-top-1 .leaderboard-points {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}

.leaderboard-row.is-top-2 .leaderboard-points {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

.leaderboard-row.is-top-3 .leaderboard-points {
  background: #ffedd5;
  border-color: #fed7aa;
  color: #9a3412;
}

/* dark theme rows */
[data-theme="dark"] .leaderboard-row {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  border-left-color: rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] .leaderboard-row:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .leaderboard-row.is-you {
  border-color: rgba(59, 130, 246, 0.3);
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.06);
}

[data-theme="dark"] .leaderboard-row.is-top-1 {
  border-color: rgba(245, 158, 11, 0.25);
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.06);
}

[data-theme="dark"] .leaderboard-row.is-top-2 {
  border-color: rgba(148, 163, 184, 0.2);
  border-left-color: #94a3b8;
  background: rgba(148, 163, 184, 0.04);
}

[data-theme="dark"] .leaderboard-row.is-top-3 {
  border-color: rgba(217, 119, 6, 0.22);
  border-left-color: #d97706;
  background: rgba(217, 119, 6, 0.05);
}

[data-theme="dark"] .leaderboard-rank {
  color: #6a8aaa;
}

[data-theme="dark"] .leaderboard-name {
  color: #cfe2f3;
}

[data-theme="dark"] .leaderboard-meta {
  color: #4a6a8a;
}

[data-theme="dark"] .leaderboard-points {
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.22);
  color: #34d399;
}

[data-theme="dark"] .leaderboard-row.is-top-1 .leaderboard-points {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
  color: #fbbf24;
}

[data-theme="dark"] .leaderboard-row.is-top-2 .leaderboard-points {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.22);
  color: #94a3b8;
}

[data-theme="dark"] .leaderboard-row.is-top-3 .leaderboard-points {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.28);
  color: #fdba74;
}

/* ── Leaderboard podium (top 3 staircase) ── */
.leaderboard-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 20px 16px 0;
  position: relative;
  background: radial-gradient(ellipse 90% 70% at 50% 110%, rgba(245, 158, 11, 0.07) 0%, transparent 70%);
}

.leaderboard-podium::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle 2px at 10% 20%, rgba(245, 158, 11, 0.55) 0%, transparent 100%),
    radial-gradient(circle 1.5px at 90% 14%, rgba(245, 158, 11, 0.45) 0%, transparent 100%),
    radial-gradient(circle 1px at 52% 8%, rgba(255, 255, 255, 0.4) 0%, transparent 100%),
    radial-gradient(circle 1.5px at 28% 32%, rgba(255, 255, 255, 0.25) 0%, transparent 100%),
    radial-gradient(circle 1px at 74% 26%, rgba(245, 158, 11, 0.35) 0%, transparent 100%),
    radial-gradient(circle 1px at 18% 55%, rgba(255, 255, 255, 0.15) 0%, transparent 100%),
    radial-gradient(circle 1.5px at 82% 50%, rgba(245, 158, 11, 0.25) 0%, transparent 100%);
  opacity: 0.6;
}

.podium-slot {
  flex: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  border-radius: 12px 12px 0 0;
  transition: filter 0.15s ease;
}

.podium-slot:hover {
  filter: brightness(1.06);
}

.podium-slot:focus {
  outline: 3px solid rgba(47, 167, 255, 0.4);
  outline-offset: 2px;
}

.podium-crown {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 4px;
}

.podium-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-bottom: 8px;
  width: 100%;
}

.podium-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  border: 3px solid;
  flex-shrink: 0;
}

.podium-1st .podium-avatar {
  width: 60px;
  height: 60px;
  font-size: 1.3rem;
  background: linear-gradient(135deg, #fef9c3, #fde68a);
  border-color: #f59e0b;
  color: #92400e;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}

.podium-2nd .podium-avatar {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-color: #94a3b8;
  color: #475569;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.15);
}

.podium-3rd .podium-avatar {
  background: linear-gradient(135deg, #fff7ed, #fed7aa);
  border-color: #d97706;
  color: #9a3412;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.15);
}

.podium-slot.is-you .podium-avatar {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
}

.podium-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1a3456;
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 6px;
  box-sizing: border-box;
}

.podium-xp {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid;
}

.podium-1st .podium-xp {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.podium-2nd .podium-xp {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.podium-3rd .podium-xp {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fed7aa;
}

.podium-step {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px 10px 0 0;
  font-size: 1.35rem;
  position: relative;
  overflow: hidden;
}

.podium-step::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, transparent 100%);
  border-radius: 10px 10px 0 0;
  pointer-events: none;
}

.podium-1st .podium-step {
  height: 80px;
  background: linear-gradient(180deg,
    #fef08a 0%,
    #fcd34d 18%,
    #f59e0b 55%,
    #d97706 85%,
    #b45309 100%);
  box-shadow: 0 -4px 16px rgba(245, 158, 11, 0.45), 0 4px 8px rgba(180, 83, 9, 0.35);
}

.podium-2nd .podium-step {
  height: 56px;
  background: linear-gradient(180deg,
    #f8fafc 0%,
    #e2e8f0 18%,
    #94a3b8 55%,
    #64748b 85%,
    #475569 100%);
  box-shadow: 0 -4px 14px rgba(148, 163, 184, 0.4), 0 4px 8px rgba(71, 85, 105, 0.3);
}

.podium-3rd .podium-step {
  height: 40px;
  background: linear-gradient(180deg,
    #fed7aa 0%,
    #fdba74 18%,
    #d97706 55%,
    #c2410c 85%,
    #9a3412 100%);
  box-shadow: 0 -4px 12px rgba(217, 119, 6, 0.4), 0 4px 8px rgba(154, 52, 18, 0.3);
}

.leaderboard-rest {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px 12px;
}

/* dark theme podium */
[data-theme="dark"] .podium-name {
  color: #d0e4ff;
}

[data-theme="dark"] .podium-1st .podium-avatar {
  background: linear-gradient(135deg, #451a03, #78350f);
  border-color: #d97706;
  color: #fde68a;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.22);
}

[data-theme="dark"] .podium-2nd .podium-avatar {
  background: linear-gradient(135deg, #1e293b, #334155);
  border-color: #64748b;
  color: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .podium-3rd .podium-avatar {
  background: linear-gradient(135deg, #431407, #7c2d12);
  border-color: #c2410c;
  color: #fed7aa;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.2);
}

[data-theme="dark"] .podium-1st .podium-xp {
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.28);
}

[data-theme="dark"] .podium-2nd .podium-xp {
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] .podium-3rd .podium-xp {
  background: rgba(217, 119, 6, 0.14);
  color: #fed7aa;
  border-color: rgba(217, 119, 6, 0.25);
}

[data-theme="dark"] .podium-1st .podium-step {
  background: linear-gradient(180deg,
    #fcd34d 0%,
    #f59e0b 22%,
    #d97706 55%,
    #b45309 85%,
    #7c2d12 100%);
  box-shadow: 0 -4px 20px rgba(245, 158, 11, 0.6), 0 4px 10px rgba(124, 45, 18, 0.45);
}

[data-theme="dark"] .podium-2nd .podium-step {
  background: linear-gradient(180deg,
    #94a3b8 0%,
    #64748b 22%,
    #475569 55%,
    #334155 85%,
    #1e293b 100%);
  box-shadow: 0 -4px 16px rgba(148, 163, 184, 0.3), 0 4px 8px rgba(30, 41, 59, 0.5);
}

[data-theme="dark"] .podium-3rd .podium-step {
  background: linear-gradient(180deg,
    #fb923c 0%,
    #c2410c 22%,
    #9a3412 55%,
    #7c2d12 85%,
    #431407 100%);
  box-shadow: 0 -4px 14px rgba(194, 65, 12, 0.5), 0 4px 8px rgba(67, 20, 7, 0.45);
}

/* ── Calendar modal ── */
.calendar-modal {
  position: fixed;
  inset: 0;
  background: rgba(9, 22, 35, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1250;
}

.calendar-modal.is-open {
  display: flex;
}

.calendar-modal-card {
  width: min(420px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: #ffffff;
  border: none;
  border-radius: 24px;
  padding: 0;
  box-shadow: 0 24px 64px rgba(8, 21, 70, 0.22), 0 4px 16px rgba(8, 21, 70, 0.08);
}

.calendar-modal-header {
  background: linear-gradient(135deg, #1a3560 0%, #2563EB 100%);
  border-radius: 24px 24px 0 0;
  padding: 18px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
}

.calendar-modal-header h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1.2rem;
}

.calendar-modal-close {
  border: none;
  background: rgba(255,255,255,0.2);
  font-size: 1.1rem;
  line-height: 1;
  color: #ffffff;
  cursor: pointer;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}


/* ── Autumn mood (js/modules/autumn-theme.js) ──
   Falling emoji leaves over the home/level pages, Sep-Nov only. Sits above
   page content but below modals/overlays, never catches clicks. Transform +
   opacity only (cheap on phones). */
.autumn-leaves {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
}

.autumn-leaf {
  position: absolute;
  top: -40px;
  line-height: 1;
  opacity: 0.85;
  will-change: transform;
  animation-name: autumnFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

.autumn-leaf-inner {
  display: block;
  will-change: transform;
}

@keyframes autumnFall {
  0%   { transform: translate3d(0, -40px, 0) rotate(0deg); opacity: 0; }
  8%   { opacity: 0.85; }
  25%  { transform: translate3d(var(--autumn-sway), 28vh, 0) rotate(calc(var(--autumn-spin) * 0.25)); }
  50%  { transform: translate3d(calc(var(--autumn-sway) * -0.8), 55vh, 0) rotate(calc(var(--autumn-spin) * 0.5)); }
  75%  { transform: translate3d(var(--autumn-sway), 82vh, 0) rotate(calc(var(--autumn-spin) * 0.75)); }
  92%  { opacity: 0.85; }
  100% { transform: translate3d(0, 108vh, 0) rotate(var(--autumn-spin)); opacity: 0; }
}

/* Header toggle: reuses the round theme-toggle button look, just an emoji
   inside; dimmed when the leaves are switched off. */
.autumn-toggle-btn {
  font-size: 20px;
  line-height: 1;
  margin-left: 6px;
}

.autumn-toggle-btn.is-off {
  opacity: 0.5;
  filter: grayscale(0.7);
}

@media (prefers-reduced-motion: reduce) {
  .autumn-leaves {
    display: none;
  }
}

/* ── Autumn warm palette, light theme only (home page) ──
   Same on/off switch as the falling leaves (body.season-autumn, set by
   js/modules/autumn-theme.js): the 🍂 header button flips the whole mood.
   Muted terracotta / amber / olive / plum / burgundy / chestnut instead of
   the saturated blue-purple-green set; warm cream surfaces instead of cold
   white-blue. Button/badge colours are darkened until white (or accent)
   text reaches WCAG 4.5:1 on the lightest point of each gradient. Dark
   theme is untouched. */
html[data-theme="light"] body.season-autumn { background: #fbf4e8; }
html[data-theme="light"] body.season-autumn .levels { background: #fbf4e8; }
html[data-theme="light"] body.season-autumn .levels-title-accent { color: #b8721c; }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(1) { background: linear-gradient(160deg,#963d12,#bc4c17); box-shadow: 0 6px 0 #4f200a, 0 8px 18px rgba(188,76,23,.38); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(1):hover { box-shadow: 0 9px 0 #4f200a, 0 12px 22px rgba(188,76,23,.5); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(1):active { box-shadow: 0 2px 0 #4f200a !important; }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(2) { background: linear-gradient(160deg,#722e7b,#8e3a9a); box-shadow: 0 6px 0 #3c1841, 0 8px 18px rgba(142,58,154,.38); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(2):hover { box-shadow: 0 9px 0 #3c1841, 0 12px 22px rgba(142,58,154,.5); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(2):active { box-shadow: 0 2px 0 #3c1841 !important; }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(3) { background: linear-gradient(160deg,#376522,#457e2a); box-shadow: 0 6px 0 #1d3512, 0 8px 18px rgba(69,126,42,.38); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(3):hover { box-shadow: 0 9px 0 #1d3512, 0 12px 22px rgba(69,126,42,.5); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(3):active { box-shadow: 0 2px 0 #1d3512 !important; }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(4) { background: linear-gradient(160deg,#7a5112,#986516); box-shadow: 0 6px 0 #402a09, 0 8px 18px rgba(152,101,22,.38); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(4):hover { box-shadow: 0 9px 0 #402a09, 0 12px 22px rgba(152,101,22,.5); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(4):active { box-shadow: 0 2px 0 #402a09 !important; }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(5) { background: linear-gradient(160deg,#9d224b,#c42a5e); box-shadow: 0 6px 0 #521227, 0 8px 18px rgba(196,42,94,.38); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(5):hover { box-shadow: 0 9px 0 #521227, 0 12px 22px rgba(196,42,94,.5); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(5):active { box-shadow: 0 2px 0 #521227 !important; }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(6) { background: linear-gradient(160deg,#216275,#297b92); box-shadow: 0 6px 0 #11343d, 0 8px 18px rgba(41,123,146,.38); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(6):hover { box-shadow: 0 9px 0 #11343d, 0 12px 22px rgba(41,123,146,.5); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(6):active { box-shadow: 0 2px 0 #11343d !important; }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(7) { background: linear-gradient(160deg,#3c438f,#4b54b3); box-shadow: 0 6px 0 #20234b, 0 8px 18px rgba(75,84,179,.38); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(7):hover { box-shadow: 0 9px 0 #20234b, 0 12px 22px rgba(75,84,179,.5); }
html[data-theme="light"] body.season-autumn .quick-links .quick-link-btn:nth-child(7):active { box-shadow: 0 2px 0 #20234b !important; }
@media (min-width: 641px) {
  html[data-theme="light"] body.season-autumn .quick-links .qlb-label {
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0.07em;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  }
  html[data-theme="light"] body.season-autumn .quick-links .qlb-icon { font-size: 2.3rem; }
}
html[data-theme="light"] body.season-autumn .levels .card:nth-child(1) { --card-accent: #C0683A; --card-accent-text: #a55932; }
html[data-theme="light"] body.season-autumn .card:nth-child(1) .btn { background: linear-gradient(135deg,#af5f35,#95512d); }
html[data-theme="light"] body.season-autumn .levels .card:nth-child(2) { --card-accent: #6F8B45; --card-accent-text: #5c7439; }
html[data-theme="light"] body.season-autumn .card:nth-child(2) .btn { background: linear-gradient(135deg,#627b3d,#536934); }
html[data-theme="light"] body.season-autumn .levels .card:nth-child(3) { --card-accent: #8A5A83; --card-accent-text: #8a5a83; }
html[data-theme="light"] body.season-autumn .card:nth-child(3) .btn { background: linear-gradient(135deg,#8a5a83,#754c6f); }
html[data-theme="light"] body.season-autumn .levels .card:nth-child(4) { --card-accent: #D18A2B; --card-accent-text: #95631f; }
html[data-theme="light"] body.season-autumn .card:nth-child(4) .btn { background: linear-gradient(135deg,#9f6921,#87591c); }
html[data-theme="light"] body.season-autumn .levels .card {
  background: linear-gradient(160deg, #fffdf8 0%, #f8eedd 100%);
  border-color: rgba(110, 70, 30, 0.14);
  border-top-color: var(--card-accent);
  box-shadow: 0 14px 34px rgba(90, 55, 20, 0.12), 0 4px 12px rgba(90, 55, 20, 0.07);
}
html[data-theme="light"] body.season-autumn .levels .card:hover {
  box-shadow: 0 22px 50px rgba(90, 55, 20, 0.18), 0 0 0 1px rgba(209, 138, 43, 0.28);
}
html[data-theme="light"] body.season-autumn .card-level-badge { color: var(--card-accent-text); background: rgba(140, 90, 40, 0.07); }
html[data-theme="light"] body.season-autumn .card .btn.is-locked-course-btn { background: #7c7266; border-color: #7c7266; }
html[data-theme="light"] body.season-autumn .hero-daily-card {
  background: linear-gradient(160deg, #fffdf9 0%, #faf0e0 100%);
  border-color: #e6d4b8;
  box-shadow: 0 10px 28px rgba(90, 55, 20, 0.11), 0 2px 8px rgba(90, 55, 20, 0.06);
}
html[data-theme="light"] body.season-autumn .hero-daily-card::before { background: linear-gradient(90deg, #c0683a, #e0a34a); }
html[data-theme="light"] body.season-autumn #daily-tip-card::before { background: linear-gradient(90deg, #6f8b45, #e0a34a); }
html[data-theme="light"] body.season-autumn .hero-daily-badge { color: #8a4a1c; background: #f6dfc2; }
html[data-theme="light"] body.season-autumn .hero-daily-badge--tip { color: #4f6a2a; background: #e3ebc9; }
html[data-theme="light"] body.season-autumn .hero-daily-text { border-left-color: #c0683a; color: #3a2616; }

/* Partners strip, autumn warm version (light theme) - same cool blue gradient,
   border and text as the rest of the old palette swapped for cream / terracotta
   / amber. Logos' own colours are untouched. */
html[data-theme="light"] body.season-autumn .partners-strip {
  background: linear-gradient(160deg, #fdf6ea 0%, #f8ead3 50%, #fdf7ec 100%);
  border-color: #e6cfa8;
  box-shadow: 0 8px 36px rgba(90, 55, 20, 0.12), 0 2px 8px rgba(90, 55, 20, 0.06);
}
html[data-theme="light"] body.season-autumn .partners-strip::before {
  background: linear-gradient(90deg, #5a2d12 0%, #a8532f 20%, #d9893b 40%, #efb458 55%, #d9893b 70%, #a8532f 85%, #5a2d12 100%);
}
html[data-theme="light"] body.season-autumn .partners-strip::after { background: linear-gradient(90deg, transparent, rgba(168, 83, 47, 0.28), transparent); }
html[data-theme="light"] body.season-autumn .partners-strip-label { color: #9b4a26; }
html[data-theme="light"] body.season-autumn .partners-strip-label::before { background: linear-gradient(90deg, transparent, #9b4a26); }
html[data-theme="light"] body.season-autumn .partners-strip-label::after { background: linear-gradient(90deg, #9b4a26, transparent); }
html[data-theme="light"] body.season-autumn .partner-item {
  border-color: #eedcc0;
  box-shadow: 0 4px 18px rgba(90, 55, 20, 0.08);
}
html[data-theme="light"] body.season-autumn .partner-item:hover {
  border-color: #c0683a;
  box-shadow: 0 12px 36px rgba(168, 83, 47, 0.2), 0 0 0 1px rgba(242, 193, 78, 0.25), 0 0 32px rgba(242, 193, 78, 0.18);
}
html[data-theme="light"] body.season-autumn .partner-logo {
  background: #fbf3e6;
  border-color: #ecd9ba;
  box-shadow: 0 3px 10px rgba(90, 55, 20, 0.1);
}
html[data-theme="light"] body.season-autumn .partner-name { color: #3a2616; }
html[data-theme="light"] body.season-autumn .partner-type { color: #9b4a26; }
html[data-theme="light"] body.season-autumn .partners-loading { color: #9b4a26; }
html[data-theme="light"] body.season-autumn .partners-edit-btn { border-color: #e3cfae; color: #8a6a45; }
html[data-theme="light"] body.season-autumn .partners-edit-btn:hover { border-color: #c0683a; color: #3a2616; box-shadow: 0 2px 8px rgba(168, 83, 47, 0.15); }
html[data-theme="light"] body.season-autumn .partner-type { opacity: 1; }
html[data-theme="light"] body.season-autumn a.partner-item::after { color: #c0683a; }
html[data-theme="light"] body.season-autumn .partner-logo-placeholder {
  background: linear-gradient(140deg, #5a2d12 0%, #c0683a 100%);
  box-shadow: 0 4px 14px rgba(90, 55, 20, 0.2);
}

/* Home page sections that were still plain white next to the cream body in
   autumn mode (hero cards area, "Our results", contact) - background only. */
html[data-theme="light"] body.season-autumn .hero,
html[data-theme="light"] body.season-autumn .results-section,
html[data-theme="light"] body.season-autumn .contact-section {
  background: #fbf4e8;
}

/* ── Header control cluster, light theme ──
   Theme/leaf toggles, Profile/Login/staff buttons and the streak badge:
   one family of dark smoky-brown chips with a bright amber rim and amber
   text - no white backgrounds, so they stay clearly visible over both the
   pale and the saturated parts of the sunrise banner - with real spacing so
   they never touch each other. Dark theme keeps its own look. */
html[data-theme="light"] .hero-header .header-actions-left {
  gap: 12px !important; /* beats the tighter mobile gaps in admin-editors/mobile-patches */
}

html[data-theme="light"] .hero-header .autumn-toggle-btn {
  margin-left: 0;
}

html[data-theme="light"] .hero-header .header-actions .btn,
html[data-theme="light"] .hero-header #login-btn,
html[data-theme="light"] #mobile-menu-btn,
html[data-theme="light"] .hero-header .theme-toggle-btn,
html[data-theme="light"] .hero-header .streak-badge {
  background: rgba(46, 24, 8, 0.72) !important;
  background-image: none !important;
  border: 1.5px solid rgba(255, 205, 110, 0.9) !important;
  box-shadow:
    0 4px 14px rgba(60, 25, 5, 0.38),
    0 0 0 3px rgba(255, 200, 100, 0.16) !important;
  backdrop-filter: blur(10px) saturate(1.3) !important;
  -webkit-backdrop-filter: blur(10px) saturate(1.3) !important;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease !important;
}

html[data-theme="light"] .hero-header .header-actions .btn,
html[data-theme="light"] .hero-header #login-btn,
html[data-theme="light"] #mobile-menu-btn {
  color: #ffe7b0 !important;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(30, 12, 0, 0.55);
}

html[data-theme="light"] .hero-header .header-actions .btn:hover,
html[data-theme="light"] .hero-header #login-btn:hover,
html[data-theme="light"] #mobile-menu-btn:hover,
html[data-theme="light"] .hero-header .theme-toggle-btn:hover {
  background: rgba(46, 24, 8, 0.86) !important;
  border-color: #ffe08f !important;
  color: #fff0c4 !important;
  transform: translateY(-2px);
  box-shadow:
    0 8px 20px rgba(60, 25, 5, 0.45),
    0 0 0 3px rgba(255, 200, 100, 0.28) !important;
}

/* #profile-btn has its own `transform: none` further up, which swallowed
   the hover lift the other chips get. */
html[data-theme="light"] .hero-header .header-actions #profile-btn:hover {
  transform: translateY(-2px) !important;
}

html[data-theme="light"] .hero-header .header-actions .btn:active,
html[data-theme="light"] .hero-header .theme-toggle-btn:active {
  transform: translateY(0) scale(0.97);
}

html[data-theme="light"] .hero-header .streak-count,
html[data-theme="light"] .hero-header #streak-freeze-count {
  color: #fff0c4;
  text-shadow: 0 1px 2px rgba(30, 12, 0, 0.55);
}

/* Browsers without backdrop-filter: opaque enough that the text never
   depends on what is behind the chip. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-theme="light"] .hero-header .header-actions .btn,
  html[data-theme="light"] .hero-header #login-btn,
  html[data-theme="light"] #mobile-menu-btn,
  html[data-theme="light"] .hero-header .theme-toggle-btn,
  html[data-theme="light"] .hero-header .streak-badge {
    background: rgba(46, 24, 8, 0.92) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme="light"] .hero-header .header-actions .btn:hover,
  html[data-theme="light"] .hero-header .theme-toggle-btn:hover {
    transform: none;
  }
}

/* Layout fix (both themes): `header .btn { position: absolute; right: 4% }`
   still applies to Profile, which is position: relative here, so it was
   nudged ~13px left into the 🍂 button and the gap to the streak badge came
   out 25px instead of the intended one. */
.hero-header .header-actions-left #profile-btn {
  right: auto;
}

/* ── Inner-page headers (course/lesson/results/articles/admin ...): no Earth
   banner, no comets - just a plain bar with the logo. The big sunrise/space
   banner stays on the home page (.hero-header) and the staff cabinets that
   reuse that header. ── */
.level-header::before,
.admin-header::before {
  content: none;
}

.level-header .level-header-comet-canvas,
.admin-header .level-header-comet-canvas {
  display: none;
}

html[data-theme="light"] .level-header,
html[data-theme="light"] .admin-header {
  --header-bg-color: #ffffff;
  border-bottom: 1px solid #e3e9f1;
  box-shadow: 0 2px 10px rgba(15, 42, 69, 0.06);
}

html[data-theme="dark"] .level-header,
html[data-theme="dark"] .admin-header {
  --header-bg-color: #0a1628;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

/* Buttons: the translucent-grey-with-gold-text pills were made for a photo
   behind them; on a plain bar they looked muddy. Same dark amber chips as the
   home header (see "Header control cluster" above). Dark theme keeps its
   existing look (dark bar + translucent chips already read fine). */
html[data-theme="light"] .level-header .btn,
html[data-theme="light"] .level-header-actions .btn,
html[data-theme="light"] .admin-header .btn {
  background: rgba(46, 24, 8, 0.86) !important;
  background-image: none !important;
  color: #ffe7b0 !important;
  border: 1.5px solid rgba(255, 205, 110, 0.9) !important;
  box-shadow: 0 4px 12px rgba(60, 25, 5, 0.22) !important;
}

html[data-theme="light"] .level-header .btn:hover,
html[data-theme="light"] .level-header-actions .btn:hover,
html[data-theme="light"] .admin-header .btn:hover {
  background: rgba(46, 24, 8, 0.96) !important;
  color: #fff0c4 !important;
  border-color: #ffe08f !important;
}

/* Course lesson lists (a1/a2/b1/b2): the level's dark gradient is the PAGE
   background (body), pinned to the viewport, so it runs all the way to the
   top edge behind the header. The header paints the very same fixed
   gradient, so it stays opaque while sticky (content scrolls under it) yet
   has no seam, line or fade strip against the page - there is nothing to
   "match", it is one background. Body classes lp-a1..lp-b2 come from
   lesson-catalog.js (and are also set in the HTML to avoid a white flash).
   White logo even in the light theme: the dark one vanishes on these. */
body.lp-a1 { --lp-bg: linear-gradient(180deg, #2a0f00 0%, #1a0800 100%); }
body.lp-a2 { --lp-bg: linear-gradient(180deg, #0c1528 0%, #07101f 100%); }
body.lp-b1 { --lp-bg: linear-gradient(180deg, #021a19 0%, #011010 100%); }
body.lp-b2 { --lp-bg: linear-gradient(180deg, #10042a 0%, #08031a 100%); }

/* "html body..." so it also beats dark-theme-legacy.css's [data-theme="dark"] body. */
html body.lp-a1,
html body.lp-a2,
html body.lp-b1,
html body.lp-b2 {
  background: var(--lp-bg) fixed;
  min-height: 100vh;
}

body.lp-a1 .lessons-page.lp-a1,
body.lp-a2 .lessons-page.lp-a2,
body.lp-b1 .lessons-page.lp-b1,
body.lp-b2 .lessons-page.lp-b2 {
  background: transparent;
}

body.lp-a1 .level-header,
body.lp-a2 .level-header,
body.lp-b1 .level-header,
body.lp-b2 .level-header {
  background: var(--lp-bg) fixed;
  border-bottom: none;
  box-shadow: none;
}

body.lp-a1 .level-header::after,
body.lp-a2 .level-header::after,
body.lp-b1 .level-header::after,
body.lp-b2 .level-header::after {
  content: none;
}

html[data-theme="light"] body.lp-a1 .logo img,
html[data-theme="light"] body.lp-a2 .logo img,
html[data-theme="light"] body.lp-b1 .logo img,
html[data-theme="light"] body.lp-b2 .logo img {
  content: url("../../assets/images/logo_citizen_x_white_thin.png");
}

/* Inner pages: the header scrolls away with the page instead of staying
   pinned (the home page and the staff cabinets keep their sticky/fixed
   .hero-header). Needs !important only to beat the mobile "fixed" rule in
   admin-editors.css (and its matching body padding-top compensation). */
body > .level-header,
body > .admin-header {
  position: relative !important;
  top: auto !important;
}

html body:has(> .level-header),
html body:has(> .admin-header) {
  padding-top: 0 !important;
  scroll-padding-top: 0 !important;
}

/* ── Autumn warm palette for the lesson quiz page (tasks.html), light theme ──
   Same cream/terracotta/amber family as the home page instead of white and
   cold blue-grey; class set by js/modules/autumn-theme.js (Sep-Nov, unless
   switched off with the home page's 🍂 button). Right/wrong answer colours
   keep their meaning (green / red). White text on the terracotta buttons is
   >= 5.9:1. */
html[data-theme="light"] body.season-autumn:has(main.tasks-page) { background: #fbf4e8; }
html[data-theme="light"] body.season-autumn:has(main.tasks-page) .level-header {
  --header-bg-color: #fbf4e8;
  border-bottom-color: #ecdcc0;
  box-shadow: 0 2px 10px rgba(90, 55, 20, 0.07);
}
html[data-theme="light"] body.season-autumn .tasks-card { background: #fffaf0; border-color: #e8d6b8; box-shadow: 0 10px 28px rgba(90, 55, 20, 0.08); }
html[data-theme="light"] body.season-autumn .tasks-card h1 { color: #3a2616; }
html[data-theme="light"] body.season-autumn .tasks-card p,
html[data-theme="light"] body.season-autumn .tasks-list { color: #5c4126; }
html[data-theme="light"] body.season-autumn .quiz-card { background: #f6ebd8; border-color: #e6d2b1; box-shadow: 0 12px 30px rgba(90, 55, 20, 0.1); }
html[data-theme="light"] body.season-autumn .quiz-card h1,
html[data-theme="light"] body.season-autumn .quiz-subtitle { color: #3a2616; }
html[data-theme="light"] body.season-autumn .quiz-question-shell { background: #fbf3e4; border-color: #e6d4b6; }
html[data-theme="light"] body.season-autumn .quiz-task-number { color: #9c7448; }
html[data-theme="light"] body.season-autumn .quiz-question { color: #3a2616; }
html[data-theme="light"] body.season-autumn .quiz-option { background: #fffdf8; border-color: #e3d3b8; color: #3a2616; }
html[data-theme="light"] body.season-autumn .quiz-option.is-selected { border-color: #b25a2b; box-shadow: 0 0 0 1px #b25a2b inset; }
html[data-theme="light"] body.season-autumn .quiz-option.is-correct { background: #eaf3dc; border-color: #4c8a2e; }
html[data-theme="light"] body.season-autumn .quiz-option.is-correct .quiz-option-key { background: #4c8a2e; border-color: #4c8a2e; }
html[data-theme="light"] body.season-autumn .quiz-option-key { border-color: #b9a07c; color: #5c4126; }
html[data-theme="light"] body.season-autumn .quiz-check-btn,
html[data-theme="light"] body.season-autumn .quiz-nav-btn-primary,
html[data-theme="light"] body.season-autumn #quiz-prev-btn:not(:disabled) { background: linear-gradient(135deg, #b25a2b, #8f4318); }
html[data-theme="light"] body.season-autumn .quiz-nav-btn { background: #b9a58a; }
html[data-theme="light"] body.season-autumn .quiz-explain-btn { background: #f3dfbb; border-color: #e0c48e; color: #6b3d12; }
html[data-theme="light"] body.season-autumn .quiz-explain-btn:disabled { color: #6b3d12; }
html[data-theme="light"] body.season-autumn .quiz-counter { color: #5c4126; }
html[data-theme="light"] body.season-autumn .quiz-status { color: #5c4126; }
html[data-theme="light"] body.season-autumn .quiz-final-result { color: #3a2616; }
html[data-theme="light"] body.season-autumn .btn.btn-exit { background: linear-gradient(135deg, #fffdf8, #f6ebd8); border-color: rgba(143, 15, 23, 0.25); box-shadow: 0 8px 16px rgba(90, 55, 20, 0.12); }

/* Quiz page fixes (after QA): answer states must beat the warm "selected"
   rules above (specificity), letters in the key circle stay white on
   green/red, Check keeps its "go" green but in an olive that sits in the
   palette (white text >= 5:1; mobile-patches-flashcards.css forces the old
   green with !important), and the explanation / retry dialogs get the warm
   surface too. */
html[data-theme="light"] body.season-autumn .quiz-option.is-correct { background: #eaf3dc; border-color: #4c8a2e; box-shadow: none; }
html[data-theme="light"] body.season-autumn .quiz-option.is-wrong { background: #fbe6df; border-color: #b64232; box-shadow: none; }
html[data-theme="light"] body.season-autumn .quiz-option.is-correct .quiz-option-key,
html[data-theme="light"] body.season-autumn .quiz-option.is-wrong .quiz-option-key { color: #ffffff; }
html[data-theme="light"] body.season-autumn .quiz-option.is-wrong .quiz-option-key { background: #b64232; border-color: #b64232; }
html[data-theme="light"] body.season-autumn .quiz-check-btn {
  background: linear-gradient(135deg, #5f8f2a, #3f6b1c) !important;
  box-shadow: 0 12px 24px rgba(63, 107, 28, 0.28) !important;
}
html[data-theme="light"] body.season-autumn .quiz-explain-card,
html[data-theme="light"] body.season-autumn .quiz-retry-card { background: linear-gradient(180deg, #fffdf8 0%, #f6ebd8 100%); border-color: #c0683a; }
html[data-theme="light"] body.season-autumn .quiz-explain-header,
html[data-theme="light"] body.season-autumn .quiz-explain-ask,
html[data-theme="light"] body.season-autumn .quiz-explain-lang-label,
html[data-theme="light"] body.season-autumn .quiz-retry-card h3,
html[data-theme="light"] body.season-autumn .qre-ask,
html[data-theme="light"] body.season-autumn .qre-lang-label { color: #3a2616; }
html[data-theme="light"] body.season-autumn .quiz-explain-text,
html[data-theme="light"] body.season-autumn .qre-text,
html[data-theme="light"] body.season-autumn .quiz-retry-card p { color: #5c4126; }
html[data-theme="light"] body.season-autumn .quiz-explain-question { background: #fbf3e4; border-color: #e6d4b6; border-left-color: #b25a2b; color: #3a2616; }
html[data-theme="light"] body.season-autumn .quiz-explain-close { background: #b25a2b; border-color: #8f4318; }
html[data-theme="light"] body.season-autumn .quiz-explain-option,
html[data-theme="light"] body.season-autumn .qre-option { background: #fbf1df; border-color: #e0c48e; color: #6b3d12; }

/* Quiz page polish (second QA): Check's light end darkened to reach 4.5:1,
   and the last cold leftovers in the retry/explanation dialogs. */
html[data-theme="light"] body.season-autumn .quiz-check-btn {
  background: linear-gradient(135deg, #557f26, #3c6419) !important;
}
html[data-theme="light"] body.season-autumn .quiz-retry-icon { background: #fbe3d3; color: #a2501f; }
html[data-theme="light"] body.season-autumn .quiz-modal-retry-btn { background: linear-gradient(135deg, #b25a2b, #8f4318); color: #ffffff; border-color: #8f4318; }
html[data-theme="light"] body.season-autumn .quiz-modal-theory-btn { background: #fffdf8; color: #6b3d12; border-color: #e0c48e; }
html[data-theme="light"] body.season-autumn .quiz-explain-lang-trigger { background: #fffdf8; color: #3a2616; border-color: #e0c48e; }
html[data-theme="light"] body.season-autumn .quiz-explain-card { box-shadow: 0 24px 60px rgba(90, 55, 20, 0.28); }
html[data-theme="light"] body.season-autumn .quiz-explain-header *:not(button) { color: #3a2616; }

/* ── Autumn warm palette on every inner page, light theme ──
   Same cream page (#fbf4e8), warm sand/cream surfaces and warm borders as the
   home page, instead of white and cold blue-grey. Set by autumn-theme.js
   (Sep-Nov, unless switched off with the home page's 🍂 button); the level
   lesson lists (a1-b2) keep their own dark colours; the Cosmo chat panel is
   left alone (its redesign is a separate topic). Text colours are untouched
   (already dark on light), so contrast only goes up. */
html[data-theme="light"] body.season-autumn { background: #fbf4e8; }
html[data-theme="light"] body.season-autumn > .level-header,
html[data-theme="light"] body.season-autumn > .admin-header {
  --header-bg-color: #fbf4e8;
  border-bottom-color: #ecdcc0;
  box-shadow: 0 2px 10px rgba(90, 55, 20, 0.07);
}
html[data-theme="light"] body.season-autumn .lesson-player-card,
html[data-theme="light"] body.season-autumn .presentation-card,
html[data-theme="light"] body.season-autumn .article-reader-card,
html[data-theme="light"] body.season-autumn #article-read-content,
html[data-theme="light"] body.season-autumn .results-modal-card-standalone,
html[data-theme="light"] body.season-autumn .results-modal-tile,
html[data-theme="light"] body.season-autumn .fc-card-face.fc-card-front,
html[data-theme="light"] body.season-autumn .article-card-item,
html[data-theme="light"] body.season-autumn .admin-table-card,
html[data-theme="light"] body.season-autumn .admin-chart-card,
html[data-theme="light"] body.season-autumn .admin-user-card,
html[data-theme="light"] body.season-autumn .admin-dashboard-panel { background: #fffaf0; border-color: #e8d6b8; }
html[data-theme="light"] body.season-autumn .article-card-content { background: linear-gradient(180deg, #fffaf0 0%, #f8eedd 100%); }
html[data-theme="light"] body.season-autumn .results-modal-certificate { background: #f6ebd8; }
html[data-theme="light"] body.season-autumn .results-modal-person--image { background: rgba(255, 250, 240, 0.8); }
html[data-theme="light"] body.season-autumn .results-modal-lead { background: #fbf3e4; }
html[data-theme="light"] body.season-autumn .presentation-frame-shell,
html[data-theme="light"] body.season-autumn #presentation-frame { background: #f6ebd8; }
html[data-theme="light"] body.season-autumn .admin-head { background: linear-gradient(180deg, #faf0e0 0%, #f3e5cc 100%); }
html[data-theme="light"] body.season-autumn .admin-dashboard-stat { background: linear-gradient(180deg, #fffaf0 0%, #f6ebd8 100%); }
html[data-theme="light"] body.season-autumn .admin-username-search { background: #fffdf8; border-color: #e0c48e; }
html[data-theme="light"] body.season-autumn #mobile-nav-drawer { background: linear-gradient(180deg, #fbf4e8 0%, #f6ebd8 55%, #f3e5cc 100%); }
html[data-theme="light"] body.season-autumn .fc-page { background: #fbf4e8; }
