@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;600;700&family=Poppins:wght@400;600;700;900&display=swap');

/**
 * Piggy Bank Problems - Piggy Bank/Money Theme
 *
 * A fun money-themed word problem game for 2nd graders
 *
 * Color Palette:
 * - Piggy Pink: #FFB6C1 (main theme, accents)
 * - Money Green: #228B22 (bills, success)
 * - Gold Coin: #FFD700 (highlights, coins)
 * - Brown/Copper: #CD853F (pennies, earth tones)
 * - Light Pink: #FFC0CB (backgrounds)
 */

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

body {
    font-family: 'Quicksand', 'Poppins', sans-serif;
    background: linear-gradient(135deg, #FFB6C1 0%, #FF69B4 25%, #228B22 50%, #FFD700 75%, #FFC0CB 100%);
    background-size: 400% 400%;
    animation: moneyShift 25s ease infinite;
    color: #2C2C2C;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

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

.game-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    flex: 1 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.game-title {
    font-family: 'Quicksand', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2);
    animation: piggyBounce 2s ease-in-out infinite;
    color: #ffffff;
}

@keyframes piggyBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

.score-display {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.score, .accuracy {
    background: rgba(34, 139, 34, 0.8);
    backdrop-filter: blur(10px);
    border: 2px solid #FFD700;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    color: white;
}

/* Screens */
.screen {
    display: block;
    animation: fadeIn 0.5s ease;
}

.screen.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Setup Panel */
.setup-panel, .results-panel {
    background: rgba(255, 255, 255, 0.95);
    border: 4px solid #FFB6C1;
    border-radius: 30px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.piggy-mascot {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: wiggle 2s ease-in-out infinite;
}

.piggy-mascot.excited {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: bounce 0.8s ease infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.setup-panel h2 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    font-weight: 700;
    color: #FF69B4;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: #555;
}

/* Difficulty Selector */
.difficulty-selector {
    margin: 30px 0;
}

.difficulty-selector h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #228B22;
    font-weight: 700;
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.difficulty-btn {
    background: rgba(255, 182, 193, 0.3);
    border: 3px solid #FFB6C1;
    border-radius: 20px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #2C2C2C;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.difficulty-btn:hover {
    transform: translateY(-5px);
    background: rgba(255, 182, 193, 0.5);
    border-color: #FF69B4;
    box-shadow: 0 8px 20px rgba(255, 105, 180, 0.3);
}

.difficulty-btn.selected {
    background: rgba(255, 182, 193, 0.6);
    border-color: #FF69B4;
    border-width: 4px;
    box-shadow: 0 0 20px rgba(255, 105, 180, 0.5);
}

.diff-emoji {
    font-size: 2.5rem;
}

.diff-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #FF69B4;
}

.diff-desc {
    font-size: 0.9rem;
    color: #666;
}

.question-count {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

/* Buttons */
.main-btn, .secondary-btn, .next-btn, .submit-btn, .hint-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 10px;
}

.main-btn {
    background: linear-gradient(135deg, #FFB6C1 0%, #FF69B4 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(255, 105, 180, 0.4);
}

.main-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 105, 180, 0.6);
}

.main-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background: rgba(34, 139, 34, 0.7);
    color: white;
    border: 2px solid #228B22;
}

.secondary-btn:hover {
    background: rgba(34, 139, 34, 0.9);
    transform: translateY(-2px);
}

.next-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #2C2C2C;
    margin-top: 20px;
}

.next-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4);
}

.submit-btn {
    background: linear-gradient(135deg, #228B22 0%, #32CD32 100%);
    color: white;
    padding: 12px 30px;
    margin: 0;
    font-size: 1rem;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(34, 139, 34, 0.4);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hint-btn {
    background: rgba(255, 215, 0, 0.7);
    color: #2C2C2C;
    padding: 10px 25px;
    font-size: 1rem;
    margin: 20px auto;
    display: block;
}

.hint-btn:hover {
    background: rgba(255, 215, 0, 0.9);
    transform: scale(1.05);
}

/* Progress Bar */
.progress-bar {
    background: rgba(255, 255, 255, 0.5);
    border: 3px solid #FFB6C1;
    border-radius: 50px;
    height: 40px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #228B22, #32CD32, #228B22);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
    height: 100%;
    border-radius: 50px;
    transition: width 0.5s ease;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 1rem;
    color: #2C2C2C;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7);
    z-index: 1;
}

/* Question Panel */
.question-panel {
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #FFB6C1;
    border-radius: 25px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.story-book {
    background: rgba(255, 252, 230, 0.8);
    border: 2px solid #FFD700;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
}

.story-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 15px;
}

.problem-text {
    font-size: 1.3rem;
    line-height: 1.8;
    color: #2C2C2C;
    text-align: center;
    font-weight: 600;
}

/* Hint Box */
.hint-box {
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid #FFD700;
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
}

.hint-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #FFA500;
    margin-bottom: 10px;
}

.hint-text {
    font-size: 1rem;
    color: #555;
    line-height: 1.6;
}

/* Text Input */
.answers-container {
    margin-bottom: 20px;
}

.text-input-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dollar-sign {
    font-size: 2rem;
    font-weight: 700;
    color: #228B22;
}

#answer-input {
    font-size: 1.5rem;
    padding: 15px 20px;
    border: 3px solid #FFB6C1;
    border-radius: 15px;
    width: 200px;
    text-align: center;
    font-weight: 700;
    color: #2C2C2C;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

#answer-input:focus {
    outline: none;
    border-color: #FF69B4;
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.3);
    transform: scale(1.05);
}

#answer-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Feedback */
.feedback {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 15px;
    border-radius: 15px;
    margin-top: 20px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback.correct {
    background: rgba(34, 197, 94, 0.2);
    border: 3px solid #22c55e;
    color: #15803d;
}

.feedback.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border: 3px solid #ef4444;
    color: #b91c1c;
}

/* Results */
.results-panel h2 {
    font-size: 2.2rem;
    margin-bottom: 20px;
    color: #FF69B4;
    font-weight: 700;
}

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

.stat {
    background: rgba(255, 182, 193, 0.4);
    border: 3px solid #FFB6C1;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: #FF69B4;
}

/* Missed Problems */
.missed-section {
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid #FFB6C1;
    border-radius: 20px;
    padding: 20px;
    margin: 20px 0;
}

.missed-section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #FF69B4;
    font-weight: 700;
}

.missed-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.missed-item {
    background: rgba(255, 182, 193, 0.3);
    border: 1px solid #FFB6C1;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.95rem;
    color: #555;
}

.results-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }

    .piggy-mascot {
        font-size: 4rem;
    }

    .difficulty-buttons {
        grid-template-columns: 1fr;
    }

    .problem-text {
        font-size: 1.1rem;
    }

    #answer-input {
        width: 150px;
        font-size: 1.3rem;
    }

    .final-stats {
        grid-template-columns: 1fr;
    }

    .text-input-wrapper {
        flex-direction: column;
        gap: 15px;
    }

    .submit-btn {
        width: 100%;
        max-width: 250px;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 10px;
    }

    .setup-panel, .results-panel, .question-panel {
        padding: 20px 15px;
    }

    .main-btn, .secondary-btn, .next-btn {
        padding: 12px 30px;
        font-size: 1rem;
    }

    .story-book {
        padding: 15px;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .difficulty-btn:hover,
    .main-btn:hover,
    #answer-input:focus {
        transform: none !important;
    }
}
