/* ============================================================================== */
/*                       RESPONSIVE.CSS — TABLE OF CONTENTS                       */
/* ============================================================================== */
/*                                                                                */
/*                               TABLE OF CONTENTS                                */
/*                                                                                */
/*     1. CUSTOM FONT — Luckiest Guy with ascent override                         */
/*     2. PORTRAIT ORIENTATION — show orientation-lock overlay                    */
/*     3. SMALL PHONES — <= 667px wide (main mobile breakpoint)                   */
/*     4. VERY SMALL PHONES — <= 380px wide                                       */
/*     5. LARGE PHONES / SMALL TABLETS — 668-844px                                */
/*     6. TABLETS / IPAD MINI — 845-932px                                         */
/*     7. ALL PHONES & SMALL TABLETS — <= 932px (shared tweaks)                   */
/*     8. DESKTOPS & LARGE TABLETS — >= 933px                                     */
/*                                                                                */
/* ============================================================================== */

/* ====================================================================== */
/* CUSTOM FONT — Luckiest Guy with ascent override */
/* ====================================================================== */

@font-face {
    font-family: 'Luckiest Guy';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url(assets/fonts/LuckiestGuy.ttf) format('truetype');
    ascent-override: 70.3%;
    descent-override: 29.7%;
}

/* ====================================================================== */
/* PORTRAIT ORIENTATION — show orientation-lock overlay */
/* ====================================================================== */

@media screen and (orientation: portrait) {

    #orientation-lock {
        display: flex;
    }

    body {
        overflow: hidden;
    }

    #ui-container, canvas, #header-buttons-container, #touch-controls {
        display: none;
    }
}

/* ====================================================================== */
/* SMALL PHONES — <= 667px wide (main mobile breakpoint) */
/* ====================================================================== */

@media screen and (max-width: 667px) {

    #gameTitle {
        font-size: clamp(3.2rem, 11vw, 6rem);
        text-shadow: 3px 3px 0px var(--color-black), 6px 6px 0px var(--game-title-shadow);
        margin-bottom: 20px;
    }

    .category-card {
        min-width: 130px;
        max-width: 240px;
        border-radius: 14px;
    }
    .category-card .card-icon {
        width: 34px;
        height: 34px;
        margin-bottom: 6px;
    }
    .category-card span {
        font-size: 15px;
        letter-spacing: 1px;
    }

    #btnOpenBackgrounds,
    #btnOpenSkins {
        flex: 0 0 auto;
        width: 270px;
        min-width: 0;
        max-width: none;
        border-radius: 15px;
    }
    #btnSelectGameBg,
    #btnSelectMenuBg {
        flex: 0 0 auto;
        width: 270px;
        min-width: 0;
        max-width: none;
        border-radius: 15px;
    }

    #btnOpenBackgrounds .card-icon,
    #btnOpenSkins .card-icon,
    #btnSelectGameBg .card-icon,
    #btnSelectMenuBg .card-icon {
        width: 47px;
        height: 47px;
        margin-bottom: 12px;
    }

    #btnOpenBackgrounds span,
    #btnOpenSkins span,
    #btnSelectGameBg span,
    #btnSelectMenuBg span {
        font-size: 19px;
        letter-spacing: 1px;
    }

    .category-container {
        gap: 15px;
    }

    #hud-left {
        top: 10px;
        left: 10px;
        gap: 4px;
    }
    #score-container {
        height: 24px;
        padding: 4px 18px 4px 6px;
        border-width: 1.5px;
    }
    #score-container.no-plus {
        padding: 4px 8px 4px 6px;
    }
    .score-item {
        font-size: 0.65rem;
    }
    .score-item img {
        height: 12px;
    }

    .plus-btn {
        width: 18px;
        height: 18px;
        right: -3px;
        border-width: 1.5px;
    }
    .plus-btn svg {
        width: 12px;
        height: 12px;
    }

    #header-buttons-container {
        top: 10px;
        right: 10px;
        gap: 6px;
    }
    .green-3d-btn {
        width: 37px;
        height: 37px;
        border-width: 2px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .green-3d-btn svg {
        width: 52%;
        height: 52%;
    }

    #startBtn {
        font-size: 0.85rem;
        padding: 8px 22px;
        min-width: 120px;
        margin-top: 20px;
        border-width: 2px;
    }

    #menuLevelDisplay {
        font-size: 1.9rem;
        margin-bottom: 12px;
    }

    #level-progress-container {
        top: 10px;
        width: 60%;
        max-width: 260px;
        height: 24px;
        gap: 6px;
    }
    .progress-track {
        height: 8px;
        border-width: 1.5px;
    }
    #progress-ball {
        width: 16px;
        height: 16px;
    }
    .progress-icon-end {
        font-size: 0.95rem;
    }

    #shopMenu::before {
        height: 40px;
    }
    #shopMenu.menu {
        padding-top: 60px;
        padding-left: 0;
        padding-right: 10px;
    }
    #shopMenu::after {
        top: 40px;
    }

    #shopMenu #shopBackBtn {
        top: 20px;
        left: 10px;
        width: 28px;
        height: 28px;
    }

    #shopMenu .menu-title {
        height: 40px;
        font-size: 1.2rem;
    }

    #galleryMenu::after {
        top: 40px;
    }
    #galleryMenu::before {
        height: 40px;
    }
    #galleryMenu.menu {
        padding-top: 60px;
        padding-left: 10px;
        padding-right: 10px;
    }

    #galleryMenu #galleryActionBtn {
        top: 20px;
        left: 10px;
        width: 28px;
        height: 28px;
    }
    #galleryMenu .menu-title {
        height: 40px;
        font-size: 1.2rem;
    }

    #productsMenu::before {
        height: 40px;
    }
    #productsMenu.menu {
        padding-left: 0;
        padding-right: 10px;
        padding-top: 60px;
    }
    #productsMenu::after {
        top: 40px;
    }
    #productsMenu .menu-title {
        height: 40px;
        font-size: 1.2rem;
    }
    #productsMenu #productsBackBtn {
        top: 20px;
        left: 10px;
        width: 28px;
        height: 28px;
    }

    .unified-shop-tab .tab-half {
        padding: 4px 12px;
    }
    .shop-tabs-container {
        right: 10px;
        height: 40px;
    }

    #shopContainerCoins, #shopContainerDiamonds {
        grid-template-columns: repeat(3, 1fr);
        padding: 0 0 30px 10px;
    }
    #shopMenu .shop-item {
        min-height: 160px;
        padding: 12px 6px 10px;
        gap: 12px;
    }

    #shopMenu .shop-item .item-visual img {
        width: 38px;
        height: 38px;
    }
    #shopMenu .item-amount {
        font-size: 14px;
    }

    .buy-btn {
        font-size: 0.65rem;
        padding: 3px 0;
    }

    .unified-shop-tab .tab-half img {
        width: 14px;
        height: 14px;
    }

    .products-sidebar-buttons {
        top: 60px;
        left: 2px;
        width: 150px;
        gap: 8px;
        padding: 0 8px;
    }

    .products-sidebar-buttons::after {
        top: 60px;
        left: 150px;
    }

    .products-sidebar-btn {
        font-size: 0.6rem;
        padding: 6px 4px;
        border-width: 2px;
        width: 100%;
    }

    #productsMenu .shop-items-grid {
        grid-template-columns: repeat(3, 1fr);
        padding: 0 0 30px 158px;
        gap: 8px;
    }
    #productsMenu .shop-item {
        padding: 12px 6px 10px;
        gap: 12px;
    }

    #productsMenu .shop-item.has-bg {
        padding-top: 5px;
        padding-left: 4px;
        padding-right: 4px;
    }

    #productsMenu .shop-ball-preview {
        width: 52px;
        height: 52px;
    }
    .shop-bg-preview {
        height: 52px;
    }

    #productsMenu .buy-btn {
        padding: 4px 0;
        font-size: 0.65rem;
    }
    #productsMenu .buy-btn img {
        width: 14px;
        height: 14px;
    }

    #settingsMenu.menu,
    #langMenu.menu {
        width: 400px;
        max-width: 84%;
        max-height: 70vh;
        padding: 8px 10px;
        gap: 4px;
        border-width: 3px;
        border-radius: 16px;
    }
    #settingsMenu .settings-list,
    #langMenu .settings-list {
        max-height: 55vh;
        gap: 6px;
        padding: 2px 4px;
    }
    #langMenu.menu {
        padding: 14px 10px;
    }
    #langMenu .settings-list {
        padding: 0;
        gap: 8px;
    }

    .settings-item {
        min-height: 36px;
        padding: 3px 8px;
        border-width: 1.5px;
        border-radius: 9px;
        box-shadow: 0 3px 0 rgba(0,0,0,0.2);
    }
    .settings-item span {
        font-size: 0.75rem;
    }
    .icon-box {
        width: 17px;
        height: 17px;
    }
    .setting-info {
        gap: 5px;
    }

    .toggle-switch {
        width: 36px;
        height: 20px;
        border-width: 2px;
        border-radius: 10px;
    }
    .toggle-switch .thumb {
        width: 11px;
        height: 11px;
        top: 50%;
        left: 4px;
    }
    .toggle-switch.is-active .thumb {
        transform: translateY(-50%) translateX(13px);
    }
    .nav-arrow {
        width: 14px;
        height: 14px;
    }

    #settingsBackBtn,
    #langBackBtn {
        width: 26px;
        height: 26px;
        border-width: 2px;
    }
    #settingsMenu .menu-title {
        font-size: 1rem;
        margin: 2px 0;
        letter-spacing: 0.5px;
    }
    #langMenu .settings-list .settings-item {
        min-height: 36px;
        font-size: 0.75rem;
    }

    #confirmExitMenu.menu,
    #confirmExitMenu.confirm-from-gameover,
    #confirmExitMenu.confirm-from-win,
    #confirmExitMenu.confirm-from-settings {
        border-width: 3px;
        border-radius: 25px;
    }
    #confirmExitMenu.menu {
        width: auto;
        max-width: 75%;
        min-width: 184px;
        padding: 14px;
    }
    #confirmExitMenu h1,
    #confirmExitMenu.confirm-from-gameover h1,
    #confirmExitMenu.confirm-from-win h1,
    #confirmExitMenu.confirm-from-settings h1 {
        font-size: 0.72rem;
        margin-bottom: 7px;
    }
    #confirmExitMenu .confirm-buttons .button {
        font-size: 0.53rem;
        padding: 3px 7px;
        min-height: 22px;
    }

    #genericAlertMenu.menu {
        width: 75%;
        max-width: 220px;
        padding: 10px;
        border-width: 2px;
    }
    #genericAlertMenu h2 {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    #genericAlertMenu #alertOkBtn {
        max-width: 180px;
        font-size: 0.65rem;
        min-height: 34px;
        padding: 6px 8px;
    }

    .toast.toast-small {
        font-size: 0.8rem;
        padding: 7px 14px;
        border-width: 1.5px;
    }

    #touch-controls {
        padding: 0 15px;
        height: 42px;
    }
    #move-controls-container,
    #action-controls-container {
        gap: 10px;
    }
    .control-btn {
        width: 36px;
        height: 36px;
        border-width: 1.5px;
    }
    .control-btn svg {
        width: 17px;
        height: 17px;
    }

    #levelSelectMenu.menu {
        padding: 8px 8px 20px 8px;
    }
    #levelSelectMenu .menu-title {
        font-size: 1.075rem;
        margin-top: 4px;
        margin-left: 2px;
        margin-right: 2px;
    }
    #levelSelectMenu #levelSelectBackBtn.close-btn {
        top: 8px;
        right: 8px;
        width: 30px;
        height: 30px;
    }

    .level-grid-row {
        grid-template-columns: minmax(18px, 1fr) minmax(auto, 380px) minmax(18px, 1fr);
    }
    .level-page-arrow svg {
        width: 32px;
        height: 32px;
    }

    .level-grid {
        grid-template-columns: repeat(10, 1fr);
        gap: 4px;
        max-width: 380px;
    }

    .level-cell {
        font-size: 0.65rem;
        border-width: 2px;
        border-radius: 5px;
        box-shadow: 0 3px 0 rgba(0,0,0,0.35), inset 0 -3px 5px rgba(0,0,0,0.15);
    }
    .level-grid-wrapper {
        justify-content: flex-end;
        gap: 12px;
        padding-bottom: 18px;
    }

    .level-play-btn {
        max-width: 380px;
        font-size: 0.8rem;
        padding: 4px 16px;
        margin-bottom: 10px;
    }

    body.in-game #score-container.no-plus {
        height: 19px;
        padding: 4px 13px 4px 6px;
    }
    body.in-game #score-container.no-plus .score-item img {
        height: 10px;
    }
    body.in-game .lives-display {
        display: none;
        gap: 2px;
    }
    body.in-game .lives-display .heart-icon {
        height: 9px;
    }
    body.in-game #settingsBtn {
        width: 32px;
        height: 32px;
    }
    body.in-game #level-progress-container {
        height: 19px;
        max-width: 255px;
    }
}

/* ====================================================================== */
/* VERY SMALL PHONES — <= 380px wide */
/* ====================================================================== */

@media screen and (max-width: 380px) {

    #touch-controls {
        padding: 0 10px;
        height: 90px;
    }

    #move-controls-container,
    #action-controls-container {
        gap: 8px;
    }

    .control-btn {
        width: 44px;
        height: 44px;
    }

}

/* ====================================================================== */
/* LARGE PHONES / SMALL TABLETS — 668-844px */
/* ====================================================================== */

@media screen and (min-width: 668px) and (max-width: 844px) {

    #gameTitle {
        font-size: clamp(2.5rem, 9vw, 5.5rem);
        text-shadow: 3px 3px 0px var(--color-black), 6px 6px 0px var(--game-title-shadow);
        margin-bottom: 35px;
    }

    .category-card {
        min-width: 150px;
        max-width: 260px;
        border-radius: 16px;
    }
    .category-card .card-icon {
        width: 38px;
        height: 38px;
        margin-bottom: 7px;
    }
    .category-card span {
        font-size: 17px;
        letter-spacing: 1px;
    }

    #btnOpenBackgrounds,
    #btnOpenSkins {
        flex: 0 0 auto;
        width: 340px;
        min-width: 0;
        max-width: none;
        border-radius: 16px;
    }
    #btnSelectGameBg,
    #btnSelectMenuBg {
        flex: 0 0 auto;
        width: 340px;
        min-width: 0;
        max-width: none;
        border-radius: 16px;
    }
    #btnOpenBackgrounds .card-icon,
    #btnOpenSkins .card-icon,
    #btnSelectGameBg .card-icon,
    #btnSelectMenuBg .card-icon {
        width: 52px;
        height: 52px;
        margin-bottom: 11px;
    }
    #btnOpenBackgrounds span,
    #btnOpenSkins span,
    #btnSelectGameBg span,
    #btnSelectMenuBg span {
        font-size: 23px;
        letter-spacing: 1px;
    }

    .category-container {
        gap: 17px;
    }

    #hud-left {
        top: 15px;
        left: 15px;
        gap: 5px;
    }
    #score-container {
        height: 32px;
        padding: 4px 24px 4px 10px;
        gap: 4px;
        border-width: 1.8px;
    }
    #score-container.no-plus {
        padding: 4px 12px 4px 10px;
    }
    .score-item {
        font-size: 0.78rem;
    }
    .score-item img {
        height: 16px;
    }
    .plus-btn {
        width: 22px;
        height: 22px;
        right: -4px;
        border-width: 1.8px;
    }
    .plus-btn svg {
        width: 14px;
        height: 14px;
    }

    #header-buttons-container {
        top: 15px;
        right: 15px;
        gap: 5px;
    }
    .green-3d-btn {
        width: 39px;
        height: 39px;
        border-width: 2px;
    }
    .green-3d-btn svg {
        width: 52%;
        height: 52%;
    }

    #startBtn {
        font-size: 0.85rem;
        padding: 8px 20px;
        min-width: 130px;
        margin-top: 30px;
        border-width: 2px;
    }

    #menuLevelDisplay {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }

    #level-progress-container {
        top: 10px;
        width: 65%;
        max-width: 300px;
        height: 26px;
        gap: 8px;
    }
    .progress-track {
        height: 8px;
        border-width: 1.5px;
    }
    #progress-ball {
        width: 17px;
        height: 17px;
    }
    .progress-icon-end {
        font-size: 1rem;
    }

    #shopMenu::before {
        height: 48px;
    }
    #shopMenu.menu {
        padding-top: 65px;
        padding-left: 0;
        padding-right: 15px;
    }
    #shopMenu::after {
        top: 48px;
    }
    #shopMenu #shopBackBtn {
        top: 24px;
        left: 15px;
        width: 30px;
        height: 30px;
    }
    #shopMenu .menu-title {
        height: 48px;
        font-size: 1.4rem;
    }

    #galleryMenu::after {
        top: 48px;
    }
    #galleryMenu::before {
        height: 48px;
    }
    #galleryMenu.menu {
        padding-top: 65px;
        padding-left: 15px;
        padding-right: 15px;
    }
    #galleryMenu #galleryActionBtn {
        top: 24px;
        left: 15px;
        width: 30px;
        height: 30px;
    }
    #galleryMenu .menu-title {
        height: 48px;
        font-size: 1.4rem;
    }

    #productsMenu::before {
        height: 48px;
    }
    #productsMenu.menu {
        padding-left: 0;
        padding-right: 15px;
        padding-top: 65px;
    }
    #productsMenu::after {
        top: 48px;
    }
    #productsMenu .menu-title {
        height: 48px;
        font-size: 1.4rem;
    }
    #productsMenu #productsBackBtn {
        top: 24px;
        left: 15px;
        width: 30px;
        height: 30px;
    }

    #shopMenu .shop-item {
        min-height: 180px;
        padding: 15px 8px 12px;
        gap: 16px;
    }
    #shopContainerCoins, #shopContainerDiamonds {
        padding: 0 0 30px 15px;
    }
    #shopMenu .shop-item .item-visual img {
        width: 48px;
        height: 48px;
    }
    #shopMenu .item-amount {
        font-size: 16px;
    }
    .buy-btn {
        font-size: 0.7rem;
        padding: 4px 0;
    }
    .unified-shop-tab .tab-half img {
        width: 16px;
        height: 16px;
    }

    .unified-shop-tab .tab-half {
        padding: 5px 14px;
    }
    .shop-tabs-container {
        right: 15px;
        height: 48px;
    }

    .products-sidebar-buttons {
        top: 65px;
        left: 5px;
        width: 160px;
        gap: 10px;
        padding: 0 10px;
    }
    .products-sidebar-buttons::after {
        top: 65px;
        left: 163.5px;
    }
    .products-sidebar-btn {
        font-size: 0.65rem;
        padding: 8px 6px;
    }

    #productsMenu .shop-items-grid {
        grid-template-columns: repeat(3, 1fr);
        padding: 0 0 30px 175px;
        gap: 15px;
    }
    #productsMenu .shop-item {
        padding: 15px 8px 12px;
        gap: 16px;
    }
    #productsMenu .shop-item.has-bg {
        padding-top: 6px;
        padding-left: 5px;
        padding-right: 5px;
    }

    #productsMenu .shop-ball-preview {
        width: 70px;
        height: 70px;
    }
    .shop-bg-preview {
        height: 70px;
    }
    #productsMenu .buy-btn {
        padding: 5px 0;
        font-size: 0.7rem;
    }
    #productsMenu .buy-btn img {
        width: 16px;
        height: 16px;
    }

    #settingsMenu.menu,
    #langMenu.menu {
        width: 420px;
        max-width: 85%;
        padding: 12px 8px;
        gap: 4px;
    }
    .settings-list,
    #langMenu .settings-list {
        gap: 8px;
        padding: 2px 4px;
    }
    #langMenu.menu {
        padding: 14px 10px;
    }
    #langMenu .settings-list {
        padding: 0;
        gap: 8px;
    }
    .settings-item {
        min-height: 40px;
        padding: 3px 8px;
    }
    .settings-item span {
        font-size: 0.85rem;
    }
    .icon-box {
        width: 20px;
        height: 20px;
    }
    .setting-info {
        gap: 4px;
    }

    .toggle-switch {
        width: 40px;
        height: 20px;
    }
    .toggle-switch .thumb {
        width: 12px;
        height: 12px;
        left: 4px;
    }

    .toggle-switch.is-active .thumb {
        transform: translateY(-50%) translateX(14px);
    }

    #settingsBackBtn,
    #langBackBtn {
        width: 30px;
        height: 30px;
        border-width: 2px;
    }
    #settingsMenu .menu-title {
        font-size: 1.2rem;
    }
    #langMenu .settings-list .settings-item {
        min-height: 40px;
        font-size: 0.85rem;
    }

    #confirmExitMenu.menu,
    #confirmExitMenu.confirm-from-gameover,
    #confirmExitMenu.confirm-from-win,
    #confirmExitMenu.confirm-from-settings {
        border-width: 3px;
        border-radius: 25px;
    }
    #confirmExitMenu.menu {
        width: auto;
        max-width: 77%;
        min-width: 204px;
        padding: 16px;
    }
    #confirmExitMenu h1,
    #confirmExitMenu.confirm-from-gameover h1,
    #confirmExitMenu.confirm-from-win h1,
    #confirmExitMenu.confirm-from-settings h1 {
        font-size: 0.77rem;
        margin-bottom: 8px;
    }
    #confirmExitMenu .confirm-buttons .button {
        font-size: 0.54rem;
        padding: 4px 8px;
        min-height: 24px;
    }

    #genericAlertMenu.menu {
        width: 70%;
        max-width: 280px;
        padding: 14px;
        border-width: 2px;
    }
    #genericAlertMenu h2 {
        font-size: 1.05rem;
    }
    #genericAlertMenu #alertOkBtn {
        max-width: 240px;
        font-size: 0.8rem;
        min-height: 36px;
        padding: 6px 10px;
    }

    .toast.toast-small {
        font-size: 0.85rem;
        padding: 8px 16px;
        border-width: 1.5px;
    }

    #touch-controls {
        padding: 0 25px;
        height: 46px;
    }
    #move-controls-container,
    #action-controls-container {
        gap: 12px;
    }
    .control-btn {
        width: 40px;
        height: 40px;
        border-width: 1.5px;
    }
    .control-btn svg {
        width: 19px;
        height: 19px;
    }

    #levelSelectMenu.menu {
        padding: 10px 12px 20px 12px;
    }
    #levelSelectMenu #levelSelectBackBtn.close-btn {
        top: 10px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
    #levelSelectMenu .menu-title {
        font-size: 1.175rem;
    }

    .level-grid-row {
        grid-template-columns: minmax(24px, 1fr) minmax(auto, 420px) minmax(24px, 1fr);
    }
    .level-page-arrow svg {
        width: 48px;
        height: 48px;
    }
    .level-grid {
        gap: 5px;
        max-width: 420px;
    }
    .level-cell {
        font-size: 0.75rem;
        border-width: 2px;
        border-radius: 6px;
        box-shadow: 0 4px 0 rgba(0,0,0,0.35), inset 0 -3px 5px rgba(0,0,0,0.15);
    }
    .level-grid-wrapper {
        justify-content: flex-end;
        gap: 12px;
        padding-bottom: 20px;
    }
    .level-play-btn {
        max-width: 420px;
        font-size: 0.85rem;
        padding: 5px 18px;
    }

    body.in-game #score-container.no-plus {
        height: 27px;
        padding: 4px 19px 4px 10px;
    }
    body.in-game #score-container.no-plus .score-item img {
        height: 14px;
    }
    body.in-game .lives-display {
        display: none;
        gap: 3px;
    }
    body.in-game .lives-display .heart-icon {
        height: 12px;
    }
    body.in-game #settingsBtn {
        width: 34px;
        height: 34px;
    }
    body.in-game #level-progress-container {
        height: 21px;
        max-width: 295px;
    }
}

/* ====================================================================== */
/* TABLETS / IPAD MINI — 845-932px */
/* ====================================================================== */

@media screen and (min-width: 845px) and (max-width: 932px) {

    #gameTitle {
        font-size: clamp(2.5rem, 9.5vw, 6.5rem);
        text-shadow: 3px 3px 0px var(--color-black), 6px 6px 0px var(--game-title-shadow);
        margin-bottom: 40px;
    }

    .category-card {
        min-width: 240px;
        max-width: 420px;
        border-radius: 20px;
    }
    .category-card .card-icon {
        width: 62px;
        height: 62px;
        margin-bottom: 12px;
    }
    .category-card span {
        font-size: 26px;
        letter-spacing: 1.5px;
    }

    #btnOpenBackgrounds,
    #btnOpenSkins {
        flex: 0 0 auto;
        width: 380px;
        min-width: 0;
        max-width: none;
        border-radius: 19px;
    }
    #btnSelectGameBg,
    #btnSelectMenuBg {
        flex: 0 0 auto;
        width: 380px;
        min-width: 0;
        max-width: none;
        border-radius: 19px;
    }
    #btnOpenBackgrounds .card-icon,
    #btnOpenSkins .card-icon,
    #btnSelectGameBg .card-icon,
    #btnSelectMenuBg .card-icon {
        width: 61px;
        height: 61px;
        margin-bottom: 15px;
    }
    #btnOpenBackgrounds span,
    #btnOpenSkins span,
    #btnSelectGameBg span,
    #btnSelectMenuBg span {
        font-size: 25px;
        letter-spacing: 1.5px;
    }

    .category-container {
        gap: 26px;
    }

    #hud-left {
        top: 15px;
        left: 15px;
        gap: 6px;
    }
    #score-container {
        height: 33px;
        padding: 4px 28px 4px 12px;
        gap: 6px;
        border-width: 1.4px;
    }
    #score-container.no-plus {
        padding: 4px 14px 4px 12px;
    }
    .score-item {
        font-size: 0.85rem;
    }
    .score-item img {
        height: 18px;
    }
    .plus-btn {
        width: 22px;
        height: 22px;
        right: -4px;
        border-width: 1.6px;
    }
    .plus-btn svg {
        width: 14px;
        height: 14px;
    }

    #header-buttons-container {
        top: 15px;
        right: 15px;
        gap: 6px;
    }
    .green-3d-btn {
        width: 46px;
        height: 46px;
        border-width: 2px;
    }
    .green-3d-btn svg {
        width: 50%;
        height: 50%;
    }

    #startBtn {
        font-size: 0.95rem;
        padding: 10px 26px;
        min-width: 155px;
        margin-top: 30px;
        border-width: 2.5px;
    }

    #menuLevelDisplay {
        font-size: 2.2rem;
        margin-bottom: 12px;
    }

    #level-progress-container {
        top: 10px;
        width: 70%;
        max-width: 340px;
    }
    .progress-track {
        border-width: 1.5px;
    }

    #shopMenu::before {
        height: 50px;
    }
    #shopMenu.menu {
        padding-top: 70px;
        padding-left: 0;
        padding-right: 15px;
    }
    #shopMenu::after {
        top: 50px;
    }
    #shopMenu #shopBackBtn {
        top: 25px;
        left: 15px;
        width: 32px;
        height: 32px;
    }
    #shopMenu .menu-title {
        height: 50px;
        font-size: 1.4rem;
    }

    #galleryMenu::after {
        top: 50px;
    }
    #galleryMenu::before {
        height: 50px;
    }
    #galleryMenu.menu {
        padding-top: 70px;
        padding-left: 15px;
        padding-right: 15px;
    }
    #galleryMenu #galleryActionBtn {
        top: 25px;
        left: 15px;
        width: 32px;
        height: 32px;
    }
    #galleryMenu .menu-title {
        height: 50px;
        font-size: 1.4rem;
    }

    #productsMenu::before {
        height: 50px;
    }
    #productsMenu.menu {
        padding-left: 0;
        padding-right: 15px;
        padding-top: 70px;
    }
    #productsMenu::after {
        top: 50px;
    }
    #productsMenu .menu-title {
        height: 50px;
        font-size: 1.4rem;
    }
    #productsMenu #productsBackBtn {
        top: 25px;
        left: 15px;
        width: 32px;
        height: 32px;
    }

    .unified-shop-tab .tab-half {
        padding: 5px 16px;
    }
    .shop-tabs-container {
        right: 15px;
        height: 50px;
    }

    #shopMenu .shop-item {
        min-height: 200px;
        padding: 18px 10px 14px;
        gap: 20px;
    }
    #shopContainerCoins, #shopContainerDiamonds {
        padding: 0 0 30px 15px;
    }
    #shopMenu .shop-item .item-visual img {
        width: 52px;
        height: 52px;
    }
    #shopMenu .item-amount {
        font-size: 18px;
    }
    .buy-btn {
        font-size: 0.75rem;
        padding: 5px 0;
    }
    .unified-shop-tab .tab-half img {
        width: 17px;
        height: 17px;
    }

    .products-sidebar-buttons {
        top: 70px;
        left: 3px;
        width: 180px;
        gap: 12px;
        padding: 0 12px;
    }
    .products-sidebar-buttons::after {
        top: 70px;
        left: 180px;
    }
    .products-sidebar-btn {
        font-size: 0.7rem;
        padding: 10px 8px;
    }

    #productsMenu .shop-items-grid {
        grid-template-columns: repeat(3, 1fr);
        padding: 0 0 30px 195px;
        gap: 15px;
    }
    #productsMenu .shop-item {
        padding: 18px 10px 14px;
        gap: 20px;
    }
    #productsMenu .shop-item.has-bg {
        padding-top: 7px;
        padding-left: 6px;
        padding-right: 6px;
    }

    #productsMenu .shop-ball-preview {
        width: 80px;
        height: 80px;
    }
    .shop-bg-preview {
        height: 80px;
    }
    #productsMenu .buy-btn {
        padding: 5px 0;
        font-size: 0.75rem;
    }
    #productsMenu .buy-btn img {
        width: 18px;
        height: 18px;
    }

    #settingsMenu.menu,
    #langMenu.menu {
        padding: 15px 10px;
        gap: 5px;
    }
    .settings-list,
    #langMenu .settings-list {
        gap: 10px;
        padding: 2px 4px;
    }
    #langMenu.menu {
        padding: 16px 12px;
    }
    #langMenu .settings-list {
        padding: 0;
        gap: 10px;
    }
    .settings-item {
        min-height: 45px;
        padding: 4px 9px;
    }
    .settings-item span {
        font-size: 0.9rem;
    }
    .icon-box {
        width: 23px;
        height: 23px;
    }
    .setting-info {
        gap: 5px;
    }

    .toggle-switch {
        width: 45px;
        height: 23px;
    }
    .toggle-switch .thumb {
        width: 14px;
        height: 14px;
        left: 4px;
    }

    .toggle-switch.is-active .thumb {
        transform: translateY(-50%) translateX(17px);
    }

    #settingsBackBtn,
    #langBackBtn {
        width: 32px;
        height: 32px;
        border-width: 2px;
    }
    #settingsMenu .menu-title {
        font-size: 1.4rem;
    }
    #langMenu .settings-list .settings-item {
        min-height: 45px;
        font-size: 0.9rem;
    }

    #confirmExitMenu.menu,
    #confirmExitMenu.confirm-from-gameover,
    #confirmExitMenu.confirm-from-win,
    #confirmExitMenu.confirm-from-settings {
        border-width: 3px;
        border-radius: 21px;
    }
    #confirmExitMenu.menu {
        width: auto;
        max-width: 78%;
        min-width: 224px;
        padding: 19px;
    }
    #confirmExitMenu h1,
    #confirmExitMenu.confirm-from-gameover h1,
    #confirmExitMenu.confirm-from-win h1,
    #confirmExitMenu.confirm-from-settings h1 {
        font-size: 0.81rem;
        margin-bottom: 9px;
    }
    #confirmExitMenu .confirm-buttons .button {
        font-size: 0.56rem;
        padding: 4px 9px;
        min-height: 24px;
    }

    #genericAlertMenu.menu {
        width: 65%;
        max-width: 320px;
        padding: 16px;
        border-width: 2px;
    }
    #genericAlertMenu h2 {
        font-size: 1.1rem;
    }
    #genericAlertMenu #alertOkBtn {
        max-width: 260px;
        font-size: 0.85rem;
        min-height: 40px;
        padding: 7px 12px;
    }

    .toast.toast-small {
        font-size: 0.9rem;
        padding: 9px 18px;
        border-width: 1.5px;
    }

    #touch-controls {
        padding: 0 30px;
        height: 52px;
    }
    #move-controls-container,
    #action-controls-container {
        gap: 14px;
    }
    .control-btn {
        width: 44px;
        height: 44px;
        border-width: 1.5px;
    }
    .control-btn svg {
        width: 21px;
        height: 21px;
    }

    #levelSelectMenu.menu {
        padding: 10px 12px 20px 12px;
    }
    #levelSelectMenu .menu-title {
        font-size: 1.375rem;
    }

    .level-grid-row {
        grid-template-columns: minmax(28px, 1fr) minmax(auto, 460px) minmax(28px, 1fr);
    }
    .level-page-arrow svg {
        width: 56px;
        height: 56px;
    }
    .level-grid {
        gap: 6px;
        max-width: 460px;
    }
    .level-cell {
        font-size: 0.8rem;
        border-width: 2px;
        border-radius: 6px;
        box-shadow: 0 4px 0 rgba(0,0,0,0.35), inset 0 -3px 5px rgba(0,0,0,0.15);
    }
    .level-grid-wrapper {
        justify-content: flex-end;
        gap: 20px;
        padding-bottom: 22px;
    }
    .level-play-btn {
        max-width: 460px;
        font-size: 0.9rem;
        padding: 5px 18px;
    }

    body.in-game #score-container.no-plus {
        height: 28px;
        padding: 4px 23px 4px 12px;
    }
    body.in-game #score-container.no-plus .score-item img {
        height: 16px;
    }
    body.in-game .lives-display {
        display: none;
        gap: 3px;
    }
    body.in-game .lives-display .heart-icon {
        height: 14px;
    }
    body.in-game #settingsBtn {
        width: 41px;
        height: 41px;
    }
    body.in-game #level-progress-container {
        height: 25px;
        max-width: 335px;
    }
}

/* ====================================================================== */
/* ALL PHONES & SMALL TABLETS — <= 932px (shared tweaks) */
/* ====================================================================== */

@media screen and (max-width: 932px) {

    @font-face {
        font-family: 'Luckiest Guy';
        font-style: normal;
        font-weight: 400;
        font-display: swap;
        src: url(assets/fonts/LuckiestGuy.ttf) format('truetype');
        ascent-override: 70.3%;
        descent-override: 29.7%;
    }

    #gameOverMenu.menu,
    #levelCompleteMenu.menu {
        transform: translateY(-120vh) rotate(-3deg) scale(0.8);
        transform-origin: center;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        overflow: visible;
        max-width: 326px;
        padding: 21px;
        border-width: 3px;
        border-radius: 21px;
    }

    @keyframes loseCardDrop {
        0%   { transform: translateY(-120vh) rotate(-3deg) scale(0.8); opacity: 0; }
        8%   { opacity: 1; }
        45%  { transform: translateY(0) rotate(0deg) scale(0.8); opacity: 1; }
        52%  { transform: translateY(-18px) rotate(7deg) scale(0.8); }
        62%  { transform: translateY(-6px) rotate(-6deg) scale(0.8); }
        72%  { transform: translateY(-10px) rotate(4deg) scale(0.8); }
        82%  { transform: translateY(-3px) rotate(-2deg) scale(0.8); }
        90%  { transform: translateY(-2px) rotate(1deg) scale(0.8); }
        100% { transform: translateY(0) rotate(0deg) scale(0.8); opacity: 1; }
    }

    @keyframes winCardDrop {
        0%   { transform: translateY(-120vh) rotate(-3deg) scale(0.8); opacity: 0; }
        8%   { opacity: 1; }
        45%  { transform: translateY(0) rotate(0deg) scale(0.8); opacity: 1; }
        52%  { transform: translateY(-18px) rotate(7deg) scale(0.8); }
        62%  { transform: translateY(-6px) rotate(-6deg) scale(0.8); }
        72%  { transform: translateY(-10px) rotate(4deg) scale(0.8); }
        82%  { transform: translateY(-3px) rotate(-2deg) scale(0.8); }
        90%  { transform: translateY(-2px) rotate(1deg) scale(0.8); }
        100% { transform: translateY(0) rotate(0deg) scale(0.8); opacity: 1; }
    }

    #gameOverMenu > *,
    #levelCompleteMenu > * {
        transform: translateY(-8px) scale(0.9);
        transform-origin: center;
    }

    /* --- Win/Lose menus ~28% smaller on phones (15% twice) --- */
    #gameOverMenu h1,
    #gameOverMenu h1#gameOverTitle,
    #gameOverTitle,
    #levelCompleteMenu h1,
    #levelCompleteTitle {
        font-size: 36px !important;
        margin-bottom: 5px !important;
    }

    #loseLevelDisplay,
    #winLevelDisplay {
        font-size: 0.93rem !important;
        margin-bottom: 14px !important;
    }

    #gameOverMenu .button.icon-btn,
    #levelCompleteMenu .button.icon-btn {
        width: 46px !important;
        height: 46px !important;
    }

    #gameOverMenu .button.icon-btn svg,
    #levelCompleteMenu .button.icon-btn svg {
        width: 24px !important;
        height: 24px !important;
    }

    .gameover-buttons,
    .win-buttons {
        gap: 12px !important;
        margin-top: 7px !important;
    }

    #final-scores-wrapper,
    .final-scores-wrapper-win {
        gap: 5px !important;
    }

    .final-scores-wrapper-win > .final-score-container,
    .final-scores-wrapper-win .score-wrapper-relative .final-score-container,
    #final-scores-wrapper > .final-score-container {
        padding: 5px 8px !important;
        border-radius: 10px !important;
    }

    .final-scores-wrapper-win > .final-score-container img,
    .final-scores-wrapper-win .score-wrapper-relative .final-score-container img,
    #final-scores-wrapper > .final-score-container img {
        height: 18px !important;
    }

    .final-scores-wrapper-win > .final-score-container span,
    .final-scores-wrapper-win .score-wrapper-relative .final-score-container span,
    #final-scores-wrapper > .final-score-container span {
        font-size: 1.05rem !important;
    }

    .final-score-container span {

        line-height: 1.25;
        height: auto;

        transform: translateY(3px);
        transform-origin: center;
    }

    html.font-override-no .final-score-container span {
        transform: translateY(6.5px);
    }
}

html.font-override-no .final-score-container span {
    line-height: 1.25;
    height: auto;
    transform: translateY(6.5px);
    transform-origin: center;
}

/* ====================================================================== */
/* DESKTOPS & LARGE TABLETS — >= 933px */
/* ====================================================================== */

@media screen and (min-width: 933px) {
    #levelSelectMenu.menu {
        padding: 20px 20px 40px 20px;
    }

    .level-grid-wrapper {
        justify-content: center;
        gap: 20px;
        padding-bottom: 20px;
        margin-top: 45px;
    }
    .level-grid-row {
        flex: 0 0 auto;
        margin: 0;
    }
    .level-play-btn {
        margin-bottom: 10px;
    }
}
