:root {
            --primary: #FF6B9D;
            --secondary: #7C4DFF;
            --accent: #00E5FF;
            --success: #69F0AE;
            --warning: #FFD93D;
            --background: #FFF5F8;
            --card: #FFFFFF;
            --text: #2D1B4E;
            --text-light: #7B6B8D;
        }

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

        body {
            font-family: 'Nunito', sans-serif;
            background: var(--background);
            min-height: 100vh;
            overflow-x: hidden;
        }

        /* Animated background */
        .bg-shapes {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 0;
            overflow: hidden;
        }

        .shape {
            position: absolute;
            border-radius: 50%;
            opacity: 0.1;
            animation: float 20s infinite ease-in-out;
        }

        .shape:nth-child(1) {
            width: 300px;
            height: 300px;
            background: var(--primary);
            top: -100px;
            left: -100px;
            animation-delay: 0s;
        }

        .shape:nth-child(2) {
            width: 200px;
            height: 200px;
            background: var(--secondary);
            top: 50%;
            right: -50px;
            animation-delay: -5s;
        }

        .shape:nth-child(3) {
            width: 250px;
            height: 250px;
            background: var(--accent);
            bottom: -100px;
            left: 30%;
            animation-delay: -10s;
        }

        .shape:nth-child(4) {
            width: 180px;
            height: 180px;
            background: var(--warning);
            top: 20%;
            left: 60%;
            animation-delay: -15s;
        }

        @keyframes float {
            0%, 100% { transform: translate(0, 0) rotate(0deg); }
            25% { transform: translate(30px, 30px) rotate(5deg); }
            50% { transform: translate(0, 50px) rotate(-5deg); }
            75% { transform: translate(-30px, 30px) rotate(3deg); }
        }

        /* Main container */
        .container {
            position: relative;
            z-index: 1;
            max-width: 900px;
            margin: 0 auto;
            padding: 20px;
        }

        /* Header */
        .header {
            text-align: center;
            padding: 30px 0 20px;
        }

        .header h1 {
            font-family: 'Fredoka', sans-serif;
            font-size: 2.8rem;
            font-weight: 700;
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 10px;
            animation: titlePop 0.6s ease-out;
        }

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

        .header p {
            color: var(--text-light);
            font-size: 1.1rem;
        }

        /* Tablet time counter */
        .tablet-counter {
            background: linear-gradient(135deg, var(--secondary), #9C7CFF);
            border-radius: 20px;
            padding: 20px 30px;
            margin: 20px 0;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 15px;
            box-shadow: 0 10px 40px rgba(124, 77, 255, 0.3);
            animation: slideIn 0.5s ease-out 0.2s backwards;
        }

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

        .tablet-icon {
            font-size: 2.5rem;
            animation: bounce 2s infinite;
        }

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

        .tablet-info {
            text-align: left;
        }

        .tablet-label {
            color: rgba(255, 255, 255, 0.8);
            font-size: 0.9rem;
            font-weight: 600;
        }

        .tablet-time {
            font-family: 'Fredoka', sans-serif;
            font-size: 2rem;
            font-weight: 700;
            color: white;
        }

        .time-added {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-family: 'Fredoka', sans-serif;
            font-size: 3rem;
            font-weight: 700;
            color: var(--success);
            text-shadow: 0 4px 20px rgba(105, 240, 174, 0.5);
            animation: timePopUp 1s ease-out forwards;
            pointer-events: none;
            z-index: 100;
        }

        @keyframes timePopUp {
            0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
            30% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
            100% { transform: translate(-50%, -100%) scale(1); opacity: 0; }
        }

        /* Start screen */
        .start-screen {
            text-align: center;
            padding: 40px 20px;
            animation: fadeIn 0.5s ease-out;
        }

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

        .mascot {
            font-size: 8rem;
            margin-bottom: 20px;
            animation: mascotWave 2s infinite;
        }

        @keyframes mascotWave {
            0%, 100% { transform: rotate(-5deg); }
            50% { transform: rotate(5deg); }
        }

        .start-screen h2 {
            font-family: 'Fredoka', sans-serif;
            font-size: 1.8rem;
            color: var(--text);
            margin-bottom: 15px;
        }

        .start-screen p {
            color: var(--text-light);
            font-size: 1.1rem;
            margin-bottom: 30px;
            line-height: 1.6;
        }

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

        .difficulty-btn {
            padding: 15px 25px;
            border: 3px solid transparent;
            border-radius: 15px;
            font-family: 'Fredoka', sans-serif;
            font-size: 1.1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            background: var(--card);
            color: var(--text);
            box-shadow: 0 4px 15px rgba(0,0,0,0.08);
        }

        .difficulty-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(0,0,0,0.12);
        }

        .difficulty-btn.selected {
            border-color: var(--primary);
            background: linear-gradient(135deg, #FFF0F5, #FFF);
        }

        .difficulty-btn span {
            display: block;
            font-size: 0.85rem;
            color: var(--text-light);
            font-weight: 400;
            margin-top: 5px;
        }

        .start-btn {
            background: linear-gradient(135deg, var(--primary), #FF8FB1);
            color: white;
            border: none;
            padding: 18px 50px;
            font-family: 'Fredoka', sans-serif;
            font-size: 1.4rem;
            font-weight: 600;
            border-radius: 50px;
            cursor: pointer;
            box-shadow: 0 8px 30px rgba(255, 107, 157, 0.4);
            transition: all 0.3s ease;
        }

        .start-btn:hover {
            transform: translateY(-3px) scale(1.02);
            box-shadow: 0 12px 40px rgba(255, 107, 157, 0.5);
        }

        .start-btn:active {
            transform: translateY(0) scale(0.98);
        }

        /* Quiz screen */
        .quiz-screen {
            display: none;
            animation: fadeIn 0.5s ease-out;
        }

        .progress-bar {
            background: rgba(124, 77, 255, 0.1);
            border-radius: 20px;
            height: 20px;
            margin-bottom: 25px;
            overflow: hidden;
            position: relative;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--secondary), var(--accent));
            border-radius: 20px;
            transition: width 0.5s ease;
            position: relative;
        }

        .progress-fill::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
            animation: shimmer 2s infinite;
        }

        @keyframes shimmer {
            0% { transform: translateX(-100%); }
            100% { transform: translateX(100%); }
        }

        .progress-text {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-weight: 700;
            font-size: 0.75rem;
            color: var(--text);
        }

        .stats-row {
            display: flex;
            justify-content: center;
            gap: 30px;
            margin-bottom: 25px;
        }

        .stat {
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 600;
            color: var(--text);
        }

        .stat-icon {
            font-size: 1.3rem;
        }

        .question-card {
            background: var(--card);
            border-radius: 25px;
            padding: 35px;
            box-shadow: 0 10px 50px rgba(0,0,0,0.08);
            margin-bottom: 25px;
        }

        .question-number {
            font-family: 'Fredoka', sans-serif;
            font-size: 0.9rem;
            color: var(--primary);
            font-weight: 600;
            margin-bottom: 15px;
        }

        .question-text {
            font-family: 'Fredoka', sans-serif;
            font-size: 1.5rem;
            color: var(--text);
            margin-bottom: 25px;
            line-height: 1.4;
        }

        .fraction-display {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 20px;
            margin: 30px 0;
            flex-wrap: wrap;
        }

        .fraction {
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            background: linear-gradient(135deg, #F8F0FF, #FFF0F5);
            padding: 15px 25px;
            border-radius: 15px;
            min-width: 80px;
        }

        .fraction-num, .fraction-den {
            font-family: 'Fredoka', sans-serif;
            font-size: 2rem;
            font-weight: 700;
            color: var(--secondary);
        }

        .fraction-line {
            width: 100%;
            height: 4px;
            background: var(--secondary);
            border-radius: 2px;
            margin: 5px 0;
        }

        .operator {
            font-family: 'Fredoka', sans-serif;
            font-size: 2rem;
            color: var(--primary);
            font-weight: 700;
        }

        .answers-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
        }

        .answer-btn {
            background: var(--card);
            border: 3px solid #E8E0F0;
            border-radius: 15px;
            padding: 20px;
            font-family: 'Fredoka', sans-serif;
            font-size: 1.3rem;
            font-weight: 600;
            color: var(--text);
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .answer-btn:hover:not(:disabled) {
            border-color: var(--secondary);
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(124, 77, 255, 0.15);
        }

        .answer-btn.correct {
            background: linear-gradient(135deg, var(--success), #98FFCC);
            border-color: var(--success);
            color: #1B5E20;
            animation: correctPulse 0.5s ease;
        }

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

        .answer-btn.wrong {
            background: linear-gradient(135deg, #FF8A80, #FFAB91);
            border-color: #FF5252;
            color: #B71C1C;
            animation: shake 0.5s ease;
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            20%, 60% { transform: translateX(-5px); }
            40%, 80% { transform: translateX(5px); }
        }

        .answer-btn:disabled {
            cursor: not-allowed;
        }

        /* Explanation panel */
        .explanation-panel {
            display: none;
            background: linear-gradient(135deg, #FFF8E1, #FFFDE7);
            border: 3px solid var(--warning);
            border-radius: 20px;
            padding: 25px;
            margin-top: 20px;
            animation: slideUp 0.4s ease-out;
        }

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

        .explanation-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 15px;
        }

        .explanation-icon {
            font-size: 1.8rem;
        }

        .explanation-title {
            font-family: 'Fredoka', sans-serif;
            font-size: 1.2rem;
            font-weight: 600;
            color: #F57F17;
        }

        .explanation-text {
            color: #5D4037;
            line-height: 1.7;
            font-size: 1rem;
        }

        .explanation-text strong {
            color: var(--secondary);
        }

        .next-btn {
            display: none;
            margin: 25px auto 0;
            background: linear-gradient(135deg, var(--secondary), #9C7CFF);
            color: white;
            border: none;
            padding: 15px 40px;
            font-family: 'Fredoka', sans-serif;
            font-size: 1.2rem;
            font-weight: 600;
            border-radius: 50px;
            cursor: pointer;
            box-shadow: 0 8px 30px rgba(124, 77, 255, 0.4);
            transition: all 0.3s ease;
        }

        .next-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 12px 40px rgba(124, 77, 255, 0.5);
        }

        /* Results screen */
        .results-screen {
            display: none;
            text-align: center;
            padding: 40px 20px;
            animation: fadeIn 0.5s ease-out;
        }

        .results-emoji {
            font-size: 6rem;
            margin-bottom: 20px;
            animation: resultsBounce 1s ease infinite;
        }

        @keyframes resultsBounce {
            0%, 100% { transform: translateY(0) rotate(-5deg); }
            50% { transform: translateY(-15px) rotate(5deg); }
        }

        .results-title {
            font-family: 'Fredoka', sans-serif;
            font-size: 2rem;
            color: var(--text);
            margin-bottom: 10px;
        }

        .results-score {
            font-family: 'Fredoka', sans-serif;
            font-size: 3rem;
            font-weight: 700;
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 20px;
        }

        .results-stats {
            display: flex;
            justify-content: center;
            gap: 40px;
            margin: 30px 0;
            flex-wrap: wrap;
        }

        .result-stat {
            text-align: center;
        }

        .result-stat-value {
            font-family: 'Fredoka', sans-serif;
            font-size: 2.5rem;
            font-weight: 700;
        }

        .result-stat-value.correct-color { color: var(--success); }
        .result-stat-value.wrong-color { color: #FF5252; }
        .result-stat-value.time-color { color: var(--secondary); }

        .result-stat-label {
            color: var(--text-light);
            font-size: 0.9rem;
            margin-top: 5px;
        }

        .time-earned-box {
            background: linear-gradient(135deg, var(--secondary), #9C7CFF);
            border-radius: 20px;
            padding: 25px 40px;
            display: inline-block;
            margin: 20px 0 30px;
            box-shadow: 0 10px 40px rgba(124, 77, 255, 0.3);
        }

        /* Badges */
        .badges-section {
            margin: 30px 0;
        }

        .badges-title {
            font-family: 'Fredoka', sans-serif;
            font-size: 1.3rem;
            color: var(--text);
            margin-bottom: 20px;
        }

        .badges-grid {
            display: flex;
            justify-content: center;
            gap: 15px;
            flex-wrap: wrap;
        }

        .badge {
            width: 90px;
            height: 110px;
            background: var(--card);
            border-radius: 15px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 15px rgba(0,0,0,0.08);
            position: relative;
            transition: all 0.3s ease;
        }

        .badge.locked {
            opacity: 0.4;
            filter: grayscale(100%);
        }

        .badge.unlocked {
            animation: badgeUnlock 0.6s ease-out;
        }

        @keyframes badgeUnlock {
            0% { transform: scale(0.5) rotate(-10deg); opacity: 0; }
            50% { transform: scale(1.2) rotate(5deg); }
            100% { transform: scale(1) rotate(0); opacity: 1; }
        }

        .badge-icon {
            font-size: 2.5rem;
            margin-bottom: 5px;
        }

        .badge-label {
            font-family: 'Fredoka', sans-serif;
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text);
        }

        .badge-percent {
            font-size: 0.75rem;
            color: var(--text-light);
        }

        .badge.unlocked.bronze { 
            background: linear-gradient(135deg, #FFCCBC, #FFAB91);
            box-shadow: 0 4px 20px rgba(255, 171, 145, 0.4);
        }
        .badge.unlocked.silver { 
            background: linear-gradient(135deg, #E0E0E0, #BDBDBD);
            box-shadow: 0 4px 20px rgba(189, 189, 189, 0.4);
        }
        .badge.unlocked.gold { 
            background: linear-gradient(135deg, #FFE082, #FFD54F);
            box-shadow: 0 4px 20px rgba(255, 213, 79, 0.4);
        }
        .badge.unlocked.diamond { 
            background: linear-gradient(135deg, #B2EBF2, #80DEEA);
            box-shadow: 0 4px 20px rgba(128, 222, 234, 0.4);
        }

        .badge-new {
            position: absolute;
            top: -8px;
            right: -8px;
            background: var(--primary);
            color: white;
            font-size: 0.6rem;
            font-weight: 700;
            padding: 3px 6px;
            border-radius: 10px;
            animation: pulse 1s infinite;
        }

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

        .all-badges-section {
            background: var(--card);
            border-radius: 20px;
            padding: 25px;
            margin: 30px 0;
            box-shadow: 0 4px 20px rgba(0,0,0,0.05);
        }

        .all-badges-title {
            font-family: 'Fredoka', sans-serif;
            font-size: 1.1rem;
            color: var(--text);
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .collection-grid {
            display: flex;
            justify-content: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .collection-badge {
            width: 60px;
            height: 60px;
            background: #F5F0FA;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.8rem;
            transition: all 0.3s ease;
        }

        .collection-badge.locked {
            opacity: 0.3;
            filter: grayscale(100%);
        }

        .collection-badge.unlocked {
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        }

        .time-earned-label {
            color: rgba(255,255,255,0.8);
            font-size: 1rem;
            font-weight: 600;
        }

        .time-earned-value {
            font-family: 'Fredoka', sans-serif;
            font-size: 2.5rem;
            font-weight: 700;
            color: white;
        }

        .restart-btn {
            background: linear-gradient(135deg, var(--primary), #FF8FB1);
            color: white;
            border: none;
            padding: 18px 50px;
            font-family: 'Fredoka', sans-serif;
            font-size: 1.3rem;
            font-weight: 600;
            border-radius: 50px;
            cursor: pointer;
            box-shadow: 0 8px 30px rgba(255, 107, 157, 0.4);
            transition: all 0.3s ease;
        }

        .restart-btn:hover {
            transform: translateY(-3px) scale(1.02);
            box-shadow: 0 12px 40px rgba(255, 107, 157, 0.5);
        }

        /* Confetti */
        .confetti {
            position: fixed;
            width: 15px;
            height: 15px;
            top: -20px;
            z-index: 1000;
            animation: confettiFall linear forwards;
        }

        @keyframes confettiFall {
            to {
                transform: translateY(100vh) rotate(720deg);
                opacity: 0;
            }
        }

        /* ============================================
           RESPONSIVE DESIGN - Mobile, Tablet, Desktop
           ============================================ */

        /* Large Tablet & Small Desktop (max-width: 900px) */
        @media (max-width: 900px) {
            .container {
                max-width: 100%;
                padding: 15px;
            }
            
            .header h1 {
                font-size: 2.4rem;
            }
            
            .question-card {
                padding: 30px 25px;
            }
            
            .results-stats {
                gap: 30px;
            }
        }

        /* Tablet Portrait (max-width: 768px) */
        @media (max-width: 768px) {
            .header {
                padding: 20px 0 15px;
            }
            
            .header h1 {
                font-size: 2.2rem;
            }
            
            .header p {
                font-size: 1rem;
            }
            
            .tablet-counter {
                padding: 18px 25px;
                gap: 12px;
                border-radius: 16px;
            }
            
            .tablet-icon {
                font-size: 2.2rem;
            }
            
            .tablet-time {
                font-size: 1.8rem;
            }
            
            .mascot {
                font-size: 6rem;
            }
            
            .start-screen h2 {
                font-size: 1.6rem;
            }
            
            .start-screen p {
                font-size: 1rem;
                margin-bottom: 25px;
            }
            
            .difficulty-selector {
                gap: 12px;
            }
            
            .difficulty-btn {
                padding: 12px 20px;
                font-size: 1rem;
            }
            
            .start-btn {
                padding: 16px 40px;
                font-size: 1.3rem;
            }
            
            .question-card {
                padding: 25px 20px;
                border-radius: 20px;
            }
            
            .question-text {
                font-size: 1.3rem;
                margin-bottom: 20px;
            }
            
            .fraction-display {
                gap: 15px;
                margin: 25px 0;
            }
            
            .fraction {
                padding: 12px 20px;
            }
            
            .fraction-num, .fraction-den {
                font-size: 1.8rem;
            }
            
            .operator {
                font-size: 1.8rem;
            }
            
            .answers-grid {
                gap: 12px;
            }
            
            .answer-btn {
                padding: 18px 15px;
                font-size: 1.2rem;
            }
            
            .results-emoji {
                font-size: 5rem;
            }
            
            .results-title {
                font-size: 1.8rem;
            }
            
            .results-score {
                font-size: 2.5rem;
            }
            
            .result-stat-value {
                font-size: 2.2rem;
            }
            
            .time-earned-box {
                padding: 20px 30px;
            }
            
            .time-earned-value {
                font-size: 2rem;
            }
            
            .all-badges-section {
                padding: 20px;
            }
            
            .collection-badge {
                width: 55px;
                height: 55px;
                font-size: 1.6rem;
            }
        }

        /* Mobile Large (max-width: 600px) */
        @media (max-width: 600px) {
            .container {
                padding: 12px;
            }
            
            .header {
                padding: 15px 0 10px;
            }
            
            .header h1 {
                font-size: 1.8rem;
            }
            
            .header p {
                font-size: 0.9rem;
            }
            
            .tablet-counter {
                padding: 15px 20px;
                gap: 10px;
                margin: 15px 0;
            }
            
            .tablet-icon {
                font-size: 2rem;
            }
            
            .tablet-label {
                font-size: 0.8rem;
            }
            
            .tablet-time {
                font-size: 1.5rem;
            }
            
            .start-screen {
                padding: 25px 10px;
            }
            
            .mascot {
                font-size: 5rem;
                margin-bottom: 15px;
            }
            
            .start-screen h2 {
                font-size: 1.4rem;
                margin-bottom: 10px;
            }
            
            .start-screen p {
                font-size: 0.95rem;
                margin-bottom: 20px;
                line-height: 1.5;
            }
            
            .difficulty-selector {
                flex-direction: column;
                align-items: center;
                gap: 10px;
                margin-bottom: 25px;
            }
            
            .difficulty-btn {
                width: 100%;
                max-width: 280px;
                padding: 14px 20px;
                font-size: 1rem;
            }
            
            .difficulty-btn span {
                font-size: 0.8rem;
            }
            
            .start-btn {
                padding: 16px 35px;
                font-size: 1.2rem;
                width: 100%;
                max-width: 280px;
            }
            
            .all-badges-section {
                margin-top: 25px !important;
                padding: 18px 15px;
            }
            
            .all-badges-title {
                font-size: 1rem;
                margin-bottom: 12px;
            }
            
            .collection-grid {
                gap: 8px;
            }
            
            .collection-badge {
                width: 50px;
                height: 50px;
                font-size: 1.5rem;
                border-radius: 10px;
            }
            
            /* Quiz screen mobile */
            .progress-bar {
                height: 16px;
                margin-bottom: 18px;
            }
            
            .progress-text {
                font-size: 0.65rem;
            }
            
            .stats-row {
                gap: 20px;
                margin-bottom: 18px;
            }
            
            .stat {
                font-size: 0.9rem;
                gap: 5px;
            }
            
            .stat-icon {
                font-size: 1.1rem;
            }
            
            .question-card {
                padding: 20px 15px;
                border-radius: 18px;
                margin-bottom: 18px;
            }
            
            .question-number {
                font-size: 0.85rem;
                margin-bottom: 12px;
            }
            
            .question-text {
                font-size: 1.1rem;
                margin-bottom: 18px;
                line-height: 1.4;
            }
            
            .fraction-display {
                gap: 12px;
                margin: 20px 0;
            }
            
            .fraction {
                padding: 10px 16px;
                border-radius: 12px;
                min-width: 60px;
            }
            
            .fraction-num, .fraction-den {
                font-size: 1.5rem;
            }
            
            .fraction-line {
                height: 3px;
                margin: 4px 0;
            }
            
            .operator {
                font-size: 1.5rem;
            }
            
            .answers-grid {
                grid-template-columns: 1fr;
                gap: 10px;
            }
            
            .answer-btn {
                padding: 16px 12px;
                font-size: 1.1rem;
                border-radius: 12px;
                border-width: 2px;
            }
            
            .explanation-panel {
                padding: 18px 15px;
                border-radius: 15px;
                margin-top: 15px;
            }
            
            .explanation-header {
                margin-bottom: 12px;
            }
            
            .explanation-icon {
                font-size: 1.5rem;
            }
            
            .explanation-title {
                font-size: 1rem;
            }
            
            .explanation-text {
                font-size: 0.9rem;
                line-height: 1.6;
            }
            
            .next-btn {
                padding: 14px 30px;
                font-size: 1.1rem;
                margin-top: 20px;
            }
            
            /* Results screen mobile */
            .results-screen {
                padding: 30px 15px;
            }
            
            .results-emoji {
                font-size: 4.5rem;
                margin-bottom: 15px;
            }
            
            .results-title {
                font-size: 1.5rem;
                margin-bottom: 8px;
            }
            
            .results-score {
                font-size: 2.2rem;
                margin-bottom: 15px;
            }
            
            .results-stats {
                gap: 25px;
                margin: 20px 0;
            }
            
            .result-stat-value {
                font-size: 2rem;
            }
            
            .result-stat-label {
                font-size: 0.8rem;
            }
            
            .time-earned-box {
                padding: 18px 25px;
                border-radius: 16px;
                margin: 15px 0 25px;
            }
            
            .time-earned-label {
                font-size: 0.9rem;
            }
            
            .time-earned-value {
                font-size: 1.8rem;
            }
            
            .badges-section {
                margin: 25px 0;
            }
            
            .badges-title {
                font-size: 1.1rem;
                margin-bottom: 15px;
            }
            
            .badges-grid {
                gap: 10px;
            }
            
            .badge {
                width: 80px;
                height: 100px;
                border-radius: 12px;
            }
            
            .badge-icon {
                font-size: 2rem;
            }
            
            .badge-label {
                font-size: 0.75rem;
            }
            
            .badge-percent {
                font-size: 0.65rem;
            }
            
            .restart-btn {
                padding: 16px 40px;
                font-size: 1.2rem;
                width: 100%;
                max-width: 280px;
            }
            
            .time-added {
                font-size: 2.5rem;
            }
        }

        /* Mobile Small (max-width: 400px) */
        @media (max-width: 400px) {
            .container {
                padding: 10px;
            }
            
            .header h1 {
                font-size: 1.5rem;
            }
            
            .mascot {
                font-size: 4rem;
            }
            
            .start-screen h2 {
                font-size: 1.2rem;
            }
            
            .tablet-counter {
                flex-direction: column;
                text-align: center;
                gap: 8px;
            }
            
            .tablet-info {
                text-align: center;
            }
            
            .fraction-display {
                gap: 8px;
            }
            
            .fraction {
                padding: 8px 12px;
                min-width: 50px;
            }
            
            .fraction-num, .fraction-den {
                font-size: 1.3rem;
            }
            
            .operator {
                font-size: 1.3rem;
            }
            
            .results-stats {
                flex-direction: column;
                gap: 15px;
            }
            
            .collection-badge {
                width: 45px;
                height: 45px;
                font-size: 1.3rem;
            }
            
            .badge {
                width: 70px;
                height: 90px;
            }
            
            .badge-icon {
                font-size: 1.8rem;
            }
        }

        /* Landscape mode on mobile */
        @media (max-height: 500px) and (orientation: landscape) {
            .mascot {
                font-size: 3rem;
                margin-bottom: 10px;
            }
            
            .start-screen {
                padding: 15px 10px;
            }
            
            .start-screen h2 {
                font-size: 1.2rem;
                margin-bottom: 8px;
            }
            
            .start-screen p {
                font-size: 0.85rem;
                margin-bottom: 15px;
            }
            
            .difficulty-selector {
                flex-direction: row;
                flex-wrap: wrap;
                margin-bottom: 15px;
            }
            
            .difficulty-btn {
                padding: 10px 15px;
                font-size: 0.9rem;
            }
            
            .results-emoji {
                font-size: 3rem;
                margin-bottom: 10px;
            }
            
            .results-stats {
                flex-direction: row;
                margin: 15px 0;
            }
        }

        /* Touch-friendly adjustments */
        @media (hover: none) and (pointer: coarse) {
            .answer-btn {
                min-height: 60px;
            }
            
            .difficulty-btn {
                min-height: 55px;
            }
            
            .start-btn,
            .next-btn,
            .restart-btn {
                min-height: 55px;
            }
            
            /* Remove hover effects on touch devices */
            .answer-btn:hover:not(:disabled),
            .difficulty-btn:hover,
            .start-btn:hover,
            .next-btn:hover,
            .restart-btn:hover {
                transform: none;
            }
            
            /* Add active state for touch feedback */
            .answer-btn:active:not(:disabled),
            .difficulty-btn:active,
            .start-btn:active,
            .next-btn:active,
            .restart-btn:active {
                transform: scale(0.98);
                opacity: 0.9;
            }
        }

        /* High DPI screens */
        @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
            .fraction-line {
                height: 3px;
            }
        }

        /* Safe area for notched phones (iPhone X, etc.) */
        @supports (padding: max(0px)) {
            .container {
                padding-left: max(12px, env(safe-area-inset-left));
                padding-right: max(12px, env(safe-area-inset-right));
                padding-bottom: max(12px, env(safe-area-inset-bottom));
            }
        }
