/* Oppiyah — shared styles (oppiyah.com) */
:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-primary: #0ea5e9;
  --color-primary-hover: #0284c7;
  --color-secondary: #10b981;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --font-sans: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --app-sidebar-width: 232px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); background: var(--color-bg); color: var(--color-text); line-height: 1.5; }

/* Seasonal puzzles (hidden Easter eggs) */
body.sp-scroll-locked { overflow: hidden; }
.sp-modal-root {
  position: fixed;
  inset: 0;
  z-index: 9998;
}
.sp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}
.sp-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.sp-card {
  width: min(720px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.35);
}
.sp-card.sp-animate {
  animation: sp-pop-in 180ms ease-out both;
}
@keyframes sp-pop-in {
  from { transform: translateY(10px) scale(0.985); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .sp-card.sp-animate { animation: none; }
}
.sp-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(to bottom, rgba(255,255,255,0.98), rgba(255,255,255,0.92));
  backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}
.sp-title-wrap { display: flex; gap: 0.75rem; align-items: flex-start; }
.sp-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(14, 165, 233, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex: 0 0 auto;
}
.sp-title { font-weight: 800; letter-spacing: -0.01em; font-size: 1.15rem; line-height: 1.15; }
.sp-hook { color: var(--color-text-muted); font-size: 0.92rem; margin-top: 0.25rem; }
.sp-close {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  color: var(--color-text);
}
.sp-close:hover { background: var(--color-bg); }
.sp-board {
  padding: 1rem;
  display: grid;
  gap: 0.55rem;
}
.sp-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
}
.sp-left { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; }
.sp-eq { color: var(--color-text-muted); font-weight: 700; }
.sp-right { text-align: right; }
.sp-num, .sp-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: rgba(14, 165, 233, 0.06);
  font-weight: 800;
}
.sp-row-final .sp-q { background: rgba(16, 185, 129, 0.10); }
.sp-divider { height: 1px; background: var(--color-border); margin: 0.25rem 0; }
.sp-op { color: var(--color-text-muted); font-weight: 900; font-size: 1.05rem; }
.sp-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: linear-gradient(to bottom, #ffffff, #f8fafc);
  box-shadow: 0 1px 0 rgba(2, 6, 23, 0.06);
}
.sp-emoji { font-size: 1.25rem; line-height: 1; }
.sp-icon-changed {
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}
.sp-badge {
  position: absolute;
  right: -7px;
  top: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-text);
  color: #fff;
  font-size: 0.75rem;
  line-height: 20px;
  font-weight: 800;
  border: 2px solid #fff;
}
.sp-badge-bell { width: 12px; min-width: 12px; padding: 0; border-radius: 999px; background: #f59e0b; }
.sp-badge-missing { background: #ef4444; }
.sp-badge-half { background: #10b981; }
.sp-answers {
  padding: 0 1rem 0.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
@media (max-width: 520px) {
  .sp-answers { grid-template-columns: 1fr; }
}
.sp-choice {
  width: 100%;
  padding: 0.9rem 0.85rem;
  font-size: 1.05rem;
  font-weight: 800;
  border-radius: 14px;
}
.sp-choice.sp-choice-selected { border-color: rgba(14, 165, 233, 0.55); }
.sp-choice.sp-choice-correct {
  border-color: rgba(16, 185, 129, 0.7);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
.sp-choice.sp-choice-wrong {
  border-color: rgba(239, 68, 68, 0.75);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
}
.sp-feedback {
  padding: 0.25rem 1rem 1rem;
  min-height: 2.25rem;
}
.sp-feedback-title { font-weight: 900; }
.sp-feedback-body { margin-top: 0.35rem; color: var(--color-text-muted); }
.sp-feedback-actions { margin-top: 0.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sp-pop { animation: sp-feedback-pop 160ms ease-out; }
@keyframes sp-feedback-pop {
  from { transform: translateY(4px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .sp-pop { animation: none; }
}
.sp-shake { animation: sp-shake 220ms ease-in-out; }
@keyframes sp-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
@media (prefers-reduced-motion: reduce) {
  .sp-shake { animation: none; }
}
.sp-footer {
  padding: 0 1rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.sp-footer-hint { color: var(--color-text-muted); font-size: 0.85rem; }
.sp-toast {
  font-size: 0.85rem;
  color: var(--color-text);
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 140ms ease, transform 140ms ease;
}
.sp-toast.sp-toast-show { opacity: 1; transform: translateY(0); }

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -3rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: white;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0.75rem;
  outline: 2px solid var(--color-primary-hover);
  outline-offset: 2px;
}

/* Site footer (landing, library) */
.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 1.5rem 2rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}
.site-footer-brand { font-weight: 600; color: var(--color-primary); }
.site-footer a { color: var(--color-text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--color-primary); }

/* Layout */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.app-header .logo {
  font-size: 0;
  color: transparent;
  text-decoration: none;
  display: inline-block;
  width: 220px;
  height: 52px;
  background-image: url("/images/logo-oppiyah-full.png");
  background-image: image-set(
    url("/images/logo-oppiyah-full.webp") type("image/webp"),
    url("/images/logo-oppiyah-full.png") type("image/png")
  );
  background-repeat: no-repeat;
  background-position: left center;
  background-size: contain;
}
.app-header nav { display: flex; gap: 1rem; align-items: center; }
.app-header a { color: var(--color-text-muted); text-decoration: none; }
.app-header a:hover { color: var(--color-primary); }
.app-header .nav-lang { margin-left: auto; }

/* Slim top bar when using site shell (menu + language only) */
.app-header-shell {
  gap: 0.75rem;
}
.app-header-shell .app-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.shell-header-auth {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.shell-header-version {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
}
.shell-header-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
}
.shell-header-link:hover {
  color: var(--color-primary);
  background: rgba(14, 165, 233, 0.08);
}
.shell-header-link-cta {
  border: 1px solid var(--color-border);
}
.shell-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-left: -0.35rem;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--color-text);
  cursor: pointer;
}
.shell-menu-toggle:hover {
  background: var(--color-bg);
}
.shell-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 95;
  margin: 0;
  border: none;
  padding: 0;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}
@media (min-width: 1024px) {
  .shell-menu-toggle {
    display: none;
  }
  .app-header-shell .shell-header-logo {
    display: none;
  }
}

/* Layout with left sidebar (most site pages) */
.app-layout { display: block; }
.app-sidebar {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--app-sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 1.25rem 0;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.app-layout-with-sidebar .app-sidebar {
  display: flex;
}
.app-sidebar .logo {
  display: block;
  font-size: 0;
  color: transparent;
  text-decoration: none;
  width: calc(100% - 2.5rem);
  height: 72px;
  margin: 0 1.25rem 0.75rem;
  padding: 0;
  background-image: url("/images/logo-oppiyah-full.png");
  background-image: image-set(
    url("/images/logo-oppiyah-full.webp") type("image/webp"),
    url("/images/logo-oppiyah-full.png") type("image/png")
  );
  background-repeat: no-repeat;
  background-position: left center;
  background-size: contain;
  border-bottom: 1px solid var(--color-border);
}
.app-header-shell .shell-header-logo {
  width: 184px;
  height: 44px;
}
body.logo-variant-coding .app-header .logo,
body.logo-variant-coding .app-sidebar .logo {
  background-image: url("/images/logo-oppiyah-coding-full.png");
  background-image: image-set(
    url("/images/logo-oppiyah-coding-full.webp") type("image/webp"),
    url("/images/logo-oppiyah-coding-full.png") type("image/png")
  );
}

/* Seasonal shell logos (background swap; click opens seasonal puzzle in-season) */
body.seasonal-brand-christmas .app-header .logo,
body.seasonal-brand-christmas .app-sidebar .logo {
  background-image: url("/images/logo-oppiyah-seasonal-christmas.png");
}
body.seasonal-brand-easter .app-header .logo,
body.seasonal-brand-easter .app-sidebar .logo {
  background-image: url("/images/logo-oppiyah-seasonal-easter.png");
}
body.seasonal-brand-april-fools .app-header .logo,
body.seasonal-brand-april-fools .app-sidebar .logo {
  background-image: url("/images/logo-oppiyah-seasonal-april-fools.png");
}
.app-sidebar .sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0 0.625rem;
}
.app-sidebar .sidebar-nav-primary {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.app-sidebar .sidebar-nav-secondary {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}
.app-sidebar .sidebar-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 0.375rem 0.4375rem;
  border-radius: 7px;
  font-size: 0.875rem;
  line-height: 1.25;
}
.app-sidebar .sidebar-nav a:hover,
.app-sidebar .sidebar-nav a.active {
  color: var(--color-primary);
  background: rgba(14, 165, 233, 0.08);
}

/* Library outline inside sidebar (library.html) */
.sidebar-library-outline {
  margin: 0.35rem 0.125rem 0.2rem;
  padding: 0.2rem 0.25rem 0.35rem;
  border-top: 1px solid var(--color-border);
}
.sidebar-library-outline:empty {
  display: none;
}
.sidebar-library-outline details {
  margin-top: 0.15rem;
}
.sidebar-library-outline summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text);
  padding: 0.25rem 1rem 0.25rem 0.2rem;
  border-radius: 6px;
  position: relative;
  line-height: 1.2;
}
.sidebar-library-outline summary::after {
  content: '▸';
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 0.75rem;
}
.sidebar-library-outline details[open] > summary::after {
  content: '▾';
}
.sidebar-library-outline summary::-webkit-details-marker {
  display: none;
}
.sidebar-library-outline .outline-links {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.12rem 0 0.2rem 0.35rem;
}
.sidebar-library-outline .outline-links > a {
  font-size: 0.8125rem;
  padding: 0.22rem 0.35rem;
  border-radius: 6px;
  color: var(--color-text-muted);
  text-decoration: none;
  display: -webkit-box;
  line-height: 1.2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sidebar-library-outline .outline-links > a:hover {
  color: var(--color-primary);
  background: rgba(14, 165, 233, 0.08);
}
.sidebar-library-outline .outline-links > a.active {
  color: var(--color-primary);
  background: rgba(14, 165, 233, 0.08);
  font-weight: 600;
}
.sidebar-feature-panel {
  margin: 0.35rem 0.125rem 0.2rem;
  padding: 0.3rem 0.35rem;
  border-top: 1px solid var(--color-border);
}
.sidebar-feature-title {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
}
.sidebar-feature-link {
  display: block;
}
#shell-nav-guest {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
@media (max-width: 1023px) {
  /* Header above the drawer layer so hamburger, logo (easter egg), and lang controls receive taps. */
  .app-header-shell {
    position: relative;
    z-index: 110;
  }
  .shell-menu-toggle {
    touch-action: manipulation;
  }
  .app-header-shell .logo {
    touch-action: manipulation;
  }
  /*
   * Drawer sits below the top bar (full-height off-screen layers steal touches on iOS/WebKit
   * even with translateX, so use pointer-events + inset below header).
   */
  .app-layout-with-sidebar .app-sidebar {
    top: var(--shell-header-height, 3.75rem);
    bottom: 0;
    height: auto;
    transform: translateX(-100%);
    box-shadow: none;
    pointer-events: none;
  }
  .app-layout-with-sidebar.app-shell-drawer-open .app-sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 28px rgba(15, 23, 42, 0.12);
    pointer-events: auto;
    /* Above in-flow main so nav links receive taps (not only "visible" under paint order). */
    z-index: 105;
  }
  .app-layout-with-sidebar.app-shell-drawer-open .shell-backdrop {
    display: block;
  }
  .app-layout-with-sidebar .app-main {
    margin-left: 0 !important;
  }
  .app-layout-with-sidebar .app-header-shell {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
@media (min-width: 1024px) {
  .app-layout-with-sidebar .app-sidebar {
    top: 0;
    bottom: 0;
    height: auto;
    pointer-events: auto;
    transform: none;
  }
  .app-layout-with-sidebar .app-main {
    margin-left: var(--app-sidebar-width);
  }
  .app-layout-with-sidebar .app-header-shell {
    padding-left: calc(var(--app-sidebar-width) + 1rem);
  }
}
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  font-size: 0.9375rem;
}
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-bg); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8125rem; }

/* Landing page */
.landing {
  min-height: calc(100vh - 56px);
  background: linear-gradient(180deg, #f0f4f8 0%, #e8eef4 35%, #f8fafc 100%);
  padding-bottom: 4rem;
}
.hero {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  max-width: 600px;
  margin: 0 auto;
}
.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f766e;
  background: rgba(15, 118, 110, 0.1);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  margin: 0 0 1.25rem;
  border: 1px solid rgba(15, 118, 110, 0.25);
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.hero-tagline {
  font-size: 1.2rem;
  color: #475569;
  margin: 0 0 1rem;
  line-height: 1.45;
}
.hero-vision {
  font-size: 0.9375rem;
  color: #64748b;
  margin: 0;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}
.landing-pillars {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
  padding: 0 1.5rem 2rem;
  max-width: 560px;
  margin: 0 auto;
}
.landing-pillars .pillar {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #334155;
  background: #fff;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
}
.landing-demos {
  padding: 0 1.5rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}
.demos-heading {
  font-size: 1rem;
  font-weight: 600;
  color: #475569;
  text-align: center;
  margin: 0 0 1rem;
  letter-spacing: 0.02em;
}
.landing-demos .demo-ctas {
  margin: 0;
}
.landing-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 1.5rem;
}
.landing-actions .btn-hero {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  background: #0f766e;
  color: #fff;
}
.landing-actions .btn-hero:hover {
  background: #0d5d57;
}
.landing-actions .btn-secondary {
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
}

/* Card / form */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  max-width: 400px;
  margin: 2rem auto;
}
.card h2 { margin: 0 0 1rem; font-size: 1.25rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.25rem; color: var(--color-text-muted); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
}
.form-group input:focus { outline: none; border-color: var(--color-primary); }
.form-error { color: var(--color-error, #dc2626); font-size: 0.875rem; margin-bottom: 0.5rem; }
.form-success { font-size: 0.875rem; margin-bottom: 0.5rem; }
.card .btn { width: 100%; margin-top: 0.5rem; padding: 0.625rem; }
.card footer { margin-top: 1rem; text-align: center; font-size: 0.875rem; }
.card footer a { color: var(--color-primary); }

/* Library */
.page-title { padding: 1.5rem 1.5rem 0; font-size: 1.5rem; }
.filters {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  flex-wrap: wrap;
}
.filters .chip {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}
.filters .chip.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.library-section { margin-bottom: 2rem; }
.library-section-title { font-size: 1.125rem; margin: 0 0 1rem; padding: 0 1.5rem; color: var(--color-text); font-weight: 600; }
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 0 1.5rem 2rem;
}
.lesson-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  border: 1px solid var(--color-border);
}
.lesson-card h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.lesson-card .meta { font-size: 0.8125rem; color: var(--color-text-muted); }
.lesson-card .badge { display: inline-block; margin-top: 0.5rem; padding: 0.2rem 0.5rem; background: #e0f2fe; color: #0369a1; border-radius: 6px; font-size: 0.75rem; }

/* Featured cards (library + games) */
.featured-card {
  padding: 0;
  overflow: hidden;
}
.featured-card-link {
  display: block;
  padding: 1.05rem 1.1rem 1rem;
  color: inherit;
  text-decoration: none;
}
.featured-card-link:hover .featured-cta { text-decoration: underline; }
.featured-thumb {
  height: 108px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 0 0 0.75rem;
  border: 1px solid var(--color-border);
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
}
.featured-thumb-kids { background: linear-gradient(135deg, #fef3c7 0%, #d1fae5 100%); border-color: #fcd34d; }
.featured-thumb-math { background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%); border-color: #93c5fd; }
.featured-thumb-coding { background: linear-gradient(135deg, #e0f2fe 0%, #ede9fe 100%); border-color: #7dd3fc; }
.featured-thumb-geo { background: linear-gradient(135deg, #ffe4e6 0%, #fff7ed 100%); border-color: #fda4af; }
.featured-desc {
  margin: 0.35rem 0 0.75rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  line-height: 1.35;
}
.featured-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 0.65rem;
}
.featured-meta .pill {
  display: inline-flex;
  gap: 0.25rem;
  align-items: baseline;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  background: #ffffff;
}
.featured-cta {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary);
}

/* Creator Studio */
.studio-layout { display: flex; min-height: calc(100vh - 56px); }
.studio-sidebar {
  width: 260px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 1rem;
}
.studio-sidebar h3 { font-size: 0.875rem; margin: 0 0 0.75rem; color: var(--color-text-muted); }
.studio-main { flex: 1; padding: 1.5rem; overflow: auto; }
.ai-prompts-demo { margin-bottom: 1.5rem; padding: 1rem; background: var(--color-bg); border: 1px dashed var(--color-border); border-radius: var(--radius); }
.ai-prompts-title { font-size: 0.9375rem; margin: 0 0 0.25rem; color: var(--color-text); }
.ai-prompts-desc { font-size: 0.8125rem; color: var(--color-text-muted); margin: 0 0 0.75rem; }
.ai-prompts-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; }
.ai-prompt-card { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 0.875rem 1rem; background: var(--color-surface); border: 2px solid var(--color-border); border-radius: var(--radius); cursor: pointer; font-family: inherit; transition: border-color 0.15s, box-shadow 0.15s; }
.ai-prompt-card:hover { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2); }
.ai-prompt-card .ai-prompt-label { font-weight: 600; font-size: 0.9375rem; color: var(--color-text); margin-bottom: 0.25rem; }
.ai-prompt-card .ai-prompt-detail { font-size: 0.8125rem; color: var(--color-text-muted); line-height: 1.3; }
.ai-prompt-card.ai-prompt-curriculum { border-color: var(--color-primary); background: linear-gradient(135deg, #eff6ff 0%, var(--color-surface) 100%); }
.ai-prompt-card.ai-prompt-curriculum:hover { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25); }
.studio-toolbar { display: flex; gap: 0.5rem; margin-bottom: 1rem; align-items: center; flex-wrap: wrap; }
.studio-toolbar .credits { font-size: 0.875rem; color: var(--color-text-muted); margin-left: auto; }
.block-list { display: flex; flex-direction: column; gap: 1rem; }
.block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
}
.block .block-type { font-size: 0.75rem; color: var(--color-text-muted); margin-bottom: 0.5rem; }
.block .edit-hint { font-weight: 400; opacity: 0.8; }
.block .block-content { font-size: 0.9375rem; min-height: 2.5em; outline: none; }
.block .block-content[contenteditable="true"] { cursor: text; padding: 0.25rem 0; }
.block .block-content[contenteditable="true"]:focus { border-radius: 4px; box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.3); }
.block .block-content.block-question { font-weight: 500; margin-bottom: 0.5rem; }
.block-options { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.block-options li { padding: 0.35rem 0; border-bottom: 1px solid var(--color-border); outline: none; }
.block-options li:last-child { border-bottom: none; }
.block-options li[contenteditable="true"] { cursor: text; padding-left: 0.25rem; margin-left: -0.25rem; border-radius: 4px; }
.block-options li[contenteditable="true"]:focus { box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.3); }

/* Learner view */
.learner-view { max-width: 560px; margin: 0 auto; padding: 1.5rem; }
.learner-view h1 { font-size: 1.5rem; margin: 0 0 1rem; }
.learner-view .content { margin-bottom: 1.5rem; }
.learner-view .question { font-size: 1.125rem; font-weight: 500; margin-bottom: 1rem; }
.learner-view .options { display: flex; flex-direction: column; gap: 0.5rem; }
.learner-view .option {
  padding: 1rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
}
.learner-view .option:hover { border-color: var(--color-primary); }
.learner-view .option.selected { border-color: var(--color-primary); background: #e0f2fe; }
.learner-view .progress { font-size: 0.875rem; color: var(--color-text-muted); margin-bottom: 1rem; }

/* Book view (read as HTML book; exercises are separate via learner.html) */
.book-view { max-width: 720px; margin: 0 auto; padding: 1.5rem; }
.book-view .book-header { margin-bottom: 1.5rem; }
.book-view .book-header h1 { font-size: 1.75rem; margin: 0; }
.book-view .book-aapinen-banner-wrap { background: #000; border-radius: 16px; padding: 0.75rem; margin-bottom: 0.75rem; }
.book-view .book-aapinen-banner { display: block; width: 100%; height: auto; max-width: 560px; margin: 0 auto; }
.book-view .book-toc { margin-bottom: 2rem; padding: 1rem; background: var(--color-surface); border-radius: var(--radius); }
.book-view .book-toc h2 { font-size: 1rem; margin: 0 0 0.75rem; color: var(--color-text-muted); }
.book-view .book-toc ul { list-style: none; padding-left: 0; margin: 0; }
.book-view .book-toc-part { margin-top: 0.75rem; }
.book-view .book-toc-part-title { font-weight: 600; font-size: 0.9375rem; }
.book-view .book-toc li li { margin-left: 1rem; margin-top: 0.25rem; }
.book-view .book-toc a { color: var(--color-primary); text-decoration: none; }
.book-view .book-toc a:hover { text-decoration: underline; }
.book-view .book-chapter { margin-bottom: 2.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--color-border); }
.book-view .book-chapter:last-of-type { border-bottom: none; }
.book-view .book-chapter h2 { font-size: 1.25rem; margin: 0 0 1rem; }
.book-view .book-chapter-body { line-height: 1.6; }
.book-view .book-chapter-body p { margin: 0 0 0.75rem; }
.book-view .book-exercises-link { margin: 1rem 0 0; font-size: 0.9375rem; }
.book-view .book-exercises-link a { color: var(--color-primary); font-weight: 500; }
.book-view .book-error { padding: 1.5rem; color: var(--color-text-muted); }
.book-view .book-back-matter { margin-top: 2rem; }
.book-view .book-appendix { margin-bottom: 1.5rem; }
.book-view .book-appendix h3 { font-size: 1.0625rem; margin: 0 0 0.5rem; }
.book-view .aapinen-letter { font-size: 1.5rem; margin-bottom: 1rem; }
.book-view .aapinen-word-img { width: 80px; height: 80px; object-fit: contain; vertical-align: middle; margin-right: 0.5rem; }

/* Library: Aapinen exercise list — same cover as book.html + letter tile previews */
#lesson-list.library-aapinen-lessons .library-aapinen-hero { margin-bottom: 0.25rem; }
#lesson-list.library-aapinen-lessons .library-aapinen-banner-wrap {
  background: #000;
  border-radius: 16px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  max-width: 560px;
}
#lesson-list.library-aapinen-lessons .library-aapinen-banner {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}
#lesson-list.library-aapinen-lessons .library-aapinen-read {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
}
#lesson-list.library-aapinen-lessons .lesson-card-click {
  padding: 0 1.25rem 1.25rem;
  overflow: hidden;
}
#lesson-list.library-aapinen-lessons .library-aapinen-card-thumb {
  height: 104px;
  margin: 0 -1.25rem 0.65rem -1.25rem;
  background: linear-gradient(180deg, #f6f7fb 0%, #eef1f8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--color-border);
}
#lesson-list.library-aapinen-lessons .library-aapinen-card-thumb img {
  max-height: 92px;
  max-width: 92%;
  object-fit: contain;
}

/* Children’s Aapinen hub — large book tiles (not the adult library grid) */
body.kids-aapinen-hub {
  min-height: 100vh;
  background: linear-gradient(165deg, #1e0a3c 0%, #2d1b69 35%, #3b2f7a 55%, #1a2744 100%);
}
body.kids-aapinen-hub .kids-aapinen-main {
  position: relative;
  max-width: 920px;
  margin: 0 auto;
  padding: 0.75rem 1rem 2.5rem;
  overflow-x: hidden;
}
/* Immersive children’s hub: no sidebar drawer (back link + header only). */
body.kids-aapinen-hub .shell-menu-toggle {
  display: none !important;
}
body.kids-aapinen-hub .app-sidebar {
  display: none !important;
}
body.kids-aapinen-hub .app-main {
  margin-left: 0 !important;
}
body.kids-aapinen-hub .app-header-shell {
  padding-left: 1rem;
  padding-right: 1rem;
}
body.kids-aapinen-hub .app-header-shell {
  background: rgba(15, 23, 42, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
body.kids-aapinen-hub .app-header-shell .logo {
  color: #fef9c3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.kids-aapinen-back {
  display: inline-block;
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: rgba(254, 249, 195, 0.95);
  text-decoration: none;
  touch-action: manipulation;
}
.kids-aapinen-back:hover {
  text-decoration: underline;
  color: #fff;
}
.kids-aapinen-stars {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 80% 12%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 45% 8%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 92% 40%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 22% 55%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(2px 2px at 70% 70%, rgba(255, 255, 255, 0.25), transparent);
  opacity: 0.85;
}
.kids-aapinen-title {
  position: relative;
  text-align: center;
  margin: 0.25rem 0 0.35rem;
  font-size: clamp(2.5rem, 10vw, 3.75rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fef08a;
  text-shadow:
    0 2px 0 #ca8a04,
    0 4px 12px rgba(0, 0, 0, 0.45),
    0 0 40px rgba(250, 204, 21, 0.35);
  line-height: 1.05;
}
.kids-aapinen-sub {
  position: relative;
  text-align: center;
  margin: 0 0 1.5rem;
  font-size: clamp(0.8rem, 2.8vw, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: rgba(226, 232, 240, 0.88);
}
.kids-aapinen-picks {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.75rem, 3vw, 1.25rem);
  align-items: stretch;
}
@media (max-width: 520px) {
  .kids-aapinen-picks {
    grid-template-columns: 1fr;
  }
}
.kids-aapinen-book-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: clamp(280px, 52vh, 420px);
  border-radius: 20px;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  background: rgba(15, 23, 42, 0.55);
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  touch-action: manipulation;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.kids-aapinen-book-tile:hover {
  transform: translateY(-3px) scale(1.01);
  border-color: rgba(254, 240, 138, 0.55);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.5),
    0 0 0 2px rgba(250, 204, 21, 0.25);
}
.kids-aapinen-book-tile:active {
  transform: translateY(0) scale(0.99);
}
.kids-aapinen-spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  z-index: 2;
  border-radius: 18px 0 0 18px;
}
.kids-aapinen-book-tile--fi .kids-aapinen-spine {
  background: linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
  box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.2);
}
.kids-aapinen-book-tile--en .kids-aapinen-spine {
  background: linear-gradient(180deg, #dc2626 0%, #7f1d1d 100%);
  box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.2);
}
.kids-aapinen-cover {
  flex: 1;
  min-height: 0;
  margin-left: 10px;
  padding: 0.65rem 0.65rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
}
.kids-aapinen-cover img {
  width: 100%;
  height: 100%;
  max-height: 220px;
  object-fit: contain;
  object-position: center top;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}
.kids-aapinen-tile-footer {
  margin-top: auto;
  padding: 1rem 1rem 1.15rem 1.35rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.2) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.2rem;
}
.kids-aapinen-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #1e293b;
  background: #f8fafc;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.kids-aapinen-lang-name {
  font-size: clamp(1.5rem, 5vw, 1.85rem);
  font-weight: 800;
  line-height: 1.15;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.kids-aapinen-lang-desc {
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.92);
  max-width: 16rem;
  line-height: 1.3;
}
.kids-aapinen-parents {
  position: relative;
  margin: 1.75rem 0 0;
  text-align: center;
  font-size: 0.875rem;
  color: rgba(203, 213, 225, 0.9);
  line-height: 1.6;
}
.kids-aapinen-parents a {
  color: #fde047;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  touch-action: manipulation;
}
.kids-aapinen-parents a:hover {
  color: #fef08a;
}
.kids-aapinen-parents-sep {
  opacity: 0.7;
}

/* Horizontal letter rail (portable-style aapinen for kids) */
body.kids-aapinen-letters-hub {
  min-height: 100vh;
  background: #e8e6f5;
}
body.kids-aapinen-letters-hub .shell-menu-toggle {
  display: none !important;
}
body.kids-aapinen-letters-hub .app-sidebar {
  display: none !important;
}
body.kids-aapinen-letters-hub .app-main {
  margin-left: 0 !important;
}
body.kids-aapinen-letters-hub .app-header-shell {
  padding-left: 1rem;
  padding-right: 1rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.kids-aapinen-letters-main {
  max-width: 100%;
  padding: 0.5rem 0 2rem;
}
.kids-aapinen-letters-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  padding: 0.35rem 1rem 0.75rem;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  margin-bottom: 0.75rem;
}
.kids-aapinen-letters-back {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  line-height: 1;
  touch-action: manipulation;
}
.kids-aapinen-letters-back:hover {
  text-decoration: underline;
}
.kids-aapinen-letters-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2rem;
  padding: 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #1e293b;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}
.kids-aapinen-letters-title {
  flex: 1 1 auto;
  margin: 0;
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  font-weight: 800;
  color: #1e1b4b;
}
.kids-aapinen-letters-loading {
  padding: 1rem 1.5rem;
  color: var(--color-text-muted);
}
.kids-aapinen-letter-scroller {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 1rem 1.25rem;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.kids-aapinen-letter-rail {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  width: max-content;
  padding-bottom: 0.25rem;
}
.kids-aapinen-letter-card {
  flex: 0 0 auto;
  width: min(42vw, 168px);
  min-width: 132px;
  max-width: 180px;
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  color: #1e293b;
  box-shadow: 0 8px 28px rgba(30, 27, 75, 0.18);
  scroll-snap-align: start;
  touch-action: manipulation;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.kids-aapinen-letter-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(30, 27, 75, 0.22);
}
.kids-aapinen-letter-card:active {
  transform: translateY(-1px) scale(0.98);
}
.kids-aapinen-letter-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--card-top, #fef3c7);
  padding: 0.65rem 0.5rem 0;
  min-height: 200px;
}
.kids-aapinen-letter-big {
  font-size: clamp(2rem, 8vw, 2.75rem);
  font-weight: 900;
  line-height: 1;
  color: #422006;
}
.kids-aapinen-letter-word {
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
  margin-top: 0.2rem;
  line-height: 1.2;
  color: #451a03;
  max-width: 100%;
  padding: 0 0.25rem;
}
.kids-aapinen-letter-img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 88px;
  padding: 0.35rem 0 0.5rem;
}
.kids-aapinen-letter-img-wrap img {
  max-width: 100%;
  max-height: 96px;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}
.kids-aapinen-letter-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.5rem 0.25rem;
  font-size: 1.35rem;
  font-weight: 900;
  background: var(--card-footer-bg, #dc2626);
  color: var(--card-footer-text, #fff);
}
.kids-aapinen-letters-adult {
  text-align: center;
  padding: 0 1.25rem;
  font-size: 0.875rem;
}
.kids-aapinen-letters-adult a {
  color: #4c1d95;
  font-weight: 600;
}

/* Library: “For kids” zone — big entry, not adult cards */
.library-kids-zone {
  margin-bottom: 0.5rem;
}
.library-kids-zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1rem;
  padding: 0 1.5rem 1rem;
}
.library-kids-zone-tile {
  display: flex;
  flex-direction: column;
  min-height: 168px;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  border: 2px solid var(--color-border);
  background: linear-gradient(145deg, #faf5ff 0%, #eef2ff 45%, #fff 100%);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
  touch-action: manipulation;
}
.library-kids-zone-tile:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
}
.library-kids-zone-tile--aapinen {
  background: linear-gradient(145deg, #1e1b4b 0%, #312e81 40%, #4c1d95 100%);
  color: #fefce8;
  border-color: rgba(250, 204, 21, 0.35);
}
.library-kids-zone-tile--aapinen .library-kids-zone-tile-title {
  color: #fef08a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.library-kids-zone-tile--aapinen .library-kids-zone-tile-sub {
  color: rgba(254, 249, 195, 0.88);
}
.library-kids-zone-tile--demo {
  background: linear-gradient(145deg, #fffbeb 0%, #fef3c7 50%, #fff 100%);
}
.library-kids-zone-tile-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
  line-height: 1.2;
}
.library-kids-zone-tile-sub {
  font-size: 0.9rem;
  margin: 0;
  opacity: 0.92;
  line-height: 1.35;
}
.library-kids-zone-tile-cta {
  margin-top: auto;
  padding-top: 0.75rem;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--color-primary);
}
.library-kids-zone-tile--aapinen .library-kids-zone-tile-cta {
  color: #fde047;
}

.path-card, .lesson-card-click { cursor: pointer; }
.path-card:hover, .lesson-card-click:hover { border-color: var(--color-primary); }
.path-card-actions { margin: 0.5rem 0 0; font-size: 0.9375rem; display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.path-card-actions .path-card-book-link { color: var(--color-primary); font-weight: 500; }
.path-card-actions .path-card-exercises { color: var(--color-primary); cursor: pointer; text-decoration: none; }
.path-card-actions .path-card-exercises:hover { text-decoration: underline; }
.path-card-has-book .path-card-exercises { margin-left: 0; }
.hint-block .hint-content { margin-top: 0.5rem; padding: 0.75rem; background: var(--color-bg); border-radius: 8px; font-size: 0.9375rem; }
.reflection-block textarea { width: 100%; padding: 0.5rem; border: 1px solid var(--color-border); border-radius: 8px; font-family: inherit; margin-top: 0.5rem; }

/* Fun demo (pre-readers, Finnish, sound) — hides adult UI for child-only experience */
body.fun-demo-active .app-header-shell,
body.fun-demo-active .app-sidebar,
body.fun-demo-active .shell-backdrop,
body.fun-demo-active .skip-link { display: none !important; }
body.fun-demo-active .app-layout-with-sidebar { display: block; }
body.fun-demo-active .app-main { margin-left: 0; padding: 1rem; max-width: 600px; margin-inline: auto; }
body.fun-demo-active .fun-demo-home-btn {
  display: inline-block; margin: 0.5rem 0 1rem; padding: 0.5rem 1rem; font-size: 1.1rem;
  background: #fef3c7; border: 2px solid #fcd34d; border-radius: 12px; text-decoration: none;
  color: var(--color-text); font-weight: 600;
}
body.fun-demo-active .fun-demo-home-btn:hover { background: #fde68a; }
.fun-demo .emoji-big { font-size: 4rem; text-align: center; margin: 0.5rem 0; line-height: 1.2; }
.fun-demo .instruction { text-align: center; font-size: 1.125rem; color: var(--color-text-muted); }
.fun-demo .option, .fun-demo .multi-opt {
  min-height: 72px; font-size: 1.5rem; display: flex; align-items: center; justify-content: center;
  padding: 1rem 1.25rem; border-radius: 16px; border-width: 3px;
}
.fun-demo .option:hover, .fun-demo .multi-opt:hover { transform: scale(1.02); }
.fun-demo .option.selected, .fun-demo .multi-opt.selected { border-color: var(--color-primary); background: #e0f2fe; box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3); }
.fun-demo .question { font-size: 1.35rem; margin-bottom: 1rem; }
.fun-demo .check-btn { font-size: 1.25rem; padding: 0.75rem 1.5rem; border-radius: 16px; }
.fun-demo .btn-speaker { margin-bottom: 0.75rem; font-size: 1rem; }
.btn-speaker { background: #fef3c7; color: #92400e; border: none; }
.btn-speaker:hover { background: #fde68a; }
.demo-ctas { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: 1rem 1.5rem; }
.demo-cta { display: block; text-align: center; padding: 1.25rem 1.5rem; background: linear-gradient(135deg, #fef3c7 0%, #d1fae5 100%); border-radius: var(--radius); text-decoration: none; color: var(--color-text); font-weight: 600; font-size: 1.1rem; border: 2px solid #fcd34d; }
.demo-cta:hover { border-color: var(--color-primary); background: linear-gradient(135deg, #fde68a 0%, #a7f3d0 100%); }
.demo-cta .sub { display: block; font-weight: 400; font-size: 0.875rem; color: var(--color-text-muted); margin-top: 0.25rem; }
.demo-cta-school { background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%); border-color: #93c5fd; }
.demo-cta-school:hover { background: linear-gradient(135deg, #bfdbfe 0%, #c7d2fe 100%); }
.demo-cta-teacher { background: linear-gradient(135deg, #fce7f3 0%, #ede9fe 100%); border-color: #f9a8d4; }
.demo-cta-teacher:hover { background: linear-gradient(135deg, #fbcfe8 0%, #ddd6fe 100%); }
.demo-cta-kids-aapinen {
  background: linear-gradient(135deg, #312e81 0%, #5b21b6 50%, #4c1d95 100%);
  border-color: rgba(250, 204, 21, 0.55);
  color: #fefce8;
}
.demo-cta-kids-aapinen .sub { color: rgba(254, 249, 195, 0.9); }
.demo-cta-kids-aapinen:hover {
  border-color: #fde047;
  background: linear-gradient(135deg, #3730a3 0%, #6d28d9 50%, #5b21b6 100%);
  color: #fff;
}

/* Dashboard */
.dashboard-layout { display: flex; min-height: calc(100vh - 56px); }
.dashboard-sidebar { width: 220px; background: var(--color-surface); border-right: 1px solid var(--color-border); padding: 1rem; }
.dashboard-sidebar a { display: block; padding: 0.5rem 0; color: var(--color-text-muted); text-decoration: none; }
.dashboard-sidebar a:hover, .dashboard-sidebar a.active { color: var(--color-primary); }
.dashboard-main { flex: 1; padding: 1.5rem; }
.dashboard-main h2 { margin: 0 0 1rem; font-size: 1.25rem; }
.progress-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.progress-table th, .progress-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); }
.progress-table th { background: var(--color-bg); font-size: 0.875rem; color: var(--color-text-muted); }
.progress-table tr:last-child td { border-bottom: none; }
.progress-table .status { font-size: 0.875rem; }
.progress-table .score { font-weight: 500; }

.dashboard-skill-panel {
  margin: 1rem 0 1.25rem;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 65%);
}
.dashboard-skill-panel .meta {
  margin: 0.2rem 0 0.85rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}
.dashboard-joker-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 0.9rem;
}
.dashboard-joker-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid #f59e0b;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.78rem;
  font-weight: 600;
}
.dashboard-joker-badge.locked {
  border-color: var(--color-border);
  background: #f8fafc;
  color: var(--color-text-muted);
}
.skill-chart-wrap {
  max-width: 360px;
}
.skill-chart-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}
.skill-ring {
  fill: none;
  stroke: #f3e8d8;
  stroke-width: 1;
}
.skill-axis {
  stroke: #e7d7c5;
  stroke-width: 1;
}
.skill-area {
  fill: url(#skill-grad);
  fill-opacity: 0.28;
  stroke: #b45309;
  stroke-width: 2;
}
.skill-dot {
  fill: #7c2d12;
}
.skill-label {
  font-size: 9px;
  fill: #475569;
  text-anchor: middle;
  dominant-baseline: middle;
}
.skill-legend {
  margin-top: 0.35rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 0.8rem;
}
.skill-legend-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}
.skill-legend-item strong {
  color: var(--color-text);
}

/* Home: progress and badges */
.home-progress {
  text-align: center;
  margin: 2rem 0 2.5rem;
  padding: 1.5rem 1rem;
  background: linear-gradient(145deg, #f0fdfa 0%, #ecfeff 50%, #f0f9ff 100%);
  border-radius: var(--radius);
  border: 1px solid rgba(14, 165, 233, 0.2);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.08);
}
.home-progress-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 0.5rem;
}
.progress-summary {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}
.progress-summary .progress-count {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-primary);
}
.progress-bar-wrap {
  max-width: 280px;
  height: 8px;
  margin: 0 auto 0.5rem;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-next {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin: 0 0 1rem;
}
.badges-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}
.badge-card {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  background: var(--color-surface);
  border-radius: 999px;
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  font-size: 0.8125rem;
  color: var(--color-text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.badge-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.4);
}
.badge-icon {
  font-size: 1rem;
  line-height: 1;
}
.badge-label {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge-card.badge-milestone {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
  font-weight: 600;
  color: #92400e;
}
.badge-card.badge-milestone:hover {
  border-color: #d97706;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

/* Games hub */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.games-grid-featured .game-card {
  border-width: 2px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.game-card {
  display: block;
  padding: 1.25rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.game-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
  transform: translateY(-2px);
}
.game-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.game-name { margin: 0 0 0.35rem; font-size: 1.1rem; color: var(--color-text); }
.game-topic { margin: 0; font-size: 0.875rem; color: var(--color-primary); }
.game-grades { margin: 0.25rem 0 0; font-size: 0.8125rem; color: var(--color-text-muted); }
.game-play { font-size: 0.875rem; font-weight: 500; color: var(--color-primary); }

/* Language switcher (FI / EN), default Finnish */
#lang-switcher {
  display: inline-flex;
  gap: 0;
  align-items: center;
  margin-left: 0.5rem;
  min-width: 4rem;
}
#lang-switcher:empty::before {
  content: 'FI | EN';
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  padding: 0.25rem 0.5rem;
}
#lang-switcher .lang-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 4px;
  margin: 0 -1px;
}
#lang-switcher .lang-btn:first-child { border-radius: 4px 0 0 4px; }
#lang-switcher .lang-btn:last-child { border-radius: 0 4px 4px 0; }
#lang-switcher .lang-btn:hover { color: var(--color-primary); border-color: var(--color-primary); }
#lang-switcher .lang-btn.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }
