/* ============================================
   微信抽奖插件 - 前台完整样式
   wx_lottery v1.0  |  WuchaEX
   ============================================ */

/* === CSS 变量 === */
:root {
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --gold: #f39c12;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-secondary: #7f8c8d;
    --border: #e8ecf1;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-sm: 10px;
}

/* === 全局重置 === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(160deg, #fef3f3 0%, var(--bg) 25%, #fdf6f0 50%, var(--bg) 100%);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
}

/* ============================================
   关闭页面样式
   ============================================ */
.wx-lottery-closed {
    display: flex;
    align-items: center;
    justify-content: center;
}
.closed-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.1);
    max-width: 420px;
    width: 90%;
    padding: 48px 32px;
    text-align: center;
    border: 1px solid #f0e0e0;
}
.closed-card .icon { font-size: 56px; margin-bottom: 16px; }
.closed-card h1 { color: #e74c3c; font-size: 22px; margin-bottom: 12px; font-weight: 700; }
.closed-card p { color: #888; font-size: 14px; line-height: 1.8; }
.closed-card .back-link {
    display: inline-block;
    margin-top: 20px;
    color: #e74c3c;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 24px;
    border: 2px solid #e74c3c;
    border-radius: 50px;
    transition: all .2s;
}
.closed-card .back-link:hover { background: #e74c3c; color: #fff; }

/* ============================================
   顶部导航栏（仿 wx_user 风格，配色适配本插件）
   ============================================ */
#wx-lottery-nav {
    height: 60px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 2px 20px rgba(231, 76, 60, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}
#wx-lottery-nav h1 {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 2px;
    margin: 0;
    white-space: nowrap;
}
#wx-lottery-nav .nav-links {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}
#wx-lottery-nav .nav-links a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all .3s ease;
    white-space: nowrap;
}
#wx-lottery-nav .nav-links a:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
}
#wx-lottery-nav .nav-links a.nav-home-btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-weight: 600;
}
/* 手机端导航栏适配 */
@media (max-width: 520px) {
    #wx-lottery-nav {
        padding: 0 12px;
        height: 50px;
    }
    #wx-lottery-nav h1 {
        font-size: 16px;
        letter-spacing: 1px;
    }
    #wx-lottery-nav .nav-links { gap: 4px; }
    #wx-lottery-nav .nav-links a {
        font-size: 12px;
        padding: 4px 8px;
    }
}

/* ============================================
   主页面 — 布局容器
   ============================================ */
.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

/* === 头部 === */
.header {
    text-align: center;
    padding: 30px 20px 10px;
    position: relative;
}
.header p.lead {
    color: var(--text-secondary);
    font-size: 15px;
    letter-spacing: 1px;
}

/* === 用户信息栏 === */
.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: var(--radius);
    margin: 0 0 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 14px;
}
.user-profile { display: flex; align-items: center; gap: 14px; }
.user-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.3);
    overflow: hidden;
    object-fit: cover;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-meta { display: flex; flex-direction: column; gap: 6px; line-height: 1.4; }
.user-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-nickname { font-size: 16px; font-weight: 700; color: var(--text); }
.user-uid { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.user-uid code {
    background: #f5f6f8;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 11px;
    color: #888;
    letter-spacing: .5px;
}
.user-right { text-align: right; }
.user-credits {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.user-credits strong { font-size: 21px; color: var(--primary); font-weight: 700; }
.draws-info { color: var(--text-secondary); font-size: 13px; }
.draws-info b { color: var(--primary); font-size: 18px; font-weight: 700; }

/* 用户操作按钮组 */
.user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}
/* 积分充值按钮 */
.recharge-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #f5af19, #f12711);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transition: all .25s;
    box-shadow: 0 2px 8px rgba(241, 39, 17, 0.25);
}
.recharge-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(241, 39, 17, 0.4);
    color: #fff;
    text-decoration: none;
}
/* 返回首页按钮 */
.home-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transition: all .25s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}
.home-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
    color: #fff;
    text-decoration: none;
}
.recharge-btn i, .home-btn i { font-size: 14px; }

/* === 幸运值进度条 === */
.lucky-value-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    margin: 0 0 24px;
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    text-align: center;
}
.lucky-value-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}
.lucky-value-title i {
    color: #2ecc71;
    margin-right: 4px;
}
.lucky-value-title span {
    color: var(--primary);
    font-size: 20px;
}
.lucky-value-bar {
    height: 10px;
    background: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
    margin: 0 auto 10px;
    position: relative;
}
.lucky-value-progress {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    width: 0%;
    transition: width 0.8s ease;
    border-radius: 5px;
}
.lucky-value-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* === 登录提示 === */
.login-notice {
    background: linear-gradient(135deg, #ffffff, #fff8f8);
    border-radius: var(--radius);
    padding: 48px 20px;
    margin: 0 0 24px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 2px dashed #ffd5d5;
}
.login-notice .icon-circle {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, #fff0f0, #ffe0e0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 36px;
    color: var(--primary);
}
.login-notice p { color: #666; font-size: 16px; margin-bottom: 20px; }
.login-notice .login-button {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 13px 40px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 6px 24px rgba(231, 76, 60, 0.35);
    transition: all .3s;
    letter-spacing: 1px;
}
.login-notice .login-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 32px rgba(231, 76, 60, 0.45);
    text-decoration: none;
    color: #fff;
}

/* === 刮刮卡区域 === */
.wx-lottery-card-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.wx-lottery-info { text-align: center; margin-bottom: 8px; }
.wx-lottery-info h3 {
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 1px;
}
.wx-lottery-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
}
.wx-lottery-hint b { color: var(--primary); }
.wx-lottery-card-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 0;
}
.wx-lottery-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    aspect-ratio: 2.6 / 1;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 3px solid #ffe0e0;
    transition: transform .3s, box-shadow .3s;
}
.wx-lottery-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 48px rgba(0,0,0,0.16);
}
.wx-lottery-card canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 2;
    cursor: pointer;
    border-radius: 11px;
}
.prize-result {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24, #f0932b);
    color: #fff;
    z-index: 1;
    text-align: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.prize-result::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.15), transparent 60%);
    pointer-events: none;
}
.prize-content { position: relative; z-index: 1; }
.prize-content h3 { margin: 0 0 6px; font-size: 22px; font-weight: 700; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.prize-content p { margin: 0; font-size: 14px; opacity: 0.9; }

/* === 抽奖布局：刮卡 + 奖池全宽 === */
.lottery-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}
.wx-lottery-card-section { margin-bottom: 24px; }

/* === 奖池库存面板 (全宽) === */
.prize-pool-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}
.prize-pool-section .section-title i { color: #3498db; }
.prize-pool-section .section-title {
    margin-bottom: 14px;
    padding-bottom: 12px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    border-bottom: 2px solid var(--border);
}
.prize-pool-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}
.prize-pool-item {
    background: #f8fafb;
    border-radius: 6px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 0;
    transition: box-shadow .2s;
}
.prize-pool-item:hover {
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    border-color: #d0d8e0;
}
.prize-pool-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.prize-pool-stock {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}
.prize-pool-stock i { font-size: 9px; color: #bbb; }
.prize-pool-prob-bar {
    width: 40px;
    height: 4px;
    background: #e8ecf1;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}
.prize-pool-prob-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    transition: width .6s ease;
}
.prize-pool-prob {
    font-size: 11px;
    font-weight: 600;
    color: #3498db;
    white-space: nowrap;
    flex-shrink: 0;
    width: 32px;
    text-align: right;
}
.prize-pool-tip {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    font-size: 11px;
    color: #aaa;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* === 奖池分页器 === */
.prize-pool-pagination {
    display: flex;
    justify-content: center;
    margin: 8px 0 0;
}
.prize-pool-pager {
    display: flex;
    list-style: none;
    gap: 2px;
    margin: 0;
    padding: 0;
    align-items: center;
}
.prize-pool-pager li { list-style: none; }
.prize-pool-pager li a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all .15s;
}
.prize-pool-pager li a:hover {
    background: #e8ecf1;
    color: #3498db;
}
.prize-pool-pager li.disabled a {
    color: #ccc;
    cursor: default;
}
.prize-pool-pager li.disabled a:hover { background: transparent; }
.prize-pool-pager li.page-info {
    padding: 0 8px;
    font-size: 12px;
    color: #aaa;
}

/* === 双栏区域 === */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
.records-section, .rules-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}
.section-title i { color: var(--gold); }

/* === 抽奖记录表格 === */
.records-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.records-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}
.records-table td { padding: 10px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.records-table tbody tr:hover { background: #fef9f9; }
.records-table tbody tr:last-child td { border-bottom: none; }

.status-label {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.status-success { background: #e8f8f0; color: #27ae60; }
.status-info { background: #eaf2fd; color: #2980b9; }
.status-wait { background: #fef7e8; color: #e67e22; }
.status-label a { color: inherit; text-decoration: none; }
.status-label a:hover { text-decoration: underline; }

.empty-records { text-align: center; padding: 36px 0; color: #c0c4cc; }
.empty-records i { font-size: 40px; margin-bottom: 10px; display: block; }

/* === 分页 === */
.pagination-container { display: flex; justify-content: center; margin-top: 16px; }
.pagination { display: flex; list-style: none; gap: 4px; }
.pagination a {
    display: block;
    min-width: 34px; height: 34px;
    line-height: 34px;
    text-align: center;
    background: #f5f6f8;
    border-radius: 8px;
    color: #666;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all .2s;
}
.pagination a:hover { background: #ffe8e8; color: var(--primary); }
.pagination li.active a { background: var(--primary); color: #fff; }
.pagination li.disabled a { background: #fafafa; color: #ccc; cursor: not-allowed; }

/* === 活动规则 === */
.rules-content { white-space: pre-line; color: #666; line-height: 1.9; font-size: 14px; }

/* === 页脚 === */
.plugin-footer {
    text-align: center;
    padding: 24px 0;
    color: #bbb;
    font-size: 12px;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.8;
}
.plugin-footer a { color: #aaa; text-decoration: none; }
.plugin-footer a:hover { color: var(--primary); }

/* === 加载遮罩 === */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
    backdrop-filter: blur(3px);
}
.loading-spinner {
    width: 52px; height: 52px;
    border: 4px solid rgba(255,255,255,0.25);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #fff; font-size: 16px; font-weight: 600; }

/* === 模态框增强 === */
.wx-lottery-modal .modal-content {
    border-radius: 14px;
    border: none;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.wx-lottery-modal .modal-header { border-bottom: 1px solid #f0e0e0; }
.wx-lottery-modal .modal-footer { border-top: 1px solid #f0e0e0; }
.wx-lottery-modal .btn-primary {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: none;
    box-shadow: 0 3px 12px rgba(231, 76, 60, 0.3);
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 680px) {
    .two-col { grid-template-columns: 1fr; }
    .prize-pool-list { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .container { padding: 12px 10px 32px; }
    .header { padding: 20px 10px 8px; }
    .user-info {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 14px 16px;
        align-items: stretch;
    }
    .user-profile { justify-content: center; }
    .draws-info { text-align: center; }
    .user-right { text-align: center; }
    .user-credits { justify-content: center; }
    .user-actions { justify-content: center; }
    .wx-lottery-card { max-width: 100%; border-radius: 10px; }
    .wx-lottery-card-section { padding: 18px 12px; }
    .records-table { font-size: 13px; }
    .records-table th, .records-table td { padding: 8px 6px; }
}

/* ============================================
   翻翻乐 卡片样式
   ============================================ */

.flip-card-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.flip-card-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    width: 100%;
    min-height: 160px;
}

.flip-card-empty {
    width: 100%;
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 60px 0;
}

/* 卡片包装器 */
.flip-card-wrapper {
    width: 120px;
    height: 160px;
    perspective: 800px;
    cursor: pointer;
    transition: order 0.3s ease, transform 0.3s ease;
    user-select: none;
}

.flip-card-wrapper:hover:not(.flip-card-disabled) {
    transform: translateY(-4px);
}

.flip-card-wrapper.shuffling {
    transition: transform 0.3s ease;
}

.flip-card-wrapper.flip-card-disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* 翻转容器 */
.flip-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: none;
}

/* 正面（角色面） */
.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}

.flip-card-front {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    padding: 10px;
}

.flip-card-front img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.5);
    margin-bottom: 6px;
}

.flip-card-emoji {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 6px;
}

.flip-card-name {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* 背面（问号面） */
.flip-card-back {
    background: linear-gradient(135deg, #434343 0%, #1a1a1a 100%);
    transform: rotateY(180deg);
    color: #fff;
}

.flip-card-back-icon {
    font-size: 36px;
    font-weight: 700;
    color: #f39c12;
}

.flip-card-back.flip-card-won {
    background: linear-gradient(135deg, #f5af19 0%, #f12711 100%);
}

.flip-card-back.flip-card-won .flip-card-back-icon {
    font-size: 18px;
    color: #fff;
    text-align: center;
    padding: 4px;
}

/* 重新发卡按钮 */
.flip-reshuffle-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    border: none;
    padding: 10px 28px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.flip-reshuffle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(231, 76, 60, 0.5);
}

.flip-reshuffle-btn:active {
    transform: translateY(0);
}

/* 翻卡动画：绕Y轴翻转 900°（5次半翻）并弹出 */
@keyframes flipCardReveal {
    0%   { transform: rotateY(0deg) scale(1); }
    20%  { transform: rotateY(180deg) scale(1.02); }
    40%  { transform: rotateY(360deg) scale(0.98); }
    60%  { transform: rotateY(540deg) scale(1.02); }
    80%  { transform: rotateY(720deg) scale(0.98); }
    95%  { transform: rotateY(900deg) scale(1.06); }
    100% { transform: rotateY(900deg) scale(1); }
}

/* 移动端适配 */
@media (max-width: 576px) {
    .flip-card-wrapper {
        width: 90px;
        height: 130px;
    }
    .flip-card-front img,
    .flip-card-emoji { font-size: 36px; }
    .flip-card-name { font-size: 11px; }
    .flip-card-back-icon { font-size: 28px; }
}

/* ============================================
   九宫格 抽奖样式
   ============================================ */

.grid-lottery-container {
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.grid-lottery-box {
    width: 100%;
    max-width: 360px;
    background: #fff8f8;
    border: 3px solid #ffe0e0;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.12);
}

.grid-lottery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    aspect-ratio: 1 / 1;
    min-height: 300px;
}

.grid-lottery-item {
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8px 4px;
    text-align: center;
    transition: all 0.15s ease;
    cursor: default;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    color: #fff;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.grid-lottery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.2), transparent 60%);
    pointer-events: none;
}

.grid-lottery-item-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 3px;
}

.grid-lottery-item-name {
    font-weight: 600;
    font-size: 12px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* 高亮动画 */
.grid-lottery-item.highlighted {
    animation: gridHighlight 0.3s ease-in-out;
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(255, 170, 0, 0.7), 0 0 40px rgba(255, 170, 0, 0.3);
    z-index: 2;
}

@keyframes gridHighlight {
    0% { transform: scale(1); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
    50% { transform: scale(1.12); box-shadow: 0 0 30px rgba(255, 170, 0, 0.9); }
    100% { transform: scale(1.08); box-shadow: 0 0 20px rgba(255, 170, 0, 0.7); }
}

/* 九宫格中心按钮 */
.grid-lottery-start-btn {
    grid-column: 2;
    grid-row: 2;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.4);
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.grid-lottery-start-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.2), transparent 60%);
    pointer-events: none;
}

.grid-lottery-start-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(231, 76, 60, 0.5);
}

.grid-lottery-start-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.grid-lottery-start-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}

.grid-lottery-start-cost {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 2px;
    letter-spacing: 0;
    font-weight: 500;
}

/* 九宫格移动端适配 */
@media (max-width: 480px) {
    .grid-lottery-box {
        padding: 10px;
        border-radius: 12px;
    }
    .grid-lottery-grid {
        gap: 6px;
        min-height: 260px;
    }
    .grid-lottery-item {
        border-radius: 8px;
        padding: 4px 2px;
    }
    .grid-lottery-item-icon {
        font-size: 18px;
    }
    .grid-lottery-item-name {
        font-size: 10px;
    }
    .grid-lottery-start-btn {
        font-size: 16px;
        border-radius: 8px;
    }
    .grid-lottery-start-cost {
        font-size: 10px;
    }
}
