* {
    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;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

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

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

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

main {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.input-section {
    margin-bottom: 30px;
}

.input-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #555;
    font-size: 1.1rem;
}

#input-textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    font-family: monospace;
    resize: vertical;
    min-height: 200px;
    transition: border-color 0.3s ease;
}

#input-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.controls {
    text-align: center;
    margin-bottom: 40px;
}

.randomize-button {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.3rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

.randomize-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(255, 107, 107, 0.4);
}

.randomize-button:active {
    transform: translateY(0);
}

.randomize-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.result-section {
    margin-bottom: 40px;
    min-height: 120px;
}

.animation-display {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 15px;
    color: white;
    display: none;
}

.animation-display.active {
    display: block;
}

.winner-text {
    font-size: 1.2rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.animated-result {
    font-size: 2.5rem;
    font-weight: 700;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.animated-result.loading {
    animation: pulse 1s ease-in-out infinite;
}

.animated-result.thinking {
    animation: thinking 0.8s ease-in-out infinite;
}

.animated-result.final {
    animation: finalBounce 0.6s ease-out;
    font-size: 3rem;
    color: #ffd700;
}

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

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

@keyframes finalBounce {
    0% { transform: scale(1.2); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1.3); }
}

.info-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-top: 20px;
}

.info-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.info-section h3 {
    color: #555;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.info-content p {
    margin-bottom: 15px;
    color: #666;
}

.info-content ul {
    margin-left: 20px;
    margin-bottom: 20px;
}

.info-content li {
    margin-bottom: 8px;
    color: #666;
}

.info-content strong {
    color: #333;
}

.algorithm-note {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
    margin-top: 20px;
    color: #1565c0;
}

footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 20px;
    }
    
    .randomize-button {
        padding: 12px 30px;
        font-size: 1.1rem;
    }
    
    .animated-result {
        font-size: 2rem;
    }
    
    .animated-result.final {
        font-size: 2.5rem;
    }
}