/* Hi Dood — the gentle hello activity (say-hi page). Needs styles.css. */
.mood-pill { display: inline-flex; align-items: center; gap: 8px; font: 800 .95rem/1 var(--body); padding: 0 16px; min-height: 44px; border: var(--line); border-radius: 999px; background: var(--white); white-space: nowrap; transition: background-color .4s; }
.mood-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--grey); transition: background-color .4s; }
[data-mood="happy"] .mood-pill { background: var(--sun); }
[data-mood="happy"] .mood-dot { background: #E8457A; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.5); } }
.play-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }

.scene { position: relative; margin-top: 30px; height: clamp(460px, 48vw, 560px); border: var(--line); border-radius: var(--r-lg); box-shadow: var(--pop); overflow: hidden; background: linear-gradient(#C9DCE8, #DDE9EE 70%); transition: background-color .8s; touch-action: pan-y; isolation: isolate; }
.scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(var(--sky), var(--sky-soft) 75%); opacity: 0; transition: opacity .9s; z-index: -1; }
.scene[data-stage="approach"]::after, .scene[data-stage="pet"]::after { opacity: .55; }
.scene[data-stage="happy"]::after { opacity: 1; }
.scene-sky { position: absolute; inset: 0; z-index: 0; }
.scene .cloud { filter: grayscale(1) brightness(.93); transition: filter .8s; }
.scene[data-stage="happy"] .cloud { filter: none; }
.s1 { top: 8%; width: 170px; animation-duration: 44s; animation-delay: -10s; } .s2 { top: 26%; width: 110px; animation-duration: 58s; animation-delay: -40s; } .s3 { top: 15%; width: 220px; animation-duration: 50s; animation-delay: -28s; }
.scene-sun { position: absolute; left: 46%; top: 7%; width: clamp(70px, 10vw, 120px); aspect-ratio: 1; border-radius: 50%; background: var(--sun); border: var(--line); box-shadow: 0 0 0 12px rgba(255, 228, 92, .4), 0 0 0 28px rgba(255, 228, 92, .2); transform: translateY(520px); transition: transform 1.3s cubic-bezier(.2, 1.3, .4, 1); }
.scene[data-stage="happy"] .scene-sun { transform: none; }
.rainbow { position: absolute; left: 50%; bottom: 12%; width: min(86%, 760px); aspect-ratio: 2 / 1; translate: -50% 0; border-radius: 999px 999px 0 0 / 100% 100% 0 0; background: radial-gradient(circle at 50% 100%, transparent 0 52%, #fff 52% 60%, #FFE45C 60% 68%, #FF9DB8 68% 76%, transparent 76%); opacity: 0; clip-path: inset(0 100% 0 0); transition: clip-path 1.4s ease-out .3s, opacity .4s; }
.scene[data-stage="happy"] .rainbow { opacity: .9; clip-path: inset(0 0 0 0); }
.scene-hill { position: absolute; left: -8%; right: -8%; bottom: -1px; height: 27%; background: #E9E1CF; border-top: var(--line); border-radius: 50% 50% 0 0 / 70% 70% 0 0; z-index: 1; transition: background-color .9s; }
.scene[data-stage="approach"] .scene-hill, .scene[data-stage="pet"] .scene-hill { background: #F3E7B5; }
.scene[data-stage="happy"] .scene-hill { background: #FFEE93; }
.flower { position: absolute; bottom: 34%; width: 30px; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--sun) 0 28%, var(--ink) 29% 36%, transparent 37%), radial-gradient(circle at 50% 12%, #fff 0 22%, transparent 23%), radial-gradient(circle at 88% 40%, #fff 0 22%, transparent 23%), radial-gradient(circle at 74% 86%, #fff 0 22%, transparent 23%), radial-gradient(circle at 26% 86%, #fff 0 22%, transparent 23%), radial-gradient(circle at 12% 40%, #fff 0 22%, transparent 23%); filter: drop-shadow(0 0 0 var(--ink)) drop-shadow(0 2px 0 rgba(91, 70, 54, .5)); transform: scale(0); transition: transform .6s cubic-bezier(.3, 1.8, .5, 1); }
.scene[data-stage="happy"] .flower { transform: scale(1); }
.f1 { left: 14%; transition-delay: .5s; } .f2 { left: 27%; bottom: 52%; transition-delay: .7s; } .f3 { left: 41%; bottom: 60%; transition-delay: .9s; --p: #FF9DB8; } .f4 { left: 58%; bottom: 58%; transition-delay: .6s; } .f5 { left: 74%; bottom: 46%; transition-delay: .8s; } .f6 { left: 88%; bottom: 28%; transition-delay: 1s; }
.f3, .f5 { background: radial-gradient(circle, var(--sun) 0 28%, var(--ink) 29% 36%, transparent 37%), radial-gradient(circle at 50% 12%, #FF9DB8 0 22%, transparent 23%), radial-gradient(circle at 88% 40%, #FF9DB8 0 22%, transparent 23%), radial-gradient(circle at 74% 86%, #FF9DB8 0 22%, transparent 23%), radial-gradient(circle at 26% 86%, #FF9DB8 0 22%, transparent 23%), radial-gradient(circle at 12% 40%, #FF9DB8 0 22%, transparent 23%); }

.bubble { position: absolute; z-index: 6; left: 4%; top: 6%; max-width: min(46%, 430px); background: var(--white); border: var(--line); border-radius: 26px 26px 26px 8px; padding: 14px 20px; font: 800 clamp(1rem, 1.9vw, 1.25rem)/1.3 var(--body); box-shadow: 0 5px 0 var(--ink); }
.bubble.is-new { animation: bub .4s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bub { from { transform: scale(.85) rotate(-3deg); } }
.scene[data-mood="startled"] .bubble { background: var(--pink); }
.scene[data-stage="happy"] .bubble { background: var(--sun); }

.pal { position: absolute; z-index: 3; right: 12%; bottom: 8%; width: clamp(200px, 30%, 330px); transition: transform .4s cubic-bezier(.3, 1.5, .5, 1); transform-origin: 50% 100%; }
.pal-bob { animation: bob 3.4s ease-in-out infinite; transform-origin: 50% 100%; }
.pal .dood { width: 100%; }
.scene[data-mood="startled"] .pal { transform: translateX(7%) rotate(7deg); }
.scene[data-mood="startled"] .pal-bob { animation: shiver .12s linear infinite; }
.scene[data-mood="startled"] .d-brow { transform: translateY(-12px); }
.scene[data-mood="startled"] .d-earl { animation: none; transform: skewY(-9deg) scaleX(1.1); }
.scene[data-mood="startled"] .d-earr { animation: none; transform: skewY(9deg) scaleX(1.1); }
.scene[data-mood="startled"] .d-tail { animation: none; }
.scene[data-mood="sniff"] .pal { transform: rotate(-4deg); }
.scene[data-mood="sniff"] .d-nose { animation: sniff .28s ease-in-out infinite; }
.scene[data-stage="happy"] .pal-bob { animation: hopjoy .55s ease-in-out infinite; }
@keyframes shiver { 0%, 100% { transform: translateX(-2px); } 50% { transform: translateX(2px); } }
@keyframes sniff { 50% { transform: translateY(-5px); } }
@keyframes hopjoy { 0%, 100% { transform: translateY(0) scaleY(1); } 40% { transform: translateY(-16px) scaleY(1.03); } 80% { transform: translateY(0) scaleY(.97); } }
.eep { position: absolute; left: -4%; top: 2%; font: 700 3.4rem/1 var(--display); color: var(--ink); background: var(--sun); border: var(--line); width: 1.3em; height: 1.3em; border-radius: 50%; display: grid; place-items: center; transform: scale(0) rotate(-14deg); transition: transform .2s cubic-bezier(.3, 1.8, .5, 1); }
.scene[data-mood="startled"] .eep { transform: scale(1) rotate(-14deg); }
.sniff { position: absolute; left: 50%; top: 41%; width: 44%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: conic-gradient(var(--rose) calc(var(--p, 0) * 1turn), rgba(255, 255, 255, .7) 0); -webkit-mask: radial-gradient(circle, transparent 0 58%, #000 59% 70%, transparent 71%); mask: radial-gradient(circle, transparent 0 58%, #000 59% 70%, transparent 71%); opacity: 0; transition: opacity .25s; pointer-events: none; }
.scene[data-stage="approach"] .sniff { opacity: 1; }
.pal-hearts { position: absolute; left: 50%; top: -15%; translate: -50% 0; display: flex; gap: 8px; opacity: 0; transition: opacity .3s; }
.scene[data-stage="pet"] .pal-hearts, .scene[data-stage="happy"] .pal-hearts { opacity: 1; }
.pal-hearts span, .pt-heart { width: 38px; aspect-ratio: 1; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath fill='%23fff' stroke='%235B4636' stroke-width='3' stroke-linejoin='round' d='M20 35C3 23 4 7 13 7c4 0 7 3 7 6 0-3 3-6 7-6 9 0 10 16-7 28Z'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform .3s cubic-bezier(.3, 1.8, .5, 1); }
.pal-hearts span.on, .pt-heart { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath fill='%23FF9DB8' stroke='%235B4636' stroke-width='3' stroke-linejoin='round' d='M20 35C3 23 4 7 13 7c4 0 7 3 7 6 0-3 3-6 7-6 9 0 10 16-7 28Z'/%3E%3C/svg%3E"); }
.pal-hearts span.on { transform: scale(1.2); }

.ask { position: absolute; z-index: 6; left: 30%; top: 50%; translate: -50% -50%; font-size: clamp(1.15rem, 2.2vw, 1.5rem); padding: 16px 30px; animation: askpulse 1.8s ease-in-out infinite; }
@keyframes askpulse { 50% { scale: 1.06; } }
.home { position: absolute; z-index: 2; left: 5%; bottom: 8%; width: clamp(104px, 13vw, 140px); aspect-ratio: 1.25; border: 3px dashed rgba(91, 70, 54, .55); border-radius: 26px; display: grid; place-items: end center; padding-bottom: 6px; font: 800 .8rem/1 var(--body); color: var(--ink); background: rgba(255, 255, 255, .35); }
.hand { position: absolute; z-index: 5; left: 0; top: 0; width: clamp(92px, 11vw, 124px); padding: 0; border: 0; background: none; cursor: grab; touch-action: none; transform: translate3d(var(--hx, 40px), var(--hy, 300px), 0); -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.hand svg { width: 100%; overflow: visible; filter: drop-shadow(0 6px 0 rgba(91, 70, 54, .22)); transition: transform .2s; pointer-events: none; }
.hand.is-auto { transition: transform 1.1s cubic-bezier(.4, 0, .3, 1); }
.hand.is-drag { cursor: grabbing; }
.hand.is-drag svg { transform: scale(1.08) rotate(-4deg); }
.scene[data-stage="ask"] .hand svg { animation: nudge 2.2s ease-in-out infinite; }
@keyframes nudge { 0%, 70%, 100% { transform: none; } 78% { transform: rotate(-8deg); } 86% { transform: rotate(6deg); } }
.hand:focus-visible { outline-offset: 6px; border-radius: 26px; }
.hand-mitt { fill: var(--sun); } .hand-cuff { fill: var(--rose); } .hand-ink { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }

.badge { position: absolute; z-index: 6; left: 5%; top: 36%; width: clamp(92px, 12vw, 128px); aspect-ratio: 1; display: grid; place-items: center; text-align: center; font: 700 clamp(.95rem, 1.6vw, 1.2rem)/1.05 var(--display); background: var(--sun); border: var(--line); border-radius: 50%; box-shadow: 0 0 0 7px #fff, 0 0 0 10px var(--ink); transform: scale(0) rotate(40deg); transition: transform .6s cubic-bezier(.3, 1.7, .5, 1) .5s; }
.scene[data-stage="happy"] .badge { transform: scale(1) rotate(-10deg); }
.scene[data-stage="happy"] .home { opacity: 0; }

.steps { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.steps li { display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px 8px 8px; border: var(--line); border-radius: 999px; background: var(--white); font: 800 1rem/1 var(--body); transition: background-color .3s, transform .3s; }
.steps b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--sky-soft); font: 700 1.05rem/1 var(--display); }
.steps li.is-now { background: var(--sun); transform: translateY(-3px) rotate(-1.5deg); box-shadow: 0 5px 0 var(--ink); }
.steps li.is-done b { background: var(--rose); font-size: 0; }
.steps li.is-done b::after { content: "✓"; font-size: 1.1rem; }
.scene-ctl { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 22px; }
.steps li.is-done b::after { color: var(--ink); }

/* happy burst */
.burst { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.burst i { position: absolute; top: -70px; width: 46px; aspect-ratio: 1; background-position: center; background-size: contain; background-repeat: no-repeat; right: auto; bottom: auto; animation: fall var(--t, 2.4s) cubic-bezier(.3, .2, .6, 1) var(--dl, 0s) both; }
@keyframes fall { from { transform: translate3d(0, 0, 0) rotate(0deg); } to { transform: translate3d(var(--dx, 0), 115vh, 0) rotate(var(--rot, 300deg)); } }
[data-mood="happy"] .eyebrow { background: var(--sun); }

/* without JS the scene is a still picture and the steps below carry the lesson */
html:not(.js) .scene .bubble, html:not(.js) .scene .hand, html:not(.js) .scene .ask, html:not(.js) .scene .home, html:not(.js) .scene-ctl, html:not(.js) #handHelp { display: none; }

@media (max-width: 620px) {
  .scene { height: 520px; }
  .ask { left: 50%; top: 40%; white-space: nowrap; }
  .scene-sun { left: 62%; top: 22%; }
  .bubble { left: 12px; right: 12px; top: 12px; max-width: none; padding: 12px 16px; }
  .pal { right: 4%; bottom: 6%; width: 58%; }
  .home { left: 4%; bottom: 5%; }
  .badge { left: 5%; top: 24%; }
  .scene-ctl .btn { flex: 1 1 100%; }
  .steps li { padding-right: 14px; font-size: .95rem; }
}
