:root {
  --activity-ink: #183b56;
  --activity-muted: #526b7f;
  --activity-paper: #fffdf8;
  --activity-surface: #ffffff;
  --activity-border: #d9e4e8;
  --activity-blue: #2871b8;
  --activity-blue-soft: #eaf4fb;
  --activity-green: #4c7a5d;
  --activity-shadow: 0 12px 32px rgb(34 57 71 / 8%);
}

.activity-library-main { width: min(100% - 32px, 1160px); margin: 28px auto 56px; color: var(--activity-ink); }
.activity-library-main > .eyebrow { margin-bottom: 5px; }
.activity-title-row { display:flex; width:fit-content; max-width:100%; align-items:center; gap:clamp(12px,3vw,32px); }
.activity-library-main > .activity-title-row h1 { width:fit-content; margin:0; padding:4px 14px 8px 0; border-radius:16px; background:linear-gradient(90deg,#fff1c8 0%,#fff1c8 62%,transparent 100%); color:#254d6a; font-size:clamp(2rem,4vw,3rem); letter-spacing:-.035em; }
.activity-title-art { flex:0 0 clamp(74px,10vw,112px); width:clamp(74px,10vw,112px); height:auto; filter:drop-shadow(0 3px 2px rgb(38 66 58 / 12%)); }
.activity-library-main > .lead { max-width: 720px; margin: 10px 0 16px; color: var(--activity-muted); font-size: 1.12rem; line-height: 1.55; }
.activity-language-note { max-width: 920px; margin: 18px 0 28px; padding: 12px 16px; border-left: 4px solid #d79a3f; border-radius: 0 10px 10px 0; background: #fff7e7; color: #394b59; line-height: 1.5; }
.activity-library { padding: clamp(16px, 3vw, 30px); border: 1px solid #e4e6dc; border-radius: 22px; background: linear-gradient(150deg,#fffefa,#f9fcf4); box-shadow: var(--activity-shadow); }
.activity-library-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.activity-library-heading-row .eyebrow { margin: 0 0 4px; color: var(--activity-green); }
.activity-library-heading-row h2 { margin: 0; font-size: clamp(1.4rem, 2.5vw, 2rem); }
.activity-count { margin: 0 0 4px; color: var(--activity-muted); font-size: .95rem; }
.activity-category-list { display: flex; flex-wrap: wrap; gap: 9px; margin: 20px 0 22px; padding: 4px 0 12px; border-bottom: 1px solid var(--activity-border); }
.activity-category-list [role="tab"] { min-width: 94px; min-height: 48px; padding: 9px 18px; border: 1px solid #d8dfd7; border-radius: 14px; background: #fff; color: #31556d; font: inherit; font-weight: 750; cursor: pointer; box-shadow: 0 2px 5px rgb(34 57 71 / 5%); }
.activity-category-list [role="tab"][aria-selected="true"] { border-color: #478a68; background: #e7f4e8; color: #245b42; box-shadow: inset 0 0 0 1px #478a68; }
.activity-category-list [role="tab"]:focus-visible,.activity-card-preview:focus-visible,.activity-print-button:focus-visible,.activity-close-button:focus-visible,.activity-quantity-control select:focus-visible { outline: 3px solid #e49b27; outline-offset: 3px; }
.activity-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 20px; }
.activity-card { min-width: 0; overflow: hidden; border: 1px solid #e6e6dd; border-radius: 18px; background: var(--activity-surface); box-shadow: 0 5px 16px rgb(49 68 51 / 6%); transition: box-shadow .16s ease, transform .16s ease; }
.activity-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgb(34 57 71 / 10%); }
.activity-card-preview { position:relative; isolation:isolate; display: grid; box-sizing: border-box; width: 100%; height: 232px; overflow: hidden; place-items: center; padding: 25px 18px 29px; border: 0; border-bottom: 1px solid #e9edef; background:linear-gradient(155deg,#fff7e4,#f2f8ee 65%,#eaf5f2); cursor: pointer; }
.activity-card-preview[data-activity-type="coloring_page"] { background:linear-gradient(145deg,#fff0d4,#fff9ed 46%,#eaf6e8); }
.activity-card-preview[data-activity-type="coloring_page"]::before,.activity-card-preview[data-activity-type="coloring_page"]::after { position:absolute; z-index:0; color:#e6a943; font-size:25px; line-height:1; opacity:.82; pointer-events:none; }
.activity-card-preview[data-activity-type="coloring_page"]::before { content:"✿"; top:12px; left:14px; }
.activity-card-preview[data-activity-type="coloring_page"]::after { content:"✦"; top:18px; right:16px; color:#82af78; font-size:22px; }
.activity-card-preview[data-activity-type="number_tracing"] { background:radial-gradient(circle at 12% 18%,#ffe3a7 0 7px,transparent 8px),radial-gradient(circle at 88% 82%,#ccead5 0 10px,transparent 11px),linear-gradient(145deg,#edf6ff,#fffaf0 60%,#f2edff); }
.activity-card-art { position:relative; z-index:1; display:grid; width:100%; height:100%; place-items:center; }
.activity-garden-decoration { position:absolute; z-index:0; inset:0; overflow:hidden; pointer-events:none; }
.activity-garden-decoration svg { position:absolute; inset:auto 0 0; display:block; width:100%; height:42%; overflow:visible; }
.garden-cloud { fill:#fffdf6; stroke:#d6e4df; stroke-width:2; }
.garden-hill { fill:#dceecf; }
.garden-grass { fill:#c8e4ba; }
.garden-flower path { fill:none; stroke:#65966d; stroke-width:2.5; stroke-linecap:round; }
.garden-flower circle:not(:last-child) { fill:#f3a5a0; stroke:#d77979; stroke-width:1.5; }
.garden-flower-two circle:not(:last-child) { fill:#f2c76a; stroke:#d8a848; }
.activity-card-art svg,.activity-card-art img { display:block; width:100%; height:100%; max-width:100%; max-height:100%; object-fit:contain; }
.activity-card-art svg { filter:drop-shadow(0 3px 1px rgb(32 52 59 / 10%)); }
.activity-card-preview[data-activity-type="coloring_page"] .activity-card-art img { width:94%; height:94%; filter:drop-shadow(0 3px 2px rgb(54 69 47 / 13%)); }
.activity-card-preview[data-activity-type="coloring_page"] .activity-card-art svg { width:94%; height:96%; padding:3px; border:1px solid rgb(219 192 142 / 55%); border-radius:13px; background:#fffdf8; filter:drop-shadow(0 4px 3px rgb(54 69 47 / 17%)); }
.activity-card-preview[data-activity-type="number_tracing"] .activity-card-art svg { filter:drop-shadow(0 3px 2px rgb(44 88 142 / 18%)); }
.activity-card[data-activity-detail="pattern-mixed-review"] .activity-card-art svg { transform:scale(.84); }
.activity-card-unavailable { display: flex; box-sizing: border-box; width: 100%; height: 240px; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 18px; border: 0; border-bottom: 1px solid #e9edef; background: #f5f6f4; color: #526b7f; text-align: center; }
.activity-card-unavailable strong { color: #183b56; }
.activity-card-unavailable span { max-width: 28ch; font-size: .9rem; line-height: 1.45; }
.activity-card[data-activity-type="shape_matching"] .activity-card-preview,.activity-card[data-activity-detail="count-number-sets"] .activity-card-preview { height: 260px; }
.activity-card-preview img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.activity-card-details { display: flex; min-height: 195px; flex-direction: column; padding: 16px 17px 17px; }
.activity-card-category { width: fit-content; padding: 4px 9px; border-radius: 999px; background: #eff6ee; color: #3e694b; font-size: .78rem; font-weight: 750; }
.activity-card h3 { margin: 10px 0 6px; color: #285673; font-size: 1.15rem; line-height: 1.3; }
.activity-card-details > p { margin: 0; color: var(--activity-muted); font-size: .95rem; line-height: 1.45; }
.activity-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 14px; }
.activity-difficulty { color: #667986; font-size: .82rem; }
.activity-card-action { border: 0; padding: 5px 0; background: transparent; color: #155f9d; font: inherit; font-size: .9rem; font-weight: 800; white-space: nowrap; cursor: pointer; }
.activity-card-action { min-height: 40px; padding: 7px 12px; border-radius: 10px; background:#e7f3fa; }
.activity-card-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.activity-card-action:focus-visible { outline: 3px solid #e49b27; outline-offset: 3px; border-radius: 3px; }
.activity-privacy-note { margin: 24px 0; color: var(--activity-muted); font-size: .95rem; }

.activity-preview-dialog { width: min(900px, calc(100vw - 28px)); max-width: 900px; max-height: min(92vh, 1040px); padding: clamp(18px, 3vw, 32px); overflow: auto; border: 1px solid var(--activity-border); border-radius: 20px; background: #fffdf8; color: var(--activity-ink); box-shadow: 0 28px 90px rgb(15 39 55 / 30%); }
.activity-preview-dialog::backdrop { background: rgb(20 38 51 / 58%); backdrop-filter: blur(2px); }
.activity-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.activity-dialog-header .eyebrow { margin: 0; color: var(--activity-green); }
.activity-close-button { width: 44px; height: 44px; border: 1px solid var(--activity-border); border-radius: 50%; background: white; color: var(--activity-ink); font-size: 1.5rem; cursor: pointer; }
.activity-preview-dialog h2 { margin: 6px 0 6px; font-size: clamp(1.55rem, 3vw, 2.2rem); }
.activity-objective { margin: 0 0 10px; color: var(--activity-muted); font-size: 1.05rem; line-height: 1.5; }
.activity-preview-instructions { margin: 14px 0; padding: 12px 15px; border: 1px solid #dbe8ef; border-radius: 10px; background: #f2f8fb; color: #253f50; font-weight: 700; line-height: 1.5; }
.activity-quantity-control { display: flex; width: fit-content; align-items: center; gap: 10px; margin: 12px 0; font-weight: 750; }
.activity-quantity-control[hidden] { display: none; }
.activity-quantity-control select { min-width: 80px; min-height: 44px; padding: 6px 10px; border: 1px solid #a9bfcd; border-radius: 8px; background: #fff; color: var(--activity-ink); font: inherit; }
.activity-artwork-variant-control { display: flex; width: fit-content; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; font-weight: 750; }
.activity-artwork-variant-control[hidden] { display: none; }
.activity-artwork-variant-control select { min-width: 190px; min-height: 44px; padding: 6px 10px; border: 1px solid #a9bfcd; border-radius: 8px; background: #fff; color: var(--activity-ink); font: inherit; }
.activity-preview-art { display: grid; min-height: 320px; max-height: 54vh; place-items: center; overflow: auto; padding: clamp(12px, 2vw, 22px); border: 1px solid #dfe6e3; border-radius: 14px; background: white; }
.activity-preview-art .activity-outline { display: block; width: 100%; height: auto; max-height: 50vh; object-fit: contain; }
.activity-preview-art .activity-raster-outline { display: block; width: auto; height: auto; max-width: 100%; max-height: 50vh; object-fit: contain; }
.activity-preview-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; }
.activity-preview-footer .activity-difficulty { margin: 0; font-size: .95rem; }
.activity-print-button { min-height: 50px; padding: 12px 22px; border: 0; border-radius: 12px; background: #246eb2; color: white; font: inherit; font-weight: 800; box-shadow: 0 5px 12px rgb(36 110 178 / 18%); cursor: pointer; }
.activity-print-button:hover { background: #185b98; }
.activity-print-button:disabled { opacity: .55; cursor: wait; }
.activity-loading { color: var(--activity-muted); }

@media (max-width: 900px) { .activity-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .activity-library-main { width: min(100% - 20px, 1160px); margin-top: 18px; }
  .activity-title-row { position:relative; display:block; width:100%; min-height:68px; padding-right:58px; }
  .activity-library-main > .activity-title-row h1 { max-width:100%; padding-right:0; font-size:clamp(1.55rem,7.3vw,2.1rem); line-height:1.12; }
  .activity-title-art { position:absolute; top:0; right:0; width:54px; }
  .activity-library { padding: 15px 12px; border-radius: 16px; }
  .activity-library-heading-row { align-items: start; flex-direction: column; gap: 4px; }
  .activity-category-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 7px; margin: 14px 0 16px; }
  .activity-category-list [role="tab"] { min-width: 0; min-height: 46px; padding: 7px 4px; font-size: .82rem; }
  .activity-gallery { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .activity-card { display: grid; grid-template-columns: minmax(108px, 38%) minmax(0, 1fr); }
  .activity-card-preview { height: 100%; min-height: 205px; padding: 20px 9px; border-right: 1px solid #e9edef; border-bottom: 0; }
  .activity-card-preview[data-activity-type="coloring_page"]::before,.activity-card-preview[data-activity-type="coloring_page"]::after { display:none; }
  .activity-card-preview[data-activity-type="coloring_page"] .activity-card-art img { width:100%; height:96%; }
  .activity-card-preview[data-activity-type="coloring_page"] .activity-card-art svg { width:100%; height:96%; }
  .activity-card-unavailable { height: 100%; min-height: 205px; padding: 10px; border-right: 1px solid #e9edef; border-bottom: 0; }
  .activity-card[data-activity-type="shape_matching"] .activity-card-preview,.activity-card[data-activity-detail="count-number-sets"] .activity-card-preview { height: 100%; min-height: 205px; }
  .activity-card-details { min-height: 185px; padding: 12px 11px; }
  .activity-card h3 { font-size: 1rem; }
  .activity-card-details > p { font-size: .88rem; }
  .activity-card-footer { align-items: start; flex-direction: column; gap: 8px; }
  .activity-preview-dialog { width: calc(100vw - 16px); max-height: 94vh; padding: 16px 12px; border-radius: 16px; }
  .activity-preview-art { min-height: 230px; max-height: 46vh; padding: 8px; }
  .activity-preview-art .activity-outline { max-height: 43vh; }
  .activity-preview-art .activity-raster-outline { max-height: 43vh; }
  .activity-preview-footer { align-items: stretch; flex-direction: column; }
  .activity-print-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .activity-card { transition: none; } .activity-card:hover { transform: none; } }
