/* Legacy — sapphires (sapphire.js): the wallet chip, the shop, daily challenges and the sapphire titles. Shop grids
   hold still (rings drawn without their animation, canvases frozen by rankfx.js, CSS paused); only the item you tap
   moves, so phones stay smooth. */
.sp-chip { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-variant-numeric: tabular-nums; padding: 2px 9px 2px 6px; border-radius: 99px;
  color: #fff; background: linear-gradient(135deg, #2f6bff, #0b2a7a); box-shadow: 0 2px 8px rgb(47 107 255 / .35), inset 0 1px 0 rgb(255 255 255 / .3); }
.sp-chip i { font-style: normal; }
.sp-wallet { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sp-wallet > span:not(.sp-chip) { flex: 1; min-width: 140px; font-size: 12.5px; opacity: .75; }
.sp-wallet .sp-chip { font-size: 18px; padding: 4px 12px 4px 8px; }
.sp-cats { margin-bottom: 10px; }
.sp-th { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; }
.sp-th small { opacity: .75; font-weight: 700; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 9px; }
.sp-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border-radius: 12px; font: inherit; color: inherit; cursor: pointer; min-width: 0;
  background: var(--surface, #fff); border: 1px solid var(--line, #ddd); }
.sp-item b { font-size: 12px; line-height: 1.2; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-item small { font-size: 11px; opacity: .75; }
.sp-item.on { border-color: #2f6bff; box-shadow: 0 0 0 2px #2f6bff; }
.sp-item.owned small { color: #2fae5a; opacity: 1; font-weight: 700; }
.sp-t3, .sp-t4 { background: linear-gradient(180deg, color-mix(in srgb, #2f6bff 10%, var(--surface, #fff)), var(--surface, #fff)); }
.sp-t4 { border-color: color-mix(in srgb, #2f6bff 45%, transparent); }
.sp-prev { width: 100%; height: 72px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; position: relative; }
/* everything in the grid holds still; the selected one moves */
.sp-item:not(.on) .sp-prev * { animation-play-state: paused !important; }
.sp-ringp { width: 64px; height: 64px; position: relative; }
.sp-big .sp-ringp { width: 120px; height: 120px; }
.sp-ringp .av { width: 100%; height: 100%; }
.sp-ringp .pr-svg { position: absolute; inset: -18%; width: 136%; height: 136%; }
.sp-thp { width: 92px; height: 60px; display: block; position: relative; border-radius: 8px; background: linear-gradient(160deg, var(--a), var(--b)); }
.sp-big .sp-thp { width: 160px; height: 100px; }
.sp-thp em { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: 24px; }
.sp-namep { font-size: 20px; font-weight: 900; }
.sp-big .sp-namep { font-size: 30px; }
.sp-bnp { width: 100%; height: 100%; min-height: 64px; border-radius: 8px; overflow: hidden; position: relative; }
.sp-big .sp-bnp { min-height: 120px; }
.sp-bnp canvas.rkfx { position: absolute; inset: 0; width: 100%; height: 100%; }
.sp-gvp { width: 100%; height: 100%; min-height: 72px; transform: scale(.95); }
.sp-big .sp-gvp { min-height: 150px; }
.sp-detail { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px; margin-bottom: 6px; border-radius: 14px; border: 1px solid color-mix(in srgb, #2f6bff 40%, transparent); }
.sp-big { display: grid; place-items: center; min-height: 130px; border-radius: 10px; overflow: hidden; }
.sp-big .sp-bnp, .sp-big .sp-gvp { width: 100%; }
.sp-dtxt { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.sp-dtxt b { font-size: 16px; }
.sp-dtxt small { opacity: .75; }
.sp-wear { font-style: normal; font-weight: 800; color: #2fae5a; }
@media (max-width: 420px) { .sp-detail { grid-template-columns: 1fr; } .sp-dtxt { align-items: center; text-align: center; } }

/* daily challenges */
.sp-ch { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px; margin: 8px 0; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--dc) 40%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--dc) 10%, var(--surface, #fff)), var(--surface, #fff)); }
.sp-ch.ready { box-shadow: 0 0 0 2px var(--dc); }
.sp-ch.claimed { opacity: .6; }
.sp-ic { font-size: 24px; }
.sp-chtxt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sp-chtxt b { font-size: 13.5px; }
.sp-chtxt small { font-size: 11.5px; opacity: .8; }
.sp-diff { font-style: normal; font-weight: 800; color: var(--dc); }
.sp-bar { display: block; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--dc) 18%, transparent); overflow: hidden; }
.sp-bar i { display: block; height: 100%; border-radius: 99px; background: var(--dc); }
.sp-done { font-size: 20px; color: #2fae5a; font-weight: 900; }
.sp-bonus { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 12px; background: linear-gradient(90deg, #2f6bff22, #ff4f8022); font-weight: 700; }
.sp-bonus.claimed { opacity: .65; }
.sp-how { margin-top: 12px; }
.sp-how summary { cursor: pointer; font-weight: 700; font-size: 13px; }
.sp-fr b { font-variant-numeric: tabular-nums; }
.sp-tile small .sp-chip { font-size: 11px; padding: 0 7px 0 5px; }

/* sapphire titles: plain, then gradient, shine, glow, and a living rainbow at the top */
.rk-tag.sp-tag { color: #fff; background: var(--c2); border: 1px solid color-mix(in srgb, var(--c1) 60%, transparent); text-shadow: 0 1px 1px rgb(0 0 0 / .35); }
.rk-tag.sp-tt1, .rk-tag.sp-tt2, .rk-tag.sp-tt3, .rk-tag.sp-tt4 { background: linear-gradient(110deg, var(--c1), var(--c2)); }
.rk-tag.sp-tt2, .rk-tag.sp-tt3 { background-image: linear-gradient(100deg, transparent 40%, rgb(255 255 255 / .55) 50%, transparent 60%), linear-gradient(110deg, var(--c1), var(--c2)); background-size: 300% 100%, 100% 100%; animation: rkGlint 3.6s ease-in-out infinite; }
.rk-tag.sp-tt3 { box-shadow: 0 0 10px color-mix(in srgb, var(--c1) 60%, transparent); animation: rkGlint 2.8s ease-in-out infinite, spPulse 2.2s ease-in-out infinite; }
.rk-tag.sp-tt4 { background-image: linear-gradient(90deg, var(--c1), #ffffff, var(--c2), var(--c1)); background-size: 300% 100%; animation: rkSlide 3s linear infinite, spPulse 1.8s ease-in-out infinite; color: #0b1033; text-shadow: none; }
.rk-tag.sp-tt3 .rk-tg-ic, .rk-tag.sp-tt4 .rk-tg-ic { font-style: normal; animation: rkStar 2.4s ease-in-out infinite; display: inline-block; }
@keyframes spPulse { 50% { box-shadow: 0 0 16px color-mix(in srgb, var(--c1) 85%, transparent), 0 0 4px #fff; } }
@keyframes spGlow { 50% { filter: drop-shadow(0 1px 0 rgb(0 0 0 / .45)) drop-shadow(0 0 10px var(--spg)); } }
@media (prefers-reduced-motion: reduce) { .sp-tag, [class*="rk-nm-sp-"] { animation: none !important; } }

/* ---------- the extras: Age button skins, card frames, birth and death, diary styles, sound packs ---------- */
.sp-abp { border-radius: 50%; box-shadow: 0 2px 10px rgb(0 0 0 / .3); }
.sp-fxp, .sp-sdp { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 30px; background: radial-gradient(circle at 40% 35%, #cfe2ff, #2f6bff 60%, #0b1f4d); box-shadow: 0 4px 14px rgb(47 107 255 / .35); position: relative; }
.sp-fxp i, .sp-sdp i { font-style: normal; }
.sp-sdp small { position: absolute; right: 4px; top: 2px; font-size: 14px; color: #fff; }
.sp-fx-t3, .sp-fx-t4 { background: conic-gradient(from 0deg, #2f6bff, #b273ff, #ff5ec4, #ffd84a, #2f6bff); }
.sp-big .sp-fxp, .sp-big .sp-sdp { width: 110px; height: 110px; font-size: 52px; }
.sp-dyp { display: flex; flex-direction: column; justify-content: center; gap: 2px; width: 100%; height: 64px; padding: 6px 10px; border-radius: 6px; text-align: left; }
.sp-dyp, .modal.sp-dy .diary-e { background: var(--dy-paper); color: var(--dy-ink); font-family: var(--dy-font); }
.sp-dyp b { font-size: 13px; } .sp-dyp small { font-size: 11px; opacity: .8; }
.sp-big .sp-dyp { height: 110px; } .sp-big .sp-dyp b { font-size: 18px; }
.sp-dy-note, .modal.sp-dy-note .diary-e { background-image: repeating-linear-gradient(180deg, transparent 0 21px, rgb(30 58 138 / .15) 21px 22px); }
.sp-dy-parch, .modal.sp-dy-parch .diary-e { box-shadow: inset 0 0 18px rgb(120 80 20 / .35); }
.sp-dy-type, .modal.sp-dy-type .diary-e { letter-spacing: .02em; }
.sp-dy-leather, .modal.sp-dy-leather .diary-e { border: 2px dashed rgb(243 220 176 / .4); }
.sp-dy-gold, .modal.sp-dy-gold .diary-e { background-image: linear-gradient(100deg, transparent 40%, rgb(255 215 110 / .18) 50%, transparent 60%); background-size: 300% 100%; animation: rkGlint 5s ease-in-out infinite; border: 1px solid #b8860b; }
.sp-dy-starry, .modal.sp-dy-starry .diary-e { background-image: radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 60%, #fff, transparent), radial-gradient(1.5px 1.5px at 45% 80%, #cfe2ff, transparent), radial-gradient(1px 1px at 85% 20%, #fff, transparent); }
.sp-dy-codex, .modal.sp-dy-codex .diary-e { border: 1px solid #2f6bff; box-shadow: 0 0 12px rgb(47 107 255 / .45), inset 0 0 10px rgb(47 107 255 / .25); animation: spCodex 3s ease-in-out infinite; }
.sp-dy-royal, .modal.sp-dy-royal .diary-e { border: 3px double #5b21b6; }
@keyframes spCodex { 50% { box-shadow: 0 0 22px rgb(120 170 255 / .7), inset 0 0 14px rgb(47 107 255 / .35); } }
/* card frames, on remembrance cards (memorial.js): a border and a finish over the rarity colors */
.mc.mcf, .mc-big.mcf { border-width: 3px; }
.mcf-silver { border-color: transparent !important; background: linear-gradient(var(--surface, #fff), var(--surface, #fff)) padding-box, linear-gradient(135deg, #ffffff, #9aa4b1, #f4f6f8, #6b7480) border-box !important; }
.mcf-wood { background: linear-gradient(var(--surface, #fff), var(--surface, #fff)) padding-box, repeating-linear-gradient(45deg, #8a5a2a 0 4px, #6a3a14 4px 8px) border-box !important; }
.mcf-gilded { background: linear-gradient(var(--surface, #fff), var(--surface, #fff)) padding-box, linear-gradient(135deg, #fff4b8, #e3b22e, #8a5a00, #ffe58a) border-box !important; box-shadow: 0 0 12px rgb(227 178 46 / .45); }
.mcf-neon { background: linear-gradient(var(--surface, #fff), var(--surface, #fff)) padding-box, linear-gradient(135deg, #ff2bd6, #22e4ff) border-box !important; box-shadow: 0 0 10px #ff2bd6aa, 0 0 18px #22e4ff66; }
.mcf-holo, .mcf-starry, .mcf-prism, .mcf-frost, .mcf-sapphire, .mcf-cosmic { position: relative; overflow: hidden; }
.mcf-holo::after, .mcf-prism::after, .mcf-sapphire::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: linear-gradient(115deg, transparent 30%, rgb(255 255 255 / .45) 45%, rgb(160 220 255 / .35) 50%, rgb(255 160 230 / .3) 55%, transparent 70%); background-size: 250% 100%; mix-blend-mode: soft-light; }
.mc-big.mcf-holo::after, .mc-big.mcf-prism::after, .mc-big.mcf-sapphire::after { animation: mcShine 3s ease-in-out infinite; }
.mcf-holo { background: linear-gradient(var(--surface, #fff), var(--surface, #fff)) padding-box, linear-gradient(135deg, #e0f2fe, #c4b5fd, #fbcfe8, #bae6fd) border-box !important; }
.mcf-starry { background: radial-gradient(1px 1px at 15% 20%, #fff, transparent), radial-gradient(1px 1px at 80% 30%, #fff, transparent), radial-gradient(1.5px 1.5px at 40% 85%, #fff, transparent), linear-gradient(#0b1030, #1e1b4b) padding-box, linear-gradient(135deg, #6366f1, #0b1030) border-box !important; color: #e8ecff; }
.mcf-prism { background: linear-gradient(var(--surface, #fff), var(--surface, #fff)) padding-box, conic-gradient(from 0deg, #ff3cac, #ffe66d, #2bd2ff, #7cff6b, #b45cff, #ff3cac) border-box !important; }
.mc-big.mcf-prism { animation: rkHue 6s linear infinite; }
.mcf-frost { background: linear-gradient(180deg, #f0f9ff, var(--surface, #fff)) padding-box, linear-gradient(135deg, #ffffff, #a8e4ff, #4a8fb8, #ffffff) border-box !important; box-shadow: 0 0 14px rgb(168 228 255 / .6); }
.mcf-sapphire { background: linear-gradient(170deg, color-mix(in srgb, #2f6bff 18%, var(--surface, #fff)), var(--surface, #fff)) padding-box, conic-gradient(from 0deg, #2f6bff, #7cd4ff, #ffffff, #2f6bff, #0b1f4d, #2f6bff) border-box !important; box-shadow: 0 0 18px rgb(47 107 255 / .55); }
.mcf-cosmic { background: radial-gradient(1px 1px at 10% 15%, #fff, transparent), radial-gradient(1px 1px at 75% 40%, #fff, transparent), radial-gradient(2px 2px at 35% 70%, #ffd6ff, transparent), radial-gradient(1px 1px at 90% 85%, #fff, transparent), radial-gradient(circle at 50% 40%, #3a1a8a, #05030f) padding-box, conic-gradient(from 0deg, #ff5ec4, #7cd4ff, #b273ff, #ff5ec4) border-box !important; color: #f4ecff; box-shadow: 0 0 18px rgb(178 115 255 / .5); }
.mc-big.mcf-cosmic, .mc-big.mcf-starry { background-size: 200% 200%, 200% 200%, 200% 200%, 200% 200%, 100% 100%, 100% 100%; animation: spDrift 14s linear infinite; }
@keyframes spDrift { to { background-position: 100% 50%, -100% 20%, 60% -100%, 120% 100%, 0 0, 0 0; } }
/* birth and death */
.sp-fx { position: fixed; inset: 0; z-index: 99990; display: grid; place-items: center; background: rgb(5 8 25 / .55); animation: rkIn .3s ease both; cursor: pointer; }
.sp-fx.out { animation: rkOut .35s ease both; }
.sp-fx canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.sp-fx-txt { position: relative; text-align: center; color: #fff; text-shadow: 0 2px 12px rgb(0 0 0 / .6); animation: rkUp .8s cubic-bezier(.2, .8, .3, 1.2) .2s both; }
.sp-fx-txt i { display: block; font-style: normal; font-size: 64px; }
.sp-fx-txt b { font-size: 26px; font-weight: 900; }
.sp-leg { background: linear-gradient(90deg, #ffd84a, #2f7bff, #b273ff, #ffd84a); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 900; animation: rkSlide 3s linear infinite; }
