/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Override Tailwind background */
.bg-gray-100 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

/* Letter boxes for the number display */
.letter-box {
    width: 40px;
    height: 50px;
    border-bottom: 3px solid #4b5563;
    transition: all 0.3s ease;
    position: relative;
}

.letter-box.revealed {
    animation: letterReveal 0.5s ease-out;
}

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

/* Hangman parts */
.hangman-part {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hangman-part.visible {
    opacity: 1;
    animation: hangmanAppear 0.5s ease-out;
}

@keyframes hangmanAppear {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Keyboard styling */
.keyboard-key {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.keyboard-key:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.keyboard-key:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.keyboard-key:disabled {
    opacity: 0.7;
    transform: scale(0.95);
    cursor: not-allowed;
}

/* Ripple effect for keyboard keys */
.keyboard-key::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.keyboard-key:active::before {
    width: 100px;
    height: 100px;
}

/* Game cards */
.game-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.game-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(196, 58, 58, 0.05);
    transform: translateY(-2px);
}

/* Button enhancements */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border: none;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

/* Pulse animation */
.pulse {
    animation: pulse 1.5s infinite;
}

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

/* Confetti animation */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
}

/* Score display enhancement */
.score-glow {
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    animation: scoreUpdate 0.5s ease-out;
}

@keyframes scoreUpdate {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        text-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
    }
    100% {
        transform: scale(1);
    }
}

/* Status message animations */
.status-success {
    color: #059669;
    animation: successBounce 0.6s ease-out;
}

.status-error {
    color: #dc2626;
    animation: errorShake 0.6s ease-out;
}

@keyframes successBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .letter-box {
        width: 32px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .keyboard-key {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .game-card {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .letter-box {
        width: 28px;
        height: 36px;
        font-size: 1rem;
    }
    
    .keyboard-key {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .container {
        padding: 0.5rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .game-card {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
        border-color: #374151;
        color: #f9fafb;
    }
    
    .letter-box {
        border-bottom-color: #6b7280;
        color: #f9fafb;
    }
    
    .keyboard-key {
        background-color: #374151;
        color: #f9fafb;
    }
    
    .keyboard-key:hover:not(:disabled) {
        background-color: #4b5563;
    }
}

/* Accessibility improvements */
.keyboard-key:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .letter-box {
        border-bottom-width: 4px;
        border-bottom-color: #000;
    }
    
    .keyboard-key {
        border: 2px solid #000;
    }
    
    .game-card {
        border: 2px solid #000;
    }
}
