* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #111; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #fff; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; }

#phone { position: relative; height: 100%; max-width: 430px; margin: 0 auto; background: #000; overflow: hidden; }
@media (min-width: 600px) {
  body { display: flex; align-items: center; justify-content: center; }
  #phone { height: min(932px, 96vh); width: 430px; border-radius: 36px; box-shadow: 0 0 0 10px #222, 0 20px 60px rgba(0,0,0,.6); }
}

.page { position: absolute; inset: 0 0 56px 0; display: none; overflow-y: auto; background: #111; }
.page.active { display: block; }
#page-home { bottom: 0; background: #000; overflow: hidden; }

/* 底部导航 */
#tabbar { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; display: flex; align-items: center; justify-content: space-around; background: #000; border-top: 1px solid #222; z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
#tabbar button { flex: 1; height: 100%; color: #888; font-size: 15px; }
#tabbar button.on { color: #fff; font-weight: 600; }
#tabbar .plus span { display: inline-block; width: 44px; height: 30px; line-height: 28px; border-radius: 9px; background: #fff; color: #000; font-size: 22px; font-weight: 700; box-shadow: -3px 0 0 #25f4ee, 3px 0 0 #fe2c55; }

/* 顶部 tabs */
.top-tabs { position: absolute; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 14px 8px; background: linear-gradient(rgba(0,0,0,.45), transparent); pointer-events: none; }
.top-tabs > * { pointer-events: auto; }
.top-tabs .logo { font-weight: 800; font-size: 15px; letter-spacing: 1px; background: linear-gradient(90deg, #ff2c55, #ffb800); -webkit-background-clip: text; color: transparent; }
.top-tabs nav button { font-size: 17px; margin: 0 10px; color: rgba(255,255,255,.65); }
.top-tabs nav button.on { color: #fff; font-weight: 700; border-bottom: 2px solid #fff; padding-bottom: 3px; }
.icon-btn { font-size: 18px; }

/* 竖屏流 */
#feed { height: calc(100% - 56px); overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain; }
#feed::-webkit-scrollbar { display: none; }
.room { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: #000 center/cover no-repeat; }
.room video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.room .shade { position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(0,0,0,.55)); pointer-events: none; }
.empty-feed { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #888; gap: 10px; }

/* 直播间头部信息 */
.host { position: absolute; top: calc(52px + env(safe-area-inset-top)); left: 10px; display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.35); border-radius: 22px; padding: 3px 4px 3px 3px; max-width: 64%; }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; border: 1.5px solid #fff; }
.avatar.big { width: 80px; height: 80px; font-size: 32px; border-width: 3px; }
.host .info { min-width: 0; line-height: 1.2; }
.host .nm { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; }
.vbadge { flex: none; display: inline-block; width: 14px; height: 14px; line-height: 14px; text-align: center; border-radius: 50%; background: #d4202c; color: #ffd76a; font-size: 9px; font-weight: 800; }
.host .sub { font-size: 11px; opacity: .8; }
.follow-btn { flex: none; background: #fe2c55; border-radius: 16px; padding: 5px 11px; font-size: 13px; font-weight: 600; }
.follow-btn.done { background: rgba(255,255,255,.2); }

.room-top-right { position: absolute; top: calc(54px + env(safe-area-inset-top)); right: 10px; display: flex; align-items: center; gap: 6px; }
.viewers { background: rgba(0,0,0,.35); border-radius: 14px; padding: 4px 10px; font-size: 12px; }
.live-badge { background: linear-gradient(90deg, #ff2c55, #ff6a00); border-radius: 4px; padding: 2px 6px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.live-badge i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.room-tags { position: absolute; top: calc(96px + env(safe-area-inset-top)); left: 10px; display: flex; gap: 6px; font-size: 11px; }
.room-tags span { background: rgba(0,0,0,.3); padding: 3px 8px; border-radius: 10px; }
.room-tags .soe { background: rgba(212,32,44,.85); font-weight: 600; }
.room-tags .hot { background: rgba(255,170,0,.85); color: #000; font-weight: 600; }

/* 进场提示 & 礼物横幅 */
.enter-tip { position: absolute; left: 10px; bottom: 296px; font-size: 12px; background: linear-gradient(90deg, rgba(255,170,0,.7), transparent); padding: 4px 30px 4px 10px; border-radius: 12px; opacity: 0; transition: opacity .3s; }
.enter-tip.show { opacity: 1; }
.gift-banners { position: absolute; left: 10px; bottom: 330px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.gift-banner { display: flex; align-items: center; gap: 6px; background: linear-gradient(90deg, rgba(254,44,85,.85), rgba(254,44,85,0)); padding: 3px 34px 3px 3px; border-radius: 20px; font-size: 12px; animation: slideIn .4s ease-out, fadeOut .5s 2.6s forwards; }
.gift-banner .avatar { width: 28px; height: 28px; font-size: 12px; border-width: 1px; }
.gift-banner .gi { font-size: 30px; margin-left: 4px; }
.gift-banner b { font-size: 18px; color: #ffe066; font-style: italic; }
@keyframes slideIn { from { transform: translateX(-110%); } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }
.big-gift { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 140px; pointer-events: none; animation: bigGift 2.2s ease-out forwards; z-index: 5; }
@keyframes bigGift { 0% { transform: scale(.2) translateY(200px); opacity: 0; } 25% { transform: scale(1.1); opacity: 1; } 75% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.4) translateY(-200px); opacity: 0; } }

/* 评论区 */
.chat { position: absolute; left: 10px; bottom: 112px; width: 72%; height: 180px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 5px; -webkit-mask-image: linear-gradient(transparent, #000 30%); mask-image: linear-gradient(transparent, #000 30%); }
.chat .line { align-self: flex-start; max-width: 100%; background: rgba(0,0,0,.3); border-radius: 12px; padding: 4px 9px; font-size: 13px; line-height: 1.35; word-break: break-all; animation: pop .25s ease-out; }
.chat .line .u { color: #a8d8ff; margin-right: 4px; }
.chat .line.sys { color: #ffe08a; }
.chat .line.me .u { color: #ffb3c4; }
.chat .lv { display: inline-block; font-size: 9px; background: #4a7bff; border-radius: 6px; padding: 0 4px; margin-right: 4px; vertical-align: 1px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* 正在讲解的商品卡 */
.explain-card { position: absolute; right: 10px; bottom: 120px; width: 118px; background: #fff; color: #222; border-radius: 10px; overflow: hidden; font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.3); animation: pop .3s; cursor: pointer; }
.explain-card .ex-tag { background: #fe2c55; color: #fff; font-size: 11px; padding: 2px 6px; }
.explain-card .pic { height: 66px; background: center/cover no-repeat; }
.explain-card .nm { padding: 4px 6px 0; height: 34px; overflow: hidden; line-height: 1.3; }
.explain-card .pr { padding: 2px 6px 6px; color: #fe2c55; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.explain-card .pr button { background: #fe2c55; color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 11px; }

/* 底部操作栏 */
.room-bar { position: absolute; left: 0; right: 0; bottom: 64px; display: flex; align-items: center; gap: 8px; padding: 0 10px; }
.room-bar .say { flex: 1; height: 38px; border-radius: 19px; background: rgba(0,0,0,.35); display: flex; align-items: center; padding: 0 4px 0 14px; }
.room-bar .say input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: #fff; font-size: 14px; }
.room-bar .say input::placeholder { color: rgba(255,255,255,.6); }
.room-bar .say button { font-size: 13px; padding: 6px 10px; border-radius: 15px; background: #fe2c55; display: none; }
.room-bar .say.typing button { display: block; }
.rb-btn { width: 38px; height: 38px; border-radius: 50%; background: rgba(0,0,0,.35); font-size: 19px; display: flex; align-items: center; justify-content: center; position: relative; }
.rb-btn.cart { background: #ffb800; }
.rb-btn .num { position: absolute; top: -4px; right: -4px; background: #fe2c55; color: #fff; font-size: 10px; border-radius: 8px; padding: 0 4px; line-height: 15px; }
.like-count { position: absolute; right: 8px; bottom: 106px; font-size: 11px; text-align: center; width: 54px; text-shadow: 0 1px 2px #000; }

/* 飘心 */
.heart { position: absolute; font-size: 28px; pointer-events: none; animation: float 1.6s ease-out forwards; z-index: 6; }
@keyframes float { 0% { transform: translate(0,0) scale(.4); opacity: 0; } 15% { opacity: 1; transform: translate(0,-20px) scale(1.1); } 100% { transform: translate(var(--dx), -260px) scale(.9); opacity: 0; } }
.tap-heart { position: absolute; font-size: 80px; pointer-events: none; animation: tapHeart .8s ease-out forwards; transform: translate(-50%, -50%); z-index: 6; }
@keyframes tapHeart { 0% { transform: translate(-50%,-50%) scale(.3) rotate(var(--r)); opacity: 0; } 30% { transform: translate(-50%,-50%) scale(1.2) rotate(var(--r)); opacity: 1; } 100% { transform: translate(-50%,-150%) scale(1.5) rotate(var(--r)); opacity: 0; } }

#sound-tip { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.55); padding: 10px 18px; border-radius: 20px; font-size: 14px; z-index: 15; pointer-events: none; transition: opacity .4s; }
#sound-tip.hide { opacity: 0; }

/* 底部弹层 */
#sheet-mask { position: absolute; inset: 0; background: rgba(0,0,0,.4); z-index: 40; display: none; }
#sheet-mask.show { display: block; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 41; background: #1c1c1e; border-radius: 16px 16px 0 0; max-height: 72%; overflow-y: auto; transform: translateY(100%); transition: transform .25s; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
.sheet.show { transform: translateY(0); }
.sheet h3 { font-size: 16px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.sheet h3 small { font-size: 12px; color: #999; font-weight: 400; }
.prod { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid #2c2c2e; }
.prod .pic { width: 86px; height: 86px; border-radius: 8px; background: center/cover no-repeat; flex: none; position: relative; }
.prod .pic span { position: absolute; left: 0; top: 0; background: rgba(0,0,0,.6); font-size: 11px; padding: 1px 6px; border-radius: 8px 0 8px 0; }
.prod .body { flex: 1; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.prod .body .nm { font-size: 14px; line-height: 1.35; }
.prod .body .meta { font-size: 11px; color: #999; }
.prod .row { display: flex; justify-content: space-between; align-items: flex-end; }
.price { color: #fe2c55; font-weight: 700; font-size: 18px; }
.price small { font-size: 12px; }
.price del { color: #777; font-size: 11px; font-weight: 400; margin-left: 4px; }
.buy-btn { background: #fe2c55; border-radius: 16px; padding: 6px 14px; font-size: 13px; font-weight: 600; }
.gift-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gift-item { border-radius: 10px; padding: 8px 0; text-align: center; border: 1.5px solid transparent; }
.gift-item.sel { border-color: #fe2c55; background: rgba(254,44,85,.12); }
.gift-item .gi { font-size: 34px; }
.gift-item .gn { font-size: 12px; }
.gift-item .gp { font-size: 11px; color: #999; }
.gift-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 13px; color: #ccc; }
.primary { background: #fe2c55; color: #fff; border-radius: 22px; padding: 10px 26px; font-size: 15px; font-weight: 600; }
.profile-card { text-align: center; padding: 8px 0; }
.profile-card .avatar { margin: 0 auto 10px; }
.profile-card p { color: #aaa; font-size: 13px; margin: 6px 0; }
.profile-card .stats { display: flex; justify-content: center; gap: 24px; margin: 14px 0; font-size: 13px; color: #aaa; }
.profile-card .stats b { display: block; color: #fff; font-size: 17px; }

#toast { position: absolute; top: 45%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.8); padding: 10px 18px; border-radius: 8px; font-size: 14px; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; white-space: nowrap; }
#toast.show { opacity: 1; }

/* 广场 */
.plain-head { position: sticky; top: 0; z-index: 2; background: #111; padding: calc(14px + env(safe-area-inset-top)) 14px 10px; font-size: 18px; font-weight: 700; }
.chips { display: flex; gap: 8px; padding: 0 12px 10px; overflow-x: auto; scrollbar-width: none; }
.chips button { flex: none; background: #222; border-radius: 14px; padding: 5px 12px; font-size: 13px; color: #bbb; }
.chips button.on { background: #fe2c55; color: #fff; }
#grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 6px 12px; }
.card { position: relative; aspect-ratio: 3/4; border-radius: 8px; overflow: hidden; background: #222 center/cover no-repeat; cursor: pointer; }
.card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 50%, rgba(0,0,0,.7)); }
.card .live-badge { position: absolute; top: 6px; left: 6px; z-index: 1; }
.card .cv { position: absolute; top: 6px; right: 6px; font-size: 11px; background: rgba(0,0,0,.4); padding: 1px 6px; border-radius: 8px; z-index: 1; }
.card .ct { position: absolute; left: 8px; right: 8px; bottom: 26px; font-size: 13px; font-weight: 600; z-index: 1; line-height: 1.3; }
.card .cn { position: absolute; left: 8px; right: 8px; bottom: 7px; font-size: 11px; opacity: .85; z-index: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 开播 */
#page-golive { background: #000; }
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); background: #1a1a1a; }
.golive-panel { position: absolute; left: 14px; right: 14px; bottom: 20px; background: rgba(0,0,0,.6); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.golive-panel input { background: rgba(255,255,255,.1); border: 0; border-radius: 8px; padding: 10px; color: #fff; outline: 0; }
.golive-panel .hint { font-size: 12px; color: #aaa; line-height: 1.5; }

/* 消息 & 我 */
.msg-list { list-style: none; }
.msg-list li { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid #1f1f1f; }
.msg-list .avatar { width: 46px; height: 46px; }
.msg-list .m { flex: 1; min-width: 0; }
.msg-list .m b { font-size: 15px; font-weight: 600; display: flex; gap: 4px; align-items: center; }
.msg-list .m p { font-size: 13px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.msg-list time { font-size: 11px; color: #666; }
.me-head { text-align: center; padding: calc(30px + env(safe-area-inset-top)) 0 20px; background: linear-gradient(#3a1020, #111); }
.me-head .avatar { margin: 0 auto 10px; }
.me-head p { color: #999; font-size: 12px; margin-top: 4px; }
.me-stats { margin-top: 12px; font-size: 13px; color: #aaa; }
.me-stats b { color: #fff; font-size: 16px; margin-left: 10px; }
.me-section { padding: 12px 14px; }
.me-section h3 { font-size: 15px; margin-bottom: 10px; }
.me-follow-list { display: flex; gap: 12px; overflow-x: auto; }
.me-follow-list div { text-align: center; font-size: 11px; width: 60px; flex: none; color: #ccc; cursor: pointer; }
.me-follow-list .avatar { width: 48px; height: 48px; margin: 0 auto 4px; }
.orders { list-style: none; font-size: 13px; }
.orders li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #1f1f1f; color: #ccc; }
.muted { color: #666; font-size: 13px; }

/* 启动页 */
#splash { position: absolute; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 30px; text-align: center; background: radial-gradient(circle at 50% 35%, #5a0f1c, #0a0a0a 70%); transition: opacity .35s; }
#splash.gone { opacity: 0; pointer-events: none; }
.splash-logo { font-size: 44px; font-weight: 900; letter-spacing: 4px; background: linear-gradient(90deg, #ff2c55, #ffb800); -webkit-background-clip: text; color: transparent; }
.splash-sub { color: #ddd; font-size: 15px; margin-bottom: 20px; }
#btn-enter { font-size: 17px; padding: 13px 40px; }
.splash-note { position: absolute; bottom: calc(28px + env(safe-area-inset-bottom)); left: 20px; right: 20px; color: #888; font-size: 12px; line-height: 1.6; }

/* 视频加载中 */
.spinner { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: none; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; color: rgba(255,255,255,.85); z-index: 2; pointer-events: none; }
.spinner i { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.room.buffering .spinner { display: flex; }
@keyframes spin { to { transform: rotate(360deg); } }
