:root { color-scheme: light; font-family: "Segoe UI", system-ui, sans-serif; color: #63493f; background: #fff8ed; font-synthesis: none; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
#deploy-time { display: none; }
body:is([data-stage="loading"], [data-stage="password"]) #deploy-time {
  display: block; position: fixed; inset-inline: 12px; bottom: max(12px, env(safe-area-inset-bottom));
  color: #67574e; font-size: 11px; text-align: center; pointer-events: none;
}
body { margin: 0; min-height: 100svh; display: grid; place-items: center; background-image: radial-gradient(#e9d9c6 1px, transparent 1px); background-size: 22px 22px; }
main { width: min(100% - 32px, 460px); padding: 32px 0; }
button { border: 1.5px solid #a16b60; border-radius: 11px; background: #edb7ac; color: #533c35; width: 100%; padding: 13px 20px; font: inherit; font-size: 14px; font-weight: 650; line-height: 1.6; cursor: pointer; box-shadow: 0 3px 0 #a16b60; transition: background .15s; }
button:hover { background: #f4c7bb; }
button:active { box-shadow: 0 1px 0 #a16b60; }
button:focus-visible, input:focus-visible { outline: 3px solid #725d81; outline-offset: 4px; }
button:disabled { cursor: default; opacity: .7; }
body[data-stage="loading"], body[data-stage="error"] { background: #f3f3f3; }
html:has(body[data-stage="blackout"]), body[data-stage="blackout"] {
  overflow: hidden; background: #000;
}
html:has(body[data-stage="party"]), body[data-stage="party"] {
  overflow: hidden; background: #080605;
}
.loading-screen { text-align: center; color: #555; }
.loading-screen p { font-size: 18px; margin: 22px 0 12px; }
.spinner { margin: auto; width: 32px; height: 32px; border: 3px solid #ddd; border-top-color: #777; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.window { border: 1px solid #bcbcbc; border-radius: 5px; box-shadow: 0 10px 35px #0002; background: #fff; overflow: hidden; }
.titlebar { display: flex; justify-content: space-between; padding: 12px 18px; background: #fafafa; color: #333; border-bottom: 1px solid #ddd; font-size: 12px; }
.titlebar > span:first-child { display: flex; align-items: center; gap: 8px; }
.titlebar i { width: 8px; height: 8px; background: #c84740; border-radius: 2px; }
.content { padding: 28px; }
.error-heading { display: flex; gap: 14px; align-items: center; text-align: left; }
.error-icon { background: #c9433f; color: #fff; border-radius: 50%; width: 36px; height: 36px; flex-shrink: 0; font: 30px/32px system-ui; text-align: center; }
.error-heading h1 { margin: 0; font-size: 17px; font-weight: 500; color: #222; line-height: 1.5; }
#error-title:focus { outline: none; }
.description { text-align: left; color: #555; font-size: 12px; margin-top: 18px; line-height: 1.9; }
.error-details { text-align: left; margin-top: 16px; padding: 13px; background: #f4f4f4; border: 1px solid #ddd; color: #666; font-size: 11px; line-height: 1.9; overflow-wrap: anywhere; }
.error-help { font-size: 11px; color: #777; margin: 13px 0 0; }
.password-slot { display: grid; margin-top: 24px; }
.password-slot > * { grid-area: 1 / 1; }
#retry { align-self: start; border: 1px solid #aaa; border-radius: 4px; background: #f3f3f3; color: #333; box-shadow: none; font-weight: 400; }
#retry:hover { background: #e8e8e8; }
#password-form[hidden] { display: block !important; visibility: hidden; }
#password-form:not([hidden]) { animation: show-password .2s ease-out; }
@keyframes show-password { from { opacity: 0; } }
#password-form label { display: block; color: #333; font-size: 16px; }
.password-input { position: relative; margin-top: 16px; }
#birthday { padding-right: 44px; }
.unlock-loading::before {
  content: ''; display: inline-block; width: 14px; height: 14px; margin-right: 8px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  vertical-align: -2px; animation: spin .8s linear infinite;
}
.password-hint { margin: 8px 0; color: #777; font-size: 11px; }
#birthday { width: 100%; border: 1px solid #aaa; border-radius: 5px; background: #fff; color: #333; padding: 12px 44px 12px 12px; font: 18px monospace; letter-spacing: 4px; }
#birthday[aria-invalid="true"] { border-color: #b43c3c; }
#password-error { min-height: 18px; font-size: 12px; color: #ad3636; margin: 8px 0; }
.penguin-scene .mascot { --penguin-size: clamp(170px, 34svh, 230px); position: fixed; z-index: 5; width: var(--penguin-size); height: calc(var(--penguin-size) * 1.182); left: 50%; top: 50%; transform: translate(-50%,-50%); pointer-events: none; }
.penguin-sprite { width: 100%; aspect-ratio: 1; background: url('./assets/penguin-wave-sample.png') 0 0 / 400% 200% no-repeat; }
.search-mark { display: none; }
.speech { position: absolute; z-index: 10; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%); width: min(280px, calc(100vw - 32px)); margin: 0; padding: 13px 16px; border: 1.5px solid #ccb4a1; border-radius: 17px; background: #fffcf5; box-shadow: 0 4px 12px #63493f14; text-align: center; }
.speech::after { content: ''; position: absolute; top: 100%; left: calc(50% - 9px); border: 9px solid transparent; border-top-color: #ccb4a1; }
.speech p { margin: 0; font-size: 14px; line-height: 1.7; }
.little-wall { position: fixed; z-index: 6; left: 50%; top: calc(50% + 20px); width: min(320px, calc(100vw - 32px)); height: 170px; transform: translateX(-50%); border: 2px solid #c9ad96; border-top: 12px solid #e5cbb1; border-radius: 8px 8px 12px 12px; box-shadow: 0 9px 0 #dbccb84a; background-color: #f0dfcb; background-image: linear-gradient(#d6bda5 1px, transparent 1px), linear-gradient(90deg, #d6bda5 1px, transparent 1px); background-size: 100% 36px, 70px 72px; pointer-events: none; }
.sos { position: fixed; z-index: 8; left: 50%; top: calc(50% + clamp(120px, 23svh, 165px)); transform: translateX(-50%); width: min(300px, calc(100vw - 32px)); }
.game-panel { background: #fffcf5; border: 1px solid #dfc7b5; border-radius: 22px; padding: 28px 24px; text-align: center; box-shadow: 0 8px 28px #63493f12; }
.game-panel h2 { font-size: 23px; line-height: 1.5; }
h1 { font-size: clamp(28px,7vw,36px); line-height: 1.3; }
.game-panel p { font-size: 14px; line-height: 1.8; }
.papers { display: flex; gap: 14px; padding: 22px 0; }
.paper { font-size: 38px; background: #fff0c9; transform: rotate(-6deg); padding: 12px; }
.paper:nth-child(2) { transform: rotate(8deg); }
.paper:nth-child(3) { transform: rotate(-3deg); }
#penguin-scene { min-height: 550px; }
.idea-rays {
  position: absolute; top: -20px; left: 55%; width: 64px; height: 28px;
  transform: translateX(-50%); opacity: 0; z-index: 4; pointer-events: none;
  fill: none; stroke: #e5aa39; stroke-width: 5; stroke-linecap: round;
}
[data-phase="found"] .idea-rays,
[data-phase="offering"] .idea-rays { animation: idea-light .25s ease-out both; }
@keyframes idea-light {
  from { opacity: 0; transform: translateX(-50%) scale(.6); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}
#penguin-scene[data-view="tickets"] { min-height: 0; }
#penguin-scene[data-view="tickets"] > #ticket-options { margin-top: 0; }
.ticket-draw { position: relative; z-index: 4; text-align: center; }
.ticket-draw #game-title { margin: 8px 0; }
.ticket-draw #paper-result { min-height: 0; }
.climb-stage[data-tickets] { height: 370px; transition: height 1.2s ease-in-out; }
.climb-stage[data-tickets] .climb-actor {
  transform: translate(-50%,70px); transform-origin: center top;
  transition: transform 1.2s ease-in-out;
}
#ticket-options { position: absolute; inset: 0; transform: translateX(8px); }
#ticket-options .papers { position: absolute; inset: 0; padding: 0; margin: 0; }
#ticket-options .paper {
  position: absolute; top: 55%; width: 12%; height: 20%; padding: 0;
  border: 0; border-radius: 3px; background: transparent; box-shadow: none;
  font-size: 6px; line-height: 1.2; transform: rotate(var(--tilt));
  animation: ticket-label .3s ease-out both;
}
#ticket-options .paper:nth-child(1) { left: 37%; --tilt: -18deg; }
#ticket-options .paper:nth-child(2) { left: 48%; --tilt: 0deg; }
#ticket-options .paper:nth-child(3) { left: 59%; --tilt: 18deg; }
#ticket-options .paper span { font-size: 13px; }
#ticket-options .paper:disabled { opacity: 1; }
#ticket-options .paper:hover, #ticket-options .paper:focus-visible { outline: 1.5px solid #b98669; outline-offset: 1px; background: #fff7df60; }
#ticket-options .paper.picked { background: #ffebbed9; outline: 1.5px solid #b98669; }
@keyframes ticket-label { from { opacity: 0; } to { opacity: 1; } }
#penguin-scene .climb-frames,
#penguin-scene .wave-after-climb,
#penguin-scene .pocket-frames,
#penguin-scene .ticket-pull-frames {
  background: url('./assets/penguin-pocket-clean.png') 0 0 / 400% 300% no-repeat;
}
#penguin-scene .climb-frames, #penguin-scene .wave-after-climb { animation: none; }
#penguin-scene [data-phase="peek"] .climb-frames { opacity: 0; }
#penguin-scene [data-phase="peek"] .wave-after-climb {
  opacity: 1;
  background: url('./assets/penguin-wave-connected.png') 0 0 / 400% 200% no-repeat;
  animation: wave-sample 1s steps(1,end) infinite;
}
#penguin-scene [data-phase="landed"] .wave-after-climb {
  background: url('./assets/penguin-wave-connected.png') 0 0 / 400% 200% no-repeat;
  transform-origin: center 95%;
}
#penguin-scene [data-phase="landed"] .wave-after-climb.waving {
  animation: landed-speak 1.2s ease-in-out both;
}
@keyframes landed-speak {
  30% { transform: translateY(1px) scaleY(.975); }
  62% { transform: translateY(-1px) scaleY(1.015); }
}
#penguin-scene [data-phase="peek"] .climb-actor {
  animation: approved-peek .9s ease-in-out both;
}
@keyframes approved-peek {
  0%,10% { transform: translate(-50%,130px); }
  70% { transform: translate(-50%,-12px); }
  88% { transform: translate(-50%,-2px); }
  100% { transform: translate(-50%,-5px); }
}
#penguin-scene .climb-frames {
  background-image: url('./assets/penguin-approved-climb-transparent.png');
}
#penguin-scene [data-phase="climb"] .climb-frames {
  animation: sample-climb-frames 1.8s steps(1,end) forwards;
}
#penguin-scene [data-phase="climb"] .climb-actor {
  animation: approved-climb 1.8s ease-in-out both;
}
@keyframes approved-climb {
  0% { transform: translate(-50%,-5px); }
  16% { transform: translate(-50%,-9px) scale(1.02,.98); }
  40% { transform: translate(-50%,-25px); }
  60% { transform: translate(-50%,-35px); }
  80% { transform: translate(-50%,44px); }
  92% { transform: translate(-50%,75px) scale(1.03,.97); }
  100% { transform: translate(-50%,70px); }
}
#penguin-scene [data-phase="rummaging"] .pocket-frames {
  opacity: 1;
  animation: pocket-bend .5s steps(1,end) both, approved-search .5s .5s steps(1,end) infinite;
}
#penguin-scene [data-phase="huh"] .pocket-frames,
#penguin-scene [data-phase="looking"] .pocket-frames,
#penguin-scene [data-phase="found"] .pocket-frames {
  opacity: 1; animation: approved-search .7s steps(1,end) infinite;
}
#penguin-scene .climb-actor[data-phase] .wave-after-climb,
#penguin-scene [data-phase="offering"] .pocket-frames { opacity: 0; }
.ticket-pull-frames { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
#penguin-scene [data-phase="offering"] .ticket-pull-frames {
  opacity: 1; animation: approved-pull .9s steps(1,end) forwards, approved-cheer .45s .9s ease-out;
}
.climb-stage[data-tickets="found"] .climb-bubble { animation: found-bubble .25s ease-out both; }
@keyframes approved-cheer {
  0%,100% { transform: translateY(0); }
  45% { transform: translateY(-6px) rotate(-2deg); }
}
@keyframes found-bubble {
  from { opacity: 0; transform: translate(-50%,4px) scale(.96); }
  to { opacity: 1; transform: translate(-50%,0) scale(1); }
}
#ticket-options { transform: none; }
#ticket-options .paper { top: 52%; width: 6%; height: 12%; overflow-wrap: anywhere; }
#ticket-options .paper span { font-size: 10px; }
#ticket-options .paper:nth-child(1) { left: 45%; }
#ticket-options .paper:nth-child(2) { left: 51%; }
#ticket-options .paper:nth-child(3) { left: 57%; }
@keyframes approved-reach {
  0% { background-position: 0 0; }
  20% { background-position: 33.333333% 0; }
  40% { background-position: 66.666667% 0; }
  60% { background-position: 100% 0; }
  80%,100% { background-position: 0 50%; }
}
@keyframes approved-search {
  0%,100% { background-position: 0 50%; }
  25% { background-position: 33.333333% 50%; }
  50% { background-position: 66.666667% 50%; }
  75% { background-position: 100% 50%; }
}
@keyframes approved-pull {
  0% { background-position: 0 100%; }
  25% { background-position: 33.333333% 100%; }
  50% { background-position: 66.666667% 100%; }
  75%,100% { background-position: 100% 100%; }
}
@media (prefers-reduced-motion: reduce) {
  #penguin-scene [data-phase="huh"] .pocket-frames,
  #penguin-scene [data-phase="looking"] .pocket-frames,
  #penguin-scene [data-phase="found"] .pocket-frames { background-position: 0 50%; }
  #penguin-scene [data-phase="offering"] .ticket-pull-frames { background-position: 100% 100%; }
}
#paper-result { min-height: 76px; }
#quiz-label { letter-spacing: 2px; font-size: 22px; font-weight: 750; color: #704e3c; }
#quiz-progress { color: #937968; font-size: 17px; font-weight: 650; }
#quiz-title { font-size: 21px; }
.quiz-answers { display: grid; gap: 12px; margin: 22px 0; }
.quiz-answers button { text-align: left; background: #fff7e9; border-color: #c6aa96; box-shadow: none; font-weight: 400; }
.quiz-answers .selected { background: #f1c5b8; border-color: #936b60; opacity: 1; }
#quiz-next[hidden] { display: block !important; visibility: hidden; }
.grading-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
body[data-stage="grading"] { background: #f9e7cf; }
body[data-stage="grading"] main { width: min(100%, 64svh, 520px); padding: 0; }
body[data-stage="grading"] #age-quiz {
  border: 0; background: transparent; box-shadow: none; padding: 0;
}
body[data-stage="grading"] #quiz-label { display: none; }
body[data-stage="grading"] main { width: min(100% - 32px, 520px); }
.grading-fade.grading-long { animation-duration: 5s; }
.grading-fade { animation: grading-text-fade 3s ease-in-out both; }
#grading-dialogue.grading-joke {
  position: relative; color: #b65e48; font-weight: 800;
  font-size: clamp(20px, 5.4vw, 30px);
  animation: grading-joke-pop 3s ease-out both;
}
#grading-dialogue.grading-joke::before,
#grading-dialogue.grading-joke::after {
  content: ''; position: absolute; top: 40%; width: 12px; height: 18px;
  background: #e9b687; border: 1px solid #b68262; border-radius: 2px;
  pointer-events: none; animation: grading-paper-left .85s ease-out both;
}
#grading-dialogue.grading-joke::before { left: 12%; }
#grading-dialogue.grading-joke::after {
  right: 12%; background: #e5b5b0; animation-name: grading-paper-right;
}
@keyframes grading-joke-pop {
  0% { opacity: 0; transform: scale(.7) rotate(0); }
  6% { opacity: 1; transform: scale(1.045) rotate(-2deg); }
  12% { transform: scale(.985) rotate(1deg); }
  18%, 84% { opacity: 1; transform: scale(1) rotate(-1deg); }
  100% { opacity: 0; transform: scale(1) rotate(-1deg); }
}
@keyframes grading-paper-left {
  from { opacity: 1; transform: translate(0, 0) rotate(-10deg); }
  to { opacity: 0; transform: translate(-60px, -90px) rotate(-140deg); }
}
@keyframes grading-paper-right {
  from { opacity: 1; transform: translate(0, 0) rotate(10deg); }
  to { opacity: 0; transform: translate(60px, -90px) rotate(140deg); }
}
#grading-dialogue.grading-countdown {
  font-size: clamp(64px, 20vmin, 120px); font-weight: 750; line-height: 1;
}
@keyframes grading-text-fade {
  0%, 100% { opacity: 0; }
  17%, 83% { opacity: 1; }
}
#grading-dialogue {
  margin: 0; font-size: clamp(19px, 5vw, 26px); line-height: 1.65;
  text-wrap: balance;
}
.grading-scene {
  position: relative; aspect-ratio: 1312 / 1199; overflow: hidden;
  background: url('./assets/penguin-grading-overalls.png') left top / 200% 200% no-repeat;
}
.grading-scene:is([data-phase="viewer"], [data-phase="judging"]) { background-position: right top; }
.grading-scene[data-phase="judging"]::before,
.grading-scene[data-phase="judging"]::after {
  content: ''; position: absolute; width: 5.1%; height: 2%;
  background: #f5e0d6; border-bottom: 2px solid #39261f;
  border-radius: 45% 40% 15% 15%;
  animation: grading-squint .38s ease-out both;
}
.grading-scene[data-phase="judging"]::before {
  left: 38.5%; top: 39.2%; transform: rotate(10deg);
}
.grading-scene[data-phase="judging"]::after {
  left: 56.1%; top: 35.6%; transform: rotate(-5deg);
}
@keyframes grading-squint {
  from { opacity: 0; translate: 0 -40%; }
  to { opacity: 1; translate: 0 0; }
}
.grading-scene[data-phase="thinking"] { background-position: left bottom; }
.grading-scene[data-phase="toss"] {
  background-position: right bottom;
}
.grading-scene span { display: none; }
.grading-scene[data-phase="toss"] span {
  display: block; position: absolute; top: 64%; left: 45%; width: 22%; aspect-ratio: .77;
  border: 2px solid #bb9a78; border-radius: 4px;
  background: repeating-linear-gradient(#fff3d9 0 10px, #d8b99d 10px 12px);
  animation: toss-quiz .85s ease-out both;
}
@keyframes toss-quiz {
  from { transform: rotate(-12deg); }
  to { opacity: 0; transform: translate(160%,-370%) rotate(85deg); }
}
.game-panel .finale-line, #birthday-guide .finale-line { min-height: 1.8em; margin: 12px 0; font-size: 16px; font-weight: 650; }
.finale-penguin {
  width: 130px; aspect-ratio: 1; flex: none;
  background: url('./assets/penguin-wave-connected.png') 0 0 / 400% 200% no-repeat;
}
#birthday-guide:not([hidden]) {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center;
  padding: 16px; text-align: center; isolation: isolate; overflow: hidden;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  --guide-duration: 4.6s;
}
.guide-track, body[data-stage="party"] {
  background: linear-gradient(#f6e7da 0 61%, #d4ab90 61% 62%, #e5c6ab 62% 64%, #d4ab90 64% 65%, #ead2bb 65%);
}
.guide-track {
  position: absolute; inset: 0; z-index: -1;
}
.guide-track::before {
  content: ''; position: absolute; inset: 65% 0 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 138px, #bb8d7030 138px 140px),
    repeating-linear-gradient(0deg, transparent 0 27px, #bb8d703b 27px 29px);
}
.guide-track::after {
  content: ''; position: absolute; inset: 0 0 39%;
  background: repeating-linear-gradient(90deg, #fff5e33d 0 38px, transparent 38px 76px);
}
.guide-pair { position: relative; }
.guide-penguin {
  width: min(340px, 78vw, 66svh);
  background-image: url('./assets/penguin-guide-walk-clean.png');
  transform-origin: 29% 62%;
}
#take-hand {
  position: absolute; top: 62%; right: 70%; transform: translateY(-50%);
  width: 48px; height: 48px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
  z-index: 1; color: #804437; background: #fff5e3;
  border: 2px dashed #aa6857; box-shadow: 0 2px 6px #533c3526;
  touch-action: none;
}
#take-hand svg {
  display: block; width: 30px; height: 30px; pointer-events: none;
}
#birthday-guide:is([data-phase="ready"], [data-phase="paused"]) #take-hand::before,
#birthday-guide:is([data-phase="ready"], [data-phase="paused"]) #take-hand::after {
  content: ''; position: absolute; left: -28px;
  width: 23px; height: 16px; background: #804437;
  clip-path: polygon(0 37%, 62% 37%, 62% 0, 100% 50%, 62% 100%, 62% 63%, 0 63%);
  pointer-events: none; animation: hand-cue 1.3s ease-in-out infinite;
}
#take-hand::before { top: -2px; rotate: 26deg; }
#take-hand::after { bottom: -2px; rotate: -26deg; }
@keyframes hand-cue { 50% { opacity: .25; } }
#birthday-guide[data-phase="walking"] #take-hand {
  color: #fff8ed; background: #955546; border-color: #804437;
  box-shadow: 0 0 0 4px #aa68574d;
}
.guide-hint { margin: 8px 0 0; }
#guide-line { max-width: 360px; text-wrap: balance; }
#birthday-guide[data-phase="release"] .guide-hint { visibility: hidden; }
#birthday-guide:is([data-phase="walking"], [data-phase="paused"]) .guide-track::after { animation: guide-pan var(--guide-duration) linear both; }
#birthday-guide:is([data-phase="walking"], [data-phase="paused"]) .guide-track::before {
  animation: guide-floor-pan var(--guide-duration) linear both;
}
#birthday-guide:is([data-phase="walking"], [data-phase="paused"]) .guide-penguin {
  animation: guide-steps .84s steps(1, end) infinite, guide-weight .84s ease-in-out infinite;
}
#birthday-guide[data-phase="paused"] .guide-track::after,
#birthday-guide[data-phase="paused"] .guide-track::before,
#birthday-guide[data-phase="paused"] .guide-penguin { animation-play-state: paused; }
#birthday-guide[data-phase="release"] .guide-track::after { background-position-x: -464px; }
#birthday-guide[data-phase="release"] .guide-track::before { background-position-x: -640px, 0; }
#birthday-guide:is([data-phase="blackout"], [data-phase="arrived"]) {
  color: #fff2dc;
}
#birthday-guide[data-phase="blackout"] .guide-track { background: #080605; }
#birthday-guide[data-phase="arrived"] .guide-track {
  background: radial-gradient(ellipse at center, #694532 0%, #221510 42%, #080605 72%);
}
#birthday-guide:is([data-phase="blackout"], [data-phase="arrived"]) .guide-track::before,
#birthday-guide:is([data-phase="blackout"], [data-phase="arrived"]) .guide-track::after {
  display: none;
}
#birthday-guide:is([data-phase="blackout"], [data-phase="arrived"]) :is(#guide-line, .guide-hint, .guide-pair) {
  visibility: hidden;
}
.cake-stand { display: none; }
#birthday-guide[data-phase="arrived"] .cake-stand {
  display: grid; justify-items: center; position: absolute; inset: 0; margin: auto;
  font-size: clamp(11px, min(4.5vw, 3.1svh), 18px);
  width: 17.6em; height: 19em;
  animation: reveal-cake 1.6s ease-out both;
}
.cake-stand::after {
  content: ''; width: 100%; height: 6em; margin-top: -1em;
  border-top: 1em solid #a87558; border-inline: .9em solid #79523f;
  border-radius: 4px 4px 0 0;
}
@keyframes reveal-cake { from { opacity: 0; } }
#wish-done:not([hidden]) { animation: reveal-cake 1.6s ease-out both; }
#birthday-party {
  position: absolute; inset: 0; pointer-events: none;
}
#party-title {
  position: absolute; top: 5%; inset-inline: 16px; margin: 0;
  font-size: clamp(20px, 5vw, 34px); line-height: 1.2;
  transition: opacity .65s ease-in-out;
}
#party-title.fading { opacity: 0; }
#party-title.wish-transition { transition-duration: 1.1s; }
#party-title.love-message {
  color: #ffc7d4; font-size: clamp(23px, 6vw, 34px); font-weight: 650;
  letter-spacing: .02em;
  animation: love-glow 2.4s ease-in-out infinite;
}
@keyframes love-glow {
  0%, 100% { text-shadow: 0 0 8px #f69caf30; }
  50% { text-shadow: 0 0 18px #f69cafaa, 0 0 34px #ef7fa350; }
}
#birthday-effects {
  position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 4;
}
#birthday-effects span {
  position: absolute; top: -40px; left: var(--x);
  color: hsl(var(--hue) 80% 78%); font-size: 22px;
  animation: birthday-fall 4.5s var(--delay) linear both;
}
#birthday-effects[data-kind="confetti"] span {
  top: 22%; left: 24%; font-size: 19px; line-height: 1;
  animation: birthday-starburst 2.8s var(--burst-delay) ease-out infinite both;
}
#birthday-effects[data-kind="confetti"] span:nth-child(n+13) { left: 76%; top: 25%; }
@keyframes birthday-starburst {
  0% { opacity: 0; transform: rotate(var(--angle)) translateX(0) rotate(calc(-1 * var(--angle))) scale(.2); }
  12% { opacity: 1; }
  48%, 100% { opacity: 0; transform: rotate(var(--angle)) translateX(min(28vw, 150px)) rotate(calc(-1 * var(--angle))) scale(1.1); }
}
#birthday-effects[data-kind="hearts"] span {
  color: #f5a5bd; animation-iteration-count: infinite;
}
@keyframes birthday-fall {
  from { transform: translateY(-40px) rotate(var(--tilt)); opacity: 0; }
  10%, 75% { opacity: .85; }
  to { transform: translate(30px, calc(100svh + 60px)) rotate(calc(var(--tilt) + 180deg)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { #birthday-effects { display: none; } }
#party-title.birthday-message {
  width: min(88%, 28ch); margin-inline: auto;
  font-size: clamp(16px, 3.8vw, 22px); line-height: 1.65;
  font-weight: 500; overflow-wrap: anywhere; text-wrap: balance;
}
#birthday-party:not([hidden]) #party-title { animation: reveal-cake 1.6s ease-out; }
#birthday-party:not([hidden]) #party-title.birthday-celebration {
  color: #ffdfaa;
  animation: birthday-cheer 1.6s ease-out both, birthday-sway 2.4s 1.6s ease-in-out infinite;
}
@keyframes birthday-sway {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1deg) translateY(-3px); }
}
@keyframes birthday-cheer {
  0% { opacity: 0; transform: scale(.8); }
  65% { opacity: 1; transform: scale(1.035); }
  82% { transform: scale(.985); }
  100% { opacity: 1; transform: scale(1); }
}
#birthday-continue {
  position: absolute; inset: 0; z-index: 2;
  display: grid; align-content: end; padding: 16px 16px max(16px, env(safe-area-inset-bottom));
  color: inherit; background: transparent; border: 0; border-radius: 0; box-shadow: none;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#birthday-continue:is(:hover, :active) { background: transparent; box-shadow: none; }
#birthday-continue:focus:not(:focus-visible) { outline: none; }
#birthday-continue:focus-visible { outline-offset: -6px; }
.party-actions {
  position: absolute; inset-inline: 0; bottom: 3%; width: min(360px, calc(100% - 32px));
  margin-inline: auto;
}
.party-actions button { pointer-events: auto; }
#birthday-letter {
  padding: 14px; border-radius: 16px; background: #fffcf5; color: #533c35;
}
#candle-message:empty { display: none; }
#party-title.counting {
  color: #fff2d5;
  font-size: clamp(48px, 14vmin, 84px); line-height: 1;
  font-variant-numeric: tabular-nums;
}
@keyframes guide-pan { to { background-position-x: -464px; } }
@keyframes guide-floor-pan { to { background-position-x: -640px, 0; } }
@keyframes guide-steps {
  0% { background-position: 33.333333% 0; }
  16.666667% { background-position: 66.666667% 0; }
  33.333333% { background-position: 100% 0; }
  50% { background-position: 0 100%; }
  66.666667% { background-position: 33.333333% 100%; }
  83.333333%, 100% { background-position: 66.666667% 100%; }
}
@keyframes guide-weight {
  12% { transform: rotate(1.5deg) scaleY(.99); }
  38% { transform: rotate(-.75deg) scaleY(1.012); }
  62% { transform: rotate(-1.5deg) scaleY(.99); }
  88% { transform: rotate(.75deg) scaleY(1.012); }
}
.birthday-cake { position: relative; flex: none; width: 12.8em; height: 14em; }
.birthday-cake span { position: absolute; display: block; }
.cake-plate {
  inset: auto 0 .9em; height: 1.5em; background: #e6c7a5; border-radius: 50%;
  border: 2px solid #b88970;
}
.cake-tier {
  inset: auto .9em 1.7em; height: 5.6em; z-index: 1; border: 2px solid #ad6e61;
  border-radius: 13px 13px 20px 20px;
  background: linear-gradient(#fff4d7 0 28%, #f2b1a3 28% 63%, #ffe2bd 63% 76%, #f2b1a3 76%);
}
.cake-tier::before {
  content: ''; position: absolute; inset: -.65em -2px auto;
  height: 1.45em; border: 2px solid #ad6e61; border-radius: 50%;
  background: #fff4d7;
}
.cake-candle {
  left: calc(50% - .6em); bottom: 7.3em; width: 1.2em; height: 2.9em; z-index: 2;
  border: 1px solid #b87467; border-radius: 3px;
  background: repeating-linear-gradient(135deg, #fff2d8 0 5px, #eaa08a 5px 9px);
}
.cake-candle::before {
  content: ''; position: absolute; bottom: 100%; left: 50%;
  width: 2px; height: 5px; border-radius: 2px;
  transform: translateX(-50%); background: #654237;
}
.cake-flame {
  left: calc(50% - .5em); bottom: 10.42em; width: 1em; height: 1.65em; opacity: 0;
  border-radius: 90% 30% 65% 50%; background: #ffbb55; box-shadow: 0 0 18px #ffc963;
}
#bedtime { color: #fff2dc; text-align: center; font-size: clamp(19px, 5vw, 26px); line-height: 1.65; }
#bedtime-continue { width: min(144px, 100%); }
[data-phase="lit"] .cake-flame { opacity: 1; animation: candle-flicker .55s ease-in-out alternate infinite; }
@keyframes candle-flicker { to { transform: rotate(7deg) scale(.92,1.08); } }
.cake-smoke {
  left: calc(50% - .6em); bottom: 10.42em; width: 1.2em; height: 2.7em;
  border-left: 2px solid #b8a394; border-radius: 50%; opacity: 0;
}
[data-phase="out"] .cake-smoke { animation: candle-smoke .9s ease-out; }
@keyframes candle-smoke {
  0% { opacity: .8; transform: translateY(0) rotate(-8deg); }
  100% { opacity: 0; transform: translateY(-20px) rotate(15deg); }
}
#birthday-wish { margin: 16px 0; padding: 16px; background: #fff4df; border-radius: 14px; }
@media (max-width:360px) { .content { padding: 24px 18px; } .game-panel { padding: 24px 16px; } }
@media (max-height:500px) { .penguin-scene .mascot { --penguin-size: 140px; top: 52%; } .little-wall { top: calc(52% + 12px); height: 110px; } .sos { top: calc(52% + 92px); } .speech { padding: 8px 12px; bottom: calc(100% + 8px); } .speech p { font-size: 12px; } }
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .penguin-scene [data-pose] { transform: translate(-50%,-50%); } }

.waving { animation: wave-sample 1s steps(1, end) 3; }
@keyframes wave-sample {
  0%,100% { background-position: 0 0; }
  12.5% { background-position: 33.333333% 0; }
  25% { background-position: 66.666667% 0; }
  37.5% { background-position: 100% 0; }
  50% { background-position: 0 100%; }
  62.5% { background-position: 33.333333% 100%; }
  75% { background-position: 66.666667% 100%; }
  87.5% { background-position: 100% 100%; }
}
.replay-wave { position: fixed; left: 50%; top: calc(50% + clamp(80px, 15svh, 110px)); transform: translateX(-50%); width: min(300px, calc(100vw - 32px)); }
body[data-stage="searching"] .sos { top: calc(50% + clamp(142px, 26svh, 172px)); }
.wave-preview { text-align: center; }
.wave-preview .penguin-sprite { width: min(260px, 75vw); margin: 24px auto; }
.wave-preview h1 { font-size: 23px; }
@media (max-height:500px) { .replay-wave { top: calc(52% + 60px); } body[data-stage="searching"] .sos { top: calc(52% + 115px); } }
@media (prefers-reduced-motion:reduce) { .waving { animation: none; } }

#penguin-scene { position: relative; }
#penguin-scene > #ticket-options { position: relative; inset: auto; height: 180px; margin-top: -50px; z-index: 6; }
#penguin-scene > #ticket-options .papers { display: flex; justify-content: center; align-items: center; gap: 16px; }
#penguin-scene > #ticket-options .paper {
  position: relative; inset: auto; width: 82px; height: 125px; padding: 10px;
  background: #fff0ce; border: 2px solid #b58d69; border-radius: 9px;
  box-shadow: 0 4px 0 #d6b898; font-size: 13px;
  animation: present-ticket .6s ease-out both;
}
#penguin-scene > #ticket-options .paper span { font-size: 32px; }
#penguin-scene > #ticket-options:has(.picked) .paper:not(.picked) {
  opacity: .48;
  transition: opacity .3s ease-out;
}
#penguin-scene > #ticket-options .paper.picked {
  z-index: 1;
  background: #f7d6a0;
  animation: flip-quiz-ticket .48s ease-out both;
}
#penguin-scene > #ticket-options .paper.picked span {
  display: block;
  border: 2px solid currentColor;
  border-radius: 3px;
  padding: 4px 2px;
  color: #9d4036;
  font-size: 11px;
  font-weight: 800;
  transform: rotate(-8deg);
  animation: stamp-quiz-ticket .24s .4s ease-out both;
}
@keyframes flip-quiz-ticket {
  0% { transform: perspective(450px) rotate(var(--tilt)) rotateY(-88deg); }
  72% { transform: perspective(450px) rotate(var(--tilt)) rotateY(8deg) scale(1.11); }
  100% { transform: perspective(450px) rotate(var(--tilt)); }
}
@keyframes stamp-quiz-ticket {
  from { opacity: 0; transform: rotate(-8deg) scale(1.6); }
  75% { opacity: 1; transform: rotate(-8deg) scale(.94); }
  to { opacity: 1; transform: rotate(-8deg) scale(1); }
}
@keyframes present-ticket {
 from { opacity: 0; transform: translateY(-90px) scale(.25) rotate(0); }
 to { opacity: 1; transform: translateY(0) scale(1) rotate(var(--tilt)); }
}

#paper-result:empty { display: none; }

#penguin-scene [data-phase="peek"] .wave-after-climb {
  opacity: 1; animation: hello-back-and-forth .6s steps(1,end) infinite;
}
@keyframes hello-back-and-forth {
  0%,100% { background-position: 0 0; }
  50% { background-position: 33.333333% 0; }
}
#penguin-scene[data-view="zooming"] .climb-stage { opacity: 0; transition: opacity .3s; }
#penguin-scene > #ticket-options {
  position: fixed; left: 50%; top: 50%; width: min(100% - 24px,420px);
  height: 180px; margin: 0; transform: translate(-50%,-50%); z-index: 10;
}
#penguin-scene > #ticket-options .paper:nth-child(1) { --from-x: 98px; }
#penguin-scene > #ticket-options .paper:nth-child(2) { --from-x: 0px; }
#penguin-scene > #ticket-options .paper:nth-child(3) { --from-x: -98px; }
#penguin-scene[data-view="tickets"] .ticket-draw { padding-top: calc(50svh + 100px); }
#penguin-scene[data-view="tickets"] { position: fixed; inset: 0; padding: 0 24px 24px; overflow-y: auto; }
@keyframes present-ticket {
 from { opacity: 0; transform: translateX(var(--from-x)) scale(.25) rotate(0); }
 to { opacity: 1; transform: translateX(0) scale(1) rotate(var(--tilt)); }
}

@keyframes pocket-bend {
  0% { background-position: 0 0; }
  25% { background-position: 33.333333% 0; }
  50% { background-position: 66.666667% 0; }
  75%,100% { background-position: 100% 0; }
}

#penguin-scene[data-view="tickets"] .ticket-draw { padding-top: 0; }
#penguin-scene[data-view="tickets"] #game-title {
  position: fixed; left: 50%; top: calc(50svh - 172px); transform: translateX(-50%);
  width: min(100% - 40px,420px); margin: 0; padding: 12px 16px;
  font-size: clamp(19px,5vw,24px); font-weight: 750; line-height: 1.45;
  color: #704e3c; text-align: center; text-wrap: balance;
  border-radius: 18px; background: #fff4df; border: 1px solid #e8cfaf;
}
#penguin-scene[data-view="tickets"] #game-title:focus { outline: none; }
#penguin-scene[data-view="tickets"] #game-title:empty { display: none; }
#penguin-scene[data-view="tickets"] #open-letter {
  position: fixed; left: 50%; top: calc(50svh + 110px); transform: translateX(-50%);
  width: min(100% - 48px,360px);
}

@media (max-width: 380px) {
  #penguin-scene > #ticket-options .papers { gap: 12px; }
  #penguin-scene > #ticket-options .paper { width: min(82px, 23vw); padding-inline: 5px; }
}

@media (max-height: 480px) {
  #penguin-scene[data-view="tickets"] {
    display: flex; flex-direction: column; align-items: center;
    gap: 12px; padding: 16px;
  }
  #penguin-scene[data-view="tickets"] .ticket-draw { display: contents; }
  #penguin-scene[data-view="tickets"] #ticket-options,
  #penguin-scene[data-view="tickets"] #game-title,
  #penguin-scene[data-view="tickets"] #open-letter {
    position: relative; inset: auto; transform: none; flex: none;
  }
  #penguin-scene[data-view="tickets"] #game-title { order: -1; }
  #penguin-scene[data-view="tickets"] #ticket-options { height: 142px; }
}

#birthday-guide[data-phase="arrived"]:not([hidden]) {
  grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 30fr) minmax(0, 55fr) minmax(0, 15fr);
  place-content: stretch; align-items: center; gap: 12px;
  padding-block: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-bottom));
  overflow: hidden; border: 0; border-radius: 0; box-shadow: none;
}
#birthday-guide[data-phase="arrived"] :is(#guide-line, .guide-hint, .guide-pair) { display: none; }
#birthday-guide[data-phase="arrived"] .cake-stand {
  position: relative; inset: auto; margin: 0;
  font-size: clamp(8px, min(4.5vw, 2.5svh), 18px);
  grid-area: 2 / 1;
}
#birthday-party:not([hidden]) { display: contents; }
#party-title {
  position: static; grid-area: 1 / 1; max-height: 100%; min-height: 0;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  pointer-events: auto; z-index: 3;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: none;
}
#party-title:focus { outline: none; }
#party-title::-webkit-scrollbar { display: none; width: 0; height: 0; }
.party-actions { position: static; grid-area: 3 / 1; }
#birthday-guide.message-only .guide-track { background: #080605; }
#birthday-guide.message-only .cake-stand { visibility: hidden; animation: none; }
#birthday-guide.message-only #party-title { grid-area: 1 / 1 / 4 / 2; }
