/* ==========================================
   盲盒模块样式 - 九宫格老虎机版
   ========================================== */

/* 弹窗遮罩 */
.blindbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1500;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.blindbox-modal.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 弹窗容器 */
.blindbox-content {
    background: var(--bg-secondary);
    width: min(420px, calc(100vw - 32px));
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 18px 48px var(--shadow);
    overflow: hidden;
}

/* 弹窗标题栏 */
.blindbox-header {
    width: 100%;
    min-height: 50px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.blindbox-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* 关闭按钮 */
.blindbox-close {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    font-size: 24px;
    font-weight: 400;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.blindbox-close:hover {
    color: var(--accent);
    background: rgba(37, 99, 235, 0.08);
}

/* 弹窗主体 */
.blindbox-body {
    width: 100%;
    min-height: 0;
    padding: 24px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    gap: 12px;
    overflow-y: auto;
}

/* 九宫格场景容器 */
.box-scene {
    width: 100%;
    max-width: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.box-scene.hide {
    display: none;
}

/* 九宫格容器 */
.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 25px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 2px solid rgba(37, 99, 235, 0.18);
    box-shadow: none;
}

/* 九宫格单元 */
.grid-item {
    width: 85px;
    height: 85px;
    perspective: 1000px;
    position: relative;
}

/* 中心灯泡 */
.grid-item.center {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.28);
}

.bulb {
    font-size: 42px;
    animation: bulbGlow 2s ease-in-out infinite;
}

@keyframes bulbGlow {
    0%, 100% { 
        transform: scale(1);
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.1);
        filter: brightness(1.3);
    }
}

/* 问号卡片 */
.grid-item:not(.center) {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
}

.grid-face {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 700;
    backface-visibility: hidden;
    border-radius: 10px;
    transition: transform 0.6s ease;
}

.grid-face.front {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.grid-face.back {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    transform: rotateY(180deg);
    font-size: 13px;
    padding: 10px;
    word-break: break-word;
    text-align: center;
    line-height: 1.3;
}

/* 高亮状态 - 金色发光 */
.grid-item.active {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.15);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.5), inset 0 0 15px rgba(255, 215, 0, 0.3);
    transform: scale(1.05);
}

/* 翻转状态 */
.grid-item.flip {
    transform: rotateY(180deg);
}

/* 抽取按钮 */
.twist-btn {
    padding: 12px 36px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    border: 1px solid rgba(37, 99, 235, 0.28);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.22);
    letter-spacing: 1px;
}

.twist-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.28);
    background: linear-gradient(135deg, #3b82f6 0%, var(--accent-hover) 100%);
}

.twist-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.twist-btn.hide {
    display: none;
}

/* 结果卡片 */
.result-card {
    width: 100%;
    max-width: 360px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: none;
    flex-direction: column;
    gap: 16px;
    box-shadow: none;
    animation: cardFadeIn 0.5s ease;
}

.result-card.show {
    display: flex;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 信息表格 */
.result-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
}

.result-table tr {
    border-bottom: 1px solid var(--border);
}

.result-table tr:last-child {
    border-bottom: none;
}

/* 所有单元格统一样式 */
.result-table td {
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid var(--border);
    color: var(--text-primary);
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.result-table td::-webkit-scrollbar {
    display: none;
}

/* 标签列仅控制宽度和背景 */
.table-label {
    width: 80px;
    min-width: 80px;
    background: var(--bg-tertiary);
}

/* 值列仅控制最大宽度 */
.table-value {
    max-width: 0;
}

/* 按钮组 */
.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.result-btn {
    flex: 1;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.visit-result-btn {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
}

.visit-result-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

.retry-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.retry-btn:hover {
    background: rgba(15, 23, 42, 0.04);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .blindbox-content {
        width: min(360px, calc(100vw - 24px));
        max-height: 90vh;
    }

    .blindbox-header {
        min-height: 46px;
        padding: 10px 14px;
    }

    .blindbox-title {
        font-size: 16px;
    }

    .blindbox-body {
        padding: 18px 14px 16px;
    }
    
    .box-scene {
        max-width: 95%;
    }
    
    .grid-container {
        gap: 8px;
        padding: 18px;
    }
    
    .grid-item {
        width: 70px;
        height: 70px;
    }
    
    .bulb {
        font-size: 32px;
    }
    
    .grid-face.front {
        font-size: 32px;
    }
    
    .grid-face.back {
        font-size: 11px;
        padding: 8px;
    }
    
    .twist-btn {
        padding: 10px 30px;
        font-size: 14px;
    }
    
    .result-card {
        max-width: 95%;
        padding: 18px;
    }
    
    .result-table td {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .table-label {
        width: 70px;
        min-width: 70px;
    }
}
