* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 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: 1000px;
    width: 100%;
    position: relative;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    font-size: 32px;
}

.story-box {
    background: linear-gradient(135deg, #e1f5fe 0%, #b3e5fc 100%);
    border-left: 5px solid #0288d1;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.character-intro {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.avatar {
    font-size: 50px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.intro-text strong {
    color: #01579b;
    font-size: 20px;
    display: block;
}

.intro-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: #0277bd;
    font-size: 18px;
    font-family: 'Courier New', monospace;
}

.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;
}

/* Calculator Scene */
.calculator-scene {
    display: flex;
    justify-content: center;
    margin: 40px 0;
    padding: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
}

.calculator-device {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    max-width: 320px;
    width: 100%;
}

.calc-brand {
    color: #ecf0f1;
    font-weight: bold;
    font-size: 18px;
    text-align: center;
    margin-bottom: 10px;
    letter-spacing: 3px;
}

.calc-solar-panel {
    display: flex;
    gap: 3px;
    margin-bottom: 15px;
    background: #1a1a2e;
    padding: 8px;
    border-radius: 5px;
}

.solar-cell {
    flex: 1;
    height: 20px;
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    border-radius: 2px;
}

.calc-main-screen {
    background: #9acd32;
    border-radius: 8px;
    padding: 5px;
    margin-bottom: 15px;
    box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.3);
}

.screen-display {
    background: #b8d96f;
    padding: 15px;
    border-radius: 5px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.input-line {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    color: #2c3e50;
    font-weight: bold;
    text-align: right;
}

.result-line {
    font-family: 'Courier New', monospace;
    font-size: 22px;
    color: #1a1a2e;
    font-weight: bold;
    text-align: right;
    margin: 8px 0;
    animation: blink-cursor 1.5s ease-in-out infinite;
}

@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.recurring-indicator {
    font-size: 12px;
    color: #e74c3c;
    font-weight: bold;
    text-align: right;
    animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.calc-keypad {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.key-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.key-row:last-child {
    grid-template-columns: 2fr 1fr 1fr;
}

.key {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    cursor: default;
    user-select: none;
}

.key.function {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.key.operator {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
}

.key.equals {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

/* Problem Card */
.problem-card {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 15px;
    padding: 25px;
    margin: 30px 0;
    border: 3px solid #ff9800;
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.3);
}

.card-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: #e65100;
}

.problem-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
}

.problem-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 2px solid #e0e0e0;
}

.problem-row:last-child {
    border-bottom: none;
}

.problem-row.highlight {
    background: #fff9c4;
    border-radius: 8px;
    border: 2px solid #fbc02d;
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
}

.label {
    color: #555;
    font-size: 18px;
    font-weight: 500;
}

.problem-row.highlight .label {
    color: #f57f17;
    font-weight: bold;
}

.value {
    color: #1976d2;
    font-size: 20px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.drop-zone {
    background: white;
    border: 3px dashed #ff9800;
    border-radius: 12px;
    padding: 25px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.drop-zone.drag-over {
    background: #fff3e0;
    border-color: #f57c00;
    border-style: solid;
    transform: scale(1.02);
}

.drop-zone.has-answer {
    border-style: solid;
    border-color: #4caf50;
}

.drop-zone.correct {
    background: #e8f5e9;
    border-color: #4caf50;
    animation: correct-drop 0.5s ease;
}

.drop-zone.incorrect {
    animation: shake-drop 0.5s ease;
}

@keyframes correct-drop {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shake-drop {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.drop-placeholder {
    color: #999;
    font-size: 16px;
    font-weight: bold;
    pointer-events: none;
}

.drop-zone.has-answer .drop-placeholder {
    display: none;
}

/* Options Section */
.options-section {
    margin: 40px 0;
}

.options-section h3 {
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    font-size: 20px;
}

.fractions-pool {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.fraction-tile {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    border: 3px solid #00bcd4;
    border-radius: 12px;
    padding: 20px 30px;
    cursor: move;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(132, 250, 176, 0.4);
    user-select: none;
}

.fraction-tile:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 6px 20px rgba(132, 250, 176, 0.6);
}

.fraction-tile.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.fraction-tile.correct {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    border-color: #388e3c;
    cursor: default;
    pointer-events: none;
}

.fraction-display {
    font-size: 26px;
    font-weight: bold;
    color: #01579b;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
    font-family: 'Courier New', monospace;
}

.fraction-tile.correct .fraction-display {
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* 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;
}

/* 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-device {
        transform: scale(0.9);
    }

    .fractions-pool {
        gap: 15px;
    }

    .fraction-tile {
        padding: 18px 25px;
    }

    .fraction-display {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .story-box {
        padding: 15px;
    }

    .story-text,
    .question {
        font-size: 14px;
    }

    .calculator-device {
        transform: scale(0.75);
    }

    .problem-row {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .fraction-tile {
        padding: 15px 20px;
    }

    .fraction-display {
        font-size: 20px;
    }
}
