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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #64748b;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    line-height: 1.6;
}

.game-container {
    background: #64748b;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 100%;
    text-align: center;
    position: relative;
    border: 1px solid #475569;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.help-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.help-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #9333ea);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5);
}

.timer-container {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
    min-width: 80px;
}

.timer-label {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 2px;
}

.timer {
    font-size: 24px;
    font-weight: 700;
}

.game-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #4f46e5, #7c3aed, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: gradientShift 3s ease-in-out infinite;
    margin-bottom: 32px;
    letter-spacing: -0.02em;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.setting-group {
    margin-bottom: 24px;
    text-align: left;
}

.setting-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}

.setting-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.setting-select:focus {
    border-color: #7c3aed;
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.timer-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #374151;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s ease;
    background: white;
}

.radio-option:hover {
    border-color: #7c3aed;
    background: linear-gradient(135deg, #faf5ff, #f3e8ff);
}

.radio-option input[type="radio"] {
    margin: 0;
    accent-color: #7c3aed;
}

.radio-option input[type="radio"]:checked + span {
    color: #7c3aed;
    font-weight: 600;
}

.start-game-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    margin-top: 24px;
}

.start-game-btn:hover {
    background: linear-gradient(135deg, #4338ca, #6d28d9);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.5);
}

.scrambled-word-container {
    margin-bottom: 32px;
    padding: 24px;
    background: linear-gradient(135deg, #faf5ff, #f3e8ff);
    border-radius: 16px;
    border: 1px solid #e9d5ff;
}

.scrambled-word {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(45deg, #4f46e5, #7c3aed, #ec4899, #f59e0b);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: wordPulse 2s ease-in-out infinite, colorFlow 4s ease-in-out infinite;
    margin-bottom: 8px;
    letter-spacing: 4px;
    font-family: 'Inter', sans-serif;
    transform-origin: center;
}

@keyframes wordPulse {
    0%, 100% { 
        transform: scale(1);
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.05);
        filter: brightness(1.1);
    }
}

@keyframes colorFlow {
    0%, 100% { background-position: 0% 50%; }
    25% { background-position: 100% 50%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
}

.word-hint {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.input-container {
    margin-bottom: 20px;
}

#playerInput {
    width: 100%;
    padding: 16px 20px;
    font-size: 18px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
    font-weight: 500;
    text-align: center;
    background: white;
}

#playerInput:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.submit-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    margin-bottom: 20px;
}

.submit-btn:hover {
    background: linear-gradient(135deg, #4338ca, #6d28d9);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.5);
}

.message {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 8px;
}

.message.correct {
    color: #047857;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: 1px solid #6ee7b7;
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

.message.incorrect {
    color: #b91c1c;
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border: 1px solid #fca5a5;
    animation: errorShake 0.5s ease-out;
}

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

.game-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.action-btn {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.3);
}

.action-btn:hover {
    background: linear-gradient(135deg, #475569, #334155);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.4);
}

.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.help-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.help-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.close-help-btn {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: #6b7280;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-help-btn:hover {
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    color: #374151;
}

.help-body {
    padding: 24px;
}

.help-intro {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 24px;
    text-align: center;
}

.help-example {
    background: linear-gradient(135deg, #faf5ff, #f3e8ff);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #e9d5ff;
    text-align: center;
}

.example-scrambled {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(45deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.example-arrow {
    font-size: 20px;
    color: #9ca3af;
    margin: 8px 0;
}

.example-answer {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(45deg, #059669, #047857);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.help-rules {
    margin-bottom: 24px;
}

.rule-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #f3f4f6;
}

.rule-number {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    margin-right: 12px;
    flex-shrink: 0;
}

.rule-text {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.help-tips h3 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
    text-align: center;
}

.tip-item {
    background: #fffbeb;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid #f59e0b;
    font-size: 14px;
    font-weight: 500;
    color: #92400e;
}

.game-over-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.game-over-content {
    background: white;
    padding: 32px;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.game-over-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 16px;
}

.game-over-content p {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 24px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        padding: 24px;
        margin: 10px;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .scrambled-word {
        font-size: 2rem;
        letter-spacing: 2px;
    }
    
    .timer-options {
        grid-template-columns: 1fr;
    }
    
    .game-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .scrambled-word {
        font-size: 1.75rem;
        letter-spacing: 1px;
    }
    
    .game-title {
        font-size: 1.75rem;
    }
    
    .header {
        flex-direction: column;
        gap: 16px;
    }
}