/* 抽奖页面样式 */

/* 全局字体设置 */
body, .p1, .p1 * {
    font-family: "微软雅黑", "Microsoft YaHei", sans-serif;
}

.p1 {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    cursor: pointer;
}

.bg-img {
   
}

/* 二维码区域 - 样式由JS动态设置 */
.qrcode-box {
    z-index: 100;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.qrcode-box.hidden {
    opacity: 0;
    visibility: hidden;
}

.qrcode-box #qrcode img {
    width: 100% !important;
    height: 100% !important;
}

.qrcode-box p {
    margin-top: 10px;
    font-size: 14px;
    color: #333;
    font-weight: bold;
}

/* 奖品展示弹层 */
.jp-pop {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    text-align: center;
    transition: opacity 0.3s ease;
    width: 18.6%;
}

.jp-pop.hidden {
    opacity: 0;
    pointer-events: none;
}

.jp-pop .v2 {
   
}

.jp-name {
    position: absolute;
    width: 100%;
    left: 0;
    top: 2.5vw;
    height: 5vw;
    line-height: 5vw;
    font-size: 3vh;
    text-align: center;
    color: #000;
    font-family: "微软雅黑";
}

.jp-img {
    position: absolute;
    width: 67%;
    left: 17%;
    top: 33%;
}

.jp-img img {
    width: 100%;
    border-radius: 10px;
}

.jp-product {
    position: absolute;
    width: 90%;
    left: 5%;
    top: 25%;
    font-size: 2vh;
    color: #000;
    text-align: center;
    /* font-weight: bold; */
    font-family: "微软雅黑";
    word-break: break-all;
    line-height: 1.3;
}

.jp-count {
    position: absolute;
    width: 100%;
    left: 0;
    top: 78%;
    font-size: 2vh;
    color: #FFD700;
    text-align: center;
}

/* 抽奖场景容器 */
.scroll-container {
    position: absolute;
    top: 50%;
    left: 5%;
    width: 90%;
    height: 78%;
    transform: translateY(-50%);
    z-index: 30;
    display: flex;
    justify-content: space-between;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.scroll-container.active {
    opacity: 1;
    pointer-events: auto;
}

/* 大红框：马群循环区 */
.draw-stage {
    position: relative;
    width: 100%;
    height: 100%;
}

.horse-loop {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 100%;
    transform: none;
    overflow: hidden;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.62));
    border: 3px solid rgba(255, 165, 0, 0.55);
    box-shadow: 0 0 24px rgba(255, 165, 0, 0.4), inset 0 0 24px rgba(0, 0, 0, 0.35);
    z-index: 1;
}

.horse-loop::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 24px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.32) 0%, rgba(0, 0, 0, 0.22) 50%, rgba(0, 0, 0, 0.52) 100%);
    z-index: 2;
    pointer-events: none;
}

.horse-runner {
    position: absolute;
    left: -30%;
    width: 12%;
    max-width: 420px;
    min-width: 150px;
    object-fit: contain;
    filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.42));
    opacity: 0.95;
    animation: horseRunAcross linear infinite;
    animation-play-state: paused;
    z-index: 1;
}

#horseLoop.running .horse-runner {
    animation-play-state: running;
}

@keyframes horseRunAcross {
    0% {
        transform: translateX(0) translateY(0) scale(0.88);
    }
    8% {
        transform: translateX(12vw) translateY(-0.35vw) scale(0.9);
    }
    16% {
        transform: translateX(25vw) translateY(0.2vw) scale(0.92);
    }
    24% {
        transform: translateX(38vw) translateY(-0.32vw) scale(0.93);
    }
    32% {
        transform: translateX(52vw) translateY(0.18vw) scale(0.95);
    }
    40% {
        transform: translateX(66vw) translateY(-0.28vw) scale(0.96);
    }
    48% {
        transform: translateX(80vw) translateY(0.22vw) scale(0.98);
    }
    56% {
        transform: translateX(94vw) translateY(-0.26vw) scale(0.99);
    }
    64% {
        transform: translateX(108vw) translateY(0.18vw) scale(1);
    }
    72% {
        transform: translateX(122vw) translateY(-0.22vw) scale(0.98);
    }
    84% {
        transform: translateX(143vw) translateY(0.12vw) scale(0.93);
    }
    100% {
        transform: translateX(165vw) translateY(0) scale(0.88);
    }
}

.avatar-picker.hide {
    display: none !important;
}

/* 小红框：固定三槽位滚动 */
.avatar-picker {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 76%;
    min-width: 1220px;
    max-width: 1800px;
    padding: 18px 22px;
    border: none;
    background: transparent;
    box-shadow: none;
    z-index: 5;
}

.avatar-picker::before {
    content: none;
}

.avatar-picker::after {
    content: none;
}

.avatar-slots {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    gap: 280px;
}

.avatar-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.avatar-ring {
    position: relative;
    width: 196px;
    height: 196px;
    border-radius: 50%;
    border: 5px solid #FFD700;
    box-shadow:
        0 0 22px rgba(255, 215, 0, 0.5),
        0 0 0 5px rgba(82, 238, 255, 0.22),
        0 0 0 12px rgba(82, 238, 255, 0.1);
    background: rgba(0, 0, 0, 0.42);
    flex-shrink: 0;
    animation: ringPulse 1.8s ease-in-out infinite;
}

.avatar-ring::before {
    content: "";
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgba(82, 238, 255, 0) 0%,
        rgba(82, 238, 255, 0.95) 12%,
        rgba(190, 140, 255, 0.95) 25%,
        rgba(82, 238, 255, 0) 38%,
        rgba(82, 238, 255, 0) 50%,
        rgba(190, 140, 255, 0.95) 62%,
        rgba(82, 238, 255, 0.95) 75%,
        rgba(82, 238, 255, 0) 88%
    );
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #fff calc(100% - 7px), #fff calc(100% - 2px), transparent 100%);
    mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #fff calc(100% - 7px), #fff calc(100% - 2px), transparent 100%);
    animation: ringSpin 2.4s linear infinite;
    z-index: -1;
    filter: blur(2px);
}

.avatar-ring::after {
    content: "";
    position: absolute;
    inset: -18px;
    border-radius: 50%;
    background: conic-gradient(
        from 180deg,
        rgba(205, 155, 255, 0) 0%,
        rgba(205, 155, 255, 0.85) 15%,
        rgba(82, 238, 255, 0.85) 30%,
        rgba(205, 155, 255, 0) 45%,
        rgba(205, 155, 255, 0) 55%,
        rgba(82, 238, 255, 0.85) 70%,
        rgba(205, 155, 255, 0.85) 85%,
        rgba(205, 155, 255, 0) 100%
    );
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #fff calc(100% - 5px), #fff calc(100% - 1px), transparent 100%);
    mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #fff calc(100% - 5px), #fff calc(100% - 1px), transparent 100%);
    animation: ringSpin 3.6s linear infinite reverse;
    z-index: -1;
    filter: blur(3px);
    opacity: 0.7;
}

.avatar-ring-clip {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-ring-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    will-change: transform;
    transform: translateY(0);
}

.avatar-ring-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-ring-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-slot-name {
    font-size: 32px;
    line-height: 1.2;
    color: #fff;
    text-shadow: 1px 2px 6px rgba(0, 0, 0, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    text-align: center;
}

@keyframes ringSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes ringPulse {
    0%, 100% {
        box-shadow:
            0 0 22px rgba(255, 215, 0, 0.5),
            0 0 0 5px rgba(82, 238, 255, 0.22),
            0 0 0 12px rgba(82, 238, 255, 0.1),
            0 0 38px rgba(82, 238, 255, 0.18);
    }
    50% {
        box-shadow:
            0 0 32px rgba(255, 215, 0, 0.65),
            0 0 0 6px rgba(205, 155, 255, 0.42),
            0 0 0 14px rgba(205, 155, 255, 0.18),
            0 0 52px rgba(205, 155, 255, 0.28);
    }
}

.winner-grid {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    justify-items: center;
    align-items: center;
    justify-content: space-evenly;
    align-content: space-evenly;
    padding: 24px 40px;
    overflow: hidden;
}

.winner-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.winner-grid-ring {
    width: var(--wg-size, 110px) !important;
    height: var(--wg-size, 110px) !important;
}

.winner-grid-ring::before,
.winner-grid-ring::after {
    inset: -8px;
}

.winner-grid-name {
    font-size: var(--wg-font, 16px);
    line-height: 1.3;
    color: #fff;
    text-shadow: 1px 2px 6px rgba(0, 0, 0, 0.7);
    white-space: normal;
    word-break: break-all;
    max-width: none;
    text-align: center;
}

.winner-grid.winner-grid-split {
    display: grid !important;
    grid-template-columns: repeat(var(--wg-cols, 10), minmax(0, 1fr));
    grid-auto-rows: 1fr;
    justify-items: center;
    align-items: center;
    align-content: space-evenly;
    justify-content: stretch;
    column-gap: 0.4vw;
    row-gap: 1vh;
    padding: 2vh 2vw;
    pointer-events: none;
}

.winner-grid-split .winner-grid-item {
    gap: 18px;
    transition: opacity 0.4s ease;
}

.winner-grid-split.split-dim-prev .winner-grid-item {
    opacity: 0.28;
}

.winner-grid-split .winner-grid-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: var(--wg-name-w, 108px);
}

.avatar-ring.winner-glow {
    border-color: #FFD700;
    animation: winnerGlow 0.6s ease-in-out infinite alternate;
}

.avatar-ring.winner-glow::before,
.avatar-ring.winner-glow::after {
    filter: blur(3px) brightness(1.6);
}

@keyframes winnerGlow {
    0% {
        box-shadow:
            0 0 30px rgba(255, 215, 0, 0.7),
            0 0 0 6px rgba(255, 215, 0, 0.4),
            0 0 0 14px rgba(255, 215, 0, 0.15),
            0 0 60px rgba(255, 215, 0, 0.35);
    }
    100% {
        box-shadow:
            0 0 42px rgba(255, 215, 0, 0.9),
            0 0 0 8px rgba(255, 215, 0, 0.55),
            0 0 0 18px rgba(255, 215, 0, 0.22),
            0 0 80px rgba(255, 215, 0, 0.5);
    }
}

/* 中奖结果遮罩层 */
.winner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 190;
    display: none;
}

.winner-overlay.show {
    display: block;
}

/* 中奖结果展示 */
.winner-result {
    position: fixed;
    top: 5%;
    left: 3%;
    right: 3%;
    bottom: 5%;
    transform: none;
    z-index: 200;
    background: rgba(0, 0, 0, 0.95);
    padding: 30px 40px;
    border-radius: 15px;
    text-align: center;
    display: none;
    width: auto;
    max-width: none;
    max-height: none;
    border: 3px solid #FFD700;
    box-sizing: border-box;
    /* 使用 flex 布局确保按钮始终可见 */
    flex-direction: column;
}

.winner-result.show {
    display: flex;
}

.winner-title {
    font-size: 32px;
    color: #FFD700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* 中奖奖品信息 */
.winner-prize-info {
    margin-bottom: 20px;
    font-size: 22px;
}

.winner-prize-info .prize-type {
    color: #FF6B6B;
    font-weight: bold;
    margin-right: 15px;
}

.winner-prize-info .prize-name {
    color: #fff;
}

/* 中奖列表 - 默认30个布局（10列3行） */
.winner-list {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 20px 15px;
    margin-bottom: 20px;
    padding: 15px;
    justify-items: center;
    align-items: start;
    flex: 1;
    overflow-y: auto;
    align-content: center;
}

/* 1-6个中奖者时，横向一行排列 */
.winner-list.few-winners {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.winner-item {
    text-align: center;
    width: 100%;
    max-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.winner-item img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid #FFD700;
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    transition: transform 0.3s ease;
}

.winner-item img:hover {
    transform: scale(1.1);
}

.winner-item .name {
    margin-top: 8px;
    font-size: 16px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.winner-close {
    display: block;
    width: 40%;
    max-width: 400px;
    margin: 15px auto 0;
    padding: 15px 0;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.2s;
}

.winner-close:hover {
    transform: scale(1.05);
}

/* 过渡页面 */
.transition-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 250;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.transition-page.show {
    display: flex;
}

.transition-text {
    font-size: 16px;
    color: #000;
    font-weight: normal;
    text-shadow: none;
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: #FFA500;
    margin-bottom: 0;
    position: fixed;
    bottom: 2%;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.transition-countdown {
    font-size: 120px;
    color: #FFD700;
    font-weight: bold;
    text-shadow: 5px 5px 15px rgba(0, 0, 0, 0.8);
    animation: countdown-pulse 1s ease-in-out;
}

@keyframes countdown-pulse {
    0% { 
        transform: scale(0.5);
        opacity: 0;
    }
    50% { 
        transform: scale(1.2);
    }
    100% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* 操作提示 */
.tips {
    position: absolute;
    bottom: 2%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    font-size: 16px;
    color: #000;
    background: #FFA500;
    padding: 8px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 高亮中奖用户 */
.user-card.winner {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.5), rgba(255, 165, 0, 0.5));
    border-radius: 10px;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .avatar-picker {
        min-width: 700px;
        width: 72%;
    }
    .avatar-ring {
        width: 156px;
        height: 156px;
    }
    .avatar-slot-name {
        font-size: 24px;
    }
}

@media (max-width: 768px) {
    .qrcode-box {
        padding: 10px;
    }
    .qrcode-box #qrcode {
        width: 80px;
        height: 80px;
    }
    .qrcode-box p {
        font-size: 12px;
    }
    .tips {
        font-size: 18px;
    }
    .avatar-picker {
        min-width: 0;
        width: 92%;
        top: 50%;
    }
    .avatar-ring {
        width: 96px;
        height: 96px;
        border-width: 3px;
    }
    .avatar-slot-name {
        font-size: 16px;
    }
    .avatar-slots {
        gap: 24px;
    }
}

