:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border-color: #374151;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

body {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.3s ease;
}

.game-container {
    background: var(--bg-primary);
    border-radius: 20px;
    box-shadow: var(--shadow);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.scrambled-word {
    font-size: 3rem;
    font-weight: bold;
    letter-spacing: 0.2em;
    color: var(--primary-color);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    min-height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.letter-animate {
    display: inline-block;
    animation: letterFlip 0.6s ease-in-out;
}

@keyframes letterFlip {
    0% { transform: rotateY(0); }
    50% { transform: rotateY(180deg); }
    100% { transform: rotateY(0); }
}

.scramble-animation {
    animation: scrambleShake 0.5s ease-in-out;
}

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

.timer-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.timer-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(var(--success-color) 0deg, var(--border-color) 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.timer-warning {
    background: conic-gradient(var(--danger-color) 0deg, var(--border-color) 0deg) !important;
    animation: timerPulse 1s infinite;
}

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

.btn-custom {
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.btn-custom:active {
    transform: translateY(0);
}

.difficulty-btn {
    margin: 5px;
    min-width: 120px;
}

.difficulty-easy { background: var(--success-color); color: white; }
.difficulty-medium { background: var(--warning-color); color: white; }
.difficulty-hard { background: var(--danger-color); color: white; }

.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.message {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 10px;
    animation: slideIn 0.5s ease-out;
    box-shadow: var(--shadow);
}

.message-success { background: var(--success-color); color: white; }
.message-error { background: var(--danger-color); color: white; }
.message-info { background: var(--primary-color); color: white; }
.message-warning { background: var(--warning-color); color: white; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.score-display {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    text-align: center;
}

.hint-display {
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.guess-input {
    font-size: 1.5rem;
    text-align: center;
    border: 3px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.guess-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
    outline: none;
}

.shake {
    animation: shake 0.8s;
}

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

.bounce {
    animation: bounce 0.8s;
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% { transform: translateY(0); }
    40%, 43% { transform: translateY(-15px); }
    70% { transform: translateY(-7px); }
    90% { transform: translateY(-3px); }
}

.pulse-success {
    animation: pulseSuccess 0.6s;
}

@keyframes pulseSuccess {
    0% { transform: scale(1); background-color: var(--success-color); }
    50% { transform: scale(1.05); background-color: #059669; }
    100% { transform: scale(1); background-color: var(--success-color); }
}

.dark-mode-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
}

.sound-toggle {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 1000;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sound-toggle:hover {
    transform: scale(1.1);
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

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

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 5px;
}

.custom-words-section {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    margin-top: 20px;
}

.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.card-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.form-control {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.form-control:focus {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

.form-label {
    color: var(--text-primary);
    font-weight: 600;
}

@media (max-width: 768px) {
    .scrambled-word {
        font-size: 2rem;
    }
    
    .timer-container {
        width: 80px;
        height: 80px;
    }
    
    .timer-circle {
        font-size: 1.2rem;
    }
    
    .btn-custom {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .message-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .dark-mode-toggle,
    .sound-toggle {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    .sound-toggle {
        top: 70px;
    }
}