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

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

.game-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    text-align: center;
    max-width: 500px;
    width: 100%;
    border: 1px solid rgba(226, 232, 240, 0.6);
}

h1 {
    color: #2d3748;
    margin-bottom: 30px;
    font-size: 2.2rem;
    font-weight: 600;
}

h2 {
    color: #38a169;
    margin: 20px 0;
    font-size: 1.8rem;
    font-weight: 600;
}

h3 {
    color: #4a5568;
    margin: 20px 0 12px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.setup-description {
    color: #4a5568;
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.5;
}

.setup-screen, .game-screen, .result-screen {
    display: none;
}

.setup-screen.active, .game-screen.active, .result-screen.active {
    display: block;
    animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(15px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.input-group {
    margin: 20px 0;
}

label {
    display: block;
    margin-bottom: 10px;
    color: #2d3748;
    font-weight: 600;
    font-size: 1.05rem;
}

input[type="number"] {
    width: 100%;
    padding: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.15rem;
    text-align: center;
    transition: all 0.25s ease;
    background: #f8fafc;
    font-family: inherit;
}

input[type="number"]:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
    transform: scale(1.01);
}

.btn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    margin: 10px;
    min-width: 140px;
    font-family: inherit;
    box-shadow: 0 4px 6px rgba(66, 153, 225, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(66, 153, 225, 0.3);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(66, 153, 225, 0.2);
}

.btn-secondary {
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
    box-shadow: 0 4px 6px rgba(237, 137, 54, 0.2);
}

.btn-secondary:hover {
    box-shadow: 0 6px 12px rgba(237, 137, 54, 0.3);
}

.btn-secondary:active {
    box-shadow: 0 2px 4px rgba(237, 137, 54, 0.2);
}

.game-info {
    background: rgba(66, 153, 225, 0.08);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    border-left: 4px solid #4299e1;
}

.attempts {
    font-size: 1.2rem;
    color: #2d3748;
    margin: 12px 0;
    font-weight: 500;
}

.message {
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    font-size: 1.25rem;
    font-weight: 600;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.message.too-high {
    background: rgba(254, 205, 205, 0.7);
    color: #c53030;
    border-color: #feb2b2;
    animation: shake 0.4s ease-in-out;
}

.message.too-low {
    background: rgba(198, 226, 255, 0.7);
    color: #2b6cb0;
    border-color: #bee3f8;
    animation: shake 0.4s ease-in-out;
}

.message.close {
    background: rgba(253, 230, 138, 0.7);
    color: #b7791f;
    border-color: #faf089;
    animation: pulse 1.2s infinite;
}

.message.correct {
    background: rgba(167, 244, 183, 0.7);
    color: #2f855a;
    border-color: #9ae6b4;
    animation: bounce 0.6s ease-in-out;
}

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

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
    60% { transform: translateY(-4px); }
}

/* Previous Guesses Styles */
.previous-guesses {
    margin-top: 25px;
    padding: 20px;
    background: rgba(247, 250, 252, 0.7);
    border-radius: 15px;
    border: 1px solid rgba(226, 232, 240, 0.6);
}

.previous-guesses h3 {
    margin-bottom: 15px;
    color: #4a5568;
}

.guesses-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    min-height: 40px;
}

.guess-item {
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.guess-item.too-high {
    background: rgba(254, 205, 205, 0.8);
    color: #c53030;
    border: 1px solid #feb2b2;
}

.guess-item.too-low {
    background: rgba(198, 226, 255, 0.8);
    color: #2b6cb0;
    border: 1px solid #bee3f8;
}

.guess-item.correct {
    background: rgba(167, 244, 183, 0.8);
    color: #2f855a;
    border: 1px solid #9ae6b4;
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Result screen specific */
.result-guesses {
    margin-top: 20px;
    background: rgba(247, 250, 252, 0.9);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.stat-card {
    background: rgba(66, 153, 225, 0.08);
    padding: 16px;
    border-radius: 12px;
    border: 2px solid rgba(66, 153, 225, 0.2);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: #3182ce;
}

.stat-label {
    font-size: 0.85rem;
    color: #4a5568;
    margin-top: 6px;
    font-weight: 500;
}

.emoji {
    font-size: 2.2rem;
    margin: 12px 0;
}

.performance-message {
    margin: 20px 0;
    font-size: 1.15rem;
    color: #4a5568;
    line-height: 1.5;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 500px) {
    .game-container {
        padding: 25px;
        margin: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    .btn {
        width: 100%;
        margin: 8px 0;
        padding: 12px;
    }
    
    .stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .input-group {
        margin: 15px 0;
    }
    
    input[type="number"] {
        padding: 12px;
        font-size: 1.1rem;
    }
    
    .guess-item {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
    
    .previous-guesses {
        padding: 15px;
    }
}