/* friendbook (round 4): Friend Book tab, five-tab rail, daily treasure chest */

/* ---------------------------------------------------------------- five-tab rail (fits 900px) */
.rail.rail-5 { padding-top: 34px; gap: 12px; }
.rail.rail-5 .rail-tab { width: 168px; height: 152px; gap: 4px; }
.rail.rail-5 .rail-icon { width: 94px; height: 94px; }
.rail.rail-5 .rail-icon img { width: 98px; height: 116px; margin-top: 26px; }
.rail.rail-5 .rail-label { font-size: 26px; }

/* ---------------------------------------------------------------- friend book */
.fb { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, #3D2D8E 0%, #2A1E66 55%, #221750 100%); overflow: hidden; }
.fb::before { content: ''; position: absolute; inset: 0; opacity: .14; pointer-events: none;
  background-image: radial-gradient(circle, #FFFFFF 2px, transparent 3px); background-size: 46px 46px; }

.fb-progress { position: absolute; right: 30px; top: 40px; height: 92px; padding: 0 22px 0 14px; display: flex; align-items: center; gap: 14px;
  background: #FFFFFF; border-radius: 999px; box-shadow: 0 6px 0 rgba(0,0,0,.22); z-index: 6; }
.fb-pstar { display: grid; margin-top: -4px; }
.fb-ptext { display: flex; flex-direction: column; gap: 8px; }
.fb-ptext b { font-size: 30px; line-height: 1; color: var(--navy); white-space: nowrap; }
.fb-pbar { display: block; width: 250px; height: 16px; border-radius: 8px; background: #E9E5FF; overflow: hidden; }
.fb-pbar i { display: block; height: 100%; min-width: 16px; border-radius: 8px; background: linear-gradient(90deg, #FDC061, #F8C850 60%, #FFE48A); }
.fb-pcoins { display: flex; align-items: center; gap: 6px; padding-left: 14px; border-left: 3px solid #EEEAF8; }
.fb-pcoins b { font-size: 32px; color: #B97516; }

.fb-book { position: absolute; left: 118px; top: 150px; width: 1120px; height: 662px; perspective: 1800px; touch-action: none; }
.fb-spread { position: absolute; inset: 0; border-radius: 30px; overflow: hidden; background: #FFF8EC;
  box-shadow: 0 0 0 14px var(--ink, #4A2380), 0 0 0 18px rgba(255,255,255,.18), 0 30px 0 14px rgba(0,0,0,.28); transform-origin: 50% 50%; backface-visibility: hidden; }
.fb-spread.leaving { pointer-events: none; }
.fb-bg { position: absolute; inset: -10px; background-size: cover; background-position: 50% 42%; filter: saturate(.85); }
.fb-wash { position: absolute; inset: 0; background:
  linear-gradient(90deg, rgba(255,250,240,.62) 0%, rgba(255,250,240,.48) 46%, rgba(255,250,240,.48) 54%, rgba(255,250,240,.62) 100%); }
.fb-gutter { position: absolute; left: 50%; top: 0; bottom: 0; width: 70px; margin-left: -35px; pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, rgba(60,40,20,.10) 38%, rgba(60,40,20,.30) 50%, rgba(60,40,20,.10) 62%, transparent 100%); }
.fb-page { position: absolute; top: 0; bottom: 0; width: 50%; padding: 24px 34px 0; display: flex; flex-direction: column; }
.fb-page.left { left: 0; padding-left: 28px; padding-right: 46px; }
.fb-page.right { right: 0; padding-left: 46px; padding-right: 28px; }
.fb-pageno { position: absolute; bottom: 12px; font-size: 20px; font-weight: 700; color: rgba(34,23,80,.45); }
.fb-pageno.l { left: 30px; } .fb-pageno.r { right: 30px; }

.fb-head { height: 92px; display: flex; align-items: center; gap: 16px; flex: none; }
.fb-wn { padding: 6px 18px; border-radius: 999px; background: var(--c, #B07CF0); color: #FFFFFF; font-size: 22px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; box-shadow: 0 4px 0 var(--ink, #4A2380); white-space: nowrap; }
.fb-head h2 { margin: 0; font-family: var(--font-read); font-size: 44px; line-height: 1; color: var(--ink, #221750); white-space: nowrap;
  text-shadow: 3px 0 0 #FFF, -3px 0 0 #FFF, 0 3px 0 #FFF, 0 -3px 0 #FFF, 2px 2px 0 #FFF, -2px -2px 0 #FFF, 2px -2px 0 #FFF, -2px 2px 0 #FFF; }
.fb-page.right .fb-head { justify-content: flex-end; }
.fb-count { padding: 8px 20px; border-radius: 999px; background: rgba(255,255,255,.88); font-size: 26px; font-weight: 700; color: var(--navy); white-space: nowrap; }
.fb-count b { color: var(--ink, var(--purple)); font-size: 30px; }
.fb-pips { display: flex; gap: 6px; }
.fb-pips i { width: 16px; height: 16px; border-radius: 50%; background: rgba(34,23,80,.18); }
.fb-pips i.on { background: var(--c); box-shadow: 0 0 0 3px #FFFFFF; }

.fb-slots { flex: 1; display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 22px 16px; padding-top: 8px; }
.fb-slot { position: relative; width: 142px; height: 246px; border-radius: 26px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 14px; transition: transform .15s; }
.fb-slot.earned { background: #FFFFFF; transform: rotate(var(--rot)); box-shadow: 0 7px 0 rgba(34,23,80,.22), 0 12px 22px rgba(0,0,0,.14); }
.fb-slot.earned:active { transform: rotate(0deg) scale(.95); }
.fb-sticker { position: absolute; left: 10px; right: 10px; top: 10px; height: 180px; border-radius: 20px; display: grid; place-items: end center; overflow: hidden; }
.fb-slot.earned .fb-sticker { background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--c) 45%, #FFFFFF) 0%, color-mix(in srgb, var(--c) 18%, #FFFFFF) 70%); }
.fb-sticker img { max-width: 124px; max-height: 168px; object-fit: contain; margin-bottom: 4px; filter: drop-shadow(0 5px 3px rgba(0,0,0,.18)); }
.fb-name { position: relative; font-family: var(--font-read); font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1.05; text-align: center; max-width: 140px; }
.fb-slot.earned .fb-name { font-size: clamp(18px, 24px, 24px); }
.fb-slot.locked { background: rgba(255,255,255,.42); border: 4px dashed rgba(34,23,80,.32); }
.fb-slot.locked .fb-sticker img { filter: brightness(0) opacity(.42); }
.fb-slot.locked .fb-name { font-family: var(--font-ui); font-size: 22px; color: rgba(34,23,80,.72); }
.fb-lock { position: absolute; right: -12px; top: -12px; width: 54px; height: 54px; border-radius: 50%; background: var(--navy); display: grid; place-items: center; box-shadow: 0 0 0 4px #FFFFFF; }
.fb-lock svg { width: 26px; height: 30px; }
.fb-slot.next { border: 5px solid #F8C850; background: rgba(255,248,220,.75); animation: fbNext 1.2s ease-in-out infinite alternate; }
.fb-next { position: absolute; left: 50%; top: -18px; transform: translateX(-50%); padding: 3px 14px; border-radius: 999px; background: #F8C850; color: var(--navy); font-size: 20px; font-weight: 700; box-shadow: 0 3px 0 #C98A1E; }
@keyframes fbNext { from { box-shadow: 0 0 0 0 rgba(248,200,80,.0); } to { box-shadow: 0 0 0 10px rgba(248,200,80,.45); } }

/* stickers page */
.fb-spread.stickers { background: #F3DFB8; }
.fb-cork { position: absolute; inset: 0; background-image: radial-gradient(circle, rgba(150,95,40,.18) 2px, transparent 3px), radial-gradient(circle, rgba(150,95,40,.12) 1.5px, transparent 2.5px);
  background-size: 34px 34px, 22px 22px; background-position: 0 0, 11px 17px; }
.fb-head.wide { position: relative; padding: 18px 40px 0; height: 110px; }
.fb-head.wide h2 { color: #8A4E12; }
.fb-head.wide .fb-wn { background: #E09A2C; box-shadow: 0 4px 0 #9A5F12; }
.fb-head.wide .fb-count { margin-left: auto; }
.fb-gs-grid { position: absolute; left: 0; right: 0; top: 112px; bottom: 0; padding: 18px 40px 40px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 26px 22px; overflow-y: auto; scrollbar-width: none; align-content: start; touch-action: pan-y; }
.fb-gs-grid::-webkit-scrollbar { display: none; }
.fb-gs { position: relative; height: 222px; border-radius: 24px; background: #FFFFFF; transform: rotate(var(--rot)); box-shadow: 0 6px 0 rgba(120,70,20,.22), 0 10px 18px rgba(0,0,0,.12);
  display: flex; flex-direction: column; align-items: center; padding: 10px 8px 10px; cursor: pointer; }
.fb-gs-art { width: 140px; height: 140px; border-radius: 50%; background: var(--c); display: grid; place-items: center; overflow: hidden; box-shadow: inset 0 -8px 0 rgba(0,0,0,.12); }
.fb-gs-art img { width: 120px; height: 132px; object-fit: contain; margin-top: 18px; }
.fb-gs.chest .fb-gs-art { background: radial-gradient(circle, #FFF2B8, #F8C850); }
.fb-gs-star { position: absolute; right: -10px; top: -12px; }
.fb-gs b { margin-top: 8px; font-size: 20px; text-align: center; line-height: 1.1; color: var(--navy); }
.fb-gs small { font-size: 16px; font-weight: 600; color: rgba(34,23,80,.55); }
.fb-empty { position: absolute; left: 0; right: 0; top: 130px; bottom: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; }
.fb-ghosts { display: flex; gap: 26px; }
.fb-ghost { width: 150px; height: 190px; border-radius: 24px; border: 4px dashed rgba(138,78,18,.35); background: rgba(255,255,255,.35); display: grid; place-items: end center; overflow: hidden; }
.fb-ghost img { max-width: 120px; max-height: 160px; filter: brightness(0) opacity(.22); margin-bottom: 8px; }
.fb-empty h3 { margin: 10px 0 0; font-family: var(--font-read); font-size: 46px; color: #8A4E12; }
.fb-go { height: 92px; padding: 0 60px; border-radius: 999px; background: #43BE95; color: #FFFFFF; font-size: 36px; font-weight: 700; box-shadow: 0 7px 0 #23795D; }
.fb-go:active { transform: translateY(5px); box-shadow: 0 2px 0 #23795D; }

/* arrows + dots */
.fb-arrow { position: absolute; top: 450px; width: 88px; height: 88px; border-radius: 50%; background: var(--purple); display: grid; place-items: center; z-index: 5;
  box-shadow: 0 0 0 6px #FFFFFF, 0 10px 0 6px rgba(0,0,0,.25); transition: transform .12s, opacity .2s; }
.fb-arrow.prev { left: 16px; } .fb-arrow.next { right: 16px; }
.fb-arrow:active { transform: scale(.92); }
.fb-arrow:disabled { opacity: .25; pointer-events: none; }
.fb-dots { position: absolute; left: 118px; width: 1120px; top: 862px; display: flex; justify-content: center; gap: 12px; z-index: 5; }
.fb-dot { width: 24px; height: 24px; border-radius: 12px; background: var(--c); opacity: .45; box-shadow: 0 0 0 3px rgba(255,255,255,.7); transition: width .25s, opacity .25s; }
.fb-dot.on { width: 56px; opacity: 1; box-shadow: 0 0 0 4px #FFFFFF; }
.fb-dot.star { border-radius: 6px; transform: rotate(45deg); }
.fb-dot.star.on { width: 24px; transform: rotate(45deg) scale(1.3); }

/* friend card */
.fb-layer { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.fb-layer > * { pointer-events: auto; }
.fb-card-wrap { position: absolute; inset: 0; background: rgba(34,23,80,.55); display: grid; place-items: center; }
.fb-card { position: relative; width: 820px; height: 470px; display: flex; border-radius: 44px; background: #FFFFFF; overflow: visible; box-shadow: 0 12px 0 var(--ink), 0 30px 70px rgba(0,0,0,.35); }
.fb-card-x { position: absolute; right: -22px; top: -22px; width: 76px; height: 76px; border-radius: 50%; background: var(--navy); display: grid; place-items: center; box-shadow: 0 0 0 5px #FFFFFF; z-index: 2; }
.fb-card-x svg { width: 34px; height: 34px; }
.fb-card-art { position: relative; width: 360px; flex: none; border-radius: 44px 0 0 44px; overflow: hidden; display: grid; place-items: end center; background: var(--c); }
.fb-card-bg { position: absolute; inset: 0; background-size: cover; background-position: 50% 45%; opacity: .75; }
.fb-card-art::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 60px; background: linear-gradient(transparent, rgba(0,0,0,.18)); }
.fb-card-art img { position: relative; height: 340px; max-width: 320px; object-fit: contain; margin-bottom: 26px; z-index: 1; filter: drop-shadow(0 12px 8px rgba(0,0,0,.3)); }
.fb-card-body { flex: 1; padding: 46px 44px 40px; display: flex; flex-direction: column; align-items: flex-start; }
.fb-bubble { position: relative; padding: 16px 28px; border-radius: 30px; background: color-mix(in srgb, var(--c) 22%, #FFFFFF); border: 4px solid var(--c); font-family: var(--font-read); font-size: 38px; font-weight: 700; color: var(--ink); }
.fb-bubble::before { content: ''; position: absolute; left: -26px; top: 26px; border: 14px solid transparent; border-right: 16px solid var(--c); }
.fb-card-body h3 { margin: 26px 0 6px; font-family: var(--font-read); font-size: 76px; line-height: 1; color: var(--ink); }
.fb-card-body p { margin: 0; font-size: 28px; font-weight: 600; color: #6F6792; }
.fb-card-hear { margin-top: auto; height: 86px; padding: 0 38px 0 18px; border-radius: 999px; background: var(--c); color: #FFFFFF; font-size: 34px; font-weight: 700; display: flex; align-items: center; gap: 8px; box-shadow: 0 7px 0 var(--ink); }
.fb-card-hear svg { width: 62px; height: 56px; }
.fb-card-hear:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); }

/* ---------------------------------------------------------------- daily chest: map button */
.chest-btn { position: absolute; left: 30px; bottom: 26px; width: 200px; height: 206px; z-index: 22; display: grid; place-items: center; animation: chestBob 1.4s ease-in-out infinite alternate; }
.cb-plate { position: absolute; left: 50%; top: 8px; width: 170px; height: 170px; margin-left: -85px; border-radius: 50%; background: radial-gradient(circle at 50% 60%, #FFF6C8 0%, #FFE48A 45%, #F8C850 100%);
  box-shadow: 0 0 0 7px #5031F5, 0 0 0 13px #FFFFFF, 0 14px 0 13px rgba(34,23,80,.28); }
.chest-btn .chest-svg { position: relative; margin-top: -26px; filter: drop-shadow(0 8px 4px rgba(0,0,0,.25)); animation: chestWiggle 3s ease-in-out infinite; transform-origin: 50% 90%; }
.chest-btn:active { transform: scale(.94); }
.cb-glow { position: absolute; left: 50%; top: 46%; width: 230px; height: 230px; margin: -115px 0 0 -115px; border-radius: 50%; background: radial-gradient(circle, rgba(255,228,138,.95) 0%, rgba(255,216,102,.55) 40%, transparent 70%); animation: chestGlow 1.4s ease-in-out infinite alternate; }
.cb-tag { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); padding: 4px 18px; border-radius: 999px; background: #FFFFFF; color: var(--navy); font-size: 24px; font-weight: 700; white-space: nowrap; box-shadow: 0 4px 0 rgba(34,23,80,.25); }
.cb-spark { position: absolute; width: 22px; height: 22px; background: #FFFFFF; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: chestSpark 1.6s ease-in-out infinite; }
.cb-spark.s1 { left: 18px; top: 26px; } .cb-spark.s2 { right: 16px; top: 46px; animation-delay: -.55s; } .cb-spark.s3 { right: 44px; top: 4px; width: 16px; height: 16px; animation-delay: -1.1s; }
@keyframes chestBob { from { transform: translateY(0); } to { transform: translateY(-10px); } }
@keyframes chestWiggle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-6deg); } 80% { transform: rotate(6deg); } 85% { transform: rotate(-4deg); } 90% { transform: rotate(3deg); } }
@keyframes chestGlow { from { opacity: .55; transform: scale(.9); } to { opacity: 1; transform: scale(1.08); } }
@keyframes chestSpark { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }

/* chest svg parts */
.chest-svg .ch-lid { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .45s cubic-bezier(.3,1.5,.5,1); }
.chest-svg .ch-inside { opacity: 0; transition: opacity .2s; }
.chest-svg .ch-lid-shade { opacity: 0; transition: opacity .3s; }
.chest-svg.open .ch-lid { transform: translateY(-30px) scaleY(.6); }
.chest-svg.open .ch-lid-shade { opacity: .32; }
.chest-svg.open .ch-inside { opacity: 1; }
.chest-svg.open .ch-lock { opacity: .0; transition: opacity .2s; }

/* ---------------------------------------------------------------- daily chest: the moment */
.chest-moment { position: absolute; inset: 0; z-index: 420; overflow: hidden; background: radial-gradient(circle at 50% 62%, #5A3DB8 0%, #2E1F78 45%, #160F3A 100%); }
.cm-title { position: absolute; left: 0; right: 0; top: 56px; margin: 0; text-align: center; font-family: var(--font-read); font-size: 72px; color: #FFFFFF; text-shadow: 0 6px 0 rgba(0,0,0,.3); z-index: 3; }
.cm-x { position: absolute; right: 36px; top: 36px; width: 84px; height: 84px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; z-index: 6; }
.cm-x svg { width: 36px; height: 36px; }
.cm-stage { position: absolute; left: 50%; top: 250px; width: 620px; height: 600px; margin-left: -310px; transition: left .6s cubic-bezier(.3,.9,.3,1); z-index: 2; }
.chest-moment.show-result .cm-stage { left: 34%; }
.cm-rays { position: absolute; left: 50%; top: 66%; width: 1700px; height: 1700px; margin: -850px 0 0 -850px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,232,150,.16) 0 10deg, transparent 10deg 20deg); animation: spin 14s linear infinite;
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 62%); mask-image: radial-gradient(circle, #000 20%, transparent 62%); transition: left .6s cubic-bezier(.3,.9,.3,1); }
.chest-moment.show-result .cm-rays { left: 34%; }
.cm-light { position: absolute; left: 50%; bottom: 220px; width: 360px; height: 520px; margin-left: -180px; opacity: 0; transform-origin: 50% 100%; transform: scaleY(.2);
  background: radial-gradient(ellipse at 50% 100%, rgba(255,246,200,.95) 0%, rgba(255,216,102,.55) 35%, transparent 70%); transition: opacity .3s, transform .5s cubic-bezier(.2,.9,.3,1.2); }
.chest-moment.is-open .cm-light { opacity: 1; transform: scaleY(1); }
.cm-chest { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 380px; }
.cm-chest .chest-svg { display: block; filter: drop-shadow(0 16px 10px rgba(0,0,0,.35)); transform-origin: 50% 90%; animation: chestWiggle 1.8s ease-in-out infinite; }
.cm-chest.opening .chest-svg { animation: none; }
.cm-reward { position: absolute; left: 50%; bottom: 178px; transform: translate(-50%, 120px) scale(.2); opacity: 0; z-index: 3; pointer-events: none; }
.cm-reward img { display: block; height: 300px; max-width: 360px; object-fit: contain; filter: drop-shadow(0 14px 10px rgba(0,0,0,.35)); }
.cm-sticker { display: block; animation: spin 6s linear infinite; }
.cm-hint { position: absolute; left: 0; right: 0; bottom: 34px; margin: 0; text-align: center; font-size: 42px; font-weight: 700; color: #FFE48A; animation: chestGlow .9s ease-in-out infinite alternate; z-index: 3; }
.cm-flycoin { position: absolute; z-index: 4; pointer-events: none; }
.cm-result { position: absolute; left: 62%; top: 300px; width: 520px; display: flex; flex-direction: column; align-items: center; gap: 28px; z-index: 4; opacity: 0; transform: translateX(80px); pointer-events: none; transition: opacity .4s .25s, transform .5s .25s cubic-bezier(.2,.9,.3,1.2); }
.cm-result.show { opacity: 1; transform: none; pointer-events: auto; }
.cm-coins { display: flex; align-items: center; gap: 14px; padding: 14px 34px 14px 18px; border-radius: 999px; background: #FFFFFF; box-shadow: 0 8px 0 rgba(0,0,0,.25); }
.cm-coins b { font-size: 64px; line-height: 1; color: #B97516; }
.cm-coins span:last-child { font-size: 32px; font-weight: 700; color: var(--navy); }
.cm-coin { display: grid; animation: coinSpin 1.6s ease-in-out infinite; }
@keyframes coinSpin { 0%, 60%, 100% { transform: rotateY(0); } 80% { transform: rotateY(180deg); } }
.cm-streak { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.cm-dots { display: flex; gap: 10px; }
.cm-dots i { width: 50px; height: 50px; border-radius: 50%; border: 4px dashed rgba(255,255,255,.45); display: grid; place-items: center; font-style: normal; font-size: 28px; color: #FFFFFF; }
.cm-dots i.on { border: 0; background: radial-gradient(circle at 40% 35%, #FFE48A, #F3A73A); color: #FFFFFF; box-shadow: 0 4px 0 #B97516; }
.cm-streak p { margin: 0; font-family: var(--font-read); font-size: 40px; font-weight: 700; color: #FFFFFF; text-align: center; }
.cm-yay { height: 104px; padding: 0 90px; border-radius: 999px; background: #43BE95; color: #FFFFFF; font-size: 48px; font-weight: 700; box-shadow: 0 8px 0 #23795D; }
.cm-yay:active { transform: translateY(5px); box-shadow: 0 3px 0 #23795D; }
