/* Block Flow 游戏页面样式 */
.block-flow-page {
    padding: 100px 0 60px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    min-height: 100vh;
}

/* 关卡选择界面 */
.level-select {
    max-width: 800px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.level-select h3 {
    text-align: center;
    color: var(--secondary-color);
    font-size: 2rem;
    margin-bottom: 2rem;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.level-btn {
    aspect-ratio: 1;
    border: 3px solid var(--primary-color);
    border-radius: 12px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.level-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
}

.level-btn.locked {
    background: #e0e0e0;
    border-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.level-btn .lock-icon {
    font-size: 2rem;
}

.level-btn .stars-earned {
    font-size: 1rem;
}

/* 游戏容器 */
.game-container {
    max-width: 700px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* 关卡信息 */
.level-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    color: var(--secondary-color);
    padding: 8px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.level-badge {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95rem;
}

/* 游戏目标 */
.objective {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.objective-text {
    font-size: 1.1rem;
    color: #1565c0;
    margin: 0;
}

.start-point, .end-point {
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--white);
}

.start-point {
    color: #2196f3;
}

.end-point {
    color: #4caf50;
}

/* 游戏信息面板 */
.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
}

.info-item {
    text-align: center;
}

.info-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.info-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* 游戏棋盘区域 */
.game-board-container {
    margin-bottom: 2rem;
    text-align: center;
}

.play-board {
    display: grid;
    gap: 4px;
    background: #2c3e50;
    padding: 8px;
    border-radius: 12px;
    width: 100%;
    max-width: 450px;
    aspect-ratio: 1;
    margin: 0 auto;
}

.cell {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
    aspect-ratio: 1;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.cell:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

/* 管道方块 */
.pipe-cell {
    background: #34495e;
}

.pipe-cell.flowing {
    background: #2980b9;
}

/* 管道接口 */
.pipe-connector {
    position: absolute;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    transition: all 0.3s ease;
}

.pipe-connector.top {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 50%;
    border-radius: 0 0 4px 4px;
}

.pipe-connector.bottom {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 50%;
    border-radius: 4px 4px 0 0;
}

.pipe-connector.left {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 50%;
    height: 40%;
    border-radius: 0 4px 4px 0;
}

.pipe-connector.right {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 50%;
    height: 40%;
    border-radius: 4px 0 0 4px;
}

/* 中心连接点 */
.pipe-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 50%;
}

/* 水流动画 */
@keyframes flowAnimation {
    0% {
        opacity: 0.6;
        transform: scale(0.9);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 0.6;
        transform: scale(0.9);
    }
}

.cell.flowing .pipe-connector {
    animation: flowAnimation 1.5s ease-in-out infinite;
}

.cell.flowing .pipe-center {
    animation: flowAnimation 1.5s ease-in-out infinite 0.2s;
}

/* 起点和终点 */
.start-cell {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%) !important;
}

.start-cell::after {
    content: '💧';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 10;
}

.end-cell {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%) !important;
}

.end-cell::after {
    content: '🏁';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 10;
}

/* 空单元格 */
.empty-cell {
    background: rgba(255, 255, 255, 0.05);
    cursor: default;
}

/* 游戏控制按钮 */
.game-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-control {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    color: var(--secondary-color);
    padding: 10px 20px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-control:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 水流说明 */
.flow-guide {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.flow-guide h4 {
    color: #1565c0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.flow-guide ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.flow-guide li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: #1565c0;
}

.flow-guide li::before {
    content: '💧';
    position: absolute;
    left: 0;
}

/* 关卡完成弹窗 */
.level-complete-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.level-complete-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--white);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    animation: slideUp 0.4s ease;
}

.modal-content h3 {
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

/* 水滴动画 */
.water-animation {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.drop {
    font-size: 2.5rem;
    animation: dropBounce 0.6s ease-in-out infinite;
}

.drop:nth-child(1) {
    animation-delay: 0s;
}

.drop:nth-child(2) {
    animation-delay: 0.2s;
}

.drop:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dropBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

.stars-display {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.star {
    font-size: 3rem;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.star.earned {
    opacity: 1;
    animation: starPop 0.5s ease-out;
}

@keyframes starPop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

.stats-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1rem;
    border-radius: 12px;
}

.stat-item p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color) !important;
    margin: 0;
}

.btn-primary {
    display: inline-block;
    background: var(--primary-color);
    color: var(--white);
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    margin-bottom: 1rem;
    width: 100%;
}

.btn-primary:hover {
    background: #3a7bc8;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 144, 217, 0.4);
}

.btn-secondary {
    display: inline-block;
    background: #f8f9fa;
    color: var(--secondary-color);
    padding: 12px 30px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    width: 100%;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .block-flow-page {
        padding: 80px 0 40px;
    }

    .game-container {
        padding: 1.5rem;
        margin: 0 1rem;
    }

    .play-board {
        max-width: 350px;
    }

    .game-controls {
        flex-wrap: wrap;
    }

    .btn-control {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }

    .modal-content {
        padding: 2rem;
    }

    .modal-content h3 {
        font-size: 1.5rem;
    }

    .star {
        font-size: 2.5rem;
    }

    .stats-display {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .level-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
}
