html, body {
    width: 100%;
    height: 100%;
}

body {
    background: #000;
}

.gift-page {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.gift-bg {
    position: absolute;
    inset: 0;
    background: url("../images/bg-page.png") center top no-repeat;
    background-size: cover;
    z-index: 0;
}

.gift-header {
    position: relative;
    z-index: 2;
    height: 1.3rem;
    padding: 0.18rem 0.28rem 0;
    display: flex;
    align-items: flex-start;
    flex-direction: row-reverse;
    justify-content: space-between;
    pointer-events: none;
}

.gift-logo {
    width: 2.4rem;
    height: 0.86rem;
    background: url("../images/Logo.png") left top no-repeat;
    background-size: contain;
    pointer-events: auto;
}

.gift-header-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
    pointer-events: auto;
}

.gift-header-icons {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.16rem;
    flex-shrink: 0;
}

.gift-header .gift-header-icons {
    display: none;
}

.gift-header-icons--top {
    display: none;
}

.gift-icon-btn {
    width: 0.56rem;
    height: 0.56rem;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.gift-icon-btn img {
    width: 100%;
    height: 100%;
    display: block;
}

.gift-login {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

/* 登录与退出互斥：仅显示其一 */
.gift-login.is-logged-in .login-before {
    display: none !important;
}

.gift-login.is-logged-out .login-before {
    display: block !important;
}

.gift-login.is-logged-out .gift-login-after.login-after {
    display: none !important;
}

.gift-auth-btn {
    position: relative;
    width: 1.72rem;
    height: 0.53rem;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.gift-auth-btn img {
    width: 100%;
    height: 100%;
    display: block;
}

.gift-auth-btn img:last-child {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.gift-auth-btn:hover img:last-child {
    opacity: 1;
}

.gift-login-after {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    width: 100%;
}

.gift-login-after .btn-logout {
    align-self: center;
}

.gift-action-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.16rem;
}

.gift-welcome-stack {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.14rem;
    width: 100%;
    max-width: 5.6rem;
}

.gift-login-after .gift-switch-role-btn {
    align-self: center;
    display: block;
    margin-left: 0;
}

.gift-welcome {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.06rem 0.08rem;
    font-size: 0.16rem;
    color: #000;
    text-shadow: 0 2px 6px rgba(0,0,0,0.45);
    white-space: nowrap;
    text-align: left;
    max-width: 100%;
}

.gift-welcome-label {
    opacity: 0.9;
}

.gift-welcome-account,
.gift-welcome-block,
.gift-welcome-role {
    font-family: 'main-font-medium', 'main-font', sans-serif;
}

.gift-switch-role-btn {
    border: 0;
    padding: 0;
    margin-left: 0;
    background: transparent;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.16rem;
    line-height: 1;
    text-align: center;
}

.gift-switch-role-btn:hover {
    color: #fff;
}

/* 桌面端：移动端专用账号条隐藏 */
.gift-mobile-login-strip,
.gift-mobile-user-strip {
    display: none;
}

.gift-user {
    font-size: 0.16rem;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 2px 6px rgba(0,0,0,0.45);
    max-width: 3.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-top: 0.05rem;
}

.gift-main {
    position: relative;
    z-index: 1;
    width: 100%;
    height: calc(100% - 1.3rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -50px;
}

.gift-title {
    /* width: 60vw;
    height: 12.6vw;
    max-width: 1000px;
    max-height: 210px; */
    width: 10rem;
    height: 2.1rem;
    background: url("../images/sologan.png") no-repeat;
    background-size: 100% 100%;
    margin-top: -20px;
}

.gift-time-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.24rem;
    margin-top: -0.2rem;
}

.gift-time {
    position: relative;
    width: 7rem;
    height: 0.85rem;
    margin-top: 0;
}

.gift-time-bg {
    position: absolute;
    inset: 0;
    background: url("../images/bg-time.png") center no-repeat;
    background-size: cover;
}

.gift-time-text {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.18rem;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 2px 6px rgba(0,0,0,0.35);
    letter-spacing: 0.03rem;
    padding-top: 0.13rem;
    /* background: url("../images/bg-time.png") center no-repeat;
    background-size: 100% 100%; */
    /* color: #5c61d0; */
    /* font-family: '江城斜宋体', 'Source Han Serif CN', 'STSong', '宋体', serif; */
    font-weight: bold;
    /* line-height: 1.8; */
    /* text-align: center; */
    font-style: italic;
}

.gift-cards {
    margin-top: 0.22rem;
    display: flex;
    gap: 0.38rem;
    align-items: flex-start;
    justify-content: center;
}

.gift-card {
    position: relative;
    width: 4.15rem;
    height: 4.97rem;
}

.gift-card-bg {
    position: absolute;
    inset: 0;
    background: url("../images/bg-gift.png") center no-repeat;
    background-size: 100% 100%;
    filter: drop-shadow(0 12px 24px rgba(0,0,0,0.25));
}

.gift-card-title {
    position: absolute;
    top: 0.2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2.8rem;
    /* height: 0.55rem; */
}

.gift-card-title img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.gift-card-icon {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 1.2rem;
    height: 1.2rem;
}

.gift-card-icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.gift-card-list {
    position: absolute;
    left: 0.35rem;
    top: 2.2rem;
    right: 0.4rem;
    font-size: 0.18rem;
    line-height: 0.28rem;
    color: #6a4a3f;  
    text-align: center;
    /* font-family: 'main-font-medium', 'main-font', sans-serif; */
    /* font-family: '江城斜宋体', 'Source Han Serif CN', 'STSong', '宋体', serif; */
    /* font-weight: bold; */
    font-style: italic;
}

.gift-card-list li {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gift-get-wrap {
    position: absolute;
    left: 50%;
    bottom: 0.25rem;
    transform: translateX(-50%);
    width: 1.96rem;
    height: 0.6rem;
}

.gift-get-btn {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.gift-get-btn img {
    width: 100%;
    height: 100%;
    display: block;
}

.gift-get-btn .img-hover,
.gift-get-btn .img-disabled {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.gift-get-btn.is-claimable:hover .img-hover {
    opacity: 1;
}

/* 已领取：仅显示灰态图 */
.gift-get-btn.is-claimed {
    cursor: default;
    pointer-events: auto;
}

.gift-get-btn.is-claimed .img-normal,
.gift-get-btn.is-claimed .img-hover {
    opacity: 0;
}

.gift-get-btn.is-claimed .img-disabled {
    opacity: 1;
}

/* 未达成：可悬停看原因，按钮置灰样式 */
.gift-get-btn.is-locked {
    cursor: default;
    pointer-events: auto;
    filter: grayscale(0.9);
    opacity: 0.72;
}

.gift-get-btn.is-locked .img-normal {
    opacity: 1;
}

.gift-get-btn.is-locked .img-hover,
.gift-get-btn.is-locked .img-disabled {
    opacity: 0;
}

.gift-get-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.08rem);
    transform: translateX(-50%);
    min-width: 1.6rem;
    max-width: 2.8rem;
    padding: 0.1rem 0.14rem;
    font-size: 0.13rem;
    line-height: 0.2rem;
    color: #fff;
    text-align: center;
    background: rgba(30, 22, 18, 0.92);
    border-radius: 0.08rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    z-index: 5;
    pointer-events: none;
    white-space: normal;
    word-break: break-all;
}

.gift-get-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    margin-left: -0.06rem;
    border: 0.06rem solid transparent;
    border-top-color: rgba(30, 22, 18, 0.92);
}

.gift-get-wrap:not(.show-tip) .gift-get-tooltip,
.gift-get-tooltip:empty {
    display: none !important;
}

/* 只在悬停/聚焦时显示原因 */
.gift-get-wrap.show-tip .gift-get-tooltip {
    display: none !important;
}

.gift-get-wrap.show-tip:hover .gift-get-tooltip,
.gift-get-wrap.show-tip:focus-within .gift-get-tooltip {
    display: block !important;
}

.gift-bottom-tip {
    margin-top: 0.18rem;
    width: 10.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gift-tip-img {
    width: 100%;
    max-width: 10.8rem;
    height: auto;
    display: block;
}

.gift-tip-text {
    font-size: 0.2rem;
    color: #5c61d0;
    /* font-family: '江城斜宋体', 'Source Han Serif CN', 'STSong', '宋体', serif; */
    font-weight: bold;
    line-height: 1.8;
    text-align: center;
    font-style: italic;
    letter-spacing: 0.02rem;
}

/* 弹窗（规则/记录） */
.gift-popup {
    position: relative;
    width: 9.6rem;
    height: 5.6rem;
    margin: 0 auto;
}

.gift-popup-bg {
    position: absolute;
    inset: 0;
    background: url("../images/bg-popup-main.png") center no-repeat;
    background-size: 100% 100%;
}

.gift-popup-content {
    position: relative;
    z-index: 1;
    padding: 0.9rem 0.9rem 0.7rem 1.2rem;
    height: 100%;
}

.gift-popup-title {
    font-size: 0.24rem;
    color: #3b2a22;
    margin-bottom: 0.18rem;
}

.gift-rule-list {
    padding-left: 0.3rem;
    font-size: 0.2rem;
    line-height: 0.4rem;
    color: #3b2a22;
}

.gift-log-empty {
    font-size: 18px;
    color: #3b2a22;
    padding-top: 0.3rem;
}

.gift-log-list {
    margin-top: 0.2rem;
    max-height: 3.6rem;
    overflow: auto;
    font-size: 0.16rem;
    color: #3b2a22;
}

/* 领取记录表格样式 */
.gift-log-group {
    margin-bottom: 0.24rem;
}

.gift-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.15rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0.08rem;
    overflow: hidden;
}

.gift-log-table thead {
    background: rgba(139, 115, 85, 0.2);
}

.gift-log-table th,
.gift-log-table td {
    padding: 0.1rem 0.08rem;
    text-align: center;
    border-bottom: 1px solid rgba(139, 115, 85, 0.15);
}

.gift-log-table th {
    font-weight: 600;
    color: #5d4e37;
    font-size: 0.14rem;
}

.gift-log-table td {
    color: #6a4a3f;
}

.gift-log-table tbody tr:last-child td {
    border-bottom: none;
}

.gift-log-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 让通用弹窗主容器透明，显示我们的 PNG */
#rule-dialog .mod-dialog-main,
#log-dialog .mod-dialog-main {
    width: 10rem;
    height: 6rem;
    background: none;
    padding-left: 0;
}

#rule-dialog .mod-dialog-content,
#log-dialog .mod-dialog-content {
    height: 100%;
}

#rule-dialog .mod-dialog-close1,
#log-dialog .mod-dialog-close1 {
    font-size: 0;
    line-height: 0;
    width: 0.56rem;
    height: 0.56rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gift-log-group-title {
    margin-top: 0.14rem;
    font-size: 0.2rem;
    font-family: 'main-font-medium', 'main-font', sans-serif;
    font-size: bold;
}

.gift-log-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.16rem;
}

.gift-log-item-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-login1 {
    padding: 0.1rem 0.75rem !important;
}

/* 移动端适配：纵向排布 + 自适应缩放 */
@media screen and (max-width: 768px) {
    .gift-page {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .gift-bg {
        background-image: url("../images/bg-mini.jpg");
        background-position: center top;
        background-size: cover;
    }

    .gift-log-list {
        max-height: 31vh;
    }

    .gift-header {
        height: auto;
        padding: 16px 14px 0;
    }

    .gift-header-actions {
        justify-content: flex-end;
        max-width: calc(100vw - 150px);
    }

    .gift-logo {
        width: 140px;
        height: 50px;
    }

    .gift-icon-btn {
        width: 44px;
        height: 44px;
    }

    .gift-auth-btn {
        width: 150px;
        height: 45px;
    }

    .gift-header .login-before {
        display: none !important;
    }

    .gift-header .gift-login.is-logged-out .login-before {
        display: none !important;
    }

    .gift-welcome {
        font-size: 12px;
        max-width: 220px;
        gap: 10px;
    }

    .gift-switch-role-btn {
        font-size: 12px;
    }

    .gift-main {
        height: auto;
        padding-bottom: 20px;
        margin-top: 0;
    }

    .gift-title {
        width: 92vw;
        height: 43vw;
        margin-top: 6px;
        background-image: url("../images/sologan-mini.png");
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
    }

    .gift-time-row {
        display: block;
        margin-top: 10px;
    }

    .gift-header-icons--inline {
        display: none;
    }

    .gift-header .gift-header-icons--top {
        display: flex;
        justify-content: flex-end;
        gap: 0.14rem;
        position: static;
        margin-top: 0;
        z-index: 4;
    }

    .gift-time {
        width: 92vw;
        height: 42px;
        margin-top: 0;
    }

    .gift-time-text {
        font-size: 11px;
        padding: 8px 8px 0;
        text-align: center;
        letter-spacing: 0;
        white-space: nowrap;
    }

    /* 顶栏仅保留 LOGO，登录按钮移到活动时间下方 */
    .gift-header .gift-login-after {
        display: none !important;
    }

    .gift-mobile-login-strip {
        display: none;
        width: 92vw;
        margin: 8px auto 0;
        text-align: center;
    }

    .gift-page.is-logged-out .gift-mobile-login-strip {
        display: block;
    }

    .gift-mobile-login-strip .gift-auth-btn {
        width: 150px;
        height: 45px;
    }

    /* 登录后：活动信息下方显示欢迎信息及操作按钮 */
    .gift-header .gift-welcome-stack {
        display: none !important;
    }

    .gift-mobile-user-strip {
        display: none;
        width: 85vw;
        max-width: 420px;
        margin: 8px auto 0;
        padding: 6px 10px;
        box-sizing: border-box;
        /* flex-direction: column; */
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        background: rgba(255, 255, 255, 0.68);
        border-radius: 6px;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
    }

    .gift-page.is-logged-in .gift-mobile-user-strip {
        display: flex;
    }

    .gift-mobile-user-strip .gift-welcome {
        justify-content: center;
        text-align: center;
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: none;
    }

    .gift-mobile-user-strip .gift-action-links {
        gap: 0.18rem;
    }

    .gift-mobile-user-strip .gift-switch-role-btn {
        font-size: 12px;
        white-space: nowrap;
    }

    .gift-cards {
        flex-direction: column;
        gap: 14px;
        margin-top: 16px;
        width: 100%;
        align-items: center;
    }

    .gift-card {
        width: 86vw;
        max-width: 420px;
        height: 520px;
    }

    .gift-card-title {
        width: 260px;
        height: 55px;
        top: 34px;
    }

    .gift-card-icon {
        width: 110px;
        height: 110px;
        top: 115px;
    }

    .gift-card-list {
        left: 30px;
        right: 30px;
        top: 250px;
        font-size: 14px;
        line-height: 24px;
    }

    .gift-get-wrap {
        width: 220px;
        height: 60px;
        bottom: 38px;
    }

    .gift-get-tooltip {
        min-width: 120px;
        max-width: 240px;
        padding: 8px 12px;
        font-size: 12px;
        line-height: 16px;
        border-radius: 6px;
        bottom: calc(100% + 6px);
    }

    .gift-get-tooltip::after {
        margin-left: -6px;
        border-width: 6px;
    }

    .gift-bottom-tip {
        width: 94vw;
        margin-top: 14px;
    }

    .gift-tip-img {
        max-width: 94vw;
    }

    .gift-tip-text {
        font-size: 12px;
        padding: 0 10px;
    }

    .gift-popup {
        width: 92vw;
        height: 50vh;
        padding-bottom: 20px;
    }

    .gift-popup-content {
        padding: 70px 40px 40px 52px;
    }

    .gift-popup-title {
        font-size: 18px;
    }

    .gift-rule-list {
        font-size: 14px;
        line-height: 24px;
    }

    #rule-dialog .mod-dialog-main,
    #log-dialog .mod-dialog-main {
        width: 94vw;
        height: auto;
    }

    .gift-log-table {
        font-size: 12px;
    }

    .gift-log-table th {
        font-size: 11px;
        padding: 8px 6px;
    }

    .gift-log-table td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .gift-log-group-title {
        font-size: 14px;
    }
}
