/* Trick or Treat: a trick-or-treat bag on a front doorstep at night. The page is dark night paper with a
   porch light printed as red halftone and cut-paper jack-o'-lanterns on the step; the sheet and the bag are
   paper as everywhere else. The sweets are the one thing that isn't paper: real gummies (assets/js/gummy),
   only in the two inks (blood red, black licorice) and clear ice for a loose sweet. */

body[data-game="treat"] {
  --tt-kraft: #bd9154;
  --tt-night: #191314;
  /* the table (the cloth and glass are drawn in .tt-night) */
  background-color: #102a2e;
  background-image: var(--fibers-soft, none), var(--noise);
  background-attachment: fixed;
}
body[data-game="treat"]::before { display: none; }
/* every gummy button here in the bag's red-marker hand (the horror games' default, Slice o Paper, is hard to read through candy) */
body[data-game="treat"] gummy-button { --font-display: var(--font-hand); }
body[data-game="treat"] .topbar, body[data-game="treat"] .stage { position: relative; z-index: 2; }
body[data-game="treat"] .topbar { position: sticky; z-index: 3; }   /* above the page, so the clouds' lobes cover its cut edge */
body[data-game="treat"] { --clip-extra: -9px; }   /* the page is cut up between the clouds' lobes, not at their tips */
body[data-game="treat"] .clouds { display: block; --cloud-front: #14242c; --cloud-back: #1b323d; --cloud-front-edge: var(--cloud-front-night); --cloud-back-edge: var(--cloud-back-night); --cloud-shadow: rgba(0, 0, 0, 0.35); }
body[data-game="treat"] .icon-btn svg { stroke: var(--paper); }
body[data-game="treat"] .icon-btn:hover { background: rgba(241, 234, 216, 0.12); }
body[data-game="treat"] .game-tab:not(.active) { opacity: 0.7; }
body[data-game="treat"] .game-tab:not(.active):hover, body[data-game="treat"] .game-tab:not(.active):focus-visible { opacity: 1; filter: none; }
/* no divider under the top bar here: the night sky runs straight up to it */
body[data-game="treat"] .topbar::before { display: none; }
body[data-game="treat"] .topbar::after { display: none; }
body[data-game="treat"] .topbar { margin-bottom: 40px; }   /* a clear gap between the clouds and the sweets spilling over the bag */
body[data-game="treat"] .stage { padding-bottom: 20px; }

/* ---------- the backdrop: a street on Halloween night (drawn in treat.js, STREET) ---------- */
.tt-night { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background: #1d3440; }
.tt-street, .tt-street svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* the gummy jack-o'-lanterns: one candy body with its face printed on (it squashes with the candy), a
   licorice stem; poke them */
.tt-pumpkin { position: absolute; bottom: 4vh; width: clamp(110px, 16vw, 210px); aspect-ratio: 120 / 110; z-index: 5; --gummy-pattern: plain; --gummy-ground: #2c2b30; }
.tt-pumpkin.left { left: clamp(10px, 6vw, 110px); rotate: -6deg; }
.tt-pumpkin.right { right: clamp(10px, 6vw, 110px); bottom: 3vh; width: clamp(92px, 13vw, 170px); rotate: 5deg; }
/* the little purple one, tucked in to the right of the orange one */
.tt-pumpkin.mid { left: calc(clamp(10px, 6vw, 110px) + clamp(110px, 16vw, 210px) - 14px); bottom: 7vh; width: clamp(64px, 8vw, 112px); rotate: 7deg; z-index: 4; }
@media (max-width: 1250px) { .tt-pumpkin.mid { display: none; } }   /* only where there's room beside the bag */
.tt-pumpkin gummy-sweet { position: absolute; pointer-events: auto; cursor: pointer; }
.tt-pumpkin-body { left: 3%; top: 16%; --sweet-w: 94%; --sweet-h: 82%; }
.tt-pumpkin-stem { left: 46%; top: 1%; --sweet-w: 10%; --sweet-h: 24%; rotate: 14deg; z-index: 1; transition: translate .7s cubic-bezier(.3, 1.9, .5, 1); }
.tt-pumpkin.pressed .tt-pumpkin-stem { translate: 0 30%; transition-duration: .09s; transition-timing-function: ease-out; }
.tt-defs { position: absolute; }


/* ---------- the bag: title, date and how to play, all on one kraft paper bag ---------- */
/* An open trick-or-treat bag standing on the doorstep: its top pinked (the zigzag is cut by script, see
   pink() in treat.js), its bottom flat, gusset creases down both sides and a folded base. Candy is heaped in
   its mouth behind the front, so only the tops show over the zigzag. Gummies on the bag refract the kraft. */
.tt-card { margin-top: 64px; }   /* room for the bag's back panel rising behind the front */
/* the bag in the round: the inside of its back panel rises behind the candy (darker, in shadow), the front's
   sides turn away into shaded gussets, its top edge folds over, and it casts a shadow on the doorstep */
.tt-bagwrap { position: relative; isolation: isolate; }
.tt-bagwrap > .sheet { position: relative; z-index: 1; }
/* seen from a little above: the back panel stands well back (inset and higher than the front), and the two inside
   walls show between them, the left lit, the right in shadow */
.tt-bagback {
  position: absolute; left: 5%; right: 5%; top: -50px; height: 96px; z-index: -1;
  background: linear-gradient(180deg, #96703f 0%, #7a5530 45%, #5e4022 100%), var(--noise);
  background-blend-mode: multiply;
}
.tt-bagside { position: absolute; top: -50px; width: 5%; height: 96px; z-index: -1; }
.tt-bagside.l { left: 0; clip-path: polygon(0 50px, 100% 0, 100% 100%, 0 100%);
  background: linear-gradient(90deg, #b48650 0%, #9a7040 100%), var(--noise); background-blend-mode: multiply; }
.tt-bagside.r { right: 0; clip-path: polygon(0 0, 100% 50px, 100% 100%, 0 100%);
  background: linear-gradient(90deg, #5a3d20 0%, #6e4c2a 100%), var(--noise); background-blend-mode: multiply; }
.tt-bagwrap::after {
  content: ''; position: absolute; left: 1%; right: -3%; bottom: -14px; height: 26px; z-index: -1;
  background: radial-gradient(ellipse 50% 40% at 50% 30%, rgba(6, 4, 4, 0.75), rgba(6, 4, 4, 0) 70%),
    radial-gradient(ellipse 52% 60% at 56% 50%, rgba(6, 4, 4, 0.35), rgba(6, 4, 4, 0) 75%);
}
.tt-spill { position: absolute; inset: 0; pointer-events: none; container-type: inline-size; --gummy-pattern: plain; --gummy-ground: #2b4a4f; }
.tt-spill.in { z-index: 0; }
.tt-spill gummy-sweet { position: absolute; pointer-events: auto; }
.sheet.tt-sheet {
  --tt-kraft-sheet: #d3b382;
  --gummy-pattern: plain;
  --gummy-ground: #d3b382;
  background-color: var(--tt-kraft-sheet);
  background-image:
    linear-gradient(0deg, rgba(120, 80, 36, 0.2) 0 16px, rgba(120, 80, 36, 0.34) 16px 18px, transparent 18px),
    linear-gradient(180deg, rgba(70, 44, 18, 0.32) 0, rgba(70, 44, 18, 0.12) 10px, transparent 22px),
    linear-gradient(90deg, rgba(70, 44, 18, 0.2) 0, rgba(70, 44, 18, 0.09) 4%, transparent 7%, transparent 93%, rgba(70, 44, 18, 0.07) 96%, rgba(70, 44, 18, 0.16) 100%),   /* the sides turning away, lightly */
    var(--fibers-soft, none), var(--noise);
  padding-top: 22px; padding-bottom: 28px;
}
/* the name, drawn on the bag in red marker, with the issue and date under it */
/* the name on a strip of masking tape stuck across the bag */
.tt-title { margin: 0 auto; width: fit-content; text-align: center; line-height: 1; rotate: -0.8deg; position: relative; isolation: isolate; padding: 6px 30px 4px; }
.tt-title::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: rgba(236, 226, 196, 0.82);
  background-image: linear-gradient(90deg, rgba(255,255,255,0.22), rgba(0,0,0,0.05) 60%, rgba(255,255,255,0.14));
  clip-path: polygon(1.5% 0, 3.5% 12%, 1.5% 25%, 4% 40%, 1% 55%, 3.5% 72%, 1.5% 88%, 3% 100%, 97% 100%, 99% 86%, 96.5% 70%, 98.5% 55%, 96% 40%, 98.5% 24%, 96.5% 10%, 98.5% 0);
  filter: drop-shadow(0 1px 1px rgba(60, 40, 20, 0.18));
}
.tt-word { font-family: var(--font-hand); font-size: 2.7rem; color: var(--ink-1); letter-spacing: 0.04em; text-transform: uppercase; }
.tt-or { font-family: var(--font-hand); font-size: 1.5rem; color: var(--ink-2); margin: 0 0.35em; }
.tt-issue { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 18px 0 12px; color: var(--ink-2); }   /* the pill sits clear of the title's tape */
/* between the title block and how to play: just a little space (a fold line made the bag look folded flat) */
.tt-divider { height: 8px; margin: 0 0 6px; }
.tt-issue gummy-sweet { --sweet-font: 400 18px/1 'Wee Bairn', sans-serif; letter-spacing: 0.04em; }
.sheet.tt-sheet .fine { color: rgba(28, 23, 23, 0.7); }
.tt-sheet .lede { text-align: center; margin: 0 0 6px; }
.tt-sheet .rules { margin-block: 0 22px; }
.tt-sheet .rules li { margin-bottom: 6px; }
/* a red gumdrop instead of the scissors on each rule */
.tt-sheet .rules li::before { content: none; }
.tt-sheet .rules li > gummy-sweet { position: absolute; left: 3px; top: 8px; }
.tt-begin { height: 54px; margin-bottom: 18px; --font-display: var(--font-hand); }   /* the bag's own red-marker hand, readable through the candy */
.tt-begin::part(hit) { font-size: 25px; letter-spacing: 0.02em; padding: 0 28px; }
.tt-sheet .fine { margin: 4px 0 8px; }

/* the demo: four loose sweets, then a little paper bag label once they're all picked */
.tt-demo { margin: 0 auto 18px; text-align: center; }
.tt-demo-label { margin: 0 0 6px; font-family: var(--font-type); font-size: 0.9rem; color: var(--ink-2); opacity: 0.8; }
/* the sweets and the bagged strip share one spot, so nothing below moves when one swaps for the other */
.tt-demo-line { display: grid; place-items: center; height: 74px; }   /* fixed, so the sweets swapping for the strip never nudges the text below */
.tt-demo-line > * { grid-area: 1 / 1; }
.tt-demo-line > [hidden] { display: none; }
.tt-demo-strip { width: min(100%, 460px); animation: tt-tag-hang .35s ease both; }
.tt-demo-chips {
  display: flex; gap: 8px; flex-wrap: nowrap; justify-content: center;   /* the four in one row */
  /* character names on the wrappers in typewriter type, so they read exactly */
  --font-display: var(--font-type);
}

/* shorter windows (a 1024 x 768 laptop): the same bag, packed a little tighter so it fits without scrolling */
@media (max-height: 820px) and (min-width: 521px) {
  .tt-card { margin-top: 56px; }
  .sheet.tt-sheet { padding-top: 16px; padding-bottom: 20px; }
  .tt-word { font-size: 2.3rem; }
  .tt-or { font-size: 1.3rem; }
  .tt-issue { margin: 14px 0 6px; }
  .tt-divider { height: 22px; margin-bottom: 8px; }
  .tt-sheet .rules { margin-block: 0 16px; }
  .tt-sheet .rules li { margin-bottom: 2px; }
  .tt-begin { height: 50px; }
}

@media (max-width: 520px) {
  .tt-pumpkin { display: none; }   /* no room beside the sheet on a phone */
  .sheet.tt-sheet { padding-top: 18px; padding-bottom: 22px; }
  .tt-card { margin-top: 42px; }
  .tt-issue { margin: 12px 0 4px; }
  .tt-divider { height: 18px; margin-bottom: 4px; }
  .tt-demo { margin-bottom: 2px; }
  .tt-demo-label { margin-bottom: 4px; font-size: 0.82rem; }
  .tt-sheet .rules { margin-block: 0 14px; }
  .tt-sheet .rules li { padding-top: 4px; padding-bottom: 4px; line-height: 1.4; }
  .tt-sheet .fine { margin: 2px 0 6px; }
  .tt-word { font-size: 2.1rem; }
  .tt-or { font-size: 1.2rem; }
  .tt-begin { height: 48px; }
  .tt-begin::part(hit) { font-size: 22px; }
  .tt-demo-chips { gap: 5px; }
  .tt-demo-line { height: 90px; }   /* the strip's titles wrap to two lines on a phone */
  .tt-demo-chips gummy-chip { --_fs: 11.5px; --_px: 8px; --_h: 36px; }
  .tt-sheet .lede { font-size: 1.2rem; }
  .tt-sheet .rules li { margin-bottom: 4px; }
}

/* ---------- the board ---------- */
/* The same kraft paper as the bag: the issue and the candies left at the top, any villain sighting, the
   bagged fours as labelled strips, the loose sweets (gummy chips with character names) in a 4 x 4 grid,
   and the controls along the bottom. */
.tt-board-card { margin-top: 26px; max-width: 760px; }
.sheet.tt-board { padding: 30px 30px 26px; }
.tt-board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tt-board-head .tt-issue { margin: 0; justify-content: flex-start; }
.tt-lives { display: flex; align-items: center; gap: 8px; font-family: var(--font-type); font-size: 0.85rem; color: var(--ink-2); }
.tt-candies { display: flex; gap: 6px; --gummy-pattern: plain; --gummy-ground: #d3b382; }
.tt-candies gummy-sweet { transition: opacity .4s, scale .5s; }
.tt-row { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 12px 7px; text-align: center;
  background: #e3cb9f; box-shadow: 0 2px 0 rgba(70, 44, 18, 0.3); clip-path: polygon(0 0, 100% 0, 99% 100%, 1% 100%); }   /* pale kraft: the writing stands out */
.tt-row b { font-family: var(--font-hand); font-size: 1.3rem; font-weight: normal; color: var(--ink-1); line-height: 1; }
.tt-row span { font-family: var(--font-type); font-size: 0.85rem; color: var(--ink-2); }
.tt-row.peeked b::after { content: ' ½'; color: var(--ink-2); }
.tt-row.missed { background: rgba(227, 203, 159, 0.55); }
.tt-row.missed b { color: var(--ink-2); }
/* the peeks: kraft gift tags, the same pale kraft and eyelet as the "next bag in" tag. On a narrow screen they lie
   on the sidewalk under the bag; on a wide one they hang down the bag's right side under that tag, each held on by
   its own staple. */
.tt-hint-tags { position: relative; z-index: 2; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 16px; margin: 18px auto 0; max-width: 92%; }
.tt-hint-tags:empty { display: none; }
.tt-hint-tag { position: relative; width: max-content; max-width: 100%; rotate: -3deg; animation: tt-tag-drop .5s cubic-bezier(.3, 1.5, .5, 1) both;
  filter: drop-shadow(0 1px 0 rgba(60, 35, 10, .22)) drop-shadow(0 4px 3px rgba(0, 0, 0, .18)); }
.tt-hint-face { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 16px 8px 28px; color: var(--ink-2);
  background: linear-gradient(100deg, rgba(255, 240, 210, 0.16), transparent 45%), var(--fibers-soft, none), #e3cb9f;
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, .45), inset 0 -2px 0 rgba(90, 55, 20, .22);
  clip-path: polygon(15px 0, 100% 0, 100% 100%, 15px 100%, 0 50%); }
.tt-hint-face::before { content: ''; position: absolute; left: 7px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; border-radius: 50%;
  background: radial-gradient(circle, #1d3440 0 3.3px, rgba(0,0,0,.35) 3.6px, #ecd7a8 4.2px 6px, #a8804a 6.4px 7.5px);
  box-shadow: 0.5px 1px 1px rgba(60, 35, 10, .35); }
.tt-hint-face span { font-family: var(--font-hand); font-size: 0.95rem; line-height: 1; white-space: nowrap; }
.tt-hint-face b { font-family: var(--font-hand); font-size: 1.35rem; font-weight: normal; color: var(--ink-1); line-height: 1.05; text-align: center; }
.tt-hint-tag .tt-staple { display: none; }
@keyframes tt-tag-drop { from { opacity: 0; translate: 0 -16px; rotate: 6deg; } to { opacity: 1; translate: 0 0; rotate: -3deg; } }
@media (min-width: 1081px) {
  .tt-board-card .tt-hint-tags { position: absolute; z-index: 3; top: 124px; left: calc(100% - 14px); width: 190px; max-width: none; margin: 0;
    flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: 16px; }
  /* each hangs from its staple, tipped down like the countdown tag above, a degree or two apart so they look hand-pinned */
  .tt-board-card .tt-hint-tag { rotate: 9deg; transform-origin: 6px 50%; animation-name: tt-tag-hang; }
  .tt-board-card .tt-hint-tag:nth-child(2n) { rotate: 11deg; }
  .tt-board-card .tt-hint-tag:nth-child(3n) { rotate: 7.5deg; }
  .tt-board-card .tt-hint-tag .tt-staple { display: block; left: 9px; top: 50%; margin-top: -10px; }
  .tt-board-card .tt-hint-face b { max-width: 150px; white-space: normal; }
}
@keyframes tt-tag-hang { from { opacity: 0; translate: 0 -10px; } to { opacity: 1; translate: 0 0; } }
.tt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 12px;
  --font-display: var(--font-type); --gummy-pattern: plain; --gummy-ground: #d3b382; }
.tt-grid:empty { display: none; }
.tt-grid gummy-chip { width: 100%; --_h: 92px; --_fs: 15px; --_px: 12px; --_radius: 24px; }
/* a bagged strip spans the grid and stands exactly as tall as the row of sweets it took the place of */
.tt-grid > .tt-row { grid-column: 1 / -1; height: 92px; box-sizing: border-box; justify-content: center; }
/* film titles are longer than the names that used to be here: they wrap onto two lines inside the sweet */
.tt-grid gummy-chip::part(hit) { white-space: normal; line-height: 1.08; text-align: center; }
.tt-grid gummy-chip::part(label) { text-wrap: balance; }
@keyframes tt-shake { 0%, 100% { translate: 0 0; } 20% { translate: -6px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 3px 0; } }
.tt-shake { animation: tt-shake .45s ease-in-out; }
.tt-controls { display: flex; flex-wrap: nowrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 22px; }
.tt-tools { display: flex; flex-wrap: nowrap; gap: 10px; }
.tt-bagit { margin-left: auto; flex: none; }
/* the helpers match Bag them: same height, same hand lettering */
.tt-bagit, .tt-tool { --font-display: var(--font-hand); }
.tt-bagit::part(hit) { font-size: 22px; padding: 0 26px; }
.tt-tool::part(hit) { font-size: 19px; padding: 0 16px; }
.tt-end { text-align: center; margin-top: 22px; }   /* clear of the strips above */
.tt-end:empty { display: none; }
@media (max-width: 520px) {
  .sheet.tt-board { padding: 18px 12px 16px; }
  .tt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 8px; }   /* two columns: full titles fit */
  .tt-grid gummy-chip { --_h: 76px; --_fs: 14px; --_radius: 20px; }
  .tt-grid > .tt-row { height: calc(76px * 2 + 7px); }   /* on phones a flavour's four sweets fill two rows */
  /* phones: the three helpers share a row, Bag them runs full width under them */
  .tt-controls { flex-direction: column; align-items: stretch; gap: 8px; }
  .tt-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .tt-tool, .tt-bagit { width: 100%; margin-left: 0; }
  .tt-tool::part(hit) { font-size: 15px; padding: 0 4px; }
}

/* ---------- the results: your haul ---------- */
.tt-results-card { margin-top: 26px; max-width: 640px; }
.sheet.tt-results { padding: 24px 28px 26px; }
.tt-score-row { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin: 6px 0 10px; }
/* the score on a strip of masking tape (like the titles), so the red reads on the kraft */
.tt-score { display: flex; align-items: baseline; gap: 8px; position: relative; isolation: isolate; padding: 5px 16px 3px; rotate: -1deg; }
.tt-score::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: rgba(236, 226, 196, 0.85);
  background-image: linear-gradient(90deg, rgba(255,255,255,0.22), rgba(0,0,0,0.05) 60%, rgba(255,255,255,0.14));
  clip-path: polygon(3% 0, 6% 14%, 2% 30%, 6% 48%, 2% 66%, 5% 84%, 2% 100%, 98% 100%, 95% 84%, 99% 66%, 95% 48%, 99% 30%, 95% 14%, 98% 0);
  filter: drop-shadow(0 1px 1px rgba(60, 40, 20, 0.18));
}
.tt-big { font-family: 'Archivo Black', sans-serif; font-size: 2rem; line-height: 1; color: var(--ink-1); }
.tt-of { font-family: 'Archivo Black', sans-serif; font-size: 1.4rem; color: var(--ink-2); }
.tt-marks { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; --gummy-pattern: plain; --gummy-ground: #d3b382; }
/* a peeked flavour scores half: half a star over a faint whole one */
.tt-half { position: relative; display: inline-block; width: var(--s, 30px); height: var(--s, 30px); }
.tt-half-fill { position: absolute; left: 0; top: 0; width: calc(var(--s, 30px) / 2); height: var(--s, 30px); overflow: hidden; }
/* each flavour in the review starts with its gummy */
.tt-mark { display: inline-flex; align-items: center; align-self: center; translate: 0 -2px; width: 22px; justify-content: center; --gummy-pattern: plain; --gummy-ground: #e3cb9f; }
.tt-review { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.tt-film-review header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; padding: 6px 12px 5px; background: #e3cb9f;
  box-shadow: 0 2px 0 rgba(70, 44, 18, 0.35); clip-path: polygon(0 0, 100% 0, 99.5% 100%, 0.5% 100%); }
.tt-film-review header b { font-family: var(--font-hand); font-size: 1.3rem; font-weight: normal; color: var(--ink-1); line-height: 1; }
.tt-year { font-family: var(--font-type); font-size: 0.85rem; color: var(--ink-2); }
.tt-status { margin-left: auto; font-family: 'Archivo Black', sans-serif; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.tt-film-review.missed header { background: rgba(227, 203, 159, 0.55); }
.tt-film-review.missed header b { color: var(--ink-2); }
.tt-film-review ul { list-style: none; margin: 8px 0 0; padding: 0 4px; display: flex; flex-direction: column; gap: 5px; }
.tt-film-review li { font-size: 0.9rem; line-height: 1.4; color: var(--ink-2); }
.tt-film-review li b { color: var(--ink-2); font-family: var(--font-type); }   /* black: red is hard to read on the kraft */
.tt-results-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 18px; margin: 6px 0 14px; }
.tt-results-foot .tt-score-row { justify-content: flex-start; margin: 0; }
.tt-results-foot .tt-copy { margin: 0 0 0 auto; }
@media (max-width: 520px) {
  .sheet.tt-results { padding: 18px 14px 20px; }
  .tt-big { font-size: 1.8rem; }
}

/* ---------- the countdown: a kraft gift tag tied to the bag's top corner ---------- */
.tt-card { position: relative; }
.tt-next { position: absolute; z-index: 3; top: 8px; left: calc(100% - 14px); width: 150px; pointer-events: none; transform-origin: 6px 6px; rotate: 9deg; }
/* the tag hangs from its eyelet, turned a little away from us so it has some depth, lifted off the bag by its shadow */
.tt-next-tag { position: absolute; left: 0; top: 6px; transform-origin: 12px 50%; transform: perspective(420px) rotateY(-16deg) rotate(2deg);
  filter: drop-shadow(0 1px 0 rgba(60, 35, 10, .22)) drop-shadow(0 4px 3px rgba(0, 0, 0, .18)); }   /* a soft shadow straight down, none to the side */
.tt-next-face { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 13px 9px 26px; color: var(--ink-2);
  /* pale kraft with the bag's grain, lit a little from the left */
  background: linear-gradient(100deg, rgba(255, 240, 210, 0.16), transparent 45%), var(--fibers-soft, none), #e3cb9f;   /* the pale kraft of the film labels: reads light on the dark table */
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, .45), inset 0 -2px 0 rgba(90, 55, 20, .22);
  clip-path: polygon(15px 0, 100% 0, 100% 100%, 15px 100%, 0 50%); }
/* a punched eyelet with a pale reinforcing ring; the hole shows the dark tablecloth behind */
.tt-next-face::before { content: ''; position: absolute; left: 7px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; border-radius: 50%;
  background: radial-gradient(circle, #133437 0 3.3px, rgba(0,0,0,.35) 3.6px, #ecd7a8 4.2px 6px, #a8804a 6.4px 7.5px);
  box-shadow: 0.5px 1px 1px rgba(60, 35, 10, .35); }
.tt-next-face span { font-family: var(--font-hand); font-size: 1rem; line-height: 1; white-space: nowrap; }
.tt-next-face b { font-family: 'Archivo Black', sans-serif; font-weight: normal; font-size: 1.15rem; letter-spacing: .05em; color: var(--ink-1); font-variant-numeric: tabular-nums; line-height: 1; }
@media (max-width: 1080px) { .tt-next { display: none; } }

/* ---------- the archive ---------- */
.tt-archive-card { margin-top: 26px; max-width: 640px; }
.sheet.tt-archive { padding: 24px 24px 22px; }
.tt-arch-title { margin: 4px auto 2px; width: fit-content; text-align: center; font-family: var(--font-hand); font-weight: normal; font-size: 2.2rem; color: var(--ink-1); line-height: 1;
  position: relative; isolation: isolate; padding: 6px 24px 4px; rotate: -0.8deg; }
/* the same strip of masking tape as the bag's title, so the red lettering reads on the kraft */
.tt-arch-title::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: rgba(236, 226, 196, 0.82);
  background-image: linear-gradient(90deg, rgba(255,255,255,0.22), rgba(0,0,0,0.05) 60%, rgba(255,255,255,0.14));
  clip-path: polygon(1.5% 0, 3.5% 12%, 1.5% 25%, 4% 40%, 1% 55%, 3.5% 72%, 1.5% 88%, 3% 100%, 97% 100%, 99% 86%, 96.5% 70%, 98.5% 55%, 96% 40%, 98.5% 24%, 96.5% 10%, 98.5% 0);
  filter: drop-shadow(0 1px 1px rgba(60, 40, 20, 0.18));
}
.tt-arch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 6px; --gummy-pattern: plain; --gummy-ground: #d3b382; }
.tt-arch { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 9px; text-decoration: none; color: var(--ink-2);
  background: rgba(255, 248, 232, 0.35); box-shadow: 0 2px 0 rgba(70, 44, 18, 0.3); transition: transform .15s, background .15s; }
.tt-arch:hover, .tt-arch:focus-visible { transform: translateY(-2px) rotate(-1deg); background: rgba(255, 248, 232, 0.6); }
.tt-arch.here { outline: 2px dashed var(--ink-1); outline-offset: -4px; }
.tt-arch-date { font-family: var(--font-type); font-size: 0.85rem; }
.tt-arch b { font-family: var(--font-hand); font-weight: normal; font-size: 1.05rem; line-height: 1; }
.tt-arch.done b { color: var(--ink-1); }
.tt-arch-pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 10px 0 4px; font-family: var(--font-type); font-size: 0.9rem; }
.tt-arch-head { margin: 4px 0 2px; }
.tt-arch-head > gummy-button { justify-self: start; }
/* your stash: four big numbers, the streak, and a bar per score in pumpkin orange */
.tt-stash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0 8px; text-align: center; }
.tt-stash-grid > div { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; background: rgba(255, 248, 232, 0.35); }
.tt-stash-grid b { font-family: var(--font-hand); font-weight: normal; font-size: 2.2rem; line-height: 1; color: var(--ink-1); }
.tt-stash-grid span { font-family: var(--font-type); font-size: 0.8rem; color: var(--ink-2); }
.tt-stash-streak { text-align: center; font-family: var(--font-hand); font-size: 1.15rem; margin: 6px 0 12px; }
.tt-stash-bars { display: flex; flex-direction: column; gap: 6px; max-width: 440px; margin: 0 auto 10px; }
.tt-stash-row { display: grid; grid-template-columns: 18px 1fr 28px; align-items: center; gap: 8px; font-family: var(--font-type); font-size: 0.9rem; color: var(--ink-2); }
.tt-stash-row .track { height: 18px; background: rgba(90, 60, 30, 0.12); border-radius: 9px; overflow: hidden; }
.tt-stash-row .bar { display: block; height: 100%; border-radius: 9px; background: linear-gradient(180deg, #ffa257, #ff7a1a 55%, #d95f0a); }
.tt-stash-row.today .k, .tt-stash-row.today .v { color: var(--ink-1); font-weight: 700; }
@media (max-width: 520px) { .tt-stash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
body[data-game="treat"] .icon-btn[aria-pressed="true"] { background: var(--paper); }
body[data-game="treat"] .icon-btn[aria-pressed="true"] svg { stroke: #102a2e; }
@media (max-width: 520px) { .sheet.tt-archive { padding: 18px 12px 16px; } .tt-arch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* the staple holding the tag to the bag: two short legs and a bar, steel, with a glint */
.tt-staple { position: absolute; z-index: 2; left: 9px; top: 24px; width: 4px; height: 20px; rotate: 10deg;
  border: 1.5px solid #8f949c; border-left-color: #c9ced6; border-radius: 1px; background: transparent;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35); }

/* The title's red-marker lettering (Wee Bairn) for the page's other words too: the date, the day links, the switch,
   the countdown, the strips... */
body[data-game="treat"] { --font-display: var(--font-hand); }
body[data-game="treat"] .stage :is(p, li, b, i, em, span, a, button, h1, h2, h3, header, dt, dd, small, strong, label, div) { font-family: var(--font-hand); }
/* ...and the body copy (the lede, the rules) in the sweets' typewriter type, so the page reads in two faces:
   hand-lettered headings and buttons, typed text */
body[data-game="treat"] .stage .tt-sheet :is(.lede, .rules li, .rules li b) { font-family: var(--font-type); }
body[data-game="treat"] .stage .tt-sheet .lede { font-size: 1.02rem; }
@media (min-width: 640px) { body[data-game="treat"] .stage .tt-sheet .lede { white-space: nowrap; } }   /* one line wherever the bag is wide enough */
body[data-game="treat"] .stage .tt-sheet .rules li { font-size: 1rem; line-height: 1.45; }
body[data-game="treat"] .stage .tt-sheet .rules li b { color: var(--ink-2); }   /* black: red doesn't read on the kraft */
body[data-game="treat"] .tt-issue > span { font-size: 1.15rem; }
body[data-game="treat"] .end-links .btn, body[data-game="treat"] .end-links .btn span { font-size: 1rem; }
/* the film names on a bagged strip (in the game and the demo) are typed like the sweets they came from, at a size you can read */
body[data-game="treat"] .stage .tt-row span { font-family: var(--font-type); font-size: 0.98rem; line-height: 1.3; }
/* phones: no room for the score and Copy result side by side, so they stack, both centred */
@media (max-width: 520px) {
  .tt-results-foot { flex-direction: column; justify-content: center; }
  .tt-results-foot .tt-score-row { justify-content: center; }
  .tt-results-foot .tt-copy { margin: 0 auto; }
}
/* the countdown tag, in the hand lettering: its time sized to read like Paper Cuts' (digits about 15px tall), the tag
   trimmed close round it */
body[data-game="treat"] .tt-next { width: 150px; }
body[data-game="treat"] .stage .tt-next-face { padding: 8px 14px 7px 28px; }
body[data-game="treat"] .stage .tt-next-face span { font-size: 0.95rem; }
body[data-game="treat"] .stage .tt-next-face b { font-size: 1.3rem; letter-spacing: .04em; }
/* the Popular / Expert switch is set like every other game's (Archivo Black), not in the page's hand lettering */
body[data-game="treat"] .stage .mode-switch button { font-family: 'Archivo Black', sans-serif; }

/* phones: the four example candies wrap to a second row rather than pushing past the bag */
@media (max-width: 520px) { .tt-demo-chips { flex-wrap: wrap; row-gap: 6px; } }
