* {
    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: 900px;
    width: 100%;
    position: relative;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    font-size: 32px;
}

/* Instruction Box */
.instruction-box {
    background: linear-gradient(135deg, #e1f5fe 0%, #b3e5fc 100%);
    border-left: 5px solid #0288d1;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.instruction-header {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.icon {
    font-size: 35px;
}

.title {
    font-size: 22px;
    font-weight: bold;
    color: #01579b;
}

/* Calculator Scene */
.calculator-scene {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    border-radius: 15px;
    padding: 40px;
    margin: 30px 0;
    display: flex;
    justify-content: center;
}

.calculator {
    background: linear-gradient(135deg, #263238 0%, #37474f 100%);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    max-width: 400px;
    width: 100%;
}

.calculator-screen {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
    border-radius: 12px;
    padding: 25px 20px;
    margin-bottom: 20px;
    box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.3);
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen-content {
    width: 100%;
}

.expression-display {
    color: #c8e6c9;
    font-size: 20px;
    font-family: 'Courier New', monospace;
    text-align: center;
    margin-bottom: 15px;
    line-height: 1.6;
    text-shadow: 0 0 5px rgba(200, 230, 201, 0.5);
}

.result-display {
    color: #00e676;
    font-size: 48px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-align: center;
    text-shadow: 0 0 15px #00e676;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.calculator-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.button-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.calc-button {
    background: linear-gradient(135deg, #eceff1 0%, #cfd8dc 100%);
    color: #263238;
    border-radius: 10px;
    padding: 20px;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.calc-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.3);
}

.calc-button.operator {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

/* Operation Breakdown */
.operation-breakdown {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 15px;
    padding: 25px;
    margin: 30px 0;
    border: 3px solid #ff9800;
}

.breakdown-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.breakdown-header .title {
    color: #e65100;
}

.breakdown-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
}

.breakdown-step {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fafafa;
    border-radius: 8px;
    border-left: 4px solid #ff9800;
}

.breakdown-step:last-child {
    margin-bottom: 0;
}

.step-number {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.step-text {
    color: #555;
    font-size: 16px;
    font-weight: 500;
}

/* Answer Section */
.answer-section {
    margin: 40px 0;
}

.answer-section h3 {
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    font-size: 20px;
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8edf2 100%);
    border: 3px solid #bdbdbd;
    border-radius: 15px;
    padding: 20px 25px;
    width: 100%;
    max-width: 450px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.answer-input {
    flex: 1;
    font-size: 28px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    border: none;
    background: transparent;
    color: #333;
    outline: none;
    text-align: center;
}

.answer-input::placeholder {
    color: #bdbdbd;
    font-weight: normal;
}

.input-unit {
    color: #667eea;
    font-size: 18px;
    font-weight: bold;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.submit-btn:active {
    transform: translateY(-1px);
}

/* 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);
}

/* Info Box */
.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 p:last-child {
    margin-bottom: 0;
}

/* 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;
    }

    .calculator {
        padding: 20px;
    }

    .expression-display {
        font-size: 16px;
    }

    .result-display {
        font-size: 38px;
    }

    .calc-button {
        padding: 15px;
        font-size: 18px;
    }

    .answer-input {
        font-size: 24px;
    }

    .input-wrapper {
        padding: 15px 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 22px;
    }

    .calculator-scene {
        padding: 20px;
    }

    .expression-display {
        font-size: 14px;
    }

    .result-display {
        font-size: 32px;
    }

    .calc-button {
        padding: 12px;
        font-size: 16px;
    }

    .button-row {
        gap: 8px;
    }

    .answer-input {
        font-size: 20px;
    }

    .submit-btn {
        padding: 15px 35px;
        font-size: 16px;
    }
}
