/* Quizzy — quiz-show theme: deep purple stage, white cards, yellow highlights, purple actions.
   Fast by design: system fonts, no images except three tiny SVGs, background on its own GPU layer.
   Spacing on a 4px grid. Radius: 8 controls, 12 cards, 16 popups. */

:root {
  --stage: #1b0f6b;
  --stage-deep: #0c0538;
  --yellow: #fcff07;
  --gold: #ffc400;
  --purple: #7b1fa2;
  --purple-2: #9c27b0;
  --tile: #f3ebfb;
  --ink: #1d1b2e;
  --ink-2: #4a4860;
  --muted: #8a8799;
  --line: #ece8f3;
  --lavender: #c9c1ff;
  --green: #2fb10a;
  --green-bg: #47be06;
  --red: #f33;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --app-w: 420px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: #07031f; }
body { margin: 0; min-height: 100%; }
body {
  background: transparent; color: #fff;
  font: 400 15px/22px var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, p, ul, ol { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a, button { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; border-radius: 8px; }
.hidden { display: none !important; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }

/* icons: a block inside a grid box always sits on the exact centre */
.i { display: block; flex: none; }
[data-icon] { display: grid; place-items: center; }

/* app column + stage background on its own fixed layer (no repaint on scroll) */
.app { position: relative; isolation: isolate; max-width: var(--app-w); min-height: 100vh; margin: 0 auto; background: var(--stage); overflow-x: hidden; }
.app::before {
  content: ""; position: fixed; top: 0; bottom: 0; z-index: -1; pointer-events: none;
  left: max(0px, calc(50% - var(--app-w) / 2)); width: min(100%, var(--app-w));
  background: var(--stage) url("../img/bg.svg") center top / cover no-repeat; transform: translateZ(0);
}
.view { min-height: 100vh; }
.page { padding: 0 16px 48px; animation: enter .2s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* coin */
.coin { display: inline-block; flex: none; width: 16px; height: 16px; vertical-align: -3px; background: url("../img/e/coin.webp") center / contain no-repeat; }
.coin-lg { width: 24px; height: 24px; vertical-align: -5px; }
.coin-hero { display: block; width: 64px; height: 64px; margin: 0 auto 12px; }

/* ---------- shared ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 12px 0 6px; }
.brand-btn { display: flex; align-items: center; gap: 2px; height: 40px; padding-right: 8px; }
.brand-btn .wordmark { font-size: 20px; font-weight: 700; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; transition: background-color .15s var(--ease); }
.icon-btn:hover { background: rgba(255, 255, 255, .1); }
.text-link {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 16px;
  background: linear-gradient(180deg, #d4d6ff, #9a9ef2); color: #1a1450; border: 1px solid #fff; font-size: 13px; font-weight: 600;
}
.accent-link { color: var(--yellow); font-weight: 600; }

.page-head { display: flex; align-items: center; gap: 8px; height: 56px; margin: 0 -4px; }
.page-head .icon-btn { width: 36px; height: 36px; background: rgba(255, 255, 255, .12); }
.page-head h1 { font-size: 19px; line-height: 24px; font-weight: 700; }

.eyebrow { font-size: 13px; line-height: 20px; color: var(--lavender); }
.title { font-size: 24px; line-height: 32px; font-weight: 700; }
.lead { font-size: 15px; line-height: 22px; color: #e4e0ff; }
.section-title { font-size: 16px; font-weight: 700; color: var(--yellow); margin: 32px 0 12px; }

.points { list-style: none; padding: 0; display: grid; gap: 8px; }
.points li { position: relative; padding-left: 16px; font-size: 13px; line-height: 20px; }
.points li::before { content: ""; position: absolute; left: 0; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); }
.made-in { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 32px; font-size: 14px; }
.made-in img { width: 32px; height: 20px; border-radius: 2px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px;
  border-radius: 8px; font-size: 16px; font-weight: 700; transition: transform .12s var(--ease), background-color .15s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn-block { display: flex; width: 100%; }
.btn-primary { background: linear-gradient(180deg, #ffe44d, #f5a800); color: #3a2400; box-shadow: 0 4px 0 #b57700; border-radius: 24px; }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #b57700; }
.btn-secondary { background: #fff; color: var(--purple); box-shadow: inset 0 0 0 1.5px var(--purple); }
.btn-secondary:hover { background: #faf5fd; }
.btn-quiet { color: var(--muted); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; }
.btn.done { background: #fff; color: #aaa; box-shadow: inset 0 0 0 1.5px #ccc; pointer-events: none; }

/* white card + icon tile */
.card { background: #fff; color: var(--ink); border-radius: 12px; padding: 12px; box-shadow: 0 4px 16px rgba(4, 0, 30, .3); }
.icon-box { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 12px; background: #fff; color: var(--purple); box-shadow: inset 0 0 0 1px #e6e2f0; }
.icon-box img { display: block; }
.icon-box.lg { width: 104px; height: 104px; border-radius: 16px; }

/* ---------- home ---------- */
.balance { text-align: center; padding: 8px 0 20px; }
.balance .eyebrow { display: none; }
.balance-figure { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px; font-size: 24px; line-height: 32px; font-weight: 800; }
.balance .btn {
  height: 40px; border-radius: 20px; border: 2px solid #fff; color: #2b1600; font-weight: 700;
  background: linear-gradient(180deg, #fff35a, #ffc400); box-shadow: 0 4px 16px rgba(255, 196, 0, .35);
}

.tabs { display: flex; border-bottom: 1px solid rgba(255, 255, 255, .3); margin-bottom: 12px; }
.tab { flex: 1; height: 44px; font-size: 15px; font-weight: 600; color: #fff; border-bottom: 3px solid transparent; transition: border-color .15s var(--ease); }
.tab.active { border-bottom-color: #fff; }

.list { display: grid; gap: 12px; }
#tabContent > * { content-visibility: auto; contain-intrinsic-size: auto 132px; }

/* contest card */
.contest-top { display: grid; grid-template-columns: 48px 1fr; grid-template-areas: "icon name" "icon prize" "icon sub"; column-gap: 12px; align-items: center; }
.contest-top .icon-box { grid-area: icon; }
.contest-top > div:nth-child(2) { display: contents; }
.contest-name { grid-area: name; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-2); }
.contest-sub { grid-area: sub; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--muted); }
.prize { grid-area: prize; display: flex; align-items: center; gap: 4px; font-size: 19px; line-height: 28px; font-weight: 800; }
.prize .coin { width: 20px; height: 20px; }
.contest-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.contest-foot .btn { margin-left: auto; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 700; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4cd000; }

/* editor's choice */
.pick { display: grid; grid-template-columns: 80px 1fr 20px; gap: 12px; align-items: center; }
.pick .icon-box { width: 80px; height: 64px; border-radius: 10px; background: linear-gradient(135deg, #5b2ad6, #c33ad1); color: #fff; }
.pick p { font-size: 14px; line-height: 20px; font-weight: 600; }
.pick .eyebrow { color: var(--purple); margin-top: 4px; font-size: 12px; }
.pick > .i { color: var(--muted); }

/* fortune cookie */
.fortune-btn img { display: block; animation: wobble 2.6s ease-in-out infinite; }
.fortune-btn {
  position: fixed; bottom: 24px; right: max(16px, calc(50% - var(--app-w) / 2 + 16px)); z-index: 40;
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; border: 2px solid #fff;
  background: radial-gradient(circle at 30% 30%, #ffe680, #f5a800); color: #5a3500; box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
}

/* ---------- side menu ---------- */
.menu-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .55); opacity: 0; visibility: hidden; transition: opacity .2s var(--ease), visibility 0s linear .2s; }
.sidebar {
  position: fixed; top: 0; bottom: 0; left: max(0px, calc(50% - var(--app-w) / 2)); z-index: 61;
  width: 288px; max-width: 84vw; padding: 8px 12px 24px; overflow-y: auto; background: #fff; color: var(--ink);
  transform: translateX(-16px); opacity: 0; visibility: hidden;
  transition: transform .22s var(--ease), opacity .22s var(--ease), visibility 0s linear .22s;
}
.menu-open .menu-backdrop { opacity: 1; visibility: visible; transition-delay: 0s; }
.menu-open .sidebar { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
.sidebar-head { display: flex; align-items: center; gap: 12px; padding: 12px 4px 16px; border-bottom: 1px solid #eee; }
.sidebar .icon-btn { color: #666; }
.sidebar .icon-btn:hover { background: #f4f0f8; }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--tile); color: var(--purple); flex: none; }
.sidebar-who { flex: 1; display: grid; }
.sidebar-who b { font-size: 16px; font-weight: 700; }
.sidebar-who a { font-size: 14px; font-weight: 700; color: var(--purple); text-decoration: underline; text-underline-offset: 3px; }
.sidebar-menu { list-style: none; padding: 8px 0 0; }
.sidebar-menu a { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 8px; border-bottom: 1px solid #f2f2f2; font-size: 15px; font-weight: 500; }
.sidebar-menu .i { color: var(--purple); }

/* ---------- intro ---------- */

/* questions */
.q-label { font-size: 13px; color: var(--lavender); margin-bottom: 4px; }
.q-text { font-size: 20px; line-height: 28px; font-weight: 700; margin-bottom: 16px; }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 12px 16px; border-radius: 8px;
  background: #fff; color: #000; box-shadow: inset 0 0 0 1px #fff;
  font-size: 16px; line-height: 22px; font-weight: 700; text-transform: uppercase; text-align: left;
  transition: background-color .15s var(--ease), color .15s var(--ease), transform .12s var(--ease);
}
.option:not(:disabled):active { transform: scale(.98); }
.option:disabled { cursor: default; }
.option > span:last-child { flex: 1; }
.bubble { order: 2; display: none; place-items: center; flex: none; width: 32px; height: 32px; }
.bubble img { display: block; animation: pop .3s var(--ease); }
.bubble .ltr { display: none; }
.option.correct { background: var(--green-bg); color: #fff; box-shadow: none; }
.option.wrong { background: var(--red); color: #fff; box-shadow: none; }
.option.correct .bubble, .option.wrong .bubble { display: grid; }
.intro-q .option { background: transparent; color: #fff; }
.intro-q .option.correct { background: var(--green-bg); }
.intro-q .option.wrong { background: var(--red); }
/* intro starts straight with the question: same 20px gap above it with or without the top ad */
.intro-q > .q-label { margin-top: 20px; }
.intro-q > .ad-top { margin-bottom: 0; }
.login-line { margin-top: 20px; text-align: right; font-size: 13px; }
.legal-bar { margin: 32px 0 0; font-size: 11px; line-height: 16px; text-align: center; color: rgba(255, 255, 255, .75); }
.legal-bar a { color: var(--yellow); text-decoration: underline; }

/* intro success */
.success { margin-top: 48px; padding: 24px 20px; border-radius: 20px; background: #fff; color: var(--ink); border-left: 6px solid var(--gold); text-align: center; }
.success .coin-hero { width: 88px; height: 88px; }
.success .title { color: var(--purple); }
.success .lead { color: var(--ink-2); }
.success .btn { margin: 20px 0 24px; }
.success .points { text-align: left; }
.success .points li::before { background: var(--purple-2); }

/* ---------- contest entry ---------- */
.entry-head { display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 4px; }
.entry-head h2 { font-size: 20px; line-height: 28px; font-weight: 700; }
.prize-big { display: flex; align-items: center; gap: 8px; font-size: 28px; line-height: 36px; font-weight: 800; color: var(--purple); }
.prize-big .coin { width: 28px; height: 28px; }
.rank-link { font-size: 13px; color: #777; text-decoration: underline; text-underline-offset: 3px; }
.facts-list { margin: 16px 0; }
.facts-list div { display: flex; justify-content: space-between; align-items: center; height: 40px; border-bottom: 1px solid var(--line); font-size: 14px; }
.facts-list dt { color: var(--ink-2); font-weight: 600; }
.facts-list dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
#playBtn { background: #fff; color: var(--purple); box-shadow: inset 0 0 0 1.5px var(--purple); border-radius: 8px; }
#playBtn:active { transform: scale(.98); }
.notes { margin-top: 20px; }
.notes li::before { background: #c04de0; }
.rules-row { display: flex; justify-content: center; margin-top: 20px; }
.rules-row .text-link { background: none; border: 0; color: #fff; text-decoration: underline; font-size: 15px; }

/* rank table */
.sheet { padding: 0; overflow: hidden; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 20px; border-bottom: 1px solid #eee; }
.rank-table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.rank-table th, .rank-table td { height: 44px; padding: 0 20px; border-bottom: 1px solid #f0f0f0; text-align: left; }
.rank-table th { background: #f7f3fb; color: #555; font-size: 13px; }
.rank-table tr:last-child td { border-bottom: 0; }
.rank-table td:last-child, .rank-table th:last-child { text-align: right; font-weight: 700; }
.rank-table .coin { margin-right: 4px; }

/* ---------- quiz play ---------- */
.play-head { display: flex; align-items: center; gap: 12px; height: 64px; }
.play-head .icon-box { width: 40px; height: 40px; border-radius: 10px; background: #fff; }
.play-head b { font-size: 17px; font-weight: 600; }
.play-status { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 24px; }
.play-status .eyebrow { font-size: 16px; color: #fff; font-weight: 600; }
.play-status .eyebrow b { font-variant-numeric: tabular-nums; }
.timer { position: relative; width: 56px; height: 56px; }
.timer svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.timer .base { fill: none; stroke: rgba(255, 255, 255, .2); stroke-width: 10; }
.timer .prog { fill: none; stroke: var(--yellow); stroke-width: 10; stroke-linecap: round; transition: stroke .3s; }
.timer.low .prog { stroke: var(--red); }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.score-line { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 32px; font-size: 17px; font-weight: 700; }
.score-line b { font-variant-numeric: tabular-nums; }
.streak { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px 4px 8px; border-radius: 12px; background: var(--yellow); color: #3a2400; font-size: 13px; font-weight: 800; opacity: 0; transition: opacity .2s var(--ease); }
.streak.show { opacity: 1; }

/* ---------- score ---------- */
.result-card { background: rgba(40, 10, 110, .6); color: #fff; border: 1px solid #b23ad6; box-shadow: none; display: grid; gap: 12px; padding: 16px; }
.result-top { display: flex; align-items: center; gap: 12px; }
.result-top .icon-box { background: #fff; }
.result-top b { display: block; font-size: 18px; font-weight: 700; }
.result-top .eyebrow { color: #fff; font-weight: 600; }
.result-figures { display: flex; border-top: 1px solid rgba(255, 255, 255, .15); padding-top: 12px; }
.result-figures div { flex: 1; }
.result-figures div + div { padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, .15); }
.result-figures strong { display: flex; align-items: center; gap: 8px; font-size: 28px; line-height: 36px; font-weight: 800; color: var(--yellow); font-variant-numeric: tabular-nums; }

/* ---------- results list ---------- */
.result-row { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; min-height: 68px; border-bottom: 1px solid #eee; }
.result-row:last-child { border-bottom: 0; }
.result-row b { display: block; font-size: 15px; }
.result-row .eyebrow { color: var(--muted); }
.result-row .won { display: flex; align-items: center; gap: 4px; font-weight: 800; font-variant-numeric: tabular-nums; }
.empty { display: grid; justify-items: center; gap: 12px; padding: 32px 16px; text-align: center; color: var(--ink-2); font-size: 14px; }

/* ---------- content pages ---------- */
.card.prose { padding: 20px 16px; display: grid; gap: 10px; }
.prose h2 { font-size: 16px; line-height: 22px; font-weight: 700; margin-top: 8px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { font-size: 14px; line-height: 22px; color: var(--ink-2); }
.prose ol { padding-left: 20px; display: grid; gap: 10px; }
.prose a { color: var(--purple); font-weight: 600; }
.contact-block { display: grid; justify-items: center; gap: 8px; text-align: center; }
.contact-block .lead { color: var(--ink-2); }
.contact-block .accent-link { color: var(--purple); }
.contact-block + .contact-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.card:has(.contact-block) { padding: 20px 16px; }
.foot-note { margin-top: 16px; text-align: center; font-size: 14px; }
.foot-note a { color: var(--yellow); text-decoration: underline; }
.social-row { display: flex; justify-content: center; gap: 8px; }

/* signup */
.signup { padding-top: 8px; }
.signup img.mark { float: right; width: 56px; height: 56px; }
.signup .title { color: var(--yellow); font-size: 22px; }
.signup .lead { font-size: 13px; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 272px; height: 52px; margin: 64px auto 16px;
  border-radius: 10px; background: #fff; color: #333; font-size: 17px; font-weight: 600; box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
  transition: transform .12s var(--ease);
}
.google-btn:active { transform: scale(.98); }
.fine-print { font-size: 13px; line-height: 20px; text-align: center; margin-bottom: 40px; }
.fine-print a { text-decoration: underline; }

/* 404 */
.notfound { display: grid; justify-items: center; gap: 12px; padding-top: 96px; text-align: center; }
.notfound .icon-box { width: 80px; height: 80px; border-radius: 20px; margin-bottom: 8px; }
.notfound .btn { margin-top: 12px; }

/* ---------- popups ---------- */
.modal {
  position: fixed; inset: 0; z-index: 99; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .6); opacity: 0; visibility: hidden; transition: opacity .2s var(--ease), visibility 0s linear .2s;
}
.modal.show { opacity: 1; visibility: visible; transition-delay: 0s; }
.dialog {
  position: relative; width: min(336px, 100%); padding: 24px 20px 20px; border-radius: 16px; background: #fff; color: var(--ink);
  text-align: center; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); transform: scale(.96); transition: transform .2s var(--ease);
}
.modal.show .dialog { transform: none; }
.dialog.center { background: linear-gradient(180deg, #33137f, #170a52); color: #fff; }
.dialog.center .dialog-title { color: var(--yellow); font-size: 28px; line-height: 36px; }
.dialog.center .dialog-text { color: #e4e0ff; }
.dialog.center .dialog-text b { color: var(--yellow); }
.dialog.center .btn-quiet { color: #fff; }
.dialog-x { position: absolute; top: 8px; right: 8px; color: #888; }
.dialog-x:hover { background: #f4f0f8; }
.dialog-title { font-size: 24px; line-height: 32px; font-weight: 800; }
#halfTitle { color: #2e9e00; }
#lowTitle { color: #e53935; }
.dialog-text { margin-top: 8px; font-size: 15px; line-height: 22px; color: var(--ink-2); }
.dialog-text b { color: var(--ink); }
.dialog-actions { display: grid; gap: 8px; margin-top: 20px; }
.dialog-actions.row { grid-template-columns: 1fr 1fr; }
.dialog-actions .btn-quiet { height: 36px; }
#awesomeContinue, #lowBalanceClaim { background: linear-gradient(90deg, #6a1b9a, #b03ad1); color: #fff; box-shadow: none; border-radius: 10px; }
#exitYes { background: #fff; color: var(--purple); box-shadow: inset 0 0 0 1.5px var(--purple); }
#exitNo { background: var(--purple); color: #fff; box-shadow: none; border-radius: 8px; }
.figure-xl { margin-top: 4px; font-size: 32px; line-height: 40px; font-weight: 800; color: #f39c00; font-variant-numeric: tabular-nums; }
#congratsTitle { color: #ff8f00; }
.eyebrow#fortuneLabel { color: #8a5a00; font-weight: 700; }
#fortuneModal .dialog { background: linear-gradient(160deg, #fff8dc, #ffe29a); color: #4a2a00; }
.fortune-text { margin-top: 8px; font-size: 19px; line-height: 28px; font-weight: 700; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 72px; z-index: 120; display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 24px; background: #fff; color: #14275e; font-size: 14px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; transform: translate(-50%, 8px);
  transition: opacity .2s var(--ease), transform .2s var(--ease); font-variant-numeric: tabular-nums;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- pictures + playful motion (transform only, GPU friendly) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pop-img { display: block; margin: 0 auto 8px; }
.pop { animation: pop .45s var(--ease) both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } to { transform: none; } }
@keyframes wobble { 0%, 78%, 100% { transform: rotate(0); } 84% { transform: rotate(-12deg); } 90% { transform: rotate(12deg); } 95% { transform: rotate(-6deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-8px) scale(1.04); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* gift with turning light rays behind it */
.burst { position: relative; width: 160px; height: 140px; margin: -8px auto 4px; display: grid; place-items: center; }
.burst::before {
  content: ""; position: absolute; inset: -20px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 214, 0, .35) 0 10deg, transparent 10deg 30deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%); mask: radial-gradient(circle, #000 25%, transparent 70%);
  animation: spin 8s linear infinite;
}
.burst img { position: relative; }
.bob { animation: bob 1.6s ease-in-out infinite; }

/* fortune cookie card */
#fortuneModal { padding: 24px; }
.fortune-card {
  position: relative; width: min(320px, 100%); padding: 112px 24px 48px; border-radius: 10px;
  background:
    radial-gradient(rgba(176, 96, 32, .16) 1.2px, transparent 1.4px) 0 0 / 14px 14px,
    linear-gradient(180deg, #ffe7c4 0 38%, #f8cf98 38% 100%);
  border: 2px solid #ffeabf; box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  transform: scale(.94); transition: transform .2s var(--ease);
}
#fortuneModal.show .fortune-card { transform: none; }
.fortune-badge {
  position: absolute; left: 50%; top: -72px; width: 176px; height: 176px; margin-left: -88px;
  display: grid; place-items: center; border-radius: 50%;
}
.fortune-badge::before { content: ""; position: absolute; inset: 34px; border-radius: 50%; background: #fff; box-shadow: 0 4px 12px rgba(120, 60, 0, .25); }
.fortune-badge img { position: relative; }
.wobble { animation: wobble 2.6s ease-in-out infinite; }
.fortune-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.fortune-ring text {
  font: 900 30px/1 "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif; letter-spacing: 2px;
  fill: #f39a1e; stroke: #7a3b0a; stroke-width: 5px; paint-order: stroke; stroke-linejoin: round;
}
.fortune-paper { display: grid; place-items: center; min-height: 200px; padding: 32px 20px; background: #fff; filter: drop-shadow(0 2px 2px rgba(120, 60, 0, .25)); }
.fortune-text {
  margin: 0; color: #2a1d10; text-align: center; font-size: 22px; line-height: 32px; font-weight: 700;
  font-family: "Comic Sans MS", "Chalkboard SE", "Segoe Print", "Comic Neue", cursive;
}
.fortune-x {
  position: absolute; left: 50%; bottom: -22px; width: 48px; height: 48px; margin-left: -24px; border-radius: 50%;
  display: grid; place-items: center; background: #fff1dc; color: #b5651d; box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}
.fortune-x svg { stroke-width: 3; }

/* ---------- display ad (top of page) ---------- */
/* space is reserved up front (min-height set from config) so content never jumps when an ad arrives */
.ad-slot {
  display: flex; flex-direction: column; justify-content: flex-start; margin: 0 -16px;
  contain: layout;
}
.ad-slot::after { content: "Advertisement"; display: block; order: 2; padding: 4px 0 0; text-align: center; font-size: 10px; line-height: 12px; color: rgba(255, 255, 255, .45); }
.ad-slot ins { width: 100%; }
/* clean gap between the top ad and the page content under it */
.ad-top { margin-bottom: 16px; }
/* no ad to show: give the space back instead of leaving an empty block */
.ad-slot:has(ins[data-ad-status="unfilled"]), .no-ads .ad-slot { display: none; }

/* loader shown while an interstitial / rewarded ad is fetched (max 3s) */
.ad-loader {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; align-content: center; gap: 12px;
  background: rgba(12, 5, 56, .92); opacity: 0; visibility: hidden; transition: opacity .15s, visibility 0s linear .15s;
}
.ad-loader.show { opacity: 1; visibility: visible; transition-delay: 0s; }
.ad-spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .2); border-top-color: var(--yellow); animation: spin .8s linear infinite; }
.ad-loader p { font-weight: 600; color: var(--yellow); }
