/* ============================================================
 * secondFloor.css — 首页下拉二楼（活动领券 + 微信红包封面）
 * ============================================================ */

/* ========== 下拉提示条（随首页下拉从屏幕最顶部露出，非悬浮） ========== */
#sf-pull-hint {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 0.9rem;
    z-index: 10050;              /* 高于顶栏 1001：初始 translateY(-100%) 藏在顶部外 */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;         /* 浅灰底色，衬托浅灰文字 */
    color: #999;                 /* 浅灰色字（浅灰背景下更清晰） */
    text-shadow: none;
    font-size: 0.28rem;
    transform: translateY(-100%);
    pointer-events: none;
}
#sf-pull-hint.ready {
    color: #999;                 /* 浅灰色字，ready 态不变红 */
}

/* ========== 登录后首次下拉引导教程（覆盖首页，不拦截手势） ========== */
#sf-tutorial {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10045;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;        /* 拦截点击，防止点穿到底层控件 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
#sf-tutorial.show {
    opacity: 1;
    visibility: visible;
}
#sf-tutorial .sf-tut-close {
    position: absolute;
    top: calc(0.42rem + env(safe-area-inset-top));
    right: 0.3rem;
    width: 0.8rem;
    height: 0.8rem;
    border: none;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    color: #fff;
    font-size: 0.46rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;        /* 仅关闭按钮可点 */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
#sf-tutorial .sf-tut-close:active {
    background: rgba(255, 255, 255, 0.34);
}
#sf-tutorial .sf-tut-body {
    text-align: center;
    color: #fff;
    padding: 0 0.6rem;
}
#sf-tutorial .sf-tut-arrow {
    width: 1rem;
    height: 1rem;
    margin: 0 auto 0.3rem;
    color: #fff;
    animation: sfTutBounce 1.4s ease-in-out infinite;
}
#sf-tutorial .sf-tut-arrow svg {
    width: 100%;
    height: 100%;
    display: block;
}
#sf-tutorial .sf-tut-title {
    font-size: 0.46rem;
    font-weight: 800;
    letter-spacing: 0.02rem;
}
#sf-tutorial .sf-tut-sub {
    margin-top: 0.18rem;
    font-size: 0.3rem;
    opacity: 0.92;
    line-height: 1.6;
}
@keyframes sfTutBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(0.24rem); }
}

/* ========== 二楼全屏层 ========== */
#sf-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10040;
    transform: translateY(-101%);
    transition: transform 0.4s cubic-bezier(0.22, 0.9, 0.32, 1);
    visibility: hidden;
    pointer-events: none;
}
#sf-overlay.show {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

.sf-bg {
    position: relative;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #FF9BAC;
    box-sizing: border-box;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* 头部 */
.sf-header {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    padding: calc(0.6rem + env(safe-area-inset-top)) 0.32rem 0.36rem;
    text-align: center;
    color: #fff;
}

/* 灰白内容面板：包住海报/卡片/券列表，顶部大圆角，至少撑到屏幕底部（内容更多时跟随内容） */
.sf-panel {
    flex: 1 0 auto;
    min-height: 0;
    margin-top: 0.1rem;
    background: #f5f5f5;
    border-radius: 0.4rem 0.4rem 0 0;
    display: flex;
    flex-direction: column;
}
.sf-panel-inner {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 0.28rem 0.32rem 0.1rem;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.sf-tab-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
/* 顶部 Tab 切换（优惠券 / 红包封面）：纯文字 + 底部焦点圆点 */
.sf-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 0.28rem;
}
.sf-tab {
    position: relative;
    flex: none;
    border: none;
    background: transparent;
    color: #8e8e93;
    font-size: 0.34rem;
    font-weight: 400;
    padding: 0.12rem 0 0.26rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease;
}
.sf-tab::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0.03rem;
    width: 0.13rem;
    height: 0.13rem;
    border-radius: 50%;
    background: transparent;
    transform: translateX(-50%);
    transition: background 0.15s ease;
}
.sf-tab.active {
    color: #333;
    font-weight: 400;
}
.sf-tab.active::after {
    background: rgba(252, 117, 139, 0.75);
}
/* 红包雨入口横幅 */
.sf-rain-entry {
    display: flex;
    align-items: center;
    width: 100%;
    border: none;
    border-radius: 0.24rem;
    padding: 0.26rem 0.30rem;
    margin-bottom: 0.26rem;
    background: linear-gradient(90deg, #ff5f5f 0%, #e8232b 100%);
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 0.08rem 0.20rem rgba(232, 35, 43, 0.28);
}
.sf-rain-entry .sf-rain-emoji {
    width: 0.56rem;
    height: 0.67rem;
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
}
.sf-rain-entry .sf-rain-text {
    flex: 1;
    text-align: left;
    font-size: 0.32rem;
    font-weight: 700;
    letter-spacing: 0.02rem;
}
.sf-rain-entry .sf-rain-sub {
    font-size: 0.24rem;
    font-weight: 400;
    opacity: 0.9;
    margin-top: 0.02rem;
}
.sf-rain-entry .sf-rain-arrow {
    font-size: 0.40rem;
    line-height: 1;
    opacity: 0.9;
}
.sf-title {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.02rem;
}
.sf-sub {
    margin-top: 0.12rem;
    font-size: 0.34rem;
    opacity: 0.92;
    letter-spacing: 0.04rem;
}
.sf-back {
    position: absolute;
    top: calc(0.5rem + env(safe-area-inset-top));
    left: 0.31rem;
    width: 0.74rem;
    height: 0.74rem;
    border: none;
    padding: 0;
    background: transparent;
    color: #fff;
    font-size: 0.42rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.sf-back:active {
    opacity: 0.6;
}
.sf-back svg {
    width: 0.52rem;
    height: 0.52rem;
    flex-shrink: 0;
}
.sf-rules {
    position: absolute;
    top: calc(0.5rem + env(safe-area-inset-top));
    right: 0.32rem;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 0.32rem;
    font-weight: 500;
    padding: 0.14rem 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.sf-rules:active {
    opacity: 0.6;
}

/* 两个入口卡片 */
.sf-cards {
    display: flex;
    flex-direction: column;
    margin-top: 0;
    flex: 1;
}
.sf-card {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
    background: #fff;
    border-radius: 0.34rem;
    padding: 0.6rem 0.32rem;
    text-align: left;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.sf-card-icon {
    width: 3rem;
    height: 4rem;
    flex-shrink: 0;
    border-radius: 0.12rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}
.sf-card-coupon .sf-card-icon {
    background: #e3f2fd;
}
.sf-card-red .sf-card-icon {
    background: #fdecea;
    height: 5rem;
}
.sf-card-red[data-claimed="0"] .sf-card-icon {
    align-self: stretch;
    height: auto;
}
.sf-card-icon img,
.sf-card-icon video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0.12rem;
    display: block;
}
/* 封面视频懒加载占位：视频未就绪时显示浅灰底 + 旋转加载环，弱网下有明确反馈 */
.sf-card-icon-video {
    position: relative;
}
.sf-card-icon-video video {
    background: #f2f2f2;
}
.sf-card-icon-video::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.4rem;
    height: 0.4rem;
    margin: -0.2rem 0 0 -0.2rem;
    border: 0.04rem solid rgba(0, 0, 0, 0.1);
    border-top-color: #FF9BAC;
    border-radius: 50%;
    animation: sfSpin 0.8s linear infinite;
    pointer-events: none;
}
.sf-card-icon-video.loaded::after {
    display: none;
}
@keyframes sfSpin {
    to { transform: rotate(360deg); }
}
.sf-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-left: 0.2rem;
    margin-right: 0.2rem;
    align-self: stretch;
}
/* 红包封面：让卡片内容区高度对齐封面图(5rem)，使底部操作行与图片框底部对齐 */
.sf-card-red .sf-card-body {
    height: 5rem;
}
/* 无记录时：隐藏记录框，让「已领」文字贴顶、领取按钮在剩余空间垂直居中 */
.sf-card-red .sf-card-body.is-empty {
    justify-content: flex-start;
}
.sf-card-red .sf-card-body.is-empty .sf-cover-stage {
    display: none;
}
.sf-card-red .sf-card-body.is-empty .sf-card-actions {
    padding-top: 0;
    flex: 1;
}
.sf-card-head {
    display: flex;
    align-items: baseline;
    width: 100%;
    flex-wrap: nowrap;
}
.sf-card-title {
    font-size: 0.34rem;
    font-weight: 700;
    color: #1c1c1e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.sf-card-desc {
    font-size: 0.26rem;
    color: #8e8e93;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}
.sf-card-qr {
    width: 2.4rem;
    height: 2.4rem;
    flex-shrink: 0;
    align-self: center;
    margin-top: 0.14rem;
    background: #fff;
    border-radius: 0.12rem;
    padding: 0.1rem;
    box-sizing: border-box;
}
.sf-card-qr img {
    width: 100%;
    height: 100%;
    display: block;
}
.sf-card-qr-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    background: transparent;
    padding: 0;
    color: #c7c7cc;
    font-size: 0.26rem;
    font-weight: 500;
    margin: 0;
}
.sf-card-range {
    width: 100%;
    flex-basis: 100%;
    margin-top: 0.12rem;
    font-size: 0.26rem;
    color: #c7c7cc;
    line-height: 1.6;
    text-align: left;
}
.sf-card-tip {
    width: 100%;
    flex-basis: 100%;
    margin-top: 0.3rem;
    padding-top: 0.24rem;
    border-top: 1px solid #f0f0f0;
    font-size: 0.26rem;
    color: #c7c7cc;
    line-height: 1.6;
    text-align: center;
}
.sf-card-top-time {
    font-size: 0.28rem;
    color: #c7c7cc;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: center;
}
.sf-serial-line {
    display: none;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.14rem;
    padding: 0.12rem 0.16rem;
    background: #fff0f3;
    border-radius: 0.16rem;
    align-items: flex-start;
    line-height: 1.5;
}
.sf-serial-line .sf-serial-label {
    flex-shrink: 0;
    font-size: 0.24rem;
    color: #8e8e93;
    padding-top: 0.02rem;
}
.sf-serial-line .sf-serial-value {
    font-size: 0.28rem;
    font-weight: 700;
    color: #d6336c;
    letter-spacing: 0.02rem;
    word-break: break-all;
    min-width: 0;
}
.sf-card-claim {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.sf-card-issuing {
    font-size: 0.32rem;
    font-weight: 700;
    color: #333;
    line-height: 1.4;
    margin-top: -0.06rem;
}
.sf-card-btn {
    flex-shrink: 0;
    margin-top: auto;
    margin-bottom: auto;
    margin-left: auto;
    margin-right: auto;
    padding: 0.18rem 0.42rem;
    border: none;
    border-radius: 9999px;
    font-size: 0.3rem;
    font-weight: 700;
    color: #fff;
}
.sf-card-coupon .sf-card-btn {
    background: rgb(255, 120, 143);
    box-shadow: 0 0.1rem 0.3rem rgba(255, 120, 143, 0.42);
}
.sf-card-red .sf-card-btn {
    background: rgb(255, 120, 143);
    margin-top: auto;
    margin-bottom: 0;
}
.sf-card-red .sf-card-btn.is-done {
    background: #fff0f3;
    color: rgb(254, 123, 145);
    box-shadow: none;
}
.sf-card-red .sf-card-btn.is-waiting {
    background: #f2f2f7;
    color: #8e8e93;
}
.sf-card-red .sf-card-btn[disabled] {
    cursor: default;
    opacity: 1;
}

/* 红包封面：领取记录展示区（只显示当前一张） */
.sf-cover-stage {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 0;
}

/* 卡片底部操作区 */
.sf-card-actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0;
    padding-top: 0.2rem;
}
.sf-card-actions .sf-card-btn {
    margin: 0;
}
.sf-card-nav {
    display: flex;
    align-items: center;
}
.sf-nav-btn {
    border: none;
    background: #fff0f3;
    color: rgb(254, 123, 145);
    font-size: 0.3rem;
    font-weight: 600;
    padding: 0.16rem 0.34rem;
    border-radius: 9999px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.sf-nav-btn:active {
    opacity: 0.6;
}
.sf-nav-ind {
    font-size: 0.28rem;
    color: #8e8e93;
    min-width: 0.9rem;
    text-align: center;
}
.sf-cover-record {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0.12rem;
    background: transparent;
    border-radius: 0.2rem;
    box-sizing: border-box;
}
.sf-record-qr {
    flex: 0 0 auto;
    width: 3rem;
    height: 3rem;
    aspect-ratio: 1 / 1;
    background: #fff;
    border-radius: 0.12rem;
    padding: 0.08rem;
    box-sizing: border-box;
}
.sf-record-qr img {
    width: 100%;
    height: 100%;
    display: block;
}
.sf-record-right {
    flex: 0 0 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.04rem 0;
}
.sf-card-time {
    font-size: 0.26rem;
    color: #8e8e93;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}
.sf-card-top-row {
    flex: 0 0 100%;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-bottom: 0.28rem;
}
.sf-card-top-left {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.sf-card-top-title {
    display: flex;
    align-items: center;
    font-size: 0.34rem;
    font-weight: 700;
    color: #1c1c1e;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex-basis: 100%;
}
.sf-card-top-title::before {
    content: '';
    width: 0.1rem;
    height: 0.34rem;
    border-radius: 0.05rem;
    background: rgb(255, 155, 172);
    margin-right: 0.18rem;
    flex-shrink: 0;
}
.sf-card-top-hint {
    font-size: 0.26rem;
    font-weight: 400;
    color: #8e8e93;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}
.sf-card-top-desc {
    font-size: 0.28rem;
    color: #c7c7cc;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
    align-self: center;
}
.sf-record-copy {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #8e8e93;
    font-size: 0.28rem;
    font-weight: 400;
    padding: 0;
    border-radius: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.sf-record-copy:active {
    opacity: 0.6;
}

/* 领券列表（展开区） */
.sf-coupon-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.12rem 0.06rem 0.2rem;
    font-size: 0.34rem;
    color: #8e8e93;
}
.sf-coupon-bar-text b {
    color: rgb(254, 123, 145);
    font-weight: 600;
}
.sf-coupon-bar-link {
    display: inline-flex;
    align-items: center;
    color: rgb(254, 123, 145);
    font-size: 0.3rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.sf-coupon-bar-arrow {
    margin-left: 0.1rem;
    font-size: 0.36rem;
    line-height: 1;
}
.sf-coupon-bar-link:active {
    opacity: 0.6;
}
.sf-coupon-list {
    display: none;
    margin-top: 0.16rem;
}
.sf-coupon-list.open {
    display: flex;
    flex-direction: column;
}
.sf-coupon-list.open.empty {
    flex: 1;
    justify-content: center;
}
.sf-coupon-list .sf-coupon-item {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 0.34rem;
    padding: 0.46rem 0.32rem;
    min-height: 2.06rem;
}
.sf-coupon-list .sf-coupon-item + .sf-coupon-item {
    margin-top: 0.2rem;
}
.sf-coupon-id {
    position: absolute;
    top: 0.1rem;
    right: 0.3rem;
    font-size: 0.22rem;
    color: #c0c0c0;
    line-height: 1;
}
.sf-coupon-amt {
    flex: none;
    width: 1.7rem;
    text-align: center;
    color: #1976d2;
}
.sf-coupon-amt .v {
    font-size: 0.56rem;
    font-weight: 800;
    line-height: 1;
}
.sf-coupon-amt .u {
    font-size: 0.3rem;
}
.sf-coupon-info {
    flex: 1;
    min-width: 0;
    padding: 0 0.2rem;
}
.sf-coupon-info .t {
    font-size: 0.3rem;
    color: #1c1c1e;
    font-weight: 600;
}
.sf-coupon-info .m {
    margin-top: 0.08rem;
    font-size: 0.24rem;
    color: #8e8e93;
}
.sf-coupon-tag {
    flex: none;
    font-size: 0.24rem;
    color: #fff;
    border-radius: 0.24rem;
    padding: 0.06rem 0.2rem;
}
.sf-coupon-tag.generic {
    background: #1976d2;
}
.sf-coupon-tag.product {
    background: #ff9800;
}

.sf-coupon-claim {
    flex: none;
    padding: 0.14rem 0.3rem;
    border: none;
    border-radius: 9999px;
    background: rgb(255, 120, 143);
    color: #fff;
    font-size: 0.26rem;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.sf-coupon-claim[disabled] {
    opacity: 0.6;
}
.sf-coupon-claim.done {
    background: #b0b0b0;
}
/* 已领取的券：整体弱化显示 */
.sf-coupon-item.claimed .sf-coupon-amt {
    color: #b0b0b0;
}
.sf-coupon-item.claimed .sf-coupon-info .t {
    color: #8e8e93;
}

.sf-empty {
    width: 100%;
    padding: 0.4rem 0.2rem;
    text-align: center;
    color: #8e8e93;
    font-size: 0.28rem;
    background: transparent;
    border-radius: 0.26rem;
    margin: auto 0;
}

/* 底部上拉返回提示：默认隐藏，等二楼完全展开再显示（避免下拉过程与首页/下拉提示重叠） */
.sf-pull-up-hint {
    margin-top: auto;
    text-align: center;
    color: #999;
    font-size: 0.26rem;
    letter-spacing: 0.02rem;
    padding-top: 0.4rem;
    padding-bottom: 0.3rem;
    display: none;
}
/* 二楼完全展开后才显示「上滑动回到一楼」 */
#sf-overlay.show .sf-pull-up-hint {
    display: block;
}
/* 教程显示时隐藏「上滑动回到一楼」灰色字，避免与教程白色字重叠 */
#sf-tutorial.show ~ #sf-overlay .sf-pull-up-hint {
    display: none;
}

/* 加载/提示 toast */
.sf-toast {
    position: fixed;
    left: 50%;
    bottom: 1.6rem;
    transform: translateX(-50%);
    z-index: 10070;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    font-size: 0.28rem;
    padding: 0.2rem 0.4rem;
    border-radius: 0.2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}
.sf-toast.show {
    opacity: 1;
}

/* ===== gap 回退：margin 替代（兼容不支持 flex/grid gap 的旧 WebView） ===== */
#sf-pull-hint > * + * { margin-left: 0.12rem; }
.sf-tabs > * + * { margin-left: 0.7rem; }
.sf-rain-entry > * + * { margin-left: 0.16rem; }
.sf-cards > * + * { margin-top: 0.4rem; }
.sf-card > * { margin-right: 0.26rem; margin-bottom: 0.26rem; }
.sf-card-body > * + * { margin-top: 0.1rem; }
.sf-card-head > * + * { margin-left: 0.16rem; }
.sf-serial-line > * + * { margin-left: 0.1rem; }
.sf-card-claim > * + * { margin-top: 0.5rem; }
.sf-card-nav > * + * { margin-left: 0.2rem; }
.sf-card-top-row > * { margin-right: 0.16rem; margin-bottom: 0.16rem; }
.sf-card-top-left > * + * { margin-top: 0.02rem; }
