* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(120% 90% at 50% 0%, #1c2542 0%, #121828 70%) #121828;
  font-family: Nunito, Helvetica, Arial, sans-serif;
  color: #eef1f8;
}
a { color: #ffd23e; }
a:hover { color: #ffe98a; }
header { display: flex; justify-content: center; padding: 22px 40px; }
.logo { width: 180px; height: 42px; display: block; }
main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 24px 24px 0; }
h1 { margin: 0; font-family: Fredoka, sans-serif; font-weight: 600; font-size: 46px; letter-spacing: .5px; }
.sub { margin: 10px 0 0; font-size: 17px; font-weight: 600; color: #9aa5c4; }
.stage {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 48px 30px;
  border: 1px solid #0c2415;
  border-radius: 24px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.02) 0 2px, rgba(255,255,255,0) 2px 4px),
    repeating-linear-gradient(-45deg, rgba(0,0,0,.05) 0 2px, rgba(0,0,0,0) 2px 4px),
    radial-gradient(ellipse at 50% 35%, #2e7a4d 0%, #1f5f3a 55%, #164829 100%);
  box-shadow: 0 18px 44px rgba(0,0,0,.45), inset 0 0 70px rgba(0,18,8,.55);
}
.row { display: flex; align-items: center; gap: 44px; flex-wrap: wrap; justify-content: center; }
.tally {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 110px; white-space: nowrap; flex-shrink: 0; visibility: hidden;
}
.tally.show { visibility: visible; }
.count {
  font-family: Fredoka, sans-serif; font-weight: 600; font-size: 32px; line-height: 1;
  color: #ffd23e; -webkit-text-stroke: 2px #000; paint-order: stroke fill;
}
.stack-slot { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 48px; }
.stack { width: 44px; height: 44px; background-size: contain; background-repeat: no-repeat; background-position: center bottom; image-rendering: pixelated; }
.side-label { font-size: 11px; font-weight: 800; letter-spacing: 2px; color: #9aa5c4; }
.coin-wrap { width: 480px; height: 330px; position: relative; flex-shrink: 0; }
#coin { width: 480px; height: 720px; position: absolute; left: 0; bottom: 0; cursor: pointer; z-index: 2; }
.result {
  min-height: 38px; margin-top: 10px;
  font-family: Fredoka, sans-serif; font-weight: 600; font-size: 27px; letter-spacing: 2px;
  color: #ffd23e; text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.flip-btn {
  width: 280px; margin-top: 8px; padding: 15px;
  font-family: Fredoka, sans-serif; font-weight: 700; font-size: 21px; letter-spacing: 2px;
  color: #3a2600; background: linear-gradient(180deg, #ffd95e 0%, #f5b81f 100%);
  border: none; border-radius: 14px; cursor: pointer;
  box-shadow: 0 6px 0 #b07f0a, 0 12px 22px rgba(0,0,0,.35);
  animation: ctaPulse 2.4s ease-in-out infinite;
  transition: filter .12s ease;
}
.flip-btn:hover { filter: brightness(1.08); animation: none; transform: translateY(-2px); }
.flip-btn:active { animation: none; transform: translateY(4px); box-shadow: 0 2px 0 #b07f0a; }
.flip-btn:focus-visible { outline: 3px solid #ffe98a; outline-offset: 3px; }
.reset-btn {
  margin-top: 12px; padding: 4px; background: none; border: none; cursor: pointer;
  font-family: Nunito, Helvetica, sans-serif; font-size: 13px; font-weight: 600;
  color: #7d87a6; text-decoration: underline;
}
.reset-btn:hover { color: #eef1f8; }
.reset-btn:focus-visible { outline: 1px solid #7d87a6; outline-offset: 2px; }
.about { max-width: 960px; width: 100%; margin-top: 60px; border-top: 1px solid rgba(255,255,255,.07); padding: 44px 8px 64px; }
.about h2 { margin: 0; font-family: Fredoka, sans-serif; font-weight: 600; font-size: 25px; text-align: center; }
.about p { margin: 16px auto 0; font-size: 16px; line-height: 1.65; font-weight: 600; color: #9aa5c4; text-wrap: pretty; }
footer {
  border-top: 1px solid rgba(255,255,255,.07); padding: 20px 40px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px;
}
footer span { font-size: 13px; font-weight: 600; color: #6f789a; letter-spacing: .5px; text-align: center; }
.foot-nav { display: flex; gap: 20px; }
.foot-nav a { font-size: 13px; font-weight: 700; color: #9aa5c4; text-decoration: none; }
.foot-nav a:hover { color: #ffd23e; }

/* Legal pages */
.legal { max-width: 760px; width: 100%; margin: 0 auto; padding: 8px 8px 64px; }
.legal h1 { margin: 8px 0 6px; font-family: Fredoka, sans-serif; font-weight: 600; font-size: 38px; }
.legal h2 { margin: 30px 0 6px; font-family: Fredoka, sans-serif; font-weight: 600; font-size: 20px; color: #eef1f8; }
.legal p { margin: 10px 0; font-size: 16px; line-height: 1.7; font-weight: 600; color: #9aa5c4; text-wrap: pretty; }
.legal .updated { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #6f789a; }
@keyframes ctaPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@media (max-width: 560px) {
  .stage { padding: 20px 20px 24px; }
  .coin-wrap { width: 320px; height: 220px; }
  #coin { width: 320px; height: 480px; }
  h1 { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
