/* Common styles for all games */
* {
    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;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 900px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.5s ease;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
    flex-wrap: wrap;
    gap: 15px;
}

.back-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
}

.back-button:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.game-title {
    font-size: 2em;
    color: #333;
    flex: 1;
    text-align: center;
}

.score-display {
    font-size: 1.2em;
    color: #667eea;
    font-weight: bold;
}

.game-area {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 35px;
    border-radius: 10px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px;
    font-weight: 600;
}

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

.btn:active {
    transform: scale(0.98);
}

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

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

/* Input fields */
input[type="text"],
input[type="number"],
textarea {
    font-size: 1.2em;
    padding: 12px 20px;
    border: 2px solid #667eea;
    border-radius: 8px;
    text-align: center;
    margin: 10px;
    transition: all 0.3s ease;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

/* Stat boxes */
.stats-row {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.stat-box {
    background: #f0f0f0;
    padding: 15px 25px;
    border-radius: 10px;
    text-align: center;
    min-width: 120px;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.stat-value {
    color: #667eea;
    font-size: 2em;
    font-weight: bold;
}

.stat-value.success {
    color: #51cf66;
}

.stat-value.error {
    color: #ff6b6b;
}

/* Messages */
.message {
    font-size: 1.3em;
    margin: 20px 0;
    font-weight: bold;
    min-height: 40px;
    transition: all 0.3s ease;
}

.message.success {
    color: #51cf66;
}

.message.error {
    color: #ff6b6b;
}

.message.info {
    color: #667eea;
}

/* Timer */
.timer {
    font-size: 1.5em;
    color: #ff6b6b;
    margin: 20px 0;
    font-weight: bold;
}

.timer.warning {
    animation: pulse 1s infinite;
}

/* Screens */
.screen {
    display: none;
}

.screen.active {
    display: flex;
}

/* Result screen */
.result-container {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.result-container h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em;
}

.final-score {
    background: #f0f0f0;
    padding: 30px;
    border-radius: 15px;
    margin: 20px 0;
}

.final-score .label {
    color: #666;
    font-size: 1.1em;
}

.final-score .value {
    color: #667eea;
    font-size: 3.5em;
    font-weight: bold;
    margin: 10px 0;
}

.final-score .subtitle {
    color: #666;
    font-size: 1em;
}

.new-record {
    color: #51cf66;
    font-size: 1.8em;
    margin: 20px 0;
    animation: pulse 2s infinite;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

/* Responsive design */
@media (max-width: 768px) {
    .game-container {
        padding: 20px;
    }

    .game-title {
        font-size: 1.5em;
    }

    .game-header {
        flex-direction: column;
        text-align: center;
    }

    .btn {
        padding: 12px 25px;
        font-size: 1em;
    }

    .stat-box {
        padding: 10px 15px;
        min-width: 100px;
    }

    .stat-value {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .game-container {
        padding: 15px;
    }

    .game-title {
        font-size: 1.3em;
    }

    .stats-row {
        gap: 10px;
    }

    input[type="text"],
    input[type="number"] {
        font-size: 1em;
        width: 90%;
    }
}
