
/* ==========================================
   FONT FACE
   ========================================== */
@font-face {
    font-family: 'Sniglet';
    src: url('fonts/Sniglet-Regular.woff2') format('woff2'),
         url('fonts/Sniglet-Regular.woff') format('woff'),
         url('fonts/Sniglet-Regular.ttf') format('truetype');
    font-display: swap;
    font-weight: normal;
    font-style: normal;
}

/* ==========================================
   RESET & BASE STYLES
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    font-family: 'Sniglet', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    position: relative;
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.fade-out {
    animation: fadeOut 0.5s ease-out;
}

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

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

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes glowGreen {
    0%, 100% { box-shadow: 0 0 5px #4ade80, 0 0 10px #4ade80, 0 0 15px #4ade80; }
    50% { box-shadow: 0 0 10px #4ade80, 0 0 20px #4ade80, 0 0 30px #4ade80; }
}

@keyframes glowRed {
    0%, 100% { box-shadow: 0 0 5px #ef4444, 0 0 10px #ef4444, 0 0 15px #ef4444; }
    50% { box-shadow: 0 0 10px #ef4444, 0 0 20px #ef4444, 0 0 30px #ef4444; }
}

@keyframes glowBlue {
    0%, 100% { box-shadow: 0 0 8px #667eea, 0 0 15px #667eea; }
    50% { box-shadow: 0 0 15px #667eea, 0 0 25px #667eea; }
}

/* ==========================================
   LOADING SCREEN
   ========================================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #ff6b9d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 20px;
    font-size: 1.5rem;
    color: #333;
    font-weight: bold;
}

.loading-progress {
    width: 80%;
    max-width: 300px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff6b9d, #c471f5);
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* ==========================================
   SPLASH SCREEN
   ========================================== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow-y: auto;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.8s ease-in;
}

.splash-logo {
    width: 300px;
    height: 300px;
    border-radius: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
    animation: bounce 2s infinite;
    object-fit: cover;
}

.splash-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 320px;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    font-family: 'Sniglet', cursive;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-weight: bold;
    text-transform: uppercase;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(-1px);
}

.btn.active {
    border: 4px solid #fff;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.8), 0 6px 20px rgba(0, 0, 0, 0.3);
    animation: glowBlue 1.5s ease-in-out infinite;
    transform: scale(1.05);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-learn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-level1 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-level2 {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.btn-level3 {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #333;
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* ==========================================
   GAME SCREEN
   ========================================== */
.game-screen {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    display: flex;
    flex-direction: column;
}

/* Top Navigation */
.top-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    justify-content: center;
    align-items: center;
}

.nav-btn {
    padding: 10px 15px;
    font-size: 1rem;
    font-family: 'Sniglet', cursive;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    font-weight: bold;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.nav-btn:active {
    transform: translateY(0);
}

/* Game Content */
.game-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ==========================================
   LEARN MODE
   ========================================== */
.learn-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 100%;
    animation: fadeIn 0.5s ease-in;
}

.learn-title {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2rem;
}

.learn-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.division-display {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 300px;
    justify-content: center;
}

/* ==========================================
   LONG DIVISION LAYOUT - BOX GRID SYSTEM
   ========================================== */
.long-division {
    position: relative;
    display: inline-block;
    padding: 30px 20px;
    font-family: 'Sniglet', cursive;
}

/* Main flex container: divisor on left, grid on right */
.division-bracket {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

/* Divisor box (left side, outside bracket) */
.divisor-box {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #764ba2;
    border-radius: 10px;
    font-size: 2rem;
    font-weight: bold;
    background: #faf5ff;
    color: #764ba2;
    margin-top: 80px;
    flex-shrink: 0;
}

/* Right side: CSS Grid for all digit boxes */
.division-grid {
    display: grid;
    gap: 8px;
    position: relative;
}

/* L-shaped bracket (top and left borders) */
.bracket-top {
    position: absolute;
    top: 58px;  /* Move up slightly from 60px */
    left: -5px; /* Move left slightly from 0 */
    right: 0;
    height: 4px;
    background: #333;
    z-index: 1;
}

.bracket-left {
    position: absolute;
    top: 58px;  /* Match the top bracket */
    left: -5px; /* Move left slightly from 0 */
    width: 4px;
    height: 80px;
    background: #333;
    z-index: 1;
}

/* Individual digit box - base style */
.digit-box {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid;
    border-radius: 10px;
    font-size: 2rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

/* Display boxes (dividend, results) */
.digit-display {
    border-color: #667eea;
    background: #f0f9ff;
    color: #667eea;
}

/* Input boxes (quotient) */
.digit-input {
    border-color: #0284c7;
    background: white;
    color: #0284c7;
    text-align: center;
    font-family: 'Sniglet', cursive;
}

.digit-input:focus {
    outline: none;
    border-color: #0369a1;
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.5);
}

.digit-input.correct {
    background: #4ade80;
    color: white;
    border-color: #22c55e;
    animation: glowGreen 1s ease-in-out;
}

.digit-input.incorrect {
    background: #ef4444;
    color: white;
    border-color: #dc2626;
    animation: glowRed 0.5s ease-in-out;
}

/* Remainder input box */
.digit-remainder {
    border-color: #ea580c;
    background: white;
    color: #ea580c;
    text-align: center;
    font-family: 'Sniglet', cursive;
}

.digit-remainder:focus {
    outline: none;
    border-color: #c2410c;
    box-shadow: 0 0 10px rgba(234, 88, 12, 0.5);
}

.digit-remainder.correct {
    background: #4ade80;
    color: white;
    border-color: #22c55e;
    animation: glowGreen 1s ease-in-out;
}

.digit-remainder.incorrect {
    background: #ef4444;
    color: white;
    border-color: #dc2626;
    animation: glowRed 0.5s ease-in-out;
}

/* Empty space (no box) */
.empty-space {
    width: 60px;
    height: 60px;
}

/* Minus sign (outside box) */
.minus-sign {
    width: 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
}

/* Horizontal line (subtraction line) */
.horizontal-line {
    height: 3px;
    background: #666;
    margin: 5px 0;
}

/* Tooltips */
.tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
    margin-bottom: 10px;
}

.divisor-box:hover .tooltip,
.digit-box:hover .tooltip {
    opacity: 1;
}

.hint-box {
    background: #fef3c7;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    text-align: center;
}

.hint-box p {
    color: #92400e;
    margin: 0;
    font-size: 1rem;
}

/* Success overlay for final answer */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    animation: fadeIn 0.3s ease-in;
}

.final-answer-box {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 40px 60px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: bounce 0.5s ease-in-out;
}

.final-answer-box h3 {
    color: #22c55e;
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.final-answer {
    font-size: 2rem;
    color: #333;
    margin: 15px 0;
}

.final-answer strong {
    color: #667eea;
    font-size: 2.5rem;
}

.alternative {
    font-size: 1.5rem;
    color: #666;
    margin-top: 10px;
}

/* Proper fraction with horizontal line */
.fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 5px;
    font-size: 1.3rem;
}

.frac-num {
    display: block;
    text-align: center;
    padding-bottom: 2px;
    color: #667eea;
    font-weight: bold;
}

.frac-line {
    display: block;
    width: 100%;
    min-width: 30px;
    height: 2px;
    background: #333;
    margin: 2px 0;
}

.frac-den {
    display: block;
    text-align: center;
    padding-top: 2px;
    color: #667eea;
    font-weight: bold;
}

/* Interactive Division (for level play) */
.interactive-division {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.division-row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

/* ==========================================
   LEVEL MODE
   ========================================== */
.level-setup {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.5s ease-in;
}

.level-title {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2rem;
}

.setup-section {
    margin: 30px 0;
}

.setup-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.question-buttons, .remainder-toggle {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.question-select, .remainder-select {
    position: relative;
}

.level-play {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 900px;
    width: 100%;
    animation: fadeIn 0.5s ease-in;
}

.level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.level-info {
    font-size: 1.2rem;
    color: #667eea;
    font-weight: bold;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 30px;
    background: rgba(200, 200, 200, 0.3);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 30px;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
    border-radius: 15px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Division Problem for Interactive Mode */
.division-problem {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 400px;
}

.submit-answer-btn {
    margin-top: 20px;
}

/* ==========================================
   MODALS
   ========================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease-in;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    color: #667eea;
    font-size: 1.8rem;
}

.close-btn {
    background: #ef4444;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: #dc2626;
    transform: rotate(90deg);
}

.modal-body {
    color: #333;
}

/* Rules Modal */
.rules-modal {
    max-height: calc(100vh - 50px);
}

.rules-body {
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}


.rules-content h3 {
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 10px;
}

.rules-content p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.rules-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.rules-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* Confirmation Modal */
.confirm-modal {
    text-align: center;
    max-width: 400px;
}

.confirm-modal h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.confirm-modal p {
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Achievement Modal */
.achievement-modal {
    text-align: center;
    max-width: 400px;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.achievement-img {
    width: 200px;
    height: 200px;
    border-radius: 20px;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out;
    object-fit: cover;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.achievement-text {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

/* Bring-down arrow animation (Learn mode only) */
.arrow-box {
    width: 60px;
    height: 60px;
    border: none !important;
    background: transparent !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #ef4444;
    animation: bounce-arrow 1.5s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
    position: relative;
}

/* Bring-down arrow animation (Learn mode only) */
.arrow-box {
    width: 60px;
    height: 60px;
    border: none !important;
    background: transparent !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #ef4444;
    animation: bounce-arrow 1.5s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
    position: relative;
    pointer-events: none; /* Allows clicking through if needed */
}

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

/* Mobile adjustment */
@media (max-width: 480px) {
    .arrow-box {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

/* Tablets */
@media (max-width: 768px) {
    .splash-logo {
        width: 250px;
        height: 250px;
    }

    .btn {
        padding: 12px 25px;
        font-size: 1.1rem;
    }

    .learn-title, .level-title {
        font-size: 1.6rem;
    }

    .divisor-box, .digit-box {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
    }

    .empty-space {
        width: 50px;
        height: 50px;
    }

    .minus-sign {
        width: 18px;
        height: 50px;
        font-size: 1.8rem;
    }

    .top-nav {
        gap: 6px;
        padding: 10px;
    }

    .nav-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .final-answer-box {
        padding: 30px 40px;
    }

    .final-answer-box h3 {
        font-size: 2rem;
    }

    .final-answer {
        font-size: 1.8rem;
    }

    .final-answer strong {
        font-size: 2rem;
    }

    .alternative {
        font-size: 1.3rem;
    }

    .fraction {
        font-size: 1.1rem;
    }
}

/* Mobile Phones (Portrait) */
@media (max-width: 480px) {
    .splash-logo {
        width: 200px;
        height: 200px;
    }

    .splash-buttons {
        max-width: 280px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 1rem;
    }

    .learn-container, .level-setup, .level-play {
        padding: 20px;
    }

    .learn-title, .level-title {
        font-size: 1.4rem;
    }

    /* BOX SIZES - Keep only this one (removed duplicate below) */
 .divisor-box {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
        margin-top: 55px; /* Reduced from 80px to align with bracket */
    }
    
    .digit-box {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }

    .empty-space {
        width: 45px;
        height: 45px;
    }

    /* MINUS SIGN - Keep the tighter one (12px, not 15px) */
    .minus-sign {
        width: 12px;
        height: 45px;
        font-size: 1.5rem;
    }

    .top-nav {
        gap: 5px;
        padding: 8px;
    }

    .nav-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .modal-content {
        padding: 20px;
    }

    .modal-header h2 {
        font-size: 1.4rem;
    }

    .achievement-img {
        width: 150px;
        height: 150px;
    }

    .achievement-text {
        font-size: 1.4rem;
    }

    .rules-modal {
        margin-top: 25px;
    }

    .tooltip {
        font-size: 0.75rem;
        padding: 8px 12px;
    }

    .game-content {
        padding: 15px;
    }

    .loading-text {
        font-size: 1.2rem;
    }

    .loader {
        width: 50px;
        height: 50px;
    }

    /* DIVISION LAYOUT - Keep the tighter spacing */
    .long-division {
        padding: 15px 5px;
    }

    .division-bracket {
        gap: 8px;
    }

    .division-grid {
        gap: 4px !important;
    }

    .division-problem {
        padding: 20px 10px;
        min-height: 350px;
    }

    .final-answer-box {
        padding: 25px 30px;
    }

    .final-answer-box h3 {
        font-size: 1.8rem;
    }

    .final-answer {
        font-size: 1.5rem;
    }

    .final-answer strong {
        font-size: 1.8rem;
    }

    .alternative {
        font-size: 1.2rem;
    }

    .fraction {
        font-size: 1rem;
    }

    .frac-line {
        min-width: 25px;
    }

   .bracket-top {
        top: 46px;  /* Adjusted for smaller boxes */
        left: -3px; /* Less offset on mobile */
    }

    .bracket-left {
        top: 48px;  /* Match top bracket */
        left: -3px; /* Less offset on mobile */
        height: 60px; /* Adjusted for smaller layout */
    }

    /* BUTTONS SIDE-BY-SIDE */
  .button-container {
   display: flex;
    gap: 4%;
    justify-content: center;
    margin-top: 5px;  /* Changed from 10px to 5px */
}

.submit-answer-btn {
    margin-top: 0 !important;
    padding: 10px 15px;
    font-size: 0.9rem;
    width: 48%;
    flex-shrink: 0;
}

#checkAnswerBtn {
    margin-right: 0;
}

#generateNewBtn {
    margin-left: 0;
}
    
    .hint-box {
        margin-top: 10px !important;
        margin-bottom: 5px !important;
        padding: 10px;
    }
}


/* Extra Small Devices */
@media (max-width: 360px) {
    .splash-logo {
        width: 180px;
        height: 180px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .nav-btn {
        padding: 5px 8px;
        font-size: 0.75rem;
    }
    .divisor-box {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
        margin-top: 50px; /* Reduced from 80px for smaller screens */
    }
    
    .digit-box {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }

    .empty-space {
        width: 40px;
        height: 40px;
    }

    .minus-sign {
        width: 12px;
        height: 40px;
        font-size: 1.3rem;
    }
}

/* Landscape Mode for Small Devices */
@media (max-height: 500px) and (orientation: landscape) {
    .splash-logo {
        width: 150px;
        height: 150px;
        margin-bottom: 15px;
    }

    .splash-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        max-width: 100%;
    }

    .modal-content {
        max-height: 85vh;
    }

    .rules-body {
        max-height: 60vh;
    }

    .division-problem {
        min-height: 250px;
    }
}

/* Make tooltips work on touch devices */
@media (hover: none) and (pointer: coarse) {
    /* This targets touch devices only */
    
    .digit-box,
    .divisor-box {
        cursor: pointer;
    }
    
    /* Show tooltip when box has 'active' class */
    .digit-box.show-tooltip .tooltip,
    .divisor-box.show-tooltip .tooltip {
        opacity: 1;
        pointer-events: auto;
    }
    
    /* Make tooltip stay visible longer */
    .tooltip {
        transition: opacity 0.3s ease;
    }
}

/* Highlight simplified fraction */
.fraction.simplified {
    color: #10b981; /* Green to show it's the final simplified form */
    font-weight: bold;
}