/* ========================================
   GLOBAL MOBILE RESPONSIVE OVERRIDE
   Highest Priority - Final Override
   ======================================== */

/* Base font size for rem calculations */
html {
    font-size: 16px;
}

@media (max-width: 600px) {
    html {
        font-size: 14px;
    }
}

@media (max-width: 375px) {
    html {
        font-size: 12px; /* Smaller for very small screens */
    }
}

/* ========================================
   NUMBER GRID - Fully Responsive
   ======================================== */

@media (max-width: 600px) {
    .number-grid {
        gap: clamp(3px, 0.8vw, 6px) !important;
    }

    .number-btn {
        /* Compact responsive sizes for small screens */
        min-height: auto !important;
        max-height: none !important;
        width: auto !important;
        height: auto !important;
        aspect-ratio: 1 !important;
        min-width: clamp(32px, 7vw, 40px) !important;
        min-height: clamp(32px, 7vw, 40px) !important;
        max-width: clamp(32px, 7vw, 40px) !important;
        max-height: clamp(32px, 7vw, 40px) !important;
        font-size: clamp(10px, 2.2vw, 14px) !important;
        font-weight: 700 !important;
        border-radius: clamp(6px, 1.5vw, 10px) !important;
        padding: 0 !important;
    }
}

/* ========================================
   BUTTONS - Responsive Sizing
   ======================================== */

@media (max-width: 600px) {
    .bet-btn {
        /* Compact buttons for small screens */
        min-height: auto !important;
        min-width: auto !important;
        padding: clamp(0.5rem, 1.5vw, 0.8rem) clamp(0.8rem, 2vw, 1.2rem) !important;
        font-size: clamp(0.75rem, 1.8vw, 0.95rem) !important;
        border-radius: clamp(0.5rem, 1.2vw, 0.8rem) !important;
        flex: 0 1 auto !important;
    }

    .action-btn {
        min-height: auto !important;
        padding: clamp(0.7rem, 1.8vw, 1rem) clamp(1rem, 2.5vw, 1.5rem) !important;
        font-size: clamp(0.85rem, 2vw, 1.05rem) !important;
        border-radius: clamp(0.6rem, 1.4vw, 0.9rem) !important;
    }

    .play-btn {
        min-height: auto !important;
        padding: clamp(0.8rem, 2.5vw, 1.3rem) clamp(1.5rem, 4vw, 2.2rem) !important;
        font-size: clamp(0.95rem, 2.8vw, 1.4rem) !important;
        border-radius: clamp(0.7rem, 2vw, 1.1rem) !important;
        font-weight: 900 !important;
    }
}

/* ========================================
   TYPOGRAPHY - Responsive Text
   ======================================== */

@media (max-width: 600px) {
    .balance-value {
        font-size: clamp(1rem, 3.5vw, 1.6rem) !important;
        font-weight: 900 !important;
    }

    .balance-label {
        font-size: clamp(0.7rem, 1.8vw, 0.9rem) !important;
    }

    .section-title {
        font-size: clamp(0.9rem, 2.5vw, 1.3rem) !important;
        margin-bottom: clamp(0.6rem, 1.8vw, 1rem) !important;
    }

    .selection-info {
        font-size: clamp(0.7rem, 1.8vw, 0.9rem) !important;
    }

    .timer-value, .multiplier-value {
        font-size: clamp(1.1rem, 3vw, 1.5rem) !important;
    }

    .timer-label, .multiplier-label {
        font-size: clamp(0.65rem, 1.6vw, 0.85rem) !important;
    }
}

/* ========================================
   CONTAINERS - Responsive Spacing
   ======================================== */

@media (max-width: 600px) {
    .game-container {
        padding: clamp(0.5rem, 1.5vw, 1rem) !important;
    }

    .game-header {
        padding: clamp(0.85rem, 2.2vw, 1.2rem) !important;
        border-radius: clamp(0.9rem, 2vw, 1.2rem) !important;
        margin-bottom: clamp(0.7rem, 1.8vw, 1rem) !important;
    }

    .game-main {
        padding: clamp(0.85rem, 2.2vw, 1.2rem) !important;
        border-radius: clamp(0.9rem, 2vw, 1.2rem) !important;
        margin-bottom: clamp(0.7rem, 1.8vw, 1rem) !important;
    }
}

/* ========================================
   TUTORIAL OVERLAY - Responsive
   ======================================== */

@media (max-width: 600px) {
    .tutorial-overlay {
        padding: clamp(0.7rem, 2vw, 1.3rem) !important;
    }

    .tutorial-step {
        padding: clamp(1.2rem, 3vw, 1.8rem) !important;
        border-radius: clamp(0.9rem, 2.2vw, 1.4rem) !important;
        max-width: calc(100% - clamp(1.5rem, 4vw, 3rem)) !important;
    }

    .tutorial-step h3 {
        font-size: clamp(1.1rem, 3vw, 1.4rem) !important;
        margin-bottom: clamp(0.7rem, 2vw, 1rem) !important;
    }

    .tutorial-step p {
        font-size: clamp(0.9rem, 2.4vw, 1.1rem) !important;
        margin-bottom: clamp(0.9rem, 2.4vw, 1.4rem) !important;
    }

    .tutorial-btn {
        padding: clamp(0.7rem, 2vw, 0.9rem) clamp(1.2rem, 3vw, 1.7rem) !important;
        font-size: clamp(0.9rem, 2.4vw, 1.1rem) !important;
        border-radius: clamp(0.6rem, 1.6vw, 0.9rem) !important;
    }

    .tutorial-highlight {
        border-width: clamp(2px, 0.5vw, 3px) !important;
        border-radius: clamp(0.9rem, 2.2vw, 1.1rem) !important;
    }
}

/* ========================================
   DRAWING OVERLAY - Responsive
   ======================================== */

@media (max-width: 600px) {
    .drawing-content {
        padding: clamp(1.2rem, 3vw, 1.8rem) !important;
        border-radius: clamp(0.9rem, 2.2vw, 1.4rem) !important;
        max-width: calc(100% - clamp(1.5rem, 4vw, 3rem)) !important;
    }

    .drawing-title {
        font-size: clamp(1.3rem, 3.5vw, 1.7rem) !important;
        margin-bottom: clamp(0.9rem, 2.4vw, 1.4rem) !important;
    }

    .drawn-numbers {
        gap: clamp(0.4rem, 1vw, 0.6rem) !important;
    }

    .drawn-number {
        width: clamp(2.8rem, 7vw, 3.2rem) !important;
        height: clamp(2.8rem, 7vw, 3.2rem) !important;
        font-size: clamp(1.1rem, 2.8vw, 1.3rem) !important;
        border-radius: clamp(0.7rem, 1.6vw, 0.9rem) !important;
    }
}

/* ========================================
   SCALE ANIMATIONS - Relative Only
   ======================================== */

@media (max-width: 600px) {
    .number-btn.selected {
        transform: scale(1.05) !important; /* Relative, not fixed */
    }

    .number-btn:hover {
        transform: translateY(-0.125rem) !important; /* Relative */
    }

    .bet-btn.active {
        transform: scale(1.03) !important;
    }

    .play-btn:hover:not(:disabled) {
        transform: translateY(-0.125rem) scale(1.03) !important;
    }
}

/* ========================================
   GLOW & SHADOW - Responsive
   ======================================== */

@media (max-width: 600px) {
    .number-btn.selected {
        box-shadow: 
            0 0 clamp(0.75rem, 2vw, 1.2rem) rgba(255, 215, 0, 0.6),
            0 0 clamp(1.5rem, 4vw, 2.5rem) rgba(255, 215, 0, 0.4) !important;
    }

    .play-btn {
        box-shadow: 0 0 clamp(1rem, 2.8vw, 2rem) rgba(255, 215, 0, 0.5) !important;
    }

    .play-btn:hover:not(:disabled) {
        box-shadow: 0 0 clamp(1.5rem, 4vw, 3rem) rgba(255, 215, 0, 0.8) !important;
    }
}

/* ========================================
   SAFE AREA SUPPORT
   ======================================== */

@supports (padding: max(0px)) {
    @media (max-width: 600px) {
        .game-container {
            padding-top: max(0.5rem, env(safe-area-inset-top)) !important;
            padding-bottom: max(0.5rem, env(safe-area-inset-bottom)) !important;
            padding-left: max(0.5rem, env(safe-area-inset-left)) !important;
            padding-right: max(0.5rem, env(safe-area-inset-right)) !important;
        }
    }
}

/* ========================================
   LANDSCAPE MODE
   ======================================== */

@media (max-width: 600px) and (orientation: landscape) {
    html {
        font-size: 12px;
    }

    .game-container {
        padding: 0.4rem !important;
    }

    .game-header {
        padding: 0.7rem !important;
        margin-bottom: 0.6rem !important;
    }

    .game-main {
        padding: 0.9rem !important;
    }

    .number-grid {
        gap: 0.3rem !important;
    }

    .number-btn {
        min-width: 2.4rem !important;
        min-height: 2.4rem !important;
        max-width: 2.4rem !important;
        max-height: 2.4rem !important;
        font-size: 0.9rem !important;
    }

    .balance-value {
        font-size: 1.2rem !important;
    }

    .section-title {
        font-size: 1.1rem !important;
        margin-bottom: 0.7rem !important;
    }
}
