/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple:       #6d28d9;
  --purple-dark:  #5b21b6;
  --purple-light: #7c3aed;
  --purple-50:    #f5f3ff;
  --purple-100:   #ede9fe;
  --white:        #ffffff;
  --gray-50:      #f9fafb;
  --gray-100:     #f3f4f6;
  --gray-400:     #9ca3af;
  --gray-500:     #6b7280;
  --gray-600:     #4b5563;
  --gray-700:     #374151;
  --gray-800:     #1f2937;
  --gray-900:     #111827;
  --text-dark:    #1a1a1a;
  --nav-bg:       rgba(255,255,255,0.93);
  --font:         'Nunito', sans-serif;
  --transition:   0.3s ease;
  --radius:       16px;
  --shadow-sm:    0 2px 12px rgba(0,0,0,0.07);
  --shadow-md:    0 8px 32px rgba(0,0,0,0.10);
  --shadow-lg:    0 20px 60px rgba(0,0,0,0.14);
  --shadow-purple:0 8px 30px rgba(109,40,217,0.25);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text-dark);
  background: var(--white);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a  { text-decoration: none; color: inherit; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: var(--purple-light); border-radius: 4px; }

/* ===== UTILITIES ===== */
.gradient-bg  { background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%); }
.gradient-text {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.section-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 16px;
}
.section-sub {
  font-size: 1.05rem;
  color: var(--gray-500);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}
.section-header { text-align: center; margin-bottom: 60px; }

/* ===== ANDROID SMART BANNER ===== */
#custom-android-banner {
  display: none;
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--white);
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 16px;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#custom-android-banner.show { display: flex; }
.banner-app-info { display: flex; align-items: center; gap: 12px; }
.banner-app-info img { width: 46px; height: 46px; border-radius: 10px; }
.banner-title  { font-weight: 800; font-size: 0.95rem; color: var(--text-dark); }
.banner-sub    { font-size: 0.8rem; color: var(--gray-500); }
.banner-btn {
  font-size: 0.85rem; font-weight: 700; color: var(--purple);
  padding: 7px 16px; border: 2px solid var(--purple);
  border-radius: 50px; white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.banner-btn:hover { background: var(--purple); color: var(--white); }

/* ===== NAVIGATION ===== */
.nav {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: min(900px, 92vw);
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 50px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.2rem; font-weight: 900; color: var(--text-dark);
}
.nav-logo img { height: 30px; width: auto; border-radius: 8px; }
.nav-links { display: flex; align-items: center; gap: 2px; list-style: none; }
.nav-links a {
  font-size: 0.875rem; font-weight: 600; color: var(--gray-600);
  padding: 6px 12px; border-radius: 20px;
  transition: color var(--transition), background var(--transition);
}
.nav-links a:hover { color: var(--purple); background: var(--purple-100); }
.nav-right { display: flex; align-items: center; gap: 10px; }
.btn-nav-dl {
  background: var(--purple); color: var(--white);
  padding: 9px 20px; border-radius: 50px;
  font-size: 0.875rem; font-weight: 700;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-nav-dl:hover {
  background: var(--purple-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-purple);
}
.nav-hamburger {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; padding: 4px; background: none; border: none;
}
.nav-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--gray-600); border-radius: 2px;
  transition: var(--transition);
}

/* ===== MOBILE DROPDOWN MENU ===== */
.mobile-menu {
  /* Hidden by default — shown only on mobile via media query + .open */
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 98;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  flex-direction: column;
  padding: 8px;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  display: none; /* flex only on mobile breakpoint */
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.mobile-menu.open {
  opacity: 1; pointer-events: all;
  transform: translateY(0);
}
.mobile-menu a {
  font-size: 1rem; font-weight: 700; color: var(--text-dark);
  padding: 12px 16px; border-radius: 12px;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.mobile-menu a:hover { background: var(--purple-100); color: var(--purple); }
.mobile-menu .btn-nav-dl {
  margin: 6px 0 2px;
  text-align: center;
  color: var(--white) !important; /* override the general mobile-menu a color */
}
.mobile-menu .btn-nav-dl:hover {
  background: var(--purple-dark);
  color: var(--white) !important;
}

/* ===== HERO ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background: url('https://images.unsplash.com/photo-1652235106936-418dc6928143?q=80&w=1770&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D') center/cover no-repeat;
  transform: scale(1.05);
  animation: bgPan 20s ease-in-out infinite alternate;
}
.hero-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(10,0,30,0.45) 0%, rgba(10,0,30,0.25) 60%, rgba(10,0,30,0.15) 100%);
}
@keyframes bgPan {
  from { transform: scale(1.05) translateX(0); }
  to   { transform: scale(1.05) translateX(-2%); }
}
.hero-blobs {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
}
.hero-blobs span {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.07);
  filter: blur(40px);
}
.hero-blobs span:nth-child(1) { width: 400px; height: 400px; top: -100px; left: -80px; }
.hero-blobs span:nth-child(2) { width: 500px; height: 500px; bottom: -150px; right: -100px; }
.hero-blobs span:nth-child(3) { width: 200px; height: 200px; top: 40%; left: 40%; }

.hero-inner {
  position: relative; z-index: 2;
  width: 100%; max-width: 900px;
  margin: 0 auto;
  padding: 100px 20px 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
}

/* Badge pill */
.hero-badge-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50px;
  padding: 6px 14px 6px 8px;
  margin-bottom: 20px;
  opacity: 0; animation: fadeUp 0.7s 0.1s forwards;
}
.hero-badge-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74,222,128,0.3);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
.hero-badge-pill span { font-size: 0.78rem; font-weight: 700; color: #fff; letter-spacing: 0.05em; text-transform: uppercase; }

.hero-app-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
  opacity: 0; animation: fadeUp 0.8s 0.2s forwards;
}
.hero-app-row img { width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.hero-app-row h1 {
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 900;
  color: #fff;
  line-height: 1.1;
}

.hero-tagline {
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  margin-bottom: 14px;
  opacity: 0; animation: fadeUp 0.8s 0.35s forwards;
}
.hero-desc {
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  color: rgba(255,255,255,0.82);
  line-height: 1.75;
  max-width: 420px;
  margin-bottom: 28px;
  opacity: 0; animation: fadeUp 0.8s 0.45s forwards;
}

/* Content source icons */
.hero-sources {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 28px;
  opacity: 0; animation: fadeUp 0.8s 0.55s forwards;
}
.hero-source-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff;
  transition: background var(--transition), transform var(--transition);
}
.hero-source-icon:hover { background: rgba(255,255,255,0.25); transform: translateY(-2px); }

/* Badges */
.hero-badges {
  display: flex; gap: 10px; flex-wrap: nowrap; align-items: center;
  opacity: 0; animation: fadeUp 0.8s 0.65s forwards;
}
.badge-link { display: block; flex-shrink: 0; transition: transform var(--transition), filter var(--transition); }
.badge-link:hover { transform: translateY(-3px); filter: brightness(1.08); }
.badge-link img { height: 44px; width: auto; }

/* Hero phone */
.hero-phone {
  flex-shrink: 0;
  opacity: 0; animation: phoneReveal 1s 0.5s forwards;
}
.hero-slideshow-wrapper {
  position: relative;
  width: 240px;
  filter: drop-shadow(0 32px 64px rgba(0,0,0,0.4));
  animation: phoneFloat 6s ease-in-out infinite;
}
.hero-slideshow { position: relative; width: 240px; height: 480px; }
.hero-slide {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: contain;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 1.5s ease;
}
.hero-slide.active { opacity: 1; }

@keyframes phoneReveal { to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes phoneFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-14px)} }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

/* Hero wave */
.hero-wave { position: absolute; bottom: -1px; left: 0; right: 0; line-height: 0; }
.hero-wave svg { display: block; width: 100%; }

/* ===== FEATURES ===== */
.features { padding: 90px 20px; background: var(--white); }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}
.feature-card {
  background: var(--white);
  border: 2px solid var(--gray-100);
  border-radius: 20px;
  padding: 32px;
  transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
  opacity: 0;
  transform: translateY(20px);
}
.feature-card.visible {
  opacity: 1; transform: translateY(0);
}
.feature-card:hover {
  border-color: var(--purple-light);
  box-shadow: 0 16px 40px rgba(109,40,217,0.12);
  transform: translateY(-6px);
}
.feature-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin-bottom: 20px;
}
.feature-card h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 10px; }
.feature-card p  { font-size: 0.95rem; color: var(--gray-500); line-height: 1.7; }

/* ===== HOW IT WORKS ===== */
.how-it-works {
  padding: 90px 20px;
  background: linear-gradient(135deg, var(--purple-50) 0%, #eef2ff 100%);
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px;
  max-width: 900px;
  margin: 0 auto 40px;
}
.step-card {
  background: var(--white);
  border-radius: 20px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.step-card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }
.step-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: var(--white);
  margin: 0 auto 20px;
}
.step-card h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 12px; }
.step-card p  { font-size: 0.95rem; color: var(--gray-500); line-height: 1.7; }
.steps-cta { text-align: center; }
.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--purple-light), var(--purple-dark));
  color: var(--white);
  padding: 14px 36px;
  border-radius: 50px;
  font-size: 1rem; font-weight: 800;
  box-shadow: var(--shadow-purple);
  transition: transform var(--transition), box-shadow var(--transition);
}
.btn-primary:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 12px 36px rgba(109,40,217,0.35); }

/* ===== STUDY FORMATS ===== */
.study-formats { padding: 90px 20px; background: var(--white); }
.formats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}
.format-item { text-align: center; }
.format-thumb {
  border-radius: 16px;
  overflow: hidden;
  padding: 12px;
  margin-bottom: 10px;
  transition: transform var(--transition);
}
.format-thumb:hover { transform: translateY(-4px); }
.format-thumb img { width: 100%; height: auto; border-radius: 10px; }
.format-item h4 { font-size: 0.9rem; font-weight: 800; color: var(--gray-700); }

/* ===== SCREENSHOTS ===== */
.screenshots { padding: 90px 20px; background: var(--gray-50); }
.carousel-wrap { position: relative; max-width: 900px; margin: 0 auto; }
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 10; background: var(--white);
  border: none; border-radius: 50%;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md); cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.carousel-btn:hover { background: var(--purple-50); transform: translateY(-50%) scale(1.08); }
.carousel-btn svg { width: 20px; height: 20px; color: var(--purple); stroke: var(--purple); }
#prev-btn { left: -22px; }
#next-btn { right: -22px; }
.carousel-overflow { overflow: hidden; }
.carousel-track {
  display: flex;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.carousel-slide {
  flex-shrink: 0;
  width: 25%;
  padding: 0 12px;
  text-align: center;
}
.carousel-slide img { width: 100%; height: auto; border-radius: 12px; margin-bottom: 10px; }
.carousel-slide p { font-size: 0.85rem; font-weight: 700; color: var(--gray-600); }
.carousel-dots { display: flex; justify-content: center; gap: 8px; margin-top: 28px; }
.carousel-dot {
  height: 10px; width: 10px; border-radius: 50%; border: none;
  background: var(--purple-100); cursor: pointer;
  transition: background var(--transition), width var(--transition);
}
.carousel-dot.active { background: var(--purple); width: 28px; border-radius: 5px; }

/* ===== WHY QUIXLY (BENEFITS) ===== */
.benefits { padding: 90px 20px; background: var(--white); }
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}
.benefit-item { text-align: center; padding: 28px 20px; }
.benefit-icon {
  width: 68px; height: 68px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin: 0 auto 18px;
}
.benefit-item h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 10px; }
.benefit-item p  { font-size: 0.9rem; color: var(--gray-500); line-height: 1.65; }

/* ===== CTA DOWNLOAD ===== */
.cta-download {
  padding: 100px 20px;
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  position: relative; overflow: hidden;
  text-align: center;
}
.cta-blobs { position: absolute; inset: 0; pointer-events: none; }
.cta-blobs span {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.07); filter: blur(50px);
}
.cta-blobs span:nth-child(1) { width: 350px; height: 350px; top: -100px; left: -80px; }
.cta-blobs span:nth-child(2) { width: 450px; height: 450px; bottom: -120px; right: -80px; }
.cta-download h2 {
  position: relative; z-index: 1;
  font-size: clamp(2rem, 4vw, 3rem); font-weight: 900;
  color: var(--white); margin-bottom: 16px;
}
.cta-download p {
  position: relative; z-index: 1;
  font-size: 1.05rem; color: rgba(255,255,255,0.88);
  max-width: 560px; margin: 0 auto 44px;
  line-height: 1.7;
}
.cta-badges {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 16px;
}
.cta-badge-link { display: block; transition: transform var(--transition), filter var(--transition); }
.cta-badge-link:hover { transform: translateY(-4px) scale(1.04); }
.cta-badge-link img { height: 56px; width: auto; border-radius: 10px; }

/* ===== FAQ ===== */
.faq { padding: 90px 20px; background: var(--gray-50); }
.faq-list { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.faq-item {
  background: var(--white); border-radius: 16px;
  padding: 28px; box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.faq-item:hover { box-shadow: var(--shadow-md); }
.faq-item h3 { font-size: 1rem; font-weight: 800; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.faq-item h3 i { color: var(--purple); font-size: 1.1rem; flex-shrink: 0; }
.faq-item p  { font-size: 0.95rem; color: var(--gray-500); line-height: 1.7; padding-left: 30px; }
.faq-cta { text-align: center; margin-top: 40px; }

/* ===== FOOTER ===== */
footer {
  background: var(--gray-900); color: var(--white);
  padding: 72px 20px 36px;
}
.footer-inner {
  max-width: 900px; margin: 0 auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px; margin-bottom: 48px;
}
.footer-brand h3 { font-size: 1.4rem; font-weight: 900; color: #a78bfa; margin-bottom: 12px; }
.footer-brand p  { font-size: 0.9rem; color: var(--gray-400); line-height: 1.7; }
.footer-brand .brand-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.footer-brand .brand-row img { height: 28px; width: auto; border-radius: 7px; }
.footer-col h4 { font-size: 0.95rem; font-weight: 800; color: #a78bfa; margin-bottom: 16px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-col a  { font-size: 0.9rem; color: var(--gray-400); transition: color var(--transition); }
.footer-col a:hover { color: var(--white); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 28px;
  display: flex; flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.footer-bottom .copy { font-size: 0.85rem; color: var(--gray-400); }
.social-links { display: flex; gap: 20px; }
.social-links a { font-size: 1.3rem; color: var(--gray-400); transition: color var(--transition), transform var(--transition); }
.social-links a:hover { color: var(--white); transform: translateY(-2px); }
.footer-legal { display: flex; gap: 16px; }
.footer-legal a { font-size: 0.85rem; color: var(--gray-400); transition: color var(--transition); }
.footer-legal a:hover { color: var(--white); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .nav-dl-desktop { display: none; }

  /* Enable the dropdown (starts hidden via opacity/pointer-events until .open) */
  .mobile-menu { display: flex; }
  .nav { position: fixed; } /* ensure position:absolute on child works */

  .hero-inner {
    flex-direction: column;
    text-align: center;
    padding: 100px 20px 60px;
    gap: 40px;
  }
  .hero-app-row { justify-content: center; }
  .hero-desc { margin: 0 auto 28px; }
  .hero-sources { justify-content: center; }
  .hero-badges { justify-content: center; }
  .hero-slideshow-wrapper { width: 200px; }
  .hero-slideshow { width: 200px; height: 400px; }

  .carousel-slide { width: 33.33%; }
  #prev-btn { left: -8px; }
  #next-btn { right: -8px; }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}

@media (max-width: 640px) {
  .nav { padding: 10px 16px; }
  .hero-slideshow-wrapper { width: 170px; }
  .hero-slideshow { width: 170px; height: 340px; }
  .hero-badges { flex-wrap: wrap; justify-content: center; }
  .badge-link img { height: 38px; }
  .carousel-slide { width: 50%; }
  .formats-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .footer-legal { justify-content: center; }
}

/* ===== NAV DROPDOWN ===== */
.nav-has-dropdown { position: relative; }
.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: rgba(255,255,255,.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  padding: 8px;
  min-width: 210px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 99;
}
.nav-has-dropdown:hover .nav-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.nav-dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  font-size: .85rem; font-weight: 700; color: #374151;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-dd-item:hover { background: #f5f3ff; color: #6d28d9; }
.nav-dd-icon {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; flex-shrink: 0;
}
.nav-dd-sep { height: 1px; background: #f3f4f6; margin: 4px 8px; }

/* Mobile sub-links (Library formats in mobile menu) */
.mobile-sub-links { display: flex; flex-direction: column; padding-left: 12px; gap: 2px; margin-top: -4px; }
.mobile-sub-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 10px;
  font-size: .84rem; font-weight: 700; color: #4b5563;
  text-decoration: none; transition: background .15s;
}
.mobile-sub-link:hover { background: #f5f3ff; color: #6d28d9; }
.mobile-sub-link i { font-size: .7rem; width: 14px; text-align: center; }

/* ===== LIBRARY LISTING PAGE ===== */
.lib-wrap  { padding: 120px 20px 80px; background: #f9fafb; min-height: 100vh; }
.lib-inner { max-width: 900px; margin: 0 auto; }

.lib-layout { display: flex; gap: 32px; align-items: flex-start; }
.lib-sidebar { width: 220px; flex-shrink: 0; position: sticky; top: 100px; }
.lib-main { flex: 1; min-width: 0; }

@media (max-width: 850px) {
  .lib-layout { flex-direction: column; gap: 24px; }
  .lib-sidebar { width: 100%; position: static; }
}

.lib-hero {
  border-radius: 24px; padding: 40px 36px; margin-bottom: 32px; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.lib-hero h1 { font-size: clamp(1.5rem,3vw,2rem); font-weight: 900; margin-bottom: 6px; }
.lib-hero p  { font-size: .95rem; opacity: .88; max-width: 440px; line-height: 1.65; }
.lib-hero-stat { text-align: center; flex-shrink: 0; }
.lib-hero-stat strong { display: block; font-size: 2.2rem; font-weight: 900; line-height: 1; }
.lib-hero-stat span   { font-size: .75rem; opacity: .8; text-transform: uppercase; letter-spacing: .06em; }

.lib-format-nav {
  display: flex; flex-wrap: nowrap; overflow-x: auto;
  gap: 6px; margin-bottom: 28px; padding-bottom: 4px; scrollbar-width: none;
}
.lib-format-nav::-webkit-scrollbar { display: none; }
.lib-format-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 50px; white-space: nowrap;
  font-size: .875rem; font-weight: 700;
  border: 2px solid #e5e7eb; background: #fff; color: #374151;
  text-decoration: none; transition: all .2s; flex-shrink: 0;
}
.lib-format-tab i { font-size: .8rem; }
.lib-format-tab:hover { border-color: var(--tab-color,#6d28d9); color: var(--tab-color,#6d28d9); }
.lib-format-tab.active { color: #fff; border-color: var(--tab-color,#6d28d9); background: var(--tab-color,#6d28d9); }

.lib-format-hero {
  border-radius: 20px; padding: 28px 32px; margin-bottom: 28px;
  color: #fff; display: flex; align-items: center; gap: 20px;
}
.lib-fmt-icon-box {
  width: 52px; height: 52px; border-radius: 14px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.lib-format-hero h2 { font-size: 1.1rem; font-weight: 900; margin-bottom: 4px; }
.lib-format-hero p  { font-size: .875rem; opacity: .88; line-height: 1.5; }

.lib-filter-wrap { margin-bottom: 24px; }
.lib-filter-label { font-size: .75rem; font-weight: 800; color: #9ca3af; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.lib-subjects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 7px;
}
.lib-subject-btn {
  padding: 7px 12px; border-radius: 10px; font-size: .82rem; font-weight: 700;
  border: 2px solid #e5e7eb; background: #fff; color: #374151;
  text-decoration: none; transition: all .2s;
  display: flex; align-items: center; justify-content: space-between; gap: 5px;
}
.lib-subject-btn:hover  { border-color: #6d28d9; color: #6d28d9; background: #f5f3ff; }
.lib-subject-btn.active { background: #6d28d9; color: #fff; border-color: #6d28d9; }
.lib-count {
  background: rgba(0,0,0,.08); font-size: .7rem; font-weight: 800;
  padding: 1px 7px; border-radius: 20px; flex-shrink: 0;
}
.lib-subject-btn.active .lib-count { background: rgba(255,255,255,.25); }
.lib-toggle-btn {
  margin-top: 10px; padding: 7px 18px; border: 2px solid #e5e7eb; border-radius: 50px;
  font-size: .82rem; font-weight: 700; color: #374151;
  background: #fff; cursor: pointer; transition: all .2s; display: inline-block;
}
.lib-toggle-btn:hover { border-color: #6d28d9; color: #6d28d9; }

.lib-search-row { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.lib-search {
  flex: 1; min-width: 200px; padding: 10px 16px;
  border: 2px solid #e5e7eb; border-radius: 50px;
  font-family: inherit; font-size: .92rem; color: #111827;
  outline: none; transition: border-color .25s;
}
.lib-search:focus { border-color: #6d28d9; }
.lib-search::placeholder { color: #9ca3af; }
.lib-sort {
  padding: 10px 14px; border: 2px solid #e5e7eb; border-radius: 50px;
  font-family: inherit; font-size: .85rem; font-weight: 700; color: #374151;
  background: #fff; cursor: pointer; outline: none;
}

.lib-results-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; flex-wrap: wrap; gap: 8px;
}
.lib-results-bar span { font-size: .88rem; color: #9ca3af; font-weight: 700; }
.lib-active-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 50px; font-size: .78rem; font-weight: 700;
  background: #f5f3ff; color: #6d28d9; border: 1.5px solid #ddd6fe; text-decoration: none;
  transition: background .15s;
}
.lib-filter-chip:hover { background: #ede9fe; }
.lib-filter-chip .fa-times { font-size: .65rem; }

/* Filter pill row */
.lib-filter-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.lib-pill {
  display: inline-flex; align-items: center;
  padding: 6px 14px; border-radius: 50px; font-size: .8rem; font-weight: 700;
  border: 2px solid #e5e7eb; background: #fff; color: #6b7280;
  text-decoration: none; transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.lib-pill:hover          { border-color: #6d28d9; color: #6d28d9; }
.lib-pill.active         { border-color: #6d28d9; background: #6d28d9; color: #fff; }
.lib-pill-easy.active    { border-color: #10b981; background: #10b981; color: #fff; }
.lib-pill-easy:not(.active):hover { border-color: #10b981; color: #10b981; }
.lib-pill-medium.active  { border-color: #f59e0b; background: #f59e0b; color: #fff; }
.lib-pill-medium:not(.active):hover { border-color: #f59e0b; color: #f59e0b; }
.lib-pill-hard.active    { border-color: #ef4444; background: #ef4444; color: #fff; }
.lib-pill-hard:not(.active):hover { border-color: #ef4444; color: #ef4444; }

/* Search form + search button */
.lib-search-btn {
  padding: 10px 16px; border-radius: 50px; border: 2px solid #6d28d9;
  background: #6d28d9; color: #fff; cursor: pointer; font-size: .9rem;
  transition: background .15s;
}
.lib-search-btn:hover { background: #5b21b6; }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }

.quiz-card {
  background: #fff; border-radius: 18px; border: 2px solid transparent;
  box-shadow: 0 2px 10px rgba(0,0,0,.06); padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow .3s, border-color .3s, transform .3s;
  text-decoration: none; color: inherit;
}
.quiz-card:hover {
  box-shadow: 0 8px 30px rgba(109,40,217,.12); border-color: #c4b5fd; transform: translateY(-3px);
}
.card-top { display: flex; align-items: flex-start; gap: 11px; }
.card-emoji {
  font-size: 1.8rem; width: 48px; height: 48px; flex-shrink: 0;
  background: #f5f3ff; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.card-meta { flex: 1; min-width: 0; }
.card-title {
  font-size: .95rem; font-weight: 900; color: #111827;
  margin-bottom: 4px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-subject {
  font-size: .75rem; font-weight: 700; color: #6d28d9;
  background: #f5f3ff; padding: 2px 9px; border-radius: 20px; display: inline-block;
}
.card-summary {
  font-size: .84rem; color: #6b7280; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.card-tag  { font-size: .7rem; font-weight: 700; color: #4b5563; background: #f3f4f6; padding: 2px 9px; border-radius: 20px; }
.card-formats { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.fmt-icon {
  width: 26px; height: 26px; border-radius: 7px;
  background: #f5f3ff; display: flex; align-items: center; justify-content: center;
  font-size: .7rem; color: #6d28d9;
}
.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 10px; border-top: 1px solid #f3f4f6; flex-wrap: wrap; gap: 6px;
}
.card-stats { display: flex; align-items: center; gap: 10px; }
.card-stat  { font-size: .75rem; color: #9ca3af; font-weight: 700; display: flex; align-items: center; gap: 3px; }
.diff-badge { font-size: .7rem; font-weight: 800; padding: 2px 9px; border-radius: 20px; text-transform: capitalize; }
.diff-easy   { background: #d1fae5; color: #065f46; }
.diff-medium { background: #fef3c7; color: #92400e; }
.diff-hard   { background: #fee2e2; color: #991b1b; }
.card-cta {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 0; border-radius: 50px; font-size: .82rem; font-weight: 800;
  color: #fff; margin-top: 4px; transition: opacity .2s;
}
.quiz-card:hover .card-cta { opacity: .88; }
.lib-empty { text-align: center; padding: 70px 20px; grid-column: 1 / -1; }
.lib-empty i { font-size: 2.8rem; color: #e5e7eb; margin-bottom: 14px; display: block; }
.lib-empty h3 { font-size: 1.1rem; font-weight: 900; color: #374151; margin-bottom: 6px; }
.lib-empty p  { color: #9ca3af; font-size: .92rem; }

.lib-pagination { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.pg-btn {
  min-width: 38px; height: 38px; padding: 0 12px;
  border: 2px solid #e5e7eb; border-radius: 10px; background: #fff;
  font-family: inherit; font-size: .875rem; font-weight: 700; color: #374151;
  cursor: pointer; text-decoration: none; display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.pg-btn:hover    { border-color: #6d28d9; color: #6d28d9; }
.pg-btn.active   { background: #6d28d9; color: #fff; border-color: #6d28d9; cursor: default; }
.pg-btn.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.pg-ellipsis     { color: #9ca3af; font-weight: 700; padding: 0 4px; line-height: 38px; }

@media(max-width:640px) {
  .lib-hero { padding: 24px 20px; }
  .lib-hero-stat { display: none; }
  .lib-grid { grid-template-columns: 1fr; }
}

/* ===== STUDY MATERIAL PROFILE PAGE ===== */
.mat-wrap  { padding: 120px 20px 80px; background: #f9fafb; min-height: 100vh; }
.mat-inner { max-width: 900px; margin: 0 auto; }
.mat-back {
  display: inline-flex; align-items: center; gap: 7px;
  color: #6d28d9; font-weight: 700; font-size: .88rem;
  margin-bottom: 24px; text-decoration: none; transition: color .2s;
}
.mat-back:hover { color: #5b21b6; }
.mat-hero {
  background: linear-gradient(135deg,#7c3aed 0%,#5b21b6 100%);
  border-radius: 24px; padding: 36px; color: #fff; margin-bottom: 28px;
  display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap;
}
.mat-emoji-box {
  width: 72px; height: 72px; border-radius: 18px;
  background: rgba(255,255,255,.2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 2.4rem;
}
.mat-hero-body { flex: 1; min-width: 200px; }
.mat-hero-title { font-size: clamp(1.3rem,3vw,1.9rem); font-weight: 900; margin-bottom: 8px; line-height: 1.25; }
.mat-hero-subject {
  display: inline-block; background: rgba(255,255,255,.2);
  padding: 3px 14px; border-radius: 20px; font-size: .8rem; font-weight: 700; margin-bottom: 12px;
}
.mat-hero-summary { font-size: .9rem; opacity: .9; line-height: 1.65; margin-bottom: 14px; }
.mat-hero-tags    { display: flex; flex-wrap: wrap; gap: 6px; }
.mat-hero-tag     { background: rgba(255,255,255,.15); padding: 3px 11px; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.mat-hero-meta {
  display: flex; gap: 20px; flex-wrap: wrap; margin-top: 16px;
  padding-top: 16px; border-top: 1px solid rgba(255,255,255,.25);
  font-size: .82rem; font-weight: 700; opacity: .9;
}
.mat-hero-meta span { display: flex; align-items: center; gap: 6px; }
.mat-section-title { font-size: 1.1rem; font-weight: 900; color: #111827; margin-bottom: 16px; }
.mat-formats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px; margin-bottom: 36px;
}
.mat-format-card {
  background: #fff; border-radius: 18px; padding: 20px 22px; border: 2px solid #e5e7eb;
  display: flex; align-items: center; gap: 16px; text-decoration: none; color: inherit; transition: all .25s;
}
.mat-format-card:hover {
  border-color: var(--fmt-color,#6d28d9);
  box-shadow: 0 6px 24px rgba(109,40,217,.1); transform: translateY(-2px);
}
.mat-fmt-icon {
  width: 48px; height: 48px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.mat-fmt-body { flex: 1; }
.mat-fmt-label { font-size: .95rem; font-weight: 900; color: #111827; margin-bottom: 3px; }
.mat-fmt-desc  { font-size: .78rem; color: #6b7280; line-height: 1.45; }
.mat-fmt-arrow { font-size: 1rem; color: #d1d5db; flex-shrink: 0; transition: color .2s, transform .2s; }
.mat-format-card:hover .mat-fmt-arrow { color: var(--fmt-color,#6d28d9); transform: translateX(3px); }
.mat-preview-card {
  background: #fff; border-radius: 20px; padding: 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07); margin-bottom: 28px;
}
.mat-q-list { display: flex; flex-direction: column; }
.mat-q-item {
  padding: 14px 0; border-bottom: 1px solid #f3f4f6;
  display: flex; gap: 12px; align-items: flex-start;
}
.mat-q-item:last-child { border-bottom: none; padding-bottom: 0; }
.mat-q-num {
  min-width: 24px; height: 24px; border-radius: 7px;
  background: #f5f3ff; color: #6d28d9; font-size: .75rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px;
}
.mat-q-text { font-size: .88rem; color: #374151; line-height: 1.5; font-weight: 600; }
.mat-q-more { text-align: center; padding: 14px 0 0; font-size: .85rem; font-weight: 700; color: #9ca3af; }

/* About section */
.mat-about-card {
  background: #fff; border-radius: 20px; padding: 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07); margin-bottom: 28px;
}
.mat-about-text { font-size: .94rem; color: #4b5563; line-height: 1.75; margin: 12px 0 0; }

/* Full Q&A section */
.mat-qa-section {
  background: #fff; border-radius: 20px; padding: 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07); margin-bottom: 28px;
}
.mat-qa-intro { font-size: .9rem; color: #6b7280; line-height: 1.65; margin: 8px 0 24px; }
.mat-qa-item { padding: 20px 0; border-bottom: 1px solid #f3f4f6; }
.mat-qa-item:last-child { border-bottom: none; padding-bottom: 0; }
.mat-qa-q { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.mat-qa-num {
  min-width: 26px; height: 26px; border-radius: 8px;
  background: #f5f3ff; color: #6d28d9; font-size: .75rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mat-qa-qtext { font-size: .93rem; color: #111827; line-height: 1.55; font-weight: 700; }
.mat-qa-options {
  list-style: none; padding: 0; margin: 0 0 0 38px;
  display: flex; flex-direction: column; gap: 6px;
}
.mat-qa-option {
  display: flex; align-items: center; gap: 8px;
  font-size: .87rem; color: #4b5563; padding: 7px 12px;
  border-radius: 8px; border: 1px solid #f3f4f6; background: #fafafa;
}
.mat-qa-option.mat-qa-correct {
  background: #ecfdf5; border-color: #6ee7b7; color: #065f46; font-weight: 700;
}
.mat-qa-letter {
  min-width: 20px; height: 20px; border-radius: 5px;
  background: #e5e7eb; color: #374151; font-size: .72rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mat-qa-correct .mat-qa-letter { background: #10b981; color: #fff; }
.mat-qa-check { margin-left: auto; color: #10b981; font-size: .8rem; }
.mat-qa-explanation {
  margin: 10px 0 0 38px; font-size: .83rem; color: #6b7280;
  background: #fffbeb; border-radius: 8px; padding: 8px 12px;
  border-left: 3px solid #f59e0b; line-height: 1.55;
}
.mat-qa-explanation .fa-lightbulb { color: #f59e0b; margin-right: 5px; }
@media(max-width:600px) {
  .mat-hero { padding: 24px 20px; }
  .mat-emoji-box { width: 56px; height: 56px; font-size: 1.8rem; }
  .mat-qa-options { margin-left: 0; }
  .mat-qa-explanation { margin-left: 0; }
}

/* ===== STUDY FORMAT PAGE ===== */
.study-wrap { padding: 90px 20px 80px; background: #f9fafb; min-height: 100vh; }
.study-layout {
  max-width: 900px; margin: 0 auto;
  display: flex; gap: 20px; align-items: flex-start;
}
.study-main { flex: 1; min-width: 0; }

.study-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; flex-wrap: wrap; gap: 10px;
}
.study-back {
  display: inline-flex; align-items: center; gap: 7px;
  color: #6d28d9; font-weight: 700; font-size: .88rem;
  text-decoration: none; transition: color .2s;
}
.study-back:hover { color: #5b21b6; }
.study-format-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 16px; border-radius: 50px; font-size: .82rem; font-weight: 800; color: #fff;
}
.study-title-row { margin-bottom: 24px; }
.study-title-row h1 { font-size: clamp(1.2rem,2.5vw,1.6rem); font-weight: 900; color: #111827; margin-bottom: 4px; }
.study-title-row p  { font-size: .875rem; color: #6b7280; }

.study-progress-wrap { margin-bottom: 20px; }
.study-progress-bar  { height: 6px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.study-progress-fill { height: 100%; background: #6d28d9; border-radius: 99px; transition: width .4s; }
.study-progress-label { font-size: .8rem; font-weight: 700; color: #6b7280; display: flex; justify-content: space-between; }

.study-card { background: #fff; border-radius: 20px; padding: 28px; box-shadow: 0 2px 14px rgba(0,0,0,.07); margin-bottom: 16px; }

.q-number  { font-size: .78rem; color: #9ca3af; font-weight: 700; margin-bottom: 10px; }
.q-text    { font-size: 1.05rem; font-weight: 700; color: #111827; line-height: 1.55; margin-bottom: 18px; }
.q-options { display: flex; flex-direction: column; gap: 10px; }
.q-option  {
  padding: 13px 16px; background: #f9fafb; border: 2px solid #e5e7eb;
  border-radius: 12px; cursor: pointer; font-size: .9rem; font-weight: 600; color: #374151;
  transition: all .2s; display: flex; align-items: center; gap: 12px;
}
.q-option:hover   { background: #f5f3ff; border-color: #6d28d9; color: #6d28d9; }
.q-option.correct { background: #d1fae5 !important; border-color: #10b981 !important; color: #065f46 !important; cursor: default; }
.q-option.wrong   { background: #fee2e2 !important; border-color: #ef4444 !important; color: #991b1b !important; cursor: default; }
.q-option.disabled{ cursor: default; }
.q-opt-label {
  width: 26px; height: 26px; border-radius: 8px; border: 2px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800; flex-shrink: 0;
}
.q-explanation {
  margin-top: 14px; padding: 13px 15px; background: #f0fdf4;
  border-left: 4px solid #10b981; border-radius: 10px;
  font-size: .86rem; color: #374151; line-height: 1.55; display: none;
}
.q-explanation.show { display: block; }

.score-card { text-align: center; padding: 48px 28px; }
.score-ring {
  width: 110px; height: 110px; border-radius: 50%;
  background: conic-gradient(#6d28d9 var(--pct), #e5e7eb 0);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; position: relative;
}
.score-ring::before { content: ''; position: absolute; width: 82px; height: 82px; border-radius: 50%; background: #fff; }
.score-pct   { position: relative; z-index: 1; font-size: 1.4rem; font-weight: 900; color: #111827; }
.score-label { font-size: 1.1rem; font-weight: 900; color: #111827; margin-bottom: 6px; }
.score-sub   { font-size: .875rem; color: #6b7280; margin-bottom: 24px; }

.fc-scene { perspective: 1000px; margin-bottom: 20px; cursor: pointer; }
.fc-card  { position: relative; width: 100%; padding-bottom: 56%; transform-style: preserve-3d; transition: transform .6s; }
.fc-card.flipped { transform: rotateY(180deg); }
.fc-front, .fc-back {
  position: absolute; width: 100%; height: 100%;
  backface-visibility: hidden; border-radius: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px; box-shadow: 0 4px 20px rgba(0,0,0,.1); text-align: center;
}
.fc-front { background: linear-gradient(135deg,#7c3aed,#5b21b6); color: #fff; }
.fc-back  { background: #fff; transform: rotateY(180deg); border: 2px solid #e5e7eb; color: #111827; }
.fc-label { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; opacity: .7; margin-bottom: 12px; }
.fc-text  { font-size: clamp(.95rem,2vw,1.25rem); font-weight: 700; line-height: 1.5; }
.fc-expl  { margin-top: 10px; font-size: .82rem; color: #6b7280; line-height: 1.5; }
.fc-hint  { font-size: .78rem; opacity: .6; margin-top: 14px; }
.fc-nav   { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.tf-statement { font-size: 1rem; font-weight: 700; color: #111827; line-height: 1.6; margin-bottom: 22px; text-align: center; }
.tf-btns { display: flex; gap: 12px; }
.tf-btn  { flex: 1; padding: 16px; border: 2px solid #e5e7eb; border-radius: 14px; font-family: inherit; font-size: 1rem; font-weight: 800; cursor: pointer; background: #fff; transition: all .25s; }
.tf-btn.true-btn  { color: #10b981; }
.tf-btn.false-btn { color: #ef4444; }
.tf-btn:hover     { transform: translateY(-2px); }
.tf-btn.correct   { background: #d1fae5; border-color: #10b981; color: #065f46; }
.tf-btn.wrong     { background: #fee2e2; border-color: #ef4444; color: #991b1b; }
.tf-btn:disabled  { cursor: not-allowed; opacity: .7; transform: none; }

.match-timer { text-align: center; font-size: 1.4rem; font-weight: 900; color: #6d28d9; margin-bottom: 16px; }
.match-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-tile  {
  padding: 14px 12px; border-radius: 14px; border: 2px solid #e5e7eb;
  background: #fff; cursor: pointer; text-align: center;
  font-size: .82rem; font-weight: 700; color: #374151;
  min-height: 70px; display: flex; align-items: center; justify-content: center;
  transition: all .2s; line-height: 1.4;
}
.match-tile.question { border-color: #c4b5fd; background: #f5f3ff; color: #6d28d9; }
.match-tile.answer   { border-color: #bbf7d0; background: #f0fdf4; color: #065f46; }
.match-tile.selected { border-color: #6d28d9 !important; background: #6d28d9 !important; color: #fff !important; transform: scale(1.03); }
.match-tile.match-removing { animation: matchFadeOut .35s ease forwards; pointer-events: none; }
@keyframes matchFadeOut { to { opacity: 0; transform: scale(0.75); } }
.match-tile.shake    { animation: shake .4s; border-color: #ef4444 !important; background: #fee2e2 !important; color: #991b1b !important; }
.match-count-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.match-count-btn  { min-width: 72px; font-size: .95rem; font-weight: 800; }
@keyframes shake {
  0%,100%{ transform:translateX(0) }
  20%{ transform:translateX(-6px) }
  40%{ transform:translateX(6px) }
  60%{ transform:translateX(-4px) }
  80%{ transform:translateX(4px) }
}
.match-complete { text-align: center; padding: 40px 20px; }

.sg-controls { display: flex; gap: 10px; margin-bottom: 16px; }
.sg-item     { background: #fff; border-radius: 14px; margin-bottom: 10px; border: 1px solid #e5e7eb; overflow: hidden; }
.sg-topic    { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; cursor: pointer; gap: 12px; }
.sg-topic-text { font-size: .92rem; font-weight: 700; color: #111827; flex: 1; line-height: 1.4; }
.sg-icon { font-size: .9rem; color: #6b7280; transition: transform .3s; flex-shrink: 0; }
.sg-item.open .sg-icon { transform: rotate(90deg); }
.sg-body { display: none; padding: 0 20px 18px; border-top: 1px solid #f3f4f6; font-size: .86rem; color: #374151; line-height: 1.6; }
.sg-item.open .sg-body { display: block; }
.sg-answer { font-weight: 700; color: #6d28d9; margin-bottom: 6px; }
.sg-expl   { color: #6b7280; }

.btn-study {
  padding: 12px 24px; border: none; border-radius: 50px; cursor: pointer;
  font-family: inherit; font-size: .9rem; font-weight: 800;
  background: linear-gradient(135deg,#7c3aed,#5b21b6); color: #fff;
  box-shadow: 0 6px 20px rgba(109,40,217,.25); transition: transform .2s, box-shadow .2s;
  text-decoration: none; display: inline-block;
}
.btn-study:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(109,40,217,.35); }
.btn-outline {
  padding: 12px 24px; border: 2px solid #e5e7eb; border-radius: 50px; cursor: pointer;
  font-family: inherit; font-size: .9rem; font-weight: 800;
  background: #fff; color: #374151; transition: border-color .2s, color .2s;
}
.btn-outline:hover { border-color: #6d28d9; color: #6d28d9; }
.btn-sm { padding: 8px 18px; font-size: .8rem; }

/* Study sidebar — inside the 900px content box */
.study-sidebar { width: 200px; flex-shrink: 0; position: sticky; top: 100px; align-self: flex-start; }
.study-sidebar-card { background: #fff; border-radius: 18px; padding: 16px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.study-sidebar-title { font-size: .72rem; font-weight: 800; color: #9ca3af; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.study-fmt-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  font-size: .85rem; font-weight: 700; color: #374151;
  transition: background .15s; text-decoration: none;
}
.study-fmt-link:hover { background: #f5f3ff; color: #6d28d9; }
.study-fmt-link.active { pointer-events: none; }
.study-fmt-icon { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: .7rem; flex-shrink: 0; }

/* About paragraph on study page */
.study-about {
  background: #fff; border-radius: 16px; padding: 18px 22px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06); margin-bottom: 22px;
}
.study-about p { font-size: .92rem; color: #4b5563; line-height: 1.75; margin: 0; }

/* Explore more section */
.study-explore {
  max-width: 900px; margin: 32px auto 0; padding: 0 24px 56px;
}
.study-explore h2 {
  font-size: 1.2rem; font-weight: 900; color: #111827; margin: 0 0 6px;
}
.study-explore > p {
  font-size: .9rem; color: #6b7280; line-height: 1.6; margin: 0 0 20px;
}
.explore-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.explore-card {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06); text-decoration: none;
  border: 1.5px solid transparent; transition: border-color .18s, box-shadow .18s;
}
.explore-card:hover { border-color: #6d28d9; box-shadow: 0 4px 16px rgba(109,40,217,.1); }
.explore-emoji { font-size: 1.5rem; flex-shrink: 0; line-height: 1; }
.explore-body { min-width: 0; }
.explore-title {
  font-size: .84rem; font-weight: 700; color: #111827; line-height: 1.35;
  margin-bottom: 5px; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
}
.explore-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: .73rem; color: #6b7280; }
.explore-view-all {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 26px; border-radius: 50px;
  background: linear-gradient(135deg,#7c3aed,#5b21b6);
  color: #fff; font-size: .88rem; font-weight: 700;
  text-decoration: none; transition: opacity .18s;
}
.explore-view-all:hover { opacity: .85; }
@media(max-width:720px) { .explore-grid { grid-template-columns: 1fr 1fr; } }
@media(max-width:480px) { .explore-grid { grid-template-columns: 1fr; } }

/* Mobile format bar */
.study-fmt-bar { display: none; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 4px; margin-bottom: 20px; scrollbar-width: none; }
.study-fmt-bar::-webkit-scrollbar { display: none; }
.study-fmt-pill {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 50px; white-space: nowrap;
  font-size: .8rem; font-weight: 700; border: 2px solid #e5e7eb;
  background: #fff; color: #374151; text-decoration: none; flex-shrink: 0; transition: all .2s;
}
.study-fmt-pill.active { border-color: transparent; color: #fff; }
.study-fmt-pill:not(.active):hover { border-color: #6d28d9; color: #6d28d9; }

@media(max-width:900px) {
  .study-sidebar { display: none; }
  .study-fmt-bar { display: flex; }
}
@media(max-width:540px) {
  .match-grid { grid-template-columns: 1fr; }
  .tf-btns    { flex-direction: column; }
}

/* ===== LISTEN MODE ===== */
.listen-card { text-align: center; }
.listen-q-label { font-size: .78rem; color: #9ca3af; font-weight: 700; margin-bottom: 10px; }
.listen-q-text {
  font-size: 1.05rem; font-weight: 700; color: #111827; line-height: 1.55;
  margin-bottom: 20px; text-align: left;
}

/* Choices — collapse to zero height until revealed */
.listen-choices { display: flex; flex-direction: column; text-align: left; }
.listen-choice {
  display: flex; align-items: center; gap: 10px;
  border-radius: 12px; border: 2px solid transparent;
  background: transparent; font-size: .9rem; font-weight: 600; color: #374151;
  /* hidden: zero height, no padding, no margin so it takes no space */
  max-height: 0; overflow: hidden; padding: 0 14px; margin-bottom: 0;
  transition: max-height .35s ease, padding .3s ease, margin-bottom .3s ease,
              border-color .3s, background .3s;
  pointer-events: none;
}
.listen-choice.visible {
  max-height: 80px; padding: 11px 14px;
  border-color: #e5e7eb; background: #f9fafb;
  margin-bottom: 8px; /* gap between revealed choices */
}
.listen-choice.listen-choice-correct {
  background: #d1fae5; border-color: #10b981; color: #065f46; font-weight: 700;
}
.listen-choice-letter {
  min-width: 26px; height: 26px; border-radius: 7px;
  background: #e5e7eb; color: #374151; font-size: .72rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.listen-choice-correct .listen-choice-letter { background: #10b981; color: #fff; }
.listen-choice-text { flex: 1; line-height: 1.4; }

/* Controls */
.listen-controls {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-top: 14px; margin-bottom: 20px;
}
.listen-btn-play {
  width: 64px; height: 64px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg,#0ea5e9,#0284c7);
  color: #fff; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(14,165,233,.35);
  transition: transform .2s, box-shadow .2s;
}
.listen-btn-play:hover { transform: scale(1.08); box-shadow: 0 8px 28px rgba(14,165,233,.45); }
.listen-btn-prev, .listen-btn-next {
  width: 42px; height: 42px; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.listen-btn-prev:disabled, .listen-btn-next:disabled { opacity: .35; cursor: not-allowed; }

/* Footer: speed + auto-next */
.listen-footer {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 16px;
  padding-top: 16px; border-top: 1px solid #f3f4f6;
}
.listen-speed-row { display: flex; align-items: center; gap: 8px; }
.listen-speed-label { font-size: .75rem; font-weight: 800; color: #9ca3af; text-transform: uppercase; letter-spacing: .05em; }
.listen-speed-btns { display: flex; gap: 4px; }
.listen-speed-btn {
  padding: 5px 12px; border-radius: 50px; border: 2px solid #e5e7eb;
  background: #fff; color: #374151; font-size: .78rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: border-color .15s, background .15s, color .15s;
}
.listen-speed-btn:hover { border-color: #0ea5e9; color: #0ea5e9; }
.listen-speed-btn.active { background: #0ea5e9; border-color: #0ea5e9; color: #fff; }

/* Auto-next toggle */
.listen-auto-label {
  display: flex; align-items: center; gap: 10px;
  font-size: .875rem; font-weight: 700; color: #374151; cursor: pointer; user-select: none;
}
.listen-toggle-wrap {
  position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0;
}
.listen-toggle-wrap input { opacity: 0; width: 0; height: 0; position: absolute; }
.listen-toggle {
  position: absolute; inset: 0; background: #d1d5db; border-radius: 22px; transition: background .2s;
}
.listen-toggle::before {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .2s;
}
.listen-toggle-wrap input:checked + .listen-toggle { background: #0ea5e9; }
.listen-toggle-wrap input:checked + .listen-toggle::before { transform: translateX(18px); }

/* ===== SITEMAP ===== */
.smap-wrap  { padding-top:120px; padding-bottom:80px; min-height:70vh; }
.smap-inner { max-width:900px; margin:0 auto; padding:0 20px; }

/* Hero */
.smap-hero {
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:24px; flex-wrap:wrap;
  background:linear-gradient(135deg,#7c3aed 0%,#5b21b6 100%);
  border-radius:24px; padding:40px 40px 36px; color:#fff; margin-bottom:40px;
}
.smap-hero-content { flex: 1; min-width: 200px; }
.smap-hero-eyebrow { font-size:.8rem; font-weight:800; letter-spacing:.06em; text-transform:uppercase; opacity:.75; margin-bottom:10px; }
.smap-hero h1 { font-size:2rem; font-weight:900; margin-bottom:10px; }
.smap-hero p  { opacity:.85; font-size:.95rem; max-width:420px; line-height:1.6; }
.smap-hero-badges { display:flex; flex-direction:column; gap:10px; align-items:flex-end; flex-shrink:0; }
.smap-xml-btn {
  display:inline-flex; align-items:center; gap:7px;
  background:rgba(255,255,255,.15); border:2px solid rgba(255,255,255,.35);
  color:#fff; text-decoration:none; border-radius:50px;
  padding:9px 18px; font-size:.85rem; font-weight:700; white-space:nowrap;
  transition:background .2s;
}
.smap-xml-btn:hover { background:rgba(255,255,255,.28); }
.smap-count-badge {
  display:inline-flex; align-items:center; gap:6px;
  background:rgba(255,255,255,.12); border-radius:50px;
  padding:7px 16px; font-size:.82rem; font-weight:700; color:rgba(255,255,255,.8);
}

/* Grid layout */
.smap-grid {
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:20px;
}
.smap-section       { background:#fff; border:1.5px solid #e5e7eb; border-radius:20px; padding:24px; }
.smap-section-wide  { grid-column:span 2; }
.smap-section-full  { grid-column:1 / -1; }

/* Section header */
.smap-section-head { display:flex; align-items:center; gap:12px; margin-bottom:18px; }
.smap-section-head h2 { font-size:1rem; font-weight:800; color:var(--gray-800); display:flex; align-items:center; gap:8px; }
.smap-icon {
  width:36px; height:36px; border-radius:10px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; font-size:.9rem;
}
.smap-count {
  background:var(--gray-100); color:var(--gray-500); font-size:.7rem;
  font-weight:800; padding:2px 8px; border-radius:20px;
}

/* Link lists */
.smap-links { list-style:none; display:flex; flex-direction:column; gap:6px; }
.smap-links a {
  display:flex; align-items:center; gap:9px;
  color:var(--gray-700); text-decoration:none; font-size:.88rem; font-weight:700;
  padding:7px 10px; border-radius:10px; transition:background .15s, color .15s;
}
.smap-links a:hover { background:var(--purple-50); color:var(--purple); }
.smap-links a i { width:16px; text-align:center; font-size:.8rem; flex-shrink:0; }
.smap-links-sm a { font-size:.8rem; font-weight:600; color:var(--gray-500); }
.smap-section-foot { margin-top:14px; padding-top:14px; border-top:1px solid var(--gray-100); }
.smap-filter-label { font-size:.72rem; font-weight:800; text-transform:uppercase; letter-spacing:.06em; color:var(--gray-400); margin-bottom:6px; padding-left:4px; }

/* Subject chips */
.smap-subject-grid {
  display:flex; flex-wrap:wrap; gap:8px;
}
.smap-subject-chip {
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 14px; border-radius:50px; font-size:.8rem; font-weight:700;
  border:1.5px solid #e5e7eb; background:#fff; color:var(--gray-700);
  text-decoration:none; transition:border-color .15s, color .15s, background .15s;
}
.smap-subject-chip:hover { border-color:var(--purple); color:var(--purple); background:var(--purple-50); }
.smap-chip-count {
  background:var(--gray-100); color:var(--gray-500);
  font-size:.68rem; font-weight:800; padding:1px 7px; border-radius:20px;
}

/* Quiz list */
.smap-quiz-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(260px,1fr)); gap:8px;
}
.smap-quiz-item {
  display:grid; grid-template-columns:auto 1fr auto auto;
  align-items:center; gap:8px;
  padding:10px 14px; border-radius:12px; border:1.5px solid #e5e7eb;
  text-decoration:none; transition:border-color .15s, background .15s;
  background:#fff;
}
.smap-quiz-item:hover { border-color:var(--purple); background:var(--purple-50); }
.smap-quiz-emoji  { font-size:1.1rem; }
.smap-quiz-title  { font-size:.82rem; font-weight:700; color:var(--gray-800); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.smap-quiz-subject{ font-size:.72rem; color:var(--gray-400); font-weight:600; white-space:nowrap; }
.smap-quiz-diff   { font-size:.72rem; font-weight:700; white-space:nowrap; display:flex; align-items:center; gap:4px; }

/* XML notice */
.smap-xml-notice {
  text-align:center; margin-top:40px; font-size:.875rem;
  color:var(--gray-500); font-weight:600;
}
.smap-xml-notice a {
  color:var(--purple); font-weight:700; text-decoration:none; margin-left:4px;
}
.smap-xml-notice a:hover { text-decoration:underline; }

/* Responsive */
@media(max-width:780px) {
  .smap-grid { grid-template-columns:1fr 1fr; }
  .smap-section-wide { grid-column:span 2; }
  .smap-section-full { grid-column:1 / -1; }
  .smap-hero { padding:28px 24px; }
  .smap-hero h1 { font-size:1.5rem; }
  .smap-hero-badges { align-items:flex-start; }
}
@media(max-width:520px) {
  .smap-grid { grid-template-columns:1fr; }
  .smap-section-wide,
  .smap-section-full { grid-column:span 1; }
  .smap-quiz-grid { grid-template-columns:1fr; }
}
