:root{color-scheme:dark;font-family:"Avenir Next","Trebuchet MS",system-ui,sans-serif;--ink:#482538;--cream:#fff0d5;--road:#352439}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;min-height:100%;overscroll-behavior:none}
body{min-height:100vh;min-height:100dvh;display:grid;place-items:center;background:radial-gradient(ellipse at 50% 30%,#613945,#291b31 72%);color:var(--cream)}
button{font:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
button:focus-visible{outline:3px solid #fff4aa;outline-offset:5px}
.game{width:100%;height:100vh;height:100dvh;position:relative;overflow:hidden;isolation:isolate;touch-action:manipulation;user-select:none;background:#f89a78}
.backdrop,#world{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.backdrop{background:linear-gradient(#eb8b86,#ffcc8d 63%,#824960)}
.hud{position:absolute;z-index:3;top:max(18px,env(safe-area-inset-top));left:clamp(18px,5vw,32px);right:clamp(18px,5vw,32px);display:grid;grid-template-columns:1fr auto;gap:13px;align-items:center}
.counter,.icon{background:#402139e8;border:1px solid #fff3ce38;color:#fff2d8;box-shadow:0 4px 15px #60312b25}
.counter{justify-self:start;border-radius:28px;height:44px;display:flex;align-items:center;gap:9px;padding:0 14px;white-space:nowrap;font-size:17px}
.counter strong{font-variant-numeric:tabular-nums}
.total{opacity:.72}
.fruit{width:19px;height:16px;border-radius:48% 48% 51% 51%;background:radial-gradient(circle at 33% 24%,#ffe7a0,#ffac3d 42%,#f17b34 80%);display:block;position:relative;transform:rotate(-7deg);box-shadow:inset 0 -1px 2px #8d4017}
.fruit::before{content:"";position:absolute;top:-4px;left:4px;width:12px;height:8px;background:#81974e;clip-path:polygon(50% 0,61% 36%,100% 26%,79% 69%,45% 100%,37% 66%,0 50%,27% 35%)}
.counter.pop .fruit{animation:pop .35s ease}
@keyframes pop{45%{transform:scale(1.45) rotate(13deg)}}
.controls{display:flex;gap:8px}
.icon{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;padding:0}
.pause-icon{width:13px;height:14px;border-left:4px solid;border-right:4px solid;border-radius:1px}
.sound-icon{font-style:normal;font-size:23px;font-weight:800;line-height:1;position:relative}
#sound[aria-pressed=false] .sound-icon{opacity:.64}
#sound[aria-pressed=false] .sound-icon::after{content:"";position:absolute;left:-3px;right:-3px;top:50%;height:2px;background:currentColor;transform:rotate(-45deg)}
.progress{height:5px;grid-column:1/-1;border-radius:8px;background:#4c274751;overflow:hidden}
#fill{height:100%;width:0;background:#fff0a7;border-radius:8px;transition:width .38s ease}
.overlay{position:absolute;z-index:2;top:clamp(91px,17%,195px);left:0;right:0;margin:auto;text-align:center;color:var(--ink);padding:0 19px;max-width:620px}
h1,h2{font-family:Georgia,"Times New Roman",serif;letter-spacing:-.06em;margin:13px 0 0;font-weight:bold;line-height:.9;text-shadow:0 2px 1px #ffc29e54}
h1{font-size:clamp(59px,12vw,105px)}
h1 em,h2 em{font-weight:400;color:#72344c}
h2{font-size:clamp(43px,8.4vw,71px);line-height:.97}
.overlay p{font-weight:660;font-size:clamp(16px,3.8vw,19px);line-height:1.4;margin:18px auto 20px;max-width:390px;white-space:pre-line;text-wrap:pretty}
.primary{min-height:53px;min-width:166px;padding:10px 24px;border:1px solid #8a3d3766;border-radius:18px;background:linear-gradient(#a7474a,#7d334a);color:#fff2d8;box-shadow:0 5px 0 #582b40,0 9px 20px #672b4050;font-weight:800}
.primary:hover{background:linear-gradient(#bb5852,#903b50)}
.primary:active{transform:translateY(3px);box-shadow:0 2px 0 #582b40}
.notice{position:absolute;z-index:2;bottom:25%;left:50%;transform:translateX(-50%);color:#fff2d8;background:#45233ce8;padding:7px 13px;border-radius:20px;font-weight:700;white-space:nowrap;transition:opacity .25s;opacity:0;pointer-events:none}
.notice.show{opacity:1}

.pause-card{width:calc(100% - 40px);max-width:500px;padding:24px 18px 29px;border-radius:30px;background:#ffd3a9f2;border:1px solid #fff4d8;box-shadow:0 18px 55px #47233940}
.pause-card h2{margin-bottom:24px}
.finished{
  --finish-top:max(28px,calc(env(safe-area-inset-top) + 16px));
  top:var(--finish-top);
  display:flex;
  flex-direction:column;
  align-items:center;
  width:calc(100% - 36px);
  max-width:740px;
  gap:20px;
  color:#fff4e5;
  text-shadow:0 2px 8px #492007d9;
  padding:0;
  animation:arrive .6s cubic-bezier(.2,.8,.19,1.12)
}
.finished .birthday,.finished h2,.finished .primary{flex:none}
.finished .birthday,.finished .birthday span,.finished h2 em{color:#ffcf9f}
.finished h2{ text-shadow:inherit }
.game[data-state=finished] .hud{display:none}
.finished .birthday{font-size:clamp(32px,6vw,48px)}
.finished h2{margin:0;font-size:clamp(29px,7.8vw,47px)}
.finished .primary{min-height:44px;background:linear-gradient(#934214,#71300f);border-color:#ffcc8866;box-shadow:0 5px 0 #4a210b,0 9px 20px #4a210b55}
#birthday-message{width:100%;text-align:left}
#birthday-message p{margin:0 0 15px;max-width:none;font-size:clamp(.9375rem,4.2vw,1.125rem);font-weight:500;line-height:1.55}
#birthday-message p:last-child{margin-bottom:0}
.lost{animation:arrive .24s ease-out}
.lost h2{margin-bottom:0}
.game:focus{outline:none}
.birthday{display:inline-block;font-family:Georgia,serif;font-size:60px;line-height:.9;letter-spacing:-.09em;font-style:italic;color:#993d44;position:relative}
.birthday span{position:absolute;color:#a4453d;font-size:22px;right:-29px;top:4px}
@keyframes arrive{from{opacity:0;transform:translateY(14px) scale(.98)}to{opacity:1;transform:none}}
@media(min-width:700px) and (min-height:600px){.game{height:min(900px,calc(100dvh - 48px));width:min(1050px,calc(100vw - 56px));border-radius:30px;border:1px solid #ffc59a50;box-shadow:0 25px 90px #160d23a6}}
@media(max-height:590px){.overlay{top:82px}h1{font-size:clamp(42px,9vw,66px)}.overlay p{margin:10px auto 12px}.pause-card{padding:14px 14px 20px}.birthday{font-size:39px}.finished h2{font-size:38px}.primary{min-height:44px}}
@media(max-height:700px), (max-width:360px){
  .finished{top:var(--finish-top);width:calc(100% - 32px);gap:12px;padding:0}
  .finished .birthday{display:none}
  .finished h2{font-size:clamp(25px,7vw,36px)}
  #birthday-message p{font-size:.875rem;line-height:1.42;margin-bottom:11px}
  .finished .primary{min-height:40px;padding:7px 16px}
}
@media(max-height:530px){
  .finished{--finish-top:max(18px,calc(env(safe-area-inset-top) + 8px));gap:8px}
  .finished h2 br{display:none}
  .finished h2{font-size:clamp(23px,6vw,30px)}
}
@media(max-height:420px) and (orientation:landscape){
  .finished{
    --finish-top:max(14px,env(safe-area-inset-top));
    max-width:650px;
    width:calc(100% - 24px);
    display:grid;
    grid-template-columns:1fr auto;
    gap:8px 12px
  }
  .finished h2{margin:0;text-align:left;font-size:clamp(20px,4vw,27px)}
  .finished .primary{grid-column:2;grid-row:1;min-height:36px;font-size:.875rem}
  #birthday-message{grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr;gap:14px}
  #birthday-message p{margin:0;font-size:.84375rem;line-height:1.32}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important}}


#intro p{text-shadow:0 1px 8px #ffd5b0,0 0 14px #ffdbac}
