/* Earnly shared design tokens + components.
   Loaded after the base inline <style>, so its token overrides win. */

:root {
  /* derived brand tints (base.html owns --accent / --bg / --text / --border) */
  --accent-strong: #1557b0;
  --accent-soft: #60a5fa;
  --on-accent: #ffffff;

  /* the single strong conversion action (app-store hand-off) */
  --cta-from: #047857;
  --cta-mid: #059669;
  --cta-to: #22c55e;
  --on-cta: #ffffff;

  /* reward + state colours */
  --reward-bg: #ffe29b;
  --reward-fg: #7a4d00;
  --reward-border: #f2c14e;
  --success: #059669;
  --warning: #f59e0b;
  --danger: #b91c1c;

  /* gaming offers get their own signal colour */
  --game: #7c3aed;
  --game-solid: #6d28d9;

  --surface-2: #f4f5f7;

  /* shape */
  --radius-card: 12px;
  --radius-control: 10px;
  --radius-modal: 20px;
  --radius-pill: 999px;

  /* elevation */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .05), 0 2px 8px rgba(0, 0, 0, .06);
  --shadow-cta: 0 10px 26px rgba(26, 115, 232, .35);
  --modal-ring: rgba(26, 115, 232, .24);
  --modal-glow: rgba(26, 115, 232, .30);

  /* type scale */
  --fs-xs: .82rem;
  --fs-sm: .9rem;
  --fs-md: .95rem;
  --fs-lg: 1.2rem;
}

[data-theme="dark"] {
  --accent-strong: #aecbfa;
  --accent-soft: #6f9bf0;
  --on-accent: #0b1220;
  --reward-bg: #4a3a10;
  --reward-fg: #ffd97a;
  --reward-border: #7a5f1a;
  --surface-2: #232323;
  --game: #a78bfa;
  --game-solid: #6d28d9;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-cta: 0 10px 26px rgba(0, 0, 0, .5);
  --modal-ring: rgba(138, 180, 248, .30);
  --modal-glow: rgba(138, 180, 248, .24);
}

[data-theme="game"] {
  --accent-strong: #a78bfa;
  --accent-soft: #9d7bff;
  --on-accent: #ffffff;
  --reward-bg: #2a2010;
  --reward-fg: #ffd97a;
  --reward-border: #5a4510;
  --surface-2: #1a1028;
  --game: #a78bfa;
  --game-solid: #7c5cff;
  --success: #39ff14;
  --warning: #ffcc00;
  --danger: #ff3b5c;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(124, 92, 255, .15);
  --shadow-cta: 0 10px 26px rgba(124, 92, 255, .45);
  --modal-ring: rgba(124, 92, 255, .35);
  --modal-glow: rgba(0, 229, 255, .25);
  --surface: #150d24;
}

/* ---------------------------------------------------------------- points */

.points-banner {
  display: flex;
  gap: 2rem;
  align-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: var(--on-accent);
  border-radius: var(--radius-card);
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.5rem;
}
.points-banner__label { font-size: .85rem; opacity: .85; }
.points-banner__amount { display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; }
.points-banner__value { font-size: 2.5rem; font-weight: 700; line-height: 1.1; }
.points-banner__cash { font-size: 1rem; font-weight: 600; opacity: .85; }
.points-banner__note { color: var(--on-accent); opacity: .9; font-size: var(--fs-sm); }

/* ---------------------------------------------------------------- pills */

.reward-pill {
  display: inline-block;
  background: var(--reward-bg);
  color: var(--reward-fg);
  border: 1px solid var(--reward-border);
  font-weight: 800;
  padding: .22rem .65rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.offer-chip {
  align-self: flex-start;
  margin-top: .35rem;
  padding: .15rem .5rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- gaming offers */

.game-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  align-self: flex-start;
  padding: .18rem .55rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--game);
  color: var(--game);
  background: transparent;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.game-chip svg { flex: none; }
.game-chip--inline {
  padding: 0 .25rem;
  height: 1.25rem;
  align-self: auto;
  gap: 0;
  border: none;
  background: transparent;
  color: inherit;
  font-size: inherit;
  letter-spacing: normal;
  text-transform: none;
}
.game-chip--overlay {
  position: absolute;
  top: .6rem;
  left: .6rem;
  z-index: 2;
  background: var(--game-solid);
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.game-chip--inverse {
  background: rgba(11, 18, 32, .22);
  border-color: currentColor;
  color: var(--on-accent);
}

/* ---------------------------------------------------------------- slider */

.slide { display: none; }
.slide.active { display: block; }

/* ---------------------------------------------------------------- steps */

.step-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex: none;
  font-weight: 800;
  font-size: .85rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 2px 6px rgba(26, 115, 232, .35);
}
.step-dot.done {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 2px 6px rgba(245, 158, 11, .35);
}
.step-row-done {
  color: var(--warning);
  background: rgba(245, 158, 11, .08);
}

/* ---------------------------------------------------------------- detail CTA band */

.cta-band {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .06);
  padding: .8rem 1rem max(.8rem, env(safe-area-inset-bottom));
  transform: translateZ(0);
}
.cta-band__inner { max-width: 560px; margin: 0 auto; }
.cta-band__note {
  text-align: center;
  font-size: .72rem;
  color: var(--muted);
  margin-top: .35rem;
}
.cta-band .cta-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-size: var(--fs-lg);
  font-weight: 700;
  padding: .95rem 1.5rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-cta);
}
.cta-main { transition: filter .15s ease, box-shadow .15s ease; }
.cta-main:hover { filter: brightness(1.1); }
.cta-main:active { filter: brightness(.95); }
.cta-main__store {
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
  padding: .22rem .6rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .92);
  color: #111;
}

/* ---------------------------------------------------------------- install modal */

.install-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.install-modal-card {
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  color: var(--text);
  border: 2px solid transparent;
  border-radius: var(--radius-modal);
  /* brand gradient edge so the sheet never melts into the page */
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    linear-gradient(140deg, var(--accent), var(--accent-soft) 55%, var(--accent-strong)) border-box;
  box-shadow:
    0 0 0 1px var(--modal-ring),
    0 0 34px var(--modal-glow),
    0 30px 70px rgba(0, 0, 0, .45);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  outline: none;
  animation: install-modal-pop .28s ease-out;
}
.install-modal-header {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--on-accent);
  padding: 1.4rem 1.5rem 1.1rem;
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, .16);
  flex: 0 0 auto;
}
.install-modal-header h2 { margin: .3rem 0 0; font-size: 1.45rem; line-height: 1.2; }
.install-modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem .75rem;
  flex-wrap: wrap;
  /* keep the row clear of the absolute close button */
  padding-right: 2.75rem;
}
.install-modal-close {
  position: absolute;
  top: .7rem;
  right: .7rem;
  z-index: 2;
  background: rgba(11, 18, 32, .16);
  border: 1px solid currentColor;
  color: var(--on-accent);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.install-modal-body {
  padding: 1.2rem 1.5rem;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.install-modal-art {
  margin: 0 0 .6rem;
  width: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.install-modal-art img {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: cover;
}
.install-modal-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.install-modal-step { display: flex; gap: .8rem; align-items: flex-start; }
.install-modal-step__num {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  margin-top: .1rem;
}
.install-modal-step__text { flex: 1; }
.install-modal-step__title { font-weight: 600; font-size: .98rem; }
.install-modal-step__body { color: var(--muted); font-size: .88rem; }
.install-modal-step__pts {
  white-space: nowrap;
  font-weight: 800;
  font-size: var(--fs-sm);
  margin-top: .1rem;
  color: var(--success);
}
.install-modal-step__pts.is-zero {
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-soft);
  padding: .1rem .5rem;
  border-radius: var(--radius-pill);
}
.install-modal-actions { padding: 0 1.5rem 1.4rem; flex: 0 0 auto; }
.install-modal-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.18rem;
  color: var(--on-cta);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  background: linear-gradient(135deg, var(--cta-from), var(--cta-mid) 45%, var(--cta-to));
  padding: 1.05rem 1.25rem 1.05rem 1.5rem;
  border-radius: var(--radius-pill);
  border: 2px solid rgba(255, 255, 255, .7);
  box-shadow: 0 18px 38px rgba(5, 150, 105, .45), 0 0 0 7px rgba(34, 197, 94, .16);
}
.install-modal-cta:hover { filter: brightness(1.08); }
.install-modal-cta:active { filter: brightness(.96); }
.install-modal-cta__arrow { font-size: 1.4rem; line-height: 1; }
.install-modal-cta__label { flex: 1; text-align: left; }
.install-modal-cta__store {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
  padding: .3rem .7rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .92);
  color: #111;
  text-shadow: none;
}
.install-modal-footer {
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
  margin-top: .7rem;
}

/* the one motion accent on a page: the modal's conversion button */
.install-modal-cta-pulse {
  animation: install-modal-cta-pulse 1.4s ease-in-out infinite;
  will-change: transform, box-shadow;
}

@keyframes install-modal-pop {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes install-modal-cta-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 18px 38px rgba(5, 150, 105, .45), 0 0 0 7px rgba(34, 197, 94, .16);
  }
  50% {
    transform: scale(1.045);
    box-shadow: 0 24px 52px rgba(5, 150, 105, .7), 0 0 0 13px rgba(34, 197, 94, .24);
  }
}

/* ---------------------------------------------------------------- card image shine */

.card-image-shine {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-130%);
  background: linear-gradient(
    115deg,
    transparent 32%,
    rgba(255, 255, 255, .48) 50%,
    transparent 68%
  );
  animation: card-image-shine 7s ease-in-out infinite;
  animation-delay: var(--shine-delay, 0s);
}

[data-activity-card]:nth-child(2n) .card-image-shine { --shine-delay: 2.3s; }
[data-activity-card]:nth-child(3n) .card-image-shine { --shine-delay: 4.6s; }

@keyframes card-image-shine {
  0%   { opacity: 0; transform: translateX(-130%); }
  3%   { opacity: 0; }
  7%   { opacity: .9; }
  18%  { opacity: 0; transform: translateX(130%); }
  100% { opacity: 0; transform: translateX(130%); }
}

/* ---------------------------------------------------------------- motion budget */

@media (prefers-reduced-motion: reduce) {
  .install-modal-card,
  .install-modal-cta-pulse,
  .card-image-shine {
    animation: none !important;
  }
}

.install-modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.install-modal-title-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
