/**
 * 参考真实刮刮乐的布局设计
 * 适配我们的游戏内容（符号匹配、金额累加、翻倍或清零）
 */

/* ========== 刮刮乐票根容器 ========== */
.lottery-ticket {
    position: relative;
    width: 100%;
    max-width: 500px;
    background: linear-gradient(135deg, #fff9e6 0%, #fff5d6 50%, #fff9e6 100%);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.15),
        0 0 0 2px rgba(255, 215, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    margin: 0 auto;
}

/* ========== 顶部信息区 ========== */
.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.4);
}

.ticket-betting {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.ticket-betting.allin {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

.ticket-title {
    font-size: 22px;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 1px;
}

/* ========== 游戏提示区（参考中奖号码区的布局） ========== */
.game-hint-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.game-hint-label {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    text-align: center;
}

/* 符号匹配模式：显示幸运符号 */
.lucky-symbol-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.lucky-symbol-badge {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 
        0 4px 12px rgba(102, 126, 234, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
    position: relative;
}

/* 金额累加模式：显示目标 */
.target-amount-display {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
    padding: 12px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 翻倍或清零模式：显示警告提示 */
.warning-hint-display {
    text-align: center;
    font-size: 16px;
    color: #e74c3c;
    font-weight: 600;
    padding: 12px;
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-radius: 12px;
    border: 2px solid rgba(231, 76, 60, 0.3);
}

.winning-numbers-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.winning-number-ball {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
    position: relative;
}

.winning-number-ball::before {
    content: '';
    position: absolute;
    top: 25%;
    left: 25%;
    width: 30%;
    height: 30%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    pointer-events: none;
}

/* 不同颜色的号码球 */
.winning-number-ball.red {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.winning-number-ball.blue {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.winning-number-ball.green {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.winning-number-ball.orange {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.winning-number-ball.purple {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.special-number-label {
    font-size: 12px;
    color: #6c757d;
    margin-left: 12px;
    font-weight: 600;
}

.special-number-ball {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 
        0 2px 8px rgba(243, 156, 18, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    position: relative;
}

.special-number-ball::before {
    content: '';
    position: absolute;
    top: 25%;
    left: 25%;
    width: 30%;
    height: 30%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    pointer-events: none;
}

/* ========== 刮奖区域 ========== */
.scratch-section-label {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 12px;
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
}

/* 符号匹配和翻倍或清零：使用卡片式布局 */
.scratch-cards-layout {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* 金额累加：使用网格布局 */
.scratch-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    border: 2px dashed rgba(255, 215, 0, 0.3);
}

.scratch-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff9ff3 0%, #f368e0 50%, #ee5a6f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.scratch-item::before {
    content: '$';
    position: absolute;
    font-size: 24px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.3);
    z-index: 1;
}

.scratch-item:hover {
    transform: scale(1.05);
}

.scratch-item-content {
    position: relative;
    z-index: 2;
    font-size: 18px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: none; /* 初始隐藏，刮开后显示 */
}

/* 刮奖涂层覆盖层 */
.scratch-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #c0c0c0 0%, #a9a9a9 50%, #c0c0c0 100%);
    border-radius: 50%;
    z-index: 3;
    cursor: pointer;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.scratch-item-overlay.scratched {
    opacity: 0;
    transform: scale(1.2);
    pointer-events: none;
}

.scratch-item-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: 4;
    cursor: pointer;
    touch-action: none;
}

/* ========== 中奖规则表格（适配我们的游戏规则） ========== */
.prize-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.prize-table-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px;
    font-weight: 700;
    font-size: 14px;
    text-align: center;
}

.prize-table-row {
    display: flex;
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s ease;
}

.prize-table-row:last-child {
    border-bottom: none;
}

.prize-table-row:hover {
    background: #f8f9fa;
}

.prize-table-cell {
    flex: 1;
    padding: 10px 12px;
    font-size: 13px;
    text-align: center;
}

.prize-table-cell.condition {
    color: #495057;
    font-weight: 600;
    border-right: 1px solid #e9ecef;
    text-align: left;
    padding-left: 16px;
}

.prize-table-cell.reward {
    color: #667eea;
    font-weight: 700;
    font-size: 14px;
}

/* ========== 底部说明 ========== */
.ticket-instructions {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.6;
    padding: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    margin-top: 16px;
}

.ticket-instructions ol {
    margin: 0;
    padding-left: 20px;
}

.ticket-instructions li {
    margin-bottom: 4px;
}

/* ========== 查看结果按钮 ========== */
.check-result-btn {
    width: 100%;
    padding: 16px;
    margin: 20px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 
        0 4px 16px rgba(102, 126, 234, 0.4),
        0 0 30px rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

.check-result-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(102, 126, 234, 0.5),
        0 0 40px rgba(102, 126, 234, 0.3);
}

.check-result-btn:active {
    transform: translateY(0);
}

.check-result-btn.disabled,
.check-result-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.check-result-btn.disabled:hover,
.check-result-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== 刮奖卡片样式（用于符号匹配和翻倍或清零） ========== */
.scratch-card {
    position: relative;
    width: 100px;
    height: 140px;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.scratch-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #c0c0c0 0%, #a9a9a9 100%);
    z-index: 2;
    cursor: pointer;
    border-radius: 12px;
    pointer-events: none;
}

.scratch-card-overlay.scratched {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.scratch-card-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none; /* 初始隐藏，刮开后显示 */
    align-items: center;
    justify-content: center;
    font-size: 48px;
    z-index: 1;
}

.scratch-card-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    z-index: 4;
    cursor: pointer;
    touch-action: none;
}

/* ========== 响应式设计 ========== */
@media (max-width: 480px) {
    .lottery-ticket {
        padding: 16px;
    }

    .ticket-title {
        font-size: 20px;
    }

    .ticket-price {
        font-size: 14px;
        padding: 4px 12px;
    }

    .winning-number-ball,
    .special-number-ball {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .scratch-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        padding: 8px;
    }

    .scratch-cards-layout {
        gap: 8px;
    }

    .scratch-card {
        width: 80px;
        height: 120px;
    }

    .scratch-card-content {
        font-size: 36px;
    }

    .scratch-item::before {
        font-size: 20px;
    }

    .scratch-item-content {
        font-size: 16px;
    }

    .prize-table-cell {
        font-size: 12px;
        padding: 8px 6px;
    }
}

/* ========== 动画效果 ========== */
@keyframes ticketEntrance {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.lottery-ticket {
    animation: ticketEntrance 0.5s ease-out;
}

@keyframes numberReveal {
    0% {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.scratch-item-overlay.scratched + .scratch-item-content {
    animation: numberReveal 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ========== 中奖匹配效果 ========== */
.scratch-item.matched {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    box-shadow: 
        0 0 20px rgba(46, 204, 113, 0.6),
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
    animation: matchedPulse 1s ease-in-out infinite;
}

.scratch-item.special-matched {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 
        0 0 25px rgba(243, 156, 18, 0.7),
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
    animation: specialMatchedPulse 1s ease-in-out infinite;
}

@keyframes matchedPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 
            0 0 20px rgba(46, 204, 113, 0.6),
            0 4px 12px rgba(0, 0, 0, 0.15);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 
            0 0 30px rgba(46, 204, 113, 0.8),
            0 6px 16px rgba(0, 0, 0, 0.2);
    }
}

@keyframes specialMatchedPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 
            0 0 25px rgba(243, 156, 18, 0.7),
            0 4px 12px rgba(0, 0, 0, 0.15);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 
            0 0 40px rgba(243, 156, 18, 0.9),
            0 8px 20px rgba(0, 0, 0, 0.2);
    }
}

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