:root {
  --cream: #fbfaf7; --paper: #fff; --navy: #102d48; --teal: #087d91;
  --teal-light: #ddf3f1; --muted: #637b92; --line: #e3eaeb; --warm: #f0bd69;
  --focus: #b36b26; --nav-height: 72px;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--navy); background: var(--cream); font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-height: 100%; scroll-padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 24px); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100svh; isolation: isolate; }
button, a, svg [role=button] { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
button[aria-disabled=true] { cursor: default; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, a:focus-visible, svg [role=button]:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
a { color: inherit; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1100px; margin-inline: auto; padding-inline: 32px; }
.background-waves { position: absolute; z-index: -1; top: 48px; inset-inline: 0; height: 210px; overflow: hidden; pointer-events: none; opacity: .76; }
.background-waves svg { width: 100%; height: 100%; display: block; }
.site-header { display: flex; align-items: center; justify-content: space-between; padding-block: 19px 21px; gap: 25px; }
.brand { display: flex; flex-direction: column; align-items: center; width: 340px; max-width: 100%; flex-shrink: 0; text-decoration: none; }
.brand img { width: 100%; height: auto; display: block; object-fit: contain; }
.brand-tagline { color: var(--muted); font-size: 13px; letter-spacing: 2px; margin-top: 7px; }
.desktop-nav { display: flex; align-items: center; gap: 23px; }
.desktop-nav button { min-width: 48px; min-height: 44px; padding: 8px 4px; border-bottom: 3px solid transparent; background: transparent; font-size: 14px; }
.desktop-nav button[aria-current=page] { color: var(--teal); border-color: var(--teal); font-weight: 600; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; }
.intro, .page-intro { padding-block: 26px 25px; }
.intro h1, .page-intro h1 { font-size: clamp(29px, 4vw, 42px); line-height: 1.15; letter-spacing: -1px; margin: 0; }
.intro h1:after, .page-intro h1:after { content: ""; display: block; width: 42px; height: 4px; border-radius: 3px; background: #8dd6d1; margin-top: 10px; }
.intro-copy, .page-intro > p { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 12px 0 0; }
.home-activities { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; max-width: 760px; margin: 0 auto 24px; }
.home-card, .activity-card { position: relative; border: 1px solid #e6eeee; border-radius: 22px; background: var(--paper); box-shadow: 0 8px 24px #163c4e0b; overflow: hidden; }
.home-card { min-height: 194px; padding: 25px; }
.home-card-play, .memory-preview { background: linear-gradient(120deg, #fff 0%, #fff 50%, #e8f8f7 66%, #ccefed 100%); }
.home-card:before, .activity-card:before { content: ""; position: absolute; width: 70%; height: 180%; right: -20%; top: 15%; background: #9ededd26; border-radius: 48%; transform: rotate(30deg); pointer-events: none; }
.home-card-copy { position: relative; z-index: 1; width: 74%; }
.home-card h2 { display: flex; align-items: center; gap: 10px; font-size: 34px; line-height: 1.2; margin: 0 0 11px; letter-spacing: -.7px; }
.home-card h2 > svg { width: 24px; height: 25px; flex-shrink: 0; fill: #168da0; }
.home-card p { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0 0 13px; max-width: 245px; }
.home-card-art { position: absolute; right: -2px; bottom: -2px; width: 195px; height: 180px; pointer-events: none; opacity: .98; }
.home-card-art > svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 4px #13394c15); }
.home-card-link { position: absolute; inset: 0; z-index: 2; background: transparent; border-radius: inherit; padding: 0; }
.home-card-link:focus-visible { outline-offset: -5px; }
.card-arrow { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 50%; background: #fffdfbdc; position: absolute; right: 13px; top: calc(50% - 18px); color: var(--navy); }
.card-arrow svg { width: 19px; height: 19px; }
.home-card-link:hover .card-arrow { background: #fff; transform: translateX(2px); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-height: 27px; padding: 5px 11px; border-radius: 20px; font-size: 12px; line-height: 1.2; white-space: nowrap; }
.free-badge { background: #d0f3eb; color: #146873; }
.count-badge { background: #e9eff8; color: #607b9b; }
.extras-divider { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; color: #7c8ca1; font-size: 12px; letter-spacing: .7px; margin: 4px 0 -2px; }
.extras-divider:before, .extras-divider:after { content: ""; height: 1px; flex: 1; background: #e0e8eb; }
.home-card-more { grid-column: 1 / -1; min-height: 108px; padding: 19px 27px; background: #ffffffb8; }
.home-card-more:before { display: none; }
.home-card-more .home-card-art { left: 24px; right: auto; bottom: 18px; width: 68px; height: 68px; }
.home-card-more .home-card-copy { margin-left: 88px; width: calc(100% - 140px); }
.home-card-more h2 { font-size: 25px; margin-bottom: 6px; }
.home-card-more p { margin: 0; max-width: none; font-size: 14px; }
.preview-label { font-size: 12px; color: var(--muted); }
.reassurance { grid-column: 1 / -1; text-align: center; color: #7a90a5; font-size: 13px; line-height: 1.5; margin: 3px 0 0; }
.reassurance:before { content: ""; display: inline-block; width: 10px; height: 14px; border-radius: 9px 1px 9px 1px; background: #95cfd1; transform: rotate(-28deg); vertical-align: -2px; margin-right: 8px; }
.studio { margin-bottom: 24px; }
.activity-welcome { max-width: 760px; }
.activity-card { min-height: 252px; padding: 27px; }
.activity-card-copy { position: relative; z-index: 1; width: 69%; }
.activity-card h2 { font-size: clamp(26px, 3.7vw, 34px); letter-spacing: -.8px; line-height: 1.15; margin: 0 0 10px; }
.activity-card p { font-size: 15px; line-height: 1.5; color: var(--muted); margin: 0 0 13px; }
.activity-card-art { position: absolute; right: -8px; top: 20px; width: 245px; height: 218px; pointer-events: none; }
.activity-card-art svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 5px 4px #163c4e15); }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 46px; border-radius: 26px; padding: 11px 22px; color: #fff; background: linear-gradient(130deg, #168ca0, #086b85); font-size: 15px; font-weight: 500; white-space: nowrap; box-shadow: 0 3px 6px #123d4c0b; }
.primary-button:hover { background: #066c82; }
.primary-button > svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.activity-card .primary-button { min-width: 146px; margin-top: 18px; }
.activity-welcome > .reassurance { margin-top: 20px; }
.workspace { border: 1px solid #e6eded; border-radius: 20px; background: #ffffffec; padding: 22px; box-shadow: 0 8px 25px #153b4e07; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -8px 0 16px; border-bottom: 1px solid #e8eeee; padding-bottom: 7px; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 2px; background: transparent; font-size: 13px; font-weight: 500; }
.text-button > span { font-size: 19px; line-height: 1; }
.play-layout { display: grid; grid-template-columns: 255px minmax(0, 1fr); gap: 38px; }
.activity-info h2 { font-size: 29px; letter-spacing: -.7px; line-height: 1.15; margin: 0 0 10px; }
.activity-info > p { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 22px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-size: 13px; font-weight: 500; margin-bottom: 9px; padding: 0; width: 100%; }
.difficulty-field { margin-bottom: 22px; }
.difficulty-options { display: flex; gap: 4px; padding: 4px; border: 1px solid #dce7e7; border-radius: 12px; }
.difficulty-options button { flex: 1; min-height: 54px; padding: 7px 4px; border-radius: 9px; background: transparent; font-size: 14px; }
.difficulty-options button span { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.difficulty-options button[aria-pressed=true] { background: #dff1ec; color: #146873; }
.game-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid #e4eceb; padding-top: 17px; }
.game-stats span { display: block; font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.7px; }
.game-stats small { display: block; color: var(--muted); font-size: 11px; margin-top: 6px; }
.activity-info .gentle-note { font-size: 12px; margin-top: 22px; }
.game-area { align-self: center; min-width: 0; }
.board-topline { display: flex; justify-content: space-between; gap: 10px; align-items: center; color: var(--muted); font-size: 10px; letter-spacing: 1.1px; margin: 0 0 12px; line-height: 1.4; }
.board-topline span:last-child { font-size: 12px; letter-spacing: 0; }
.game-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.game-board[data-difficulty=hard] { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.memory-card { position: relative; display: block; width: 100%; aspect-ratio: 1.1; border-radius: 11px; padding: 0; background: transparent; perspective: 800px; scroll-margin-block: 22px calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 24px); }
.card-inner { position: absolute; inset: 0; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; transition: transform .28s ease; }
.memory-card.is-flipped .card-inner, .memory-card.is-matched .card-inner { transform: rotateY(180deg); }
.card-back, .card-front { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 11px; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 1px solid #bcdbd8; }
.card-back { background: linear-gradient(145deg, #e3f5f0, #c7e8e2); box-shadow: inset 0 0 0 4px #e8f6f0; }
.card-back:before { content: ""; position: absolute; inset: 8px; border: 1px solid #c0ddd5; border-radius: 5px; }
.card-back svg { width: 32%; height: 45%; stroke: #4e9c99; fill: none; opacity: .72; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.card-front { transform: rotateY(180deg); background: #fff5e3; border-color: #e2d8bc; }
.card-front svg { width: 52%; height: 65%; stroke: var(--navy); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.memory-card.is-matched .card-front { background: #e9f4e7; border-color: #b2d5b9; }
.memory-card.is-matched:after { content: "✓"; position: absolute; top: 4px; right: 6px; color: #3a755f; font-size: 10px; }
.memory-card:hover:not(.is-flipped):not(.is-matched) .card-back { background: #d2ece4; }
.game-status { color: #287b83; font-size: 13px; line-height: 1.5; min-height: 20px; text-align: center; margin: 15px 0 5px; overflow-wrap: anywhere; }
.keyboard-hint, .gentle-note { font-size: 11px; line-height: 1.5; color: var(--muted); text-align: center; margin: 0; }
.win-message { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; margin-top: 14px; border: 1px solid #c6ddc5; background: #edf5e8; border-radius: 12px; }
.win-message strong { font-family: Georgia, serif; font-size: 24px; font-weight: 500; }
.win-message p { color: var(--muted); font-size: 12px; margin: 5px 0 0; }
.win-message .primary-button { padding: 10px 16px; font-size: 13px; }
.packs { max-width: 760px; margin-bottom: 30px; }
.packs-preview { background: linear-gradient(115deg, #fff 0%, #fff 49%, #e8f6f5 75%, #cfedeb 100%); }
.packs-preview .activity-card-art { width: 155px; height: 155px; top: 30px; right: 15px; }
.coming-soon { display: inline-flex; align-items: center; min-height: 42px; margin-top: 17px; padding: 10px 17px; background: #e9f0ee; border: 1px solid #d6e6e2; border-radius: 23px; color: #5b7a7f; font-size: 13px; }
.packs-preview .preview-label { margin: 10px 0 0; font-size: 12px; }
.packs > .reassurance { margin-top: 21px; }
.bottom-nav { display: none; }
footer { padding-block: 14px 24px; color: #70869a; font-size: 11px; line-height: 1.5; }
footer p { margin: 6px 0 0; font-size: 11px; }
.skip-link { position: fixed; left: 12px; top: -100px; z-index: 20; padding: 12px 17px; border-radius: 7px; color: #fff; background: var(--navy); }
.skip-link:focus { top: max(10px, env(safe-area-inset-top, 0px)); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
@media (max-width: 950px) {
  .wrap { padding-inline: 24px; }
  .brand { width: 300px; }
  .desktop-nav { gap: 15px; }
  .play-layout { grid-template-columns: 224px minmax(0, 1fr); gap: 25px; }
  .workspace { padding: 20px; }
  .game-board { gap: 8px; }
  .game-board[data-difficulty=hard] { gap: 6px; }
}
@media (max-width: 730px) {
  body { padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 16px); }
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .site-header { display: block; padding-top: max(12px, env(safe-area-inset-top, 0px)); padding-bottom: 13px; }
  .brand { gap: 4px; width: 288px; margin-inline: auto; text-align: center; }
  .brand-tagline { font-size: 12px; letter-spacing: 1.8px; margin-top: 3px; }
  .desktop-nav { display: none; }
  .background-waves { top: 72px; height: 150px; opacity: .7; }
  .intro, .page-intro { padding-block: 17px 19px; }
  .intro h1 { font-size: clamp(24px, 6.6vw, 31px); letter-spacing: -.8px; }
  .page-intro h1 { font-size: 32px; }
  .intro h1:after, .page-intro h1:after { width: 34px; height: 3px; margin-top: 9px; }
  .intro-copy { display: none; }
  .page-intro > p { font-size: 14px; margin-top: 10px; }
  .home-activities { grid-template-columns: 1fr; gap: 14px; margin-bottom: 15px; }
  .home-card { min-height: 133px; padding: 18px; border-radius: 19px; }
  .home-card h2 { font-size: 28px; margin-bottom: 7px; gap: 9px; }
  .home-card h2 > svg { width: 21px; height: 23px; }
  .home-card p { font-size: 14px; margin-bottom: 11px; max-width: 230px; }
  .home-card-copy { width: 78%; }
  .home-card-art { width: 130px; height: 126px; bottom: -3px; right: 0; }
  .badge { font-size: 11px; min-height: 25px; padding: 5px 10px; }
  .badges { gap: 6px; }
  .card-arrow { right: 12px; width: 33px; height: 33px; top: calc(50% - 16px); }
  .extras-divider { font-size: 11px; gap: 10px; margin: 3px 0 -1px; }
  .home-card-more { min-height: 91px; padding: 15px 18px; }
  .home-card-more .home-card-art { left: 13px; bottom: 13px; width: 60px; height: 60px; }
  .home-card-more .home-card-copy { margin-left: 66px; width: calc(100% - 88px); }
  .home-card-more h2 { font-size: 20px; margin-bottom: 4px; }
  .home-card-more p { font-size: 12px; line-height: 1.45; }
  .home-card-more .preview-label { font-size: 11px; }
  .reassurance { font-size: 12px; margin-top: 2px; }
  .activity-card { min-height: 221px; padding: 22px 19px; border-radius: 20px; }
  .activity-card-copy { width: 72%; }
  .activity-card h2 { font-size: 27px; }
  .activity-card p { font-size: 14px; }
  .activity-card-art { right: -11px; top: 21px; width: 162px; height: 170px; opacity: .95; }
  .activity-card .primary-button { min-width: 144px; margin-top: 16px; font-size: 15px; }
  .workspace { padding: 15px 14px; border-radius: 18px; }
  .editor-toolbar { margin: -8px 0 11px; padding-bottom: 2px; gap: 7px; }
  .text-button { font-size: 12px; }
  .play-layout { grid-template-columns: 1fr; gap: 14px; }
  .activity-info h2 { font-size: 23px; margin-bottom: 5px; }
  .activity-info > p { font-size: 13px; margin-bottom: 13px; }
  .activity-info .gentle-note { display: none; }
  .difficulty-field { margin-bottom: 11px; }
  legend { font-size: 12px; margin-bottom: 7px; }
  .difficulty-options { padding: 3px; }
  .difficulty-options button { font-size: 13px; min-height: 46px; }
  .difficulty-options button span { font-size: 10px; margin-top: 3px; }
  .game-stats { padding-top: 9px; }
  .game-stats span { font-size: 21px; }
  .game-stats small { font-size: 10px; margin-top: 3px; }
  .board-topline { font-size: 9px; letter-spacing: .7px; margin-bottom: 9px; }
  .board-topline span:last-child { font-size: 11px; }
  .game-board { gap: 8px; }
  .game-board[data-difficulty=hard] { grid-template-columns: repeat(6,minmax(0,1fr)); gap: 6px; }
  .memory-card { aspect-ratio: 1.05; border-radius: 9px; }
  .game-board[data-difficulty=hard] .memory-card { aspect-ratio: 1; }
  .card-back, .card-front { border-radius: 9px; }
  .card-back:before { inset: 6px; border-radius: 4px; }
  .game-status { font-size: 12px; margin-top: 12px; }
  .keyboard-hint { font-size: 10px; }
  .win-message { padding: 11px; }
  .win-message strong { font-size: 21px; }
  .win-message p { font-size: 10px; }
  .win-message .primary-button { font-size: 12px; padding: 10px 13px; }
  .packs-preview .activity-card-art { width: 106px; height: 110px; right: 10px; top: 25px; opacity: .9; }
  .packs-preview .activity-card-copy { width: 80%; }
  .packs-preview h2 { font-size: 27px; }
  .packs-preview .preview-label { font-size: 12px; }
  .coming-soon { font-size: 13px; margin-top: 16px; }
  .bottom-nav { display: flex; position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; justify-content: space-around; min-height: var(--nav-height); padding-top: 7px; padding-left: max(8px,env(safe-area-inset-left,0px)); padding-right: max(8px,env(safe-area-inset-right,0px)); padding-bottom: calc(7px + env(safe-area-inset-bottom,0px)); background: #fffefcf2; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid #e4ebed; border-radius: 19px 19px 0 0; box-shadow: 0 -4px 20px #18384a06; }
  .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 58px; min-height: 55px; padding: 3px 12px 7px; gap: 3px; color: #6c839e; background: transparent; font-size: 11px; position: relative; }
  .bottom-nav svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .bottom-nav button[aria-current=page] { color: #08778d; }
  .bottom-nav button[aria-current=page]:after { content: ""; position: absolute; height: 3px; border-radius: 3px; width: 30px; bottom: 0; background: #1b9aa7; }
  footer { padding-block: 13px 18px; text-align: center; font-size: 10px; }
  footer p { font-size: 10px; }
  body[data-mode=activity] .site-header { padding-top: max(9px,env(safe-area-inset-top,0px)); padding-bottom: 7px; }
  body[data-mode=activity] .brand { width: 220px; gap: 0; }
  body[data-mode=activity] .brand-tagline { display: none; }
  body[data-mode=activity] .background-waves { top: 15px; height: 100px; opacity: .5; }
  body[data-mode=activity] .page-intro { padding-block: 9px 12px; }
  body[data-mode=activity] .page-intro h1 { font-size: 25px; letter-spacing: -.5px; }
  body[data-mode=activity] .page-intro h1:after { margin-top: 6px; width: 27px; }
  body[data-mode=activity] .page-intro > p { display: none; }
  body[data-mode=activity] footer { display: none; }
}
@media (max-width: 374px) {
  /* Keep short status messages from shrinking the page while cards are used. */
  #game-status { min-height: 3em; }
  .brand { width: 264px; }
  .brand-tagline { font-size: 11px; letter-spacing: 1.5px; }
  .home-card { padding: 16px; min-height: 138px; }
  .home-card-art { width: 110px; height: 117px; right: -2px; }
  .home-card p { max-width: 195px; font-size: 13px; }
  .home-card-copy { width: 83%; }
  .badge { padding-inline: 8px; font-size: 10px; }
  .home-card-more { min-height: 101px; padding: 14px; }
  .home-card-more .home-card-copy { margin-left: 57px; width: calc(100% - 76px); }
  .home-card-more .home-card-art { width: 51px; height: 55px; left: 11px; bottom: 22px; }
  .home-card-more h2 { font-size: 19px; }
  .home-card-more p { font-size: 11px; }
  .card-arrow { right: 9px; width: 29px; height: 29px; }
  .activity-card h2 { font-size: 24px; }
  .activity-card p { font-size: 13px; }
  .activity-card-art { width: 143px; right: -18px; opacity: .85; }
  .game-board[data-difficulty=hard] { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
  .bottom-nav button { min-width: 56px; font-size: 11px; padding-inline: 10px; }
}
@media (max-height: 650px) and (max-width: 730px) {
  body[data-mode=browse] .brand { width: 240px; }
  body[data-mode=browse] .site-header { padding-bottom: 8px; }
  body[data-mode=browse] .intro, body[data-mode=browse] .page-intro { padding-block: 12px 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { transition: none !important; scroll-behavior: auto !important; }
}
