* {
  box-sizing:border-box;
  -webkit-tap-highlight-color:transparent
}
html,body {
  margin:0;
  width:100%;
  height:100%;
  overflow:hidden;
  background:#070d1d
}
body {
  display:grid;
  place-items:center;
  font-family:Arial,sans-serif;
  color:#fff;
  user-select:none;
  -webkit-user-select:none;
  overscroll-behavior:none
}
button {
  font:inherit;
  cursor:pointer;
  touch-action:manipulation
}
button:focus-visible {
  outline:3px solid #fff5a5;
  outline-offset:5px
}
button:disabled {
  cursor:wait;
  opacity:.55
}
[hidden] {
  display:none!important
}
#game {
  height:100dvh;
  width:min(100vw,56.25dvh);
  position:relative;
  overflow:hidden;
  isolation:isolate;
  container-type:inline-size;
  touch-action:none;
  background:#111b32
}
#background,#veil,#playfield,.screen {
  position:absolute;
  inset:0;
  width:100%;
  height:100%
}
#background {
  object-fit:cover;
  z-index:-3
}
#veil {
  background:rgba(10,15,30,.4);
  z-index:-1;
  transition:opacity .5s;
  pointer-events:none
}
#veil.clear {
  opacity:0
}
.art {
  position:relative;
  overflow:hidden;
  pointer-events:none
}
.art img {
  position:absolute;
  max-width:none;
  pointer-events:none;
  -webkit-user-drag:none
}
.screen {
  display:grid;
  place-items:center;
  pointer-events:none
}
.screen button {
  pointer-events:auto
}
.start-content {
  width:87%;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:7cqw;
  transform:translateY(-7cqw)
}
.start-content>[data-art] {
  width:100%
}
.image-button {
  position:relative;
  padding:0;
  border:0;
  background:none;
  display:block
}
.image-button .art {
  width:100%
}
.image-button .pressed-art {
  position:absolute;
  inset:0;
  opacity:0
}
.image-button.pressed .normal-art {
  opacity:0
}
.image-button.pressed .pressed-art {
  opacity:1
}
#start {
  width:65%
}
#loading {
  font-size:3cqw;
  text-align:center;
  margin:0;
  min-height:1.3em;
  text-shadow:0 1px 4px #000
}
#timer {
  position:absolute;
  top:max(3cqw,env(safe-area-inset-top));
  left:7%;
  width:77%;
  height:2.2cqw;
  border:1px solid #d7d9ff80;
  border-radius:10px;
  background:#0a163a99;
  overflow:hidden
}
#time-fill {
  height:100%;
  background:linear-gradient(90deg,#87bbff,#f7e7a5);
  transform-origin:left;
  will-change:transform
}
#timer.urgent #time-fill {
  background:linear-gradient(90deg,#ffa83a,#ffe7a1)
}
#sound {
  position:absolute;
  top:max(1.3cqw,env(safe-area-inset-top));
  right:3%;
  border:1px solid #f5df9c70;
  border-radius:50%;
  background:#0d173b80;
  color:#fff3bf;
  width:8cqw;
  height:8cqw;
  font-size:5cqw
}
#playfield {
  height:var(--play-area,75%);
  overflow:hidden;
  contain:layout paint
}
#hud {
  position:absolute;
  inset:var(--play-area,75%) 0 0;
  pointer-events:none
}
#wishes {
  position:absolute;
  left:4%;
  bottom:max(3cqw,env(safe-area-inset-bottom));
  width:24%
}
#best {
  position:absolute;
  right:4%;
  bottom:max(3cqw,env(safe-area-inset-bottom));
  width:21%
}
output {
  position:absolute;
  display:grid;
  place-items:center;
  color:#fff5bc;
  font-weight:800;
  text-shadow:0 2px 4px #171a47;
  font-variant-numeric:tabular-nums
}
#score {
  left:31%;
  top:34%;
  width:58%;
  height:43%;
  font-size:5.25cqw
}
#best-value {
  left:14%;
  top:50%;
  width:71%;
  height:36%;
  font-size:4.5cqw
}
/* 50% of the previous logo width (92% of 32cqw), independent of WISHES. */
#combo {
  position:absolute;
  width:14.72cqw;
  transform-origin:bottom left;
  bottom:102%;
  left:0;
  overflow:visible
}
#combo.enter {
  animation:combo-in .9s cubic-bezier(.22,.7,.3,1)
}
#combo.leave {
  animation:combo-out .18s forwards
}
#countdown {
  position:absolute;
  top:36%;
  left:0;
  right:0;
  text-align:center;
  font-weight:950;
  font-size:25cqw;
  color:#fff0b0;
  -webkit-text-stroke:1px #826127;
  text-shadow:0 4px 0 #705334,0 0 35px #ffe0a880;
  pointer-events:none
}
#countdown.pop {
  animation:count .65s both
}
#announcement {
  position:absolute;
  width:72%;
  left:14%;
  top:32%;
  pointer-events:none;
  animation:pop .35s both
}
.star {
  position:absolute;
  left:0;
  top:0;
  width:var(--hitbox-size,14.3cqw);
  height:var(--hitbox-size,14.3cqw);
  display:grid;
  place-items:center;
  will-change:transform;
  touch-action:none
}
.star .art {
  width:var(--visual-ratio,76.923%);
  overflow:hidden;
  z-index:1
}
.star::before {
  content:'';
  position:absolute;
  width:42%;
  height:42cqw;
  bottom:50%;
  background:linear-gradient(to top,var(--trail),transparent);
  clip-path:polygon(0 100%,50% 0,100% 100%);
  opacity:.58;
  pointer-events:none
}
.star.white {
  --trail:#e3f2ff
}
.star.gold {
  --trail:#ffd468
}
.star.red {
  --trail:#ff7474
}
.warning {
  position:absolute;
  top:5%;
  width:1.8cqw;
  height:1.8cqw;
  border-radius:50%;
  background:#fff;
  box-shadow:0 0 9px 3px #fff9;
  transform:translateX(-50%);
  animation:glow .5s both;
  pointer-events:none
}
.feedback {
  position:absolute;
  font-size:5cqw;
  font-weight:bold;
  text-shadow:0 2px 6px #122240;
  pointer-events:none;
  animation:feedback .5s forwards
}
.feedback.red {
  color:#ff9494
}
.feedback.gold {
  color:#ffe08a
}
.end-content {
  width:86%;
  display:flex;
  align-items:center;
  flex-direction:column;
  gap:2cqw;
  padding:6cqw 0 3cqw
}
#result {
  position:relative;
  width:76%;
  animation:pop .5s cubic-bezier(.2,.8,.3,1.15)
}
#final-score {
  left:20%;
  top:49%;
  width:59%;
  height:30%;
  font-size:10cqw
}
#record {
  position:absolute;
  width:35%;
  right:-17%;
  top:40%;
  animation:pop .4s both
}
.end-buttons {
  display:flex;
  gap:4%;
  width:92%;
  justify-content:center
}
.end-buttons button {
  width:58%
}
#end-screen { overflow-y:auto; touch-action:pan-y; pointer-events:auto; align-items:start; background:#070d1d77; }
#leaderboard { width:100%; font-size:3.3cqw; text-shadow:0 1px 3px #07102d; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
#top-five { position:relative; width:100%; border-radius:3cqw; overflow:hidden; }
#top-five>[data-art] { width:100%; }
#leaderboard-rows { position:absolute; left:20%; right:9%; top:25.1%; bottom:11.6%; display:grid; grid-template-rows:repeat(5,1fr); list-style:none; margin:0; padding:0; color:#fff5bc; font-size:3.5cqw; font-weight:800; font-variant-numeric:tabular-nums; }
#leaderboard-rows li { display:grid; grid-template-columns:79% 21%; align-items:center; min-width:0; }
#leaderboard-rows span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:center; }
#leaderboard-rows .top-name { padding:0 2%; }
#leaderboard-rows .top-score { display:grid; place-items:center; height:70%; margin:0 4%; background:#041a3b; border-radius:1cqw; }
#leaderboard-rows .your-score .top-name { color:#fff; text-shadow:0 0 6px #ffe17a; }
.leaderboard-controls { display:flex; align-items:center; justify-content:flex-end; gap:2cqw; }

#refresh-scores { border:0; background:transparent; color:#fff0b1; font-size:6cqw; min-width:10cqw; min-height:10cqw; }

.score-fields { display:flex; align-items:center; gap:2cqw; }
#player-name { width:0; min-width:0; flex:1; padding:2.5cqw; border:1px solid #6678a7; border-radius:2cqw; background:#060f29; color:white; font-size:16px; user-select:text; }
#save-score { flex:0 0 52%; min-height:48px; padding:0; border:0; background:transparent; transition:transform .1s; }
#save-score img { display:block; width:100%; height:auto; pointer-events:none; }
#save-score:active:not(:disabled) { transform:scale(.95); }
#score-status { min-height:1.3em; margin:1.5cqw 0; color:#e0e8ff; line-height:1.3; }
#leaderboard-empty { color:#bbc9e6; text-align:center; padding:1cqw; }
#leaderboard-status { color:#bbc9e6; margin:1cqw 0 0; }
#leaderboard-status:empty { display:none; }
#red-flash { position:absolute; inset:0; z-index:20; background:#ff3030; opacity:0; pointer-events:none; --red-flash-opacity:.16; }
#red-flash.hit { animation:red-hit .32s ease-out; }
@keyframes red-hit { 0% {opacity:0} 15% {opacity:var(--red-flash-opacity)} 100% {opacity:0} }
#next-message {
  font-size:3.5cqw;
  text-align:center;
  min-height:2em;
  margin:0;
  text-shadow:0 1px 4px #000
}
#resume {
  position:absolute;
  left:12%;
  right:12%;
  top:48%;
  padding:16px;
  border:1px solid #e6d18a;
  border-radius:20px;
  background:#101b3bed;
  color:#fff0b1;
  z-index:10
}
@keyframes count {
  from {
    opacity:0;
    transform:scale(1.35)
  }
  20% {
    opacity:1
  }
  to {
    opacity:1;
    transform:scale(1)
  }
}
@keyframes pop {
  from {
    opacity:0;
    transform:scale(.1)
  }
  to {
    opacity:1;
    transform:scale(1)
  }
}
@keyframes combo-in {
  from {
    opacity:0;
    transform:translateY(-5cqw) scale(2)
  }
  to {
    opacity:1;
    transform:none
  }
}
@keyframes combo-out {
  to {
    opacity:0;
    transform:scale(.6)
  }
}
@keyframes feedback {
  to {
    opacity:0;
    transform:translateY(-8cqw) scale(.8)
  }
}
@keyframes glow {
  from {
    opacity:.2;
    scale:.5
  }
  to {
    opacity:1;
    scale:1
  }
}
@media(prefers-reduced-motion:reduce) {
  #red-flash { --red-flash-opacity:.08; }
  #result,#record,#combo,#countdown,#announcement {
    animation-duration:.05s!important
  }
}

#still-background { position:absolute; inset:0; z-index:-2; background-position:center; background-size:cover; pointer-events:none; }
#game[data-scene="start"] #still-background { background-image:url('../assets/images/backgrounds/start.webp'); }
#game[data-scene="result"] #still-background { background-image:url('../assets/images/backgrounds/result.webp'); }
#game[data-scene="playing"] #still-background { visibility:hidden; }

#replay:disabled { filter:grayscale(1); cursor:default; }
#preferences{position:fixed;bottom:max(6px,env(safe-area-inset-bottom));left:8px;z-index:30;display:flex;gap:6px}#preferences button{font:12px system-ui;padding:7px 10px;background:#101b30dc;color:#fff;border:1px solid #7c8aa0;border-radius:8px}body:has(#game[data-scene="playing"]) #preferences{display:none}.settings-panel{box-sizing:border-box;max-width:min(94vw,520px);max-height:85dvh;overflow:auto;background:#13223a;color:#fff;border:1px solid #9baaca;border-radius:16px;padding:22px;font:16px/1.5 system-ui}.settings-panel::backdrop{background:#0008}.settings-panel button,.settings-panel input:not([type="checkbox"]){box-sizing:border-box;min-height:44px;font:16px system-ui;padding:10px;border-radius:8px;max-width:100%}.settings-panel label{display:block}.settings-panel form{border-top:1px solid #6b7890;padding:12px 0}.privacy-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:20px}

#preferences #privacy-open{width:44px;height:44px;padding:0;border:0;background:transparent;border-radius:50%;font-size:0;opacity:.65}#privacy-open::after{content:'!';display:inline-grid;place-items:center;width:19px;height:19px;border:1px solid #cad5e5;border-radius:50%;font:bold 13px system-ui;background:#101b30b3}#preferences #privacy-info{align-self:center;font-size:12px;padding:6px 10px}#privacy-dialog{width:min(94vw,400px);padding:20px;font-size:14px}#privacy-dialog h2{font-size:20px;margin:0 0 16px}#privacy-dialog label{display:flex;align-items:flex-start;gap:10px;padding:9px 0}#privacy-dialog input[type="checkbox"]{flex:none;width:18px;height:18px;margin:2px 0;accent-color:#89baff}#privacy-dialog summary{cursor:pointer;padding:12px 0;text-decoration:underline}#privacy-dialog p{color:#c8d3e4}#privacy-dialog .privacy-choice{font-size:16px}#privacy-dialog button{min-height:44px}#privacy-dialog .privacy-actions{justify-content:flex-end}

/* Compact help panel: original transparent star artwork, untouched. */
#info-panel{position:absolute;bottom:48px;left:0;width:min(250px,calc(100vw - 24px));max-height:calc(100dvh - 70px);overflow:auto;padding:8px 18px 2px;border:1px solid #8a9bb7;border-radius:14px;background:#13223af5;box-shadow:0 4px 24px #0006;text-align:center}
#info-title{margin:0 0 7px;font-size:16px;color:#fff2bf;text-shadow:0 1px 5px #8b6a35}
.star-rules{list-style:none;padding:0;margin:0;display:grid;gap:3px}
.star-rules li{display:grid;grid-template-columns:26px 100px;align-items:center;justify-content:center;gap:14px;min-height:26px;font-size:15px;text-align:left}
.star-rules [data-art]{display:block;width:26px}
#preferences #privacy-info{min-height:44px;border:0;background:transparent;color:#c8d3e4;text-decoration:underline;font-size:12px;padding:8px 14px}
#catch-hint{position:absolute;z-index:12;top:38%;left:8%;width:84%;margin:0;padding:12px 8px;text-align:center;font-weight:bold;font-size:clamp(16px,5cqw,24px);color:#fff2bf;background:linear-gradient(90deg,transparent,#13223ae6 15%,#13223ae6 85%,transparent);text-shadow:0 2px 5px #000,0 0 12px #c39b59;pointer-events:none}
@media(max-height:600px){#info-panel{padding-top:5px;padding-bottom:0}#info-title{font-size:14px;margin-bottom:4px}.star-rules{gap:2px}.star-rules li{min-height:22px;grid-template-columns:22px 100px;font-size:14px}.star-rules [data-art]{width:22px}}
