/* Shared visual language for the adventure and worksheet library. */
:root {
  --text-main: #243e38;
  --text-muted: #62756e;
  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 30px;
  --shadow-card: 0 12px 36px rgba(34, 71, 54, .055);
}
@media screen {
  body {
    background: radial-gradient(ellipse at 95% 10%, #e5f2e8 0, transparent 38%),
                radial-gradient(ellipse at 0% 70%, #fff0d5 0, transparent 35%), #f8f9f4;
    line-height: 1.5;
  }
  .adventure-nav, .topbar {
    background: rgba(255,255,252,.96);
    border-bottom: 1px solid #e2e9df;
    box-shadow: 0 4px 24px #233e3510;
    padding: 16px max(24px, calc((100vw - 1232px) / 2));
    gap: 20px;
  }
  .brand-title-wrap h1, .brand { letter-spacing: -.4px; }
  .mascot-avatar-top, .brand-icon {
    background: #fff0c9; border: 1px solid #efdfb5;
    box-shadow: 0 4px 0 #f0e4c9; border-radius: 17px;
  }
  .stat-pill { border-width: 1px; box-shadow: none; padding: 8px 13px; border-radius: 14px; }
  .nav-actions { gap: 10px; }
  .btn-3d, .btn { transition: transform .18s ease, box-shadow .18s ease, background .18s ease; min-height: 44px; }
  .btn-3d.soft, .btn.soft { background: #f0f4ee; box-shadow: 0 3px 0 #dce4d9; color: #3e584d; }
  .btn-3d.gold, .btn.gold { color: #493206; background: #ffd374; box-shadow: 0 5px 0 #dba843; }
  .btn-3d.gold:hover { box-shadow: 0 7px 0 #dba843; }
  .btn-3d.gold:active { box-shadow: 0 2px 0 #dba843; }
  :is(button, a, summary, input, [tabindex]):focus-visible { outline: 3px solid #208d87; outline-offset: 5px; }
  .view-container { padding-top: 34px; padding-bottom: 48px; }
  .card, .onboarding-card, .intro { border: 1px solid #dde7dc; box-shadow: var(--shadow-card); }
  .onboarding-card { max-width: 830px; padding: 40px 44px; margin: 8px auto 30px; position: relative; }
  .welcome-emblem {
    width: 84px; height: 84px; display: grid; place-items: center;
    margin: 0 auto 20px; font-size: 2.8rem; background: #fff1cd;
    border: 1px solid #f1dfad; border-radius: 28px;
    box-shadow: 0 6px 0 #f5e9c9; transform: rotate(-6deg);
  }
  .welcome-eyebrow { font-size: .83rem; font-weight: 800; color: var(--theme-primary); margin-bottom: 10px; }
  .onboarding-title { font-size: clamp(1.6rem, 3vw, 2.15rem); letter-spacing: -.6px; line-height: 1.5; }
  .onboarding-sub { font-weight: 500; line-height: 1.8; }
  .country-group { border: 1px solid #dde7dc; border-radius: 20px; margin: 18px 0; overflow: hidden; }
  .country-group > summary { padding: 18px 20px; font-size: 1.08rem; background: #f8faf5; }
  .country-group > summary:hover { background: #f0f5ec; }
  .country-group[open] > summary { border-bottom: 1px solid #e2e9dd; }
  .country-count { background: #e9f0e4; padding: 4px 11px; font-size: .75rem; }
  .curriculum-card { border: 1px solid #e0e8dd; box-shadow: 0 3px 0 #e7ece2; text-align: start; padding: 20px; border-radius: 17px; }
  .curriculum-card:hover { border-color: var(--theme-primary); background: #f8fbf5; box-shadow: 0 7px 18px #254e4010; }
  .curriculum-card.selected { border: 2px solid var(--theme-primary); padding: 19px; }
  .curriculum-flag { width: 48px; height: 48px; display: grid; place-items: center; background: #f1f5eb; border-radius: 14px; font-size: 1.7rem; margin-bottom: 12px; }
  .curriculum-title { line-height: 1.6; }
  .curriculum-desc { font-weight: 500; line-height: 1.7; }
  .term-btn { border-width: 1px; padding: 20px 28px; }
  .hero-next-mission { background: linear-gradient(120deg, #fffaf0, #fff 62%); padding: 36px; }
  .hero-next-mission::before { width: 5px; }
  .hero-title { color: var(--theme-dark); line-height: 1.4; letter-spacing: -.5px; }
  .hero-station-tag { border-radius: 10px; }
  .hero-xp-tag { background: #fff1d4; padding: 5px 10px; border-radius: 10px; }
  .hero-desc { max-width: 580px; }
  .progress-bar-wrap { height: 12px; border: 0; background: #e8eee3; }
  .progress-bar-fill { border-radius: inherit; background: linear-gradient(90deg, var(--theme-primary), #51bc83); }
  .world-map-header { border-bottom: 1px solid #e8eee3; padding-bottom: 20px; }
  .map-chapter-header { padding: 14px 18px; border-radius: 12px; }
  .map-path-flow { gap: 18px; }
  .map-station-node { border-width: 1px; padding: 18px; border-radius: 18px; box-shadow: 0 3px 0 #e2e9de; }
  .map-station-node.current { border-width: 2px; animation: none; background: var(--theme-light); }
  .station-node-icon { border: 1px solid #e1e9dc; border-radius: 15px; }
  .mascot-companion-card { background: linear-gradient(#fff9e9, #fff 75%); }
  .mascot-big-avatar { width: 100px; height: 100px; margin: 0 auto 16px; border-radius: 50%; background: #fff0cf; display: grid; place-items: center; }
  .mascot-speech-bubble { border-width: 1px; font-weight: 700; margin-top: 16px; }
  .badge-tile { border-width: 1px; padding: 14px 8px; border-radius: 16px; }
  .game-board-canvas { background: #fffcf3; border: 2px dashed #e8d49f; padding: 32px; }
  .game-choice-pill { border-radius: 18px; }
  .metric-box { border-width: 1px; background: #f7faf3; }
  .skills-breakdown-table th { background: #f2f6ec; }
  .skills-breakdown-table tbody tr:nth-child(even) { background: #fafcf7; }
  .page { padding-top: 32px; padding-bottom: 48px; }
  .intro { padding: 30px; border-radius: 24px; background: linear-gradient(120deg, #fff8e6, #fff 70%); }
  .intro h2 { font-size: 1.65rem; line-height: 1.5; }
  .chapter-box { border-width: 1px; border-radius: 22px; box-shadow: var(--shadow-card); margin-bottom: 20px; }
  .chapter-title { padding: 20px; }
  .lesson-grid { gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
  .lesson-card { border-width: 1px; padding: 22px; box-shadow: 0 4px 0 #e7ece1; gap: 13px; }
  .lesson-tag { border-radius: 8px; }
  .sheet { box-shadow: var(--shadow-card); border-width: 1px; }
  .sheet-chip { width: 40px; height: 40px; border-width: 1px; }
  .toggle { border-width: 1px; border-radius: 14px; }
  .toggle button { min-height: 36px; border-radius: 10px; }
  @media (max-width: 640px) {
    .adventure-nav, .topbar { padding: 14px 16px; gap: 16px; }
    .stats-hub { gap: 7px; flex-wrap: wrap; }
    .stat-pill { padding: 6px 10px; font-size: .85rem; }
    .nav-actions { width: 100%; gap: 8px; }
    .nav-actions .btn-3d { flex: 1 1 auto; font-size: .8rem; padding: 9px 10px; }
    .view-container { padding: 18px 12px 32px; }
    .onboarding-card { padding: 28px 18px; border-radius: 24px; }
    .welcome-emblem { width: 68px; height: 68px; font-size: 2.2rem; border-radius: 22px; }
    .country-group > summary { padding: 16px 12px; gap: 8px; font-size: .95rem; }
    .country-count { font-size: .68rem; padding: 3px 7px; }
    .country-flag { font-size: 1.6rem; }
    .card, .hero-next-mission { padding: 22px 18px; border-radius: 24px; }
    .station-info-group { gap: 10px; min-width: 0; }
    .station-name-text { font-size: 1rem; }
    .station-status { font-size: .8rem; }
    .map-path-flow { padding: 0; }
    .map-station-node { padding: 14px 10px; }
    .game-board-canvas { padding: 20px 12px; }
    .intro { padding: 22px 18px; }
    .top-actions { width: 100%; }
  }
}
@media screen {
  .top-actions { max-width: 100%; min-width: 0; }
  .toggle { flex-wrap: wrap; gap: 4px; max-width: 100%; }
  .toggle button { flex: 1 1 110px; }
}
@media screen {
  .onboarding-card { max-width: 620px; }
  .curriculum-picker { margin: 28px auto; text-align: start; max-width: 440px; }
  .curriculum-picker label { display: block; font-weight: 800; font-size: .95rem; margin-bottom: 10px; }
  .curriculum-picker select {
    display: block; width: 100%; min-height: 56px; padding: 12px 16px;
    font: inherit; font-weight: 700; color: var(--text-main);
    border: 1px solid #bdcec0; border-radius: 14px; background: #f7faf4; cursor: pointer;
  }
  .curriculum-picker select:hover { border-color: var(--theme-primary); }
  .curriculum-picker select:focus-visible { outline: 3px solid #208d87; outline-offset: 4px; }
  #onboardingStep1 > .btn-3d { width: 100%; max-width: 440px; }
}
/* A bright storybook welcome, with an original illustrated companion. */
@media screen {
  body:has(#viewOnboarding.active) {
    background-color: #699c20;
    background-image: radial-gradient(circle at 12% 24%, #a4ca5745 0 10%, transparent 10.2%), radial-gradient(circle at 84% 90%, #527f2055 0 17%, transparent 17.2%), repeating-linear-gradient(35deg, transparent 0 85px, #ffffff04 85px 87px);
  }
  body:has(#viewOnboarding.active) .adventure-nav { background: #ffffff; border-bottom: 4px solid #a9c967; box-shadow: none; }
  body:has(#viewOnboarding.active) .stats-hub { display: none; }
  #viewOnboarding.active { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 32px; max-width: 1180px; padding: 56px 28px 64px; }
  #viewOnboarding .onboarding-card { max-width: none; width: 100%; margin: 0; padding: 16px 0; text-align: start; border: 0; background: transparent; box-shadow: none; }
  #viewOnboarding .welcome-emblem { display: none; }
  #viewOnboarding .welcome-eyebrow { display: inline-block; color: #fff4bf; background: #416c1d55; border: 1px solid #c8e89b66; padding: 6px 16px; border-radius: 99px; font-size: .95rem; margin-bottom: 18px; }
  #viewOnboarding .onboarding-title { color: white; font-size: clamp(2rem, 4.1vw, 3.4rem); line-height: 1.35; letter-spacing: -.8px; margin-bottom: 18px; text-shadow: 0 3px 0 #48751f44; }
  #viewOnboarding .onboarding-title span { color: #fff0a6; }
  #viewOnboarding .onboarding-sub { color: #fff; opacity: .94; font-size: 1.15rem; line-height: 1.8; font-weight: 500; }
  #viewOnboarding .curriculum-picker { margin: 26px 0 20px; max-width: 440px; }
  #viewOnboarding .curriculum-picker label { color: #fff9e5; }
  #viewOnboarding .curriculum-picker select { border: 2px solid #fff; background: #fffef8; min-height: 60px; border-radius: 16px; box-shadow: 0 5px 0 #365e252e; color: #34472e; padding-inline: 18px; }
  #viewOnboarding .btn-3d.primary { background: #ff952c; color: #34200b; box-shadow: 0 6px 0 #c36b1a; border: 2px solid #ffb44c; min-height: 58px; font-size: 1.2rem; border-radius: 17px; }
  #viewOnboarding .btn-3d.primary:hover { background: #ffae41; transform: translateY(-3px); box-shadow: 0 9px 0 #c36b1a; }
  #viewOnboarding .btn-3d.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #c36b1a; }
  .adventure-illustration { position: relative; text-align: center; min-width: 0; }
  .adventure-illustration img { display: block; width: 100%; height: auto; max-width: 510px; margin: 0 auto; filter: drop-shadow(0 15px 0 #426a1910); animation: storyFloat 5s ease-in-out infinite; }
  .mascot-hello { position: absolute; top: 8%; right: 6%; z-index: 1; color: #563a89; background: #fff9e8; padding: 10px 22px; font-size: 1.05rem; font-weight: 900; border-radius: 22px 22px 3px 22px; transform: rotate(7deg); box-shadow: 0 5px 0 #41691b20; }
  .learning-perks { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
  .learning-perks span { background: #ffffff19; border: 1px solid #d9eeb23d; padding: 8px 12px; border-radius: 12px; color: #fff; font-size: .85rem; font-weight: 700; }
  .learning-perks b { color: #ffe294; margin-inline-end: 5px; }
  @keyframes storyFloat { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-9px) rotate(1deg); } }
  .hero-next-mission { border-top: 5px solid #8db744; background: linear-gradient(120deg, #f2f8df, #fff 72%); }
  .map-chapter-header { background: #edf4dc; }
  .station-node-icon { background: #fff3d6; }
  .map-station-node.completed .station-node-icon { background: #d9f4e2; }
  .mascot-companion-card { border-top: 5px solid #a384cf; background: linear-gradient(#f3edfc, #fff 80%); }
  .intro { border-top: 5px solid #a384cf; }
  @media (max-width: 760px) {
    #viewOnboarding.active { grid-template-columns: 1fr; gap: 20px; padding: 28px 22px 36px; }
    #viewOnboarding .onboarding-card { text-align: center; padding: 0; }
    #viewOnboarding .onboarding-title { font-size: 2.3rem; margin-bottom: 12px; }
    #viewOnboarding .onboarding-sub { font-size: 1rem; }
    #viewOnboarding .curriculum-picker { margin: 22px auto 18px; }
    .adventure-illustration img { max-width: 300px; }
    .mascot-hello { right: calc(50% - 145px); top: 5%; padding: 7px 14px; font-size: .85rem; }
    .learning-perks span { font-size: .75rem; padding: 7px 9px; }
  }
}
@media (prefers-reduced-motion: reduce) { .adventure-illustration img { animation: none; } }
@media screen and (max-width: 760px) {
  #viewOnboarding.active { gap: 10px; padding-top: 18px; }
  #viewOnboarding .adventure-illustration { order: -1; }
  .adventure-illustration img { max-width: 190px; }
  .mascot-hello { right: calc(50% - 120px); top: 5%; padding: 5px 10px; font-size: .75rem; }
  .learning-perks { display: none; }
  #viewOnboarding .welcome-eyebrow { font-size: .8rem; margin-bottom: 10px; padding: 4px 12px; }
  #viewOnboarding .onboarding-title { font-size: 2rem; }
}
/* Adventure palette: midnight blue, coral, and sunshine. */
@media screen {
  body:has(#viewOnboarding.active) {
    background-color: #283b78;
    background-image: radial-gradient(circle at 12% 24%, #627ac745 0 10%, transparent 10.2%), radial-gradient(circle at 84% 90%, #19295a66 0 17%, transparent 17.2%), repeating-linear-gradient(35deg, transparent 0 85px, #ffffff04 85px 87px);
  }
  body:has(#viewOnboarding.active) .adventure-nav { background: #fffcf5; border-bottom-color: #7186c5; }
  body:has(#viewOnboarding.active) .brand-title-wrap h1 { color: #283b78; }
  body:has(#viewOnboarding.active) .brand-title-wrap span { color: #8d503b; }
  #viewOnboarding .welcome-eyebrow { color: #ffe5a1; background: #17255455; border-color: #a7b9ee66; }
  #viewOnboarding .onboarding-title { text-shadow: 0 3px 0 #13214d44; }
  #viewOnboarding .onboarding-title span { color: #ffdb83; }
  #viewOnboarding .curriculum-picker select { color: #29395c; background: #fffcf5; box-shadow: 0 5px 0 #14204855; }
  #viewOnboarding .curriculum-picker select:hover { border-color: #ffdb83; }
  #viewOnboarding .btn-3d.primary { background: #ff947f; color: #472a30; border-color: #ffb3a0; box-shadow: 0 6px 0 #c45c57; }
  #viewOnboarding .btn-3d.primary:hover { background: #ffa58e; box-shadow: 0 9px 0 #c45c57; }
  #viewOnboarding .btn-3d.primary:active { box-shadow: 0 2px 0 #c45c57; }
  .adventure-illustration img { filter: drop-shadow(0 15px 0 #101c4218); }
  .mascot-hello { color: #344780; background: #fff5dc; box-shadow: 0 5px 0 #17264b33; }
  .learning-perks span { background: #ffffff13; border-color: #bac9f34d; }
  .learning-perks b { color: #ffdb83; }
  .hero-next-mission { border-top-color: #7186c5; background: linear-gradient(120deg, #edf1ff, #fff 72%); }
  .mascot-companion-card { border-top-color: #ed9b86; background: linear-gradient(#fff0e9, #fff 80%); }
  .intro { border-top-color: #7186c5; }
}
