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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 600px;
    width: 90%;
    margin: 20px auto;
}

/* Timer Bar Styles */
.timer-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(229, 62, 62, 0.2);
    border-radius: 3px;
    margin-bottom: 20px;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    background: #38a169;
    border-radius: 3px;
    width: 100%;
    transition: width 0.1s linear, background-color 0.1s linear;
}

.timer-bar.warning {
    animation: pulse-bar 0.5s ease-in-out infinite alternate;
}

@keyframes pulse-bar {
    0% { opacity: 1; }
    100% { opacity: 0.7; }
}

h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
    color: #4a5568;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(74, 85, 104, 0.1);
    border-radius: 10px;
}

.score-display {
    font-size: 1.2em;
    font-weight: bold;
    color: #4a5568;
}

.timer-display {
    font-size: 1.5em;
    font-weight: bold;
    color: #38a169;
    padding: 8px 16px;
    background: rgba(56, 161, 105, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.timer-display.warning {
    color: #e53e3e;
    background: rgba(229, 62, 62, 0.1);
    animation: pulse 1s infinite;
}

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

.loading {
    font-size: 1.3em;
    color: #666;
    padding: 40px;
}

/* Instructions Screen Styles */
.instructions-screen {
    text-align: center;
}

.instructions-content h2 {
    font-size: 1.8em;
    color: #4a5568;
    margin-bottom: 30px;
}

.rules {
    margin-bottom: 30px;
}

.rule {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 15px;
    text-align: left;
}

.example-letter {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    margin-right: 15px;
    flex-shrink: 0;
}

.example-letter.green {
    background-color: #48bb78;
}

.example-letter.yellow {
    background-color: #ed8936;
}

.example-letter.grey {
    background-color: #a0aec0;
}

.game-description {
    font-size: 1.1em;
    color: #666;
    line-height: 1.5;
    margin-bottom: 30px;
}

.play-button {
    padding: 15px 40px;
    font-size: 1.3em;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.play-button:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.game-area {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
}

/* Word History Styles */
.word-history {
    overflow-y: visible;
    margin-bottom: 15px;
    padding: 5px 0;
}

.word-history::-webkit-scrollbar {
    width: 6px;
}

.word-history::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.word-history::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

.word-history::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.history-word {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
    opacity: 0.8;
}

.current-challenge {
    margin-bottom: 15px;
}

.word-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.letter-box {
    width: 60px;
    height: 60px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.letter-box.green {
    background-color: #48bb78;
    color: white;
    border-color: #38a169;
}

.letter-box.yellow {
    background-color: #ed8936;
    color: white;
    border-color: #dd6b20;
}

.letter-box.grey {
    background-color: #a0aec0;
    color: white;
    border-color: #718096;
}

.input-section {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

/* Input Boxes Styles */
.input-boxes {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.input-box {
    width: 60px;
    height: 60px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    text-transform: uppercase;
    background: white;
    cursor: text;
    transition: all 0.3s ease;
    position: relative;
}

.input-box.active {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    animation: blink-border 1s infinite;
}

.input-box.filled {
    background: #f7fafc;
    border-color: #cbd5e0;
}

@keyframes blink-border {
    0%, 50% { border-color: #667eea; }
    51%, 100% { border-color: #a0aec0; }
}

/* Success Animation */
.input-box.success {
    background-color: #48bb78;
    color: white;
    border-color: #38a169;
    animation: flip-reveal 0.6s ease;
}

@keyframes flip-reveal {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); background-color: #e2e8f0; }
    100% { transform: rotateY(0deg); background-color: #48bb78; }
}

/* Slide Animation */
.input-box.slide-up {
    animation: slide-to-history 0.8s ease forwards;
}

@keyframes slide-to-history {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-200px);
        opacity: 0.8;
    }
}

/* New Input Animation */
.input-boxes.new-input {
    animation: fade-in-up 0.5s ease;
}

@keyframes fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

#word-input {
    padding: 12px 16px;
    font-size: 1.1em;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    width: 200px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.3s ease;
}

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

#submit-btn {
    padding: 12px 24px;
    font-size: 1.1em;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#submit-btn:hover {
    background: #5a67d8;
}

#submit-btn:active {
    transform: translateY(1px);
}

.status-message {
    min-height: 30px;
    font-size: 1.1em;
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.status-message.error {
    background-color: rgba(229, 62, 62, 0.1);
    color: #e53e3e;
    border: 1px solid rgba(229, 62, 62, 0.3);
}

.status-message.success {
    background-color: rgba(56, 161, 105, 0.1);
    color: #38a169;
    border: 1px solid rgba(56, 161, 105, 0.3);
}

.game-over {
    text-align: center;
}

.game-over-message {
    font-size: 1.5em;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 10px;
    font-weight: bold;
}

.game-over-message.win {
    background-color: rgba(56, 161, 105, 0.1);
    color: #38a169;
    border: 2px solid rgba(56, 161, 105, 0.3);
}

.game-over-message.lose {
    background-color: rgba(229, 62, 62, 0.1);
    color: #e53e3e;
    border: 2px solid rgba(229, 62, 62, 0.3);
}

#restart-btn {
    padding: 15px 30px;
    font-size: 1.2em;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#restart-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Digital Keyboard Styles */
.digital-keyboard {
    margin-top: 15px;
    padding: 10px;
    background: rgba(74, 85, 104, 0.05);
    border-radius: 10px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 6px;
}

.keyboard-row:last-child {
    margin-bottom: 0;
}

.key {
    min-width: 40px;
    height: 50px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.key:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

.key:active {
    transform: translateY(0);
    background: #e2e8f0;
}

.key-action {
    min-width: 65px;
    font-size: 0.75em;
    background: #667eea;
    color: white;
    border-color: #5a67d8;
}

.key-action:hover {
    background: #5a67d8;
    border-color: #4c51bf;
}

.key-action:active {
    background: #4c51bf;
}

/* Keyboard Letter Color States */
.key.green {
    background-color: #48bb78;
    color: white;
    border-color: #38a169;
}

.key.green:hover {
    background-color: #38a169;
    border-color: #2f855a;
}

.key.yellow {
    background-color: #ed8936;
    color: white;
    border-color: #dd6b20;
}

.key.yellow:hover {
    background-color: #dd6b20;
    border-color: #c05621;
}

.key.grey {
    background-color: #a0aec0;
    color: white;
    border-color: #718096;
}

.key.grey:hover {
    background-color: #718096;
    border-color: #4a5568;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
        margin: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .letter-box, .input-box {
        width: 50px;
        height: 50px;
        font-size: 1.3em;
    }
    
    .rule {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .example-letter {
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .word-history {
        max-height: 200px;
    }
    
    .key {
        min-width: 32px;
        height: 42px;
        font-size: 0.8em;
    }
    
    .key-action {
        min-width: 50px;
        font-size: 0.65em;
    }
    
    .keyboard-row {
        gap: 4px;
    }
}