/* A dedicated page: the reward board scrolls naturally, controls stay in reach. */
#dialog.bonus-page {
  --bonus-sky: url("../assets/bonus/sky.webp?v=5.19.0-r21");
  --bonus-title: url("../assets/bonus/title.webp?v=5.19.0-r21");
  --bonus-bronze: url("../assets/bonus/frame-bronze.webp?v=5.19.0-r21");
  --bonus-silver: url("../assets/bonus/frame-silver.webp?v=5.19.0-r21");
  --bonus-gold: url("../assets/bonus/frame-gold.webp?v=5.19.0-r21");
  --bonus-tile: url("../assets/bonus/tile.webp?v=5.19.0-r21");
  --bonus-hit: url("../assets/bonus/tile-hit.webp?v=5.19.0-r21");
  --bonus-claimed: url("../assets/bonus/tile-claimed.webp?v=5.19.0-r21");
  --bonus-button: url("../assets/bonus/spin-button.webp?v=5.19.0-r21");
  --bonus-burst: url("../assets/bonus/burst.webp?v=5.19.0-r21");
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100%;
  height: 100dvh;
  padding: 0;
  background: linear-gradient(#051c3b33, #05192b77), var(--bonus-sky) center / cover, #143e66;
  backdrop-filter: none;
}
.bonus-page .card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.bonus-page .card > header {
  width: 100%;
  padding: max(8px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 8px max(24px, env(safe-area-inset-left));
  border-bottom: 1px solid #ffd98745;
  background: linear-gradient(#071e3dcf, #0a294b85);
}
.bonus-page #dialogTag { color: #ffe7a0; font-size: 10px; text-shadow: 0 2px 3px #001c38; }
.bonus-page #close { width: auto; min-width: 90px; height: 44px; padding: 8px 15px; font-size: 12px; border: 7px solid #b8a26d; border-image: var(--bonus-bronze) 24% / 14px / 0 stretch; border-radius: 0; background: #112f4cee; background-clip: padding-box; }
.bonus-page #dialogContent {
  min-height: 0;
  overflow: auto;
  padding: 18px 24px 24px;
  overscroll-behavior: contain;
  scroll-padding-block: 16px;
}
.bonus-page #dialogArt { display: none; }
.bonus-page .card[data-kind] #dialogTitle { display: flex; align-items: center; justify-content: center; width: min(460px,100%); min-height: 90px; margin: 0 auto 5px; padding: 16px 50px; background: var(--bonus-title) center / 100% 100% no-repeat; color: #fff1bd; font-size: clamp(23px, 3vw, 32px); font-weight: 950; text-shadow: 0 3px 0 #071c32, 0 0 15px #ffc86745; }
.bonus-page #dialogTitle:focus { outline: none; }
.bonus-page .card[data-kind] #dialogText { max-width: 620px; margin: 0 auto 16px; font-size: 13px; line-height: 1.5; color: #edf5fa; text-shadow: 0 2px 3px #001627; }
.bonus-page #dialogBody { width: 100%; max-width: 1080px; margin: 0 auto; }
.bonus-page #dialogActions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px max(24px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: linear-gradient(#102e4cef, #071d36fa);
  border-top: 1px solid #f5ce7955;
  box-shadow: 0 -6px 24px #00122944;
}
.bonus-page #dialogActions .primary { max-width: 380px; min-height: 62px; padding: 16px 32px; background: var(--bonus-button) center / 100% 100% no-repeat, linear-gradient(#ffdf8e, #edbd65) center / 82% 64% no-repeat; border: 0; border-radius: 0; box-shadow: none; color: #4a2c10; font-size: 14px; font-weight: 950; text-shadow: 0 1px 0 #fff5c799; filter: drop-shadow(0 4px 3px #0005); transition: filter .15s, transform .15s; }
.bonus-page #dialogActions .primary:hover:not(:disabled) { filter: brightness(1.12) drop-shadow(0 0 9px #ffe28366); }
.bonus-page #dialogActions .secondary { width: auto; min-width: 130px; min-height: 48px; padding-inline: 16px; background: #0e294155; color: #ffedbe; border-color: #eac17444; }
.bonus-page[data-spinning="true"] #spinDoge { animation: bonus-button-glow .7s ease-in-out infinite alternate; }
.roll-totals {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1080px;
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid #f1ce805c;
  border-radius: 10px;
  background: linear-gradient(100deg, #0a2846ed, #204667e6, #0a2846ed);
  box-shadow: inset 0 1px 0 #e8d39320, 0 4px 10px #00192c44;
  color: #d8e9f3;
  font-size: 13px;
}
.roll-totals strong { color: #ffe19c; font-variant-numeric: tabular-nums; }
.doge-roll-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.roll-tier {
  --tier-color: #d8a271;
  --tier-frame: var(--bonus-bronze);
  min-width: 0;
  border: 10px solid #b28b51;
  border-image: var(--tier-frame) 24% / 25px / 0 stretch;
  border-radius: 8px;
  background: linear-gradient(#132d4ef2, #081c36f2);
  background-clip: padding-box;
  padding: 8px;
}
.roll-tier[data-tier="3"] { order: -2; }
.roll-tier[data-tier="2"] { --tier-color: #c9edff; --tier-frame: var(--bonus-silver); order: -1; }
.roll-tier[data-tier="1"] { --tier-color: #ffe18b; --tier-frame: var(--bonus-gold); }
.roll-tier.is-active { background: linear-gradient(#284e6cf5, #102943f5); background-clip: padding-box; box-shadow: 0 0 24px #f8d28135; }
.roll-tier.is-locked { opacity: .77; }
.roll-tier.is-new-tier { animation: bonus-tier-unlock .8s ease-out; }
.roll-tier > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 6px; }
.roll-tier > header strong { color: var(--tier-color); font-size: 16px; text-shadow: 0 2px 2px #0009; }
.roll-tier > header strong > span { display: inline-grid; place-items: center; width: 27px; height: 27px; margin-right: 4px; background: var(--bonus-hit) center / 100% 100%; color: #463315; border: 0; font-size: 12px; text-shadow: 0 1px 0 #ffedb4; }
.roll-tier > header small { font-size: 8px; color: #bbd2dd; letter-spacing: .07em; }
.roll-cells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.roll-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 56px;
  padding: 5px 2px;
  border: 0;
  border-radius: 8px;
  background: var(--bonus-tile) center / 100% 100% no-repeat;
  color: #fff5d6;
  isolation: isolate;
}
.roll-cell strong { font-size: 14px; font-variant-numeric: tabular-nums; text-shadow: 0 2px 1px #00152e, 0 0 4px #00152e; }
.roll-cell:disabled { opacity: 1; }
.roll-cell .bonus-upgrade-icon { width: 44px; height: 30px; object-fit: contain; filter: drop-shadow(0 0 4px #f4c35355); }
.roll-cell > span:not(.doge-whole-symbol):not(.hit-mark) { font-size: 7px; font-weight: 800; letter-spacing: .035em; }
.roll-cell.is-upgrade > span:not(.doge-whole-symbol):not(.hit-mark) { color: #ffe6a6; }
.roll-cell.is-hit { background-image: var(--bonus-hit); color: #3c2915; }
.roll-cell.is-hit strong, .roll-cell.is-cursor strong, .roll-cell.is-claimed strong { text-shadow: 0 1px 0 #fff7cf99; }
.roll-cell.is-hit:hover:not(:disabled) { filter: brightness(1.12); box-shadow: 0 0 12px #ffcf6977; }
.bonus-page[data-claimed="true"] .roll-cell.is-hit:disabled:not(.is-upgrade):not(.is-claimed) { opacity: .62; }
.roll-cell.is-upgrade.is-hit > span:not(.doge-whole-symbol):not(.hit-mark) { color: #514224; }
.hit-mark { position: absolute; right: -3px; top: -5px; display: grid; place-items: center; min-width: 16px; height: 16px; padding: 0 3px; border: 1px solid #d5fae5; border-radius: 9px; background: #326955; color: #eefff4; font-size: 9px; font-weight: 800; }
.roll-cell.is-cursor { outline: 2px solid #e1ffe9; outline-offset: 1px; background-image: var(--bonus-hit); color: #3c2915; box-shadow: 0 0 18px #ffe57fb0; z-index: 2; }
.roll-cell.is-cursor::after, .roll-cell.is-claimed::after { content: ""; position: absolute; inset: -12%; background: var(--bonus-burst) center / contain no-repeat; pointer-events: none; z-index: -1; }
.roll-cell.is-claimed { outline: 2px solid #d6ffe7; outline-offset: 2px; background-image: var(--bonus-claimed); color: #144c38; box-shadow: 0 0 18px #8effc188; }
.roll-status { min-height: 20px; margin: 20px 0 7px; font-size: 13px; line-height: 1.5; font-weight: 800; color: #fff0b8; text-shadow: 0 2px 3px #00162b; }
.roll-ad-count, .roll-note { margin: 5px 0 0; color: #e0ecf4; font-size: 11px; line-height: 1.5; text-shadow: 0 1px 4px #001226, 0 0 5px #001226; }
#spinDoge:disabled, #claimDogeAd:disabled { opacity: .6; }
.bonus-page .card[data-kind="demo-ad"] #dialogContent { display: flex; flex-direction: column; justify-content: center; }
.bonus-page .card[data-kind="demo-ad"] #dialogBody { max-width: 440px; }
.demo-ad-art { display: grid; justify-items: center; gap: 24px; padding: 26px; background: radial-gradient(ellipse, #ffda6730, transparent 70%); }
.demo-ad-art .bonus-treasure-art { width: 190px; height: 170px; object-fit: contain; }
.bonus-prize-reveal { position: relative; display: grid; justify-items: center; margin: 0 auto 20px; isolation: isolate; }
.bonus-prize-reveal .bonus-treasure-art { width: 210px; height: 180px; object-fit: contain; animation: bonus-prize-arrive .65s cubic-bezier(.2,.8,.2,1) both; }
.bonus-prize-burst { position: absolute; width: 260px; height: 240px; top: -25px; object-fit: contain; z-index: -1; animation: bonus-reward-halo 2.8s ease-in-out infinite alternate; }
.bonus-prize-reveal > strong { color: #fff0a5; font-size: 36px; text-shadow: 0 3px 0 #714311, 0 0 18px #ffbd5755; }
.bonus-prize-reveal > strong > span { font-size: 18px; }
.bonus-prize-reveal > small { color: #ebfff4; font-size: 12px; margin-top: 4px; text-shadow: 0 2px 4px #00162a; }
@keyframes bonus-button-glow { from { filter: brightness(.92); } to { filter: brightness(1.18) drop-shadow(0 0 10px #ffe39477); } }
@keyframes bonus-tier-unlock { 0% { filter: brightness(1.8); transform: scale(.97); } 100% { filter: brightness(1); transform: scale(1); } }
@keyframes bonus-prize-arrive { from { opacity: 0; transform: translateY(16px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes bonus-reward-halo { from { opacity: .55; transform: rotate(-5deg) scale(.95); } to { opacity: .9; transform: rotate(5deg) scale(1.06); } }
.demo-ad-art > strong { font-size: 20px; letter-spacing: .12em; color: #ffe1a0; }
#demoAdProgress { display: block; width: 100%; height: 8px; border: 0; border-radius: 8px; accent-color: #eaca83; }
#demoAdProgress::-webkit-progress-bar { border-radius: 8px; background: #0e2536; }
#demoAdProgress::-webkit-progress-value { border-radius: 8px; background: #eaca83; }
@media (max-width: 700px) and (orientation: portrait) {
  .bonus-page .card > header { padding-inline: 14px; }
  .bonus-page #dialogContent { padding: 12px 14px 20px; }
  .bonus-page .card[data-kind] #dialogTitle { width: min(340px,100%); min-height: 70px; padding: 12px 42px; font-size: 24px; }
  .bonus-page .card[data-kind] #dialogText { font-size: 11px; margin-bottom: 12px; }
  .bonus-page #dialogActions { padding: 10px 14px max(12px, env(safe-area-inset-bottom)); gap: 8px; }
  .bonus-page #dialogActions .secondary { font-size: 11px; min-width: 105px; padding-inline: 8px; }
  .bonus-page #dialogActions .primary { min-height: 56px; padding: 13px 24px; font-size: 12px; }
  .doge-roll-board { grid-template-columns: 1fr; gap: 10px; }
  .roll-tier[data-tier] { order: 0; padding: 5px; border-width: 7px; border-image-width: 18px; border-radius: 6px; }
  .roll-tier > header { margin-bottom: 7px; }
  .roll-tier > header strong { font-size: 12px; }
  .roll-tier > header strong > span { width: 22px; height: 22px; font-size: 10px; }
  .roll-tier[data-tier="3"] .roll-cells { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .roll-cells { gap: 5px; }
  .roll-cell { min-height: 44px; border-radius: 8px; }
  .roll-cell strong { font-size: 12px; }
  .roll-cell .bonus-upgrade-icon { width: 34px; height: 24px; }
  .roll-tier[data-tier="3"] .roll-cell > span:not(.doge-whole-symbol):not(.hit-mark) { font-size: 5px; }
  .roll-totals { font-size: 11px; padding: 10px 12px; margin-bottom: 12px; }
  .roll-status { margin-top: 14px; font-size: 11px; }
  .roll-ad-count, .roll-note { font-size: 9px; }
}
@media (max-width: 360px) and (orientation: portrait) {
  .bonus-page #dialogContent { padding-inline: 8px; }
  .roll-tier[data-tier] { padding: 4px; border-width: 6px; border-image-width: 16px; }
  .roll-cells { gap: 3px; }
  .roll-cell strong { font-size: 11px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .bonus-page .card > header { padding-block: 4px; }
  .bonus-page #dialogContent { padding: 8px 12px 18px; }
  .bonus-page .card[data-kind="doge-roll"] #dialogTitle { position: fixed; top: 4px; left: 50%; right: auto; transform: translateX(-50%); width: min(300px,44vw); min-height: 44px; height: 44px; padding: 6px 32px; font-size: 19px; pointer-events: none; }
  .bonus-page .card[data-kind="doge-roll"] #dialogText { display: none; }
  .bonus-page #dialogActions .primary { min-height: 52px; padding: 12px 28px; font-size: 13px; }
  .bonus-page #dialogActions { padding-block: 6px; }
  .doge-roll-board { grid-template-columns: minmax(0,2fr) minmax(0,1fr) minmax(0,1fr); gap: 10px; }
  .roll-tier { padding: 5px; border-width: 6px; border-image-width: 18px; }
  .roll-tier > header { margin-bottom: 4px; }
  .roll-tier > header strong { font-size: 12px; }
  .roll-tier > header strong > span { width: 18px; height: 18px; font-size: 9px; }
  .roll-tier[data-tier="3"] .roll-cells { grid-template-columns: repeat(6,minmax(0,1fr)); }
  .roll-cell { min-height: 44px; }
  .roll-cells { gap: 4px; }
  .roll-cell .bonus-upgrade-icon { width: 34px; height: 24px; }
  .roll-totals { padding: 6px 10px; margin-bottom: 8px; font-size: 11px; }
  .bonus-page .card[data-kind="demo-ad"] #dialogContent { display: block; }
  .demo-ad-art .bonus-treasure-art { width: 120px; height: 110px; }
}
@media (max-height: 700px) and (orientation: portrait) {
  .bonus-page .card > header { padding-block: 4px; }
  .bonus-page #dialogContent { padding-block: 8px 14px; }
  .bonus-page .card[data-kind="doge-roll"] #dialogTitle { width: 280px; min-height: 44px; padding: 6px 30px; font-size: 18px; margin-bottom: 4px; }
  .bonus-page .card[data-kind="doge-roll"] #dialogText { font-size: 10px; line-height: 1.4; margin-bottom: 8px; }
  .roll-totals { padding-block: 6px; margin-bottom: 6px; }
  .doge-roll-board { gap: 6px; }
  .roll-tier.is-locked { padding-block: 1px; border-block-width: 4px; }
  .roll-tier.is-locked > header { margin-bottom: 0; }
  .roll-tier.is-locked .roll-cells { display: none; }
  .bonus-page #dialogActions { padding-block: 6px max(8px, env(safe-area-inset-bottom)); }
}

/* A continuous reward journey: chase, Dogecoin reveal, then bank the claim. */
.bonus-page #close { display: none; }
.bonus-page .card > header { min-height: 32px; justify-content: center; }
.roll-cell .bonus-upgrade-icon { width: 46px; height: 42px; animation: doge-coin-float 2.2s ease-in-out infinite; }
.roll-cell.is-upgrade::before { content: ""; position: absolute; inset: 4%; z-index: -1; border-radius: 50%; background: radial-gradient(circle, #ffc84c77, #ffbb0010 60%, transparent 72%); animation: bonus-button-glow 1.4s ease-in-out infinite alternate; }
.roll-cell.is-upgrade:nth-child(3n) .bonus-upgrade-icon { animation-delay: -.7s; }
.bonus-page[data-spinning="true"] .roll-tier.is-active { animation: spin-energy 1.2s ease-in-out infinite alternate; }
.bonus-page[data-spinning="true"] .roll-tier:not(.is-active) { filter: brightness(.7); transition: filter .3s; }
.roll-cell.is-cursor { transform: translateY(-2px) scale(1.08); box-shadow: 0 0 9px #fff4bc, 0 0 26px #ffc548b0, 0 5px 14px #0005; }
.roll-cell.is-trail { filter: brightness(1.3); box-shadow: inset 0 0 12px #ffe28480, 0 0 8px #ffd95d55; }
.roll-cell.is-cursor::after { inset: -38%; animation: spin-halo 1.6s linear infinite; }
.bonus-celebration { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at center, #1b5575ee, #021329f7 75%); animation: celebration-appear .35s ease-out both; }
.bonus-celebration.is-gold { background: radial-gradient(ellipse at center, #9c591cf0, #24102bfa 72%); }
.celebration-rays { position: absolute; width: 150vmax; height: 150vmax; z-index: -2; background: repeating-conic-gradient(from 0deg, transparent 0deg 12deg, #abe7ff26 12deg 20deg, transparent 20deg 30deg); mask-image: radial-gradient(circle, #000, transparent 65%); animation: spin-halo 20s linear infinite; }
.is-gold .celebration-rays { background: repeating-conic-gradient(transparent 0deg 10deg, #ffe49459 10deg 18deg, transparent 18deg 26deg); animation-duration: 12s; }
.celebration-ring { position: absolute; width: min(70vw, 460px); aspect-ratio: 1; border: 2px solid #ffeaa7; border-radius: 50%; box-shadow: 0 0 50px #ffc64b66, inset 0 0 50px #ffc64b55; animation: prize-ring 1.5s ease-out infinite; z-index: -1; }
.is-gold .celebration-ring { border-width: 5px; animation-duration: 1.1s; }
.celebration-prize { display: flex; flex-direction: column; align-items: center; width: 100%; padding: 24px; text-align: center; animation: prize-pop .8s cubic-bezier(.16,.8,.25,1.2) both; }
.celebration-coin { width: min(66vw, 310px, 44dvh); height: auto; filter: drop-shadow(0 0 30px #ffcd5baa); animation: prize-coin-turn 2.4s ease-in-out infinite; }
.is-gold .celebration-coin { width: min(78vw, 390px, 49dvh); filter: drop-shadow(0 0 42px #ffd34bdd); }
.celebration-prize > small { margin: 12px 0 8px; color: #fff1bd; font-size: clamp(10px, 2vw, 14px); letter-spacing: .28em; font-weight: 900; }
.celebration-prize > strong { color: #fff1b2; font-size: clamp(24px, 6vw, 58px); line-height: 1.1; font-weight: 950; text-shadow: 0 4px 0 #774016, 0 0 30px #ffcd5966; }
.is-gold .celebration-prize > strong { color: #fff3a0; text-shadow: 0 4px 0 #8a3511, 0 0 40px #ffb300; }
.celebration-prize p { margin-top: 16px; color: #fff6e0; font-size: 13px; }
.celebration-sparks { position: absolute; inset: 50%; z-index: -1; }
.celebration-sparks i { position: absolute; width: 7px; height: 14px; border-radius: 2px; background: #fff3bc; box-shadow: 0 0 12px #ffcf5c; animation: prize-spark 1.8s ease-out var(--delay) infinite both; }
.is-gold .celebration-sparks i { width: 9px; height: 19px; background: #ffd74c; }
@keyframes doge-coin-float { 0%,100% { transform: translateY(1px) rotate(-8deg); filter: drop-shadow(0 0 4px #ffc54766); } 50% { transform: translateY(-3px) rotate(8deg) scale(1.08); filter: drop-shadow(0 0 9px #ffe084cc); } }
@keyframes spin-energy { from { box-shadow: 0 0 20px #ffcf5533; } to { box-shadow: 0 0 42px #ffcf5577, inset 0 0 30px #ffe18515; } }
@keyframes spin-halo { to { transform: rotate(360deg); } }
@keyframes celebration-appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes prize-pop { from { opacity: 0; transform: scale(.35) translateY(70px); } 65% { opacity: 1; transform: scale(1.06); } to { transform: scale(1); } }
@keyframes prize-coin-turn { 0%,100% { transform: perspective(700px) rotateY(-16deg) translateY(0); } 50% { transform: perspective(700px) rotateY(16deg) translateY(-10px); } }
@keyframes prize-ring { from { opacity: .9; transform: scale(.5); } to { opacity: 0; transform: scale(1.7); } }
@keyframes prize-spark { from { opacity: 0; transform: rotate(var(--angle)) translateY(40px) rotate(0); } 20% { opacity: 1; } to { opacity: 0; transform: rotate(var(--angle)) translateY(var(--reach)) rotate(220deg); } }
@media (max-width: 700px) { .roll-cell .bonus-upgrade-icon { width: 36px; height: 34px; } }
@media (max-height: 500px) and (orientation: landscape) { .roll-cell .bonus-upgrade-icon { width: 34px; height: 30px; } .bonus-page .card > header { min-height: 48px; justify-content: flex-start; } .celebration-prize { padding: 12px; } .celebration-prize > small { margin-block: 4px; } .celebration-prize > strong { font-size: 28px; } .celebration-prize p { margin-top: 8px; } }
@media (prefers-reduced-motion: reduce) {
  .bonus-page *, .bonus-page *::before, .bonus-page *::after { animation: none !important; transition: none !important; }
  .celebration-sparks, .celebration-ring { display: none; }
}
