
/* ============= UI RESPONSIVE FIX ============= */
html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
}

body {
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* Counting container - make it full width on mobile */
.counting-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
    width: 100% !important;
    box-sizing: border-box;
}

.counting-header {
    text-align: center;
    margin-bottom: 24px;
}

.counting-header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.counting-header p {
    font-size: 1.2rem;
    color: #555;
    margin-top: 0;
}

.math-btn {
    background: linear-gradient(135deg,#667eea,#764ba2);
    color: #fff;
    border: none;
    padding: 12px 12px;
    border-radius: 18px;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.math-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}
.math-btn.active {
    background: linear-gradient(135deg,#4cb5f5,#667eea);
    box-shadow: 0 0 0 3px rgba(76, 181, 245, 0.3);
}

.counting-game-area {
    background: #fff;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    min-height: 360px;
    position: relative;
    overflow: hidden;
}

/* ============= QUESTION STYLING ============= */
.equation-display {
    text-align: center;
    font-size: 3.5rem;
    font-weight: 800;
    margin: 20px 0;
    color: #2d3748;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    padding: 10px;
    border-radius: 15px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.equation-display::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 25%;
    width: 50%;
    height: 4px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
    border-radius: 2px;
}

.question-audio-btn {
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid #667eea;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.8rem;
}

.question-audio-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.1);
}

/* ============= EMOJI DRAG FIX ============= */

.emoji {
    font-size: 2.2rem;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
    display: inline-block;
    margin: 8px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    position: relative;
    touch-action: none;
}
.emoji:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    background: rgba(255, 255, 255, 1);
}

.emoji.dragging {
    cursor: grabbing !important;
    transform: scale(1.3) rotate(8deg);
    opacity: 0.9;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    z-index: 10000;
    transition: transform 0.1s ease;
}

.emoji.dropped {
    cursor: default;
    animation: bounceIn 0.5s ease;
}

.emoji.dragging::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: red;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
/* General emoji grid */
.emoji-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
}

/* Groups look clean and compact */
.emoji-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    margin: 8px;
    background: rgba(237, 242, 247, 0.5);
}
/* basket */

.basket-area {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e0);
    border-radius: 18px;
    padding: 25px;
    margin: 25px 0;
    min-height: 140px;
    border: 3px dashed #a0aec0;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.basket-area.active {
    border-color: #4cb5f5;
    background: linear-gradient(135deg, #ebf8ff, #e6fffa);
    box-shadow: 0 4px 15px rgba(76, 181, 245, 0.3), inset 0 2px 4px rgba(0,0,0,0.05);
    transform: scale(1.02);
}

.basket-area::before {
    content: "🧺";
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

@keyframes bounceIn {
    0% { 
        transform: scale(0.3) rotate(-10deg); 
        opacity: 0; 
    }
    50% { 
        transform: scale(1.1) rotate(5deg); 
    }
    100% { 
        transform: scale(1) rotate(0deg); 
        opacity: 1; 
    }
}

/* responsive number grid */
.number-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 15px;
    margin: 25px 0;
}
.number-tile {
    background: linear-gradient(135deg,#ffd54f,#ffb300);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}
.number-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0,0,0,0.15);
}
.number {
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}
.number-name {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
    margin-top: 5px;
}

/* multiple choice */
.multiple-choice {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px,1fr));
    gap: 15px;
    margin-top: 25px;
}
.choice-btn {
    background: linear-gradient(135deg,#4ecb71,#48bb78);
    color: #fff;
    padding: 15px;
    border-radius: 15px;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.choice-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}
.choice-btn.correct {
    background: linear-gradient(135deg,#48bb78,#38a169);
    animation: pulse 0.5s;
}
.choice-btn.wrong {
    background: linear-gradient(135deg,#f56565,#e53e3e);
    animation: shake 0.5s;
}

/* Word choice buttons */
.word-choice-btn {
    background: linear-gradient(135deg,#9f7aea,#805ad5);
    color: #fff;
    padding: 15px;
    border-radius: 15px;
    border: none;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.word-choice-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}
.word-choice-btn.correct {
    background: linear-gradient(135deg,#48bb78,#38a169);
    animation: pulse 0.5s;
}
.word-choice-btn.wrong {
    background: linear-gradient(135deg,#f56565,#e53e3e);
    animation: shake 0.5s;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Score and progress styling */
.score-container {
    background: #fff;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    font-weight: 600;
    color: #4a5568;
}

.small-muted {
    font-size: 1rem;
    color: #718096;
    margin: 10px 0;
}

@media (max-width: 600px) {
    .emoji { font-size: 2.2rem; }
    .counting-game-area { padding: 18px; }
    .math-btn { padding: 10px 10px; font-size: 0.5rem; }
    .equation-display { font-size: 2.5rem; }
    .question-audio-btn { width: 50px; height: 50px; font-size: 1.5rem; }
    .word-choice-btn { font-size: 1rem; min-height: 70px; }
}
.glow-pulse {
    animation: subtractionGlowPulse 1.5s infinite ease-in-out;
    box-shadow: 0 0 20px rgba(255, 165, 0, 0.9), 0 0 30px rgba(255, 200, 0, 0.6);
    border-radius: 50%;
    transform-origin: center;
    position: relative;
    z-index: 10;
    transition: all 0.3s ease;
}

@keyframes subtractionGlowPulse {
    0% { 
        transform: scale(1.05); 
        box-shadow: 0 0 15px rgba(255, 165, 0, 0.7), 0 0 25px rgba(255, 200, 0, 0.4);
    }
    50% { 
        transform: scale(1.2); 
        box-shadow: 0 0 30px rgba(255, 165, 0, 1), 0 0 50px rgba(255, 200, 0, 0.8);
    }
    100% { 
        transform: scale(1.05); 
        box-shadow: 0 0 15px rgba(255, 165, 0, 0.7), 0 0 25px rgba(255, 200, 0, 0.4);
    }
}

/* Emoji click effect for subtraction */
.emoji-container#subtractionContainer .emoji {
    cursor: pointer !important;
    transition: all 0.3s ease;
}

.emoji-container#subtractionContainer .emoji:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 1);
}
/* Basket styling for subtraction mode */
#basketArea {
    position: relative;
    overflow: hidden;
}

#basketArea::before {
    content: "🧺";
    font-size: 2rem;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
}

/* Count button styling */
#countRemainingBtn {
    animation: gentlePulse 2s infinite;
}

@keyframes gentlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Instruction highlight for subtraction */
.subtraction-instruction {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 10px 15px;
    margin: 10px 0;
    text-align: center;
    font-weight: bold;
    color: #856404;
    box-shadow: 0 4px 6px rgba(255, 193, 7, 0.2);
}

/* Visual indicator for remaining count */
.remaining-count-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 165, 0, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1.2rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
/* Basket styling for subtraction mode */
#basketArea[style*="margin-top:8px"] {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-color: #f44336;
    min-height: 100px;
}

#basketArea[style*="margin-top:8px"]::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    opacity: 0.1;
    pointer-events: none;
}

/* Count button styling */
#countAllBtn, #countRemainingBtn {
    margin: 5px;
    padding: 12px 20px;
    border: none;
    border-radius: 15px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#countAllBtn:hover, #countRemainingBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

#countAllBtn:active, #countRemainingBtn:active {
    transform: translateY(0);
}

/* Instruction panel */
.subtraction-instruction-panel {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 2px solid #2196f3;
    border-radius: 15px;
    padding: 15px;
    margin: 15px 0;
    text-align: center;
}

.subtraction-instruction-panel h4 {
    margin: 0 0 10px 0;
    color: #1565c0;
    font-size: 1.1rem;
}

.instruction-steps {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.instruction-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.step-number {
    background: #2196f3;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.step-text {
    font-size: 0.9rem;
    color: #333;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .instruction-steps {
        flex-direction: column;
        gap: 10px;
    }
    
    .instruction-step {
        flex-direction: row;
        justify-content: flex-start;
        min-width: auto;
    }
    
    .step-text {
        text-align: left;
        margin-left: 10px;
    }
    
    #countAllBtn, #countRemainingBtn {
        display: block;
        width: 100%;
        margin: 8px 0;
    }
}
.basket-area.over-limit {
    animation: shake 0.3s ease;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.6);
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}
.instruction-btn {
    margin-top: 6px;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 8px;
    border: none;
    background: #fff3cd;
    cursor: pointer;
}

.instruction-btn:active {
    transform: scale(0.95);
}

/* Sembunyikan tombol premium dengan animasi */
#btnMul, #btnDiv {
    transition: all 0.3s ease;
}

#btnMul.hidden, #btnDiv.hidden {
    display: none;
}
 .math-btn {
        display: inline-block !important;
    }

    /* Add this to your styles */
.number-pad-container {
    display: none; /* Hidden by default (desktop) */
    margin: 10px auto;
    max-width: 250px;
}

/* Show only on mobile (touch devices) */
@media (max-width: 768px) {
    .number-pad-container {
        display: block;
    }
}

/* Also detect touch devices */
@media (hover: none) and (pointer: coarse) {
    .number-pad-container {
        display: block;
    }
}

.number-pad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    background: #f7fafc;
    padding: 12px;
    border-radius: 16px;
    border: 2px solid #e2e8f0;
}

.number-pad-btn {
    padding: 12px 8px;
    font-size: 1.3rem;
    font-weight: bold;
    border: 2px solid #cbd5e0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 50px;
    touch-action: manipulation; /* Better for mobile */
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.number-pad-btn:active {
    transform: scale(0.92);
    background: #e2e8f0;
}

.number-pad-btn.digit {
    background: white;
    color: #2d3748;
}

.number-pad-btn.digit:hover {
    background: #edf2f7;
}

.number-pad-btn.backspace {
    background: #fed7d7;
    color: #e53e3e;
}

.number-pad-btn.backspace:active {
    background: #feb2b2;
}

.number-pad-btn.clear {
    background: #fefcbf;
    color: #d69e2e;
}

.number-pad-btn.clear:active {
    background: #f6e05e;
}

.number-pad-btn.enter {
    background: #c6f6d5;
    color: #276749;
    grid-column: span 1;
}

.number-pad-btn.enter:active {
    background: #9ae6b4;
}

/* Highlight current input */
.number-pad-input-active {
    border-color: #f6ad55 !important;
    box-shadow: 0 0 15px rgba(246, 173, 85, 0.3) !important;
}