:root {
  --bg: #0d0b14; --surface: #17141f; --surface2: #211d2c; --line: rgba(255, 255, 255, .08);
  --ink: #f5f3fa; --muted: #a59fb8; --accent: #ff3d8b; --accent2: #8b5cf6; --gold: #ffc83d; --good: #34d399; --blue: #38bdf8;
  --grad: linear-gradient(135deg, #ff3d8b, #8b5cf6);
  --safe-b: env(safe-area-inset-bottom); --safe-t: env(safe-area-inset-top);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { overflow: hidden; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; color: var(--ink); }
.grow { flex: 1; }
.center { text-align: center; }
.fine { color: var(--muted); font-size: 12px; line-height: 1.45; }
.err { color: #ff8a9a; font-size: 13px; min-height: 18px; margin-top: 8px; }

.primary { background: var(--grad); color: #fff; font-weight: 800; padding: 11px 18px; border-radius: 999px; box-shadow: 0 6px 20px rgba(255, 61, 139, .35); }
.primary:active { transform: scale(.97); }
.primary.big { width: 100%; padding: 14px; font-size: 16px; }
.ghost { background: var(--surface2); color: var(--ink); font-weight: 700; padding: 10px 16px; border-radius: 999px; }
.wide-btn { display: block; width: calc(100% - 32px); margin: 12px auto; text-align: center; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; overflow-y: auto; padding-bottom: calc(76px + var(--safe-b)); -webkit-overflow-scrolling: touch; }
.screen.dark { background: #000; padding-bottom: 0; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-t) + 10px) 16px 8px; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(var(--bg) 70%, rgba(13, 11, 20, 0)); }
.topbar h1 { margin: 0; font-size: 22px; }
.brand { font-size: 30px; font-weight: 900; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin-left: 2px; }
.brand.small { font-size: 22px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255, 61, 139, .25), 0 0 16px var(--accent); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 61, 139, 0), 0 0 16px var(--accent); } }
.coin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2b3, var(--gold) 50%, #d99a00); box-shadow: inset 0 0 0 1.5px #b07d00; vertical-align: -3px; }
.coin-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface2); padding: 6px 12px; border-radius: 999px; font-weight: 800; font-variant-numeric: tabular-nums; }
.coin-chip.static { cursor: default; }

/* ---------- auth ---------- */
#auth { display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-bg { position: fixed; inset: -20%; background: radial-gradient(circle at 20% 20%, rgba(255, 61, 139, .35), transparent 40%), radial-gradient(circle at 80% 70%, rgba(139, 92, 246, .35), transparent 45%); filter: blur(20px); animation: drift 12s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate(5%, -4%) scale(1.08); } }
.auth-card { position: relative; width: min(380px, 100%); background: rgba(23, 20, 31, .85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 24px; padding: 26px 20px; text-align: center; }
.auth-card .brand { justify-content: center; font-size: 36px; }
.tagline { color: var(--muted); margin: 6px 0 18px; }
.seg { display: flex; background: var(--surface2); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.seg.wide { margin: 8px 16px; }
.seg button { flex: 1; padding: 8px; border-radius: 999px; font-weight: 700; color: var(--muted); font-size: 14px; }
.seg button.on { background: var(--grad); color: #fff; }
form input, #liveTitle { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface2); outline: none; margin-bottom: 10px; font-size: 16px; }
form input:focus, #liveTitle:focus { border-color: var(--accent); }

/* ---------- home ---------- */
.tabs { display: flex; gap: 18px; padding: 4px 16px 10px; }
.tabs button { font-weight: 800; color: var(--muted); font-size: 16px; padding: 4px 0; position: relative; }
.tabs button.on { color: var(--ink); }
.tabs button.on::after { content: ""; position: absolute; left: 25%; right: 25%; bottom: -3px; height: 3px; border-radius: 3px; background: var(--grad); }
.feed { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 10px; }
.card { position: relative; aspect-ratio: 3/4; border-radius: 14px; overflow: hidden; background: var(--surface2); text-align: left; animation: rise .35s ease-out both; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.card img, .card .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card .ph { display: flex; align-items: center; justify-content: center; font-size: 54px; font-weight: 900; color: rgba(255, 255, 255, .85); }
.card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(0, 0, 0, .75)); }
.card .live { position: absolute; z-index: 1; top: 8px; left: 8px; display: flex; gap: 4px; align-items: center; }
.tag { font-size: 10.5px; font-weight: 900; padding: 3px 7px; border-radius: 6px; letter-spacing: .04em; }
.tag.red { background: var(--accent); }
.tag.pk { background: linear-gradient(90deg, #ff3d3d, #3d7dff); }
.tag.dim { background: rgba(0, 0, 0, .45); font-weight: 700; }
.card .meta { position: absolute; z-index: 1; left: 8px; right: 8px; bottom: 8px; }
.card .t { font-weight: 800; font-size: 14px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .h { font-size: 12px; color: #ddd; margin-top: 3px; display: flex; gap: 5px; align-items: center; }
.empty { text-align: center; color: var(--muted); padding: 40px 30px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.empty-art { width: 110px; height: 110px; border-radius: 50%; background: var(--grad); opacity: .25; box-shadow: 0 0 60px var(--accent); }

/* badges & avatars */
.badge { display: inline-flex; align-items: center; gap: 2px; font-size: 10px; font-weight: 900; padding: 1px 6px; border-radius: 999px; color: #fff; white-space: nowrap; vertical-align: 1px; }
.badge.sprout { background: linear-gradient(90deg, #16a34a, #4ade80); }
.badge.star { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.badge.comet { background: linear-gradient(90deg, #7c3aed, #c084fc); }
.badge.crown { background: linear-gradient(90deg, #d97706, #fbbf24); color: #3a2200; }
.badge.legend { background: linear-gradient(90deg, #dc2626, #f43f5e, #fb923c); box-shadow: 0 0 8px rgba(244, 63, 94, .6); }
.badge.host { background: var(--grad); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 900; color: #fff; flex: none; border: 2px solid rgba(255, 255, 255, .85); }
.avatar.lg { width: 76px; height: 76px; font-size: 32px; border-width: 3px; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; border-width: 1.5px; }

/* ranking & profile */
.ranklist { list-style: none; margin: 4px 0; padding: 0 12px; }
.ranklist li { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface); margin-bottom: 6px; }
.ranklist .pos { width: 26px; text-align: center; font-weight: 900; color: var(--muted); }
.ranklist li:nth-child(1) .pos { color: #ffd166; font-size: 20px; } .ranklist li:nth-child(2) .pos { color: #cbd5e1; font-size: 18px; } .ranklist li:nth-child(3) .pos { color: #f4a261; font-size: 17px; }
.ranklist .nm { flex: 1; min-width: 0; } .ranklist .nm b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranklist .nm small { color: var(--muted); }
.ranklist .amt { font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.profile-card { margin: 4px 16px; background: var(--surface); border-radius: 22px; padding: 20px; text-align: center; border: 1px solid var(--line); }
.profile-card h2 { margin: 10px 0 2px; } .profile-card .id { color: var(--muted); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.stats div { background: var(--surface2); border-radius: 14px; padding: 10px 4px; }
.stats b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; } .stats span { font-size: 11.5px; color: var(--muted); }

/* bottom nav */
.bottomnav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; align-items: center;
  padding: 6px 0 calc(var(--safe-b) + 6px); background: rgba(13, 11, 20, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.bottomnav button { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--muted); font-weight: 700; min-width: 64px; }
.bottomnav button span { font-size: 22px; line-height: 1.1; }
.bottomnav button.on { color: var(--ink); }
.bottomnav .golive-tab .plus { width: 52px; height: 36px; border-radius: 14px; background: var(--grad); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; box-shadow: 0 4px 16px rgba(255, 61, 139, .45); }

/* ---------- go live ---------- */
#preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#preview.mirror, video.mirror { transform: scaleX(-1); }
.golive-top { position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--safe-t) + 10px) 12px; display: flex; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; background: rgba(0, 0, 0, .4); color: #fff; font-size: 18px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.golive-card { position: absolute; left: 12px; right: 12px; top: calc(var(--safe-t) + 60px); display: flex; gap: 12px; padding: 12px; border-radius: 18px; background: rgba(0, 0, 0, .45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.cover-pick { width: 84px; height: 108px; border-radius: 12px; background: rgba(255, 255, 255, .12); border: 1.5px dashed rgba(255, 255, 255, .4); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; font-weight: 700; overflow: hidden; flex: none; cursor: pointer; }
.cover-pick img { width: 100%; height: 100%; object-fit: cover; }
.golive-card #liveTitle { background: rgba(0, 0, 0, .35); border-color: rgba(255, 255, 255, .2); margin-bottom: 6px; }
.golive-btn { position: absolute; left: 24px; right: 24px; bottom: calc(var(--safe-b) + 28px); font-size: 19px; padding: 15px; }
#goliveErr { position: absolute; left: 20px; right: 20px; bottom: calc(var(--safe-b) + 90px); }

/* ---------- live room ---------- */
.stage { position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, #2a1b3d, #000 70%); }
.main-tile { position: absolute; inset: 0; }
.tile { position: absolute; inset: 0; overflow: hidden; background: #111; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .tname { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; background: rgba(0, 0, 0, .45); padding: 2px 7px; border-radius: 999px; }
.tile .novid { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px; }
.guests { position: absolute; right: 8px; top: calc(var(--safe-t) + 112px); width: 28%; max-width: 130px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.guests .tile { position: relative; inset: auto; aspect-ratio: 3/4; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .7); animation: pop .3s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.guests .tile .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, .6); font-size: 12px; font-weight: 900; }
.shade-top { position: absolute; left: 0; right: 0; top: 0; height: 140px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); pointer-events: none; }
.shade-bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 45%; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); pointer-events: none; }

.stage.pk .main-tile { display: none; }
.pk-wrap { position: absolute; left: 0; right: 0; top: calc(var(--safe-t) + 96px); height: 46%; display: flex; z-index: 2; }
.pk-side { position: relative; flex: 1; overflow: hidden; background: #111; }
.pk-side .tile { position: absolute; inset: 0; }
.pk-side:first-child { border-right: 1px solid #000; }
.pk-vs { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: 26px; font-weight: 900; font-style: italic;
  background: linear-gradient(90deg, #ff3d3d, #3d7dff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 4px #000); animation: vs 1.2s ease-in-out infinite alternate; }
@keyframes vs { to { transform: translate(-50%, -50%) scale(1.15); } }
.pk-bar { position: absolute; left: 0; right: 0; bottom: -22px; height: 22px; display: flex; font-weight: 900; font-size: 12px; font-variant-numeric: tabular-nums; }
.pk-a, .pk-b { display: flex; align-items: center; padding: 0 8px; transition: flex-grow .4s ease; min-width: 18%; }
.pk-a { background: linear-gradient(90deg, #ff2d55, #ff6b6b); flex-grow: 1; }
.pk-b { background: linear-gradient(90deg, #4d8dff, #2563eb); flex-grow: 1; justify-content: flex-end; }
.pk-timer { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); background: rgba(0, 0, 0, .6); padding: 3px 10px; border-radius: 999px; font-weight: 900; font-size: 13px; font-variant-numeric: tabular-nums; }
.pk-names { position: absolute; left: 0; right: 0; top: 6px; display: flex; justify-content: space-between; padding: 0 8px; font-size: 11.5px; font-weight: 800; pointer-events: none; }
.pk-names span { background: rgba(0, 0, 0, .5); padding: 2px 8px; border-radius: 999px; max-width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage.pk .guests { top: auto; bottom: 45%; }

.room-top { position: absolute; z-index: 5; left: 0; right: 0; top: 0; padding: calc(var(--safe-t) + 10px) 10px 0; display: flex; align-items: center; gap: 8px; }
.host-pill { display: flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, .4); border-radius: 999px; padding: 3px 4px 3px 3px; max-width: 62%; text-align: left; }
.hp-text { min-width: 0; line-height: 1.15; }
.hp-text b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-text small { font-size: 10.5px; color: #ddd; white-space: nowrap; }
.follow-btn { background: var(--grad); width: 30px; height: 26px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-weight: 900; flex: none; }
.follow-btn.done { background: rgba(255, 255, 255, .2); font-size: 12px; }
.viewers { display: flex; align-items: center; gap: 4px; }
.vtop { display: flex; }
.vtop .avatar { margin-left: -8px; }
.vcount { background: rgba(0, 0, 0, .4); padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.room-title { position: absolute; z-index: 5; left: 12px; top: calc(var(--safe-t) + 58px); font-size: 12px; background: rgba(0, 0, 0, .35); padding: 3px 10px; border-radius: 999px; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat { position: absolute; z-index: 4; left: 10px; right: 30%; bottom: calc(var(--safe-b) + 64px); max-height: 34%; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
  -webkit-mask-image: linear-gradient(transparent, #000 18%); mask-image: linear-gradient(transparent, #000 18%); scrollbar-width: none; }
.chat::-webkit-scrollbar { display: none; }
.msg { align-self: flex-start; background: rgba(0, 0, 0, .38); padding: 5px 10px; border-radius: 14px; font-size: 13.5px; line-height: 1.35; max-width: 100%; word-wrap: break-word; animation: msgin .25s ease-out; }
@keyframes msgin { from { transform: translateX(-12px); opacity: 0; } }
.msg .n { color: #c4b5fd; font-weight: 800; margin-right: 4px; cursor: pointer; }
.msg.sys { color: #ffe08a; background: rgba(0, 0, 0, .3); font-size: 12.5px; }
.msg.join { color: #a7f3d0; background: rgba(0, 0, 0, .25); font-size: 12.5px; }
.msg.gift { background: linear-gradient(90deg, rgba(255, 61, 139, .55), rgba(139, 92, 246, .35)); }
.msg.welcome { color: #c7d2fe; font-size: 12.5px; }

.room-bar { position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; align-items: center; padding: 8px 10px calc(var(--safe-b) + 10px); }
.say { flex: 1; text-align: left; background: rgba(0, 0, 0, .45); padding: 10px 14px; border-radius: 999px; color: #ddd; font-size: 14px; }
.rb { position: relative; width: 42px; height: 42px; border-radius: 50%; background: rgba(0, 0, 0, .45); font-size: 19px; display: flex; align-items: center; justify-content: center; flex-direction: column; line-height: 1; flex: none; }
.rb .rb-l { font-size: 8.5px; font-weight: 900; margin-top: 1px; }
.rb.gift { background: var(--grad); }
.rb.like { color: #ff5c8a; font-size: 22px; }
.rb.end { background: rgba(220, 38, 38, .75); }
.rb.off { opacity: .5; }
.rb.active { background: var(--good); }
.dotn { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; border-radius: 999px; background: var(--accent); font-size: 11px; font-style: normal; font-weight: 900; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.chat-input { position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; padding: 8px 10px calc(var(--safe-b) + 8px); background: rgba(13, 11, 20, .95); }
.chat-input input { flex: 1; margin: 0; border-radius: 999px; padding: 10px 14px; }
.unmute { position: absolute; z-index: 7; left: 50%; top: 45%; transform: translateX(-50%); background: rgba(0, 0, 0, .7); padding: 10px 18px; border-radius: 999px; font-weight: 800; }

.hearts { position: absolute; z-index: 4; right: 10px; bottom: calc(var(--safe-b) + 60px); width: 70px; height: 300px; pointer-events: none; }
.hearts i { position: absolute; bottom: 0; left: 26px; font-style: normal; font-size: 22px; animation: heart 2.2s ease-out forwards; }
@keyframes heart { 0% { transform: translate(0, 0) scale(.4); opacity: 0; } 15% { opacity: 1; transform: translate(0, -20px) scale(1.1); } 100% { transform: translate(var(--hx), -280px) scale(.8); opacity: 0; } }

.gift-lanes { position: absolute; z-index: 5; left: 0; top: 38%; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.lane { display: flex; align-items: center; gap: 6px; padding: 3px 14px 3px 3px; border-radius: 0 999px 999px 0; background: linear-gradient(90deg, rgba(255, 61, 139, .9), rgba(139, 92, 246, .55) 80%, transparent);
  animation: lanein .35s cubic-bezier(.2, 1.3, .4, 1), laneout .4s 2.6s ease-in forwards; min-width: 200px; }
@keyframes lanein { from { transform: translateX(-110%); } }
@keyframes laneout { to { transform: translateX(-110%); opacity: 0; } }
.lane .who { line-height: 1.1; } .lane .who b { font-size: 12.5px; display: block; } .lane .who small { font-size: 11px; color: #ffe; }
.lane svg { width: 40px; height: 40px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); animation: giftpop .5s ease-out; }
@keyframes giftpop { from { transform: scale(.2) rotate(-30deg); } 70% { transform: scale(1.3); } }
.lane .combo { font-size: 24px; font-weight: 900; font-style: italic; color: var(--gold); text-shadow: 0 2px 0 #b45309, 0 0 10px rgba(255, 200, 61, .7); animation: combo .4s ease-out; }
@keyframes combo { from { transform: scale(2.2); opacity: 0; } }

/* big gift */
.big-gift { position: fixed; z-index: 40; inset: 0; pointer-events: none; overflow: hidden; background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, .35), rgba(0, 0, 0, .55)); animation: bgfade 4s ease forwards; }
@keyframes bgfade { 0% { opacity: 0; } 8% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
.bg-rays { position: absolute; left: 50%; top: 50%; width: 240vmax; height: 240vmax; margin: -120vmax 0 0 -120vmax; background: repeating-conic-gradient(rgba(255, 200, 61, .14) 0 8deg, transparent 8deg 16deg); animation: spin 10s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bg-spark { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 12px 4px rgba(255, 220, 120, .9); animation: twinkle 1.1s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: scale(.2); opacity: .3; } }
.bg-art { position: absolute; left: 50%; top: 50%; width: 62vmin; height: 62vmin; margin: -31vmin 0 0 -31vmin; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .6)); }
.bg-art svg { width: 100%; height: 100%; }
.bg-sportscar { animation: drive 4s cubic-bezier(.3, .1, .2, 1) forwards; }
@keyframes drive { 0% { transform: translateX(-120vw); } 30% { transform: translateX(0) ; } 70% { transform: translateX(0) scale(1.05); } 100% { transform: translateX(130vw); } }
.bg-rocket { animation: launch 4s cubic-bezier(.5, 0, .8, .4) forwards; }
@keyframes launch { 0% { transform: translateY(70vh) scale(.6); } 35% { transform: translateY(0) scale(1); } 60% { transform: translateY(-4vh) scale(1.05) rotate(2deg); } 100% { transform: translateY(-140vh) scale(1.2); } }
.bg-castle { animation: castle 4s ease-out forwards; }
@keyframes castle { 0% { transform: translateY(60vh) scale(.4); opacity: 0; } 30% { transform: translateY(0) scale(1.05); opacity: 1; } 40% { transform: scale(1); } 85% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
.big-gift .bg-cap { position: absolute; left: 0; right: 0; bottom: 18%; text-align: center; font-weight: 900; font-size: 20px; text-shadow: 0 2px 8px #000; animation: rise .5s .4s both; }
.big-gift .bg-cap b { color: var(--gold); }

.pk-result { position: absolute; z-index: 9; left: 0; right: 0; top: 30%; display: flex; justify-content: center; pointer-events: none; }
.pkr-inner { text-align: center; padding: 16px 30px; border-radius: 22px; background: rgba(0, 0, 0, .7); animation: pkr .6s cubic-bezier(.2, 1.5, .4, 1); border: 2px solid var(--gold); }
@keyframes pkr { from { transform: scale(.3); opacity: 0; } }
.pkr-title { font-size: 34px; font-weight: 900; font-style: italic; background: linear-gradient(90deg, #ffd166, #ff3d8b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pkr-sub { color: #eee; font-weight: 700; margin-top: 4px; }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .45); }
.sheet { position: fixed; z-index: 31; left: 0; right: 0; bottom: 0; max-height: 78%; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 14px 14px calc(var(--safe-b) + 14px); animation: sheet .28s cubic-bezier(.2, 1, .3, 1); }
@keyframes sheet { from { transform: translateY(100%); } }
.sheet-head { display: flex; align-items: center; margin-bottom: 8px; font-size: 16px; }
.gift-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gift-grid button { display: flex; flex-direction: column; align-items: center; padding: 8px 2px 6px; border-radius: 14px; border: 1.5px solid transparent; }
.gift-grid button.on { border-color: var(--accent); background: rgba(255, 61, 139, .12); }
.gift-grid svg { width: 46px; height: 46px; }
.gift-grid .gn { font-size: 11.5px; margin-top: 2px; } .gift-grid .gp { font-size: 11px; color: var(--gold); font-weight: 800; }
.gift-grid .big-tag { font-size: 8.5px; font-weight: 900; color: #fff; background: var(--grad); border-radius: 4px; padding: 0 4px; margin-top: 2px; }
.gift-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.counts { flex: 1; display: flex; gap: 4px; }
.counts button { padding: 7px 10px; border-radius: 999px; background: var(--surface2); font-weight: 800; font-size: 13px; }
.counts button.on { background: var(--grad); }
.list-title { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; margin: 12px 2px 6px; }
.urow { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; background: var(--surface2); margin-bottom: 6px; }
.urow .nm { flex: 1; min-width: 0; } .urow .nm b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .urow .nm small { color: var(--muted); font-size: 12px; }
.urow button { padding: 7px 12px; font-size: 13px; }
.pk-wait { display: flex; align-items: center; gap: 10px; background: var(--surface2); padding: 10px 12px; border-radius: 14px; margin: 0 16px; }
.pk-wait span:nth-child(2) { flex: 1; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.user-card { text-align: center; padding: 6px 4px; }
.user-card h3 { margin: 8px 0 2px; } .user-card .id { color: var(--muted); font-size: 12.5px; }
.user-card .row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.user-card .stats { grid-template-columns: repeat(3, 1fr); }

.modal { position: fixed; z-index: 45; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { width: min(340px, 100%); background: var(--surface); border-radius: 22px; padding: 20px; text-align: center; border: 1px solid var(--line); animation: pop .3s ease-out; }
.modal-card .row { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.modal-card .row button { flex: 1; }
.pki-swords { font-size: 44px; } .pki-text { font-weight: 800; font-size: 17px; margin: 6px 0; }
.end-title { font-size: 22px; font-weight: 900; margin-bottom: 10px; }
.end-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.end-stats div { background: var(--surface2); border-radius: 12px; padding: 10px; } .end-stats b { display: block; font-size: 20px; } .end-stats span { font-size: 12px; color: var(--muted); }

.toast { position: fixed; z-index: 60; left: 50%; top: calc(var(--safe-t) + 70px); transform: translateX(-50%); background: rgba(23, 20, 31, .96); border: 1px solid var(--line);
  padding: 9px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 700; max-width: 88vw; text-align: center; animation: rise .25s ease-out; }
