* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #1d2430; overflow: hidden; }
body {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: #f3efe6;
}
#hud {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: max(8px, env(safe-area-inset-top)) 12px 2px 16px; font-size: 17px; font-weight: 700;
}
#hud .right { display: flex; align-items: center; gap: 8px; }
#hud .muted { color: #9aa6b8; font-size: 14px; font-weight: 600; }
#spare { color: #9fe0a8; font-size: 15px; }
#spare.warn { color: #ffb347; }
canvas { flex: 1; min-height: 0; width: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }

/* Round candy buttons (Sweet Land GUI): a disc with a white icon, a small label under it. */
#bar { display: flex; justify-content: center; align-items: flex-end; gap: 22px; padding: 4px 16px max(10px, env(safe-area-inset-bottom)); }
.iconbtn {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 0; border: 0; background: none;
  font: inherit; font-size: 12px; font-weight: 800; color: #f3efe6; cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.iconbtn .disc {
  display: grid; place-items: center; width: 58px; height: 58px;
  background: center / contain no-repeat; transition: transform .08s;
}
.iconbtn.big .disc { width: 74px; height: 74px; }
.iconbtn.small .disc { width: 38px; height: 38px; }
.iconbtn .disc img, .iconbtn .disc svg { width: 58%; height: 58%; pointer-events: none; }
.iconbtn .disc svg { filter: drop-shadow(2px 2px 0 #ffc7a3); }
.iconbtn .disc img.down { transform: rotate(90deg); }
.iconbtn.orange .disc { background-image: url(assets/ui/btn-orange.png); }
.iconbtn.red .disc { background-image: url(assets/ui/btn-red.png); }
.iconbtn.pink .disc { background-image: url(assets/ui/btn-pink.png); }
.iconbtn:active .disc { transform: scale(.9); }
.iconbtn:disabled { opacity: .4; filter: grayscale(.85); cursor: default; }
.iconbtn:disabled .disc { transform: none; }

/* Cards: the cream candy panel, stretched as a 9-slice. */
.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(10, 14, 20, .55);
}
.overlay.hidden { display: none; }
.card {
  width: min(360px, 100%); max-height: 100%; overflow: auto; padding: 4px 6px 6px;
  color: #5a3a1e; text-align: center;
  border: 24px solid transparent; border-image: url(assets/ui/panel.png) 64 fill / 24px stretch;
  border-radius: 26px; box-shadow: 0 6px 0 rgba(0, 0, 0, .35); /* not filter: drop-shadow, which stopped the page drawing */
}
.card h1 { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: .5px; color: #ff7a1a; text-shadow: 0 2px 0 #fff, 0 3px 0 #d9622a; }
.card .sub { margin: 0 0 8px; color: #a07a55; font-size: 13px; }
.card p { margin: 8px 0; }
.card .small { font-size: 13px; color: #7d6247; }
.card .score { font-size: 24px; font-weight: 900; margin: 2px 0; color: #ff7a1a; }
.card .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

/* Candy pill buttons on the cards. */
.btn {
  display: inline-flex; align-items: center; gap: 6px; min-width: 110px; justify-content: center;
  padding: 0 8px; font: inherit; font-size: 17px; font-weight: 900; line-height: 22px; letter-spacing: .3px;
  color: #fff; text-shadow: 0 2px 0 #c2410c; background: none; cursor: pointer; touch-action: manipulation;
  border: 14px solid transparent; border-width: 14px 18px; border-image: url(assets/ui/pill-orange.png) 60 fill / 14px 18px stretch;
  -webkit-tap-highlight-color: transparent;
}
.btn.alt { color: #8a5a2b; text-shadow: none; border-image-source: url(assets/ui/pill-white.png); }
.btn:active { transform: translateY(2px) scale(.97); }
.btn .inl { width: 20px; height: 20px; }

/* End card: three stars (middle one raised), and the medal with a turning shine for a perfect run. */
.trophy { position: relative; margin: 6px 0 0; }
.stars { display: flex; justify-content: center; align-items: flex-end; gap: 4px; }
.stars img { width: 50px; height: 50px; }
.stars img:nth-child(2) { width: 64px; height: 64px; margin-bottom: 10px; }
.stars img.off { filter: grayscale(1) brightness(1.3); opacity: .35; }
.medal {
  position: relative; width: 120px; height: 110px; margin: 0 auto -6px; display: grid; place-items: center;
  background: radial-gradient(circle, rgba(255, 166, 60, .6) 0, rgba(255, 166, 60, 0) 68%); /* so the white shine shows on the cream card */
}
.medal.hidden { display: none; }
.medal .m { position: relative; width: 74px; }
.medal .shine { position: absolute; width: 150px; opacity: .8; animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.form { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; margin: 12px 0 6px; text-align: left; font-weight: 600; }
.form select {
  font: inherit; font-weight: 700; padding: 4px 8px; color: #8a5a2b; background: #fff7e8;
  border: 2px solid #ffb36b; border-radius: 10px;
}
