/* Hubbub: warm paper, plum ink, a tomato-orange accent, Fredoka. Phone first (360 × 640), then tablet and desktop.
   The room between things comes from the shop's one scale (theme/web/spacing.css, linked first); the look is ours. */
@font-face { font-family: Hubbub; src: url(fonts/hubbub-500.woff2) format('woff2'); font-weight: 400 549; font-display: swap; }
@font-face { font-family: Hubbub; src: url(fonts/hubbub-650.woff2) format('woff2'); font-weight: 550 800; font-display: swap; }
:root {
  --ink: #2e2640; --paper: #fbf6ea; --card: #fffdf7; --accent: #c94a1e; --accent-ink: #fff; --orange: #ef6a2c; --muted: #6a6275;
  /* the window's height, still while a phone's bars come and go (the shop's /shop/screen.js); svh off the shop */
  --screen: var(--shop-screen, 100svh);
  --line: #e7dcc6; --radius: 16px; --font: Hubbub, ui-rounded, system-ui, sans-serif; --shadow: 0 2px 0 rgba(46, 38, 64, .08), 0 8px 24px rgba(46, 38, 64, .08);
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.45 var(--font); min-height: var(--screen); display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; }
/* each screen is one step of a phone's flow, not a page section: a small top, room below */
main > .screen { padding-block: var(--space-xs) var(--space-xl); }
h1, h2, h3 { font-weight: 650; line-height: 1.12; margin: 0 0 var(--space-xs); letter-spacing: -0.01em; }
h1 { font-size: clamp(30px, 8.5vw, 52px); }
h2 { font-size: clamp(24px, 6.4vw, 34px); padding: 0 var(--gutter); margin-top: var(--space-xs); }
h3 { font-size: 18px; padding: 0 var(--gutter); margin-top: var(--space-m); }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.err { color: #b3261e; font-weight: 600; }
.center { text-align: center; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; padding: 10px var(--gutter); padding-top: max(10px, env(safe-area-inset-top)); }
.mark { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: 22px; text-decoration: none; min-height: 44px; }
.mark-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--orange); box-shadow: 7px -5px 0 -3px #f5c533, -6px 6px 0 -4px #3a7bd5; }
.top-r { display: flex; gap: 6px; align-items: center; }
.lang select { min-height: 44px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); padding: 0 8px; }
.icon { min-width: 44px; min-height: 44px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); cursor: pointer; padding: 0; display: inline-grid; place-items: center; }
/* Hubbub's icons (icons.js): drawn shapes, never letters or emoji, so they sit centred alike on every device */
.ico { width: 20px; height: 20px; flex: none; display: block; }
#sound[data-muted='true'] .ico-on, #sound:not([data-muted='true']) .ico-off { display: none; }

/* buttons */
.btn { min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 17px;
  cursor: pointer; box-shadow: 0 3px 0 #8f3212; transition: transform .12s cubic-bezier(.3, 1.6, .5, 1); touch-action: manipulation; }
.btn:active { transform: translateY(2px) scale(.98); box-shadow: 0 1px 0 #8f3212; }
.btn.big { min-height: 56px; font-size: 19px; padding: 0 28px; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn:disabled { opacity: .5; }
/* ordering closed (a public site before it opens) or soon (no payment can go through yet): the server stamps
   <html data-ordering>, so this holds before any script: the order buttons show the puzzle at real size instead, with
   an opens-soon line */
html:not([data-ordering='closed']):not([data-ordering='soon']) .closed-only,
html:is([data-ordering='closed'], [data-ordering='soon']) .open-only { display: none; }

/* home */
#home { display: grid; gap: var(--space-xs); padding-inline: var(--gutter); }
.hero-pic { position: relative; margin: 26px 18px 6px 4px; }
/* a puzzle lying on a table: its board's edge, and a soft shadow down and to the right (the light comes from the top left) */
.puzzle { position: relative; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 0 #d9ccb2, 2px 3px 4px rgba(46, 38, 64, .12), 6px 12px 28px rgba(46, 38, 64, .16); transform: rotate(-1.2deg); }
.puzzle img { display: block; width: 100%; height: auto; }
.dims { position: absolute; color: var(--muted); font-size: 13px; font-weight: 650; }
.dims-w { left: 0; right: 0; top: -22px; border-top: 2px solid var(--line); text-align: center; }
.dims-w span, .dims-h span { background: var(--paper); padding: 0 6px; position: relative; top: -11px; }
.dims-h { top: 0; bottom: 0; right: -18px; border-right: 2px solid var(--line); writing-mode: vertical-rl; display: flex; align-items: center; justify-content: center; }
.dims-h span { top: 0; right: -11px; }
.kicker { color: var(--accent); font-weight: 650; margin: 8px 0 2px; }
.what { font-size: 17px; margin: 0 0 10px; }
.price { font-size: 20px; margin: 0; }
.price span { font-size: 15px; color: var(--muted); }
.hero-soon { color: var(--accent); font-weight: 650; font-size: 15px; margin: 4px 0 0; }
#start { margin-top: var(--space-m); }
.small { color: var(--muted); margin: 2px 0 14px; }
/* a phone: the shop's bar sits above the page, so the first screen keeps the start button in view at 360 × 640 */
@media (max-width: 480px) {
  .top { padding-block: 6px; }
  .hero-pic { margin-top: 22px; margin-bottom: 2px; }
  #home h1 { font-size: 28px; }
  .kicker { margin-top: 4px; }
  .what { font-size: 15px; margin-bottom: 6px; }
}
.steps { list-style: none; padding: 0; margin: var(--space-l) 0 0; display: grid; gap: var(--space-xs); counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 10px; align-items: center; background: var(--card); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
.steps li::before { content: counter(s); flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; font-weight: 650; }

/* build */
#build { padding-bottom: 96px; }
.castbar { display: flex; gap: var(--space-xs); overflow-x: auto; padding: 4px var(--gutter) var(--space-s); scrollbar-width: none; }
.castbar .chip { flex: none; display: flex; align-items: center; gap: 6px; min-height: 48px; padding: 2px 10px 2px 2px; border-radius: 999px; border: 2px solid var(--line);
  background: var(--card); cursor: pointer; font-weight: 600; }
.castbar .chip[aria-current="true"] { border-color: var(--orange); }
.castbar .chip svg { width: 40px; height: 40px; border-radius: 50%; background: #efe7d6; }
.castbar .chip .x { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.castbar .chip .x .ico { width: 14px; height: 14px; }
/* a person just removed: their chip, faded, says Undo for a few seconds (app.js UNDO_MS) */
.castbar .chip.undo { border-style: dashed; color: var(--accent); padding-right: 14px; }
.castbar .chip.undo svg { opacity: .45; }
.builder { display: grid; gap: var(--space-s); padding: 0 var(--gutter); }
.builder > *, .controls > * { min-width: 0; }
.stage { height: 216px; border-radius: 24px; background: radial-gradient(ellipse at 50% 92%, #e3eccf 0 34%, transparent 35%), linear-gradient(#dff0f7, #f2f7ee);
  display: grid; place-items: end center; overflow: hidden; position: relative; padding-bottom: 20px; }
/* "Surprise me" changes the person in the picture, so it sits on the picture's lower edge, half over it */
.stagebox { position: relative; padding-bottom: 20px; }
#shuffle { position: absolute; bottom: 0; left: 0; right: 0; width: max-content; margin-inline: auto; box-shadow: inset 0 0 0 2px var(--line), var(--shadow);
  min-height: 40px; padding: 0 14px 0 10px; font-size: 15px; display: flex; align-items: center; gap: 6px; }
#shuffle:active { box-shadow: inset 0 0 0 2px var(--line); }
/* the person's crop (app.js STAGE, 36 × 34.5, a balloon still fits; KITE_STAGE taller for a kite) */
.stage svg { width: 205px; height: 196px; overflow: visible; transform-origin: 50% 92%; }
.stage svg.pop { animation: pop .5s cubic-bezier(.3, 1.7, .5, 1); }
@keyframes pop { 0% { transform: scale(.88, 1.08); } 60% { transform: scale(1.04, .97); } 100% { transform: none; } }
.namefield { display: grid; gap: 4px; font-weight: 600; }
.namefield input { min-height: 50px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); padding: 0 14px; font-size: 20px; font-weight: 600; }
.namefield input:focus { outline: 3px solid color-mix(in srgb, var(--orange) 50%, transparent); border-color: var(--orange); }
.namefield small { font-weight: 400; color: var(--muted); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; margin: 4px 0 var(--space-s); }
.tabs button { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 0; background: #efe7d6; cursor: pointer; font-weight: 600; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
/* a mouse can't swipe a row: with one, the tabs and the people wrap onto a second line instead of hiding past the edge */
@media (pointer: fine) { .tabs, .castbar { flex-wrap: wrap; overflow-x: visible; } }
@media (hover: hover) { .tabs button:not([aria-selected='true']):hover { background: #e3d6bd; } }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: var(--space-xs); }
.opts.sub { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); margin-top: 8px; }
.opt { min-height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); cursor: pointer; padding: 4px; display: grid; justify-items: center; gap: 2px;
  font-size: 12px; line-height: 1.1; transition: transform .15s cubic-bezier(.3, 1.6, .5, 1); }
.opt svg { width: 100%; height: 66px; }
.opt[aria-checked="true"] { border-color: var(--orange); background: #fff1e6; transform: scale(1.03); }
.opt.swatch { min-height: 48px; padding: 0; border-radius: 50%; aspect-ratio: 1; }
.opt.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--orange); }
.bar { position: sticky; bottom: 0; display: flex; gap: var(--space-xs); justify-content: center; flex-wrap: wrap; padding: var(--space-s) var(--gutter) max(var(--space-s), env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--paper) 30%); }
.bar.stack { flex-direction: column; flex-wrap: nowrap; align-items: stretch; position: static; }
.bar .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-xs); }
.bar .row .btn { font-size: 15px; padding: 0 10px; }
/* under the picture only the order button is big: the others are lighter and smaller, one even gap between all */
.bar.stack .row .btn.ghost { min-height: 40px; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 600; }
#build .bar { position: fixed; left: 0; right: 0; z-index: 5; }
#build .bar .btn.ghost { box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--line); }
#build .bar .btn.ghost:active { box-shadow: inset 0 0 0 2px var(--line), 0 1px 0 var(--line); }
@media (max-width: 480px) { #build .bar .btn { padding-inline: 14px; font-size: 16px; } }
/* the message sits above the buttons, so it shows wherever the page is scrolled */
.bar .err { flex-basis: 100%; margin: 0; background: var(--paper); box-shadow: 0 0 10px 6px var(--paper); }

/* scenes */
#scene > h2 { margin-bottom: var(--space-l); }
/* "How hard?" a heading of its own, with room above it */
#scene > h3 { font-size: clamp(20px, 5vw, 26px); margin: var(--space-xl) 0 var(--space-s); }
.scenes { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-s); padding: 0 var(--gutter); }
.scene-card { border: 3px solid transparent; border-radius: 18px; padding: 0; background: var(--card); overflow: hidden; cursor: pointer; text-align: left; box-shadow: var(--shadow);
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.scene-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
.scene-card span { display: block; padding: 8px 10px; font-weight: 650; }
.scene-card[aria-checked="true"] { border-color: var(--orange); transform: scale(1.02); }
.dial { display: flex; margin: 0 var(--gutter); background: #efe7d6; border-radius: 999px; padding: 4px; position: relative; }
.dial button { flex: 1; min-height: 48px; border: 0; background: none; border-radius: 999px; cursor: pointer; font-weight: 650; position: relative; z-index: 1; }
.dial .knob { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); border-radius: 999px; background: var(--ink);
  transition: transform .45s cubic-bezier(.3, 1.5, .5, 1); }
.dial button[aria-checked="true"] { color: #fff; }
.levelhint { padding: 0 var(--gutter); color: var(--muted); min-height: 3em; }

/* find */
#find { padding-bottom: var(--space-l); }
.viewer-wrap { position: relative; margin: 0 8px; }
.viewer { display: block; width: 100%; height: clamp(260px, calc(var(--screen) * 0.58), 680px); border-radius: 18px; touch-action: none; background: #efe7d6; cursor: grab; }
.viewer-msg { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: var(--ink); color: #fff; font-weight: 650; padding: 8px 16px; border-radius: 999px;
  pointer-events: none; transition: opacity .3s, transform .4s cubic-bezier(.3, 1.6, .5, 1); white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.viewer-msg:empty { opacity: 0; transform: translateX(-50%) translateY(-8px); }
.zoom { position: absolute; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.zoom .icon { background: rgba(255, 253, 247, .92); }
.hint { color: var(--muted); font-size: 14px; padding: 0 var(--gutter); margin: var(--space-xs) 0; }
.findlist { display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px; column-gap: var(--space-s); padding: 0 var(--gutter); }
.findlist .who { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-weight: 600; min-height: 44px; }
.findlist .who svg { width: 36px; height: 36px; border-radius: 50%; background: #efe7d6; }
.findlist .who.found { animation: pop .5s cubic-bezier(.3, 1.7, .5, 1); }
.findlist .who.found::after { content: '✓'; color: #2f9e5a; font-weight: 700; }
.preview-note { color: var(--muted); font-size: 13px; padding: 0 var(--gutter); }
.closed-note { margin: 0; padding: var(--space-s); border-radius: var(--radius); background: var(--card);
  border: 1px dashed var(--line); text-align: center; }
.findlist .who .time { color: #2f9e5a; font-variant-numeric: tabular-nums; font-size: 14px; }
/* a shared link opening (kits/share sets data-share on #find): three of the crowd hop while its picture is drawn; Order
   this and Make your own wait for the replay of them hiding to end */
.share-loading { position: absolute; inset: 0; display: none; place-items: center; pointer-events: none; }
#find[data-share="loading"] .share-loading { display: grid; }
.share-loading { grid-auto-flow: column; justify-content: center; align-items: end; gap: 12px; padding-bottom: 6%; }
.share-loading i { position: relative; width: 30px; height: 36px; border-radius: 15px 15px 9px 9px; background: var(--coat);
  animation: hop 1s cubic-bezier(.3, 1.4, .5, 1) infinite; }
.share-loading i:nth-child(2) { animation-delay: .16s; }
.share-loading i:nth-child(3) { animation-delay: .32s; }
.share-loading b { position: absolute; left: 4px; top: -21px; width: 22px; height: 22px; border-radius: 50%; background: var(--skin); }
.share-loading b::before { content: ''; position: absolute; inset: -2px -1px 11px; border-radius: 12px 12px 3px 3px; background: var(--hair); }
.share-loading b::after { content: ''; position: absolute; left: 6px; top: 11px; width: 3px; height: 3px; border-radius: 50%; background: var(--ink);
  box-shadow: 7px 0 var(--ink); }
@keyframes hop { 0%, 55%, 100% { transform: translateY(0) scale(1, 1); } 12% { transform: translateY(0) scale(1.08, .9); } 30% { transform: translateY(-16px) scale(.96, 1.05); } }
@media (prefers-reduced-motion: reduce) { .share-loading i { animation: none; } }
#find[data-share="loading"] #dareBar, #find[data-share="replay"] #dareBar { visibility: hidden; }
/* the dare: whose picture it is, the time when everyone's found, the race in the link */
.dare-head { padding: 4px var(--gutter) 10px; }
.dare-head h2 { margin: 6px 0 4px; padding: 0; }
.dare-head p { margin: 0; color: var(--muted); }
.dare-head .btn { margin-top: 12px; }
.done { margin: 14px var(--gutter) 4px; padding: 16px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); text-align: center;
  animation: pop .5s cubic-bezier(.3, 1.7, .5, 1); }
.done-time { margin: 0 0 6px; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.done-line { margin: 0 0 12px; color: var(--muted); }
.dare-note { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.dare-msg { margin: 10px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.dare-msg input { display: block; width: 100%; margin: 6px 0 0; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  font: 500 13px var(--font); color: var(--ink); }
.race-form { text-align: left; }
.race-form label { display: block; font-weight: 650; margin-bottom: 6px; }
.race-row { display: flex; flex-wrap: wrap; gap: 8px; }
.race-row .btn { flex: 1 1 auto; }
.race-row input { flex: 1 1 12em; min-width: 0; min-height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--paper); padding: 0 14px; font: 600 18px var(--font); }
.race-row input:focus { outline: 3px solid color-mix(in srgb, var(--orange) 50%, transparent); border-color: var(--orange); }
.race { margin: 14px var(--gutter) 0; padding: 12px 16px; border-radius: var(--radius); border: 2px dashed var(--line); }
.race h3 { margin: 0 0 6px; padding: 0; }
.race ol { margin: 0; padding-left: 24px; }
.race li { padding: 4px 0; font-weight: 600; }
.race li span { display: inline-block; min-width: 9em; }
.race li b { font-variant-numeric: tabular-nums; }
.race li.me { color: var(--accent); }
.race li.me::marker { color: var(--accent); }
.race li.empty { list-style: none; margin-left: -24px; color: var(--muted); font-weight: 400; }

/* order */
.scale { margin: var(--space-m) var(--gutter); }
.scale svg { width: 100%; height: auto; display: block; }
.scale figcaption { color: var(--muted); font-size: 13px; text-align: center; }

.foot { padding: var(--space-l) var(--gutter) max(var(--space-l), env(safe-area-inset-bottom)); text-align: center; font-size: 14px; color: var(--muted); }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 14px; }
.foot nav a { min-height: 44px; display: inline-flex; align-items: center; }
.foot .ai { max-width: 560px; margin: var(--space-xs) auto 0; font-size: 12px; }

/* tablet and desktop */
@media (min-width: 760px) {
  #home { grid-template-columns: 1.25fr 1fr; align-items: center; gap: var(--space-xl); padding-block: var(--space-xl) var(--space-2xl); }
  #build { --stage-w: 300px; }
  .builder { grid-template-columns: var(--stage-w) 1fr; align-items: start; }
  .stagebox { position: sticky; top: 12px; }
  .stage { height: 290px; }
  .stage svg { width: 282px; height: 270px; }
  .opts { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .opt svg { height: 84px; }
  /* the buttons start where the controls column does (the builder's stage column and its gap) */
  #build .bar { justify-content: flex-start; padding-left: calc(var(--gutter) + var(--stage-w) + var(--space-s)); }
  /* the puzzle's own shape: 68 × 44 cm and its 3 mm bleed each side (scene.js), no bands beside it; the page under it
     as wide as the picture, and the zoom at its top, clear of the names along its bottom */
  #find { max-width: calc(clamp(260px, calc(var(--screen) * 0.64), 700px) * 686 / 446 + 2 * var(--gutter)); margin-inline: auto; }
  .viewer-wrap { margin-inline: var(--gutter); }
  .viewer { height: auto; aspect-ratio: 686 / 446; }
  .zoom { top: 8px; bottom: auto; }
  .scenes { grid-template-columns: repeat(4, 1fr); }
  #build .bar { position: sticky; }
  #order { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-l); align-items: start; }
  #order h2 { grid-column: 1 / -1; }
  #order #checkout { grid-row: span 3; }
}
