/* Pop Couture: warm cream paper, walnut and gold; Fredoka for words (assets/fonts). Portrait-first: a puzzle board is
   tall like a dress; landscape puts the top bar on the left (play.ts layout). */
:root {
  --cream: #fffaf1; --paper: #f7efe0; --gold: #e7c98f; --gold2: #d9a73b; --walnut: #7a4a2a; --ink: #4a2f1c; --rose: #e86f93; --sky: #5aa9e6;
  --shadow: 0 10px 30px rgba(60, 30, 10, .25);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #3b2618; color: var(--ink); font-family: Fredoka, Nunito, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
.stage { position: fixed; inset: 0; background: radial-gradient(circle at 50% 30%, #6b4128, #2e1d12); }
.stage canvas { display: block; }
.screen { position: fixed; inset: 0; display: none; z-index: 5; }
.screen.on { display: flex; }
.screen.pass { pointer-events: none; }
.modal { align-items: center; justify-content: center; background: rgba(40, 22, 10, .55); padding: 16px; z-index: 20; }
.card { background: var(--cream); border: 3px solid var(--gold); border-radius: 26px; box-shadow: var(--shadow); padding: 22px; max-width: 460px; width: 100%; text-align: center; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.btn { border: 0; border-radius: 999px; padding: 12px 22px; background: #fff; box-shadow: inset 0 0 0 2px var(--gold), 0 3px 0 #c9a465; font-size: 19px; font-weight: 600; min-height: 48px; }
.btn.primary { background: linear-gradient(#f7a3bd, var(--rose)); color: #fff; box-shadow: inset 0 0 0 2px #c94d74, 0 4px 0 #b04066; text-shadow: 0 1px 0 rgba(0, 0, 0, .15); }
.btn.big { font-size: 26px; padding: 16px 38px; }
.btn:active { transform: translateY(2px); }
.btn.loading { opacity: .6; pointer-events: none; }
.round { width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--cream); box-shadow: inset 0 0 0 3px var(--gold), 0 4px 0 #b88a4a; display: grid; place-items: center; }
.round svg { width: 28px; height: 28px; fill: none; stroke: var(--walnut); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.round.small { width: 46px; height: 46px; }
.small { font-size: 14px; opacity: .8; }

/* title */
#title { flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: radial-gradient(circle at 50% 35%, #fff5e4 0%, #f3dcc0 55%, #d9b48a 100%); }
.brand { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--walnut); font-size: 26px; }
.brand img { height: 34px; }
.brand.solo span { display: none; }
.lang-switch { position: absolute; top: 14px; right: 14px; display: flex; gap: 6px; }
.lang-switch a { text-decoration: none; color: var(--walnut); background: #fff8; border-radius: 10px; padding: 4px 8px; font-weight: 600; }
.logo { margin: 0; line-height: .9; display: flex; flex-direction: column; align-items: center; }
.logo .pop { font-size: clamp(72px, 22vw, 150px); color: var(--rose); font-weight: 700; letter-spacing: -2px; text-shadow: 0 6px 0 #b04066, 0 12px 24px rgba(120, 40, 70, .3); display: flex; align-items: center; }
.logo .btn-o { display: inline-block; width: .62em; height: .62em; margin: 0 .04em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #9fd0f5, var(--sky) 60%, #3d7fb8); box-shadow: 0 6px 0 #2f6698; position: relative; }
.logo .btn-o::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, #2f6698 0 7%, transparent 8%) 32% 32% / 50% 50%, radial-gradient(circle, #2f6698 0 7%, transparent 8%) 68% 32% / 50% 50%, radial-gradient(circle, #2f6698 0 7%, transparent 8%) 32% 68% / 50% 50%, radial-gradient(circle, #2f6698 0 7%, transparent 8%) 68% 68% / 50% 50%; background-repeat: no-repeat; }
.logo .couture { font-size: clamp(34px, 9vw, 64px); color: var(--walnut); font-weight: 600; letter-spacing: 6px; margin-top: 6px; }
.tag { font-size: 20px; max-width: 420px; margin: 4px 0 10px; }
.presents { display: flex; align-items: center; gap: 8px; opacity: .8; margin-top: 18px; }
.presents img { height: 26px; }

/* the book */
#book { flex-direction: column; background: linear-gradient(#f6e6cf, #e9cfa9); }
.book-top { width: 100%; max-width: 760px; margin: 0 auto; display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 16px 8px; gap: 10px; }
.book-top h2 { margin: 0; font-size: 30px; color: var(--walnut); }
.book-top p { margin: 2px 0 6px; font-size: 17px; }
.envelopes { display: flex; gap: 6px; flex-wrap: wrap; }
.env { width: 30px; height: 21px; border-radius: 4px; background: #fff linear-gradient(155deg, transparent 49%, var(--gold) 50%, transparent 53%), linear-gradient(25deg, transparent 49%, var(--gold) 50%, transparent 53%); box-shadow: inset 0 0 0 2px var(--gold); }
.env.used { opacity: .35; }
.chapters { flex: 1; overflow-y: auto; width: 100%; max-width: 760px; margin: 0 auto; padding: 6px 14px 30px; display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }
.chapter { flex-shrink: 0; border-radius: 22px; padding: 14px; background-size: cover; background-position: center; position: relative; box-shadow: var(--shadow); color: #fff; min-height: 150px; }
.chapter::before { content: ""; position: absolute; inset: 0; border-radius: 22px; background: linear-gradient(rgba(30, 15, 5, .15), rgba(30, 15, 5, .55)); }
.chapter > * { position: relative; }
.chapter h3 { margin: 0; font-size: 26px; text-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
.chapter .count { position: absolute; top: 14px; right: 16px; margin: 0; font-weight: 700; text-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
.chapter.locked { filter: grayscale(.85) brightness(.7); }
.chapter.locked .items { pointer-events: none; }
.items { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.item { aspect-ratio: 3 / 4; min-width: 0; overflow: hidden; border-radius: 16px; border: 0; background: rgba(255, 250, 241, .55); box-shadow: inset 0 0 0 2px rgba(231, 201, 143, .9); position: relative; padding: 4px; display: grid; place-items: center; }
.item img { position: absolute; inset: 5px; width: calc(100% - 10px); height: calc(100% - 10px); object-fit: contain; filter: grayscale(1) brightness(1.6) opacity(.45); }
.item.sewn { background: rgba(255, 250, 241, .92); }
.item.sewn img { filter: none; }
.item.next { background: #fffaf1; box-shadow: inset 0 0 0 3px var(--rose), 0 0 0 4px rgba(232, 111, 147, .35); animation: bob 1.2s ease-in-out infinite; }
.item.next img { filter: grayscale(.4) opacity(.8); }
.item.moon::after { content: "🌙"; position: absolute; font-size: 26px; }
.item:disabled { cursor: default; }
.item .stars { position: absolute; bottom: -4px; left: 0; right: 0; font-size: 13px; color: #f2b632; text-shadow: 0 1px 2px #0008; letter-spacing: -1px; }
@keyframes bob { 50% { transform: translateY(-4px) scale(1.04); } }

/* letter, win, reveal */
.place { margin: 0; font-weight: 700; color: var(--rose); font-size: 20px; letter-spacing: 1px; }
.letter-item { height: min(34vh, 260px); max-width: 100%; object-fit: contain; filter: grayscale(1) brightness(1.4) opacity(.55); margin: 8px 0; }
#letterText { font-size: 21px; margin: 6px 0; }
.goals { display: flex; gap: 14px; justify-content: center; }
.goal { display: flex; align-items: center; gap: 4px; font-size: 22px; }
.goal img { width: 44px; height: 44px; object-fit: contain; }
.win-card h2 { margin: 6px 0; font-size: 26px; color: var(--walnut); }
.shine { position: relative; display: grid; place-items: center; }
.shine::before { content: ""; position: absolute; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(#fff6c8, transparent 65%); animation: glow 2s ease-in-out infinite; }
.shine img { position: relative; height: min(36vh, 280px); max-width: 100%; object-fit: contain; animation: rise .8s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes glow { 50% { transform: scale(1.12); opacity: .7; } }
@keyframes rise { from { transform: translateY(40px) scale(.7); opacity: 0; } }
.win-stars { display: flex; justify-content: center; gap: 10px; margin: 4px 0 8px; }
.win-stars span { font-size: 54px; color: #d8cbb5; animation: star .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.win-stars span.on { color: #f2b632; text-shadow: 0 3px 0 #b8861f, 0 0 18px #ffe38a; }
@keyframes star { from { transform: scale(0) rotate(-60deg); } }
.reveal-card { max-width: 520px; padding: 14px; }
.reveal-stage { height: min(52vh, 460px); display: grid; place-items: center; border-radius: 18px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #fff, #f1e2c8); }
.reveal-stage video { height: 100%; max-width: 100%; object-fit: contain; position: absolute; inset: 0; margin: auto; opacity: 0; transition: opacity .5s; }
.reveal-stage video.on { opacity: 1; }
.reveal-stage { position: relative; }
.doll { position: relative; height: 100%; }
.doll img { position: absolute; display: block; }
.doll img:first-child { left: 0 !important; top: 0 !important; width: 100% !important; }
.judges { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.judge { flex: 1; max-width: 150px; animation: pop .4s cubic-bezier(.2, 1.4, .4, 1) both; }
.judge img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; box-shadow: 0 0 0 3px var(--gold); background: #fff; }
.judge p { margin: 4px 0 0; font-size: 14px; background: #fff; border-radius: 12px; padding: 6px 8px; box-shadow: 0 2px 0 var(--gold); }
.moon-pic { font-size: 70px; }
#moonText { font-size: 20px; }
.gate-q { font-size: 40px; font-weight: 700; margin: 8px 0; }
.parents-card label { display: block; text-align: left; font-size: 19px; margin: 10px 0; }
.parents-card input { width: 22px; height: 22px; vertical-align: middle; }

/* buttons over the board */
.play-ui { position: fixed; left: 0; right: 0; bottom: max(12px, env(safe-area-inset-bottom)); display: none; justify-content: space-between; padding: 0 16px; z-index: 6; pointer-events: none; }
.play-ui.on { display: flex; }
.play-ui .round { pointer-events: auto; }
@media (orientation: landscape) and (max-height: 520px) {
  .play-ui { top: 12px; bottom: auto; left: auto; width: auto; gap: 10px; }
  .items { grid-template-columns: repeat(7, minmax(0, 72px)); }
}

.bubble { position: fixed; left: 50%; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 70px); transform: translate(-50%, 20px); width: max-content; max-width: min(88vw, 460px); margin: 0; background: #fffaf1; color: var(--ink); border: 3px solid var(--gold); border-radius: 20px; padding: 10px 16px; font-size: 19px; text-align: center; box-shadow: var(--shadow); opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; z-index: 8; }
.bubble.on { opacity: 1; transform: translate(-50%, 0); }

/* inside Davet Var!: the book has a back button to the wardrobe (body.embed); alone it has none */
.close-btn { display: none; flex-shrink: 0; }
body.embed .close-btn { display: grid; }
.book-head { flex: 1; }
@media (orientation: landscape) and (max-height: 560px) {
  .bubble { left: 12px; bottom: 12px; transform: translateY(20px); width: 24vw; max-width: 24vw; font-size: 16px; }
  .bubble.on { transform: none; }
}
.judges .later { display: none; }
.small-btn { font-size: 14px; padding: 6px 14px; margin: 6px auto 0; display: block; }
.small-btn[hidden] { display: none; }
.lose-pic { font-size: 56px; line-height: 1; }
#loseMore[hidden] { display: none; }
/* cards always fit the visible screen (dvh: the phone's browser bars excluded); sideways the reveal goes side by side */
.modal { padding: max(8px, env(safe-area-inset-top)) 12px; }
.card { max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; }
.shine img { height: min(30dvh, 260px); }
.reveal-stage { height: min(46dvh, 440px); }
@media (orientation: landscape) and (max-height: 560px) {
  .card { padding: 12px 16px; }
  .win-card { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: center; max-width: 640px; }
  .win-card .shine { grid-row: 1 / span 3; }
  .win-card .shine img { height: min(62dvh, 260px); }
  .win-card h2 { font-size: 22px; }
  .win-stars span { font-size: 40px; }
  .reveal-card { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; max-width: 760px; }
  .reveal-stage { grid-row: 1 / span 3; height: calc(100dvh - 44px); width: min(42vw, 300px); }
  .judges img { width: 56px; height: 56px; }
}
.gate-in { font: 700 24px Fredoka, sans-serif; width: 110px; text-align: center; padding: 8px; border-radius: 14px; border: 3px solid var(--gold); }
.star-total { color: #f2b632; font-weight: 700; }
.item.hard::after { content: "Zor"; position: absolute; top: 3px; left: 3px; background: #c94d74; color: #fff; font: 700 10px Fredoka, sans-serif; padding: 2px 5px; border-radius: 8px; }
html[lang="en"] .item.hard::after { content: "Hard"; }
html[lang="fr"] .item.hard::after { content: "Dur"; }

/* ---------- the 3D board (play3d.ts): the atelier behind, the top bar, the gilt frame, words and flying goals ---------- */
.stage { background: #3a2417 url(assets/art/ui/bg_port.webp) center / cover no-repeat; }
body.land-play .stage { background-image: url(assets/art/ui/bg_land.webp); }
.stage canvas.board3d { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.hud, .board-frame { display: none; }
body.playing .hud { display: grid; }
body.playing .board-frame { display: block; }
.hud { position: fixed; z-index: 4; top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; height: clamp(104px, 17vh, 150px); grid-template-columns: auto 1fr; gap: 12px; align-items: center;
  border: 22px solid transparent; border-image: url(assets/art/ui/panel.webp) 110 fill / 22px stretch; box-sizing: border-box; padding: 0 6px; }
.hud-pic { position: relative; display: grid; place-items: center; }
.hud-pic canvas { cursor: pointer; filter: drop-shadow(0 2px 3px rgba(60, 30, 10, .35)); }
.hud .pct { position: absolute; bottom: -6px; right: -6px; font: 700 14px Fredoka, sans-serif; color: #8a5a35; background: #fffaf1; border-radius: 10px; padding: 0 6px; box-shadow: 0 1px 0 #e7c98f; }
.hud-info { display: grid; grid-template-rows: auto 1fr auto; height: 100%; min-width: 0; align-items: center; }
.ribbon { height: 40px; margin: -16px -10px 0; background: url(assets/art/ui/banner.webp) center / 100% 100% no-repeat; display: grid; place-items: center; padding: 0 18% 6px; }
.ribbon span { font: 700 15px Fredoka, sans-serif; color: #fff; text-shadow: 0 1px 0 #b2476a, 0 0 4px #b2476a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hud-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.spool, .goal { display: inline-flex; align-items: center; gap: 4px; }
.spool img { width: 38px; height: 38px; object-fit: contain; }
.spool b { font: 700 28px Fredoka, sans-serif; color: #5a3a20; min-width: 1.4em; }
.spool b.low { color: #d9343f; animation: pulse .8s ease-in-out infinite; }
.goals-row { display: flex; gap: 10px; flex-wrap: wrap; }
.goal img { width: 32px; height: 32px; object-fit: contain; }
.goal b { font: 700 20px Fredoka, sans-serif; color: #5a3a20; }
.goal.done b { color: #3f9a4f; }
.goal.bump img { animation: bump .3s ease-out; }
.hud-stars { display: flex; gap: 4px; justify-content: flex-end; }
.hud-stars i { width: 24px; height: 24px; background: url(assets/art/ui/star.webp) center / contain no-repeat; opacity: .3; filter: grayscale(.8); transition: opacity .3s, filter .3s; }
.hud-stars i.on { opacity: 1; filter: none; }
.board-frame { position: fixed; z-index: 3; pointer-events: none; border: 24px solid transparent; border-image: url(assets/art/ui/frame_open.webp) 250 / 24px stretch; box-sizing: border-box; filter: drop-shadow(0 6px 10px rgba(40, 20, 5, .45)); }
body.land-play .hud { right: auto; bottom: 8px; height: auto; width: clamp(210px, 27vw, 300px); grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; align-items: start; }
body.land-play .hud-pic { order: 2; justify-self: center; margin: 4px 0; }
body.land-play .hud-info { display: contents; }
body.land-play .ribbon { order: 1; margin: -14px -8px 0; }
body.land-play .hud-row { order: 3; justify-content: center; flex-wrap: wrap; }
body.land-play .hud-stars { order: 4; justify-content: center; }
body.land-play .play-ui { top: auto; bottom: 18px; left: 22px; right: auto; width: calc(clamp(210px, 27vw, 300px) - 28px); justify-content: space-between; }
.bubble { left: var(--vcx, 50%); bottom: calc(var(--vb, 90px) + 14px); }
body.land-play .bubble { left: var(--vcx, 50%); bottom: calc(var(--vb, 20px) + 14px); width: max-content; max-width: min(60vw, 440px); transform: translate(-50%, 20px); font-size: 17px; }
body.land-play .bubble.on { transform: translate(-50%, 0); }
.praise { position: fixed; z-index: 9; transform: translate(-50%, -50%); font: 700 38px Fredoka, sans-serif; color: #fff; pointer-events: none;
  -webkit-text-stroke: 7px #c94d74; paint-order: stroke fill; text-shadow: 0 4px 0 #8a2d4c, 0 0 18px rgba(255, 220, 240, .9); animation: praise 1.2s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes praise { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.3) rotate(-8deg); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(3deg); } 70% { opacity: 1; transform: translate(-50%, -110%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -150%) scale(.9); } }
.fly { position: fixed; z-index: 9; width: 46px; height: 46px; margin: -23px 0 0 -23px; object-fit: contain; pointer-events: none; transition: transform .5s cubic-bezier(.5, 0, .3, 1), opacity .5s; }
@keyframes bump { 50% { transform: scale(1.5); } }
@keyframes pulse { 50% { transform: scale(1.15); } }
body.land-play .hud { padding-bottom: 64px; }
/* ---------- the atelier look on every screen (the approved mock, 29 Nov 2026) ---------- */
.card { background: none; border: 26px solid transparent; border-image: url(assets/art/ui/panel.webp) 110 fill / 26px stretch; border-radius: 0; box-shadow: none; padding: 4px 8px; filter: drop-shadow(0 10px 18px rgba(40, 18, 5, .45)); }
.modal { background: rgba(40, 22, 10, .45); backdrop-filter: blur(3px); }
.card h2 { color: #8a3a55; }
.btn { background: linear-gradient(#fffdf7, #f3e4c6); box-shadow: inset 0 0 0 2px #d9b46a, 0 4px 0 #b88a4a, 0 6px 10px rgba(60, 30, 10, .25); color: #5a3a20; font-family: Fredoka, sans-serif; }
.btn.primary { background: linear-gradient(#ffb9cf, #ec7fa3 55%, #d9608a); box-shadow: inset 0 0 0 2px #fff3, inset 0 2px 0 #fff8, 0 4px 0 #a73f62, 0 7px 12px rgba(120, 30, 60, .35); }
#book { background: #3a2417 url(assets/art/ui/bg_port.webp) center / cover no-repeat; }
.book-top { background: none; }
.book-head h2 { display: inline-block; padding: 8px 54px 16px; background: url(assets/art/ui/banner.webp) center / 100% 100% no-repeat; color: #fff; font-size: 26px; text-shadow: 0 2px 0 #b2476a; }
.book-top p { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.chapter { border: 6px solid transparent; border-image: url(assets/art/ui/frame_open.webp) 250 / 14px stretch; border-radius: 0; box-shadow: 0 8px 18px rgba(30, 12, 2, .45); }
.chapter::before { border-radius: 0; }
.item { background: rgba(255, 250, 241, .82); }
.item.sewn { background: rgba(255, 246, 224, .95); box-shadow: inset 0 0 0 3px #e3b341; }
.win-stars span { font-size: 0; width: 58px; height: 58px; display: inline-block; background: url(assets/art/ui/star.webp) center / contain no-repeat; filter: grayscale(1) opacity(.35); }
.win-stars span.on { filter: drop-shadow(0 0 12px #ffe38a); }
body.bubble-above .bubble { bottom: auto; top: var(--bubble-top); transform: translate(-50%, -50%) scale(.96); }
body.bubble-above .bubble.on { transform: translate(-50%, -50%); }

/* Fable review 2: the moves read as moves (a label, and a gold bobbin, not the green board piece); titles wrap, never clip */
.spool img { filter: none; } /* a real gold bobbin now (local GPU) */
.spool .mv { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; }
.spool .mv-label { font: 700 11px Fredoka, sans-serif; color: #8a5a35; font-style: normal; letter-spacing: .02em; }
.ribbon { padding: 0 12% 6px; }
.ribbon span { white-space: normal; line-height: 1.05; text-wrap: balance; text-align: center; }
body.land-play .ribbon { height: 52px; }
body.land-play .bubble { left: calc(clamp(210px, 27vw, 300px) / 2 + 8px); bottom: 86px; max-width: calc(clamp(210px, 27vw, 300px) - 24px); font-size: 15px; }

/* the title's "o" is the sapphire heart brooch from the piece sheet (Fable 2: the old blue-button "o" was the piece the parent disliked) */
.logo .btn-o { background: url(assets/art/sprites/brooch.png) center / contain no-repeat; box-shadow: none; border-radius: 0; width: .72em; height: .72em; vertical-align: -.05em; }
.logo .btn-o::before { display: none; }
.lose-pic img { width: 64px; height: 64px; object-fit: contain; }
/* the silk card's 26 px border made the reveal scroll on small phones: smaller stage */
.reveal-stage { height: min(40dvh, 420px); }
.judges img { width: 54px; height: 54px; }
@media (orientation: landscape) and (max-height: 560px) { .reveal-stage { height: calc(100dvh - 84px); } }

/* Fable review 3: the frame casts a soft shadow on the mat, and a light vignette (moved out of the 3D pipeline) */
.board-frame { box-shadow: inset 0 5px 14px rgba(80, 50, 15, .30), inset 0 0 0 1px #B89A6A, inset 0 0 60px rgba(70, 35, 10, .16); }
body.land-play .bubble { bottom: 10px; }
body.playing .bubble { font-size: 16px; padding: 8px 14px; }

/* the surprise (the parent, 29 Nov 2026): unsewn items are sealed envelopes; the name is unveiled at the finish */
.item .mystery { display: grid; place-items: center; width: 78%; aspect-ratio: 3 / 4; border-radius: 10px; background: linear-gradient(160deg, #f3d6de, #e9b9c8); box-shadow: inset 0 0 0 2px #d9a3b4, 0 2px 0 #c48aa0; font: 700 34px Fredoka, sans-serif; color: #fff; text-shadow: 0 2px 0 #b2476a; }
#hudTitle.unveil { animation: unveil .9s cubic-bezier(.2, 1.6, .4, 1); display: inline-block; }
@keyframes unveil { 0% { transform: scale(.2); opacity: 0; } 60% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); } }

.fstar { position: fixed; z-index: 9; width: 22px; height: 22px; margin: -11px; pointer-events: none; background: radial-gradient(circle, #fff 0 18%, rgba(255, 240, 190, .9) 30%, transparent 62%);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); transition: transform .85s cubic-bezier(.2, .8, .3, 1), opacity .85s ease-in; }
/* the earthquake: small, medium, large (big pops, scissors and big sewing; the wand) */
body.quake-s #stage, body.quake-s .board-frame { animation: quake .24s linear; --q: 1.5px; }
body.quake-m #stage, body.quake-m .board-frame { animation: quake .3s linear; --q: 3px; }
body.quake-l #stage, body.quake-l .board-frame { animation: quake .4s linear; --q: 5px; }
@keyframes quake { 0%, 100% { transform: translate(0, 0); } 15% { transform: translate(calc(var(--q) * -1), calc(var(--q) * .5)); } 30% { transform: translate(var(--q), calc(var(--q) * -.6)); } 45% { transform: translate(calc(var(--q) * -.7), calc(var(--q) * -.4)); } 60% { transform: translate(calc(var(--q) * .6), calc(var(--q) * .5)); } 80% { transform: translate(calc(var(--q) * -.3), 0); } }
/* the wand's little tree fairy (art/fairy/): about one second over the wand's spot, see-through fluttering tulle wings */
.pixie { position: fixed; z-index: 8; pointer-events: none; aspect-ratio: 253 / 420; transform: translate(-50%, -62%); opacity: 0; animation: pixie 1s ease-out forwards; filter: drop-shadow(0 4px 6px rgba(30, 20, 50, .3)); }
.pixie img { position: absolute; }
.pixie .body { inset: 0; width: 100%; height: 100%; transform-origin: 50% 90%; animation: pixieFlick 1s ease-in-out forwards; }
.pixie .wings { width: 133%; left: -26.5%; top: 6.4%; opacity: .92; transform: rotate(-14deg); animation: flutter .09s ease-in-out infinite alternate; }
@keyframes pixie { 0% { opacity: 0; transform: translate(-50%, -55%) scale(.55); } 16% { opacity: 1; transform: translate(-50%, -62%) scale(1.06); } 26% { transform: translate(-50%, -62%) scale(1); } 72% { opacity: 1; transform: translate(-50%, -66%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -82%) scale(.92); } }
@keyframes pixieFlick { 0%, 30% { transform: rotate(0); } 38% { transform: rotate(-7deg); } 46% { transform: rotate(8deg); } 60%, 100% { transform: rotate(0); } }
@keyframes flutter { from { transform: rotate(-14deg) scaleX(1); } to { transform: rotate(-14deg) scaleX(.55); } }
@media (prefers-reduced-motion: reduce) { .pixie, .pixie .body, .pixie .wings { animation: none; opacity: 1; } .pixie { transform: translate(-50%, -62%); } }

/* Fable review 4: the envelope without the ghost filter; the name unveiled big on the ribbon; a painted title screen */
.letter-item.mystery { filter: none; }
@keyframes unveil { 0% { transform: scale(.2); opacity: 0; } 55% { transform: scale(1.6); opacity: 1; } 100% { transform: scale(1); } }
#title { background: #3a2417 url(assets/art/ui/bg_port.webp) center / cover no-repeat; }
#title .logo .couture { display: inline-block; padding: 10px 56px 22px; background: url(assets/art/ui/banner.webp) center / 100% 100% no-repeat; color: #fff; text-shadow: 0 3px 0 #b2476a; }
#title .tag { color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, .55); }
/* Ribbon Pop 2: the chain counter on the frame's top edge, one pop per cascade wave */
#chain { position: fixed; z-index: 9; transform: translate(-50%, -50%) scale(0); font: 700 22px Fredoka, sans-serif; color: #fff; background: linear-gradient(#e24f86, #b3285f); padding: 3px 14px; border-radius: 999px; border: 2px solid #ffd257; box-shadow: 0 3px 8px rgba(40, 10, 30, .35); pointer-events: none; opacity: 0; }
#chain.on { animation: chainPop .9s ease-out forwards; }
@keyframes chainPop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.18); } 30% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -80%) scale(1); } }

/* the help card (the parent, 30 Nov 2026: "do we have help page for those?"): each tool, the pattern that makes it, what it does */
.help { position: fixed; inset: 0; z-index: 20; display: none; place-items: center; background: rgba(40, 20, 30, .55); padding: 16px; }
.help.on { display: grid; }
.help-card { background: var(--cream); border-radius: 22px; box-shadow: inset 0 0 0 3px var(--gold), 0 10px 30px rgba(0,0,0,.35); padding: 16px 16px 14px; width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; text-align: center; }
.help-card h2 { margin: 2px 0 10px; font: 700 22px Fredoka, sans-serif; color: var(--walnut); }
.help-row { display: grid; grid-template-columns: 52px 44px 1fr; gap: 10px; align-items: center; text-align: left; padding: 8px 4px; border-top: 1px solid rgba(150, 110, 60, .25); }
.help-row img { width: 52px; height: 52px; object-fit: contain; }
.help-row p { margin: 0; font: 500 15px/1.3 Nunito, Fredoka, sans-serif; color: #4a3020; }
.help-row b { font-family: Fredoka, sans-serif; color: #a8285d; }
.pat { display: grid; gap: 2px; justify-content: center; }
.pat i { width: 8px; height: 8px; border-radius: 2px; background: #2f6be0; }
.pat i.o { background: transparent; }
.help-card .btn { margin-top: 10px; }
