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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 100%);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* HUD (Heads Up Display) */
.hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.title {
    font-size: 1.5rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hud-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.level-badge {
    background: white;
    color: #667eea;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
}

.lives-container {
    display: flex;
    gap: 5px;
}

.heart {
    font-size: 1.5rem;
    transition: all 0.3s;
}

.heart.lost {
    opacity: 0.3;
    transform: scale(0.8);
}

/* Game World */
.game-world {
    position: relative;
    width: 100vw;
    height: calc(100vh - 70px);
    margin-top: 70px;
    overflow: hidden;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 50%, #90EE90 100%);
}

/* Ground */
.ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(180deg, #8B7355 0%, #6B5B4C 100%);
    border-top: 3px solid #5A4A3A;
}

.ground::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: repeating-linear-gradient(
        90deg,
        #7A6A4D 0px,
        #7A6A4D 40px,
        #6B5B4C 40px,
        #6B5B4C 80px
    );
}

/* Character */
.character {
    position: absolute;
    left: 100px;
    bottom: 80px;
    width: 60px;
    height: 80px;
    transition: left 0.3s linear;
}

.character-body {
    position: relative;
    width: 100%;
    height: 100%;
}

.character-head {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 35px;
    height: 35px;
    background: #FFDBB3;
    border-radius: 50%;
}

.hair {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 20px;
    background: #FFD700;
    border-radius: 50px 50px 0 0;
}

.eye {
    position: absolute;
    top: 12px;
    width: 5px;
    height: 5px;
    background: #0066CC;
    border-radius: 50%;
    animation: blink 3s infinite;
}

@keyframes blink {
    0%, 98%, 100% { transform: scaleY(1); }
    99% { transform: scaleY(0.1); }
}

.eye.left { left: 10px; }
.eye.right { right: 10px; }

.character-torso {
    position: absolute;
    top: 32px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 35px;
    background: #4A90E2;
    border-radius: 5px;
}

.arm {
    position: absolute;
    width: 8px;
    height: 25px;
    background: #FFDBB3;
}

.arm.left {
    top: 8px;
    left: -10px;
    transform-origin: top center;
    animation: walk-arm-left 0.6s ease-in-out infinite;
}

.arm.right {
    top: 8px;
    right: -10px;
    transform-origin: top center;
    animation: walk-arm-right 0.6s ease-in-out infinite;
}

@keyframes walk-arm-left {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

@keyframes walk-arm-right {
    0%, 100% { transform: rotate(10deg); }
    50% { transform: rotate(-10deg); }
}

.leg {
    position: absolute;
    top: 35px;
    width: 8px;
    height: 25px;
    background: #2C3E50;
    border-radius: 0 0 5px 5px;
}

.leg.left {
    left: 5px;
    transform-origin: top center;
    animation: walk-leg-left 0.6s ease-in-out infinite;
}

.leg.right {
    right: 5px;
    transform-origin: top center;
    animation: walk-leg-right 0.6s ease-in-out infinite;
}

@keyframes walk-leg-left {
    0%, 100% { transform: rotate(-15deg); }
    50% { transform: rotate(15deg); }
}

@keyframes walk-leg-right {
    0%, 100% { transform: rotate(15deg); }
    50% { transform: rotate(-15deg); }
}

/* Obstacle (Stone) */
.obstacle {
    position: absolute;
    right: 50%;
    bottom: 80px;
    transform: translateX(200px);
    transition: transform 0.3s ease;
}

.stone {
    position: relative;
    width: 60px;
    height: 60px;
}

.stone-top {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 40px;
    background: #708090;
    border-radius: 50px;
    border: 3px solid #556B2F;
}

.stone-bottom {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 40px;
    background: #708090;
    border-radius: 50px;
    border: 3px solid #556B2F;
}

/* Speech Bubble */
.speech-bubble {
    position: absolute;
    right: calc(50% - 50px);
    bottom: 180px;
    transform: translateX(200px);
    background: white;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    display: none;
    animation: bubblePop 0.3s ease;
    z-index: 50;
}

@keyframes bubblePop {
    0% { transform: translateX(200px) scale(0); opacity: 0; }
    100% { transform: translateX(200px) scale(1); opacity: 1; }
}

.speech-bubble.show {
    display: block;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 15px solid white;
}

.speech-bubble p {
    margin: 0 0 10px 0;
    font-weight: bold;
    color: #333;
}

.action-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.action-btn:hover {
    transform: scale(1.05);
}

/* Task Screen Overlay */
.task-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.task-screen-overlay.show {
    display: flex;
}

.task-screen-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

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

.close-task-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f44336;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-header {
    text-align: center;
    margin-bottom: 20px;
}

.task-header h2 {
    color: #667eea;
    margin-bottom: 5px;
}

.task-info {
    color: #666;
    font-size: 0.9rem;
}

.question-display {
    text-align: center;
    margin-bottom: 30px;
}

.equation {
    font-size: 4rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.question-text {
    font-size: 1.2rem;
    color: #666;
}

/* Multiple Choice Answers */
.answers-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.answer-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 20px;
    border-radius: 15px;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.answer-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.answer-btn.selected {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    transform: scale(1.05);
}

/* Number Pad */
.number-pad-container {
    margin-bottom: 20px;
}

.number-display {
    background: #f5f5f5;
    border: 3px solid #667eea;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    font-size: 3rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.num-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.num-btn:hover {
    transform: scale(1.05);
}

.num-btn.clear {
    background: #f44336;
    grid-column: 1 / 3;
}

.num-btn.submit-num {
    background: #4CAF50;
    grid-column: 3 / 5;
}

/* Feedback Message */
.feedback-message {
    margin-top: 20px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 15px;
    border-radius: 10px;
    display: none;
}

.feedback-message.show {
    display: block;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.feedback-message.correct {
    background: #4CAF50;
    color: white;
}

.feedback-message.wrong {
    background: #f44336;
    color: white;
}

/* Level Complete Overlay */
.level-complete-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.level-complete-overlay.show {
    display: flex;
}

.level-complete-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
}

.level-complete-content .emoji {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

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

.level-complete-content h2 {
    color: #4CAF50;
    margin-bottom: 10px;
}

.level-complete-content p {
    color: #666;
}

/* Game Over Overlay */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 400;
}

.game-over-overlay.show {
    display: flex;
}

.game-over-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
}

.game-over-content .emoji {
    font-size: 5rem;
    margin-bottom: 20px;
}

.reset-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s;
}

.reset-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 1.2rem;
    }
    
    .equation {
        font-size: 3rem;
    }
    
    .answers-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .answer-btn {
        font-size: 1.5rem;
    }
    
    .number-display {
        font-size: 2.5rem;
    }
    
    .num-btn {
        padding: 15px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .answers-container {
        grid-template-columns: 1fr;
    }
    
    .equation {
        font-size: 2.5rem;
    }
}
