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

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

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 32px;
}

.controls {
    margin-bottom: 30px;
}

.size-options {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.size-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
}

.size-btn:hover {
    background: #f0f0f0;
}

.size-btn.active {
    background: #667eea;
    color: white;
}

.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.game-controls button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

#startBtn {
    background: #4CAF50;
    color: white;
}

#startBtn:hover {
    background: #45a049;
}

#resetBtn {
    background: #f44336;
    color: white;
}

#resetBtn:hover {
    background: #da190b;
}

.game-board {
    display: grid;
    gap: 10px;
    margin: 0 auto;
    max-width: 500px;
}

.game-board.size-2 {
    grid-template-columns: repeat(2, 1fr);
}

.game-board.size-3 {
    grid-template-columns: repeat(3, 1fr);
}

.game-board.size-4 {
    grid-template-columns: repeat(4, 1fr);
}

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

.cell {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e0e0e0;
    border-radius: 10px;
    font-size: 32px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.cell:hover {
    background: #d0d0d0;
    transform: scale(1.05);
}

.cell.hidden {
    background: #667eea;
    color: transparent;
}

.cell.correct {
    background: #4CAF50;
    color: white;
    pointer-events: none;
}

.cell.wrong {
    background: #f44336;
    color: white;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.message {
    text-align: center;
    margin-top: 20px;
    font-size: 20px;
    font-weight: bold;
    min-height: 30px;
}

.message.success {
    color: #4CAF50;
}

.message.error {
    color: #f44336;
}

.next-level-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    background: #FF9800;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.next-level-btn:hover {
    background: #F57C00;
    transform: scale(1.05);
}

.back-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    background: #9E9E9E;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background: #757575;
    transform: scale(1.05);
}

.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: #667eea;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    z-index: 1000;
}

.nav-arrow:hover {
    background: #667eea;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.right-arrow {
    right: 30px;
}

.left-arrow {
    left: 30px;
}

.level2-board {
    grid-template-columns: repeat(4, 1fr);
    gap: 0 !important;
    max-width: 400px;
    border: 3px solid #667eea;
    border-radius: 10px;
    overflow: hidden;
}

.level2-board .cell {
    border-radius: 0;
    border: none;
}

.game-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.game-link {
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    text-decoration: none;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.game-link:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.link-number {
    font-size: 48px;
    font-weight: bold;
}

.link-title {
    font-size: 18px;
    text-align: center;
}