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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #ffb3e6 0%, #ff99d9 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: backgroundShift 10s ease-in-out infinite alternate;
}

@keyframes backgroundShift {
    0% { background: linear-gradient(135deg, #ffb3e6 0%, #ff99d9 100%); }
    100% { background: linear-gradient(135deg, #ffc4e6 0%, #ffb3e6 100%); }
}

.container {
    width: 90%;
    max-width: 600px;
    background: #fff5f8;
    border-radius: 25px;
    box-shadow: 0 20px 40px rgba(255, 182, 193, 0.3);
    overflow: hidden;
    animation: containerFloat 3s ease-in-out infinite alternate;
    transition: transform 0.3s ease;
    border: 3px solid #ffcccb;
    position: relative;
}

.container::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 15px solid #ff9ec7;
    z-index: 10;
}

.container::after {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 12px solid #ff9ec7;
    z-index: 11;
}

.container:hover {
    transform: scale(1.02);
}

@keyframes containerFloat {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-5px); }
}

header {
    background: linear-gradient(135deg, #ff9ec7 0%, #ffb3d9 100%);
    padding: 30px;
    text-align: center;
    position: relative;
}

header::before {
    content: '🐾';
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 2rem;
    animation: pawBounce 2s ease-in-out infinite;
}

header::after {
    content: '🐾';
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 2rem;
    animation: pawBounce 2s ease-in-out infinite 0.5s;
}

@keyframes pawBounce {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(5deg); }
}

header h1 {
    color: #8e44ad;
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(142, 68, 173, 0.2);
    animation: titlePulse 2s ease-in-out infinite alternate;
}

header h1::before {
    content: '🐱 ';
    font-size: 2rem;
}

header h1::after {
    content: ' 🐱';
    font-size: 2rem;
}

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

.score-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: rgba(255, 245, 248, 0.95);
    padding: 15px 20px;
    border-radius: 20px;
    font-weight: bold;
    color: #8e44ad;
    box-shadow: 0 5px 15px rgba(255, 182, 193, 0.3);
    text-align: center;
    border: 2px solid #ffb3d9;
}

main {
    padding: 40px;
}

.setup-area {
    text-align: center;
}

.setup-area h2 {
    color: #8e44ad;
    margin-bottom: 30px;
    font-size: 2rem;
}

.setup-section {
    margin-bottom: 25px;
    text-align: left;
}

.setup-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #8e44ad;
}

.setup-section input[type="checkbox"] {
    margin-right: 8px;
}

#word-list-input {
    width: 100%;
    height: 120px;
    padding: 15px;
    border: 2px solid #ffb3d9;
    border-radius: 15px;
    font-size: 1rem;
    resize: vertical;
    font-family: Arial, sans-serif;
    background: #fff5f8;
}

#word-list-input:focus {
    outline: none;
    border-color: #ff9ec7;
    box-shadow: 0 0 10px rgba(255, 158, 199, 0.5);
}

#word-time-setting, #question-limit {
    width: 80px;
    padding: 8px;
    border: 2px solid #ffb3d9;
    border-radius: 10px;
    font-size: 1rem;
    text-align: center;
    background: #fff5f8;
}

#word-time-setting:focus, #question-limit:focus {
    outline: none;
    border-color: #ff9ec7;
    box-shadow: 0 0 5px rgba(255, 158, 199, 0.3);
}

#openai-api-key {
    width: 100%;
    padding: 10px;
    border: 2px solid #ffb3d9;
    border-radius: 10px;
    font-size: 1rem;
    font-family: monospace;
    background: #fff5f8;
}

#openai-api-key:focus {
    outline: none;
    border-color: #ff9ec7;
    box-shadow: 0 0 5px rgba(255, 158, 199, 0.3);
}

.help-text {
    font-size: 0.9rem;
    color: #c44569;
    margin-top: 5px;
    font-style: italic;
}

.start-btn {
    background: linear-gradient(135deg, #ff7675 0%, #fd79a8 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(255, 118, 117, 0.4);
    margin-top: 20px;
    position: relative;
    overflow: hidden;
}

.start-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 25px rgba(255, 118, 117, 0.6);
    animation: buttonPulse 0.6s ease-in-out;
}

.start-btn:active {
    transform: translateY(0px) scale(0.98);
}

@keyframes buttonPulse {
    0% { box-shadow: 0 8px 20px rgba(255, 118, 117, 0.4); }
    50% { box-shadow: 0 15px 30px rgba(255, 118, 117, 0.8); }
    100% { box-shadow: 0 12px 25px rgba(255, 118, 117, 0.6); }
}

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

.timer-bar-container {
    position: relative;
    width: 100%;
    height: 40px;
    background: #ecf0f1;
    border-radius: 20px;
    margin: 20px 0;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timer-bar {
    height: 100%;
    background: linear-gradient(135deg, #ff7675 0%, #fd79a8 100%);
    border-radius: 20px;
    transition: width 0.1s linear, background 0.3s ease;
    width: 100%;
    position: relative;
}

.timer-bar::after {
    content: '🐾';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    animation: pawWalk 1s ease-in-out infinite;
}

@keyframes pawWalk {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-60%) scale(1.1); }
}

.timer-bar.warning {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    animation: timerPulse 0.5s ease-in-out infinite alternate;
}

@keyframes timerPulse {
    0% { opacity: 0.8; }
    100% { opacity: 1; transform: scaleY(1.1); }
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: #2d3436;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.paper-mode-area {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    margin: 20px 0;
    border: 2px dashed #6c757d;
}

.paper-instructions {
    margin-bottom: 25px;
}

.paper-instructions p {
    margin: 10px 0;
    font-size: 1.1rem;
    color: #495057;
}

.paper-instructions p:first-child {
    font-size: 1.3rem;
    font-weight: bold;
    color: #2d3436;
}

.paper-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.paper-btn {
    background: linear-gradient(135deg, #ff9ec7 0%, #ffb3d9 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(255, 158, 199, 0.4);
    min-width: 120px;
}

.paper-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 158, 199, 0.6);
}

.paper-btn.correct-btn {
    background: linear-gradient(135deg, #ff7675 0%, #fd79a8 100%);
    box-shadow: 0 6px 15px rgba(255, 118, 117, 0.4);
}

.paper-btn.correct-btn::before {
    content: '😸 ';
    font-size: 1rem;
}

.paper-btn.correct-btn:hover {
    box-shadow: 0 10px 20px rgba(255, 118, 117, 0.6);
}

.paper-btn.incorrect-btn {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    box-shadow: 0 6px 15px rgba(253, 121, 168, 0.4);
}

.paper-btn.incorrect-btn::before {
    content: '😿 ';
    font-size: 1rem;
}

.paper-btn.incorrect-btn:hover {
    box-shadow: 0 10px 20px rgba(253, 121, 168, 0.6);
}

.paper-btn.reveal-btn {
    background: linear-gradient(135deg, #ffc4e6 0%, #ffb3d9 100%);
    box-shadow: 0 6px 15px rgba(255, 196, 230, 0.4);
}

.paper-btn.reveal-btn::before {
    content: '🐱 ';
    font-size: 1rem;
}

.paper-btn.reveal-btn:hover {
    box-shadow: 0 10px 20px rgba(255, 196, 230, 0.6);
}

.photo-upload-section {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-radius: 15px;
    padding: 25px;
    margin: 20px 0;
    border: 2px solid #9c27b0;
}

.upload-instructions {
    margin-bottom: 20px;
    text-align: center;
}

.upload-instructions p {
    margin: 8px 0;
    font-size: 1.1rem;
    color: #4a148c;
}

.upload-instructions p:first-child {
    font-weight: bold;
    font-size: 1.2rem;
}

.upload-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.photo-btn {
    background: linear-gradient(135deg, #ff9ec7 0%, #ffb3d9 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(255, 158, 199, 0.4);
    min-width: 140px;
}

.photo-btn::before {
    content: '📷🐱 ';
    font-size: 1rem;
}

.photo-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 158, 199, 0.6);
}

.photo-preview {
    text-align: center;
    margin: 20px 0;
}

.photo-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.validation-controls {
    text-align: center;
    margin-top: 20px;
}

.validate-btn {
    background: linear-gradient(135deg, #ff7675 0%, #fd79a8 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(255, 118, 117, 0.4);
    margin-bottom: 15px;
}

.validate-btn::before {
    content: '🔍🐱 ';
    font-size: 1.1rem;
}

.validate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(255, 118, 117, 0.6);
}

.validate-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.validation-status {
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    font-weight: bold;
}

.validation-status.loading {
    background: linear-gradient(135deg, #ff9ec7 0%, #ffb3d9 100%);
    color: white;
}

.validation-status.loading::before {
    content: '🐱✨ ';
    font-size: 1.2rem;
}

.validation-status.success {
    background: linear-gradient(135deg, #ff7675 0%, #fd79a8 100%);
    color: white;
}

.validation-status.success::before {
    content: '😸✨ ';
    font-size: 1.2rem;
}

.validation-status.error {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: white;
}

.validation-status.error::before {
    content: '😿💔 ';
    font-size: 1.2rem;
}

.paper-btn.finish-btn {
    background: linear-gradient(135deg, #ff7675 0%, #fd79a8 100%);
    box-shadow: 0 6px 15px rgba(255, 118, 117, 0.4);
    font-size: 1.1rem;
    padding: 15px 25px;
}

.paper-btn.finish-btn::before {
    content: '🏁🐱 ';
    font-size: 1.1rem;
}

.paper-btn.finish-btn:hover {
    box-shadow: 0 10px 20px rgba(255, 118, 117, 0.6);
}

.manual-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.word-display {
    margin-bottom: 30px;
}

.play-btn {
    background: linear-gradient(135deg, #ff9ec7 0%, #ffb3d9 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(255, 158, 199, 0.4);
}

.play-btn::before {
    content: '🐈 ';
    font-size: 1.2rem;
}

.play-btn:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 12px 25px rgba(255, 158, 199, 0.6);
    animation: speakerBounce 0.3s ease-in-out;
}

@keyframes speakerBounce {
    0%, 100% { transform: translateY(-2px) scale(1.1); }
    50% { transform: translateY(-2px) scale(1.15) rotate(5deg); }
}

.definition {
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #fff5f8 0%, #ffe0e6 100%);
    border-radius: 15px;
    color: #8e44ad;
    font-style: italic;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffcccb;
    position: relative;
}

.definition::before {
    content: '🐾';
    position: absolute;
    top: 5px;
    left: 10px;
    font-size: 1rem;
    opacity: 0.7;
}

.input-area {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
}

#spelling-input {
    flex: 1;
    max-width: 300px;
    padding: 15px 20px;
    border: 3px solid #ffb3d9;
    border-radius: 50px;
    font-size: 1.1rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #fff5f8;
}

#spelling-input:focus {
    outline: none;
    border-color: #ff9ec7;
    box-shadow: 0 0 20px rgba(255, 158, 199, 0.4);
    transform: scale(1.02);
    animation: inputFocus 0.3s ease-out;
}

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

#submit-btn {
    background: linear-gradient(135deg, #ff7675 0%, #fd79a8 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(255, 118, 117, 0.4);
}

#submit-btn::before {
    content: '🐾 ';
    font-size: 1rem;
}

#submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(255, 118, 117, 0.6);
}

.feedback {
    margin: 25px 0;
    padding: 15px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 1.1rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.feedback.correct {
    background: linear-gradient(135deg, #ff7675 0%, #fd79a8 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(255, 118, 117, 0.4);
    animation: correctBounce 0.6s ease-out;
}

.feedback.correct::before {
    content: '😸 ';
    font-size: 1.5rem;
}

.feedback.incorrect {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(253, 121, 168, 0.4);
    animation: incorrectShake 0.6s ease-out;
}

.feedback.incorrect::before {
    content: '😿 ';
    font-size: 1.5rem;
}

@keyframes correctBounce {
    0% { transform: scale(0.5) rotate(-5deg); opacity: 0; }
    50% { transform: scale(1.1) rotate(2deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

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

.feedback.hint {
    background: linear-gradient(135deg, #fdcb6e 0%, #e84393 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(253, 203, 110, 0.4);
}

.feedback.skipped {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(162, 155, 254, 0.4);
}

.feedback.warning {
    background: linear-gradient(135deg, #fab1a0 0%, #e17055 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(250, 177, 160, 0.4);
}

.feedback.time-expired {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(253, 121, 168, 0.4);
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.hint-btn, .skip-btn, .end-test-btn {
    background: linear-gradient(135deg, #ff9ec7 0%, #ffb3d9 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(255, 158, 199, 0.4);
}

.hint-btn:hover, .skip-btn:hover, .end-test-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 158, 199, 0.6);
}

.end-test-btn {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    box-shadow: 0 6px 15px rgba(253, 121, 168, 0.4);
}

.end-test-btn:hover {
    box-shadow: 0 10px 20px rgba(253, 121, 168, 0.6);
}

.game-over {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #ff9ec7 0%, #ffb3d9 100%);
    border-radius: 25px;
    margin: 20px;
    position: relative;
    border: 3px solid #ffcccb;
}

.game-over::before {
    content: '😸🎉😸';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    animation: celebrationBounce 1s ease-in-out infinite;
}

@keyframes celebrationBounce {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.1); }
}

.game-over h2 {
    color: #8e44ad;
    font-size: 2.5rem;
    margin-bottom: 20px;
    margin-top: 30px;
}

.game-over p {
    font-size: 1.5rem;
    color: #8e44ad;
    margin-bottom: 30px;
}

#restart-btn {
    background: linear-gradient(135deg, #ff7675 0%, #fd79a8 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(255, 118, 117, 0.4);
}

#restart-btn::before {
    content: '😸 ';
    font-size: 1.2rem;
}

#restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(255, 118, 117, 0.6);
}

@media (max-width: 768px) {
    .container {
        width: 95%;
        margin: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .score-board {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    main {
        padding: 20px;
    }
    
    .input-area {
        flex-direction: column;
        align-items: center;
    }
    
    #spelling-input {
        max-width: 100%;
        margin-bottom: 15px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .paper-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .paper-btn {
        min-width: 200px;
    }
    
    .upload-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .photo-btn {
        min-width: 200px;
    }
    
    .manual-controls {
        flex-direction: column;
        align-items: center;
    }
}