/* ===== 快闪记忆游戏专用样式 ===== */
/* 序列显示区域 */
.sequence-board {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 15px;
    border: 2px solid #6a11cb;
    position: relative;
    overflow: hidden;
    min-width: 220px;
    max-width: 250px;
    height: fit-content;
    align-self: flex-start;
    margin-top: 20px;
    max-height: 400px;  /* 限制最大高度 */
    overflow-y: auto;   /* 添加垂直滚动 */
}

.sequence-board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(106, 17, 203, 0.05) 50%, transparent 70%);
    background-size: 200px 100%;
    animation: shine 3s infinite linear;
}

@keyframes shine {
    0% { background-position: -100px; }
    100% { background-position: 100px; }
}

.sequence-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: #ffd700;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    justify-content: center;
}

.sequence-header i {
    font-size: 1.5rem;
}

/* 序列网格样式 - 简化版 */
.sequence-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    justify-items: center;
    align-items: center;
    padding: 5px;
    max-height: 350px;  /* 限制网格高度 */
    overflow-y: auto;   /* 允许滚动 */
    padding-right: 5px; /* 给滚动条留空间 */
}

.sequence-card {
    width: 60px;
    height: 75px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 2px solid #4dccff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    font-size: 0.8rem;  /* 减小字体 */
}

.sequence-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(77, 204, 255, 0.4);
}

.sequence-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 5px;
}

.sequence-number {
    position: absolute;
    top: 2px;
    left: 2px;
    background: #6a11cb;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;  /* 减小数字字体 */
    font-weight: bold;
    border: 1px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.sequence-image {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: white;
    padding: 2px;
    border: 1px solid #e0e0e0;
    margin-top: 5px;
}

.sequence-status {
    position: absolute;
    bottom: 3px;
    right: 3px;
    color: #888;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.9);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sequence-status.completed {
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.sequence-empty {
    color: #a0a0c0;
    font-style: italic;
    text-align: center;
    padding: 30px 20px;
    font-size: 0.95rem;
    width: 100%;
    grid-column: 1 / -1;
}

/* 游戏状态特殊样式 */
.combo-high {
    color: #ffd700 !important;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    animation: comboPulse 0.5s infinite alternate;
}

@keyframes comboPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

.time-warning {
    color: #f44336 !important;
    animation: timeWarning 0.5s infinite alternate;
}

@keyframes timeWarning {
    0% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* 游戏板网格样式 - 所有关卡都使用网格 */
.shape-grid .game-board {
    display: grid;
    gap: 12px;
    justify-content: center;
    align-content: center;
    width: 100%;
    min-height: 400px;
    padding: 15px;
    box-sizing: border-box;
}

/* 第1关：2x3网格 */
.shape-grid .game-board.grid-6 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* 第2关：2x4网格 */
.shape-grid .game-board.grid-8 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* 第3关：3x4网格（多一个卡片放在中间） */
.shape-grid .game-board.grid-10 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

/* 第4关：3x4网格 */
.shape-grid .game-board.grid-12 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

/* 第5关：3x5网格 */
.shape-grid .game-board.grid-15 {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

/* 第6关：3x6网格 */
.shape-grid .game-board.grid-18 {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

/* 卡片基础样式 */
.card {
    width: 110px !important;
    height: 147px !important;
    cursor: pointer;
    perspective: 1000px;
    position: relative;
    transition: transform 0.3s;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    margin: 0 !important;
}

.card:hover {
    transform: translateY(-5px) rotateX(5deg);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    border-radius: 12px;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card.matched {
    position: relative;
    animation: matchedPulse 0.5s ease-out;
}

@keyframes matchedPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.card.matched .card-inner {
    transform: rotateY(180deg);
    box-shadow: 0 0 25px rgba(76, 175, 80, 0.7);
    border: 3px solid #4CAF50;
    animation: matchedGlow 1.5s infinite alternate;
}

@keyframes matchedGlow {
    0% { 
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
        border-color: #4CAF50;
    }
    100% { 
        box-shadow: 0 0 40px rgba(76, 175, 80, 0.9);
        border-color: #8BC34A;
    }
}

.card.wrong .card-inner {
    border: 3px solid #f44336;
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.5);
}

.nft-image {
    width: 90%;
    height: 90%;
    object-fit: contain;
    border-radius: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 1;
}

/* 滚动条样式 */
.sequence-board::-webkit-scrollbar,
.sequence-grid::-webkit-scrollbar {
    width: 5px;
}

.sequence-board::-webkit-scrollbar-track,
.sequence-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.sequence-board::-webkit-scrollbar-thumb,
.sequence-grid::-webkit-scrollbar-thumb {
    background: #4dccff;
    border-radius: 3px;
}

.sequence-board::-webkit-scrollbar-thumb:hover,
.sequence-grid::-webkit-scrollbar-thumb:hover {
    background: #6a11cb;
}

/* 响应式调整 */
@media (max-width: 1024px) {
    .sequence-board {
        max-width: 230px;
    }
    
    .sequence-card {
        width: 55px;
        height: 70px;
    }
    
    .sequence-image {
        width: 35px;
        height: 35px;
    }
    
    /* 小屏幕调整网格布局 */
    .shape-grid .game-board.grid-18 {
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    /* 小屏幕改为上下布局 */
    .game-main-area {
        flex-direction: column !important;
    }
    
    .sequence-board {
        max-width: 100%;
        min-width: auto;
        margin-top: 20px;
        order: 2;
    }
    
    .game-board-wrapper {
        order: 1;
        min-height: 400px;
    }
    
    .sequence-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    
    .sequence-card {
        width: 50px;
        height: 65px;
    }
    
    .sequence-image {
        width: 30px;
        height: 30px;
    }
    
    /* 小屏幕调整网格布局 */
    .shape-grid .game-board.grid-12,
    .shape-grid .game-board.grid-15,
    .shape-grid .game-board.grid-18 {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .shape-grid .game-board.grid-18 {
        grid-template-rows: repeat(5, 1fr);
    }
}

@media (max-width: 480px) {
    .sequence-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }
    
    .sequence-card {
        width: 45px;
        height: 60px;
    }
    
    .sequence-image {
        width: 25px;
        height: 25px;
    }
    
    .sequence-header {
        font-size: 1rem;
    }
    
    /* 小屏幕调整网格布局 */
    .shape-grid .game-board {
        gap: 8px;
        padding: 10px;
    }
    
    .shape-grid .game-board.grid-12,
    .shape-grid .game-board.grid-15 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .shape-grid .game-board.grid-18 {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(6, 1fr);
    }
}

/* 关卡按钮高分显示 */
.level-score {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* 确保游戏板容器正确显示 */
.game-board-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    min-height: 400px;
    position: relative;
    width: 100%;
}

.game-board {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* 游戏消息区域 */
.game-message-area {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-message {
    color: #2196F3;
    font-size: 1.1rem;
    text-align: center;
    padding: 10px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 游戏提示 */
.game-hint {
    margin-top: 15px;
    padding: 10px 15px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    border-left: 4px solid #ffd700;
    color: #ffd700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-hint i {
    font-size: 1.2rem;
}