/* Pixel's version: "A Small Hello Grows". Paper, felt and thread; peach sunrise to lavender evening. */
:root {
  --bg-a: #fbe3d2; --bg-b: #f3c9c0;
  --paper: #fff8ec; --ink: #3a2a45; --soft: #6e5a78; --gold: #f2b544; --gold-deep: #c98a1c; --stitch: #d9a46a;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); line-height: 1.55; background: linear-gradient(180deg, var(--bg-a), var(--bg-b)); background-attachment: fixed; transition: background .3s; }
a { color: #8a3f9e; text-underline-offset: 3px; }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }
[hidden] { display: none !important; }

.ptop { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 10px 18px;
  background: color-mix(in srgb, var(--bg-a) 88%, transparent); backdrop-filter: blur(6px); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 800; }
.byline { font-size: .85rem; color: var(--soft); font-weight: 700; }

main { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.scene { padding: 6vh 0 4vh; }
.scene .paper, .scene .pic { opacity: 0; transform: translateY(26px); transition: opacity .9s ease, transform .9s ease; }
.scene.seen .paper, .scene.seen .pic { opacity: 1; transform: none; }

/* picture frame: felt edge + stitches */
.pic { position: relative; aspect-ratio: 16 / 9; border-radius: 26px; overflow: hidden; background: #e9cfc6;
  box-shadow: 0 14px 40px rgba(90, 50, 80, .22); outline: 2px dashed rgba(255, 255, 255, .7); outline-offset: -12px; }
.pic > img:not(.sprite) { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 700px) { .pic { aspect-ratio: auto; height: 58vh; min-height: 330px; border-radius: 20px; } main { padding: 0 10px; } }
.pic-hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); margin: 0; padding: 8px 16px; border-radius: 99px;
  background: rgba(255, 248, 236, .9); font-weight: 800; font-size: .9rem; pointer-events: none; animation: nudge 2.2s ease-in-out infinite; white-space: nowrap; }
@keyframes nudge { 50% { transform: translate(-50%, -6px); } }

/* paper card under each picture */
.paper { position: relative; max-width: 720px; margin: -46px auto 0; padding: 26px 28px 22px; background: var(--paper); border-radius: 18px;
  box-shadow: 0 8px 24px rgba(90, 50, 80, .14); text-align: center; z-index: 2; }
.paper::before { content: ""; position: absolute; inset: 8px; border: 2px dashed var(--stitch); border-radius: 12px; pointer-events: none; opacity: .55; }
h1, h2 { margin: .1em 0 .2em; line-height: 1.15; }
h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
.big { font-size: 1.25rem; font-weight: 700; margin: .3em 0; }
.tiny { font-size: .9rem; color: var(--soft); margin: .5em 0; }
.date { display: inline-block; margin: 0 0 .3em; padding: 4px 12px; border-radius: 99px; background: #f6dfb2; font-weight: 800; font-size: .85rem; }

.pbtn { display: inline-block; font: inherit; font-weight: 800; padding: 12px 22px; border-radius: 99px; border: 0; cursor: pointer; text-decoration: none;
  background: linear-gradient(180deg, #ffd98a, var(--gold)); color: #3a2a12; box-shadow: 0 5px 0 var(--gold-deep); margin: 6px 4px; }
.pbtn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--gold-deep); }
.pbtn.ghost { background: #fff; color: var(--ink); box-shadow: 0 0 0 2px #e6cfa8 inset; }
.pbtn:focus-visible, .block:focus-visible, .win:focus-visible, .seed:focus-visible, .door:focus-visible, .sw:focus-visible, .mk:focus-visible { outline: 3px solid #8a3f9e; outline-offset: 3px; }
.kb-only { position: absolute; left: -9999px; }
.kb-only:focus { position: static; }

/* 1. golden trail */
.night { transition: opacity 1.2s ease; z-index: 1; }
.day { z-index: 0; }
.trail { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; touch-action: none; cursor: crosshair; }
#helloPic.awake .night { opacity: 0; }

/* 2. prompt blocks */
.blocks { position: absolute; inset: 0; }
.block { position: absolute; font: inherit; font-weight: 900; font-size: clamp(.8rem, 2vw, 1.05rem); padding: 10px 14px; border: 0; border-radius: 10px; cursor: pointer;
  color: #3a2a45; box-shadow: 0 5px 0 rgba(0, 0, 0, .18); transition: left .6s cubic-bezier(.3, 1.4, .5, 1), top .6s cubic-bezier(.3, 1.4, .5, 1), transform .6s; }
.b1 { background: #ffd1dc; left: 8%; top: 18%; transform: rotate(-8deg); }
.b2 { background: #c9e7ff; left: 66%; top: 14%; transform: rotate(6deg); }
.b3 { background: #d7f2c4; left: 12%; top: 64%; transform: rotate(5deg); }
.b4 { background: #ffe9a8; left: 64%; top: 66%; transform: rotate(-5deg); }
.block.used { opacity: 0; pointer-events: none; transform: scale(.4) rotate(20deg); }
.blocks.tumble .block { animation: tumble .9s ease-in forwards; }
@keyframes tumble { to { transform: translate(-50%, 300px) rotate(160deg); opacity: 0; } }
.line { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; width: 92%; }
.line b { padding: 8px 12px; border-radius: 10px; background: #fff8ec; font-size: clamp(.8rem, 2vw, 1rem); box-shadow: 0 4px 0 rgba(0, 0, 0, .15); animation: drop .4s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes drop { from { transform: translateY(-30px) scale(.6); opacity: 0; } }
.sprite { position: absolute; left: 50%; bottom: 8%; width: clamp(90px, 16vw, 150px); height: auto; transform: translateX(-50%); z-index: 3; }
.sprite.low { bottom: 6%; width: clamp(70px, 11vw, 110px); }
.sprite.in-hop { animation: in-hop .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes in-hop { from { transform: translate(-50%, 60px) scale(.5); opacity: 0; } }
.sprite.in-peek { animation: in-peek 1.4s ease; }
@keyframes in-peek { 0% { transform: translate(-50%, 120%); } 50% { transform: translate(-50%, 45%); } 70% { transform: translate(-50%, 45%); } 100% { transform: translate(-50%, 0); } }
.sprite.tipsy { transform: translateX(-50%) rotate(-24deg); cursor: pointer; transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }

/* 3. windows */
.wins { position: absolute; left: 0; right: 0; bottom: 24%; display: flex; justify-content: center; gap: 7%; }
.win { width: clamp(58px, 10vw, 96px); aspect-ratio: 1; padding: 6px; border-radius: 12px 12px 6px 6px; border: 5px solid #7a4f3a; background: #2f2747;
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px; cursor: pointer; box-shadow: 0 6px 0 rgba(0, 0, 0, .2); transition: background .6s; }
.win i { background: #3c3360; border-radius: 3px; transition: background .6s, box-shadow .6s; }
.win.lit { background: #7a4f3a; }
.win.lit i { background: #ffe08a; box-shadow: 0 0 18px #ffcf5a; }
.firefly { position: absolute; z-index: 4; padding: 2px 8px; border-radius: 99px; background: #fff4b8; color: #6a4a10; font-weight: 900; font-size: .8rem;
  box-shadow: 0 0 16px #ffe27a; pointer-events: none; transition: left 1.1s ease-in-out, top 1.1s ease-in-out, opacity .4s; }
.says { list-style: none; padding: 0; margin: .4em 0; font-size: 1.2rem; font-weight: 800; }
.says li { opacity: .25; transition: opacity .6s, transform .6s; }
.says li.on { opacity: 1; transform: scale(1.04); color: #b1407a; }

/* 4. garden */
.beds { position: absolute; inset: 0; }
.bloom { position: absolute; width: clamp(54px, 9vw, 90px); transform: translate(-50%, -100%); transform-origin: 50% 100%; animation: grow 1.2s cubic-bezier(.3, 1.5, .5, 1); image-rendering: pixelated; }
@keyframes grow { from { transform: translate(-50%, -100%) scaleY(0); } }
.seeds { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0 4px; }
.seed { font: inherit; font-weight: 800; padding: 10px 14px; border-radius: 99px; border: 2px dashed #b9895a; background: #fff3dc; color: #5a3a20; cursor: pointer; }
.seed::before { content: "🌰 "; }
.seed.chosen { background: #d7f2c4; border-style: solid; border-color: #6aa84f; }
.mission { margin: 12px auto 0; padding: 12px 16px; border-radius: 14px; background: #eef8e6; font-weight: 700; max-width: 520px; }

/* 5. doors */
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 6px; }
@media (max-width: 520px) { .doors { grid-template-columns: repeat(2, 1fr); } }
.door { position: relative; font: inherit; font-weight: 800; padding: 16px 8px 12px; border-radius: 40px 40px 10px 10px; border: 3px solid #9a6a4a; cursor: pointer;
  background: linear-gradient(180deg, #ffe7c2, #f6c98e); color: #4a2d1c; display: grid; gap: 4px; justify-items: center; transform-origin: left center; transition: transform .5s, background .4s; }
.door b { font-size: 1.8rem; }
.door.open { background: linear-gradient(180deg, #fff6d8, #ffe08a); transform: perspective(500px) rotateY(-14deg); box-shadow: inset 0 0 18px #ffd34d; }
.peek { min-height: 3em; margin: 8px 0 0; font-weight: 700; }

/* 6. quilt */
.maker { display: flex; gap: 18px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.my-square { width: 96px; height: 96px; border-radius: 8px; display: grid; place-items: center; font-size: 2.6rem; color: #fff; background: #e86a8a;
  outline: 3px dashed rgba(255, 255, 255, .8); outline-offset: -8px; box-shadow: 0 6px 14px rgba(0, 0, 0, .18); }
.my-square b { text-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.swatches, .marks { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.sw { width: 34px; height: 34px; border-radius: 8px; border: 3px solid #fff; box-shadow: 0 0 0 1px #d8c2a8; cursor: pointer; }
.sw[aria-pressed="true"], .mk[aria-pressed="true"] { box-shadow: 0 0 0 3px #3a2a45; }
.mk { width: 38px; height: 38px; border-radius: 8px; border: 0; background: #f4e6d0; font-size: 1.2rem; cursor: pointer; color: #3a2a45; }
.placed { position: absolute; z-index: 3; width: clamp(34px, 6vw, 60px); height: clamp(34px, 6vw, 60px); font-size: clamp(1rem, 3vw, 1.6rem); transform: translate(-50%, -50%);
  transition: left 1.2s cubic-bezier(.4, 1.3, .5, 1), top 1.2s cubic-bezier(.4, 1.3, .5, 1), transform 1.2s; outline-width: 2px; outline-offset: -5px; }
.ring { position: absolute; z-index: 2; border: 3px dashed #ffd768; border-radius: 12px; transform: translate(-50%, -50%); pointer-events: none; animation: ring 1.6s ease-out forwards; }
@keyframes ring { from { width: 40px; height: 40px; opacity: 1; } to { width: 520px; height: 360px; opacity: 0; } }

/* 7. warmth */
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 10px; }
.share { margin-top: 14px; }
.share canvas { width: min(300px, 80vw); height: auto; border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }

.pfoot { text-align: center; padding: 30px 16px 40px; font-size: .92rem; }
.sparkle { position: fixed; z-index: 60; pointer-events: none; font-size: 18px; animation: spk 1s ease-out forwards; }
@keyframes spk { to { transform: translate(var(--dx), var(--dy)) scale(1.1); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .scene .paper, .scene .pic { opacity: 1; transform: none; }
}

/* pinned onto Pixel's drawings (positions set by pixel.js from data-at) */
.block[data-at] { transform: translate(-50%, -50%) rotate(var(--r, 0deg)); }
.block.used[data-at] { transform: translate(-50%, -50%) scale(.4) rotate(20deg); }
.b1 { --r: -8deg; } .b2 { --r: 6deg; } .b3 { --r: 5deg; } .b4 { --r: -5deg; }
.wins.pinned { inset: 0; bottom: auto; display: block; }
.wins.pinned .win { position: absolute; width: clamp(30px, 4.4vw, 62px); padding: 3px; gap: 3px; border-width: 3px; transform: translate(-50%, -50%); }
.bloom[data-at] { transform: translate(-50%, -96%); }
@media (max-width: 700px) { .pic.wide { height: auto; min-height: 0; aspect-ratio: 4 / 3; } }
@media (max-width: 700px) { .pic.wide + .paper { margin-top: -10px; } .pic.wide .sprite { width: 70px; bottom: 4%; } }
