/* 全局样式重置与基础配置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    background: #000;
    background-image: url('https://picsum.photos/id/1076/1920/1080'),
                      linear-gradient(45deg, rgba(34,34,34,0.8) 25%, transparent 25%, transparent 75%, rgba(34,34,34,0.8) 75%),
                      linear-gradient(45deg, rgba(34,34,34,0.8) 25%, transparent 25%, transparent 75%, rgba(34,34,34,0.8) 75%);
    background-size: cover, 20px 20px, 20px 20px;
    background-position: center center, 0 0, 10px 10px;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #333;
    font-family: "微软雅黑", "Helvetica Neue", sans-serif;
    padding: 20px;
    position: relative;
    min-height: 100vh;
}
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #111;
    z-index: -1;
    transition: opacity 0.5s;
}
body.loaded::before {
    opacity: 0;
}
/* 头部布局（修复标题被遮挡：增加右侧内边距） */
.header {
    display: flex;
    justify-content: center; /* 标题居中 */
    align-items: center;
    margin-bottom: 15px;
    padding-right: 220px; /* 预留功能菜单和联系方式按钮空间 */
    position: relative;
}
.title {
    font-size: 2.5em;
    color: #ffd700;
    text-align: center;
    margin: 0;
    text-shadow: 0 0 10px #ffd700, 3px 3px 0 #ff0000, 6px 6px 0 rgba(0,0,0,0.5);
    font-weight: bold;
}
/* 新增：联系方式按钮样式 */
.contact-btn {
    position: absolute;
    top: 20px;
    right: 120px; /* 位于功能菜单左侧 */
    background: #ff9933;
    color: #fff;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(255,153,51,0.3);
    z-index: 1000;
}
/* 右上角功能菜单按钮（调整位置避免遮挡标题） */
.menu-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #ff0000;
    color: #fff;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(255,0,0,0.3);
    z-index: 1000;
}
/* 下拉菜单 */
.dropdown-menu {
    position: absolute;
    top: 60px;
    right: 20px;
    background: rgba(245,238,218,0.98);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 999;
    width: 200px;
}
.dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}
.dropdown-item:last-child {
    border-bottom: none;
}
.dropdown-item:hover {
    background: #ffedd5;
}
/* 面板通用样式 */
.panel {
    background: rgba(245,238,218,0.98);
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #ffd700;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    position: relative;
}
.panel-title {
    color: #ff0000;
    font-size: 1.5em;
    text-align: center;
    margin-bottom: 15px;
    font-weight: bold;
}
/* 顶部显示的排行榜面板 */
.top-panel {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    margin: 0;
    z-index: 998;
    border-radius: 0 0 15px 15px;
    border-top: none;
    padding-top: 30px; /* 给关闭按钮预留空间 */
}
/* 修复：排行榜关闭按钮移至左侧，样式优化 */
.left-close-btn {
    position: absolute;
    top: 10px;
    left: 10px; /* 从右侧移到左侧，避免被功能菜单遮挡 */
    background: #ff0000;
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    z-index: 999;
}
/* 个人中心面板 */
.personal-panel .user-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.user-info-item {
    font-size: 1.1em;
    color: #333;
}
.user-info-item span {
    color: #ff0000;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(255,0,0,0.3);
}
.logout-btn {
    background: #ff0000;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    box-shadow: 0 2px 5px rgba(255,0,0,0.2);
    margin-top: 10px;
    align-self: flex-start;
}
/* 邀请记录面板 */
.invite-record-list {
    max-height: 300px;
    overflow-y: auto;
}
.invite-record-item {
    padding: 10px;
    border-bottom: 1px dashed #ccc;
    display: flex;
    justify-content: space-between;
}
.invite-record-item:last-child {
    border-bottom: none;
}
.empty-record {
    text-align: center;
    color: #666;
    padding: 20px;
}
/* 邀请好友面板 */
.invite-method {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #ccc;
}
.invite-method:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.invite-method h4 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1em;
}
#userInviteLink {
    width: 100%;
    padding: 10px;
    border: 2px solid #ccc;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 1em;
    background: #f9f9f9;
    word-break: break-all;
}
.copy-link-btn {
    background: #ff9933;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}
.copy-link-btn:hover {
    transform: scale(1.05);
    background: #ff7700;
}
.invite-tip {
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}
.invite-code-display {
    font-size: 1.1em;
    color: #333;
    margin-bottom: 8px;
}
.invite-code-display span {
    color: #ff0000;
    font-weight: bold;
    font-size: 1.2em;
}
/* 排行榜面板 */
.rank-list {
    list-style: none;
    padding: 0;
    margin: 0 0 10px;
    max-height: 250px;
    overflow-y: auto;
}
.rank-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.rank-icon {
    font-size: 1.1em;
    font-weight: bold;
    width: 25px;
    text-align: center;
}
.rank-username {
    flex: 1;
    text-align: left;
    padding: 0 8px;
    font-size: 1em;
    color: #333;
}
.rank-count {
    color: #ff9933;
    font-weight: bold;
    font-size: 1em;
}
.rank-tip {
    color: #666;
    font-size: 0.9em;
    margin: 0;
    text-align: center;
}
/* 抽奖网格 */
.draw-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 600px;
    margin: 20px auto;
}
.grid-item {
    background: rgba(245,238,218,0.95);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}
.grid-item .icon {
    font-size: 1.8em;
    margin-bottom: 8px;
}
.draw-btn {
    background: #ff9933;
    color: #fff;
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(255,153,51,0.4);
}
.draw-btn:hover:not(.disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255,153,51,0.6);
}
.draw-btn.disabled {
    background: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.draw-btn:active, .btn:active, .invite-btn:active {
    transform: scale(0.95);
    filter: brightness(0.9);
}
.prize-active {
    background: #ffcc00;
    border: 2px solid #ff0000;
    transform: scale(1.05);
    box-shadow: 0 0 15px #ffd700;
}
/* 邀请码提交区域 */
.invite-section {
    background: rgba(245,238,218,0.95);
    max-width: 600px;
    margin: 0 auto 20px;
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #ffd700;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}
.invite-title {
    color: #ff0000;
    font-size: 1.2em;
    margin-bottom: 12px;
    font-weight: bold;
}
.invite-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.invite-input {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    border: 2px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
}
.invite-btn {
    background: #ff9933;
    color: #fff;
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(255,153,51,0.3);
}
.invite-btn:hover {
    transform: scale(1.05);
    background: #ff7700;
}
.invite-desc {
    color: #666;
    font-size: 0.85em;
    margin-top: 8px;
}
.loading {
    color: #ff0000;
    font-size: 0.9em;
    margin-top: 8px;
}
/* 登录/注册模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.modal-content {
    background: #f5eeda;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    border: 3px solid #ffd700;
    box-shadow: 0 0 30px #ffd700;
}
.modal-title {
    color: #ff0000;
    font-size: 1.8em;
    margin-bottom: 25px;
    text-shadow: 1px 1px 0 #000;
}
.form-group {
    margin-bottom: 18px;
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1em;
    color: #333;
}
.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #ccc;
    border-radius: 8px;
    font-size: 1.1em;
    box-sizing: border-box;
    transition: all 0.2s ease;
}
.form-control:focus, .invite-input:focus {
    border-color: #ff9933;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,153,51,0.2);
}
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 8px;
}
.btn-primary {
    background: #ff9933;
    color: #fff;
    box-shadow: 0 3px 8px rgba(255,153,51,0.3);
}
.btn-secondary {
    background: #ff0000;
    color: #fff;
    box-shadow: 0 3px 8px rgba(255,0,0,0.3);
}
.btn-primary:hover, .btn-secondary:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}
/* Toast提示 */
.toast {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    transform: translateX(-50%) translateY(20px);
    max-width: 80%;
    text-align: center;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
/* 隐藏元素 */
.hidden {
    display: none;
}
/* 抽奖次数增加动画 */
.count-increase {
    animation: countFlash 0.5s ease-in-out;
    color: #ff0000;
    font-size: 1.5em;
}
@keyframes countFlash {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}
/* 响应式适配 */
@media (max-width: 500px) {
    .title {
        font-size: 2em;
    }
    .header {
        padding-right: 180px; /* 移动端调整预留空间 */
    }
    .contact-btn {
        padding: 6px 10px;
        font-size: 0.8em;
        right: 90px;
    }
    .menu-btn {
        padding: 6px 12px;
        font-size: 0.9em;
    }
    .dropdown-menu {
        width: 180px;
        top: 50px;
    }
    .draw-btn {
        font-size: 1.6em;
    }
    .grid-item {
        padding: 10px;
        min-height: 80px;
    }
    .panel {
        padding: 15px;
    }
    .panel-title {
        font-size: 1.3em;
    }
    .rank-item {
        flex-wrap: wrap;
        padding: 6px 8px;
    }
    .rank-username {
        width: 100%;
        margin: 3px 0;
    }
    .rank-count {
        width: 100%;
        text-align: center;
    }
    .modal-title {
        font-size: 1.6em;
    }
}