* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #a8e6cf 0%, #dcedc1 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: 900px;
    width: 100%;
    position: relative;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    font-size: 32px;
}

.story-box {
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
    border-left: 5px solid #ffa726;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.school-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.school-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: #e65100;
    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: 16px;
    margin-bottom: 15px;
}

.story-text strong {
    color: #f57c00;
    font-size: 18px;
}

.question {
    color: #333;
    line-height: 1.8;
    font-size: 17px;
    font-weight: 500;
    text-align: center;
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
}

/* Lunch Scene */
.lunch-scene {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 15px;
    padding: 50px;
    margin: 30px 0;
    display: flex;
    justify-content: center;
}

.scale-setup {
    display: flex;
    justify-content: center;
}

.weighing-scale {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.scale-display-box {
    background: linear-gradient(135deg, #263238 0%, #37474f 100%);
    border-radius: 10px;
    padding: 12px 35px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.lcd-screen {
    background: #1b5e20;
    padding: 15px 30px;
    border-radius: 8px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.screen-value {
    color: #00e676;
    font-size: 32px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-align: center;
    text-shadow: 0 0 10px #00e676;
    animation: digital-blink 2s ease-in-out infinite;
}

@keyframes digital-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
}

.scale-plate {
    background: linear-gradient(135deg, #90a4ae 0%, #607d8b 100%);
    width: 320px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    position: relative;
}

.rice-plate {
    position: absolute;
    top: -120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.plate-dish {
    width: 180px;
    height: 120px;
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    border-radius: 50% 50% 45% 45%;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 3px solid #e0e0e0;
    animation: plate-weight 2s ease-in-out infinite;
}

@keyframes plate-weight {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.rice-portion {
    width: 130px;
    height: 80px;
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cc 100%);
    border-radius: 50%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rice-grain {
    width: 8px;
    height: 12px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: grain-shimmer 3s ease-in-out infinite;
}

.rice-grain:nth-child(1) { animation-delay: 0s; }
.rice-grain:nth-child(2) { animation-delay: 0.3s; }
.rice-grain:nth-child(3) { animation-delay: 0.6s; }
.rice-grain:nth-child(4) { animation-delay: 0.9s; }
.rice-grain:nth-child(5) { animation-delay: 1.2s; }
.rice-grain:nth-child(6) { animation-delay: 1.5s; }
.rice-grain:nth-child(7) { animation-delay: 1.8s; }
.rice-grain:nth-child(8) { animation-delay: 2.1s; }

@keyframes grain-shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.plate-shine {
    position: absolute;
    top: 15px;
    left: 30px;
    width: 40px;
    height: 50px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 50%;
    transform: rotate(-20deg);
}

.plate-emoji {
    font-size: 40px;
}

.scale-base-unit {
    background: linear-gradient(135deg, #455a64 0%, #263238 100%);
    width: 350px;
    height: 35px;
    border-radius: 0 0 15px 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.base-display {
    color: #b0bec5;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px;
}

/* Calculation Info */
.calculation-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 15px;
    padding: 25px;
    margin: 30px 0;
    border: 3px solid #2196f3;
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.3);
}

.info-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.icon {
    font-size: 35px;
}

.title {
    font-size: 22px;
    font-weight: bold;
    color: #0d47a1;
}

.info-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 2px solid #e0e0e0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row.highlight {
    background: #fff9c4;
    border-radius: 8px;
    font-weight: bold;
    border: 2px solid #fbc02d;
}

.info-label {
    color: #555;
    font-size: 18px;
}

.info-row.highlight .info-label {
    color: #f57f17;
}

.info-value {
    color: #1976d2;
    font-size: 20px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.info-row.highlight .info-value {
    color: #e65100;
    font-size: 22px;
}

/* Answer Section */
.answer-section {
    margin: 40px 0;
}

.answer-section h3 {
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    font-size: 20px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    max-width: 600px;
    margin: 0 auto 10px auto;
}

label {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
}

.answer-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 24px;
    border: 3px solid #bdbdbd;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
    background: white;
}

.answer-input:focus {
    outline: none;
    border-color: #4caf50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.answer-input.correct {
    border-color: #4caf50;
    background: #e8f5e9;
}

.answer-input.incorrect {
    border-color: #f44336;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.validation-icon {
    font-size: 35px;
    min-width: 40px;
    text-align: center;
}

.hint-text {
    text-align: center;
    color: #666;
    font-size: 14px;
    font-style: italic;
}

/* Buttons */
.button-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px 0 20px 0;
}

button {
    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;
}

button:hover {
    background: #388e3c;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

button:active {
    transform: translateY(0);
}

.feedback {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    min-height: 30px;
    margin: 20px 0;
}

.feedback.success {
    color: #4caf50;
}

.feedback.error {
    color: #f44336;
}

.feedback.warning {
    color: #ff9800;
}

.info-box {
    background: #e8f5e9;
    border-left: 5px solid #4caf50;
    padding: 20px;
    border-radius: 10px;
    margin-top: 30px;
}

.info-box h3 {
    color: #2e7d32;
    margin-bottom: 10px;
    font-size: 18px;
}

.info-box p {
    color: #555;
    line-height: 1.8;
    margin-bottom: 10px;
}

.info-box ul {
    margin: 10px 0;
    padding-left: 25px;
}

.info-box li {
    color: #555;
    line-height: 1.8;
    margin-bottom: 8px;
}

/* Clapping Animation */
.clapping-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    display: none;
}

.clapping-animation.active {
    display: block;
}

.clap-emoji {
    position: absolute;
    font-size: 70px;
    animation: clapping 2s ease-out forwards;
    opacity: 0;
}

.clap-emoji:nth-child(1) {
    left: 10%;
    top: 20%;
    animation-delay: 0s;
}

.clap-emoji:nth-child(2) {
    left: 25%;
    top: 35%;
    animation-delay: 0.15s;
}

.clap-emoji:nth-child(3) {
    left: 45%;
    top: 15%;
    animation-delay: 0.3s;
}

.clap-emoji:nth-child(4) {
    left: 60%;
    top: 40%;
    animation-delay: 0.45s;
}

.clap-emoji:nth-child(5) {
    left: 80%;
    top: 25%;
    animation-delay: 0.6s;
}

.clap-emoji:nth-child(6) {
    left: 20%;
    top: 60%;
    animation-delay: 0.75s;
}

.clap-emoji:nth-child(7) {
    left: 40%;
    top: 70%;
    animation-delay: 0.9s;
}

.clap-emoji:nth-child(8) {
    left: 65%;
    top: 65%;
    animation-delay: 1.05s;
}

.clap-emoji:nth-child(9) {
    left: 85%;
    top: 55%;
    animation-delay: 1.2s;
}

.clap-emoji:nth-child(10) {
    left: 50%;
    top: 50%;
    animation-delay: 1.35s;
}

@keyframes clapping {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(0deg);
    }
    15% {
        opacity: 1;
        transform: scale(1.2) rotate(15deg);
    }
    30% {
        transform: scale(0.9) rotate(-10deg);
    }
    45% {
        transform: scale(1.1) rotate(10deg);
    }
    60% {
        transform: scale(1) rotate(-5deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) rotate(20deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 25px;
    }

    h1 {
        font-size: 26px;
    }

    .lunch-scene {
        padding: 30px 20px;
    }

    .scale-plate {
        width: 280px;
    }

    .scale-base-unit {
        width: 310px;
    }

    .input-wrapper {
        flex-direction: column;
        gap: 10px;
    }

    .answer-input {
        width: 100%;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .story-box {
        padding: 15px;
    }

    .story-text,
    .question {
        font-size: 14px;
    }

    .lunch-scene {
        padding: 25px 15px;
    }

    .scale-plate {
        width: 240px;
        height: 50px;
    }

    .rice-plate {
        top: -100px;
    }

    .plate-dish {
        width: 150px;
        height: 100px;
    }

    .rice-portion {
        width: 110px;
        height: 70px;
    }

    .scale-base-unit {
        width: 270px;
    }

    .answer-input {
        font-size: 18px;
        padding: 12px 15px;
    }
}
