* {
    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;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1100px;
    width: 100%;
    position: relative;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    font-size: 32px;
}

/* Story Box */
.story-box {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%);
    border-left: 5px solid #e91e63;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.story-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.icon {
    font-size: 50px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.header-text strong {
    color: #c2185b;
    font-size: 20px;
    display: block;
}

.header-text p {
    color: #666;
    font-size: 14px;
    margin-top: 3px;
}

.story-text {
    color: #333;
    line-height: 1.8;
    font-size: 18px;
    text-align: center;
}

.story-text strong {
    color: #c2185b;
}

/* Scenario Section */
.scenario-section {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    gap: 15px;
    align-items: center;
    margin: 30px 0;
    padding: 30px;
    background: linear-gradient(135deg, #f5f5f5 0%, #ffe0b2 100%);
    border-radius: 15px;
    border: 3px solid #ff9800;
}

.total-fruits {
    background: white;
    padding: 20px;
    border-radius: 15px;
    border: 3px solid #4caf50;
    text-align: center;
}

.fruits-label {
    font-size: 16px;
    font-weight: bold;
    color: #2e7d32;
    margin-bottom: 12px;
}

.fruits-expression {
    font-size: 32px;
    font-weight: bold;
    color: #333;
    font-family: 'Courier New', monospace;
    margin-bottom: 15px;
}

.fruits-display {
    font-size: 40px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.division-sign {
    font-size: 50px;
    color: #ff5722;
    font-weight: bold;
}

.friends-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    border: 3px solid #2196f3;
    text-align: center;
}

.friends-label {
    font-size: 16px;
    font-weight: bold;
    color: #1565c0;
    margin-bottom: 12px;
}

.friends-number {
    font-size: 48px;
    font-weight: bold;
    color: #1976d2;
    margin-bottom: 10px;
}

.friends-display {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
}

.friend {
    font-size: 32px;
    animation: wave 2s ease-in-out infinite;
}

.friend:nth-child(1) { animation-delay: 0s; }
.friend:nth-child(2) { animation-delay: 0.2s; }
.friend:nth-child(3) { animation-delay: 0.4s; }
.friend:nth-child(4) { animation-delay: 0.6s; }
.friend:nth-child(5) { animation-delay: 0.8s; }
.friend:nth-child(6) { animation-delay: 1s; }

@keyframes wave {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.equals-sign {
    font-size: 50px;
    color: #9c27b0;
    font-weight: bold;
}

.result-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    border: 3px dashed #ff9800;
    text-align: center;
}

.result-label {
    font-size: 16px;
    font-weight: bold;
    color: #e65100;
    margin-bottom: 12px;
}

.result-box {
    font-size: 60px;
    color: #ff9800;
    font-weight: bold;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Question Section */
.question-section {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 3px solid #1976d2;
    border-radius: 15px;
    padding: 30px;
    margin: 30px 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.question-section h3 {
    color: #0d47a1;
    text-align: center;
    font-size: 20px;
    margin-bottom: 10px;
}

.question-section label {
    font-size: 18px;
    font-weight: bold;
    color: #1565c0;
    text-align: center;
}

.question-section input {
    width: 100%;
    max-width: 400px;
    padding: 15px;
    font-size: 22px;
    text-align: center;
    border: 3px solid #1976d2;
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
}

.question-section input:focus {
    border-color: #0d47a1;
    box-shadow: 0 0 10px rgba(25, 118, 210, 0.3);
}

.question-section input.blink-green {
    animation: blink-green 0.6s ease;
}

.question-section input.blink-red {
    animation: blink-red 0.6s ease;
}

@keyframes blink-green {
    0%, 100% { background: white; border-color: #1976d2; }
    50% { background: #4caf50; border-color: #2e7d32; color: white; }
}

@keyframes blink-red {
    0%, 100% { background: white; border-color: #1976d2; }
    50% { background: #f44336; border-color: #c62828; color: white; }
}

.question-section button {
    padding: 15px 40px;
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.question-section button:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.question-section button:active {
    transform: translateY(0);
}

.question-section button:disabled {
    background: #9e9e9e;
    cursor: not-allowed;
    transform: none;
}

/* Feedback */
.feedback {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    min-height: 30px;
    margin: 20px 0;
}

.feedback.success {
    color: #4caf50;
}

.feedback.error {
    color: #f44336;
}

/* Reset Button */
.reset-btn {
    display: block;
    margin: 20px auto;
    background: #4caf50;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background: #388e3c;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.reset-btn:active {
    transform: translateY(0);
}

/* Balloons Animation */
.balloons-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    display: none;
}

.balloons-animation.active {
    display: block;
}

.balloon {
    position: absolute;
    bottom: -100px;
    font-size: 60px;
    animation: rise 4s ease-out forwards;
    opacity: 0;
}

@keyframes rise {
    0% {
        bottom: -100px;
        opacity: 0;
        transform: translateX(0) rotate(0deg);
    }
    10% {
        opacity: 1;
    }
    50% {
        transform: translateX(20px) rotate(10deg);
    }
    100% {
        bottom: 120%;
        opacity: 0;
        transform: translateX(-20px) rotate(-10deg);
    }
}

/* Responsive */
@media (max-width: 968px) {
    .scenario-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .division-sign,
    .equals-sign {
        transform: rotate(0deg);
        margin: 10px 0;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 25px;
    }

    h1 {
        font-size: 26px;
    }

    .fruits-expression {
        font-size: 28px;
    }

    .fruits-display {
        font-size: 32px;
    }

    .friends-number {
        font-size: 40px;
    }

    .question-section input {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 22px;
    }

    .story-text {
        font-size: 16px;
    }

    .fruits-expression {
        font-size: 24px;
    }

    .fruits-display {
        font-size: 28px;
    }

    .friends-number {
        font-size: 36px;
    }

    .friend {
        font-size: 24px;
    }

    .result-box {
        font-size: 48px;
    }

    .question-section input {
        font-size: 18px;
        padding: 12px;
    }
}
