/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red: #8B0000;
    /* 深红 */
    --bright-red: #C41E3A;
    /* 中国红 */
    --gold: #D4AF37;
    /* 富贵金 */
    --bright-gold: #FFD700;
    /* 流光金 */
    --cream: #F5F5DC;
    /* 米白/纸张色 */
    --text-dark: #2c0e0e;
    /* 深褐色文字 */
    --shadow-color: rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', serif;
    /* 使用衬线体更有质感 */
    background: radial-gradient(circle at center, #a00000 0%, #500000 100%);
    min-height: 100vh;
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* 背景装饰 */
.bg-decoration {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 300px;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.horse-bg-left {
    left: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="80" font-size="80">🐎</text></svg>');
    /* 暂用emoji占位，实际可换图案 */
    transform: scaleX(-1);
}

.horse-bg-right {
    right: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="80" font-size="80">🐎</text></svg>');
}

/* 邀请函容器 */
.invitation-container {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 800px;
    padding: 20px;
    perspective: 1000px;
}

.inner-card {
    background: var(--cream);
    border: 8px solid var(--primary-red);
    outline: 4px solid var(--gold);
    outline-offset: -12px;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 50px var(--shadow-color), inset 0 0 60px rgba(139, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    /* 纸张纹理 */
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23d4af37' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* 角落装饰 */
.corner-decoration {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 4px solid var(--gold);
    z-index: 1;
}

.top-left {
    top: 15px;
    left: 15px;
    border-right: none;
    border-bottom: none;
}

.top-right {
    top: 15px;
    right: 15px;
    border-left: none;
    border-bottom: none;
}

.bottom-left {
    bottom: 15px;
    left: 15px;
    border-right: none;
    border-top: none;
}

.bottom-right {
    bottom: 15px;
    right: 15px;
    border-left: none;
    border-top: none;
}

/* 头部区域 */
.header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
}

.logo-wrapper {
    display: inline-block;
    padding: 15px 40px;
    /* 增加内边距 */
    background: #fff;
    border-radius: 50px;
    /* 改为胶囊形，更适合长方形Logo */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    border: 2px solid var(--gold);
    /* 增加金边 */
}

.logo {
    height: 50px;
    width: auto;
    display: block;
}

.title {
    font-size: 2.5rem;
    color: var(--primary-red);
    margin-bottom: 10px;
    line-height: 1.2;
    text-shadow: 1px 1px 0 var(--gold);
}

.year-label {
    font-size: 1.2rem;
    color: var(--gold);
    background: var(--primary-red);
    padding: 4px 15px;
    border-radius: 20px;
    vertical-align: middle;
    letter-spacing: 2px;
}

.subtitle-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.subtitle-bar .line {
    height: 2px;
    width: 40px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.subtitle-bar .text {
    color: var(--text-dark);
    font-weight: bold;
    letter-spacing: 3px;
    font-size: 1.1rem;
}

/* 滚动舞台 */
.rolling-stage {
    background: #fff;
    border: 3px solid var(--gold);
    border-radius: 8px;
    margin: 0 auto 30px;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.curtain-top {
    height: 10px;
    background: repeating-linear-gradient(90deg, var(--primary-red), var(--primary-red) 10px, var(--bright-red) 10px, var(--bright-red) 20px);
    border-bottom: 2px solid var(--gold);
}

.rolling-area {
    min-height: 140px;
    /* 增加最小高度 */
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, #fff 30%, #f0f0f0 100%);
}

.rolling-content {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

/* 单人显示样式 */
.rolling-content.single {
    font-size: 3.5rem;
    font-weight: bold;
    color: var(--primary-red);
    text-shadow: 2px 2px 0 rgba(212, 175, 55, 0.3);
    letter-spacing: 2px;
}

/* 多人网格布局样式 */
.rolling-content.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    width: 100%;
}

.rolling-item {
    background: var(--primary-red);
    color: var(--gold);
    padding: 10px 5px;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--gold);
    animation: popIn 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 针对不同数量的优化 */
.rolling-content.grid-small .rolling-item {
    font-size: 2rem;
}

/* 2-4人 */
.rolling-content.grid-medium .rolling-item {
    font-size: 1.5rem;
}

/* 5-9人 */
.rolling-content.grid-large .rolling-item {
    font-size: 1.2rem;
    padding: 5px;
}

/* 10+人 */

/* 控制面板 */
.control-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.divider-vertical {
    width: 1px;
    height: 30px;
    background: var(--gold);
}

.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-upload {
    background: #fff;
    color: var(--primary-red);
    border: 1px solid var(--primary-red);
}

.btn-upload:hover {
    background: var(--primary-red);
    color: #fff;
}

.btn-draw {
    background: linear-gradient(135deg, var(--gold) 0%, #b8860b 100%);
    color: #fff;
    min-width: 120px;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.btn-draw:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(212, 175, 55, 0.4);
}

.btn-draw.stop {
    background: linear-gradient(135deg, var(--bright-red) 0%, var(--primary-red) 100%);
}

.input-wrapper {
    position: relative;
}

#drawCount {
    width: 60px;
    padding: 8px;
    border: 1px solid var(--gold);
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    color: var(--primary-red);
}

.participant-count {
    font-size: 0.9rem;
    color: #666;
}

label {
    font-weight: bold;
    color: var(--text-dark);
}

/* 中奖记录 */
.winner-display {
    text-align: center;
}

.winner-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.winner-header h2 {
    color: var(--primary-red);
    font-size: 1.5rem;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 5px;
}

.decoration-icon {
    font-size: 1.5rem;
}

.winners-container {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

/* 滚动条美化 */
.winners-container::-webkit-scrollbar {
    width: 6px;
}

.winners-container::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 3px;
}

.winner-round {
    margin-bottom: 15px;
    animation: fadeIn 0.5s ease;
}

.round-title {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 5px;
    display: block;
}

.winner-names {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.winner-name {
    background: linear-gradient(to bottom, #fff, #f9f9f9);
    border: 1px solid var(--gold);
    color: var(--primary-red);
    padding: 8px 20px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 动画定义 */
@keyframes popIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 错误提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 15px 30px;
    border-radius: 8px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

/* 响应式 */
@media (max-width: 768px) {
    .invitation-container {
        width: 95%;
        padding: 10px;
    }

    .inner-card {
        padding: 20px;
        outline: none;
        border-width: 4px;
    }

    .control-panel {
        flex-direction: column;
        border-radius: 15px;
    }

    .divider-vertical {
        width: 100%;
        height: 1px;
    }

    .title {
        font-size: 1.8rem;
    }
}

/* 保留原有的灯笼和金币动画逻辑，但样式微调 */
.lantern {
    position: fixed;
    width: 50px;
    height: 70px;
    pointer-events: none;
    z-index: 100;
    animation: lanternFall 4s ease-out forwards;
}

.lantern-body {
    width: 100%;
    height: 85%;
    background: var(--bright-red);
    border-radius: 50% 50% 40% 40%;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.lantern-body::before {
    content: '福';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--gold);
    font-size: 20px;
    font-weight: bold;
}

.lantern-tassel {
    width: 4px;
    height: 20px;
    background: var(--gold);
    margin: 0 auto;
}

@keyframes lanternFall {
    0% {
        transform: translateY(-100px);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

.gold-coin {
    position: fixed;
    width: 30px;
    height: 30px;
    background: var(--gold);
    border-radius: 50%;
    border: 2px solid #b8860b;
    z-index: 99;
    animation: coinFall 3s linear forwards;
}

.gold-coin::before {
    content: '¥';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #b8860b;
    font-weight: bold;
}

@keyframes coinFall {
    0% {
        transform: translateY(-100px) rotate(0deg);
    }

    100% {
        transform: translateY(100vh) rotate(360deg);
    }
}