* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-wrapper {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.game-header {
    text-align: center;
    margin-bottom: 30px;
}

.game-header h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.game-header p {
    color: #666;
    font-size: 1.1em;
}

.game-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #2196F3;
    color: white;
}

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

.btn-hint {
    background: #FF9800;
    color: white;
}

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

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-item .label {
    color: #666;
    font-weight: 600;
}

.info-item .value {
    color: #333;
    font-size: 1.2em;
    font-weight: bold;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-width: 400px;
    margin: 0 auto 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
    position: relative;
}

.cell {
    width: 60px;
    height: 60px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cell:hover:not(.triggered) {
    border-color: #4CAF50;
    background: #e8f5e9;
    transform: scale(1.05);
}

.cell.triggered {
    background: #4CAF50;
    border-color: #4CAF50;
    animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0);
    }
}

.arrow-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 2px;
}

.arrow {
    font-size: 24px;
    color: #333;
    transition: all 0.3s ease;
    line-height: 1;
    padding: 2px;
    animation: arrowPulse 2s ease-in-out infinite;
}

@keyframes arrowPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.cell.triggered .arrow {
    color: white;
}

/* 多个箭头时的样式调整 */
.arrow-container .arrow:nth-child(1) {
    font-size: 20px;
}

.arrow-container .arrow:nth-child(2) {
    font-size: 18px;
}

.arrow-container .arrow:nth-child(3) {
    font-size: 16px;
}

.arrow-container .arrow:nth-child(n+4) {
    font-size: 14px;
}

/* 动画箭头样式 */
.animated-arrow {
    position: absolute;
    font-size: 28px;
    color: #FF5722;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 87, 34, 0.8),
                 0 0 20px rgba(255, 87, 34, 0.6),
                 0 0 30px rgba(255, 87, 34, 0.4);
    z-index: 100;
    pointer-events: none;
    transition: all 0.4s ease-out;
}

.animated-arrow::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 87, 34, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: arrowGlow 0.4s ease-out;
}

@keyframes arrowGlow {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.5);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* 格子触发时的动画效果 */
.cell.triggered {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-color: #4CAF50;
    animation: cellTrigger 0.6s ease-out forwards;
}

@keyframes cellTrigger {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 rgba(76, 175, 80, 0);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.8);
    }
    100% {
        transform: scale(0);
        opacity: 0;
        box-shadow: 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* 格子被触发时的闪烁效果 */
.cell.just-triggered {
    animation: cellFlash 0.3s ease-out;
}

@keyframes cellFlash {
    0% {
        background: #FFEB3B;
        transform: scale(1.1);
    }
    50% {
        background: #FFC107;
        transform: scale(1.05);
    }
    100% {
        background: white;
        transform: scale(1);
    }
}

.game-message {
    text-align: center;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    min-height: 50px;
}

.game-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.game-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.game-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.game-instructions {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.game-instructions h3 {
    color: #333;
    margin-bottom: 15px;
}

.game-instructions ul {
    list-style: none;
    padding-left: 0;
}

.game-instructions li {
    color: #666;
    margin-bottom: 8px;
    padding-left: 25px;
    position: relative;
}

.game-instructions li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #4CAF50;
    font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .game-wrapper {
        padding: 20px;
    }

    .game-header h1 {
        font-size: 2em;
    }

    .game-board {
        grid-template-columns: repeat(5, 1fr);
        gap: 5px;
    }

    .cell {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .arrow {
        font-size: 22px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}
