/* =============================================================================
   Partner × MomentScience — styles.css
   Single-screen flow: Level Complete screenshot + game-native offer bottom sheet
============================================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Game-native display + body type (chunky, playful, rounded): Fredoka + Nunito.
   Self-hosted Latin subsets of the variable fonts, trimmed to the weights used
   below (see assets/fonts/OFL.txt). font-display: swap shows text in the fallback
   at once. */
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("assets/fonts/fredoka-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("assets/fonts/nunito-latin.woff2") format("woff2");
}

/* ============================================================
   PRIMITIVES — shared with the landscape template. Keep them: the
   accessibility checks look for each one (see CLONE.md).
============================================================ */
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
html,
body {
  overscroll-behavior: none;
}
/* One focus ring for every control. Dark surfaces override it to white below. */
:focus-visible {
  outline: 2px solid #233d71;
  outline-offset: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}
/* Headings, regions and messages take focus from script only (tabindex="-1"):
   it tells a screen reader where it is, and is not an operable control to ring. */
[tabindex="-1"]:focus {
  outline: none;
}
.format-picker :focus-visible,
.bonus-close:focus-visible,
.bonus-dot:focus-visible,
.toast-dismiss:focus-visible {
  outline-color: #fff;
}
button {
  touch-action: manipulation;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  /* Decorative loops do not run at all. */
  .bonus-sparkle,
  .bonus-hero-shimmer,
  .bottom-sheet-shimmer {
    animation: none !important;
  }
}

:root {
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* Game palette — Words with Friends: the board's blue→teal, white cards,
     navy ink (the old template names are kept so every rule above follows) */
  --wood-deep: #0b1d33;
  --wood-mid: #0a4fc4;
  --wood-warm: #1489c9;
  --cream: #ffffff;
  --cream-shadow: #eef2f8;
  --ribbon-red: #0a4fc4;
  --ribbon-red-d: #083d93;
  /* The Claim gradient, darkened from WWF's #1489c9 / #14b8a0 so white text
     clears 4.5:1 on every stop (#0a4fc4 7.2, #0c6fa8 5.5, #0a7a6c 5.2). */
  --leaf-top: #0a4fc4;
  --leaf-green: #0c6fa8;
  --leaf-bot: #0a7a6c;
  --leaf-green-d: #083d93;
  --ink: #17233a;
  --ink-soft: #5b6675; /* 5.8:1 on the white cards */
  --gold: #d9932c;
  --gold-d: #d9932c;
  /* --gold-ink is the small grey label colour: 5.4:1 on white. */
  --gold-ink: #5f6b80;
  --gold-glow: rgba(20, 137, 201, 0.35);
  --picker-accent: #ffffff;
  --picker-accent-ink: var(--ink);
}

/* ============================================================
   DEMO BODY — dark canvas, centers the phone frame
============================================================ */
.demo-body {
  /* Cross-browser viewport height: dvh in modern browsers, vh fallback for older Safari */
  min-height: 100vh;
  min-height: 100dvh;
  background: #0d0d0d;
  font-family:
    "Nunito",
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Text",
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Touch phones: no body scroll, the iphone-frame fills the viewport.
     Non-touch pointers (any desktop window, at any zoom) scroll instead, below. */
  overflow: hidden;
}
@media (not (pointer: coarse)) {
  .demo-body {
    overflow-x: hidden;
    overflow-y: auto;
  }
}

/* <main> wraps the picker and the phone for the landmark; it adds no box. */
.demo-main {
  display: contents;
}

/* ============================================================
   DESKTOP LABEL
============================================================ */
.desktop-label {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  text-align: center;
}
.desktop-label-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.desktop-label-sub {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.3);
}

/* ============================================================
   IPHONE FRAME — full-bleed on mobile, bezel on desktop
============================================================ */
.iphone-frame {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--wood-deep);
  overflow: hidden;
}

.screen-content {
  position: relative;
  width: 100%;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dynamic-island,
.home-indicator,
.iphone-frame .btn {
  display: none;
}

@media (min-width: 920px) and (not (pointer: coarse)) {
  html,
  body {
    height: 100%;
  }
  .demo-body {
    background-image: radial-gradient(
      ellipse at center,
      #1a1a1a 0%,
      #0d0d0d 100%
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    /* was: justify-content: center. On a viewport shorter than the
       frame, centering a flex item clips BOTH ends equally and the
       browser only ever lets you scroll toward revealing more of the
       bottom — the top (status bar, Dynamic Island) becomes permanently
       unreachable, not just distorted. .iphone-frame's own `margin:
       auto 0` below does the centering instead: it centers when there's
       room and safely collapses to top-anchored, scrollable overflow
       when there isn't — the standard flexbox-safe-centering pattern,
       with universal browser support (no reliance on `justify-content:
       safe center`). */
    justify-content: flex-start;
    padding: 20px;
    /* was: overflow: hidden. clamp(560px, 100dvh-40px, 840px) on
       .iphone-frame used to squash the screen shorter than its true
       375:812 ratio on any viewport under ~880px tall — now the frame
       is a fixed, correctly-proportioned size and scrolls into view
       instead of distorting. */
    overflow-y: auto;
    height: 100vh;
    height: 100dvh;
  }
  .desktop-label {
    display: none;
  }
  .iphone-frame {
    /* Fixed at the true 375:812 ratio — no more clamp(560px,...,840px)
       squashing the screen shorter on viewports under ~880px tall.
       margin: auto 0 centers it within .demo-body when there's room,
       and safely collapses to 0 (top-anchored, scrollable) instead of
       clipping when there isn't — see the .demo-body comment above.
       The frame itself stays unclipped (overflow:visible overrides the
       mobile overflow:hidden above) so the buttons below, which
       protrude slightly past its edge, aren't cut off — the clipped
       titanium body lives on ::before instead. */
    margin: auto 0;
    width: 399px;
    height: 836px;
    overflow: visible;
    /* A window shorter than the phone scales the whole frame down (script.js
       sets --bezel-scale to fit the window, never under 0.55) instead of
       pushing Claim and Save below the fold. A transform keeps the 375x812
       layout inside and the squircle clip-paths, which are in px, exact. The
       margins take the scaled-away height back out of the layout, and still
       centre the phone when the window is taller than it. */
    --bezel-scale: 1;
    transform: scale(var(--bezel-scale));
    transform-origin: center;
    margin: max(
        calc(418px * (var(--bezel-scale) - 1)),
        calc((100vh - 876px) / 2)
      )
      0;
    margin: max(
        calc(418px * (var(--bezel-scale) - 1)),
        calc((100dvh - 876px) / 2)
      )
      0;
    /* The bezel's rounded body is ::before, clipped to the squircle. This
       box is square, so the full-screen phone background has to go here or
       its corners show past the rounded edge. */
    background: none;
    flex-shrink: 0;
  }
  .iphone-frame::before {
    /* Titanium body, clipped to Figma's published corner-smoothing
       squircle (see <svg><defs> in index.html) — cornerRadius=79.8px
       (20% of the shorter side), cornerSmoothing=0.6. border-radius is
       a fallback for browsers without clip-path support. */
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
      133deg,
      #4c4c4f 0%,
      #2d2d2f 13%,
      #1c1c1e 32%,
      #232326 56%,
      #18181a 79%,
      #3c3c3f 100%
    );
    border-radius: 50px;
    clip-path: url(#frame-squircle-portrait);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.16),
      inset 0 1px 1px rgba(255, 255, 255, 0.22),
      0 40px 80px -20px rgba(0, 0, 0, 0.7),
      0 20px 40px -10px rgba(0, 0, 0, 0.5);
    z-index: 0;
  }
  /* Scoped to .iphone-frame — #screen-content is shared with .android-frame
     via a class swap on #phone-frame (device swap, see CLONE.md), and
     .android-frame .screen-content below doesn't override position/
     clip-path, so a bare .screen-content selector here would leak the
     iPhone's absolute positioning and squircle clip onto the Android
     skin (mismatched box size, wrong corner shape). */
  .iphone-frame .screen-content {
    position: absolute;
    left: 12px;
    top: 12px;
    width: 375px;
    height: 812px;
    border-radius: 38px;
    clip-path: url(#screen-squircle-portrait);
    overflow: hidden;
    flex: none;
  }
  .iphone-frame .dynamic-island {
    /* top:20px, not the original top:22px — .iphone-frame used to have
       padding:14px, and this value was measured from the frame's padding
       box regardless of that padding, landing 8px below the screen's own
       top edge (22-14=8). The frame no longer has padding — .screen-content
       gets an explicit top:12px offset instead — so this is recalculated
       to preserve the same 8px-below-screen-top position (12+8=20). */
    display: block;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 126px;
    height: 37px;
    background: #000;
    border-radius: 20px;
    z-index: 200;
    pointer-events: none;
  }
  .iphone-frame .home-indicator {
    display: block;
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 116px;
    height: 4px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 3px;
    z-index: 200;
    pointer-events: none;
  }
  /* Physical side controls — same treatment already used on .android-frame
     below, extended to the iPhone's four controls. Positions are typical
     placement (rounded percentages of frame height), not device-specific
     measurements. Depth is intentionally subtle (~2px). */
  .iphone-frame .btn {
    display: block;
    position: absolute;
    background: linear-gradient(90deg, #3d3d3f, #1c1c1e);
    box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.14);
    z-index: 1;
  }
  .iphone-frame .btn-action {
    left: -2px;
    top: 150px;
    width: 2px;
    height: 42px;
    border-radius: 2px 0 0 2px;
  }
  .iphone-frame .btn-vol-up {
    left: -2px;
    top: 226px;
    width: 2px;
    height: 58px;
    border-radius: 2px 0 0 2px;
  }
  .iphone-frame .btn-vol-dn {
    left: -2px;
    top: 301px;
    width: 2px;
    height: 58px;
    border-radius: 2px 0 0 2px;
  }
  .iphone-frame .btn-power {
    right: -2px;
    top: 251px;
    width: 2px;
    height: 100px;
    border-radius: 0 2px 2px 0;
  }
}

/* A short window with a mouse (a laptop at 200% zoom is 640x400 CSS px): the
   phone keeps enough height for the offer card and the page scrolls to the
   Claim button. Touch phones keep the full-bleed layout. */
@media (not (pointer: coarse)) and (max-height: 640px) and (max-width: 919px) {
  .iphone-frame,
  .android-frame {
    height: auto;
    min-height: 640px;
  }
}

/* ============================================================
   ANDROID FRAME — full-bleed on mobile, bezel on desktop.
   Alternate to .iphone-frame; provisioning picks one via device swap
   (swaps the class on #phone-frame, no markup restructuring needed).
   No status-bar/icon overlay — screenshots carry their own OS chrome.
============================================================ */
/* The iPhone's .btn divs (action/volume/power) live in the same markup
   regardless of which frame class is active — explicitly hidden here so
   a future generic style can't make four unstyled bars appear on the
   Android skin. Android's own physical-button treatment is the
   ::before/::after pair below. */
.android-frame .btn {
  display: none;
}
.android-frame {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--wood-deep);
  overflow: hidden;
}

.android-punch-hole {
  display: none;
}

@media (min-width: 920px) and (not (pointer: coarse)) {
  .android-frame {
    width: calc(390px + 24px);
    height: clamp(560px, calc(100vh - 40px), 840px);
    height: clamp(560px, calc(100dvh - 40px), 840px);
    padding: 12px;
    background: linear-gradient(155deg, #323234 0%, #202022 55%, #18181a 100%);
    border-radius: 36px;
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.08),
      0 40px 80px -20px rgba(0, 0, 0, 0.7),
      0 20px 40px -10px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
  }
  .android-frame .screen-content {
    width: 390px;
    height: 100%;
    border-radius: 26px;
    overflow: hidden;
    flex: none;
  }
  .android-frame .android-punch-hole {
    display: block;
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: #000;
    border-radius: 50%;
    z-index: 200;
    pointer-events: none;
  }
  .android-frame::before,
  .android-frame::after {
    content: "";
    position: absolute;
    right: -4px;
    width: 7px;
    background: #101012;
    border-radius: 2px 0 0 2px;
  }
  .android-frame::before {
    top: 90px;
    height: 46px;
  }
  .android-frame::after {
    top: 150px;
    height: 30px;
  }
}

@media (min-width: 920px) and (not (pointer: coarse)) and (max-height: 680px) {
  .android-frame .screen-content {
    width: 100%;
  }
}

/* ============================================================
   SCREENS
============================================================ */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transition: opacity 0.35s var(--ease);
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}
.screen.hidden {
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   iOS STATUS BAR OVERLAY — desktop bezel only
   Hidden on mobile (real OS bar shows). Enabled with the bezel (not a touch phone, ≥920px wide)
   via the desktop media query above.
============================================================ */
.ms-status-bar {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px 6px;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.45) 0%,
    transparent 100%
  );
  pointer-events: none;
}
.ms-status-time {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.3px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}
.ms-status-icons {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #fff;
}
@media (min-width: 920px) and (not (pointer: coarse)) {
  .iphone-frame .ms-status-bar {
    display: flex;
  }
}

/* ============================================================
   GAME SCREEN — full-bleed Level Complete screenshot
============================================================ */
#screen-game {
  background: var(--wood-deep);
}

.game-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.game-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  /* Load intro — feels like the "Level Complete!" animation arriving */
  opacity: 0;
  transform: scale(1.03);
  transition:
    opacity 0.7s var(--ease),
    transform 1.1s var(--spring);
}
.game-img.intro-in {
  opacity: 1;
  transform: scale(1);
}

/* Dim overlay (behind sheet, above screenshot) */
.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 10, 4, 0.32);
  z-index: 10;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.game-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   FORMAT PICKER — partner-facing placement toggle
   Three pills (Modal / Sheet / Toast) so partners can preview
   each placement format without reloading.
============================================================ */
.format-picker {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: rgba(20, 20, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 50;
}
.format-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  font-family: "Nunito", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 0.2s var(--ease),
    color 0.2s var(--ease),
    transform 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.format-pill:hover {
  color: rgba(255, 255, 255, 0.88);
}
.format-pill:active {
  transform: scale(0.96);
}
.format-pill.is-active {
  background: linear-gradient(
    180deg,
    var(--cream) 0%,
    var(--cream-shadow) 100%
  );
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 2px 6px rgba(0, 0, 0, 0.3);
}
.format-pill-emoji {
  font-size: 14px;
  line-height: 1;
}
.format-pill-label {
  white-space: nowrap;
}

/* Desktop: floating fixed panel on the left, bezel stays centered */
@media (min-width: 920px) and (not (pointer: coarse)) {
  .format-picker {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    border-radius: 14px;
    padding: 6px;
    gap: 2px;
    width: 168px;
    z-index: 60;
    margin-top: 0;
  }
  .format-pill {
    width: 100%;
    justify-content: flex-start;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
  }
  .format-pill.is-active {
    border-radius: 10px;
  }
}
/* format-pill-row exists only so markup can wrap the pills for the mobile
   dropdown below — on desktop/tablet it stays a no-op so pills remain direct
   flex children of .format-picker. */
.format-pill-row {
  display: contents;
}
.format-picker-trigger {
  display: none;
}

/* Mobile: the picker floats top-center over the full-bleed game. When the
   viewport is tall enough (phones; not a 200%-zoomed desktop window) it gets
   its own strip above the game instead, so it never covers the game's own top
   HUD (currency chips, status bar). The strip is reserved by shrinking the
   frame; offers (toast, sheet, modal) live inside the frame and never reach
   it. Expanding the picker drops its list over the game until a choice. */
@media not all and (min-width: 920px) and (not (pointer: coarse)) {
  .format-picker {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    max-width: calc(
      100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)
    );
  }
}
@media ((max-width: 919.98px) or (pointer: coarse)) and (min-height: 560px) {
  .demo-body {
    --picker-strip: calc(60px + env(safe-area-inset-top));
    padding-top: var(--picker-strip);
  }
  .iphone-frame,
  .android-frame {
    height: calc(100vh - var(--picker-strip));
    height: calc(100dvh - var(--picker-strip));
  }
  .format-picker {
    top: calc(4px + env(safe-area-inset-top));
  }
}

/* Narrow phones: 3 pills in a row no longer fit — collapse to a single
   trigger that expands into a vertical dropdown on tap. */
@media (max-width: 479px) {
  .format-picker {
    flex-direction: column;
    align-items: stretch;
    padding: 4px;
    border-radius: 14px;
  }
  .format-picker-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.88);
    font-family: "Nunito", sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    border-radius: 999px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .format-picker-trigger-chevron {
    margin-left: auto;
    transition: transform 0.2s var(--ease);
  }
  .format-picker.is-expanded .format-picker-trigger-chevron {
    transform: rotate(180deg);
  }
  .format-pill-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 2px;
  }
  .format-pill {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 12px;
    font-size: 12.5px;
  }
  .format-pill-emoji {
    font-size: 13px;
  }
}

/* ── Format-picker header ── */
.format-picker-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 12px 12px;
  border-bottom: 1px solid rgba(245, 200, 66, 0.18);
  margin-bottom: 6px;
}
.format-picker-title {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: var(--picker-accent);
  line-height: 1.15;
  text-align: center;
}
.format-picker-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin: 2px 0 1px;
  border-radius: 20px;
  background: rgba(245, 200, 66, 0.15);
  border: 1px solid rgba(245, 200, 66, 0.35);
  color: var(--picker-accent);
  font-family: "Nunito", sans-serif;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.format-picker-subtitle {
  font-family: "Nunito", sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.3;
  text-align: center;
  text-wrap: balance;
}
/* Mobile: header would clutter the floating picker (row or dropdown) — hidden */
@media not all and (min-width: 920px) and (not (pointer: coarse)) {
  .format-picker-header {
    display: none;
  }
}

/* ============================================================
   BOTTOM SHEET — alternative placement format
   Slides up from below; restrained, "system-style" companion
   to the celebratory bonus modal.
============================================================ */
.offer-bottom-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 28;
  /* A column whose offer copy is the part that gives way: on a short screen
     only the copy scrolls, and the arrows, dots, Claim and Save stay in view.
     The sheet itself scrolls only as a last resort. */
  display: flex;
  flex-direction: column;
  max-height: 100%;
  overflow-y: auto;
  padding: 14px calc(18px + env(safe-area-inset-right))
    calc(22px + env(safe-area-inset-bottom))
    calc(18px + env(safe-area-inset-left));
  background: linear-gradient(
    180deg,
    var(--cream) 0%,
    var(--cream-shadow) 100%
  );
  border-top: 3px solid rgba(0, 0, 0, 0.32);
  border-radius: 20px 20px 0 0;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.7),
    0 -10px 30px rgba(0, 0, 0, 0.4);
  font-family: "Nunito", sans-serif;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.45s var(--spring),
    opacity 0.3s var(--ease);
}
.offer-bottom-sheet.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.bottom-sheet-handle {
  width: 44px;
  height: 4px;
  margin: 0 auto 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 999px;
}
.bottom-sheet-close {
  position: absolute;
  top: 10px;
  right: calc(12px + env(safe-area-inset-right));
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  border: 0;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.bottom-sheet-close:hover {
  background: rgba(0, 0, 0, 0.18);
  color: var(--ink);
}
/* Small round controls keep their look; the invisible hit box reaches 44px. */
.bottom-sheet-close::before,
.bottom-sheet-nav-btn::before,
.bonus-close::before,
.toast-dismiss::before {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
}
.bottom-sheet-eyebrow {
  margin: 0 0 8px;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-ink);
}
.bottom-sheet-hero {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 0;
  display: block;
}
.bottom-sheet-shimmer {
  height: 70px;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.04) 0%,
    rgba(0, 0, 0, 0.12) 50%,
    rgba(0, 0, 0, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: bonus-shimmer 1.4s ease-in-out infinite;
  margin-bottom: 12px;
}
/* Loading and the empty/error copy are states of the surface (data-state).
   The shimmer only exists, and so only animates, while loading. */
.bottom-sheet-shimmer {
  display: none;
}
.offer-bottom-sheet[data-state="loading"] .bottom-sheet-shimmer {
  display: block;
}
.offer-bottom-sheet:not([data-state="ready"]) .bottom-sheet-body {
  display: none;
}
.ms-state {
  display: none;
  padding: 18px 12px 8px;
  text-align: center;
}
[data-state="empty"] > .ms-state,
[data-state="error"] > .ms-state {
  display: block;
}
.ms-state-title {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}
.ms-state-body {
  margin: 4px 0 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink-soft);
}
.ms-state-body:empty {
  display: none;
}
.ms-state-retry {
  margin-top: 4px;
}
.bottom-sheet-handle,
.bottom-sheet-eyebrow,
.bottom-sheet-shimmer,
.offer-bottom-sheet > .ms-state {
  flex-shrink: 0;
}
.bottom-sheet-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  min-height: 0;
}
.bottom-sheet-body[hidden] {
  display: none;
}
.bottom-sheet-dots,
.bottom-sheet-btns {
  flex-shrink: 0;
}
.bottom-sheet-nav-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex: 0 1 auto;
  min-height: 0;
}
/* The scroller. Its logo and text centre with auto margins, not
   align-items: center, which would push the top of long copy out of reach. */
.bottom-sheet-offer {
  flex: 1;
  display: flex;
  align-items: flex-start;
  align-self: stretch;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}
.bottom-sheet-offer > * {
  margin-block: auto;
}
.bottom-sheet-nav-btn {
  position: relative;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.2);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
  -webkit-tap-highlight-color: transparent;
}
.bottom-sheet-nav-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}
.bottom-sheet-nav-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}
.bottom-sheet-logo-wrap {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.16);
  overflow: hidden;
}
.bottom-sheet-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bottom-sheet-text {
  flex: 1;
  min-width: 0;
}
.bottom-sheet-headline {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.bottom-sheet-desc {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.3;
  margin-top: 2px;
  /* No clamp — show full description so longer copy reads cleanly. */
  overflow-wrap: anywhere;
}
.bottom-sheet-dots {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 6px;
}
/* The button is a 24px target (WCAG 2.5.8); the 6px dot is its ::after. */
.bottom-sheet-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}
.bottom-sheet-dot::after {
  content: "";
  box-sizing: border-box;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-soft); /* 5.5:1 on the cream sheet */
}
.bottom-sheet-dot.active::after {
  background: var(--ink);
  border-color: var(--ink);
  transform: scale(1.25);
}
.bottom-sheet-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bottom-sheet-btn {
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bottom-sheet-btn--claim {
  background: linear-gradient(
    180deg,
    var(--leaf-top) 0%,
    var(--leaf-green) 60%,
    var(--leaf-bot) 100%
  );
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    0 3px 0 var(--leaf-green-d);
}
.bottom-sheet-btn--claim:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    0 1px 0 var(--leaf-green-d);
}
.bottom-sheet-btn--save {
  background: linear-gradient(180deg, #fff 0%, var(--cream-shadow) 100%);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 2px 0 rgba(0, 0, 0, 0.2);
}
.bottom-sheet-btn--save:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 1px 0 rgba(0, 0, 0, 0.2);
}

/* ============================================================
   BONUS CARD — primary surface
   Game-native center modal. Bouncy scale-in from 0.
   Same celebration language as the Level Complete banner:
   cream "wooden sign" with red ribbon header + chunky green CTA.
============================================================ */
.bonus-card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 30;
  width: min(86%, 320px);
  /* Long copy scrolls inside the card instead of pushing Claim off the screen. */
  display: flex;
  flex-direction: column;
  max-height: calc(100% - 24px);
  padding: 0;
  background: linear-gradient(
    180deg,
    var(--cream) 0%,
    var(--cream-shadow) 100%
  );
  border: 2.5px solid var(--wood-mid);
  border-radius: 22px;
  box-shadow:
    inset 0 2px 0 rgba(255, 220, 100, 0.22),
    inset 0 -4px 0 rgba(80, 40, 10, 0.3),
    0 0 0 1px rgba(245, 200, 66, 0.12),
    0 10px 0 rgba(0, 0, 0, 0.42),
    0 24px 50px rgba(0, 0, 0, 0.58);
  font-family: "Nunito", sans-serif;
  /* Bouncy scale-in */
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.55s var(--spring),
    opacity 0.3s var(--ease);
}
.bonus-card.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.bonus-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--wood-deep);
  border: 2.5px solid var(--gold);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.45),
    0 0 8px var(--gold-glow);
}

/* Floating sparkles around the card to amplify celebration feel */
.bonus-sparkle {
  position: absolute;
  font-size: 22px;
  color: var(--gold);
  text-shadow:
    0 2px 8px var(--gold-glow),
    0 0 16px rgba(255, 200, 40, 0.4);
  pointer-events: none;
  animation: bonus-sparkle-float 2s ease-in-out infinite;
}
.bonus-sparkle--a {
  top: -10px;
  left: 8px;
  animation-delay: 0s;
}
.bonus-sparkle--b {
  top: 18px;
  right: -6px;
  font-size: 17px;
  animation-delay: 0.6s;
}
.bonus-sparkle--c {
  bottom: 14px;
  left: -8px;
  font-size: 12px;
  animation-delay: 1.2s;
}
@keyframes bonus-sparkle-float {
  0%,
  100% {
    transform: translateY(0) rotate(-6deg);
    opacity: 0.65;
  }
  50% {
    transform: translateY(-11px) rotate(13deg);
    opacity: 1;
  }
}

/* Red ribbon header — same vocabulary as the Level Complete banner */
/* ── Hero zone — streaming-app treatment ──────────────────────
   Blurred fill layer (same image, scaled + blurred) sits behind a
   sharp contained copy. Full banner always visible, no crop.
============================================================ */
.bonus-hero-zone {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  border-radius: 19px 19px 0 0; /* 22px card radius minus 3px border */
  background: #2a1a10;
  flex-shrink: 0;
}
.bonus-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.15);
  filter: blur(18px) saturate(1.2) brightness(0.85);
  pointer-events: none;
}
.bonus-hero-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.bonus-hero-img.loaded {
  opacity: 1;
}
.bonus-hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 45%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0%, rgba(0, 0, 0, 0) 35%);
  pointer-events: none;
  z-index: 2;
}
/* Gold banner strip across the top of the hero zone */
.bonus-hero-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 9px 14px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 3;
  /* a label, never a click target: the close button straddles its corner */
  pointer-events: none;
  /* deeper gradient so gold text pops */
  background: linear-gradient(
    180deg,
    rgba(50, 15, 0, 0.72) 0%,
    transparent 100%
  );
}
.bonus-hero-icon {
  font-size: 17px;
  line-height: 1;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.6));
}
.bonus-hero-label {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow:
    0 1px 4px rgba(0, 0, 0, 0.8),
    0 0 14px rgba(245, 200, 66, 0.45);
}
/* Carousel arrows */
.bonus-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s;
}
.bonus-nav-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}
/* The arrows sit level with the dots and straddle the card border, half on
   and half off, so the hero creative stays clear and the controls group with
   the pagination just above the CTA. The row is as tall as the dot buttons
   (24px); the 34px arrows overhang it, and the margins keep their 44px hit
   boxes off the copy above and the CTA below. */
.bonus-nav-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 24px;
  /* 16px body padding + 2.5px card border + half the 34px arrow */
  margin: 10px -35.5px;
}
.bonus-nav-row .bonus-dots {
  margin: 0;
}
.bonus-nav-edge {
  position: relative;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--wood-deep);
  border: 2px solid var(--gold);
  color: var(--gold);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.45),
    0 0 10px var(--gold-glow);
}
/* 44px hit box around the 34px disc (inset is from the padding box, so the
   2px border is added back) */
.bonus-nav-edge::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
}
.bonus-nav-edge:hover {
  background: var(--wood-mid);
}
.bonus-nav-edge:active {
  transform: scale(0.88);
}
/* The disc is half on the cream card and half on the dim game, so its ring is
   two-tone: white against the dark side, blue against the cream. */
.bonus-nav-edge:focus-visible {
  outline: 2px solid #233d71;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff;
}
/* A single offer has nothing to page to, so its arrows go entirely */
.bonus-nav-edge:disabled {
  visibility: hidden;
}
/* Carousel dots */
.bonus-dots {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 4px 0 10px;
}
/* The button is a 24px target (WCAG 2.5.8) carrying aria-current; the 8px
   dot is its ::after. Ring and solid in ink on the cream card, like the
   bottom sheet's. */
.bonus-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}
/* The scaled desktop bezel (--bezel-scale) draws everything smaller, so the
   dots get 30px boxes there: still 24px on screen in a 1280x720 window. In a
   shorter one the arrows beside them (44px boxes) remain the larger target. */
@media (min-width: 920px) and (not (pointer: coarse)) {
  .iphone-frame .bonus-dot,
  .iphone-frame .bottom-sheet-dot {
    width: 30px;
    height: 30px;
  }
}
.bonus-dot::after {
  content: "";
  box-sizing: border-box;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-soft); /* 5.5:1 on the cream card */
  transition:
    background 0.2s,
    transform 0.2s;
}
.bonus-dot.active::after {
  background: var(--ink);
  border-color: var(--ink);
  transform: scale(1.3);
}
/* Shimmer overlay — covers hero while loading. It only exists in the loading
   state, so nothing animates on a loaded, empty or closed card. */
.bonus-hero-shimmer {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none; /* never intercept clicks on arrows/dots */
  background: linear-gradient(
    90deg,
    rgba(42, 26, 16, 0) 25%,
    rgba(122, 92, 68, 0.35) 50%,
    rgba(42, 26, 16, 0) 75%
  );
  background-size: 200% 100%;
  animation: bonus-shimmer 1.6s infinite;
}
.bonus-card[data-state="loading"] .bonus-hero-shimmer {
  display: block;
}
@keyframes bonus-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}
/* Empty and error: the card is just the message. No hero, no Claim, no Save. */
.bonus-card:not([data-state="loading"]):not([data-state="ready"])
  .bonus-hero-zone,
.bonus-card:not([data-state="ready"]) .bonus-body {
  display: none;
}
.bonus-state {
  padding: 28px 20px 20px;
}

/* ── Brand name chip — sits above the offer text in the body ── */
.bonus-brand-name {
  font-family: "Nunito", sans-serif;
  font-size: 0.625rem;
  font-weight: 800;
  color: var(--gold-ink);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
  line-height: 1;
}
.bonus-brand-name:empty {
  display: none;
}
/* The same advertiser line on the sheet and the toast, left-aligned with their
   copy: the logo alone doesn't identify every brand. --gold-ink is 4.9:1 on the
   sheet's darkest stop and 6.3:1 on the toast's cream. */
.bottom-sheet-brand,
.toast-brand {
  font-family: "Nunito", sans-serif;
  font-size: 0.625rem;
  font-weight: 800;
  color: var(--gold-ink);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1.2;
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}
.bottom-sheet-brand:empty,
.toast-brand:empty {
  display: none;
}

.bonus-body {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 36px 16px 16px;
}
.bonus-body[hidden] {
  display: none;
}
/* Offers without an icon, or whose hero already falls back to it, keep the
   original top padding. */
.bonus-body:has(.bonus-icon-wrap[hidden]) {
  padding-top: 12px;
}
/* Advertiser icon: a reward-badge tile straddling the hero/body seam */
.bonus-icon-wrap {
  position: absolute;
  top: -29px;
  left: 50%;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 2.5px solid var(--gold);
  box-shadow: 0 4px 0 var(--wood-deep);
  z-index: 2;
}
.bonus-icon-wrap[hidden] {
  display: none;
}
.bonus-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bonus-icon[hidden] {
  display: none;
}

.bonus-offer {
  text-align: center;
  padding: 0 4px 8px;
  /* Long copy scrolls here; the arrows, Claim and Save below stay put. */
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.bonus-headline {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 4px;
  overflow-wrap: break-word;
}
.bonus-desc {
  font-size: 0.78125rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.35;
  overflow-wrap: break-word;
}

.bonus-btns {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bonus-btn {
  width: 100%;
  border: none;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    transform 0.12s,
    box-shadow 0.12s,
    opacity 0.1s;
}
.bonus-btn--claim {
  min-height: 44px;
  padding: 13px 16px;
  border-radius: 14px;
  font-size: 0.9375rem;
  background: linear-gradient(
    180deg,
    var(--leaf-top) 0%,
    var(--leaf-green) 60%,
    var(--leaf-bot) 100%
  );
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    inset 0 -3px 0 rgba(0, 0, 0, 0.25),
    0 5px 0 var(--leaf-green-d),
    0 6px 8px rgba(0, 0, 0, 0.3);
}
.bonus-btn--claim:active {
  transform: translateY(4px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    0 1px 0 var(--leaf-green-d);
}
/* Text-link style secondary — clear hierarchy, no competition with the CTA */
.bonus-btn--save {
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.8125rem;
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
}
.bonus-btn--save:active {
  opacity: 0.6;
}

/* Swipe surfaces: vertical scroll stays with the browser, a deliberate
   horizontal drag reaches script.js. No text selection or image ghost-drag. */
.bonus-hero-zone,
.bottom-sheet-nav-row {
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.bonus-hero-zone img,
.bottom-sheet-nav-row img {
  -webkit-user-drag: none;
}

/* ============================================================
   IN-PHONE BROWSER SHEET — Save for Later on the desktop bezel. Claim opens
   a new tab instead (see openLink in script.js). A modal dialog: [hidden]
   until opened, then it slides up over the whole screen.
============================================================ */
.webview {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #1a1a1a;
  transform: translateY(100%);
  transition: transform 0.45s var(--ease);
  pointer-events: none;
}
.webview[hidden] {
  display: none;
}
.webview.open {
  transform: translateY(0);
  pointer-events: auto;
}
.webview-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: max(52px, env(safe-area-inset-top)) 12px 10px;
  /* The top padding clears the Dynamic Island / punch-hole, which sit above
     the sheet (z-index 200). */
  background: #f2f2f7;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.webview-close,
.webview-open {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #6b6b6b; /* 3:1+ on the bar */
  background: #fff;
  color: #1a1a1a;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.webview-url {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  color: #444;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.webview-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}
.webview-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}
.webview-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 24px;
  text-align: center;
  background: #fff;
  color: #444;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
}
.webview-fallback[hidden] {
  display: none;
}
.webview-fallback p {
  margin: 0;
}
.webview-fallback-open {
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: #1a1a1a;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* Handoff: covers the frame once it leaves save-offer (see showHandoff). */
.webview-handoff {
  z-index: 1;
}
.webview-handoff:not([hidden]) {
  display: flex;
}
.webview-handoff-back {
  min-width: 44px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid #6b6b6b; /* 3:1+ on white */
  border-radius: 10px;
  background: #fff;
  color: #1a1a1a;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   ROTATE GUARD — a phone held sideways only. A desktop window that happens to
   be short (or a browser zoomed to 200%) is not a rotated phone, and must
   still reach the demo.
============================================================ */
.landscape-guard {
  position: fixed;
  inset: 0;
  background: #0d0d0d;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
  font-size: 0.875rem;
  padding: 16px;
}
.landscape-guard-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
/* script.js decides when it shows (a coarse pointer held sideways, not yet
   dismissed); the [hidden] rule at the top does the hiding. */
.landscape-guard-continue {
  min-height: 44px;
  padding: 10px 22px;
  border: 2px solid #fff;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* ============================================================
   MOBILE — narrow viewports
   On phone the bezel is hidden and the game fills the screen.
   Scale the bonus card down.
============================================================ */
@media (max-width: 479px) {
  .bonus-card {
    /* 22px side margin keeps the 17px arrow overhang on screen at any width */
    width: min(calc(100% - 44px), 340px);
  }
  .bonus-hero-zone {
    height: 160px;
  }
  .bonus-headline {
    font-size: 1rem;
  }
  .bonus-desc {
    font-size: 0.78125rem;
  }
  .bonus-btn {
    padding: 12px 14px;
    font-size: 0.875rem;
  }
}

/* ============================================================
   TOAST ALERT — Reward Reveal (Option C)
   Gopuff-style card: dismiss X at corner, large logo, eyebrow +
   2-line headline, full-width 3D CTA. Game palette throughout.
============================================================ */
.offer-toast {
  position: absolute;
  bottom: calc(36px + env(safe-area-inset-bottom));
  left: calc(12px + env(safe-area-inset-left));
  right: calc(12px + env(safe-area-inset-right));
  background: var(--cream);
  border-radius: 18px;
  box-shadow:
    0 -2px 24px rgba(0, 0, 0, 0.5),
    0 8px 24px rgba(0, 0, 0, 0.4);
  overflow: visible; /* dismiss X extends outside the card */
  display: flex;
  flex-direction: column;
  max-height: calc(100% - 60px - env(safe-area-inset-bottom));
  transform: translateY(120%);
  opacity: 0;
  /* A closed toast must not catch taps meant for the surface under it; with
     reduced motion it stays in place instead of sliding off-screen. */
  pointer-events: none;
  transition:
    transform 0.42s var(--spring),
    opacity 0.25s var(--ease);
  z-index: 30;
}
.offer-toast.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.offer-toast:not([data-state="ready"]) .toast-hero,
.offer-toast:not([data-state="ready"]) .toast-footer {
  display: none;
}
.toast-state {
  padding: 18px 40px 14px 16px;
  text-align: left;
}

/* Dismiss X — top-right corner, outside card boundary */
.toast-dismiss {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--wood-deep);
  border: 2px solid var(--cream-shadow);
  color: var(--cream);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.toast-dismiss::before {
  inset: -10px; /* 24px button + 10px each side = 44px */
}
.toast-dismiss:hover {
  background: var(--wood-mid);
}

/* Hero row: large logo + stacked text meta */
.toast-hero {
  display: flex;
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto; /* long copy scrolls here; the buttons below stay put */
  align-items: center;
  gap: 11px;
  padding: 14px 14px 11px;
  border-bottom: 1px solid rgba(61, 38, 21, 0.08);
}
.toast-logo-wrap {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.05);
}
.toast-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.toast-meta {
  flex: 1;
  min-width: 0;
}
.toast-eyebrow {
  font-size: 0.5625rem;
  font-weight: 800;
  color: var(--gold-ink);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 3px;
  line-height: 1;
}
.toast-headline {
  font-size: 0.8125rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 2px;
  overflow-wrap: anywhere;
}
.toast-desc {
  font-size: 0.6875rem;
  color: var(--ink-soft);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* Footer: full-width 3D game-style CTA + Save for Later */
.toast-footer {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast-claim {
  width: 100%;
  min-height: 44px;
  padding: 11px 16px;
  border: none;
  border-radius: 12px;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(
    180deg,
    var(--leaf-top) 0%,
    var(--leaf-green) 60%,
    var(--leaf-bot) 100%
  );
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.38),
    inset 0 -3px 0 rgba(0, 0, 0, 0.22),
    0 4px 0 var(--leaf-green-d),
    0 5px 8px rgba(0, 0, 0, 0.25);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.1s,
    box-shadow 0.1s;
}
.toast-claim:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.38),
    0 1px 0 var(--leaf-green-d);
}
.toast-save {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(180deg, #fff 0%, var(--cream-shadow) 100%);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 2px 0 rgba(0, 0, 0, 0.2);
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.1s,
    box-shadow 0.1s;
}
.toast-save:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 1px 0 rgba(0, 0, 0, 0.2);
}

/* ============================================================
   REDUCED MOTION
   Surfaces still appear and disappear (state stays visible and
   functional) but with a short opacity fade only: no springs,
   slides, scale-ins, looping shimmer or floating sparkles.
============================================================ */
@media (prefers-reduced-motion: reduce) {
  .game-img {
    transform: none;
    transition: opacity 0.2s var(--ease);
  }
  .game-img.intro-in {
    transform: none;
  }
  .bonus-card,
  .bonus-card.open {
    transform: translate(-50%, -50%);
    transition: opacity 0.15s var(--ease);
  }
  .offer-bottom-sheet,
  .offer-bottom-sheet.open {
    transform: none;
    transition: opacity 0.15s var(--ease);
  }
  .offer-toast,
  .offer-toast.open {
    transform: none;
    transition: opacity 0.15s var(--ease);
  }
  .webview {
    transform: none;
    opacity: 0;
    transition: opacity 0.15s var(--ease);
  }
  .webview.open {
    opacity: 1;
  }
  .bonus-hero-shimmer {
    animation: none;
    opacity: 0;
  }
  .bottom-sheet-shimmer,
  .bonus-sparkle {
    animation: none;
  }
  .bonus-dot,
  .format-picker-trigger-chevron {
    transition: none;
  }
}

/* ============================================================
   FORCED COLOURS — Windows High Contrast and similar. The browser swaps the
   palette for system colours and drops backgrounds and shadows, so anything
   that was only a coloured fill needs a border, and the pressed/active states
   need a system colour that still reads.
============================================================ */
@media (forced-colors: active) {
  .webview {
    background: Canvas;
    color: CanvasText;
  }
  .webview-bar {
    border-bottom: 1px solid CanvasText;
  }
  .webview-close,
  .webview-open,
  .webview-fallback-open,
  .webview-handoff-back {
    border: 1px solid ButtonText;
  }
  .webview-url {
    border: 1px solid CanvasText;
  }
  .format-pill,
  .format-picker-trigger,
  .bonus-btn,
  .bottom-sheet-btn,
  .toast-claim,
  .toast-save,
  .bonus-close,
  .bonus-nav-btn,
  .bottom-sheet-close,
  .bottom-sheet-nav-btn,
  .toast-dismiss {
    border: 1px solid ButtonText;
  }
  .format-pill[aria-pressed="true"] {
    /* system colours chosen by hand: left to the browser, the label gets a
       white text backplate and disappears on the Highlight fill */
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
    border-color: HighlightText;
  }
  .format-picker {
    background: Canvas;
    border: 1px solid CanvasText;
  }
  .bonus-card,
  .offer-bottom-sheet,
  .offer-toast {
    background: Canvas;
    color: CanvasText;
    border: 1px solid CanvasText;
  }
  .bonus-hero-zone {
    border-bottom: 1px solid CanvasText;
  }
  .bonus-sparkle {
    display: none; /* pure decoration: it would draw as a grey box */
  }
  .bonus-hero-header,
  .bonus-hero-label {
    color: CanvasText;
    background: Canvas;
    text-shadow: none;
  }
  .bonus-dot::after,
  .bottom-sheet-dot::after {
    border-color: ButtonText;
  }
  .bonus-dot.active::after,
  .bottom-sheet-dot.active::after {
    background: Highlight;
    border-color: Highlight;
    forced-color-adjust: none;
  }
  .bonus-icon-wrap {
    border: 2px solid CanvasText;
  }
  .landscape-guard-continue {
    border-color: ButtonText;
  }
}

/* ============================================================
   WORDS WITH FRIENDS SKIN
   Everything above is the portrait template (palette retuned in
   :root). This block re-applies the WWF demo's own look on the
   template surfaces: Poppins, white cards, the blue→teal board
   gradient, BONUS rack tiles, and four formats mapped like so:
     #modal  → the bonus card, arrows and dots over the hero,
               Claim and Save on a gradient band
     #sheet  → the bottom sheet, same band at its foot
     #icon   → Bonus Tile: the toast restyled as the tile's popover,
               plus the floating rack tile (#wwf-tile)
     #native → the bonus card laid inline in the results screen
               (N1 / N2 / N3), landing over the N2 score panel
   The CTA gradient is darker than the old #1489c9 / #14b8a0 stops
   so white text clears 4.5:1 on every stop (#0a4fc4 7.2, #0c6fa8
   5.5, #0a7a6c 5.2), and the grey labels moved from #8a93a6 (3.1:1)
   to #5f6b80 (5.4:1).
============================================================ */

/* Poppins, self-hosted (assets/fonts, OFL.txt). The old stylesheet pulled it
   from Google Fonts with an @import placed after a rule, which browsers drop,
   so the live page fell back to the system font. */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/poppins-500-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/poppins-600-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
  src: url("assets/fonts/poppins-700-latin.woff2") format("woff2");
}

:root {
  --wwf-cta-gradient: linear-gradient(
    135deg,
    #0a4fc4 0%,
    #0c6fa8 55%,
    #0a7a6c 100%
  );
  --wwf-cta-ink: #0a4fc4;
  --wwf-cta-shadow:
    0 0 0 3px rgba(10, 79, 196, 0.16), 0 10px 22px rgba(10, 79, 196, 0.32);
  --wwf-cta-shadow-sm:
    0 0 0 2px rgba(10, 79, 196, 0.16), 0 6px 14px rgba(10, 79, 196, 0.3);
  --wwf-ring: linear-gradient(135deg, #1489c9 0%, #d9932c 100%);
  --wwf-label: #5f6b80;
  --wwf-card-shadow:
    0 20px 60px rgba(15, 40, 80, 0.3), 0 4px 14px rgba(15, 40, 80, 0.14);
  /* Tile Rack accent: the BONUS chips and the Bonus Tile */
  --tile-bg: #f7edd8;
  --tile-edge: #d9c69a;
  --tile-accent: #d9932c;
  --tile-accent-ink: #9a5f12; /* 5.2:1 under white: the tile's count badge */
  --tile-ink: #3d2c14;
  /* Board scene (fallback art) */
  --wwf-cell: #0f7183;
  --wwf-cell-edge: rgba(255, 255, 255, 0.08);
  --wwf-tw: #e8552f;
  --wwf-dw: #f2a03d;
  --wwf-tl: #2f6fd8;
  --wwf-dl: #4fb0e8;
  --wwf-tile: #f6ead0;
  --wwf-letter: #17414f;
  /* Native: the results screen is the width of the phone screen, and the
     card lands where N2 starts (N1 is 444x469), but always leaves itself
     room for Claim and Save on a short screen. */
  --wwf-screen-w: 100vw;
  --wwf-native-top: max(
    64px,
    min(calc(var(--wwf-screen-w) * 469 / 444), calc(100% - 360px))
  );
  --wwf-hero-h: 152px;
}
@media (min-width: 920px) and (not (pointer: coarse)) {
  :root {
    --wwf-screen-w: 375px;
  }
}

/* ── Type: Poppins on everything in the demo except the board scene ── */
.demo-body,
.demo-main *:not(.wwf-scene, .wwf-scene *) {
  font-family:
    "Poppins",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}

/* WWF.PNG carries its own iOS status bar: no second one over it */
.ms-status-bar {
  display: none !important;
}

/* ── Picker ── */
.format-pill {
  font-weight: 600;
}
.format-pill.is-active {
  background: var(--wwf-cta-gradient);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 4px 12px rgba(13, 95, 224, 0.35);
}
.format-picker-header {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}
.format-picker-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}
.format-picker-badge {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  font-weight: 700;
}
.format-picker-subtitle {
  color: rgba(234, 250, 255, 0.72);
}

/* ── BONUS rack tiles (decorative, aria-hidden) ── */
.tile-chip-row {
  display: flex;
  justify-content: center;
  gap: 3px;
}
.tile-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--tile-bg);
  border: 1px solid var(--tile-edge);
  box-shadow: 0 1px 2px rgba(61, 44, 20, 0.28);
  font-weight: 700;
  font-size: 11px;
  color: var(--tile-ink);
  line-height: 1;
}
.tile-chip sub {
  position: absolute;
  right: 2px;
  bottom: 1px;
  font-size: 6px;
  font-weight: 800;
  color: var(--tile-accent);
  line-height: 1;
}

/* ── Game art: the WWF board capture; the CSS board scene only if it fails ── */
.wwf-scene {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
}
.wwf-art-failed .wwf-scene {
  display: flex;
}
.wwf-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 58px 18px 8px;
  color: #eafaff;
  flex-shrink: 0;
}
.wwf-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.wwf-avatar--me {
  background: linear-gradient(180deg, #5ec26a 0%, #3f9e4d 100%);
}
.wwf-avatar--them {
  background: linear-gradient(180deg, #f2a03d 0%, #e07d2a 100%);
}
.wwf-turn {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: #f5c842;
  color: #4a3500;
  font-family: "Nunito", sans-serif;
  font-style: normal;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}
.wwf-score {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}
.wwf-score-me,
.wwf-score-them {
  font-size: 27px;
}
.wwf-score-them {
  opacity: 0.62;
}
.wwf-score-sep {
  font-size: 20px;
  opacity: 0.45;
}
.wwf-board {
  width: min(92%, 400px);
  aspect-ratio: 1 / 1;
  margin: 10px auto 0;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  grid-template-rows: repeat(11, 1fr);
  gap: 3px;
  background: rgba(4, 40, 48, 0.35);
  border-radius: 10px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}
.wwf-cell {
  border-radius: 4px;
  background: var(--wwf-cell);
  display: grid;
  place-items: center;
  font-family: "Nunito", sans-serif;
  font-size: 6.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px var(--wwf-cell-edge);
}
.wwf-cell.is-tw {
  background: var(--wwf-tw);
  color: #fff;
}
.wwf-cell.is-dw,
.wwf-cell.is-center {
  background: var(--wwf-dw);
  color: #5a3200;
}
.wwf-cell.is-tl {
  background: var(--wwf-tl);
  color: #fff;
}
.wwf-cell.is-dl {
  background: var(--wwf-dl);
  color: #0a3550;
}
.wwf-cell.is-center::after {
  content: "★";
  font-size: 10px;
}
.wwf-placed,
.wwf-tile {
  position: relative;
  display: grid;
  place-items: center;
  background: linear-gradient(
    180deg,
    #fbf3dd 0%,
    var(--wwf-tile) 70%,
    #ecdcae 100%
  );
}
.wwf-placed {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.wwf-placed span,
.wwf-tile span {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  color: var(--wwf-letter);
  line-height: 1;
}
.wwf-placed span {
  font-size: clamp(9px, 2.5vw, 15px);
}
.wwf-placed::after,
.wwf-tile::after {
  content: attr(data-pts);
  position: absolute;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  color: var(--wwf-letter);
  opacity: 0.8;
}
.wwf-placed::after {
  right: 2px;
  bottom: 1px;
  font-size: 6px;
}
.wwf-rack {
  margin: auto auto max(16px, env(safe-area-inset-bottom));
  padding: 8px 10px;
  width: min(92%, 400px);
  display: flex;
  justify-content: center;
  gap: 5px;
  background: linear-gradient(180deg, #0e6475 0%, #08414f 100%);
  border-radius: 14px;
  box-shadow:
    inset 0 2px 7px rgba(0, 0, 0, 0.35),
    0 5px 14px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}
.wwf-tile {
  flex: 1;
  max-width: 46px;
  aspect-ratio: 1 / 1;
  border-radius: 7px;
  box-shadow:
    0 2px 3px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.wwf-tile span {
  font-size: clamp(15px, 5vw, 22px);
}
.wwf-tile::after {
  right: 3px;
  bottom: 2px;
  font-size: 9px;
}

.game-overlay {
  background: rgba(5, 26, 33, 0.42);
}

/* ── Native: the results screen (N1, N2, N3), crossfaded in over the board ── */
.wwf-native-art {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.35s var(--ease),
    visibility 0s linear 0.35s;
}
#screen-game.wwf-native .wwf-native-art {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s var(--ease);
}
.wwf-native-art img {
  display: block;
  width: 100%;
  height: auto;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-drag: none;
}
#screen-game.wwf-native .game-overlay {
  display: none;
}

/* ── Bonus card: shared look ── */
.bonus-card {
  background: #fff;
  border: 0;
  box-shadow: var(--wwf-card-shadow);
}
.bonus-sparkle,
.bonus-hero-icon {
  display: none;
}
.bonus-close {
  background: #fff;
  border: 0;
  color: var(--ink-soft);
  box-shadow: 0 4px 12px rgba(15, 40, 80, 0.28);
}
.bonus-close:focus-visible {
  outline-color: #233d71;
}
.wwf-title-native {
  display: none;
}
.bonus-brand-name {
  font-weight: 700;
  color: var(--wwf-label);
}
.bonus-headline {
  font-size: 1.0625rem;
  font-weight: 700;
}
.bonus-desc {
  font-size: 0.78125rem;
  font-weight: 500;
}
/* Arrows: white discs with a blue chevron (the old overlay arrows) */
.bonus-nav-edge {
  background: rgba(255, 255, 255, 0.94);
  border: 0;
  color: var(--wwf-cta-ink);
  box-shadow: 0 4px 12px rgba(15, 40, 80, 0.3);
}
.bonus-nav-edge:hover {
  background: #fff;
}
.bonus-icon-wrap,
.bottom-sheet-logo-wrap,
.toast-logo-wrap {
  border: 2px solid transparent;
  background-image: linear-gradient(#fff, #fff), var(--wwf-ring);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

/* ── #modal: hero on top, carousel row beside the CTA band at the foot ── */
.bonus-card:not(.wwf-native-card) .bonus-hero-zone {
  height: var(--wwf-hero-h);
  border-radius: 22px 22px 0 0;
  background: #0b1d33;
}
.bonus-hero-header {
  background: none;
}
/* The heading stays (focus lands on it) but the BONUS tiles say it visually */
.bonus-card:not(.wwf-native-card) .bonus-hero-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* The carousel row keeps the template's place: arrows on the card edges, level
   with the dots, directly above the CTA band, so paging and claiming sit
   together. The dots use the template's ink rings; the focus ring goes navy
   because the template's white ring vanishes on this card's white body. */
.bonus-card:not(.wwf-native-card) .bonus-dot:focus-visible {
  outline-color: #233d71;
}
/* The advertiser badge sits on the seam at the left, clear of the dots */
.bonus-card:not(.wwf-native-card) .bonus-icon-wrap {
  top: -24px;
  left: 16px;
  width: 48px;
  height: 48px;
  margin-left: 0;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(15, 40, 80, 0.25);
}
.bonus-card:not(.wwf-native-card) .bonus-body {
  padding-top: 14px;
}
.bonus-card .tile-chip-row {
  margin-bottom: 8px;
}
.bonus-card:not(.wwf-native-card) .bonus-btns {
  gap: 8px;
  padding: 14px 16px;
  margin: 8px -16px -16px;
  background: var(--wwf-cta-gradient);
  border-radius: 0 0 22px 22px;
}
.bonus-card:not(.wwf-native-card) .bonus-btn--claim,
.bottom-sheet-btn--claim {
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--wwf-cta-ink);
  text-shadow: none;
  font-weight: 700;
  box-shadow: var(--wwf-cta-shadow);
}
.bonus-card:not(.wwf-native-card) .bonus-btn--claim:active,
.bottom-sheet-btn--claim:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: var(--wwf-cta-shadow-sm);
}
.bonus-btn--claim::before,
.bottom-sheet-btn--claim::before,
.toast-claim::before {
  content: "\1F451"; /* crown, the WWF win-streak motif */
  margin-right: 6px;
  font-size: 12px;
}
.bonus-card:not(.wwf-native-card) .bonus-btn--save {
  color: #fff;
  font-weight: 600;
}
.bonus-btns :focus-visible,
.bottom-sheet-btns :focus-visible {
  outline-color: #fff;
}

/* ── #native: the card laid inline over N2 ── */
.bonus-card.wwf-native-card {
  left: 0;
  right: 0;
  top: var(--wwf-native-top);
  width: auto;
  max-height: calc(100% - var(--wwf-native-top));
  padding: 14px 0 10px;
  border-radius: 0;
  box-shadow: none;
  transform: translateY(10px);
}
.bonus-card.wwf-native-card.open {
  transform: none;
}
/* Until the offers arrive the static N2 panel is what shows: the card is
   there (it carries the loading state) but transparent, then fades in. */
.bonus-card.wwf-native-card[data-state="loading"] {
  opacity: 0;
}
.wwf-native-card .bonus-close,
.wwf-native-card .tile-chip-row,
.wwf-native-card .bonus-hero-bg,
.wwf-native-card .bonus-hero-img,
.wwf-native-card .bonus-hero-scrim,
.wwf-native-card .bonus-hero-shimmer {
  display: none;
}
.wwf-native-card .bonus-hero-zone {
  height: auto;
  overflow: visible;
  border-radius: 0;
  background: none;
  touch-action: auto;
}
.wwf-native-card .bonus-hero-header {
  position: static;
  padding: 0 18px 10px;
}
.wwf-native-card .bonus-hero-label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: var(--ink-soft);
  text-shadow: none;
}
.wwf-native-card .wwf-title-modal {
  display: none;
}
.wwf-native-card .wwf-title-native {
  display: inline;
}
.wwf-native-card .bonus-body {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  column-gap: 10px;
  margin: 2px 9% 0;
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(11, 29, 51, 0.28);
  touch-action: pan-y;
}
.wwf-native-card .bonus-body:has(.bonus-icon-wrap[hidden]) {
  grid-template-columns: minmax(0, 1fr);
  padding-top: 14px;
}
.wwf-native-card .bonus-icon-wrap {
  position: static;
  grid-row: 1 / 3;
  align-self: center;
  width: 40px;
  height: 40px;
  margin: 0;
  border-radius: 12px;
  box-shadow: 0 3px 8px rgba(11, 90, 104, 0.18);
}
.wwf-native-card .bonus-brand-name,
.wwf-native-card .bonus-offer {
  text-align: left;
}
.wwf-native-card .bonus-brand-name {
  margin-bottom: 3px;
}
.wwf-native-card .bonus-offer {
  padding: 0;
  align-self: center;
}
.wwf-native-card .bonus-headline {
  font-size: 0.8125rem;
  margin-bottom: 2px;
}
.wwf-native-card .bonus-desc {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.wwf-native-card .bonus-nav-row,
.wwf-native-card .bonus-btns {
  grid-column: 1 / -1;
}
.wwf-native-card .bonus-nav-row {
  margin: 8px 0 6px;
  height: 30px;
}
.wwf-native-card .bonus-nav-edge {
  width: 30px;
  height: 30px;
  background: #f3f5f9;
  box-shadow: 0 2px 6px rgba(15, 40, 80, 0.12);
}
.wwf-native-card .bonus-nav-edge::before {
  inset: -7px;
}
/* The template rings dots in white (they sit on the cream card's dark edge
   there); on Native's white card the ring is the default navy. */
.wwf-native-card .bonus-dot:focus-visible {
  outline-color: #233d71;
}
.wwf-native-card .bonus-dot.active::after {
  background: var(--wwf-cta-ink);
  border-color: var(--wwf-cta-ink);
}
.wwf-native-card .bonus-btns {
  gap: 2px;
}
.wwf-native-card .bonus-btn--claim,
.toast-claim {
  border: 0;
  border-radius: 999px;
  background: var(--wwf-cta-gradient);
  color: #fff;
  text-shadow: none;
  font-size: 0.8125rem;
  font-weight: 700;
  box-shadow: var(--wwf-cta-shadow-sm);
}
.wwf-native-card .bonus-btn--claim:active,
.toast-claim:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: var(--wwf-cta-shadow-sm);
}
.wwf-native-card .bonus-btn--claim::before {
  content: none;
}
.wwf-native-card .bonus-btn--save,
.toast-save {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
}
.wwf-native-card .bonus-state {
  margin: 0 9%;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(11, 29, 51, 0.28);
}

/* ── #sheet ── */
.offer-bottom-sheet {
  background: #fff;
  border-top: 0;
  box-shadow:
    0 -8px 30px rgba(15, 40, 80, 0.18),
    0 -1px 0 rgba(15, 40, 80, 0.06);
}
.bottom-sheet-close {
  background: rgba(0, 0, 0, 0.08);
}
.bottom-sheet-eyebrow {
  font-weight: 700;
  color: var(--wwf-label);
}
.bottom-sheet-eyebrow::before {
  content: "\1F451";
  margin-right: 4px;
  font-size: 10px;
}
.offer-bottom-sheet .tile-chip-row {
  margin: 0 0 10px;
  flex-shrink: 0;
}
.bottom-sheet-nav-btn {
  border: 0;
  background: #f3f5f9;
  box-shadow: 0 2px 6px rgba(15, 40, 80, 0.12);
}
.bottom-sheet-logo-wrap {
  border-radius: 14px;
}
.bottom-sheet-headline {
  font-weight: 700;
}
.bottom-sheet-brand,
.toast-brand {
  font-weight: 700;
  color: var(--wwf-label);
}
.bottom-sheet-dot.active::after {
  background: var(--wwf-cta-ink);
  border-color: var(--wwf-cta-ink);
}
.bottom-sheet-btns {
  margin: 0 calc(-18px - env(safe-area-inset-right))
    calc(-22px - env(safe-area-inset-bottom))
    calc(-18px - env(safe-area-inset-left));
  padding: 14px calc(10px + env(safe-area-inset-right))
    calc(14px + env(safe-area-inset-bottom))
    calc(10px + env(safe-area-inset-left));
  background: var(--wwf-cta-gradient);
}
.bottom-sheet-btn {
  border-radius: 999px;
}
.bottom-sheet-btn--save {
  border: 0;
  background: transparent;
  color: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.65);
}
.bottom-sheet-btn--save:active {
  transform: none;
  opacity: 0.75;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.65);
}

/* ── #icon: the toast is the Bonus Tile's popover ── */
.offer-toast {
  left: auto;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(80px + env(safe-area-inset-bottom));
  width: min(72%, 248px);
  max-height: calc(100% - 100px - env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(11, 29, 51, 0.28);
  transform: translateY(12px) scale(0.9);
  transform-origin: bottom right;
}
.offer-toast.open {
  transform: none;
}
.toast-dismiss {
  width: 22px;
  height: 22px;
  background: var(--wwf-cta-gradient);
  border: 2px solid #fff;
  color: #fff;
  box-shadow: 0 4px 10px rgba(11, 90, 104, 0.35);
}
.toast-dismiss::before {
  inset: -11px;
}
.toast-dismiss:hover {
  background: var(--wwf-cta-gradient);
}
.toast-hero {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 10px;
  align-items: start;
  align-content: start;
  padding: 14px 14px 10px;
  border-bottom: 0;
}
.toast-meta {
  display: contents;
}
.toast-eyebrow.tile-chip-row {
  grid-column: 1 / -1;
  justify-content: flex-start;
  margin: 0 0 8px;
  line-height: 1;
}
.toast-logo-wrap {
  grid-column: 1;
  grid-row: 2 / span 3;
  align-self: center;
  width: 40px;
  height: 40px;
  box-shadow: 0 3px 8px rgba(11, 90, 104, 0.18);
}
.toast-logo {
  object-fit: cover;
}
.toast-brand,
.toast-headline,
.toast-desc {
  grid-column: 2;
}
.toast-headline {
  font-weight: 700;
}
.toast-desc {
  font-weight: 600;
}
.toast-footer {
  padding: 0 14px 14px;
  gap: 6px;
}
.toast-claim > span[aria-hidden] {
  display: none;
}
.toast-claim::before {
  margin-right: 5px;
  font-size: 11px;
}
.toast-save:active {
  transform: none;
  opacity: 0.6;
}

/* The tile itself: an oversized rack tile, bottom right, clear of the
   board's panels. It pulses gently while it holds a reward. */
.wwf-bonus-tile {
  position: absolute;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 31;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 12px;
  background: var(--tile-bg);
  border: 2px solid var(--tile-edge);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    0 6px 20px rgba(61, 44, 20, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  animation:
    wwf-tile-in 0.5s var(--spring) both,
    wwf-tile-pulse 2.2s ease-in-out 0.5s infinite;
}
.wwf-bonus-tile:active {
  transform: translateY(2px);
}
.wwf-bonus-tile[aria-expanded="true"] {
  animation: wwf-tile-in 0.5s var(--spring) both;
}
.wwf-tile-glyph {
  font-size: 24px;
  line-height: 1;
  color: var(--tile-ink);
}
.wwf-tile-pts {
  position: absolute;
  bottom: 5px;
  right: 7px;
  font-size: 9px;
  font-weight: 700;
  color: var(--tile-ink);
  line-height: 1;
}
.wwf-tile-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--tile-accent-ink);
  border: 2px solid #fff;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(217, 147, 44, 0.4);
}
@keyframes wwf-tile-in {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes wwf-tile-pulse {
  0%,
  100% {
    transform: scale(1) rotate(0);
  }
  45% {
    transform: scale(1.06) rotate(-3deg);
  }
  55% {
    transform: scale(1.06) rotate(3deg);
  }
}

/* ── States ── */
.ms-state-title {
  font-weight: 700;
}

/* ── Narrow phones ── */
@media (max-width: 479px) {
  :root {
    --wwf-hero-h: 160px;
  }
  .bonus-headline {
    font-size: 1rem;
  }
  .wwf-bonus-tile {
    right: max(10px, env(safe-area-inset-right));
    width: 48px;
    height: 48px;
  }
  .wwf-tile-glyph {
    font-size: 22px;
  }
  .offer-toast {
    right: max(10px, env(safe-area-inset-right));
    width: min(78vw, 280px);
  }
}

/* ── Reduced motion: the skin's own movement ── */
@media (prefers-reduced-motion: reduce) {
  .bonus-card.wwf-native-card,
  .bonus-card.wwf-native-card.open {
    transform: none;
    transition: opacity 0.15s var(--ease);
  }
  .wwf-bonus-tile,
  .wwf-bonus-tile[aria-expanded="true"] {
    animation: none;
  }
  .wwf-native-art,
  #screen-game.wwf-native .wwf-native-art {
    transition: none;
  }
}

/* ── Forced colours: the skin's fills become borders ── */
@media (forced-colors: active) {
  /* The skin sets border: 0 on these, some through specific selectors;
     the id outranks them so the template's borders come back */
  #screen-game .bonus-btn,
  #screen-game .bottom-sheet-btn,
  #screen-game .toast-claim,
  #screen-game .toast-save,
  #screen-game .bonus-close,
  #screen-game .bonus-nav-btn,
  #screen-game .bottom-sheet-nav-btn,
  #screen-game .toast-dismiss {
    border: 1px solid ButtonText;
  }
  .wwf-bonus-tile {
    border: 1px solid ButtonText;
  }
  .tile-chip {
    border: 1px solid CanvasText;
  }
  .bonus-btns,
  .bottom-sheet-btns {
    background: Canvas;
  }
  .wwf-native-card .bonus-body {
    border: 1px solid CanvasText;
  }
  .bonus-icon-wrap,
  .bottom-sheet-logo-wrap,
  .toast-logo-wrap {
    border: 2px solid CanvasText;
  }
}
