/* Topple's styles (moved out of index.html, 6 Oct 2026: the page is served through Functions without compression,
   this file is static, compressed and cached) */
  @font-face { font-family: Fredoka; font-weight: 300 700; font-display: swap; src: url(fonts/fredoka-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
  @font-face { font-family: Fredoka; font-weight: 300 700; font-display: swap; src: url(fonts/fredoka-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
  /* Design tokens (quality sprint, 6 Oct 2026). Direction "domino toybox" (Jev 0.83, DONE): a sky page with a pip-dot
     pattern, a teal felt board, chunky white cards and buttons with a lip, each mode its own colour, Pip on every screen. */
  :root { --bg: #FCF0E4; --dots: rgba(160, 70, 50, .08); --ink: #1F3440; --muted: #536873; --mat: #1E5B57; --mat-2: #174A47; --card: #FFFFFF;
    --line: #EBD6C6; --coral: #F0644F; --coral-d: #C9452F; --gold: #F2B33D; --gold-d: #C98A12; --purple: #8E6BD8; --purple-d: #6748B8;
    --teal: #2A9D8F; --teal-d: #1E7468; --fire: #FF8A3D; --r: 20px; }
  * { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; color: var(--ink); font-family: Fredoka, system-ui, sans-serif;
    background: #1E5B57 radial-gradient(circle, rgba(255, 255, 255, .06) 2.6px, transparent 3px) 0 0 / 30px 30px;
    overscroll-behavior: none; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
  #app { position: relative; max-width: 440px; height: 100vh; height: 100dvh; margin: 0 auto; overflow: hidden; overflow: clip;
    background: var(--bg) radial-gradient(circle, var(--dots) 2px, transparent 2.5px) 0 0 / 22px 22px; }
  @media (min-width: 600px) { #app { height: min(100dvh - 48px, 900px); margin-top: 24px; border-radius: 36px; box-shadow: 0 0 0 10px rgba(255, 255, 255, .08), 0 30px 80px rgba(0, 0, 0, .35); } }
  button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
  .screen { position: absolute; inset: 0; display: none; flex-direction: column; }
  .screen.on { display: flex; animation: enter .26s cubic-bezier(.2, .8, .3, 1); }
  @keyframes enter { from { opacity: 0; transform: translateY(10px); } }
  @media (prefers-reduced-motion: reduce) { .screen.on { animation: none; } }
  .hide { visibility: hidden; }
  svg.i { width: 22px; height: 22px; flex: none; }

  /* buttons: chunky, with a lip that the press pushes down into (every tappable gets one) */
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; padding: 0 22px; border-radius: 16px; font-weight: 700; font-size: 18px;
    letter-spacing: .01em; background: var(--coral); color: #fff; box-shadow: 0 5px 0 var(--coral-d); transition: transform .08s, box-shadow .08s; margin-bottom: 5px; }
  .btn:active { transform: translateY(5px); box-shadow: 0 0 0 var(--coral-d); }
  .btn:disabled { background: #E3EEF2; color: #7D9099; box-shadow: 0 5px 0 #C9DCE3; }
  .btn.ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line), 0 5px 0 var(--line); }
  .btn.ghost:active { box-shadow: inset 0 0 0 2px var(--line), 0 0 0 var(--line); }
  .btn.big { width: 100%; height: 58px; font-size: 20px; }
  .card { background: var(--card); border-radius: var(--r); box-shadow: inset 0 0 0 2px var(--line), 0 5px 0 var(--line); }
  .eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--coral-d); }
  .fine { color: var(--muted); font-size: 12px; text-decoration: none; text-align: center; display: block; margin: 18px 0 6px; }
  input { font: inherit; color: inherit; -webkit-user-select: text; user-select: text; }

  /* home: a top bar of stats, today's picture as the hero, the weekly giant, then the ladder as a domino-chain path */
  #home { padding-top: env(safe-area-inset-top); }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 8px; flex: none; gap: 8px;
    background: rgba(252, 240, 228, .94); box-shadow: 0 2px 0 rgba(160, 70, 50, .08); z-index: 2; }
  .wordmark { display: flex; align-items: center; font-size: 34px; font-weight: 700; color: var(--ink); line-height: 1; letter-spacing: -.01em; }
  .wordmark img { width: 32px; height: 32px; border-radius: 50%; margin: 3px 1px 0; box-shadow: 0 3px 0 var(--coral-d); }
  .chips { display: flex; gap: 6px; align-items: center; }
  .chip { display: inline-flex; align-items: center; gap: 5px; height: 38px; padding: 0 11px 0 8px; border-radius: 14px; font-weight: 700; font-size: 17px; background: #fff;
    box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--line); }
  .chip:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px var(--line); }
  .chip.fire { color: #E8661E; } .chip.fire.cold { color: #8FA3AC; } .chip.fire.cold svg { filter: grayscale(1) opacity(.5); }
  .chip.goldc { color: var(--gold-d); }
  .chip.gear { padding: 0; width: 38px; justify-content: center; color: var(--muted); }
  .hscroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 16px max(24px, env(safe-area-inset-bottom)); scrollbar-width: none; }
  .hscroll::-webkit-scrollbar { display: none; }
  .nook { position: relative; margin: -14px -16px 0; height: var(--nookH, 470px); overflow: hidden; background: #4f1424; }
  #roomCv { position: absolute; left: 0; width: 100%; }
  .nook #dailyThumb { position: absolute; width: auto; height: auto; }
  .nook #homePip { position: absolute; z-index: 1; }
  .nook .say { z-index: 2; }
  .nook-tag { position: absolute; left: 16px; top: 14px; display: flex; flex-direction: column; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
  .nook-tag .eyebrow { color: rgba(255, 255, 255, .85); } .nook-tag b { font-size: 24px; font-weight: 700; } .nook-tag small { font-size: 14px; opacity: .9; }
  .nook-tag small:empty { display: none; }
  .nook-btn { position: relative; margin-top: -34px; z-index: 2; box-shadow: 0 5px 0 var(--coral-d), 0 10px 24px rgba(60, 10, 20, .35); }
  .today { display: flex; gap: 14px; padding: 12px; border-radius: 22px; background: var(--coral); box-shadow: 0 6px 0 var(--coral-d); color: #fff; position: relative; overflow: hidden; }
  .today::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(255, 255, 255, .13) 2.5px, transparent 3px) 0 0 / 20px 20px; pointer-events: none; }
  #dailyThumb { position: relative; width: 112px; height: 132px; flex: none; }
  .tcol { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
  .tcol .eyebrow { color: rgba(255, 255, 255, .85); }
  .tcol b { font-size: 24px; font-weight: 700; line-height: 1.1; }
  .tcol small { font-size: 14px; opacity: .9; } .tcol small:empty { display: none; }
  .btn.light { background: #fff; color: var(--coral-d); box-shadow: 0 5px 0 rgba(0, 0, 0, .18); height: 46px; font-size: 17px; margin-top: 8px; padding: 0 14px; }
  .btn.light:active { box-shadow: 0 0 0 rgba(0, 0, 0, .18); }
  .chapter { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 0; padding: 13px 16px 14px; border-radius: 18px; color: #fff;
    background: var(--teal); box-shadow: 0 5px 0 var(--teal-d); }
  .chapter.c1 { background: var(--purple); box-shadow: 0 5px 0 var(--purple-d); } .chapter.c2 { background: #3F8FD8; box-shadow: 0 5px 0 #2A6DB0; }
  .chapter.c3 { background: var(--coral); box-shadow: 0 5px 0 var(--coral-d); }
  .chapter small { display: block; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
  .chapter b { font-size: 21px; font-weight: 700; }
  .chapter .cnt { font-weight: 700; font-size: 15px; padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, .22); }
  #homePip { position: absolute; width: 112px; height: 112px; cursor: pointer; z-index: 1; }
  #homePip.walk { transition: left .9s cubic-bezier(.4, 0, .3, 1), top .9s cubic-bezier(.4, 0, .3, 1); animation: hop .3s ease-in-out 3; }
  @keyframes hop { 50% { transform: translateY(-14px); } }
  .say { position: absolute; max-width: 180px; padding: 9px 13px; border-radius: 16px; background: #fff; color: var(--ink); z-index: 2;
    font-size: 15px; font-weight: 600; line-height: 1.25; box-shadow: 0 0 0 2px var(--line), 0 4px 0 var(--line); animation: say .5s .5s cubic-bezier(.3, 1.6, .5, 1) both; }
  .say:empty { display: none; }
  @keyframes say { from { opacity: 0; transform: scale(.6); } }
  .tabs { flex: none; display: flex; justify-content: space-around; padding: 8px 8px max(10px, env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -2px 0 var(--line); z-index: 2; }
  .tab { width: 72px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 4px; border-radius: 14px; font-size: 13px; font-weight: 700; color: var(--muted); }
  .tab svg { width: 32px; height: 32px; }
  .tab { position: relative; } .tab em { position: absolute; top: 0; right: 6px; min-width: 22px; padding: 1px 6px; border-radius: 999px; font-style: normal; font-size: 12px; background: var(--ink); color: #fff; }
  .tab.on { background: #E6F4F8; box-shadow: inset 0 0 0 2px #A9D9E6; color: var(--ink); }
  .tab:active { transform: scale(.94); }
  /* the path: nodes wind left and right; little standing dominoes link them like a chain waiting to fall */
  #path { position: relative; margin: 6px -16px 0; }
  .node { position: absolute; width: 74px; height: 84px; margin-left: -37px; border-radius: 18px; display: grid; place-items: center; }
  .node canvas { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); }
  .node.done { background: #fff; box-shadow: inset 0 0 0 2px var(--line), 0 5px 0 var(--line); }
  .node.done:active { transform: translateY(5px); box-shadow: inset 0 0 0 2px var(--line); }
  .node.done.gold { box-shadow: inset 0 0 0 3px var(--gold), 0 5px 0 var(--gold-d); }
  .node.done.gold::after { content: ''; position: absolute; right: -7px; top: -7px; width: 22px; height: 22px; border-radius: 50%; background: var(--gold)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4l2.4 5 5.4.6-4 3.7 1.1 5.4L12 16l-4.9 2.7 1.1-5.4-4-3.7 5.4-.6z' fill='%23fff'/%3E%3C/svg%3E") center / 15px no-repeat; box-shadow: 0 2px 0 var(--gold-d); }
  .node.lock { background: #EAF4F7; box-shadow: inset 0 0 0 2px var(--line), 0 5px 0 var(--line); color: #9AB1BA; font-weight: 700; font-size: 22px; cursor: default; }
  .node.lock.twist { color: var(--purple); background: #F1ECFB; box-shadow: inset 0 0 0 2px #DCD0F5, 0 5px 0 #DCD0F5; }
  #levelBtn.node { width: 96px; height: 108px; margin-left: -48px; background: var(--coral); box-shadow: 0 7px 0 var(--coral-d), 0 0 0 8px rgba(240, 100, 79, .2);
    color: #fff; z-index: 1; }
  #levelBtn.node::before { content: ''; position: absolute; inset: -8px; border-radius: 26px; border: 4px solid var(--coral); opacity: 0; animation: nodering 2.2s ease-out infinite; pointer-events: none; }
  #levelBtn.capped::before { border-color: var(--gold); }
  #levelBtn.node:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--coral-d), 0 0 0 8px rgba(240, 100, 79, .2); }
  #levelBtn .num { display: block; font-size: 38px; font-weight: 700; line-height: 1; margin-top: -4px; }
  #levelBtn .num::after { content: ''; display: block; width: 52px; height: 3px; margin: 9px auto 0; border-radius: 2px; background: rgba(255, 255, 255, .45); }
  #levelBtn .dots { display: flex; gap: 6px; justify-content: center; margin-top: 7px; } #levelBtn .dots i { width: 7px; height: 7px; border-radius: 50%; background: #fff; }
  #levelBtn.capped { background: var(--gold); box-shadow: 0 7px 0 var(--gold-d), 0 0 0 8px rgba(242, 179, 61, .22); }
  .bubble { position: absolute; top: calc(100% + 18px); left: 50%; transform: translateX(-50%); white-space: nowrap; background: #fff; color: var(--coral-d);
    font-size: 15px; font-weight: 700; padding: 8px 14px; border-radius: 14px; box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line); }
  .bubble::after { content: ''; position: absolute; left: 50%; top: -8px; margin-left: -8px; border: 8px solid transparent; border-top: 0; border-bottom-color: #fff; }
  #levelBtn.capped .bubble { white-space: normal; width: 230px; text-align: center; color: var(--gold-d); }
  .link-d { position: absolute; width: 7px; height: 20px; margin: -10px 0 0 -3.5px; border-radius: 3px; background: #A9D0DA; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .1); }
  .link-d.done { background: var(--teal); }
  @keyframes nodering { 0% { opacity: .7; transform: scale(.94); } 70%, 100% { opacity: 0; transform: scale(1.18); } }
  @media (prefers-reduced-motion: reduce) { #levelBtn.node::before { animation: none; } }

  /* sheets: a white card that rises */
  .sheet { position: absolute; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); background: var(--card); border-radius: 28px;
    padding: 22px 20px 16px; box-shadow: inset 0 0 0 2px var(--line), 0 -12px 40px rgba(20, 50, 60, .22); transform: translateY(120%);
    transition: transform .45s cubic-bezier(.2, .9, .25, 1.1); z-index: 3; }
  .sheet.on { transform: none; }
  .sheet h2 { margin: 4px 0 6px; font-size: 30px; font-weight: 700; }
  .sheet p { margin: 0 0 18px; color: var(--muted); font-size: 16px; line-height: 1.35; }
  .btns { display: flex; gap: 10px; } .btns .btn { flex: 1; }
  .sheet .tip { margin: -8px 0 16px; padding: 10px 12px; border-radius: 14px; background: #FFF1E2; color: var(--ink); font-size: 15px; }
  .sheet .tip:empty { display: none; }
  .sheet.win { left: 0; right: 0; top: 0; bottom: 0; border-radius: 0; padding: max(28px, env(safe-area-inset-top)) 22px max(18px, env(safe-area-inset-bottom));
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; transform: translateY(100%); box-shadow: none; overflow: hidden;
    background: linear-gradient(#2F7FD9, #58A9F2 55%, #8CCBFF); color: #fff; }
  .sheet.win.gold { background: linear-gradient(#F08A1C, #F7A93A 50%, #FFD47A); }
  .sheet.win.daily { background: linear-gradient(#E8504A, #F6765A 50%, #FFB089); }
  .sheet.win.daily.gold { background: linear-gradient(#E8504A, #F7884A 45%, #FFC66B); }
  .sheet.win.weekly { background: linear-gradient(#6A45C8, #8E6BD8 55%, #B9A0F2); }
  .sheet.win > :not(.sky) { position: relative; z-index: 1; }
  .sky { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
  .sky .floaty { animation: floaty 4s ease-in-out infinite; } .sky .twinkle { animation: twinkle 2.2s ease-in-out infinite; }
  @keyframes floaty { 50% { transform: translateY(-10px); } } @keyframes twinkle { 50% { opacity: .35; } }
  @media (prefers-reduced-motion: reduce) { .sky .floaty, .sky .twinkle { animation: none; } }
  .sheet.win h2, .sheet.win .ribbon .eyebrow, .sheet.win.gold .ribbon .eyebrow { color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, .12); }
  .sheet.win .ribbon .eyebrow { opacity: .9; }
  .sheet.win p#winStats { color: rgba(255, 255, 255, .92); font-weight: 600; }
  .sheet.win .winframe { background: #fff; box-shadow: 0 7px 0 rgba(0, 0, 0, .14), 0 18px 40px rgba(0, 0, 0, .18); margin-top: 124px; }
  .sheet.win.gold .winframe { background: linear-gradient(145deg, #FFE08A, #F2B33D); box-shadow: 0 7px 0 #C98A12, 0 18px 40px rgba(0, 0, 0, .2); }
  .sheet.win .btn.ghost { background: #fff; color: var(--muted); box-shadow: 0 5px 0 rgba(0, 0, 0, .14); flex: 0 0 auto; }
  .sheet.win #nextBtn { background: #fff; color: var(--ink); box-shadow: 0 5px 0 rgba(0, 0, 0, .14); }
  .sheet.win.on { transform: none; }
  .sheet.win .ribbon { margin: 0; padding: 0; background: none; box-shadow: none; }
  .sheet.win .ribbon .eyebrow { color: var(--teal-d); font-size: 15px; }
  .sheet.win h2 { font-size: 40px; margin: 2px 0 0; }
  .pills { display: flex; gap: 8px; margin: 8px 0 12px; flex-wrap: wrap; }
  .pills span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 12px; background: #EAF5F8; font-weight: 700; font-size: 16px; color: var(--ink); }
  .pills span i { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-style: normal; color: #fff; font-size: 13px; }
  .pills .dom i { background: var(--teal); } .pills .one i { background: var(--gold); } .pills .again i { background: #9AB1BA; }
  .winframe { position: relative; margin: 16px auto 0; padding: 10px; border-radius: 20px; background: #EAF4F7; box-shadow: 0 6px 0 var(--line); }
  .sheet.win.gold .winframe { background: linear-gradient(145deg, #FFD36B, #F2A21C); box-shadow: 0 7px 0 #D9861A, 0 18px 40px rgba(240, 160, 40, .35); }
  #winPic { display: block; width: min(62vw, 250px); aspect-ratio: 12 / 14; border-radius: 10px; }
  .sheet.win .pills { justify-content: center; margin: 22px 0 10px; }
  .sheet.win .pills span { flex-direction: column; gap: 2px; width: 100px; padding: 0 0 10px; border-radius: 16px; background: #fff; overflow: hidden; font-size: 22px; box-shadow: inset 0 0 0 2.5px var(--teal), 0 5px 0 rgba(0, 0, 0, .12); }
  .sheet.win .pills span i { width: 100%; height: auto; border-radius: 0; padding: 5px 0 4px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; margin-bottom: 4px; }
  .sheet.win .pills .one { box-shadow: inset 0 0 0 2.5px var(--gold); } .sheet.win .pills .again { box-shadow: inset 0 0 0 2.5px #9AB1BA; }
  .sheet.win .pills .streak { box-shadow: inset 0 0 0 2.5px var(--fire); } .sheet.win .pills .streak i { background: var(--fire); }
  .sheet.win p#winStats { margin: 0 0 10px; }
  .sheet.win .btns { width: 100%; margin-top: 18px; }
  .ribbon { margin: -22px -20px 14px; padding: 12px 20px 11px; border-radius: 26px 26px 0 0; background: var(--teal); box-shadow: inset 0 -4px 0 var(--teal-d); }
  .ribbon .eyebrow { color: #fff; font-size: 14px; }
  .sheet.fail .ribbon { background: var(--coral); box-shadow: inset 0 -4px 0 var(--coral-d); }
  .sheet.win h2 { font-size: 34px; line-height: 1.05; }
  .sheet.win p#winStats { margin-bottom: 16px; }

  /* game */
  header { display: flex; align-items: center; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) 12px 0; height: 66px; flex: none; gap: 8px; }
  .icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; color: var(--ink); background: #fff; flex: none; position: relative;
    box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--line); margin-bottom: 3px; }
  .icon:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px var(--line); }
  .icon.off { color: #9AB1BA; }
  .icon.off .on-only, .icon:not(.off) .off-only { display: none; }
  .icon svg { width: 22px; height: 22px; }
  .icon .badge { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--coral); color: #fff; font-size: 8px; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff; }
  .hd { text-align: center; line-height: 1.15; flex: 1; min-width: 0; }
  .hd b { display: block; font-size: 20px; font-weight: 700; }
  .hd small { color: var(--muted); font-size: 13px; font-weight: 600; }
  .prog { display: block; height: 10px; margin: 5px auto 1px; max-width: 150px; border-radius: 5px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); overflow: hidden; }
  .prog i { display: block; height: 100%; width: 0; border-radius: 5px; background: var(--teal); box-shadow: inset 0 -3px 0 var(--teal-d), inset 0 2px 0 rgba(255, 255, 255, .35); transition: width .3s cubic-bezier(.3, 1.4, .5, 1); }
  .tools { display: flex; gap: 8px; }
  .icon b { font-size: 21px; font-weight: 600; }
  #cv { flex: 1; width: 100%; min-height: 0; touch-action: none; display: block; }
  #pipCv { position: absolute; width: 96px; height: 96px; cursor: pointer; z-index: 2; }
  #pipCv.onsheet { z-index: 4; transition: top .5s cubic-bezier(.3, 1.5, .5, 1), left .5s cubic-bezier(.3, 1.5, .5, 1); }
  /* hints are Pip's speech bubble: it sits over the empty tray, its tail points at him */
  #hint { position: absolute; left: 120px; top: 70%; width: 250px; min-height: 52px; display: flex; flex-direction: column; justify-content: center;
    background: var(--ink); color: #fff; border-radius: 16px; padding: 8px 12px; font-size: 15px; line-height: 1.28; text-wrap: pretty; opacity: 0; pointer-events: none;
    transform: translateY(6px) scale(.96); transform-origin: 0 50%; transition: opacity .25s, transform .3s cubic-bezier(.2, .9, .3, 1.3);
    box-shadow: 0 8px 24px rgba(46, 38, 34, .25); z-index: 2; }
  #hint::before { content: ''; position: absolute; left: -7px; top: 50%; margin-top: -7px; border: 7px solid transparent; border-left: 0; border-right-color: var(--ink); }
  #hint.on { opacity: 1; transform: none; }
  #hint[data-more]:not([data-more=""])::after { content: attr(data-more); margin-top: 3px; font-size: 13px; color: rgba(255, 255, 255, .6); }
  /* when the tray is the subject, the bubble sits above it and points down at Pip */
  #hint.up { transform-origin: 24px 100%; }
  #hint.up::before { left: 18px; top: auto; bottom: -7px; margin-top: 0; border: 7px solid transparent; border-bottom: 0; border-top-color: var(--ink); }
  /* tutorial: a dim with soft holes over everything but the subject, and the pointing hand (Jev: hand 0.76, paw 0.15) */
  #dim { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity .3s; z-index: 1; }
  #dim.on { opacity: 1; }
  #hand { position: absolute; width: 46px; height: 54px; margin: -2px 0 0 -19px; pointer-events: none; opacity: 0; transition: opacity .25s; z-index: 2; }
  #hand.on { opacity: 1; }
  #hand svg { display: block; width: 100%; height: 100%; overflow: visible; transform-origin: 19px 2px; filter: drop-shadow(0 4px 6px rgba(46, 38, 34, .3)); }
  #hand.tap svg { animation: tap 1.2s ease-in-out infinite; }
  #hand.tap::after { content: ''; position: absolute; left: 1px; top: -16px; width: 36px; height: 36px; box-sizing: border-box; border-radius: 50%;
    border: 3px solid #fff; opacity: 0; animation: ripple 1.2s ease-out infinite; }
  #hand.swipe svg { animation: swipe 1.7s ease-in-out infinite; }
  @keyframes tap { 0%, 100% { transform: translate(9px, 13px) rotate(-10deg); } 40%, 52% { transform: rotate(-10deg) scale(.92); } }
  @keyframes ripple { 0%, 40% { opacity: 0; transform: scale(.3); } 46% { opacity: .9; transform: scale(.45); } 85%, 100% { opacity: 0; transform: scale(1.4); } }
  @keyframes swipe { 0% { opacity: 0; transform: translate(8px, 14px) rotate(-10deg); } 16% { opacity: 1; transform: rotate(-10deg) scale(.92); }
    66% { opacity: 1; transform: translateX(var(--dx, 70px)) rotate(-10deg) scale(.92); }
    86%, 100% { opacity: 0; transform: translate(calc(var(--dx, 70px) + 10px), 14px) rotate(-10deg); } }
  @media (prefers-reduced-motion: reduce) { #hand svg, #hand::after { animation: none !important; } }
  .how { list-style: none; margin: 4px 0 18px; padding: 0; display: grid; gap: 12px; }
  .how li { display: flex; align-items: center; gap: 14px; font-size: 16px; line-height: 1.3; }
  .how canvas { width: 84px; height: 56px; flex: none; border-radius: 14px; background: var(--bg); }
  #ad { position: absolute; inset: 0; background: rgba(30, 24, 20, .92); color: #fff; display: none; place-items: center; text-align: center; padding: 40px; z-index: 5; }
  #ad.on { display: grid; }
  #ad small { opacity: .6; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; }
  #ad b { display: block; font-size: 72px; margin: 6px 0; }
  #ad p { opacity: .7; margin: 0; }
  #adSkip { margin-top: 24px; }

  /* Settings and 'Keep my progress' (pass 1): the save code carries progress to another browser */
  .code { font-weight: 600; letter-spacing: .06em; color: var(--ink); white-space: nowrap; }
  .codebox { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 10px; padding: 10px 14px; border-radius: 14px; background: #FBEDE0; }
  .codebox small { color: var(--muted); font-size: 14px; }
  .codebox b { font-size: 24px; font-weight: 600; letter-spacing: .08em; }
  .sheet #keepText { color: var(--ink); font-size: 19px; line-height: 1.3; margin-bottom: 14px; }
  #keepLink, #codeIn { width: 100%; height: 44px; padding: 0 12px; border-radius: 12px; border: 1.5px solid rgba(46, 38, 34, .14); background: #fff; }
  #keepLink { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
  .sheet p.small { font-size: 14px; margin-bottom: 16px; }
  .coderow { display: flex; gap: 8px; margin-bottom: 18px; } .coderow input { flex: 1; min-width: 0; } .coderow .btn { flex: none; }
  #codeIn:not(:placeholder-shown) { text-transform: uppercase; letter-spacing: .06em; }

  /* weekly giant */
  #wkCv { flex: 1; width: 100%; min-height: 0; display: block; }
  .wkfoot { display: flex; align-items: flex-end; gap: 10px; padding: 0 16px max(16px, env(safe-area-inset-bottom)); }
  #weekPip { width: 104px; height: 104px; flex: none; }
  .wkfoot > div { flex: 1; padding-bottom: 6px; }
  .wkfoot p { margin: 0 0 10px; color: var(--muted); font-size: 15px; line-height: 1.3; }
  .wkfoot .btn { width: 100%; }

  /* gallery */
  #gallery { padding: max(12px, env(safe-area-inset-top)) 0 0; }
  #gallery header { padding: 0 16px; margin-bottom: 6px; justify-content: flex-start; gap: 12px; height: 56px; }
  #gallery h2 { margin: 0; font-size: 26px; font-weight: 700; }
  #gallery header small { margin-left: auto; }
  #galleryGrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 14px; overflow-y: auto; padding: 10px 16px 28px; align-content: start; flex: 1; scrollbar-width: none; }
  figure { margin: 0; background: #fff; border-radius: 20px; padding: 10px 10px 8px; box-shadow: inset 0 0 0 2px var(--line), 0 5px 0 var(--line); position: relative; }
  figure canvas { width: 100%; aspect-ratio: 12 / 15; display: block; }
  figure.gold { box-shadow: inset 0 0 0 3px var(--gold), 0 5px 0 var(--gold-d); }
  figure.gold::after { content: ''; position: absolute; right: -6px; top: -6px; width: 26px; height: 26px; border-radius: 50%; background: var(--gold)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4l2.4 5 5.4.6-4 3.7 1.1 5.4L12 16l-4.9 2.7 1.1-5.4-4-3.7 5.4-.6z' fill='%23fff'/%3E%3C/svg%3E") center / 17px no-repeat; box-shadow: 0 2px 0 var(--gold-d); }
  figure.locked { background: #EAF4F7; }
  figure.locked canvas { opacity: .55; }
  figure.giant { grid-column: 1 / -1; } figure.giant canvas { aspect-ratio: 1 / 2; } /* a 24 x 42 giant gets the full width */
  figure.replay { cursor: pointer; } /* finished without gold: a tap replays it for the gold frame */
  figure.replay:active { transform: translateY(5px); box-shadow: inset 0 0 0 2px var(--line); }
  figure.replay figcaption::after { content: 'Replay for gold'; display: inline-block; margin-top: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--gold-d); background: #FFF3D6; }
  figcaption { text-align: center; font-size: 15px; font-weight: 600; margin-top: 6px; }
  figure.locked figcaption { color: #8FA3AC; }
  #toast { position: absolute; top: 74px; left: 50%; transform: translate(-50%, -8px); background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 999px;
    font-size: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 6; white-space: nowrap; }
  #toast.on { opacity: 1; transform: translate(-50%, 0); }
