/* ===================================================================================================================
   Royal letters from the painted art (9 Nov 2026): client/img/letters/ (frames in four colours, buttons, ribbons,
   panel, seal, icons; cut by art/source/letters/cut-letters.py). royalLetter() in app.js builds them.
   The letter is laid out in stage units (820 wide) and scaled with the phone (scale: S).
   =================================================================================================================== */
.rl-shade { position: fixed; inset: 0; z-index: 135; display: flex; align-items: center; justify-content: center; overflow: hidden; background: rgba(10, 4, 24, .66); animation: rlShadeIn .3s ease-out both; }
.rl-shade.closing { animation: rlShadeOut .3s ease-in both; }
.rl { position: relative; flex: none; width: 820px; aspect-ratio: 1400 / 948; transform-origin: 50% 50%; animation: rlOpen .62s cubic-bezier(.2, 1.2, .35, 1) both; }
.rl.closing { animation: rlClose .3s ease-in both; }
.rl-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; user-select: none; } /* no filter on the big picture: it is slow on phones */
.rl-seal { position: absolute; left: 50%; top: 79.5%; width: 9.6%; transform: translateX(-50%); pointer-events: none; animation: rlStamp .5s .42s cubic-bezier(.2, 1.6, .4, 1) both; filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .45)); }
.rl-title { position: absolute; left: 27%; right: 27%; top: 10.2%; height: 11.5%; display: grid; place-items: center; text-align: center;
  font: 900 34px/1 'Cinzel', serif; letter-spacing: .02em; color: #ffe9a6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 2px 0 #3d0508, 0 3px 6px rgba(0, 0, 0, .55), 0 0 14px rgba(255, 210, 110, .35); animation: rlFade .4s .3s ease-out both; }
.rl-title.long { font-size: 27px; }
.rl-close { position: absolute; right: 2.4%; top: 6%; width: 8.4%; aspect-ratio: 1; padding: 0; border: 0; background: url(img/letters/close.webp) center / contain no-repeat; cursor: pointer; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .5)); animation: rlFade .3s .5s ease-out both; }
.rl-close:active { transform: scale(.92); }
.rl-body { position: absolute; left: 12.5%; right: 12.5%; top: 24.5%; bottom: 20%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; color: #4a2508; }
.rl-body.side { flex-direction: row; gap: 22px; text-align: left; }
.rl-body.side .rl-col { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; flex: 1; min-width: 0; }
.rl-icon { position: relative; z-index: 0; flex: none; display: grid; place-items: center; animation: rlPop .55s .35s cubic-bezier(.2, 1.7, .4, 1) both; }
.rl-icon img { display: block; height: 118px; width: auto; filter: drop-shadow(0 6px 8px rgba(70, 30, 0, .4)); }
.rl-icon.big img { height: 150px; }
.rl-icon .rl-emoji { font-size: 66px; line-height: 1; filter: drop-shadow(0 4px 4px rgba(70, 30, 0, .35)); }
.rl-icon::before { content: ''; position: absolute; left: 50%; top: 50%; width: 230px; height: 230px; margin: -115px 0 0 -115px; border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 236, 160, .75) 0%, rgba(255, 214, 102, .35) 35%, transparent 68%); animation: rlGlow 2.4s ease-in-out infinite; } /* light, not a spinning mask: cheap on phones */
.rl-icon .rl-level { position: absolute; left: 0; right: 0; top: 30%; text-align: center; font: 900 40px/1 'Cinzel', serif; color: #ffe9a6; text-shadow: 0 2px 0 #2a0a3a, 0 0 8px rgba(0, 0, 0, .5); }
.rl-icon .rl-level small { display: block; font-size: 14px; letter-spacing: .08em; }
.rl-banner { position: relative; z-index: 1; margin-top: -26px; min-width: 300px; padding: 10px 52px 16px; background: url(img/letters/ribbon-red.webp) center / 100% 100% no-repeat;
  font: 900 34px/1 'Cinzel', serif; color: #ffe9a6; text-shadow: 0 2px 0 #3d0508, 0 0 10px rgba(255, 210, 110, .4); animation: rlPop .5s .55s cubic-bezier(.2, 1.6, .4, 1) both; }
.rl-banner.purple { background-image: url(img/letters/ribbon-purple.webp); text-shadow: 0 2px 0 #24063a; }
.rl-banner.small { font-size: 22px; padding: 7px 40px 11px; min-width: 220px; margin-top: -18px; }
.rl-heading { font: 900 32px/1.1 'Cinzel', serif; color: #6e1208; text-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
.rl-text { font: 600 19px/1.4 Georgia, 'Times New Roman', serif; color: #4a2508; max-width: 560px; }
.rl-text b { color: #7a1810; }
.rl-rewards { position: relative; display: flex; justify-content: center; min-width: 380px; padding: 12px 18px 10px; background: url(img/letters/panel-purple.webp) center / 100% 100% no-repeat; }
.rl-rewards .rl-r { display: flex; flex-direction: column; align-items: center; min-width: 120px; padding: 0 10px; color: #fff3c8; font: 900 23px/1.1 'Cinzel', serif; text-shadow: 0 2px 0 #2a0a3a; animation: rlPop .45s cubic-bezier(.2, 1.7, .4, 1) both; }
.rl-rewards .rl-r + .rl-r { border-left: 1px solid rgba(255, 220, 150, .35); }
.rl-rewards .rl-r img { height: 50px; width: auto; margin-bottom: 2px; }
.rl-rewards .rl-r .rl-r-emoji { font-size: 40px; line-height: 1.15; }
.rl-rewards .rl-r small { font: 700 13px/1.2 Georgia, serif; color: #e8d6ff; text-shadow: none; }
.rl-info { display: flex; width: 100%; max-width: 560px; border-radius: 12px; background: rgba(255, 248, 228, .55); box-shadow: inset 0 0 0 2px rgba(196, 150, 70, .6); }
.rl-info > div { flex: 1; padding: 8px 12px; display: flex; gap: 10px; align-items: center; text-align: left; font: 700 15px/1.25 Georgia, serif; color: #6b4520; }
.rl-info > div + div { border-left: 1px solid rgba(160, 110, 40, .45); }
.rl-info b { display: block; font: 900 19px 'Cinzel', serif; color: #4a2508; }
.rl-info .rl-i-ico { font-size: 28px; }
.rl-actions { display: flex; justify-content: center; gap: 22px; margin-top: 4px; }
.rl-btn { position: relative; width: 250px; height: 74px; padding: 0 22px 4px; border: 0; background: url(img/letters/btn-red.webp) center / 100% 100% no-repeat; cursor: pointer;
  font: 900 25px/1 'Cinzel', serif; letter-spacing: .02em; color: #fff3c8; text-shadow: 0 2px 0 #3d0508, 0 0 8px rgba(0, 0, 0, .35); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35)); white-space: nowrap; animation: rlPop .45s .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.rl-btn + .rl-btn { animation-delay: .7s; }
.rl-btn:active { transform: translateY(3px) scale(.98); }
.rl-btn.purple { background-image: url(img/letters/btn-purple.webp); text-shadow: 0 2px 0 #24063a; }
.rl-btn.blue { background-image: url(img/letters/btn-blue.webp); text-shadow: 0 2px 0 #08204a; }
.rl-btn.green { background-image: url(img/letters/btn-green.webp); text-shadow: 0 2px 0 #06380f; }
.rl-btn.parchment { background-image: url(img/letters/btn-parchment.webp); color: #5a3410; text-shadow: 0 1px 0 rgba(255, 255, 255, .7); }
.rl-btn:disabled { opacity: .55; cursor: default; }
.rl-quill { position: absolute; right: 3%; bottom: 13%; width: 9%; pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .4)); animation: rlFade .4s .6s ease-out both; }
.rl-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: 40px; }
.rl-confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: rlFall 2.6s linear infinite; }

@keyframes rlShadeIn { from { background: rgba(10, 4, 24, 0); } }
@keyframes rlShadeOut { to { background: rgba(10, 4, 24, 0); } }
@keyframes rlOpen {
  0% { opacity: 0; transform: perspective(1200px) rotateX(-70deg) scale(.55) translateY(-60px); }
  55% { opacity: 1; transform: perspective(1200px) rotateX(8deg) scale(1.03); }
  78% { transform: perspective(1200px) rotateX(-2deg) scale(.995); }
  100% { opacity: 1; transform: none; }
}
@keyframes rlClose { to { opacity: 0; transform: perspective(1200px) rotateX(70deg) scale(.6) translateY(-40px); } }
@keyframes rlStamp { 0% { opacity: 0; transform: translateX(-50%) scale(2.4) rotate(-25deg); } 70% { opacity: 1; transform: translateX(-50%) scale(.88) rotate(5deg); } 100% { opacity: 1; transform: translateX(-50%) scale(1) rotate(0); } }
@keyframes rlFade { from { opacity: 0; transform: translateY(-6px); } }
@keyframes rlPop { 0% { opacity: 0; transform: scale(.3); } 100% { opacity: 1; transform: scale(1); } }
@keyframes rlSpin { to { transform: rotate(360deg); } }
@keyframes rlGlow { 0%, 100% { opacity: .75; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes rlFall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(620px) rotate(540deg); opacity: .2; } }
@media (prefers-reduced-motion: reduce) {
  .rl, .rl-shade, .rl-seal, .rl-title, .rl-close, .rl-icon, .rl-icon::before, .rl-banner, .rl-rewards .rl-r, .rl-btn, .rl-quill, .rl-confetti i { animation: none !important; }
  .rl.closing { opacity: 0; }
}

/* the notification scroll and the in-match plaque use the painted seal and shields */
.note.letter .n-ico { background: url(img/letters/seal.webp) center / contain no-repeat !important; box-shadow: none !important; border-radius: 0; width: 64px; height: 70px; margin-top: -36px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4)); }
.note.letter .n-ico::before { display: none; }
.note.letter .n-ico i { position: absolute; right: -8px; bottom: -2px; width: 30px; height: 30px; display: grid; place-items: center; font-size: 17px; border-radius: 50%; background: #fff6dc; box-shadow: 0 0 0 2px #b07818, 0 2px 4px rgba(0, 0, 0, .35); }
.toast.letter .t-ico { clip-path: none; width: 42px; height: 42px; background: url(img/letters/icon-shield-won.webp) center / contain no-repeat !important; font-size: 0; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.toast.letter.nt-reward .t-ico, .toast.letter.nt-success .t-ico { background-image: url(img/letters/icon-shield-success.webp) !important; }
.toast.letter.nt-err .t-ico, .toast.letter.nt-warn .t-ico { background-image: url(img/letters/icon-shield-alert.webp) !important; }

/* a letter with the icon on the left fits more: the match result letter */
.rl-body.side .rl-banner { margin-top: 0; }
.rl-body.side .rl-icon.big img { height: 170px; }
.rl-body.side .rl-actions { justify-content: flex-start; gap: 14px; }
.rl-body.side .rl-btn { width: 210px; height: 66px; font-size: 22px; }
.rl-body.side .rl-rewards { min-width: 0; }

/* Welcome letter: the sign-in choices one above the other */
.rl-actions.stack { flex-direction: column; align-items: center; gap: 8px; }
.rl-actions.stack .rl-btn { width: 340px; height: 58px; font-size: 21px; }

/* ===== Login / Register page (9 Nov 2026) ===== */
.login-page { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, rgba(90, 40, 160, .55), rgba(10, 4, 30, .92) 70%), url(img/home-royal.webp) center / cover no-repeat; animation: lpIn .45s ease-out both; }
.login-page.closing { animation: lpOut .38s ease-in both; }
.lp-sparks i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #ffe08a; box-shadow: 0 0 10px 3px rgba(255, 216, 102, .8); opacity: 0; animation: lpSpark 3.2s ease-in-out infinite; }
.lp-char { position: absolute; bottom: -2%; height: 62vh; max-height: 520px; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .6)); pointer-events: none; animation: lpChar .9s cubic-bezier(.2, 1.2, .35, 1) both; }
.lp-char.l1 { left: 1%; animation-delay: .15s; } .lp-char.l2 { left: 15%; height: 50vh; animation-delay: .3s; }
.lp-char.r1 { right: 15%; height: 50vh; animation-delay: .3s; } .lp-char.r2 { right: 1%; animation-delay: .15s; }
.lp-card { position: relative; z-index: 2; width: 440px; max-width: 86vw; box-sizing: border-box; padding: 26px 30px 22px; text-align: center; border-radius: 26px;
  border: 4px solid transparent; transform-origin: 50% 50%;
  background: linear-gradient(180deg, rgba(58, 26, 122, .96), rgba(24, 9, 64, .97)) padding-box, linear-gradient(160deg, #fff1b8, #e2ad3c 25%, #8a5a12 50%, #f8dc84 72%, #b07818) border-box;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .65), 0 0 40px rgba(255, 216, 102, .25); animation: lpCard .7s .1s cubic-bezier(.2, 1.3, .35, 1) both; }
.lp-logo { width: 215px; max-width: 70%; margin: -78px auto 2px; display: block; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .6)); animation: lpLogo 3.5s ease-in-out infinite; }
.lp-card h1 { margin: 2px 0 6px; font: 900 25px/1.15 'Cinzel', serif; background: linear-gradient(180deg, #fff6c8, #ffd866 50%, #e0a020); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-card p { margin: 0 0 16px; font: 500 15px/1.4 system-ui, sans-serif; color: #e6dcff; }
.lp-btns { display: flex; flex-direction: column; gap: 10px; }
.lp-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 54px; border: 0; border-radius: 14px; cursor: pointer; font: 700 17px system-ui, sans-serif; box-shadow: 0 5px 0 rgba(0, 0, 0, .3), 0 8px 18px rgba(0, 0, 0, .35); transition: transform .1s ease; animation: lpBtn .5s both; }
.lp-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.lp-btn.google { background: #fff; color: #3c4043; animation-delay: .5s; }
.lp-btn.facebook { background: #1877f2; color: #fff; animation-delay: .6s; }
.lp-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; color: #b9a8e6; font: 600 13px system-ui, sans-serif; }
.lp-or::before, .lp-or::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #c9a45a, transparent); }
.lp-guest { width: 100%; height: 46px; border-radius: 14px; border: 2px solid #c9a45a; background: rgba(255, 216, 102, .08); color: #ffe08a; font: 400 19px Lilita, system-ui, sans-serif; letter-spacing: .03em; cursor: pointer; animation: lpBtn .5s .7s both; }
.lp-guest:active { background: rgba(255, 216, 102, .2); }
.lp-note { display: block; margin-top: 12px; font: 500 12.5px/1.3 system-ui, sans-serif; color: #a99bd6; }
@keyframes lpIn { from { opacity: 0; } }
@keyframes lpOut { to { opacity: 0; transform: scale(1.04); } }
@keyframes lpCard { 0% { opacity: 0; transform: translateY(40px) scale(.9); } 100% { opacity: 1; transform: none; } }
@keyframes lpLogo { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes lpChar { 0% { opacity: 0; transform: translateY(60px); } 100% { opacity: 1; transform: none; } }
@keyframes lpBtn { 0% { opacity: 0; transform: translateY(12px); } 100% { opacity: 1; transform: none; } }
@keyframes lpSpark { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: 1; transform: scale(1); } }
@media (max-height: 460px) { .lp-char { height: 70vh; } .lp-card { padding: 18px 26px 16px; } .lp-card p { margin-bottom: 10px; } }
@media (prefers-reduced-motion: reduce) { .login-page, .lp-card, .lp-logo, .lp-char, .lp-btn, .lp-guest, .lp-sparks i { animation: none !important; } }

/* ===== The app tour and the first-match coach (9 Nov 2026) ===== */
.tour { position: fixed; inset: 0; z-index: 150; animation: lpIn .3s ease-out both; }
.tour.closing { animation: lpOut .3s ease-in both; }
.tour-hole { position: fixed; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(8, 3, 26, .78), 0 0 0 3px #ffe08a, 0 0 26px 8px rgba(255, 216, 102, .7); transition: all .35s cubic-bezier(.3, 1.2, .4, 1); pointer-events: none; }
.tour-card { position: fixed; width: 360px; box-sizing: border-box; padding: 18px 20px 14px; border-radius: 20px; border: 4px solid transparent; color: #f4ecff;
  background: linear-gradient(180deg, rgba(58, 26, 122, .98), rgba(24, 9, 64, .98)) padding-box, linear-gradient(160deg, #fff1b8, #e2ad3c 25%, #8a5a12 50%, #f8dc84 72%, #b07818) border-box;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .6); transition: left .35s ease, top .35s ease; }
.tour-card.pop { animation: rcPop .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.tour-title { display: block; font: 900 21px/1.2 'Cinzel', serif; color: #ffd866; margin-bottom: 6px; }
.tour-text { margin: 0 0 10px; font: 500 15px/1.4 system-ui, sans-serif; color: #f4ecff; }
.tour-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; }
.tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .25); }
.tour-dots i.on { background: #ffd866; box-shadow: 0 0 8px #ffd866; }
.tour-btns { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.tour-btns .pill-btn { margin-right: auto; }
.tour-btns .pill-btn + .pill-btn { margin-right: 0; }
.coach { position: absolute; left: 50%; top: 34%; z-index: 30; transform: translateX(-50%); width: min(430px, 44vw); box-sizing: border-box; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 16px;
  background: linear-gradient(180deg, #fff3cf, #f2d99a); color: #3a1d00; border: 3px solid #b07818; box-shadow: 0 10px 24px rgba(0, 0, 0, .5); font: 500 14px/1.3 system-ui, sans-serif; pointer-events: none; }
.coach b { color: #7a2a00; }
.coach-ico { font-size: 30px; flex: none; }
.coach.pop { animation: coachIn .45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes coachIn { 0% { opacity: 0; transform: translate(-50%, -16px) scale(.9); } 100% { opacity: 1; transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .tour, .tour-card, .coach, .tour-hole { animation: none !important; transition: none !important; } }

/* Reward pictures on the reward letter (12 Nov 2026): the prize itself instead of the treasure chest. */
.rl-icon img.rl-pic.card { height: 128px; border-radius: 10px; box-shadow: 0 6px 14px rgba(70, 30, 0, .45); }
.rl-icon img.rl-pic.round { height: 120px; border-radius: 50%; box-shadow: 0 0 0 4px #f2c75a, 0 0 0 7px #6b3d06, 0 6px 14px rgba(70, 30, 0, .45); }
.rl-icon .rl-emoji { font-size: 88px; }
.rl-say { display: inline-block; max-width: 340px; margin-bottom: 16px; padding: 12px 20px; border-radius: 20px; background: linear-gradient(180deg, #fffaf0, #f3e2b8); box-shadow: 0 0 0 3px #b07818, 0 6px 14px rgba(70, 30, 0, .4);
  font: 800 24px/1.2 Georgia, serif; color: #4a2400; position: relative; }
.rl-say::after { content: ''; position: absolute; left: 34px; bottom: -14px; border: 9px solid transparent; border-top: 14px solid #b07818; border-bottom: 0; }
.rl-rewards .rl-r img.rl-r-pic { height: 54px; }
.rl-rewards .rl-r img.rl-r-pic.card { height: 64px; border-radius: 5px; }
.rl-rewards .rl-r img.rl-r-pic.round { height: 50px; border-radius: 50%; box-shadow: 0 0 0 2px #f2c75a; }
.rl-rewards .rl-r .rl-say { font-size: 14px; padding: 6px 10px; max-width: 150px; border-radius: 12px; }
.rl-rewards .rl-r .rl-say::after { display: none; }
.rl-rewards .rl-r { min-width: 96px; }
.rl-rewards .rl-r small { white-space: nowrap; }
