/* ==========================================================================
   Pandai Study — "Rainforest Night" design layer (dark by default, light available)
   Deep teal-to-emerald header, ink-blue page, mango / lagoon / hibiscus accents,
   one original line-icon set, white "paper" worksheet thumbnails with folded corners.
   Loaded after main.css. The previous garden look is kept in theme-garden.css.
   ========================================================================== */
:root, :root[data-theme="dark"] {
  --bg: #0D1828;
  --bg-2: #101F33;
  --surface: #15263D;
  --surface-2: #1B304C;
  --surface-3: #22395A;
  --line: #2A4266;
  --text: #EEF4FF;
  --muted: #9CB0CD;
  --head-a: #0B3D4C;
  --head-b: #0E6B5E;
  --head-c: #138A6A;
  --mango: #FFB43B;
  --lagoon: #2EC4B6;
  --hibiscus: #FF6B8A;
  --lilac: #A68BFF;
  --sky: #5AB6FF;
  --good: #34D399;
  --warn: #FFB43B;
  --ring: #7CC4FF;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 10px 30px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;

  /* map onto the variables main.css already uses */
  --ink: var(--text);
  --card: var(--surface);
  --dot: transparent;
  --good-soft: rgba(52, 211, 153, .14);
  --accent: var(--lagoon);
  --accent-strong: #129C8F;
  --accent-soft: rgba(46, 196, 182, .16);
  --shadow: var(--shadow-card);
  --radius: 18px;
  --font-display: "Segoe UI Variable Display", ui-rounded, "SF Pro Rounded", "Nunito", "Trebuchet MS", system-ui, sans-serif;
}
:root[data-theme="light"] {
  --bg: #F3F6FB;
  --bg-2: #EAF0F8;
  --surface: #FFFFFF;
  --surface-2: #F1F5FA;
  --surface-3: #E6EDF6;
  --line: #D8E2EF;
  --text: #13243A;
  --muted: #5A6C86;
  --ring: #2F7DDB;
  --shadow-card: 0 1px 2px rgba(19, 36, 58, .06), 0 10px 28px -16px rgba(19, 36, 58, .3);
  --good-soft: #E1F7EE;
  --accent-soft: #DDF5F2;
  --sky: #1F6FC5;
  color-scheme: light;
}
:root[data-theme="light"] .age-card .age-start { color: color-mix(in srgb, var(--c) 70%, #000); }
:root[data-theme="light"] .facts li b { color: #0E8A7E; }
body[data-age="1-2"] { --accent: var(--hibiscus); --accent-strong: #E0476A; --accent-soft: rgba(255, 107, 138, .16); }
body[data-age="3-4"] { --accent: var(--mango); --accent-strong: #D98A12; --accent-soft: rgba(255, 180, 59, .16); }
body[data-age="5-6"] { --accent: var(--lagoon); --accent-strong: #129C8F; --accent-soft: rgba(46, 196, 182, .16); }

html { background: var(--bg); }
body { background: var(--bg); color: var(--text); }
h1, h2, h3, .gc-title, .ws-tile-title, .age-title, .hero-title { font-family: var(--font-display); letter-spacing: -.015em; }
a { color: var(--sky); }
:focus-visible { outline-color: var(--ring); }
.muted { color: var(--muted); }
.ic-wrap { display: inline-flex; line-height: 0; }
.ic { width: 1.15em; height: 1.15em; flex: none; }

/* ---------- header (two rows, like a real product nav) ---------- */
.topbar {
  display: block; padding: 0; border: 0;
  background: linear-gradient(100deg, var(--head-a) 0%, var(--head-b) 55%, var(--head-c) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 2px 0 rgba(46, 196, 182, .55);
  backdrop-filter: none; color: #fff;
}
.hbar { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 20px 6px; }
.hbar .spacer { flex: 1; }
.brand { color: #fff; }
.brand .mascot { width: 40px; height: 40px; }
.wordmark { display: inline-flex; gap: 5px; font-family: var(--font-display); font-size: 1.32rem; font-weight: 900; line-height: 1; }
.wordmark b { color: #fff; }
.wordmark i { font-style: normal; color: var(--mango); }
.hsearch { display: inline-flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 8px 0 14px; border-radius: 999px; color: #E8FFF8; text-decoration: none; font-weight: 700; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .22); }
.hsearch:hover { background: rgba(255, 255, 255, .16); }
.hsearch kbd { font: inherit; font-size: .8rem; padding: 2px 8px; border-radius: 8px; background: rgba(255, 255, 255, .14); }
.hbtn { width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 50%; border: 0; cursor: pointer; color: #fff; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .22); }
.hbtn:hover { background: rgba(255, 255, 255, .18); }
.lang-toggle { background: rgba(255, 255, 255, .1); border: 0; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .22); }
.lang-toggle button { color: #D7F5EE; min-height: 34px; }
.lang-toggle button.on { background: #fff; color: var(--head-a); box-shadow: none; }
.htabs { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 6px; padding: 4px 20px 10px; }
.htabs .spacer { flex: 1; }
.htab { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 4px 16px 4px 6px; border-radius: 999px; color: #E3FFF7; text-decoration: none; font-weight: 800; white-space: nowrap; }
.htab:not(:has(.age-badge)) { padding-left: 14px; }
.htab:hover { background: rgba(255, 255, 255, .12); }
.htab.on { background: #fff; color: #10324A; box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .45); }
.htab.ghost { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .25); }
.htab .ic { width: 1.1em; height: 1.1em; }
.age-badge { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 999px; font-weight: 900; font-size: .82rem; color: #10283A; letter-spacing: -.02em; }
.age-badge.age-1-2 { background: var(--hibiscus); color: #fff; }
.age-badge.age-3-4 { background: var(--mango); }
.age-badge.age-5-6 { background: var(--lagoon); }
.age-badge.big { min-width: 64px; height: 64px; font-size: 1.35rem; box-shadow: 0 0 0 6px rgba(255, 255, 255, .06); }
.tabbar, .grass-footer, .chip-age, .btn-parent { display: none !important; }
@media (min-width: 900px) { .topbar { position: sticky; top: 0; } }
@media (max-width: 899px) {
  .topbar { position: relative; }
  .hbar { padding: 10px 14px 4px; gap: 8px; }
  .htabs { overflow-x: auto; scrollbar-width: none; padding: 4px 14px 10px; }
  .htabs::-webkit-scrollbar { display: none; }
  .htabs .spacer { display: none; }
  .hsearch span.lbl, .hsearch kbd { display: none; }
  .hsearch { width: 42px; padding: 0; justify-content: center; }
}
@media (max-width: 420px) { .wordmark { font-size: 1.08rem; } .brand .mascot { width: 34px; height: 34px; } }

/* ---------- footer ---------- */
.site-footer { margin-top: 40px; background: var(--bg-2); border-top: 1px solid var(--line); color: var(--muted); }
.site-footer .inner { max-width: 1180px; margin: 0 auto; padding: 28px 20px 36px; display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .site-footer .inner { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-footer b { color: var(--text); display: block; margin-bottom: 8px; }
.site-footer .wordmark { display: inline-flex; margin-bottom: 8px; }
.site-footer .wordmark b { display: inline; margin: 0; }
.site-footer a { color: var(--muted); text-decoration: none; display: block; padding: 3px 0; font-weight: 700; }
.site-footer a:hover { color: var(--text); }
.site-footer .pledge { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.site-footer .pledge span { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: var(--surface); color: var(--text); }

/* ---------- page shell ---------- */
#app { max-width: 1180px; padding: 18px 20px 30px; }
.crumbs { font-size: .92rem; font-weight: 700; margin: 0 0 12px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.crumbs li { color: var(--muted); display: inline-flex; gap: 6px; }
.crumbs li + li::before { content: "/"; opacity: .5; }
.crumbs a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(156, 176, 205, .5); }
.crumbs [aria-current] { max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-head h1 { font-size: clamp(1.6rem, 4.4vw, 2.3rem); display: flex; align-items: center; gap: 12px; }
.page-head .tr { color: var(--muted); }
.title-icon .isq { width: 46px; height: 46px; }
.subhead { color: var(--muted); font-weight: 700; margin: -6px 0 14px; }

/* buttons */
.btn { box-shadow: none; border-radius: 14px; font-weight: 800; }
.btn:active { transform: translateY(1px); }
.btn-go { background: var(--lagoon); color: #062B28; }
.btn-go:hover { background: #45D3C6; }
.btn-accent { background: var(--mango); color: #2B1A00; }
.btn-accent:hover { background: #FFC25E; }
.btn-soft { background: var(--surface-2); color: var(--text); border: 1.5px solid var(--line); box-shadow: none; }
.btn-soft:hover { background: var(--surface-3); }
.btn-danger { background: transparent; color: #FF8FA3; border: 1.5px solid rgba(255, 107, 138, .5); }
.btn-back { gap: 6px; }
.btn .ic-wrap .ic { width: 1.1em; height: 1.1em; }

/* generic surfaces from main.css → themed */
.card, .feature, .tile, .pic-card, .choice, .match-item, .counter, .q-count, .quiz-art, .instr, .parent-tip,
.prog-age, .ws-card, .gate-input, .chip, .seg, .do-toolbar, .do-tool, .do-act, .do-size, .do-keypad,
.do-kp-keys button, .do-kp-row button, .celebrate, .speak-btn, .lib-empty, .wsd-facts {
  background: var(--surface); color: var(--text); border-color: var(--line);
}
.card, .tile, .pic-card, .choice, .match-item, .feature, .celebrate, .do-toolbar, .quiz-art { box-shadow: var(--shadow-card); }
.pic-card, .choice, .match-item { border: 2px solid var(--line); border-radius: 18px; }
.pic-card.seen { border-color: var(--good); }
.choice:hover, .match-item:hover, .pic-card:hover { border-color: var(--lagoon); }
.choice.correct { border-color: var(--good); background: rgba(52, 211, 153, .14); }
.match-item.sel { border-color: var(--sky); background: rgba(90, 182, 255, .14); }
.match-item.matched { background: color-mix(in srgb, var(--mc) 18%, var(--surface)); }
.instr { border: 1.5px dashed var(--line); border-radius: 14px; }
.speak-btn { background: var(--lagoon); color: #062B28; }
.dot { background: var(--surface-3); }
.dot.on { background: var(--accent); }
.tick, .done-badge { background: var(--good); color: #062B28; }
.art-text { color: var(--text); }
.art-row > .art-text { border-color: var(--accent); background: var(--accent-soft); }
.trace-canvas, .colour-pic { background: #fff; }
.colour-pic, .trace-canvas { box-shadow: var(--shadow-card); border-radius: 18px; }
.trace-title small, .pic-label small, .tile-tr { color: var(--muted); }
.bar { background: var(--surface-3); }
.bar > span { background: linear-gradient(90deg, var(--lagoon), var(--good)); }
.type-chip { background: var(--surface-2); color: var(--muted); }
.tile-stars { color: var(--mango); }
.activity-tile:not(.done) .tile-stars { color: var(--lagoon); }
.bubble-field { background: linear-gradient(#123A55, #15294A); }
.bp { background: var(--surface-3); }
.parent-tip summary { color: var(--text); }
.seg button { color: var(--text); }
.seg button.on { background: var(--surface-3); box-shadow: none; }
.chip { color: var(--text); }
.prog-table td { border-color: var(--line); }
.ws-card:hover { border-color: var(--lagoon); }
.switch .slider { background: var(--surface-3); }
.ws-filters select, .builder select, .builder input, select, input[type="text"], input[type="search"] { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.gate-msg { color: #FF8FA3; }
.overlay { background: rgba(5, 12, 22, .65); }
.celebrate h2 small { color: var(--muted); }
.cel-stars { color: var(--surface-3); }
.do-result { background: rgba(255, 180, 59, .14); color: var(--text); }
.do-result.all { background: rgba(52, 211, 153, .16); color: var(--text); }
.do-hint { color: var(--muted); }
.do-tool[aria-pressed="true"] { background: var(--lagoon); color: #062B28; border-color: var(--lagoon); }
.do-check { background: var(--mango) !important; color: #2B1A00 !important; border-color: var(--mango) !important; }
.do-kp-display { background: var(--surface-2); color: var(--text); }
.do-act[aria-pressed="true"] { background: var(--surface-3); border-color: var(--sky); }
.do-size i { background: var(--text); }
.do-sw { border-color: var(--surface); box-shadow: 0 0 0 2px var(--line); }
.do-sw[aria-checked="true"] { box-shadow: 0 0 0 3px var(--text); }
.do-tool .ic, .do-act .ic { width: 1.2em; height: 1.2em; }
.do-scroller { background: transparent; }
.kp-ok { background: var(--lagoon) !important; color: #062B28 !important; border-color: var(--lagoon) !important; }
.kp-del { background: var(--surface-2) !important; }

/* ---------- icon squares ---------- */
.isq { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; flex: none; color: var(--tone); background: color-mix(in srgb, var(--tone) 16%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tone) 35%, transparent); }
.isq .ic { width: 24px; height: 24px; }
.isq.lg { width: 56px; height: 56px; border-radius: 16px; }
.isq.lg .ic { width: 30px; height: 30px; }
.t0 { --tone: #34D399; } .t1 { --tone: #5AB6FF; } .t2 { --tone: #FFB43B; } .t3 { --tone: #FF6B8A; }
.t4 { --tone: #A68BFF; } .t5 { --tone: #FF8C5A; } .t6 { --tone: #2EC4B6; } .t7 { --tone: #F472B6; }
:root[data-theme="light"] .t0 { --tone: #12A26E; } :root[data-theme="light"] .t1 { --tone: #2878D0; }
:root[data-theme="light"] .t2 { --tone: #C97B00; } :root[data-theme="light"] .t3 { --tone: #D93A62; }
:root[data-theme="light"] .t4 { --tone: #6E53D6; } :root[data-theme="light"] .t5 { --tone: #D9622B; }
:root[data-theme="light"] .t6 { --tone: #0E9A8D; } :root[data-theme="light"] .t7 { --tone: #C93A8C; }

/* ---------- section headers ---------- */
.shead { display: flex; align-items: center; gap: 14px; margin: 34px 0 14px; }
.shead-text { flex: 1; min-width: 0; }
.shead h2 { margin: 0; font-size: clamp(1.35rem, 3.4vw, 1.75rem); }
.shead h2 a { color: var(--sky); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.shead h2 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.shead-chev { width: .8em; height: .8em; }
.shead p { margin: 2px 0 0; color: var(--muted); font-weight: 700; font-size: .95rem; }
.link-more { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--sky); text-decoration: none; white-space: nowrap; background: none; border: 0; cursor: pointer; font: inherit; }
.link-more:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- page hero (age pages, library) ---------- */
.phero { display: grid; gap: 22px; grid-template-columns: 1fr; align-items: center; padding: 8px 0 22px; border-bottom: 1px solid var(--line); }
@media (min-width: 900px) { .phero { grid-template-columns: 1.25fr 1fr; } }
.phero-title { display: flex; align-items: center; gap: 16px; margin: 0 0 10px; font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.05; }
.phero-title .hl { color: var(--sky); }
.phero p.lead2 { margin: 0 0 14px; color: var(--muted); font-size: clamp(1.05rem, 2.4vw, 1.25rem); font-weight: 600; max-width: 56ch; }
.facts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0; }
.facts li { padding: 5px 13px; border-radius: 99px; border: 1.5px solid var(--line); font-weight: 700; color: var(--muted); font-size: .95rem; }
.facts li b { color: var(--lagoon); }
.notice { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 99px; text-decoration: none; color: var(--text); font-weight: 700; background: rgba(255, 180, 59, .1); box-shadow: inset 0 0 0 1.5px rgba(255, 180, 59, .45); }
.notice .pill { background: var(--mango); color: #2B1A00; border-radius: 99px; padding: 2px 9px; font-size: .78rem; font-weight: 900; letter-spacing: .04em; }
.notice:hover { background: rgba(255, 180, 59, .18); }
/* header preview fan: up to 5 clickable worksheets and games */
.fan { position: relative; height: 290px; max-width: 520px; width: 100%; justify-self: center; }
.fan-glow { position: absolute; inset: 30px 4% 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(46, 196, 182, .3), transparent); pointer-events: none; }
.fan-card {
  --r: 0deg; --x: 0px; --y: 0px;
  position: absolute; top: 30px; left: 50%; width: 140px; margin-left: -70px;
  border-radius: 8px; overflow: hidden; background: #fff; text-decoration: none; color: #13243A;
  box-shadow: 0 16px 32px -12px rgba(0, 0, 0, .6);
  transform: translate(var(--x), var(--y)) rotate(var(--r)); transform-origin: 50% 110%;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s;
}
.fan-card .ws-thumb { border-radius: 0; }
.fan-card:hover, .fan-card:focus-visible { --y: -18px; z-index: 9; box-shadow: 0 26px 44px -14px rgba(0, 0, 0, .7); }
.fan-card:hover { transform: translate(var(--x), var(--y)) rotate(calc(var(--r) * .4)) scale(1.06); }
.fan-label { position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 800; padding: 3px 8px; border-radius: 6px; color: #0B1E2E; background: var(--tone); white-space: nowrap; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; }
.fan-label .ic { width: .9em; height: .9em; }
.fan-game { background: var(--surface); color: var(--text); height: 198px; display: flex; flex-direction: column; border: 1.5px solid var(--line); }
.fan-game .gc-art { height: 118px; flex: none; }
.fan-game .gc-art::after { display: none; }
.fan-game .gc-pic { --art: 40px; transform: scale(.8); }
.fan-game-title { padding: 8px 10px 30px; font-weight: 700; font-size: .86rem; line-height: 1.25; }
/* five-card spread */
.fan.n5 .f0 { --x: -176px; --y: 26px; --r: -16deg; }
.fan.n5 .f1 { --x: -90px; --y: 8px; --r: -8deg; z-index: 2; }
.fan.n5 .f2 { --x: 0px; --y: -6px; --r: 0deg; z-index: 4; width: 150px; margin-left: -75px; }
.fan.n5 .f3 { --x: 90px; --y: 8px; --r: 8deg; z-index: 2; }
.fan.n5 .f4 { --x: 176px; --y: 26px; --r: 16deg; }
.fan.n4 .f0 { --x: -140px; --y: 18px; --r: -12deg; } .fan.n4 .f1 { --x: -48px; --r: -4deg; z-index: 2; }
.fan.n4 .f2 { --x: 48px; --r: 4deg; z-index: 2; } .fan.n4 .f3 { --x: 140px; --y: 18px; --r: 12deg; }
.fan.n3 .f0 { --x: -95px; --y: 14px; --r: -10deg; } .fan.n3 .f1 { z-index: 2; } .fan.n3 .f2 { --x: 95px; --y: 14px; --r: 10deg; }
@media (max-width: 1080px) and (min-width: 900px) { .fan { transform: scale(.86); } }
@media (max-width: 899px) { .fan { transform: scale(.9); } }
@media (max-width: 560px) { .phero .fan { display: none; } .phero { padding-bottom: 14px; } }
.fan-label { white-space: nowrap; }

/* sticky filter / tab bar */
.fbar { position: sticky; top: 0; z-index: 12; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 0; margin-bottom: 4px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
@media (min-width: 900px) { .fbar { top: 112px; } }
.fsearch { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; max-width: 340px; min-height: 46px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); color: var(--muted); }
.fsearch:focus-within { border-color: var(--sky); }
.fsearch input { flex: 1; min-width: 0; border: 0 !important; outline: 0; background: transparent !important; color: var(--text); font-size: 1rem; min-height: 42px; }
.ftabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1 1 320px; min-width: 0; }
@media (min-width: 760px) { .fbar { flex-wrap: nowrap; } .fsearch { flex: 0 1 300px; } }
@media (min-width: 900px) { .do-toolbar { top: 122px; } }
@media (max-width: 899px) { .do-toolbar { position: static; } }
.ftabs::-webkit-scrollbar { display: none; }
.ftab { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 4px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font-weight: 800; cursor: pointer; white-space: nowrap; text-decoration: none; }
.ftab b { color: var(--muted); font-weight: 800; }
.ftab:hover { border-color: var(--lagoon); }
.ftab.on { background: #fff; color: #10324A; border-color: #fff; }
.ftab.on b { color: #3E5A73; }
:root[data-theme="light"] .ftab.on { background: #10324A; color: #fff; border-color: #10324A; }
:root[data-theme="light"] .ftab.on b { color: #B9D2E6; }
.frow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 10px 0 0; }
.frow .lbl { color: var(--muted); font-weight: 800; font-size: .9rem; margin-right: 4px; }
@media (max-width: 760px) { .fsearch { max-width: none; } .frow { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .frow::-webkit-scrollbar { display: none; } }

/* ---------- cards: games ---------- */
.cards-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.gc { display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: var(--surface); text-decoration: none; color: var(--text); box-shadow: var(--shadow-card); border: 1.5px solid var(--line); transition: transform .15s, border-color .15s; }
.gc:hover { transform: translateY(-3px); border-color: var(--lagoon); }
.gc-art { position: relative; height: 128px; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--tone) 42%, transparent), transparent 60%), color-mix(in srgb, var(--tone) 18%, var(--surface-2)); }
.gc-art::after { content: ""; position: absolute; top: 0; right: 0; width: 26px; height: 26px; background: linear-gradient(225deg, var(--bg) 50%, color-mix(in srgb, var(--tone) 50%, #fff) 50%); border-bottom-left-radius: 6px; }
.gc-pic { --art: 54px; display: grid; place-items: center; color: var(--text); }
.gc-pic .art-text, .gc-pic .art-op { color: var(--text); }
.gc-pic .art-text { font-size: 48px; font-family: var(--font-learn); font-weight: 700; }
.gc-pic .emoji { font-size: 50px; }
.gc-pic .swatch { width: 56px; height: 56px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .5); }
.gc-pic svg.shape, .gc-pic svg.pic { width: 80px; height: 80px; }
.gc-pic .art-count { display: flex; flex-wrap: wrap; max-width: 140px; justify-content: center; }
.gc-pic .art-count .emoji { font-size: 26px; }
.gc-pic .art-row .emoji { font-size: 30px; }
.gc-pic { max-width: calc(100% - 20px); overflow: hidden; }
.gc-pic .art-row { gap: 4px; flex-wrap: nowrap; }
.gc-pic .art-row > .art-text { font-size: 24px !important; padding: 0 6px; border-width: 2px; border-radius: 8px; }
.gc-pic .art-row > .emoji { font-size: 26px !important; }
.gc-pic .art-row .art-count .emoji { font-size: 18px !important; }
.gc-pic .art-row .art-op { font-size: 22px; }
.gc-row { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.gc-row .emoji-badge { font-size: 26px !important; }
.gc-row > * { --art: 40px; }
.gc-row .emoji { font-size: 40px !important; }
.gc-row .swatch { width: 40px !important; height: 40px !important; }
.gc-row .art-text { font-size: 38px !important; }
.gc-link { color: var(--muted); }
.gc-letter { font-family: var(--font-learn); font-weight: 700; font-size: 68px; line-height: 1; color: transparent; -webkit-text-stroke: 2.5px var(--text); }
.gc-path { width: 120px; height: 96px; color: var(--text); }
.gc-bubble { width: 38px; height: 38px; border-radius: 50%; display: inline-block; box-shadow: inset -6px -6px 0 rgba(0, 0, 0, .12), inset 6px 6px 0 rgba(255, 255, 255, .3); }
.c-red { background: #E63946; } .c-blue { background: #1E88E5; } .c-yellow { background: #FFD23F; } .c-green { background: #43A047; } .c-orange { background: #FB8C00; } .c-purple { background: #8E44AD; }
.gc-body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; flex: 1; }
.gc-type { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.gc-title { font-weight: 800; font-size: 1.08rem; line-height: 1.25; }
.gc-go { margin-top: auto; padding-top: 4px; display: inline-flex; align-items: center; gap: 4px; color: var(--sky); font-weight: 800; }
.gc-go .ic { width: .9em; height: .9em; }
.flag { position: absolute; left: 10px; top: 10px; padding: 2px 9px; border-radius: 99px; font-weight: 900; font-size: .8rem; letter-spacing: 1px; }
.flag.done { background: var(--good); color: #062B28; }
.flag.saved { background: var(--sky); color: #08223A; letter-spacing: 0; }

/* ---------- cards: worksheets ---------- */
.ws-grid-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.ws-tile { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: var(--surface); text-decoration: none; color: var(--text); box-shadow: var(--shadow-card); border: 1.5px solid var(--line); transition: transform .15s, border-color .15s; }
.ws-tile:hover { transform: translateY(-3px); border-color: var(--lagoon); }
.ws-tile-thumb { position: relative; background: #fff; height: 168px; overflow: hidden; }
.ws-tile-thumb::after { content: ""; position: absolute; top: 0; right: 0; width: 24px; height: 24px; background: linear-gradient(225deg, var(--bg) 50%, #D7DEE8 50%); border-bottom-left-radius: 5px; box-shadow: -1px 1px 3px rgba(0, 0, 0, .15); }
.ws-thumb { position: relative; width: 100%; aspect-ratio: 210 / 297; overflow: hidden; background: #fff; pointer-events: none; }
.ws-tile-thumb .ws-thumb { width: 100%; }
.ws-thumb .sheet { position: absolute; left: 0; top: 0; box-shadow: none; border-radius: 0; transform-origin: top left; }
.ws-tile-body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; flex: 1; }
.ws-tile-title { font-weight: 800; font-size: 1.05rem; line-height: 1.25; }
.ws-tile-meta { color: var(--muted); font-size: .82rem; font-weight: 700; }
.ws-tile-go { margin-top: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--sky); font-weight: 800; }
.ws-tile-go .ic { width: .9em; height: .9em; }
.ws-tile .flag { z-index: 2; }

/* ---------- homepage ---------- */
.home-body { max-width: 1180px; margin: 0 auto; padding: 6px 20px 10px; }
.scene { min-height: min(calc(100svh - 112px), 820px); }
#pick-age { scroll-margin-top: 120px; }
.age-cards { gap: 16px; }
.age-card { align-items: flex-start; text-align: left; gap: 8px; padding: 22px; border-radius: 20px; border: 1.5px solid var(--line); border-bottom-width: 1.5px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); position: relative; overflow: hidden; }
.age-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: var(--c); }
.age-card:hover { transform: translateY(-3px); border-color: var(--c); }
.age-card.current { outline: 2px solid var(--c); outline-offset: 2px; }
.age-1-2 { --c: var(--hibiscus); --soft: transparent; }
.age-3-4 { --c: var(--mango); --soft: transparent; }
.age-5-6 { --c: var(--lagoon); --soft: transparent; }
.age-card .age-title { font-size: 1.6rem; font-weight: 900; }
.age-card .age-tag { color: var(--muted); font-weight: 600; margin: 0; }
.age-card .age-count { background: none; padding: 0; color: var(--text); font-weight: 800; }
.age-card .age-subjects { font-size: .86rem; letter-spacing: 0; color: var(--muted); font-weight: 700; margin: 0; }
.age-card .age-start { margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; color: var(--c); font-weight: 900; }
.age-card .badge { background: var(--c); color: #0B1E2E; top: 16px; right: 16px; }
.kind-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.kind-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.kind-card:hover { border-color: var(--lagoon); transform: translateY(-2px); }
.kind-title { display: block; font-weight: 800; }
.kind-count { display: block; color: var(--muted); font-size: .88rem; font-weight: 700; }
.grownups { display: grid; gap: 18px; grid-template-columns: 1fr; padding: 24px; border-radius: 22px; background: linear-gradient(120deg, color-mix(in srgb, var(--head-b) 35%, var(--surface)), var(--surface)); border: 1.5px solid var(--line); margin-top: 34px; }
@media (min-width: 900px) { .grownups { grid-template-columns: 320px 1fr; } }
.grownups h2 { margin-top: 0; }
.grownups p { color: var(--muted); font-weight: 600; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.feature { padding: 16px; border-radius: 16px; border: 1.5px solid var(--line); box-shadow: none; }
.feature .isq { margin-bottom: 8px; }
.feature p { color: var(--muted); }
.hero { display: none; }
.lead { color: var(--muted); }

/* ---------- worksheet detail ---------- */
.wsd-layout { display: grid; gap: 26px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .wsd-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); } }
.wsd-preview { background: var(--surface); border: 1.5px solid var(--line); border-radius: 20px; padding: 16px; }
.wsd-info h1 { font-size: clamp(1.8rem, 4.6vw, 2.6rem); margin: 10px 0 8px; }
.wsd-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 800; padding: 4px 12px; border-radius: 99px; background: var(--surface-2); color: var(--text); border: 1.5px solid var(--line); }
.tag .ic { width: 1em; height: 1em; }
.wsd-lead { color: var(--muted); font-size: 1.12rem; font-weight: 600; margin: 0 0 14px; }
.wsd-status { padding: 10px 14px; border-radius: 12px; background: rgba(90, 182, 255, .12); font-weight: 700; display: flex; gap: 8px; align-items: center; }
.wsd-status.done { background: rgba(52, 211, 153, .14); }
.wsd-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 8px; }
.btn-big { min-height: 58px; font-size: 1.15rem; padding: 12px 24px; }
.wsd-note { color: var(--muted); font-size: .9rem; }
.wsd-facts { list-style: none; padding: 16px; margin: 16px 0 0; border-radius: 16px; border: 1.5px solid var(--line); display: grid; gap: 10px; }
.wsd-facts li { display: flex; gap: 10px; align-items: flex-start; }
.wsd-facts li .ic { color: var(--lagoon); margin-top: 3px; }
.lib-count { color: var(--muted); font-weight: 700; margin: 14px 0 0; }
.lib-empty { padding: 40px 16px; border-radius: 16px; text-align: center; border: 1.5px solid var(--line); margin-top: 20px; }
.lib-empty .isq { margin-bottom: 8px; }
.lib-more { display: flex; justify-content: center; margin: 22px 0; }

@media (max-width: 899px) {
  .wsd-info { order: -1; }
  .wsd-preview { padding: 10px; }
  .wsd-facts { display: none; }
}
@media (max-width: 560px) {
  #app { padding: 14px 14px 24px; }
  .cards-grid, .ws-grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .gc-art { height: 104px; }
  .ws-tile-thumb { height: 140px; }
  .gc-body, .ws-tile-body { padding: 10px 11px 12px; }
  .gc-title, .ws-tile-title { font-size: .98rem; }
  .shead { margin-top: 26px; }
  .crumbs [aria-current] { max-width: 24ch; }
}

/* ---------- smooth page transitions ---------- */
.topbar { view-transition-name: site-header; }
.htab.on { view-transition-name: active-tab; }
.site-footer { view-transition-name: site-footer; }
::view-transition-old(root) { animation: vt-out 170ms cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: vt-in 320ms cubic-bezier(0, 0, .2, 1) both; }
::view-transition-group(active-tab) { animation-duration: 380ms; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-group(site-header), ::view-transition-group(site-footer) { animation-duration: 0s; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }
#app.page-in > * { animation: vt-in 320ms cubic-bezier(0, 0, .2, 1) backwards; }
#app.page-in > *:nth-child(2) { animation-delay: 40ms; }
#app.page-in > *:nth-child(3) { animation-delay: 80ms; }
/* the cards on a new page rise in gently, one after another */
.ws-grid-cards > *, .cards-grid > * { animation: card-in 420ms cubic-bezier(.2, .8, .2, 1) backwards; }
.ws-grid-cards > :nth-child(2), .cards-grid > :nth-child(2) { animation-delay: 40ms; }
.ws-grid-cards > :nth-child(3), .cards-grid > :nth-child(3) { animation-delay: 80ms; }
.ws-grid-cards > :nth-child(4), .cards-grid > :nth-child(4) { animation-delay: 120ms; }
.ws-grid-cards > :nth-child(n+5), .cards-grid > :nth-child(n+5) { animation-delay: 160ms; }
@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
.fan-card { animation: fan-in 520ms cubic-bezier(.2, .8, .2, 1) backwards; }
.fan-card.f1, .fan-card.f3 { animation-delay: 60ms; }
.fan-card.f0, .fan-card.f4 { animation-delay: 120ms; }
@keyframes fan-in { from { opacity: 0; transform: translate(0, 30px) rotate(0deg) scale(.9); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
/* Homepage scroll-reveal (js/ui/reveal.js). HOMEPAGE ONLY: every rule needs #app.landing.rv-on,
   and .rv-on is only added by the homepage view. Without JS nothing here applies, so all content shows. */
#app.landing.rv-on .rv {
  opacity: 0; transform: translateY(20px);
  transition: opacity 620ms cubic-bezier(.22, .61, .36, 1), transform 620ms cubic-bezier(.22, .61, .36, 1);
  transition-delay: var(--rv-delay, 0ms);
}
#app.landing.rv-on .rv.rv-in { opacity: 1; transform: none; }
#app.landing.rv-on :is(.ws-grid-cards, .cards-grid) > .rv { animation: none; } /* the reveal replaces the page-load card rise */
@media (prefers-reduced-motion: reduce) {
  #app.landing.rv-on .rv { opacity: 1; transform: none; transition: none; }
}
.phero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.phero { overflow-x: clip; overflow-y: visible; }
@media (max-width: 1240px) and (min-width: 900px) { .fan.n5, .fan.n4 { transform: scale(.82); transform-origin: 60% 50%; } }
.anchor { scroll-margin-top: 130px; }

/* clean cards: picture, title, one action */
.ws-tile-thumb { height: 190px; }
.gc-art { height: 140px; }
.ws-tile-body, .gc-body { gap: 10px; padding: 14px 16px 16px; }
.ws-tile-title, .gc-title { font-size: 1.12rem; font-weight: 800; }
.age-card .age-count { color: var(--muted); font-weight: 700; }
@media (max-width: 560px) { .ws-tile-thumb { height: 150px; } .gc-art { height: 110px; } .ws-tile-title, .gc-title { font-size: 1rem; } }

/* celebration confetti: coloured paper pieces instead of emoji */
.confetti span { width: 10px; height: 16px; border-radius: 3px; background: var(--mango); font-size: 0; }
.confetti span:nth-child(4n+1) { background: var(--lagoon); transform: rotate(20deg); }
.confetti span:nth-child(4n+2) { background: var(--hibiscus); width: 12px; height: 12px; border-radius: 50%; }
.confetti span:nth-child(4n+3) { background: var(--lilac); }
.pa-mark { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 6px; border: 1.5px solid var(--line); vertical-align: -4px; }
.pa-mark.on { background: var(--good); border-color: var(--good); color: #062B28; }
.pa-mark .ic { width: 14px; height: 14px; }
.parent-sec h2 { display: flex; align-items: center; gap: 10px; }
.parent-sec h2 .ic { color: var(--lagoon); }
.page-head h1 .isq { margin-right: 2px; }
.gate h1 { display: flex; align-items: center; justify-content: center; gap: 12px; }
.ws-card { border-radius: 14px; }
.ws-card .isq { width: 36px; height: 36px; }
.ws-card .isq .ic { width: 20px; height: 20px; }
.btn-play .ic { width: 1em; height: 1em; }

/* ---------- printing ---------- */
@media print {
  html, body { background: #fff !important; color: #222 !important; }
  .site-footer { display: none !important; }
  #app.ws-detail-view > :not(.wsd-layout), .wsd-info, .wsd-related { display: none !important; }
  .wsd-layout { display: block !important; }
  .wsd-preview { padding: 0 !important; border: 0 !important; background: none !important; }
}

/* ---------- professional typography ----------
   The operating system's own UI typefaces: Segoe UI Variable (Windows), SF Pro (Apple),
   Roboto (Android). No downloads, crisp at every size. Learning letters in games keep
   the school-style font. */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Display", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body { font-family: var(--font); font-size: 16.5px; line-height: 1.55; font-weight: 400; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-feature-settings: "kern", "liga"; }
h1, h2, h3, .phero-title, .shead h2, .wsd-info h1, .page-head h1 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.022em; }
.phero-title { font-weight: 750; letter-spacing: -.032em; }
.wordmark { font-family: var(--font-display); font-weight: 750; letter-spacing: -.02em; }
.btn, .htab, .ftab, .fchip, .tag, .notice, .link-more, .gc-go, .ws-tile-go, .lang-toggle button, .hsearch, .chip, .seg button, .do-tool, .do-act { font-weight: 600; letter-spacing: -.005em; }
.ws-tile-title, .gc-title, .age-card .age-title, .kind-title, .fan-game-title { font-family: var(--font-display); font-weight: 650; letter-spacing: -.012em; }
.age-card .age-title { font-weight: 700; }
.facts li, .shead p, .lib-count, .crumbs, .age-card .age-count { font-weight: 500; }
.lead2, .subhead, .wsd-lead, .age-tag, .feature p, .grownups p, .site-footer p { font-weight: 400; }
.feature b, .site-footer b { font-weight: 650; }
.age-badge { font-family: var(--font-display); font-weight: 700; letter-spacing: -.03em; }
.ftab b, .facts li b { font-weight: 600; font-variant-numeric: tabular-nums; }
.notice .pill { font-weight: 700; letter-spacing: .06em; }
.quiz-prompt-text, .trace-title, .pic-label, .choice-label, .match-label { font-family: var(--font-display); font-weight: 650; letter-spacing: -.01em; }
.instr, .trace-msg { font-weight: 500; }
.celebrate h2 { font-weight: 750; letter-spacing: -.03em; }
.site-footer a { font-weight: 500; }

/* ==========================================================================
   v3: purple-blue header, wider & larger layout, richer game artwork
   ========================================================================== */
:root, :root[data-theme="dark"] {
  --head-a: #1A1663;
  --head-b: #3A2FB8;
  --head-c: #5B4BF0;
  --bg: #0B1130;
  --bg-2: #0E1638;
  --surface: #131D45;
  --surface-2: #192552;
  --surface-3: #213067;
  --line: #2A3A7A;
  --muted: #A5B2DB;
  --sky: #7AB8FF;
  --wide: 1440px;
}
:root[data-theme="light"] { --bg: #F3F5FC; --bg-2: #E9EDF9; --surface: #FFFFFF; --surface-2: #F1F3FB; --surface-3: #E5E9F7; --line: #D9DEF0; --muted: #5A6487; --sky: #3B4FD8; }
.topbar { background: linear-gradient(100deg, var(--head-a) 0%, var(--head-b) 55%, var(--head-c) 100%); box-shadow: 0 2px 0 #8B7BFF, 0 10px 30px -18px rgba(20, 10, 80, .8); }
.lang-toggle button.on, .htab.on { color: #1A1663; }
.hbtn.off { background: rgba(255, 255, 255, .04); color: #C9C3FF; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .18); }
.hbtn.off .ic { opacity: .75; }

/* wide layout, larger type (like a full-width product site) */
.hbar, .htabs { max-width: var(--wide); padding-left: 40px; padding-right: 40px; }
.hbar { padding-top: 14px; padding-bottom: 8px; gap: 14px; }
.htabs { padding-bottom: 14px; gap: 10px; }
.brand .mascot { width: 50px; height: 50px; }
.wordmark { font-size: 1.6rem; }
.htab { min-height: 50px; font-size: 1.08rem; padding: 4px 20px 4px 7px; }
.htab:not(:has(.age-badge)) { padding-left: 18px; }
.age-badge { min-width: 36px; height: 36px; font-size: .9rem; }
.age-badge.big { min-width: 76px; height: 76px; font-size: 1.55rem; }
.hsearch { min-height: 48px; font-size: 1.05rem; padding-left: 18px; }
.hbtn { width: 48px; height: 48px; }
.lang-toggle button { min-height: 40px; min-width: 52px; font-size: 1rem; }
#app, .home-body { max-width: var(--wide); padding-left: 40px; padding-right: 40px; }
#app { padding-top: 26px; }
.site-footer .inner { max-width: var(--wide); padding-left: 40px; padding-right: 40px; }
.crumbs { font-size: 1rem; margin-bottom: 16px; }
.phero { padding: 18px 0 30px; gap: 30px; }
@media (min-width: 900px) { .phero { grid-template-columns: 1.3fr 1fr; } }
.phero-title { font-size: clamp(2.4rem, 5.4vw, 4.6rem); gap: 20px; margin-bottom: 14px; }
.phero p.lead2 { font-size: clamp(1.1rem, 1.7vw, 1.45rem); margin-bottom: 18px; }
.facts li { font-size: 1.02rem; padding: 7px 16px; }
.shead h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); }
.shead p { font-size: 1.02rem; }
.isq { width: 50px; height: 50px; border-radius: 15px; }
.fbar { padding: 16px 0; gap: 14px; }
@media (min-width: 900px) { .fbar { top: 138px; } .do-toolbar { top: 146px; } .anchor, #pick-age { scroll-margin-top: 150px; } }
.fsearch { min-height: 54px; font-size: 1.05rem; flex-basis: 380px; max-width: 420px; padding: 0 18px; }
@media (min-width: 760px) { .fsearch { flex: 0 1 400px; } }
.ftab { min-height: 48px; font-size: 1.02rem; padding: 4px 18px; }
.cards-grid, .ws-grid-cards { gap: 20px; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
.ws-tile-thumb { height: 220px; }
.ws-tile-title, .gc-title { font-size: 1.16rem; }
.fan { height: 340px; max-width: 600px; }
.fan-card { width: 160px; margin-left: -80px; }
.fan.n5 .f2 { width: 172px; margin-left: -86px; }
.fan.n5 .f0 { --x: -200px; } .fan.n5 .f1 { --x: -102px; } .fan.n5 .f3 { --x: 102px; } .fan.n5 .f4 { --x: 200px; }
.fan-game { height: 226px; }
.fan-game .gc-art { height: 136px; }
@media (max-width: 1240px) and (min-width: 900px) { .fan.n5, .fan.n4 { transform: scale(.8); } }
@media (max-width: 760px) {
  .hbar, .htabs, #app, .home-body, .site-footer .inner { padding-left: 16px; padding-right: 16px; }
  .brand .mascot { width: 38px; height: 38px; } .wordmark { font-size: 1.15rem; }
  .htab { min-height: 44px; font-size: .98rem; }
  .hbtn, .hsearch { width: 42px; height: 42px; min-height: 42px; }
  .age-badge.big { min-width: 60px; height: 60px; font-size: 1.2rem; }
}
@media (max-width: 560px) { .cards-grid, .ws-grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } .ws-tile-thumb { height: 160px; } }

/* Worksheet LIBRARY grid only (#/worksheets): compact cards, 6 per row on wide screens.
   Scoped to #app.library .lib-results so the homepage, age pages, "More like this" and the
   games grid keep their layout. Screen only, so printing is untouched. The thumbnail shows the
   whole A4 page (the .ws-thumb keeps its 210:297 shape), so nothing on the sheet is cropped. */
@media screen {
  #app.library .lib-results .ws-grid-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
  #app.library .lib-results .ws-tile-thumb { height: auto; }
  #app.library .lib-results .ws-tile-thumb::after { width: 20px; height: 20px; }
  #app.library .lib-results .ws-tile-body { gap: 6px; padding: 10px 12px 12px; }
  #app.library .lib-results .ws-tile-title {
    font-size: 1rem; line-height: 1.25; min-height: 2.5em; /* two lines, so every card in a row lines up */
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  }
  #app.library .lib-results .ws-tile-go { font-size: .95rem; }
  #app.library .lib-results .flag { left: 8px; top: 8px; font-size: .74rem; }
}
@media screen and (max-width: 1279px) { #app.library .lib-results .ws-grid-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media screen and (max-width: 1023px) { #app.library .lib-results .ws-grid-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media screen and (max-width: 560px) {
  #app.library .lib-results .ws-grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  #app.library .lib-results .ws-tile-body { padding: 8px 10px 10px; }
  #app.library .lib-results .ws-tile-title { font-size: .94rem; }
}
@media screen and (max-width: 339px) { #app.library .lib-results .ws-grid-cards { grid-template-columns: minmax(0, 1fr); } }

/* worksheets / games switch on age pages */
.viewswitch { display: inline-flex; gap: 6px; padding: 6px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); margin: 6px 0 4px; }
.vs-tab { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 22px; border-radius: 999px; text-decoration: none; color: var(--text); font-weight: 650; font-size: 1.08rem; }
.vs-tab .ic { width: 1.25em; height: 1.25em; }
.vs-tab b { font-weight: 600; font-size: .9rem; padding: 1px 9px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.vs-tab:hover { background: var(--surface-2); }
.vs-tab.on { background: linear-gradient(100deg, var(--head-b), var(--head-c)); color: #fff; box-shadow: 0 8px 20px -10px rgba(91, 75, 240, .8); }
.vs-tab.on b { background: rgba(255, 255, 255, .2); color: #fff; }
.viewswitch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 22px; }

/* ---------- richer game artwork ---------- */
.gc-art {
  height: 168px; isolation: isolate;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, .32) 0 16%, transparent 17%),
    radial-gradient(circle at 92% 88%, rgba(255, 255, 255, .16) 0 26%, transparent 27%),
    linear-gradient(140deg, var(--g1), var(--g2));
}
.t0 { --g1: #34D399; --g2: #0EA5E9; } .t1 { --g1: #60A5FA; --g2: #6366F1; } .t2 { --g1: #FCD34D; --g2: #F97316; } .t3 { --g1: #FB7185; --g2: #DB2777; }
.t4 { --g1: #A78BFA; --g2: #6D28D9; } .t5 { --g1: #FDBA74; --g2: #EF4444; } .t6 { --g1: #5EEAD4; --g2: #0891B2; } .t7 { --g1: #F9A8D4; --g2: #A855F7; }
.gc-deco { position: absolute; inset: 0; z-index: -1; opacity: .9; pointer-events: none; }
.gc-deco svg { width: 100%; height: 100%; }
.gc-kind { position: absolute; left: 10px; top: 10px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: rgba(255, 255, 255, .25); color: #fff; backdrop-filter: blur(4px); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35); }
.gc-kind .ic { width: 18px; height: 18px; }
.gc-stage { position: relative; display: grid; place-items: center; width: 112px; height: 112px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #F1F3FF); box-shadow: 0 14px 26px -10px rgba(10, 10, 60, .55), inset 0 -5px 0 rgba(30, 30, 90, .07); transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.gc-stage.wide { width: auto; min-width: 128px; height: 92px; border-radius: 999px; padding: 0 18px; }
.gc:hover .gc-stage { transform: translateY(-4px) scale(1.06) rotate(-2deg); }
.gc-stage .gc-pic { color: #1E2550; max-width: none; }
.gc-stage .gc-pic .art-text, .gc-stage .gc-pic .art-op, .gc-stage .gc-link { color: #1E2550; }
.gc-stage .gc-letter { -webkit-text-stroke-color: #1E2550; font-size: 60px; }
.gc-stage .gc-path { color: #3A2FB8; width: 92px; height: 74px; }
.gc-stage .gc-pic .emoji { font-size: 52px; }
.gc-stage .gc-pic .art-text { font-size: 46px; }
.gc-stage .gc-pic svg.shape, .gc-stage .gc-pic svg.pic { width: 76px; height: 76px; }
.gc-stage .gc-pic .swatch { width: 62px; height: 62px; border-color: rgba(0, 0, 0, .08); }
.gc-stage .gc-pic .art-count { max-width: 96px; }
.gc-stage .gc-pic .art-count .emoji { font-size: 22px; }
.gc-stage .gc-row { gap: 8px; }
.gc-stage .gc-row .emoji { font-size: 38px !important; }
.gc-stage .gc-row .art-text { font-size: 34px !important; }
.gc-stage .gc-row .swatch { width: 38px !important; height: 38px !important; }
.gc-art .flag { left: auto; right: 34px; top: 12px; }
.fan-game .gc-stage { width: 82px; height: 82px; } .fan-game .gc-stage.wide { height: 70px; min-width: 96px; padding: 0 10px; }
.fan-game .gc-pic { transform: scale(.72); }
.fan-game .gc-kind { display: none; }
@media (max-width: 560px) { .gc-art { height: 128px; } .gc-stage { width: 88px; height: 88px; } .gc-stage.wide { height: 74px; min-width: 100px; padding: 0 10px; } .gc-stage .gc-pic { transform: scale(.82); } }

.gc-stage { overflow: hidden; }
.gc-stage .gc-row > .art-count, .gc-stage .gc-row .art-count { flex-wrap: nowrap; max-width: none; }

.gc-stage.wide { max-width: calc(100% - 28px); }
.gc-stage.wide .art-row > .art-text { font-size: 20px !important; padding: 0 4px; }
.gc-stage.wide .art-row > .emoji { font-size: 22px !important; }
.gc-stage.wide svg.shape { width: 48px !important; height: 48px !important; }

@media (max-width: 560px) {
  .viewswitch-row { margin-top: 14px; }
  .viewswitch { display: flex; width: 100%; box-sizing: border-box; }
  .vs-tab { flex: 1 1 0; min-width: 0; justify-content: center; padding: 6px 10px; gap: 6px; font-size: 1rem; min-height: 48px; }
  .vs-tab b { padding: 0 7px; font-size: .8rem; }
}

