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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #dd8e20;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    max-width: 700px;
    width: 100%;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.3rem;
    opacity: 0.9;
}

.game-container {
    background: white;
    border-radius: 20px;
    padding: 80px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

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

.label {
    font-weight: 600;
    color: #374151;
    font-size: 1.1rem;
}

.value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #3b82f6;
}

.control-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.control-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.control-button:active {
    transform: scale(0.98);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin: 0 auto;
    max-width: 400px;
    aspect-ratio: 1;
}

.light {
    aspect-ratio: 1;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.light::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.light.on {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.6), 0 4px 6px rgba(0, 0, 0, 0.1);
}

.light.on::before {
    opacity: 1;
}

.light.off {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
}

.light:hover {
    transform: scale(1.05);
}

.light:active {
    transform: scale(0.95);
}

.light.toggling {
    animation: toggle-pulse 0.3s ease;
}

@keyframes toggle-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.win-message {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 15px;
    color: white;
    margin-top: 20px;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

.win-message.hidden {
    display: none;
}

.win-message h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.win-message p {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.moves-count {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.help-button-container {
    position: absolute;
    top: 20px;
    right: 20px;
}

.help-button {
    display: inline-block;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.help-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-content h2 {
    color: #1f2937;
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.modal-content p {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 15px;
}

.modal-content strong {
    color: #1f2937;
}

.back-button-container {
    position: absolute;
    top: 20px;
    left: 20px;
}

.back-button {
    display: inline-block;
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    font-weight: 600;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-5px);
}

@media (max-width: 768px) {
    header h1 {
        display: none;
    }

    .subtitle {
        display: none;
    }

    .game-container {
        padding: 20px;
    }

    .game-board {
        max-width: 300px;
    }

    .light {
        width: 50px;
        height: 50px;
    }

    /* Mobile-friendly: icon-only buttons */
    .back-button {
        font-size: 0;
        padding: 8px;
        min-width: 36px;
        min-height: 36px;
    }

    .back-button::before {
        content: '←';
        font-size: 1.2rem;
    }

    .help-button {
        font-size: 0;
        padding: 8px;
        min-width: 36px;
        min-height: 36px;
    }

    .help-button::before {
        content: '📖';
        font-size: 1.2rem;
    }

    .win-message {
        padding: 15px;
        margin-top: 15px;
    }

    .win-message h2 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .win-message p {
        font-size: 1rem;
        margin-bottom: 15px;
    }
}
