/* Trailmates — rewards UI (badges, ranks, our rewards, cheers, daily inspiration, weekly recap).
   Follows app.css: dark frosted glass on the Trail sheet, --p-* page tokens (light/dark) on Passport,
   44px targets, safe areas, reduced motion. Everything is namespaced .rw / .rw-* / .medal. */

/* ---------------------------------------------------------------- context tokens */
.rw {
  --rw-text: var(--text);
  --rw-muted: var(--muted);
  --rw-track: rgba(255, 255, 255, 0.14);
  --rw-surface: rgba(255, 255, 255, 0.065);
  --rw-surface-strong: rgba(255, 255, 255, 0.1);
  --rw-hair: rgba(255, 255, 255, 0.1);
  --rw-gold-text: var(--gold);
  --rw-accent: var(--gold);
  --rw-accent-ink: #2a1f05;
  --rw-accent-soft: rgba(245, 196, 81, 0.18);
  --rw-card: rgba(255, 255, 255, 0.07);
}
.page .rw, .theme-page .rw, .rw.theme-page {
  --rw-text: var(--p-text);
  --rw-muted: var(--p-muted);
  --rw-track: rgba(120, 120, 128, 0.16);
  --rw-surface: rgba(120, 120, 128, 0.08);
  --rw-surface-strong: rgba(120, 120, 128, 0.12);
  --rw-hair: var(--p-sep);
  --rw-gold-text: #8f600c;
  --rw-accent: var(--p-accent);
  --rw-accent-ink: #fff;
  --rw-accent-soft: var(--p-accent-soft);
  --rw-card: var(--p-card);
}
@media (prefers-color-scheme: dark) {
  .page .rw, .theme-page .rw, .rw.theme-page {
    --rw-track: rgba(255, 255, 255, 0.12);
    --rw-surface: rgba(255, 255, 255, 0.06);
    --rw-surface-strong: rgba(255, 255, 255, 0.09);
    --rw-gold-text: var(--gold);
    --rw-accent-ink: #06281c;
  }
}

.rw-subhead { margin: 20px 4px 10px; font: 700 12.5px/1.2 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--rw-muted); }
.rw-skel {
  height: 168px;
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(127,127,127,.08), rgba(127,127,127,.16), rgba(127,127,127,.08)) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.rw-bar { display: block; height: 8px; margin-top: 10px; border-radius: 4px; background: var(--rw-track); overflow: hidden; }
.rw-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--rw-accent); transition: width 1s var(--ease-out); }
.rw-bar--gold > span { background: linear-gradient(90deg, #f0b53a, #ffdf86); }
.rw-bar--sm { height: 6px; margin-top: 8px; }
.rw-bar--lg { height: 10px; border-radius: 5px; }
.rw-chip {
  position: relative;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 19px;
  background: var(--rw-surface-strong);
  color: var(--rw-text);
  font: 600 14px/1.15 var(--font);
  text-align: center;
  transition: background 0.2s, color 0.2s, transform 0.12s, box-shadow 0.2s;
}
.rw-chip::before { content: ""; position: absolute; inset: -3px 0; }
.rw-chip:active:not(:disabled) { transform: scale(0.96); }
.rw-chip.is-on, .rw-chip[aria-checked="true"] { background: var(--rw-accent); color: var(--rw-accent-ink); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14); }
.rw-chip:disabled { opacity: 0.38; cursor: default; }

/* ---------------------------------------------------------------- medallion */
.medal {
  --size: 72px;
  position: relative;
  flex: none;
  width: var(--size);
  height: calc(var(--size) * 1.1333);
}
.medal svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 calc(var(--size) * 0.035) calc(var(--size) * 0.05) rgba(50, 30, 5, 0.3));
}
.medal__emoji {
  position: absolute;
  left: 50%;
  top: 42.65%;
  transform: translate(-50%, -50%);
  font-size: calc(var(--size) * 0.33);
  line-height: 1;
  font-family: "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Emoji", sans-serif;
  filter: drop-shadow(0 calc(var(--size) * 0.012) calc(var(--size) * 0.012) rgba(60, 30, 0, 0.35));
  pointer-events: none;
}
.medal.is-locked svg { filter: none; opacity: 0.85; }
.medal.is-locked .medal__emoji { filter: grayscale(1) contrast(0.9); opacity: 0.55; }
@media (prefers-color-scheme: dark) {
  .page .medal.is-locked svg, .theme-page .medal.is-locked svg { opacity: 0.3; }
  .page .medal.is-locked .medal__emoji, .theme-page .medal.is-locked .medal__emoji { opacity: 0.5; }
}
.medal__shine {
  position: absolute;
  left: 8.33%;
  top: 5.88%;
  width: 83.33%;
  height: 73.53%;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
}
.medal__shine::after {
  content: "";
  position: absolute;
  inset: -10%;
  background: linear-gradient(112deg, transparent 34%, rgba(255, 255, 255, 0.85) 47%, rgba(255, 255, 255, 0.35) 52%, transparent 62%);
  transform: translateX(-130%);
  mix-blend-mode: soft-light;
}

/* ---------------------------------------------------------------- Passport: ranks */
.rw-passport > .psection:first-child { margin-top: 8px; }
.rw-ranks { list-style: none; }
.rw-ranks li + li .rw-rank { border-top: 0.5px solid var(--p-sep); }
.rw-rank {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 10px 14px 16px;
  border: 0;
  background: transparent;
  color: var(--p-text);
  text-align: left;
  transition: background 0.15s;
}
.rw-rank:active { background: var(--p-sep); }
.rw-rank__badge {
  position: relative;
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 34% 28%, #fff7d6 0%, #f6cf64 46%, #c78a22 100%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 75%, transparent), 0 6px 16px rgba(120, 80, 10, 0.22), inset 0 -3px 6px rgba(120, 70, 0, 0.25);
}
.rw-rank__emoji { font-size: 27px; line-height: 1; font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif; filter: drop-shadow(0 1px 1px rgba(80, 40, 0, 0.3)); }
.rw-rank__badge .avatar { --s: 22px; position: absolute; right: -5px; bottom: -4px; font-size: 10.5px; box-shadow: 0 0 0 2px var(--p-card); }
.rw-rank__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rw-rank__top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rw-rank__name { font: 760 18.5px/1.2 var(--font-display); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rw-rank__who { flex: none; font: 600 13px/1.2 var(--font); color: color-mix(in srgb, var(--c) 72%, var(--p-text)); }
.rw-rank__bar { display: block; height: 7px; margin: 8px 0 6px; border-radius: 4px; background: rgba(120, 120, 128, 0.16); overflow: hidden; }
.rw-rank__bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 80%, #fff), var(--c)); }
.rw-rank__meta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font: 500 12.5px/1.25 var(--font); color: var(--p-muted); }
.rw-rank__mi { flex: none; white-space: nowrap; }
.rw-rank__next { min-width: 0; text-align: right; font-weight: 650; color: #8f600c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-color-scheme: dark) {
  .rw-rank__bar { background: rgba(255, 255, 255, 0.1); }
  .rw-rank__next { color: var(--gold); }
}
.rw-rank__chev svg { width: 16px; height: 16px; color: var(--p-muted); }

.rw-ladder { list-style: none; display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.rw-ladder__step { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 10px 12px; border-radius: 18px; background: var(--p-card); }
.rw-ladder__step:not(.is-reached) { opacity: 0.5; }
.rw-ladder__step:not(.is-reached) .rw-ladder__emoji { filter: grayscale(0.8); }
.rw-ladder__step.is-here { box-shadow: inset 0 0 0 2px rgba(232, 172, 50, 0.85); opacity: 1; }
.rw-ladder__emoji { flex: none; width: 40px; text-align: center; font-size: 28px; font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.rw-ladder__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rw-ladder__name { font: 700 16px/1.25 var(--font); }
.rw-ladder__name small { font: 500 12.5px/1 var(--font); color: var(--p-muted); }
.rw-ladder__blurb { font: 400 13px/1.35 var(--font); color: var(--p-muted); }
.rw-ladder__who { flex: none; display: flex; }
.rw-ladder__who .avatar + .avatar { margin-left: -8px; }

/* ---------------------------------------------------------------- Passport: badges */
.rw-grid { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rw-grid > li { min-width: 0; }
.rw-tile {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px 12px;
  border: 0;
  border-radius: 22px;
  background: var(--p-card);
  color: var(--p-text);
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 22px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s var(--ease-out);
}
@media (prefers-color-scheme: dark) { .rw-tile { box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.06); } }
.rw-tile:active { transform: scale(0.96); }
.rw-tile.is-earned.is-big {
  background:
    radial-gradient(110% 70% at 50% 0%, rgba(245, 196, 81, 0.26), transparent 72%),
    var(--p-card);
}
.rw-tile.is-locked {
  min-height: 0;
  background: rgba(120, 120, 128, 0.07);
  box-shadow: inset 0 0 0 1px rgba(120, 120, 128, 0.16);
}
@media (prefers-color-scheme: dark) { .rw-tile.is-locked { background: rgba(255, 255, 255, 0.035); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); } }
.rw-tile__count {
  position: absolute;
  top: 9px;
  right: 9px;
  min-width: 28px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ffd977, #f0b53a);
  color: #3a2804;
  font: 800 12px/1 var(--font-round);
  box-shadow: 0 3px 8px rgba(200, 140, 20, 0.3);
}
.rw-tile__name {
  font: 680 13px/1.22 var(--font);
  letter-spacing: -0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.rw-tile.is-locked .rw-tile__name { color: var(--p-muted); font-weight: 650; }
.rw-tile__who { display: inline-flex; align-items: center; gap: 3px; margin-top: auto; min-height: 14px; font: 650 10.5px/1 var(--font); color: var(--p-muted); }
.rw-tile__who i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px var(--p-card); }
.rw-tile__who.is-team i + i { margin-left: -6px; }
.rw-tile__who.is-team span { margin-left: 3px; letter-spacing: 0.04em; text-transform: uppercase; }
.rw-tile__req {
  font: 400 11px/1.3 var(--font);
  color: var(--p-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rw-tile__prog { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 5px; margin-top: auto; padding: 0 4px; }
.rw-tile__bar { display: block; width: 100%; height: 5px; border-radius: 3px; background: rgba(120, 120, 128, 0.18); overflow: hidden; }
.rw-tile__bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f0b53a, #ffd66b); }
.rw-tile__plabel { font: 600 10.5px/1.25 var(--font); color: var(--p-muted); }
@media (prefers-color-scheme: dark) { .rw-tile__bar { background: rgba(255, 255, 255, 0.1); } }
.rw-empty { gap: 6px; }
.rw-empty__medals { display: flex; justify-content: center; gap: 4px; margin-bottom: 4px; }
.rw-empty__medals .medal:nth-child(1) { transform: rotate(-10deg) translateY(4px); }
.rw-empty__medals .medal:nth-child(3) { transform: rotate(10deg) translateY(4px); }
.rw-locked .rw-grid + .rw-cat, .rw-cat + .rw-cat { margin-top: 4px; }
.rw-cat__title { margin: 14px 4px 8px; font: 650 14px/1.2 var(--font); color: var(--p-text); }
.rw-cat:first-of-type .rw-cat__title { margin-top: 0; }
.rw-more {
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--p-accent);
  font: 600 15px/1 var(--font);
}
.rw-more:active { background: var(--p-accent-soft); }
.rw-more .icon svg { width: 17px; height: 17px; transition: transform 0.25s var(--ease-out); }
.rw-more .is-up svg { transform: rotate(180deg); }

/* detail sheet */
.msheet--rw .msheet__body { padding-bottom: 8px; }
/* The sticky sheet header gets a solid background so scrolled content slides under it cleanly. */
.msheet--rw .msheet__head {
  margin: 0 calc(-1 * (var(--sar) + 18px)) 0 calc(-1 * (var(--sal) + 18px));
  padding: 8px calc(var(--sar) + 18px) 12px calc(var(--sal) + 18px);
}
.msheet--rw .theme-page .msheet__head { background: var(--p-bg); }
.msheet--rw .theme-glass .msheet__head { background: rgb(24, 29, 34); }
.rw-detail { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.rw-detail__hero { position: relative; width: 100%; display: grid; place-items: center; padding: 4px 0 2px; }
.rw-detail__glow { position: absolute; left: 50%; top: 50%; width: 230px; height: 230px; margin: -125px 0 0 -115px; border-radius: 50%; background: radial-gradient(circle, var(--rw-glow, rgba(245, 196, 81, 0.35)), transparent 64%); }
.tier-bronze { --rw-glow: rgba(214, 140, 85, 0.32); }
.tier-silver { --rw-glow: rgba(150, 175, 205, 0.3); }
.tier-gold { --rw-glow: rgba(245, 196, 81, 0.4); }
.rw-detail__tier { font: 500 13px/1.3 var(--font); color: var(--rw-muted); }
.rw-tier { display: inline-block; padding: 3px 8px; border-radius: 7px; font: 800 10.5px/1.2 var(--font); letter-spacing: 0.12em; text-transform: uppercase; vertical-align: 1px; }
.rw-tier--bronze { background: #f6dcc4; color: #7a3d14; }
.rw-tier--silver { background: #e3e8ee; color: #4a5562; }
.rw-tier--gold { background: #fde9a8; color: #7a4d06; }
.rw-detail__desc { max-width: 30ch; font: 600 18px/1.35 var(--font); color: var(--rw-text); text-wrap: balance; }
.rw-detail__note { max-width: 34ch; font: 400 13px/1.4 var(--font); color: var(--rw-muted); }
.rw-detail__earned, .rw-detail__prog {
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--rw-card);
  text-align: left;
}
.theme-glass .rw-detail__earned, .theme-glass .rw-detail__prog { box-shadow: inset 0 0 0 0.5px var(--rw-hair); }
.rw-detail__label { font: 700 12px/1.2 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--rw-muted); }
.rw-detail__who { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; }
.rw-detail__who li { display: flex; align-items: center; gap: 8px; font: 650 15px/1.2 var(--font); }
.rw-detail__avatars { display: flex; }
.rw-detail__avatars .avatar + .avatar { margin-left: -8px; }
.rw-detail__wcount { padding: 2px 7px; border-radius: 8px; background: rgba(245, 196, 81, 0.24); color: var(--rw-gold-text); font: 800 12px/1.3 var(--font-round); }
.rw-detail__dates { list-style: none; margin-top: 12px; border-top: 0.5px solid var(--rw-hair); }
.rw-detail__dates li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 0.5px solid var(--rw-hair); font: 500 14px/1.3 var(--font); }
.rw-detail__dates li:last-child { border-bottom: 0; padding-bottom: 0; }
.rw-detail__by { color: var(--rw-muted); }
.rw-detail__more { margin-top: 6px; font: 500 13px/1.3 var(--font); color: var(--rw-muted); }
.rw-detail__prog .rw-bar { margin-top: 12px; }
.rw-detail__plabel { margin-top: 8px; font: 650 15px/1.3 var(--font); }
.rw-detail__nudge { margin-top: 4px; font: 500 14px/1.4 var(--font); color: var(--rw-gold-text); }
.rw-detail > .rw-detail__nudge { margin-top: 10px; }

/* Passport cover with four stats */
.passport__stats.has-4 { gap: 8px; }
.passport__stats.has-4 .passport__stat { flex: 1 1 0; min-width: 0; max-width: 86px; padding: 9px 6px; }
.passport__stats.has-4 .passport__stat span { letter-spacing: 0.06em; }

/* ---------------------------------------------------------------- Our rewards (Trail card, glass) */
.rw-card--glow { box-shadow: inset 0 0 0 1px rgba(245, 196, 81, 0.5), 0 0 26px rgba(245, 196, 81, 0.14) !important; }
.rw-rcard__ready { color: var(--gold); }
.rw-rcard__empty { display: flex; align-items: center; gap: 14px; }
.rw-rcard__gift {
  flex: none;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 32px;
  background: radial-gradient(circle at 35% 30%, rgba(255, 228, 160, 0.3), rgba(255, 255, 255, 0.06));
  font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.rw-rcard__etitle { font: 700 17px/1.25 var(--font); }
.rw-rcard__esub { margin-top: 3px; font: 400 13.5px/1.4 var(--font); color: var(--rw-muted); }
.rw-rcard > .btn { margin-top: 14px; }
.rw-rrow {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 10px;
  border-radius: 18px;
  overflow: hidden;
}
.rw-rrow + .rw-rrow, .rw-rrow + .rw-rnext { margin-top: 10px; }
.rw-rrow.is-unlocked {
  background: linear-gradient(135deg, rgba(245, 196, 81, 0.26), rgba(245, 196, 81, 0.07));
  box-shadow: inset 0 0 0 1px rgba(245, 196, 81, 0.5);
}
.rw-rrow.is-unlocked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 240, 200, 0.22) 46%, transparent 60%);
  transform: translateX(-100%);
  animation: rw-sweep 3.6s 0.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes rw-sweep { 0%, 55% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.rw-rrow__emoji, .rw-rnext__emoji {
  flex: none;
  display: grid;
  place-items: center;
  font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.rw-rrow__emoji { width: 46px; height: 46px; border-radius: 14px; font-size: 26px; background: rgba(255, 255, 255, 0.12); }
.rw-rrow.is-unlocked .rw-rrow__emoji { animation: rw-wiggle 2.8s 1s ease-in-out infinite; }
@keyframes rw-wiggle { 0%, 80%, 100% { transform: none; } 84% { transform: rotate(-9deg) scale(1.06); } 88% { transform: rotate(8deg) scale(1.06); } 92% { transform: rotate(-4deg); } }
.rw-rrow__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rw-rrow__badge { font: 800 10.5px/1.2 var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.rw-rrow__title { font: 680 16px/1.25 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rw-rrow__sub { font: 500 12.5px/1.3 var(--font); color: var(--rw-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rw-claim { flex: none; min-height: 40px; padding: 0 16px; }
.rw-rnext { display: flex; align-items: flex-start; gap: 14px; }
.rw-rnext__emoji { width: 58px; height: 58px; border-radius: 18px; font-size: 32px; background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.12); }
.rw-rnext__text { flex: 1; min-width: 0; }
.rw-rnext__title { font: 720 18px/1.2 var(--font-display); letter-spacing: -0.01em; }
.rw-rnext__sub { margin-top: 3px; font: 500 13px/1.35 var(--font); color: var(--rw-muted); }
.rw-rnext__label { margin-top: 6px; font: 650 13px/1.2 var(--font); color: var(--rw-text); }
.rw-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 40px;
  margin: 8px 0 -8px -2px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--rw-muted);
  font: 600 13.5px/1 var(--font);
}
.rw-link::before { content: ""; position: absolute; inset: -2px -6px; }
.rw-link .icon svg { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- Our rewards (Passport manager) */
.rw-manager .psection__head { align-items: center; }
.rw-add {
  position: relative;
  min-height: 34px;
  padding: 0 13px 0 9px;
  border: 0;
  border-radius: 17px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--p-accent-soft);
  color: var(--p-accent);
  font: 650 14px/1 var(--font);
}
.rw-add::before { content: ""; position: absolute; inset: -5px -2px; }
.rw-add .icon svg { width: 17px; height: 17px; }
.rw-mlist { list-style: none; }
.rw-mlist + .rw-mlist { margin-top: 12px; }
.rw-mlist > li + li > .rw-mrow, .rw-mlist > li.rw-mrow + li.rw-mrow { border-top: 0.5px solid var(--p-sep); }
.rw-mlist.is-ready {
  background:
    linear-gradient(135deg, rgba(245, 196, 81, 0.22), rgba(245, 196, 81, 0.05)),
    var(--p-card);
  box-shadow: inset 0 0 0 1px rgba(217, 154, 43, 0.42), 0 8px 22px rgba(200, 140, 20, 0.1);
}
.rw-mrow {
  width: 100%;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border: 0;
  background: transparent;
  color: var(--p-text);
  text-align: left;
}
button.rw-mrow:active { background: var(--p-sep); }
.rw-mrow__emoji {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 25px;
  background: rgba(120, 120, 128, 0.1);
  font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.rw-mrow.is-unlocked .rw-mrow__emoji { background: rgba(255, 255, 255, 0.7); box-shadow: 0 4px 12px rgba(200, 140, 20, 0.2); }
@media (prefers-color-scheme: dark) {
  .rw-mrow__emoji { background: rgba(255, 255, 255, 0.07); }
  .rw-mrow.is-unlocked .rw-mrow__emoji { background: rgba(255, 255, 255, 0.12); }
}
.rw-mrow__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rw-mrow__kicker { font: 800 10.5px/1.2 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--rw-gold-text); }
.rw-mrow__title { font: 650 15.5px/1.3 var(--font); overflow-wrap: anywhere; }
.rw-mrow__sub { font: 400 12.5px/1.35 var(--font); color: var(--p-muted); }
.rw-mrow__plabel { margin-top: 4px; font: 600 12px/1.2 var(--font); color: var(--p-muted); }
.rw-mrow .rw-bar { margin-top: 7px; }
.rw-mrow__chev svg { width: 16px; height: 16px; color: var(--p-muted); }
.rw-mrow__check { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--p-accent-soft); color: var(--p-accent); }
.rw-mrow__check .icon svg { width: 15px; height: 15px; }
.rw-mrow.is-history .rw-mrow__emoji { filter: saturate(0.8); }
.rw-x { display: inline-block; margin-left: 7px; padding: 2px 6px; border-radius: 7px; vertical-align: 1px; background: rgba(245, 196, 81, 0.24); color: var(--rw-gold-text); font: 800 11.5px/1.2 var(--font-round); }
.rw-mempty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 18px 20px; text-align: center; }
.rw-mempty__gifts { display: flex; align-items: flex-end; gap: 4px; margin-bottom: 4px; font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.rw-mempty__gifts span { font-size: 30px; transform: rotate(-10deg); }
.rw-mempty__gifts span:nth-child(2) { font-size: 42px; transform: translateY(-4px); }
.rw-mempty__gifts span:nth-child(3) { transform: rotate(10deg); }
.rw-mempty__tpls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.rw-mempty .btn { margin-top: 12px; }
.rw-tplchip {
  position: relative;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 0 10px;
  border: 0;
  border-radius: 20px;
  background: rgba(120, 120, 128, 0.1);
  color: var(--p-text);
  font: 600 14px/1 var(--font);
}
.rw-tplchip:active { transform: scale(0.97); }
@media (prefers-color-scheme: dark) { .rw-tplchip { background: rgba(255, 255, 255, 0.08); } }

/* editor sheet */
.rw-ed { gap: 18px; }
.rw-ed__group { display: flex; flex-direction: column; gap: 8px; }
.rw-ed__stats { font: 600 13px/1.3 var(--font); color: var(--rw-gold-text); }
.rw-ed__tpls { display: flex; flex-direction: column; gap: 6px; }
.rw-tpl {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 10px;
  border: 0;
  border-radius: 16px;
  background: var(--rw-card);
  color: var(--rw-text);
  text-align: left;
  box-shadow: inset 0 0 0 1px var(--rw-hair);
  transition: box-shadow 0.2s, transform 0.12s;
}
.rw-tpl:active { transform: scale(0.98); }
.rw-tpl.is-on { box-shadow: inset 0 0 0 2px var(--rw-accent); }
.rw-tpl__emoji { flex: none; width: 34px; text-align: center; font-size: 25px; font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.rw-tpl__text { flex: 1; min-width: 0; font: 400 15px/1.3 var(--font); }
.rw-tpl__when { font-weight: 650; }
.rw-tpl__arrow { color: var(--rw-muted); }
.rw-ed__titlerow { display: flex; align-items: center; gap: 10px; }
.rw-ed__preview {
  flex: none;
  width: 50px;
  height: 50px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-size: 29px;
  background: var(--rw-card);
  box-shadow: inset 0 0 0 1px var(--rw-hair);
  font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.rw-ed__preview.is-pop { animation: rw-pop-sm 0.35s var(--ease-out); }
.rw-ed__emojis {
  display: flex;
  gap: 4px;
  margin: 0 calc(-1 * (var(--sar) + 18px)) 0 calc(-1 * (var(--sal) + 18px));
  padding: 2px calc(var(--sar) + 18px) 4px calc(var(--sal) + 18px);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scroll-padding: 0 calc(var(--sar) + 18px) 0 calc(var(--sal) + 18px);
}
.rw-ed__emojis::-webkit-scrollbar { display: none; }
.rw-ed__emoji {
  flex: none;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  font-size: 25px;
  scroll-snap-align: start;
  font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  transition: background 0.15s, box-shadow 0.15s;
}
.rw-ed__emoji[aria-checked="true"] { background: var(--rw-accent-soft); box-shadow: inset 0 0 0 2px var(--rw-accent); }
.rw-ed__kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.rw-ed__sentence { margin-top: 4px; padding: 12px 14px; border-radius: 16px; background: var(--rw-card); box-shadow: inset 0 0 0 1px var(--rw-hair); }
.rw-ed__line { font: 600 16px/1.4 var(--font); color: var(--rw-text); text-wrap: balance; }
.rw-ed__line b { font-weight: 750; }
.rw-ed__stepper { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.rw-step {
  position: relative;
  flex: none;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--rw-surface-strong);
  color: var(--rw-text);
  font: 500 26px/1 var(--font);
  box-shadow: inset 0 0 0 1px var(--rw-hair);
  transition: transform 0.12s, background 0.15s;
}
.rw-step:active { transform: scale(0.92); background: var(--rw-accent-soft); }
.rw-ed__numwrap { flex: 1; position: relative; display: block; }
.rw-ed__num { width: 100%; height: 52px; padding: 0 44px 0 16px; text-align: center; font: 750 24px/1 var(--font-round); }
.rw-ed__unit { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font: 600 15px/1 var(--font); color: var(--rw-muted); pointer-events: none; }
.rw-ed__select { display: block; width: 100%; height: 48px; margin-top: 10px; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.rw-ed__sentence .field__hint { margin-top: 10px; }
.rw-ed__del { justify-content: center; margin-top: -6px; }

/* ---------------------------------------------------------------- cheers */
.msheet--cheer .msheet__head { position: absolute; top: 12px; right: calc(var(--sar) + 14px); margin: 0; padding: 0; background: none !important; }
.msheet--cheer .msheet__body { padding-top: 6px; }
.rw-cheer { gap: 16px; }
.rw-cheer__to { display: flex; align-items: center; gap: 12px; padding-right: 48px; }
.rw-cheer__title { font: 760 21px/1.2 var(--font-display); letter-spacing: -0.01em; }
.rw-cheer__sub { margin-top: 2px; font: 500 13.5px/1.35 var(--font); color: var(--rw-muted); }
.rw-cheer__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rw-cheer__emoji {
  height: 62px;
  border: 0;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--rw-surface-strong);
  font-size: 31px;
  font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  transition: transform 0.15s var(--ease-out), background 0.2s, box-shadow 0.2s;
}
.rw-cheer__emoji:active { transform: scale(0.92); }
.rw-cheer__emoji[aria-checked="true"] { background: var(--rw-accent-soft); box-shadow: inset 0 0 0 2px var(--rw-accent); }
.rw-cheer__emoji.is-pop { animation: rw-pop-sm 0.38s var(--ease-out); }
@keyframes rw-pop-sm { 40% { transform: scale(1.18); } 100% { transform: none; } }
.rw-cheer__chips {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, auto);
  justify-content: start;
  gap: 6px;
  min-height: 82px;
  margin: 0 calc(-1 * (var(--sar) + 18px)) 0 calc(-1 * (var(--sal) + 18px));
  padding: 2px calc(var(--sar) + 18px) 4px calc(var(--sal) + 18px);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-padding: 0 calc(var(--sar) + 18px) 0 calc(var(--sal) + 18px);
}
.rw-cheer__chips::-webkit-scrollbar { display: none; }
.rw-cheer__chips .rw-chip { white-space: nowrap; }
.rw-cheer__label { display: flex; justify-content: space-between; align-items: baseline; }
.rw-cheer__count { font: 600 12px/1 var(--font); color: var(--rw-muted); }
.rw-cheer__count.is-near { color: var(--rw-gold-text); }
.rw-cheer .form__error { color: var(--danger); }
.rw-cheer-btn {
  position: relative;
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.18);
  font-size: 18px;
  font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  transition: transform 0.15s var(--ease-out), background 0.2s;
}
.rw-cheer-btn::before { content: ""; position: absolute; inset: -5px; }
/* On the Trail's walker card: bottom-right, beside "2.3 mi today". */
.walker { position: relative; }
.walker > .rw-cheer-btn { position: absolute; right: 10px; bottom: 10px; }
.rw-cheer-btn:active { transform: scale(0.9); background: rgba(255, 255, 255, 0.26); }

/* ---------------------------------------------------------------- inspiration */
.rw-quote { position: relative; margin: 0; }
.rw-quote__eyebrow { padding-right: 40px; }
.rw-quote__lang { text-transform: none; letter-spacing: 0.01em; }
.rw-quote__mark {
  position: absolute;
  right: -4px;
  top: -10px;
  font: 700 92px/1 var(--font-serif);
  color: var(--gold);
  opacity: 0.3;
  pointer-events: none;
  user-select: none;
}
.rw-quote__text {
  margin: 4px 0 0;
  font: 400 20px/1.42 var(--font-serif);
  letter-spacing: -0.005em;
  color: var(--rw-text);
  text-wrap: pretty;
  overflow-wrap: break-word;
}
.rw-quote__text.is-short { font-size: 25px; line-height: 1.3; letter-spacing: -0.01em; }
.rw-quote__text.is-long { font-size: 17.5px; line-height: 1.5; }
.rw-quote__tr {
  margin-top: 12px;
  padding: 2px 0 2px 12px;
  border-left: 2.5px solid rgba(245, 196, 81, 0.65);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font: 500 15px/1.45 var(--font);
  color: var(--rw-text);
}
.rw-quote__tr-label { font: 700 10.5px/1.2 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--rw-muted); }
.rw-quote__cap { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.rw-quote__author { font: 650 14.5px/1.3 var(--font); color: var(--rw-text); }
.rw-quote__work {
  font: italic 400 13px/1.35 var(--font-serif);
  color: var(--rw-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rw-quote__foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.rw-quote__spacer { flex: 1; }
.rw-quote__src {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  font: 500 12.5px/1 var(--font);
  color: var(--rw-muted);
  text-decoration: none;
}
.rw-quote__src::before { content: ""; position: absolute; inset: -4px -6px; }
.rw-quote__src .icon svg { width: 13px; height: 13px; }
.rw-quote__btn {
  position: relative;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 0 11px;
  border: 0;
  border-radius: 18px;
  background: var(--rw-surface-strong);
  color: var(--rw-text);
  font: 600 13.5px/1 var(--font);
}
.rw-quote__btn::before { content: ""; position: absolute; inset: -4px 0; }
.rw-quote__btn:active { transform: scale(0.96); }
.rw-quote__btn .icon svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- recap card + shared week widgets */
.rw-recap__top { display: flex; flex-direction: column; gap: 4px; }
.rw-recap__total { display: flex; align-items: baseline; gap: 2px; }
.rw-recap__total b { font: 800 34px/1 var(--font-round); letter-spacing: -0.02em; color: var(--rw-text); }
.rw-recap__total span { font: 650 16px/1 var(--font); color: var(--rw-muted); }
.rw-recap__eq { font: 500 14px/1.4 var(--font); color: var(--rw-text); opacity: 0.9; }

.rw-week { --h: 64px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.rw-week__day { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.rw-week__col {
  position: relative;
  width: 100%;
  max-width: 34px;
  height: var(--h);
  display: flex;
  align-items: flex-end;
  border-radius: 9px;
  background: var(--rw-surface);
  overflow: hidden;
}
.rw-week__stack { width: 100%; display: flex; flex-direction: column-reverse; gap: 1.5px; border-radius: 9px; overflow: hidden; transition: height 0.9s var(--ease-out); }
.rw-week__stack span { min-height: 3px; background: var(--c); }
.rw-week__day.is-future .rw-week__col { background: transparent; box-shadow: inset 0 0 0 1.2px var(--rw-track); }
.rw-week__day.is-today .rw-week__col { box-shadow: inset 0 0 0 1.5px rgba(245, 196, 81, 0.65); }
.rw-week__label { font: 650 11px/1 var(--font); color: var(--rw-muted); }
.rw-week__day.is-today .rw-week__label { color: var(--rw-gold-text); font-weight: 800; }
.rw-week__day.is-best .rw-week__col::after { content: "★"; position: absolute; top: 3px; left: 0; right: 0; text-align: center; font: 700 10px/1 var(--font); color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.rw-week--big { --h: 96px; gap: 8px; }
.rw-week--big .rw-week__col { max-width: 38px; border-radius: 11px; }
.rw-week--big .rw-week__label { font-size: 12px; }

.rw-split { margin-top: 14px; }
.rw-split__bar { display: flex; gap: 3px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--rw-track); }
.rw-split__bar span { background: var(--c); }
.rw-split__legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 9px; font: 500 13px/1.3 var(--font); color: var(--rw-muted); }
.rw-split__legend li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rw-split__legend i { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.rw-split__legend b { font-weight: 700; color: var(--rw-text); }

.rw-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.rw-stat { min-width: 0; padding: 10px 10px 9px; border-radius: 16px; background: var(--rw-surface); box-shadow: inset 0 0 0 0.5px var(--rw-hair); }
.rw-stat__label { font: 600 11px/1.25 var(--font); color: var(--rw-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rw-stat__value { margin-top: 4px; font: 750 14.5px/1.2 var(--font-round); color: var(--rw-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rw-goal { margin-top: 22px; }
.rw-goal__track { position: relative; height: 8px; margin: 24px 10px 0 4px; border-radius: 4px; background: var(--rw-track); }
.rw-goal__fill { position: absolute; left: 0; top: 0; bottom: 0; max-width: 100%; border-radius: inherit; background: linear-gradient(90deg, #f0b53a, #ffdf86); transition: width 1.1s var(--ease-out); }
.rw-goal__tick { position: absolute; top: 50%; width: 0; height: 0; }
.rw-goal__tick::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rw-track-solid, #4a5056);
  box-shadow: 0 0 0 2px rgba(20, 24, 28, 0.9);
}
.page .rw-goal__tick::before { --rw-track-solid: #c9ccd2; box-shadow: 0 0 0 2px var(--p-card); }
.rw-goal__tick.is-on::before { background: #ffd66b; }
.rw-goal__emoji { position: absolute; left: 0; bottom: 9px; transform: translateX(-50%); font-size: 15px; line-height: 1; font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif; filter: grayscale(1); opacity: 0.45; transition: transform 0.3s; }
.rw-goal__tick.is-on .rw-goal__emoji { filter: none; opacity: 1; }
.rw-goal__tick.is-next .rw-goal__emoji { filter: none; opacity: 1; transform: translateX(-50%) scale(1.2); }
.rw-goal__mi { position: absolute; left: 0; top: 9px; transform: translateX(-50%); font: 650 10px/1 var(--font); color: var(--rw-muted); }
.rw-goal__label { margin-top: 20px; font: 650 13.5px/1.35 var(--font); color: var(--rw-gold-text); }
.rw-recap__facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; font: 600 13px/1.35 var(--font); color: var(--rw-muted); }
.rw-goal--compact { margin-top: 12px; }
.rw-goal--compact .rw-goal__label { margin-top: 18px; }

/* ---------------------------------------------------------------- moments (full-screen) */
.rw-moment {
  position: fixed;
  inset: 0;
  z-index: 60;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s;
  --rw-glow: rgba(245, 196, 81, 0.34);
}
.rw-moment.is-open { opacity: 1; }
.rw-moment__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(80% 48% at 50% 34%, var(--rw-glow), transparent 72%),
    radial-gradient(140% 90% at 50% 0%, #18344a 0%, #0c1622 62%, #080d14 100%);
}
.rw-moment.is-gold .rw-moment__backdrop {
  background:
    radial-gradient(85% 50% at 50% 34%, rgba(255, 205, 90, 0.5), transparent 72%),
    radial-gradient(140% 90% at 50% 0%, #3a2a0e 0%, #17120a 58%, #0a0805 100%);
}
.rw-moment__backdrop--soft {
  background: rgba(8, 10, 14, 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  backdrop-filter: blur(14px) saturate(130%);
}
.rw-moment__backdrop--recap {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='160' viewBox='0 0 240 160'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.06' stroke-width='1.2'%3E%3Cpath d='M-10 120c40-30 70-10 100-30s50-50 90-40 60 40 80 30'/%3E%3Cpath d='M-10 100c40-30 70-10 100-30s50-50 90-40 60 40 80 30'/%3E%3Cpath d='M-10 140c40-30 70-10 100-30s50-50 90-40 60 40 80 30'/%3E%3Cpath d='M-10 80c40-30 70-10 100-30s50-50 90-40 60 40 80 30'/%3E%3Cpath d='M-10 60c40-30 70-10 100-30s50-50 90-40 60 40 80 30'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 240px 160px,
    radial-gradient(120% 60% at 100% 0%, rgba(245, 196, 81, 0.2), transparent 55%),
    linear-gradient(165deg, #1b4a4f 0%, #10262f 55%, #0b1820 100%);
}
.rw-fireworks { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
.rw-moment__scroll {
  position: relative;
  z-index: 2;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--sat) + 26px) calc(var(--sar) + 20px) calc(var(--sab) + 22px) calc(var(--sal) + 20px);
}
.rw-moment__scroll > :first-child { margin-top: auto; }
.rw-moment__scroll > :last-child { margin-bottom: auto; }
.rw-moment__actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  width: min(100%, 380px);
  display: flex;
  gap: 10px;
  margin-top: 28px;
  padding-top: 6px;
}
.rw-moment__actions::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -20px;
  right: -20px;
  top: -26px;
  bottom: calc(-1 * (var(--sab) + 22px));
  background: linear-gradient(rgba(8, 12, 16, 0), rgba(8, 12, 16, 0.55) 60%);
  pointer-events: none;
}
.rw-moment__actions .pc-btn { box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35); }
.rw-moment__actions .pc-btn--ghost { background: rgba(255, 255, 255, 0.13); }
.rw-moment .pc-close { z-index: 4; }

.rw-cel { width: min(100%, 380px); display: flex; flex-direction: column; align-items: center; text-align: center; }
.rw-cel__kicker { font: 750 12.5px/1.2 var(--font); letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.rw-cel__stage { position: relative; width: 270px; height: 262px; display: grid; place-items: center; margin: 10px 0 2px; }
.is-big .rw-cel__stage { height: 286px; }
.rw-cel__rays {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 420px;
  height: 420px;
  margin: -210px 0 0 -210px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 236, 180, 0.2) 0deg 8deg, transparent 8deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 18%, transparent 66%);
  mask-image: radial-gradient(circle, #000 18%, transparent 66%);
  opacity: 0;
  pointer-events: none;
}
.tier-bronze .rw-cel__rays { background: repeating-conic-gradient(from 0deg, rgba(255, 200, 150, 0.18) 0deg 8deg, transparent 8deg 22deg); }
.tier-silver .rw-cel__rays { background: repeating-conic-gradient(from 0deg, rgba(220, 235, 255, 0.18) 0deg 8deg, transparent 8deg 22deg); }
.rw-cel__ring {
  position: absolute;
  left: 50%;
  top: 41%;
  width: 190px;
  height: 190px;
  margin: -95px 0 0 -95px;
  border-radius: 50%;
  border: 3px solid rgba(255, 228, 160, 0.85);
  opacity: 0;
  pointer-events: none;
}
.rw-cel__medal { position: relative; z-index: 1; }
.rw-cel__medal svg { filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.45)); }
.rw-banner {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 65%;
  transform: translateX(-50%) rotate(-3deg);
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.4));
}
.rw-banner span {
  display: block;
  padding: 9px 30px 10px;
  background: linear-gradient(180deg, #ef4b5c 0%, #c21d33 60%, #9e1428 100%);
  color: #fff3c4;
  font: 850 15px/1 var(--font);
  letter-spacing: 0.22em;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(90, 0, 10, 0.5);
  clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 0 100%, 12px 50%);
}
.rw-cel__name {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  font: 800 30px/1.12 var(--font-display);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.rw-cel__count { padding: 5px 10px; border-radius: 14px; background: rgba(245, 196, 81, 0.22); color: var(--gold); font: 800 17px/1 var(--font-round); }
.rw-cel__who {
  margin-top: 12px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 15px 0 5px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.16);
  font: 650 14.5px/1 var(--font);
}
.rw-cel__who .avatar { --s: 26px; font-size: 12px; }
.rw-cel__who.is-team { padding-left: 6px; }
.rw-cel__avatars { display: flex; }
.rw-cel__avatars .avatar + .avatar { margin-left: -9px; }
.rw-cel__line { margin-top: 16px; max-width: 30ch; font: 500 18px/1.45 var(--font); color: rgba(255, 255, 255, 0.92); text-wrap: balance; }
.rw-cel__desc { margin-top: 8px; max-width: 34ch; font: 500 13.5px/1.4 var(--font); color: rgba(255, 255, 255, 0.58); text-wrap: balance; }
.rw-dots { display: flex; gap: 7px; margin-top: 18px; }
.rw-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.28); }
.rw-dots i.is-on { background: var(--gold); width: 18px; border-radius: 4px; }

/* entrance choreography */
.rw-moment.is-open .rw-cel > * { animation: rw-up 0.55s var(--ease-out) both; }
.rw-moment.is-open .rw-cel > :nth-child(1) { animation-delay: 0.3s; }
.rw-moment.is-open .rw-cel > :nth-child(3) { animation-delay: 1s; }
.rw-moment.is-open .rw-cel > :nth-child(4) { animation-delay: 1.1s; }
.rw-moment.is-open .rw-cel > :nth-child(5) { animation-delay: 1.2s; }
.rw-moment.is-open .rw-cel > :nth-child(6) { animation-delay: 1.3s; }
.rw-moment.is-open .rw-cel > :nth-child(n + 7) { animation-delay: 1.4s; }
.rw-moment.is-open .rw-cel > .rw-cel__stage { animation: rw-thump 0.36s 1.02s ease-out both; }
.rw-moment.is-open .rw-cel__medal { animation: rw-drop 1.05s 0.25s cubic-bezier(0.3, 1.25, 0.45, 1) both; }
.rw-moment.is-open .rw-cel__rays { animation: rw-fade 0.9s 0.95s ease-out forwards, rw-spin 28s 0.95s linear infinite; }
.rw-moment.is-open .rw-cel__ring { animation: rw-ring 0.95s 1.02s ease-out both; }
.rw-moment.is-open .medal__shine::after { animation: rw-shine 1.1s 1.35s ease-in-out both; }
.rw-moment.is-open .rw-banner { animation: rw-banner 0.6s 1.3s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.rw-moment.is-open .rw-moment__actions { animation: rw-up 0.5s 1.2s var(--ease-out) both; }
.rw-moment--summary.is-open .rw-cel > * { animation-delay: 0.15s; }
.rw-moment--summary.is-open .rw-sum__item { animation: rw-pop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.rw-moment--summary.is-open .rw-sum__item:nth-child(2) { animation-delay: 0.08s; }
.rw-moment--summary.is-open .rw-sum__item:nth-child(3) { animation-delay: 0.16s; }
.rw-moment--summary.is-open .rw-sum__item:nth-child(4) { animation-delay: 0.24s; }
.rw-moment--summary.is-open .rw-sum__item:nth-child(n + 5) { animation-delay: 0.32s; }
.rw-moment--summary.is-open .rw-moment__actions { animation-delay: 0.4s; }
.rw-moment.is-leaving .rw-cel, .rw-moment.is-leaving .rw-cheerin, .rw-moment.is-leaving .rw-recapm { transform: scale(0.97); transition: transform 0.3s; }
@keyframes rw-up { from { opacity: 0; transform: translateY(14px); } }
@keyframes rw-fade { to { opacity: 1; } }
@keyframes rw-spin { to { transform: rotate(360deg); } }
@keyframes rw-drop {
  0% { transform: translateY(-78vh) rotate(-16deg) scale(0.72); opacity: 0; }
  45% { opacity: 1; }
  70% { transform: translateY(12px) rotate(3deg) scale(1.05, 0.94); }
  85% { transform: translateY(-7px) rotate(-1deg) scale(0.99, 1.02); }
  100% { transform: none; opacity: 1; }
}
@keyframes rw-thump { 30% { transform: translate(1.5px, 4px); } 60% { transform: translate(-1.5px, -1px); } }
@keyframes rw-ring { from { transform: scale(0.62); opacity: 0.95; } to { transform: scale(1.75); opacity: 0; } }
@keyframes rw-shine { from { transform: translateX(-130%); } to { transform: translateX(130%); } }
@keyframes rw-banner { from { transform: translateX(-50%) rotate(-14deg) scale(0.2); opacity: 0; } to { transform: translateX(-50%) rotate(-3deg) scale(1); opacity: 1; } }
@keyframes rw-pop { from { transform: scale(0.3); opacity: 0; } }

/* summary of many badges */
.rw-sum { list-style: none; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 8px; margin-top: 22px; }
.rw-sum__item { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.rw-sum__name { font: 650 13px/1.2 var(--font); text-align: center; }
.rw-sum__who { font: 500 11.5px/1 var(--font); color: rgba(255, 255, 255, 0.6); }

/* reward moments: gift box shakes, pops, reveals the reward */
.rw-gift { position: relative; width: 210px; height: 210px; display: grid; place-items: center; margin: 12px 0 4px; }
.rw-gift__glow { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(255, 214, 120, 0.5), transparent 64%); }
.rw-gift__box, .rw-gift__reveal { grid-area: 1 / 1; font-size: 108px; line-height: 1; font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.4)); }
.rw-gift__reveal { opacity: 0; font-size: 116px; }
.rw-moment.is-open .rw-gift__box { animation: rw-gift 1.25s 0.25s ease-in both; }
.rw-moment.is-open .rw-gift__reveal { animation: rw-reveal 0.65s 1.3s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.rw-moment.is-open .rw-gift__glow { animation: rw-fade 0.8s 1.2s both reverse; }
@keyframes rw-gift {
  0% { transform: scale(0.4); opacity: 0; }
  18% { transform: scale(1); opacity: 1; }
  30% { transform: rotate(-10deg); }
  40% { transform: rotate(9deg); }
  50% { transform: rotate(-8deg); }
  60% { transform: rotate(7deg) scale(1.04); }
  72% { transform: rotate(0) scale(1.1); opacity: 1; }
  100% { transform: scale(1.7); opacity: 0; }
}
@keyframes rw-reveal { from { transform: scale(0.2) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
.rw-cel--reward > :nth-child(2) { animation: none !important; }

/* cheers arriving */
.rw-moment__scroll--cheer { justify-content: center; }
.rw-cheerin {
  position: relative;
  width: min(100%, 360px);
  margin-top: 64px;
  padding: 64px 22px 22px;
  border-radius: 30px;
  text-align: center;
  color: var(--text);
  background:
    radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--c) 28%, transparent), transparent 70%),
    rgba(26, 31, 36, 0.92);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45), inset 0 0 0 0.5px rgba(255, 255, 255, 0.16);
}
.rw-moment.is-open .rw-cheerin { animation: rw-card-in 0.6s 0.05s cubic-bezier(0.2, 1.2, 0.35, 1) both; }
@keyframes rw-card-in { from { transform: translateY(40px) scale(0.92); opacity: 0; } }
.rw-cheerin__emoji {
  position: absolute;
  left: 50%;
  top: -54px;
  width: 108px;
  height: 108px;
  margin-left: -54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 30%, #ffffff), color-mix(in srgb, var(--c) 70%, #1a1f24));
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.92), 0 16px 34px color-mix(in srgb, var(--c) 45%, rgba(0, 0, 0, 0.5));
  font-size: 58px;
  font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.rw-moment.is-open .rw-cheerin__emoji span { display: inline-block; animation: rw-pop 0.6s 0.35s cubic-bezier(0.2, 1.7, 0.4, 1) both, rw-bob 2.6s 1.2s ease-in-out infinite; }
@keyframes rw-bob { 50% { transform: translateY(-4px) rotate(-6deg); } }
.rw-cheerin__who { display: flex; align-items: center; justify-content: center; gap: 10px; font: 500 17px/1.3 var(--font); }
.rw-cheerin__who .avatar { --s: 28px; }
.rw-cheerin__who b { font-weight: 750; color: color-mix(in srgb, var(--c) 55%, #ffffff); }
.rw-cheerin__msgs { list-style: none; display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.rw-cheerin__msgs li { display: flex; flex-direction: column; gap: 4px; }
.rw-cheerin__quote { font: italic 500 22px/1.35 var(--font-serif); color: #fff; text-wrap: balance; overflow-wrap: anywhere; }
.rw-cheerin__msgs li + li .rw-cheerin__quote { font-size: 18px; color: rgba(255, 255, 255, 0.86); }
.rw-cheerin__meta, .rw-cheerin__plain, .rw-cheerin__more { font: 500 13px/1.35 var(--font); color: var(--muted); }
.rw-cheerin__plain { margin-top: 10px; font-size: 15px; }
.rw-cheerin__more { margin-top: 12px; }
.rw-moment--cheer .rw-moment__actions { animation-delay: 0.5s !important; }
.rw-burst { position: fixed; inset: 0; z-index: 75; pointer-events: none; overflow: hidden; }
.rw-moment .rw-burst { z-index: 5; }
.rw-burst__p {
  position: fixed;
  font-size: 30px;
  line-height: 1;
  font-family: "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0;
  animation: rw-float var(--t, 1.6s) var(--d, 0s) cubic-bezier(0.15, 0.7, 0.3, 1) both;
  will-change: transform, opacity;
}
@keyframes rw-float {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  12% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(var(--s)); }
}

/* weekly recap modal */
.rw-recapm { width: min(100%, 400px); text-align: center; }
.rw-recapm__kicker { font: 700 12px/1.2 var(--font); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.rw-recapm__title { margin-top: 10px; font: italic 700 31px/1.1 var(--font-serif); letter-spacing: -0.01em; }
.rw-recapm__total { margin-top: 14px; display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.rw-recapm__total b { font: 800 66px/0.95 var(--font-round); letter-spacing: -0.035em; background: linear-gradient(180deg, #fff7d6, #f5c451); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rw-recapm__total span { font: 650 19px/1 var(--font); color: rgba(255, 255, 255, 0.72); }
.rw-recapm__line { margin: 12px auto 0; max-width: 32ch; font: 500 16.5px/1.45 var(--font); color: rgba(255, 255, 255, 0.9); text-wrap: pretty; }
.rw-recapm__panel { margin-top: 20px; padding: 14px 16px 16px; border-radius: 24px; background: rgba(255, 255, 255, 0.07); box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.12); text-align: left; }
.rw-recapm__panel .rw-week { margin-top: 2px; }
.rw-stats--recap { margin-top: 12px; text-align: left; }
.rw-stats--recap .rw-stat { background: rgba(255, 255, 255, 0.07); }
.rw-recapm__climb { margin-top: 12px; font: 500 13.5px/1.4 var(--font); color: rgba(255, 255, 255, 0.72); }
.rw-recapm__goal { margin: 14px auto 0; max-width: 34ch; font: 650 15px/1.45 var(--font); color: var(--gold); text-wrap: pretty; }
.rw-recapm__badges { margin-top: 20px; }
.rw-recapm__sub { font: 700 12px/1.2 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255, 255, 255, 0.62); }
.rw-recapm__medals { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 6px; margin-top: 12px; }
.rw-recapm__medals li { width: 86px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rw-recapm__mname { font: 650 12px/1.2 var(--font); text-align: center; }
.rw-recapm__mwho { font: 500 11px/1 var(--font); color: rgba(255, 255, 255, 0.58); }
.rw-recapm__team { display: flex; justify-content: center; margin-top: 22px; }
.rw-recapm__team .avatar + .avatar { margin-left: -8px; }
.rw-moment--recap.is-open .rw-recapm > * { animation: rw-up 0.55s var(--ease-out) both; }
.rw-moment--recap.is-open .rw-recapm > :nth-child(2) { animation-delay: 0.08s; }
.rw-moment--recap.is-open .rw-recapm > :nth-child(3) { animation-delay: 0.16s; }
.rw-moment--recap.is-open .rw-recapm > :nth-child(4) { animation-delay: 0.24s; }
.rw-moment--recap.is-open .rw-recapm > :nth-child(n + 5) { animation-delay: 0.32s; }
.rw-moment--recap.is-open .rw-week__stack { animation: rw-grow 0.9s 0.45s var(--ease-out) both; transform-origin: bottom; }
@keyframes rw-grow { from { transform: scaleY(0); } }
.rw-moment--recap.is-open .rw-moment__actions { animation-delay: 0.5s; }

/* landscape phones: the celebration sits beside its text */
@media (orientation: landscape) and (max-height: 500px) {
  .rw-moment__scroll { padding-top: calc(var(--sat) + 14px); padding-bottom: calc(var(--sab) + 12px); }
  .rw-cel { width: min(100%, 680px); display: grid; grid-template-columns: 220px minmax(0, 1fr); column-gap: 24px; text-align: left; align-items: center; }
  .rw-cel > * { grid-column: 2; justify-self: start; }
  .rw-cel > .rw-cel__stage, .rw-cel > .rw-gift { grid-column: 1; grid-row: 1 / span 6; justify-self: center; width: 220px; height: 220px; margin: 0; }
  .rw-cel__stage .medal { --size: 150px !important; }
  .rw-cel__name { justify-content: flex-start; font-size: 26px; }
  .rw-moment__actions { position: static; width: min(100%, 680px); margin-top: 14px; }
  .rw-moment__actions::before { display: none; }
}
/* short phones (iPhone SE): smaller stage so the buttons stay on screen */
@media (max-height: 700px) and (orientation: portrait) {
  .rw-cel__stage { width: 240px; height: 222px; }
  .is-big .rw-cel__stage { height: 238px; }
  .rw-cel__stage .medal { --size: 164px !important; }
  .is-big .rw-cel__stage .medal { --size: 176px !important; }
  .rw-cel__name { font-size: 26px; }
  .rw-cel__line { margin-top: 12px; font-size: 16.5px; }
  .rw-gift { width: 170px; height: 170px; }
  .rw-gift__box, .rw-gift__reveal { font-size: 92px; }
  .rw-recapm__total b { font-size: 54px; }
  .rw-week--big { --h: 76px; }
}

/* ---------------------------------------------------------------- reduced motion */
/* No drop-ins, sweeps, wiggles or bursts: every moment renders in its final, still state at once
   (the global rule in app.css only shortens durations, but our entrances also have delays). */
@media (prefers-reduced-motion: reduce) {
  .rw-moment *, .rw-moment *::before, .rw-moment *::after,
  .rw-rrow *, .rw-rrow::after, .rw-cheer__emoji, .rw-ed__preview { animation: none !important; }
  .rw-cel__rays { opacity: 1; }
  .rw-cel__ring, .rw-burst, .rw-fireworks, .medal__shine { display: none !important; }
  .rw-rrow.is-unlocked::after { display: none; }
  .rw-gift__box { display: none; }
  .rw-gift__reveal { opacity: 1; }
  .rw-gift__glow { opacity: 1; }
}
.rw-moment.is-still *, .rw-moment.is-still *::before, .rw-moment.is-still *::after { animation: none !important; }
.rw-moment.is-still .rw-cel__ring, .rw-moment.is-still .medal__shine { display: none; }
.rw-moment.is-still .rw-cel__rays { opacity: 1; }
.rw-moment.is-still .rw-gift__box { display: none; }
.rw-moment.is-still .rw-gift__reveal { opacity: 1; }
