:root { --sp: #5b6cff; --sp2: #3f4fe0; --spbg: #111830; --spcard: #182140; --spline: rgba(255,255,255,.08); }
.sp-fab { position: fixed; z-index: 70; right: max(16px, calc(50% - 280px + 16px)); bottom: calc(var(--tab-h) + var(--safe-b) + 16px); width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #6b7bff, #3f4fe0); box-shadow: 0 8px 24px rgba(63,79,224,.5), inset 0 1px 0 rgba(255,255,255,.3); transition: transform .2s, opacity .2s; }
.sp-fab:active { transform: scale(.92); } .sp-fab.hide { transform: scale(0); opacity: 0; pointer-events: none; }
body.ingame .sp-fab { display: none; }
.sp-fab.has { animation: spring 2s infinite; } @keyframes spring { 0%, 80%, 100% { transform: scale(1); } 90% { transform: scale(1.12); } }
.sp-dot { position: absolute; top: 3px; right: 3px; width: 13px; height: 13px; border-radius: 50%; background: #ff4d5e; border: 2px solid #0c1227; }

.sp-sheet { position: fixed; z-index: 85; top: 0; bottom: 0; left: 50%; width: 100%; max-width: 560px; transform: translateX(-50%); background: var(--spbg); display: flex; flex-direction: column; animation: spin .3s cubic-bezier(.2,.8,.2,1); color: #f3f5ff; font-family: var(--sans); }
@keyframes spin { from { transform: translate(-50%, 40px); opacity: 0; } }
.sp-sheet[hidden] { display: none; }
.sp-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.sp-scroll::-webkit-scrollbar { display: none; }
.sp-top { display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px; border-bottom: 1px solid var(--spline); background: var(--spbg); }
.sp-top b { flex: 1; font-size: 17px; font-weight: 700; } .sp-top.c b { text-align: center; padding-left: 34px; }
.sp-i, .sp-x { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #dfe3ff; background: rgba(255,255,255,.06); flex: none; }
.sp-x { margin-left: auto; }
.sp-hero { position: relative; padding: calc(18px + env(safe-area-inset-top, 0px)) 22px 90px; background: linear-gradient(160deg, #6b5bff 0%, #4a47e8 45%, #1a2346 100%); }
.sp-hero .sp-x { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; background: rgba(255,255,255,.18); }
.sp-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 38px; } .sp-brand b { font-weight: 800; font-size: 26px; letter-spacing: -.03em; }
.sp-pbox { width: 34px; height: 34px; border-radius: 10px; background: #fff; color: #3f4fe0; display: grid; place-items: center; font-weight: 800; font-size: 21px; flex: none; } .sp-pbox.sm { width: 34px; height: 34px; font-size: 20px; }
.sp-hero h1 { margin: 0; font-size: 30px; line-height: 1.12; font-weight: 800; letter-spacing: -.02em; }
.sp-up { margin-top: -62px; padding: 0 12px 100px; position: relative; }
.sp-card { background: var(--spcard); border: 1px solid var(--spline); border-radius: 16px; margin-bottom: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.sp-card:empty { display: none; }
.sp-recent { display: block; width: 100%; text-align: left; padding: 14px 16px; } .sp-recent small { font-weight: 700; font-size: 13px; display: block; margin-bottom: 10px; }
.sp-mrow { display: flex; gap: 12px; align-items: center; } .sp-mrow > div { flex: 1; min-width: 0; } .sp-mrow b, .sp-conv b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .sp-mrow p, .sp-conv p { margin: 2px 0 0; color: #9aa3d6; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .sp-mrow em, .sp-conv em { font-style: normal; color: #9aa3d6; font-size: 12px; align-self: flex-start; }
.sp-av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800; background: linear-gradient(135deg, #ff7aa8, #8a5bff); color: #fff; } .sp-av.ai { background: #212d55; color: #aab4ff; } .sp-av.sm { width: 24px; height: 24px; font-size: 11px; }
.sp-search { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 16px; margin: 0; background: rgba(255,255,255,.05); border-bottom: 1px solid var(--spline); color: #dfe3ff; } .sp-search b { font-size: 14px; } .sp-search svg { color: var(--sp); }
.sp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 14px 16px; font-size: 14px; color: #e6e9ff; border-bottom: 1px solid var(--spline); } .sp-row:last-child { border: 0; } .sp-row svg, .sp-coll svg { color: var(--sp); flex: none; }
.sp-send { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 16px; text-align: left; } .sp-send b { font-size: 15px; display: block; } .sp-send small { color: #9aa3d6; font-size: 12.5px; } .sp-send span { color: var(--sp); }
.sp-nav { display: flex; border-top: 1px solid var(--spline); background: var(--spbg); padding-bottom: env(safe-area-inset-bottom, 0px); }
.sp-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 11px 0 12px; font-size: 12px; font-weight: 600; color: #9aa3d6; position: relative; } .sp-nav button.on { color: #8c98ff; }
.sp-n { position: absolute; top: 6px; left: calc(50% + 8px); min-width: 17px; height: 17px; border-radius: 9px; background: #ff4d5e; color: #fff; font-size: 10px; font-style: normal; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }
.sp-conv { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--spline); position: relative; } .sp-conv > div { flex: 1; min-width: 0; } .sp-conv .sp-n { position: static; }
.sp-empty { text-align: center; color: #9aa3d6; padding: 40px 20px; font-size: 14px; }
.sp-fl { padding: 14px; display: flex; justify-content: center; background: linear-gradient(transparent, rgba(15,20,50,.9)); }
.sp-cta { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 22px; border-radius: 22px; background: linear-gradient(145deg, #7a89ff, #4c5cf0); color: #fff; font-weight: 700; font-size: 14.5px; box-shadow: 0 8px 20px rgba(76,92,240,.4); }
.sp-sbox { display: flex; align-items: center; gap: 10px; margin: 14px; padding: 0 14px; height: 46px; border-radius: 12px; background: var(--spcard); border: 1px solid var(--spline); color: var(--sp); } .sp-sbox input { flex: 1; background: none; border: 0; outline: 0; color: #fff; font-size: 15px; user-select: text; -webkit-user-select: text; }
.sp-cnt { padding: 10px 16px 12px; font-weight: 800; font-size: 15px; border-bottom: 1px solid var(--spline); }
.sp-coll { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; padding: 16px; border-bottom: 1px solid var(--spline); gap: 10px; } .sp-coll b { font-size: 14.5px; } .sp-coll p { margin: 3px 0 4px; font-size: 13.5px; color: #cdd2f5; } .sp-coll small { color: #9aa3d6; }
.sp-art { padding: 22px 18px; } .sp-art h2 { margin: 0 0 14px; font-size: 22px; } .sp-art p { color: #d4d8f8; line-height: 1.65; font-size: 15px; margin: 0 0 28px; }
.sp-still { padding-top: 20px; border-top: 1px solid var(--spline); text-align: center; color: #9aa3d6; display: flex; flex-direction: column; gap: 14px; align-items: center; font-size: 13px; }

/* chat */
.sp-top.chat { gap: 12px; } .sp-tt { flex: 1; min-width: 0; line-height: 1.2; } .sp-tt b { display: block; font-size: 16px; } .sp-tt small { color: #9aa3d6; font-size: 12.5px; }
.chatbody { padding: 16px 14px 8px; display: flex; flex-direction: column; }
.sp-intro { text-align: center; color: #9aa3d6; font-size: 14px; margin: 6px 0 18px; }
.sp-b { display: flex; flex-direction: column; max-width: 82%; margin-bottom: 3px; } .sp-b.f { margin-top: 12px; }
.sp-b.me { align-self: flex-end; align-items: flex-end; } .sp-b.th { align-self: flex-start; }
.sp-t { padding: 11px 16px; border-radius: 20px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; user-select: text; -webkit-user-select: text; }
.sp-b.th .sp-t { background: #1f2848; border-bottom-left-radius: 6px; } .sp-b.me .sp-t { background: linear-gradient(145deg, #7a6bff, #5b4df0); border-bottom-right-radius: 6px; }
.sp-b small { color: #9aa3d6; font-size: 12px; margin: 6px 4px 6px; }
.sp-sys { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 18px 0 8px; color: #b8c0f0; font-size: 13px; text-align: center; } .sp-sys b { color: #fff; }
.sp-typing { display: flex; gap: 5px; padding: 15px 16px; } .sp-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa3d6; animation: tp 1s infinite; } .sp-typing i:nth-child(2) { animation-delay: .15s; } .sp-typing i:nth-child(3) { animation-delay: .3s; } @keyframes tp { 50% { transform: translateY(-5px); opacity: .5; } }
.sp-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 18px 0 8px; } .sp-chips button { padding: 11px 17px; border-radius: 20px; background: #242f55; color: #dfe3ff; font-size: 14.5px; font-weight: 500; } .sp-chips button:active { background: #3a4180; }
.sp-comp { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--spline); } .sp-comp input { flex: 1; height: 46px; border-radius: 23px; border: 1px solid var(--spline); background: var(--spcard); padding: 0 18px; color: #fff; font-size: 15px; outline: 0; user-select: text; -webkit-user-select: text; } .sp-comp input:focus { border-color: var(--sp); }
.sp-comp button { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(145deg, #7a89ff, #4c5cf0); color: #fff; display: grid; place-items: center; }
.sp-ended { text-align: center; padding: 18px 14px calc(18px + env(safe-area-inset-bottom, 0px)); color: #9aa3d6; border-top: 1px solid var(--spline); display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* popup panel like a chat widget (bottom-right), not a full page */
.sp-sheet { top: auto; bottom: 92px; left: auto; right: 20px; transform: none; width: 392px; max-width: calc(100vw - 16px); height: min(720px, calc(100vh - 120px)); border-radius: 18px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); box-shadow: 0 24px 70px rgba(0,0,0,.6); animation: spup .28s cubic-bezier(.2,.8,.2,1); }
@keyframes spup { from { transform: translateY(24px) scale(.98); opacity: 0; } }
@media (max-width: 600px) { .sp-sheet { left: 8px; right: 8px; width: auto; max-width: none; top: calc(var(--tg-top, 0px) + 8px); bottom: 8px; height: auto; } }
.sp-hero { padding: 18px 20px 84px; } .sp-hero h1 { font-size: 25px; } .sp-brand { margin-bottom: 30px; } .sp-brand b { font-size: 24px; }
.sp-av { background-size: cover; background-position: center; } .sp-av.hd { width: 36px; height: 36px; } .sp-av.sm { width: 22px; height: 22px; font-size: 10px; }
.sp-chips { justify-content: flex-end; } .sp-chips button { background: linear-gradient(145deg, #7a6bff, #5b4df0); color: #fff; border-radius: 18px; padding: 10px 16px; font-size: 14px; }
.sp-ended { border-top: 1px solid var(--spline); color: #aab2e0; font-size: 14px; }
