/* ===== 抽奖面板 - 底部滑出高端设计 ===== */

/* 遮罩层 */
#lottery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.5);
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

#lottery-overlay.lottery-hidden {
    opacity: 0;
    pointer-events: none;
}

/* 弹窗主体 - 底部滑出面板 */
#lottery-modal {
    position: relative;
    width: calc(100% - 8px);
    max-width: 100%;
    margin: 0 4px;
    max-height: 82vh;
    background: linear-gradient(180deg, rgba(25, 25, 35, 0.98), rgba(15, 15, 22, 0.98));
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 16px 24px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

#lottery-modal::-webkit-scrollbar {
    width: 3px;
}

#lottery-modal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* 关闭按钮 */
#lottery-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

#lottery-close:active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: scale(0.9);
}

/* ===== 头部 ===== */
.lottery-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lottery-header-icon {
    font-size: 32px;
    margin-bottom: 4px;
    display: block;
}

.lottery-title {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.lottery-subtitle {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

/* ===== 余额卡片 ===== */
.lottery-balance-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 16px;
}

.lottery-balance-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 2px 8px;
}

.lottery-balance-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 2px;
    white-space: nowrap;
    font-weight: 500;
}

.lottery-balance-value {
    font-size: 18px;
    font-weight: 800;
    color: #fbbf24;
    font-variant-numeric: tabular-nums;
}

.lottery-balance-divider {
    width: 1px;
    height: 30px;
    background: rgba(255, 255, 255, 0.06);
}

/* ===== 奖品圆形展示区 ===== */
.lottery-prize-display {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.lottery-prize-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

/* 旋转脉冲状态 */
.lottery-prize-circle.spinning {
    animation: lotteryPulseGlow 0.5s ease-in-out infinite;
}

@keyframes lotteryPulseGlow {
    0%, 100% {
        border-color: rgba(255, 215, 0, 0.15);
        box-shadow: 0 4px 32px rgba(251, 191, 36, 0.15);
    }
    50% {
        border-color: rgba(255, 215, 0, 0.35);
        box-shadow: 0 4px 48px rgba(251, 191, 36, 0.3);
    }
}

.lottery-prize-icon {
    font-size: 48px;
    margin-bottom: 4px;
    transition: all 0.15s ease;
}

.lottery-prize-circle.spinning .lottery-prize-icon {
    animation: lotteryIconSpin 0.3s ease-in-out infinite alternate;
}

@keyframes lotteryIconSpin {
    from { transform: scale(1) rotate(-3deg); }
    to { transform: scale(1.08) rotate(3deg); }
}

.lottery-prize-name {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 2px;
    text-align: center;
    padding: 0 8px;
}

.lottery-prize-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
}

/* ===== 抽奖按钮 ===== */
.lottery-action {
    text-align: center;
    margin-bottom: 16px;
}

.lottery-btn {
    position: relative;
    width: 200px;
    height: 48px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.lottery-btn:active {
    transform: scale(0.95);
}

.lottery-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.lottery-btn-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    border-radius: 14px 14px 0 0;
    pointer-events: none;
}

.lottery-btn-text {
    position: relative;
    z-index: 1;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

/* ===== 抽奖结果 ===== */
.lottery-result {
    text-align: center;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.lottery-result-icon {
    font-size: 32px;
    margin-bottom: 4px;
    display: block;
}

.lottery-result-text {
    font-size: 15px;
    font-weight: 700;
    color: #fbbf24;
    margin-bottom: 2px;
}

.lottery-result-detail {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
}

/* ===== 抽奖记录 ===== */
.lottery-records {
    padding: 14px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
}

.lottery-records-title {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
}

.lottery-records-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.lottery-records-list::-webkit-scrollbar {
    width: 2px;
}

.lottery-records-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 1px;
}

/* 空状态 */
.lottery-no-records {
    text-align: center;
    padding: 20px 12px;
}

.lottery-no-records .empty-icon {
    font-size: 28px;
    margin-bottom: 6px;
    opacity: 0.4;
}

.lottery-no-records .empty-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 600;
}

/* 单条记录 */
.lottery-record-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.lottery-record-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.lottery-record-info {
    flex: 1;
    min-width: 0;
}

.lottery-record-prize {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.lottery-record-meta {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 2px;
}

/* ===== 积分选择弹窗 ===== */
.lottery-select-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5001;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lottery-select-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lottery-select-overlay.active .lottery-select-panel {
    transform: translateY(0);
}

.lottery-select-panel {
    background: linear-gradient(180deg, rgba(25, 25, 35, 0.98), rgba(15, 15, 22, 0.98));
    border: none;
    border-radius: 20px 20px 0 0;
    padding: 20px 20px 30px;
    width: calc(100% - 8px);
    max-width: 100%;
    margin: 0 4px;
    max-height: 75vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px));
}

.lottery-select-panel::-webkit-scrollbar {
    width: 3px;
}

.lottery-select-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* 拖拽手柄 */
.lottery-select-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 auto 12px;
}

/* 标题区 */
.lottery-select-header {
    text-align: center;
    margin-bottom: 14px;
}

.lottery-select-title {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.lottery-select-hint {
    display: block;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
}

/* 档位卡片列表 */
.lottery-tier-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

/* 单个档位卡片 */
.lottery-tier-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.lottery-tier-card:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.08);
}

/* 积分不足 */
.lottery-tier-card.insufficient {
    opacity: 0.45;
    cursor: pointer;
}

.lottery-tier-card.insufficient .lottery-tier-cost {
    color: #f87171;
}

/* 选中状态 */
.lottery-tier-card.selected {
    border-color: rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.08);
    box-shadow: 0 0 16px rgba(251, 191, 36, 0.1);
}

/* 档位图标 */
.lottery-tier-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.lottery-tier-card.selected .lottery-tier-icon {
    background: rgba(251, 191, 36, 0.15);
}

/* 档位信息 */
.lottery-tier-info {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.lottery-tier-cost {
    font-size: 15px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2px;
}

/* 奖品预览（选中后展开） */
.lottery-tier-prizes {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-direction: column;
    gap: 3px;
}

.lottery-tier-prize-item {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    padding: 2px 0;
}

.lottery-tier-card.selected .lottery-tier-prize-item {
    color: rgba(255, 255, 255, 0.75);
}

/* 选中勾选 */
.lottery-tier-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.lottery-tier-card.selected .lottery-tier-check {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-color: transparent;
    color: #1a1a2e;
}

/* 选中奖品预览栏 */
.lottery-select-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin-bottom: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 48px;
}

.lottery-select-preview-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.lottery-select-preview-info {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.lottery-select-preview-name {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 2px;
}

.lottery-select-preview-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
}

/* 选择面板按钮区 */
.lottery-select-actions {
    display: flex;
    gap: 10px;
}

.lottery-select-actions button {
    flex: 1;
    padding: 12px 0;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.lottery-select-confirm {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a2e;
}

.lottery-select-confirm:active {
    transform: scale(0.97);
}

.lottery-select-confirm:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.lottery-select-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.lottery-select-cancel:active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: scale(0.97);
}

/* ===== 结果弹窗 ===== */
.lottery-toast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5002;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.lottery-toast-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.lottery-toast-box {
    background: linear-gradient(180deg, rgba(25, 25, 35, 0.98), rgba(15, 15, 22, 0.98));
    border-radius: 20px 20px 0 0;
    padding: 24px 20px 30px;
    width: calc(100% - 8px);
    max-width: 100%;
    margin: 0 4px;
    text-align: center;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px));
}

.lottery-toast-overlay.active .lottery-toast-box {
    transform: translateY(0);
}

.lottery-toast-congrats {
    font-size: 18px;
    font-weight: 800;
    color: #fbbf24;
    margin-bottom: 10px;
}

.lottery-toast-obtained-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 4px;
}

.lottery-toast-prize-name {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 18px;
    line-height: 1.5;
}

.lottery-toast-close-btn {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a2e;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.lottery-toast-close-btn:active {
    transform: scale(0.97);
}