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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1f2937;
    padding: 20px;
}

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

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.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.game-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

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

.info-item .label {
    font-size: 1rem;
    font-weight: 600;
    color: #4b5563;
}

.info-item .value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e3a8a;
    min-width: 30px;
    text-align: center;
}

.simon-board {
    position: relative;
    width: 500px;
    height: 500px;
    margin: 0 auto 30px;
    max-width: 100%;
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 20px;
    width: 100%;
    height: 100%;
}

.simon-button {
    border: none;
    cursor: pointer;
    transition: all 0.1s ease;
    border-radius: 20px;
    position: relative;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.simon-button:active {
    transform: scale(0.95);
}

.simon-button.disabled {
    cursor: not-allowed;
    pointer-events: none;
}

.simon-button.green {
    background: linear-gradient(135deg, #22c55e 0%, #4ade80 100%);
}

.simon-button.green.active {
    background: linear-gradient(135deg, #86efac 0%, #bbf7d0 100%);
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.8);
}

.simon-button.red {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

.simon-button.red.active {
    background: linear-gradient(135deg, #f87171 0%, #fca5a5 100%);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.8);
}

.simon-button.yellow {
    background: linear-gradient(135deg, #eab308 0%, #fbbf24 100%);
}

.simon-button.yellow.active {
    background: linear-gradient(135deg, #fde047 0%, #fef08a 100%);
    box-shadow: 0 0 30px rgba(234, 179, 8, 0.8);
}

.simon-button.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

.simon-button.blue.active {
    background: linear-gradient(135deg, #93c5fd 0%, #bfdbfe 100%);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.8);
}

.center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    background: #1f2937;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.start-button {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    border: none;
    padding: 20px 30px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
    letter-spacing: 1px;
}

.start-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.5);
}

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

.start-button.hidden {
    display: none;
}

.message {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    padding: 10px;
}

.message.hidden {
    display: none;
}

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

.control-button {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.control-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(30, 58, 138, 0.4);
}

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

.game-over-message {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 15px;
    margin-top: 20px;
}

.game-over-message.hidden {
    display: none;
}

.game-over-message h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #1f2937;
}

.game-over-message p {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #4b5563;
}

.final-stats {
    font-size: 1rem;
    font-weight: 600;
    color: #6b7280;
    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 ol,
.modal-content ul {
    margin-left: 20px;
    margin-top: 10px;
    margin-bottom: 15px;
    color: #4b5563;
    line-height: 1.8;
}

.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 {
        margin-bottom: 60px;
    }

    header h1 {
        display: none;
    }

    .subtitle {
        display: none;
    }

    .game-container {
        padding: 30px 20px;
    }

    .simon-board {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        max-width: 400px;
    }

    .button-grid {
        gap: 10px;
    }

    .center-circle {
        width: 140px;
        height: 140px;
    }

    .start-button {
        padding: 15px 25px;
        font-size: 1rem;
    }

    .game-info {
        flex-direction: column;
        gap: 10px;
    }

    /* Mobile-friendly: icon-only buttons */
    .back-button {
        font-size: 0;
        padding: 8px;
        min-width: 36px;
        min-height: 36px;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .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;
    }
}
