/* Indicar amigos (client/js/referral.js). Latão e areia; nada de brilho: destaque por cor, moldura e movimento. */
.rf-body { display: flex; flex-direction: column; gap: 12px; }
.rf-body > * { flex: none; }
.rf-body h3 { margin: 0; color: var(--brass2); font: 700 14px Cinzel, serif; letter-spacing: .02em; }
.rf-hg { display: inline-grid; place-items: center; width: 1em; height: 1em; vertical-align: -.12em; color: #e8c37a; }
.rf-hg svg { width: 100%; height: 100%; }
.rf-amt { display: inline-flex; align-items: center; gap: 3px; color: #f0d08c; font-weight: 700; white-space: nowrap; }

/* ---------------------------------------------------------------- topo: ampulheta animada + números */
.rf-hero {
  position: relative; display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; align-items: center;
  padding: 14px 16px; border: 1px solid #6b5230; border-radius: 4px; overflow: hidden;
  background: radial-gradient(ellipse at 12% 40%, #4a311d, transparent 62%), linear-gradient(160deg, #221619, #130d10);
}
.rf-hero::after {   /* engrenagem gravada ao fundo */
  content: ''; position: absolute; right: -46px; bottom: -60px; width: 190px; height: 190px; border-radius: 50%;
  border: 14px dashed #b8893f1c; animation: rf-gear 40s linear infinite; pointer-events: none;
}
@keyframes rf-gear { to { transform: rotate(360deg); } }
.rf-hero-info { position: relative; z-index: 1; display: grid; gap: 8px; min-width: 0; }
.rf-hero h2 { margin: 0; color: #f3d28d; font: 700 clamp(16px, 2.3vw, 21px) Cinzel, serif; }
.rf-hero p { margin: 0; color: #c9b9a6; }
.rf-glass { width: 100%; max-width: 110px; justify-self: center; }
.rf-glass svg { display: block; width: 100%; height: auto; overflow: visible; }
.rf-flip { transform-origin: 40px 60px; animation: rf-flip 7s ease-in-out infinite; }
.rf-sand-top { animation: rf-drain 7s linear infinite; }
.rf-sand-bot { animation: rf-fillup 7s linear infinite; }
.rf-stream { animation: rf-stream 7s linear infinite, rf-pour .45s linear infinite; }
@keyframes rf-flip { 0%, 86% { transform: rotate(0); } 100% { transform: rotate(180deg); } }
@keyframes rf-drain { 0% { transform: translateY(0); } 84%, 100% { transform: translateY(48px); } }
@keyframes rf-fillup { 0% { transform: translateY(48px); } 84%, 100% { transform: translateY(0); } }
@keyframes rf-stream { 0%, 82% { opacity: 1; } 84%, 100% { opacity: 0; } }
@keyframes rf-pour { to { stroke-dashoffset: -11; } }
.rf-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rf-stat { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid #5a4528; border-radius: 3px; background: #0f0a0dcc; min-width: 0; }
.rf-stat small { color: var(--muted); font-size: 12px; line-height: 1.15; }
.rf-num { display: flex; align-items: center; gap: 5px; color: #f3d28d; font: 700 22px Cinzel, serif; line-height: 1; font-variant-numeric: tabular-nums; }
.rf-stat.ready .rf-num { color: #9fd36a; }
.rf-stat.people .rf-num { color: var(--text); }
.rf-stat.rolling .rf-num { animation: rf-pop .25s ease-out 4 alternate; }
@keyframes rf-pop { to { transform: scale(1.12); } }

/* ---------------------------------------------------------------- convite: código, link, QR */
.rf-invite {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px 14px; border: 1px solid #6b5230; border-radius: 4px; background: linear-gradient(140deg, #2e1f17, #160f12 70%);
}
.rf-invite-main { display: grid; gap: 9px; min-width: 0; }
.rf-code { display: flex; gap: 6px; perspective: 400px; }
.rf-tile {
  display: grid; place-items: center; width: 38px; height: 48px; border: 1px solid #2a1a08; border-radius: 4px;
  background: linear-gradient(180deg, #3a2a1e 0 49%, #120c0f 50%, #2a1d16 100%); color: #ffe6a8;
  font: 700 26px Cinzel, serif; box-shadow: inset 0 0 0 1px #b8893f55, 0 3px 6px #0008;
  animation: rf-tile-in .55s cubic-bezier(.3, 1.4, .5, 1) both; transform-origin: 50% 50%;
}
@keyframes rf-tile-in { from { transform: rotateX(-90deg); opacity: 0; } to { transform: rotateX(0); opacity: 1; } }
.rf-link { display: flex; gap: 6px; min-width: 0; }
.rf-link input { flex: 1; min-width: 0; color: #e6d6b4; font-size: 14px; }
.rf-link .btn.done { background: linear-gradient(180deg, #4f7a2e, #2f4f1a); }
.rf-share { display: flex; flex-wrap: wrap; gap: 6px; }
.rf-share a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.rf-qr { display: grid; justify-items: center; gap: 4px; }
.rf-qr svg { width: 112px; height: 112px; background: #f3e6c8; border: 4px solid #f3e6c8; border-radius: 3px; outline: 1px solid #6b5230; }
.rf-qr small { color: var(--muted); font-size: 11px; }

/* ---------------------------------------------------------------- convidado por / usar código */
.rf-invited { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 9px 12px; border: 1px dashed #6b5230; border-radius: 4px; background: #150f12; }
.rf-invited-txt { display: flex; gap: 6px; align-items: baseline; color: #c9b9a6; }
.rf-invited-txt b { color: #f3d28d; font-family: Cinzel, serif; }
.rf-invited.enter input { width: 110px; text-transform: uppercase; letter-spacing: .12em; font-family: Cinzel, serif; }
.rf-invited small { flex-basis: auto; }

/* ---------------------------------------------------------------- trilha de marcos */
.rf-road { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid #5a4528; border-radius: 4px; background: #140e11; }
.rf-road-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.rf-road-total { display: inline-flex; align-items: center; gap: 5px; color: #c9b9a6; font-size: 14px; }
.rf-road-list { position: relative; list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.rf-road-list::before { content: ''; position: absolute; left: 7%; right: 7%; top: 21px; height: 2px; background: repeating-linear-gradient(90deg, #8a6428 0 8px, transparent 8px 13px); }
.rf-stop { position: relative; display: grid; justify-items: center; gap: 3px; text-align: center; animation: rf-stop-in .5s ease-out both; animation-delay: calc(var(--i) * 80ms); }
@keyframes rf-stop-in { from { transform: translateY(10px); opacity: 0; } }
.rf-coin {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 2px solid #8a6428;
  background: radial-gradient(circle at 40% 35%, #3e2b1d, #1a1114); font-size: 22px;
}
.rf-stop:nth-child(n+5) .rf-coin { border-color: #b8893f; }
.rf-stop:last-child .rf-coin { width: 50px; height: 50px; margin-top: -3px; border-color: #e0b764; font-size: 26px; background: radial-gradient(circle at 40% 35%, #5a3e22, #22160f); }
.rf-stop:hover .rf-coin .rf-hg { animation: rf-turn .8s ease-in-out; }
@keyframes rf-turn { to { transform: rotate(180deg); } }
.rf-stop-lvl { color: var(--muted); font: 700 12px Cinzel, serif; white-space: nowrap; letter-spacing: -.02em; }
.rf-stop .rf-amt { font-size: 14px; }
.rf-stop-prem { display: inline-flex; align-items: center; gap: 2px; color: #d9a8ff; font: 700 10px Cinzel, serif; }
.rf-crown { display: inline-grid; width: 12px; height: 12px; color: #d9a8ff; }
.rf-crown svg { width: 100%; height: 100%; }
.rf-stop.prem .rf-coin { border-color: #a24ae0; }
.rf-node.prem { border-color: #6a3f8a; }
.rf-node.prem.got { background: #8a6428; border-color: #8a6428; }
.rf-node.prem.ready { border-color: #f0d08c; }
.rf-rules { margin: 0; padding: 8px 0 0; list-style: none; display: grid; gap: 4px; border-top: 1px solid #3a2c1c; color: var(--muted); font-size: 13px; }
.rf-rules li { display: flex; align-items: center; gap: 5px; }
.rf-rules li:not(:has(.rf-crown))::before { content: '•'; color: #8a6428; width: 12px; text-align: center; }
.rf-road-gift { margin: 0; color: #c9b9a6; font-size: 13px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- amigos */
.rf-friends { display: grid; gap: 8px; }
.rf-friends-head { display: flex; justify-content: space-between; align-items: baseline; }
.rf-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rf-friend {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid #4d3a24; border-radius: 4px; background: linear-gradient(180deg, #1d1519, #140e11);
  animation: rf-stop-in .4s ease-out both;
}
.rf-friend.has-ready { border-color: #9a7438; background: linear-gradient(180deg, #2a1d15, #160f10); }
.rf-face { width: 56px; height: 56px; border-radius: 50%; border: 2px solid #6b5230; background: radial-gradient(circle at 50% 35%, #3a2a24, #120c0f); }
.rf-friend.has-ready .rf-face { border-color: #e0b764; }
.rf-mid { display: grid; gap: 6px; min-width: 0; }
.rf-who { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.rf-name { color: var(--text); font: 700 15px Cinzel, serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-meta { display: flex; align-items: center; gap: 6px; flex: none; }
.rf-lvl { color: #f3d28d; font: 700 13px Cinzel, serif; }
.rf-online { width: 8px; height: 8px; border-radius: 50%; background: #5fbf4a; border: 1px solid #1b3a12; }
.rf-track { position: relative; height: 22px; margin: 0 11px 0 0; }
.rf-track::before { content: ''; position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: #2c2024; box-shadow: inset 0 1px 1px #0008; }
.rf-fill {
  position: absolute; left: 0; top: 9px; height: 4px; width: var(--p); border-radius: 2px;
  background: repeating-linear-gradient(110deg, #c9963f 0 6px, #e8c37a 6px 12px); background-size: 24px 4px;
  animation: rf-grow 1.1s cubic-bezier(.2, .8, .3, 1) both, rf-sandflow 1.2s linear infinite;
}
@keyframes rf-grow { from { width: 0; } }
@keyframes rf-sandflow { to { background-position: 24px 0; } }
.rf-node {
  position: absolute; top: 0; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%;
  display: grid; place-items: center; border: 2px solid #4d3a24; background: #1a1215; color: #7d6d55; font: 700 9px Cinzel, serif;
}
.rf-node i { font-style: normal; line-height: 1; }
.rf-node.next { border-color: #8a6428; color: var(--brass2); border-style: dashed; }
.rf-node.got { border-color: #8a6428; background: #8a6428; color: #1a1114; font-size: 12px; }
.rf-node.ready { border-color: #f0d08c; background: #e8c37a; color: #2a1a08; animation: rf-hop 1.1s ease-in-out infinite; }
.rf-node.held { border-color: #6b5230; background: #3a2a1e; color: #a8987a; }
@keyframes rf-hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
.rf-note { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.rf-note.ok { color: #9fd36a; }
.rf-note.warn { color: #d49a5a; }
.rf-friend .btn { min-width: 108px; }

.rf-empty { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rf-step { display: grid; justify-items: center; gap: 6px; padding: 14px 10px; text-align: center; border: 1px dashed #5a4528; border-radius: 4px; color: #c9b9a6; }
.rf-step b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid #8a6428; color: #f3d28d; font: 700 15px Cinzel, serif; }

/* ---------------------------------------------------------------- rodapé */
.rf-claimbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.rf-claimtxt { display: grid; gap: 1px; min-width: 0; }
.rf-claimtxt strong { display: flex; align-items: center; gap: 6px; color: var(--brass2); font: 700 14px Cinzel, serif; }
.rf-claimtxt small { color: #a8987a; }
.rf-claimtxt small.rf-msg { color: var(--brass2); }
.rf-claimbar .btn { flex: 0 0 auto; }

/* ---------------------------------------------------------------- menu: ponto de "tem prêmio" */
#menu button[data-p="referral"] { position: relative; }
#menu button.rf-badge::after {
  content: ''; position: absolute; top: 6px; right: 8px; width: 9px; height: 9px; border-radius: 50%;
  background: #e8c37a; border: 2px solid #1a1114; animation: rf-hop 1.4s ease-in-out infinite;
}

/* ---------------------------------------------------------------- festa do resgate */
.rf-fx { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }
.rf-fly { position: fixed; width: 26px; height: 26px; color: #f0d08c; filter: drop-shadow(0 2px 2px #000a); }
.rf-grain { position: fixed; width: 5px; height: 5px; border-radius: 1px; background: #e8c37a; }
.rf-grain:nth-child(3n) { background: #b9873e; width: 4px; height: 4px; }
.rf-fx-total {
  position: fixed; transform: translate(-50%, -50%); padding: 6px 14px; border: 1px solid #8a6428; border-radius: 4px;
  background: #1a1114ee; font: 700 26px Cinzel, serif; animation: rf-total 1.5s ease-out forwards;
}
.rf-fx-total .rf-amt { color: #f3d28d; }
@keyframes rf-total {
  0% { transform: translate(-50%, -30%) scale(.5); opacity: 0; }
  18% { transform: translate(-50%, -120%) scale(1.15); opacity: 1; }
  70% { transform: translate(-50%, -150%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -190%) scale(.9); opacity: 0; }
}
.pc-res .hg.rf-bump { animation: rf-bump .3s ease-out; }
.pc-res .hg.rf-bump b { color: #f3d28d; }
@keyframes rf-bump { 40% { transform: scale(1.3); } }
.pc-res .hg { display: inline-block; }

@media (max-width: 760px), (max-width: 1000px) and (max-height: 520px), (max-width: 1100px) and (pointer: coarse) {
  .rf-hero { grid-template-columns: 70px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .rf-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .rf-num { font-size: 17px; }
  .rf-invite { grid-template-columns: minmax(0, 1fr); }
  .rf-qr { display: none; }
  .rf-tile { width: 32px; height: 42px; font-size: 22px; }
  .rf-coin { width: 34px; height: 34px; font-size: 17px; }
  .rf-stop:last-child .rf-coin { width: 38px; height: 38px; font-size: 20px; }
  .rf-road-list::before { top: 16px; }
  .rf-friend { grid-template-columns: 44px minmax(0, 1fr); }
  .rf-face { width: 44px; height: 44px; }
  .rf-friend .btn { grid-column: 1 / -1; }
  .rf-empty { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .rf-flip, .rf-sand-top, .rf-sand-bot, .rf-stream, .rf-hero::after, .rf-node.ready, .rf-fill, .rf-tile, .rf-stop, .rf-friend, #menu button.rf-badge::after { animation: none; }
}
