/* ============================================================================== */
/*                         STYLE.CSS — TABLE OF CONTENTS                          */
/* ============================================================================== */
/*                                                                                */
/*                               TABLE OF CONTENTS                                */
/*                                                                                */
/*     1. GLOBAL RESET & DESIGN TOKENS                                            */
/*     2. DESIGN TOKENS (CSS custom properties)                                   */
/*     3. ROOT HTML ELEMENT                                                       */
/*     4. BODY — global typography & background                                   */
/*     5. BODY OVERLAY — subtle dark tint over background image                   */
/*     6. GAME CANVAS                                                             */
/*     7. UI CONTAINER — wraps every menu and HUD element                         */
/*     8. ORIENTATION LOCK OVERLAY                                                */
/*     9. TOAST NOTIFICATION                                                      */
/*    10. LEVEL PROGRESS BAR — visible during gameplay                            */
/*    11. MEDIA QUERIES — responsive breakpoints                                  */
/*    12. MAIN MENU — current level display                                       */
/*    13. IN-GAME HUD (LEFT) — coins, diamonds, plus button                       */
/*    14. LIVES DISPLAY — disabled (kept for future use)                          */
/*    15. PLUS BUTTON — opens the currency shop                                   */
/*    16. HEADER BUTTONS — gallery / shop / settings                              */
/*    17. GENERIC MENU — shared overlay style for every menu panel                */
/*    18. START MENU                                                              */
/*    19. SETTINGS & LANGUAGE MENUS                                               */
/*    20. SETTINGS LIST — shared list styling                                     */
/*    21. SETTINGS ITEM — row inside settings list                                */
/*    22. SETTING INFO — icon + label wrapper                                     */
/*    23. ICON BOX — square container for setting icons                           */
/*    24. TOGGLE SWITCH — sound on/off                                            */
/*    25. NAV ARROW — chevron shown on tappable settings rows                     */
/*    26. CHECKMARK — selected state indicator                                    */
/*    27. GALLERY MENU — preview & select cosmetics                               */
/*    28. SHOP MENU — buy currency (coins/diamonds)                               */
/*    29. PRODUCTS MENU — buy balls & backgrounds                                 */
/*    30. DECORATIVE GLOW — behind shop/gallery/products panels                   */
/*    31. CLOSE / BACK BUTTONS — shared back-button styling                       */
/*    32. MENU TITLE — large heading inside shop-style menus                      */
/*    33. SHOP TABS — coins vs diamonds switch                                    */
/*    34. SHOP TAB HALF — individual tab inside the unified shop tab              */
/*    35. SHOP ITEMS GRID — responsive grid of purchasable items                  */
/*    36. SHOP ITEM — single product card                                         */
/*    37. ITEM VISUAL — icon/preview area at top of shop item                     */
/*    38. BUY BUTTON — price/owned label on each shop item                        */
/*    39. PRODUCTS SIDEBAR — Balls / Menu BG / Game BG                            */
/*    40. PRODUCTS SIDEBAR BUTTON                                                 */
/*    41. DIVIDER — horizontal separator line                                     */
/*    42. GALLERY ROOT — category selection cards                                 */
/*    43. CATEGORY CARD — selectable card in the gallery root                     */
/*    44. BACKGROUNDS GRID — owned backgrounds gallery                            */
/*    45. MULTIPLIER TAG — x2 badge shown on win screen                           */
/*    46. MENU BANNER — large WIN/LOSE label                                      */
/*    47. FINAL SCORE CONTAINER — coin/diamond tally on win/lose                  */
/*    48. HEADER 3D BUTTONS — gallery / shop / settings                           */
/*    49. CONFIRM DIALOG BUTTONS                                                  */
/*    50. TOUCH CONTROLS — on-screen movement & jump buttons                      */
/*    51. ACTION CONTROLS — jump button                                           */
/*    52. CONTROL BUTTON — generic on-screen control button                       */
/*    53. LEVEL GRID — paginated level selector layout                            */
/*    54. LEVEL PAGINATION ARROWS                                                 */
/*    55. LEVEL GRID CELLS                                                        */
/*    56. LEVEL SELECT — Play button                                              */
/*                                                                                */
/* ============================================================================== */

/* ====================================================================== */
/* GLOBAL RESET & DESIGN TOKENS */
/* ====================================================================== */

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

/* ====================================================================== */
/* DESIGN TOKENS (CSS custom properties) */
/* ====================================================================== */

:root {

    --background-dark: #121826;
    --menu-background: rgba(22, 29, 47, 0.95);

    --primary-accent: #00A78E;
    --primary-accent-dark: #007C6A;
    --primary-glow: rgba(0, 167, 142, 0.5);
    --accent-glow: rgba(0, 255, 221, 0.8);

    --text-light: #F0F4F8;
    --text-dark: #AAB3C2;

    --border-color: rgba(255, 255, 255, 0.1);

    --game-btn-green: #00d68f;
    --game-btn-shadow: #008c5e;

    --game-title-stroke: #000;
    --game-title-shadow: #00A78E;

    --header-height: 65px;

    /* --- Extended palette tokens (added during code-quality pass) --- */
    --color-white: #ffffff;
    --color-black: #000000;
    --color-panel-dark: #1f2a36;
    --color-panel-darker: #0a1020;
    --color-slate: #34495e;
    --color-slate-light: #475569;
    --color-muted: #555555;
    --color-success: #1e8449;
    --color-danger: #8b0000;
    --color-danger-bright: #c8102e;
    --color-warning: #f39c12;
    --color-warning-bright: #f5a623;
    --color-gold: #ffd700;
    --color-yellow: #f1c40f;
    --color-accent-bright: #4aeecf;
    --color-orange-dark: #d35400;
    --color-brown: #a04000;
    --color-deep-red: #5b0000;
    --color-blue-dark: #2c3e50;
    --color-indigo: #2a3d6b;
    --color-off-white: #f0f2f5;
}

/* ====================================================================== */
/* ROOT HTML ELEMENT */
/* ====================================================================== */

html {
    height: 100%;
    width: 100%;
}

/* ====================================================================== */
/* BODY — global typography & background */
/* ====================================================================== */

body {
    font-family: 'Changa', sans-serif;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--text-light);
    user-select: none;
    -webkit-user-select: none;
    height: 100%;
    width: 100%;
    margin: 0;
    background-color: var(--background-dark);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ====================================================================== */
/* BODY OVERLAY — subtle dark tint over background image */
/* ====================================================================== */

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    pointer-events: none;
    z-index: 0;
}

/* ====================================================================== */
/* GAME CANVAS */
/* ====================================================================== */

canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    background-color: var(--background-dark);
    width: 100%;
    height: 100%;
}

/* ====================================================================== */
/* UI CONTAINER — wraps every menu and HUD element */
/* ====================================================================== */

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 5;
    pointer-events: none;
    padding: 0;
}

/* ====================================================================== */
/* ORIENTATION LOCK OVERLAY */
/* ====================================================================== */

#orientation-lock {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-dark);
    z-index: 10000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

#orientation-lock svg {
    width: 80px;
    height: 80px;
    fill: var(--primary-accent);
    animation: rotatePhone 2s infinite ease-in-out;
    margin-bottom: 20px;
}

#orientation-lock h2 {
    font-family: 'Changa', sans-serif;
    color: white;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

/* ====================================================================== */
/* TOAST NOTIFICATION */
/* ====================================================================== */

.toast {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(31, 42, 54, 0.95);
    color: var(--color-white);
    padding: 10px 20px;
    border-radius: 50px;
    font-family: 'Changa', sans-serif;
    font-size: 1rem;
    font-weight: bold;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.2);
    white-space: nowrap;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    pointer-events: none;
}

.toast.show {
    top: 15px;
    opacity: 1;
}

/* ====================================================================== */
/* LEVEL PROGRESS BAR — visible during gameplay */
/* ====================================================================== */

#level-progress-container {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 25;
    direction: ltr;
}

.progress-track {
    flex-grow: 1;
    height: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--color-white);
    border-radius: 10px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

#level-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-yellow), var(--color-warning));
    border-radius: 6px;
    transition: width 0.1s linear;
    box-shadow: 0 0 5px rgba(241, 196, 15, 0.6);
}

#progress-ball {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    transition: left 0.1s linear;
    z-index: 2;

    animation: progressBallPulse 1.5s ease-in-out infinite;
}

@keyframes progressBallPulse {
    0%   { transform: translate(-50%, -50%) scale(1); }
    50%  { transform: translate(-50%, -50%) scale(1.12); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* ====================================================================== */
/* MEDIA QUERIES — responsive breakpoints */
/* ====================================================================== */

@media (prefers-reduced-motion: reduce) {
    #progress-ball { animation: none; }
}

.progress-icon-end {
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5));
}

/* ====================================================================== */
/* MAIN MENU — current level display */
/* ====================================================================== */

#menuLevelDisplay {
    font-family: 'Luckiest Guy', cursive;
    font-size: 2.5rem;
    color: var(--color-yellow);
    text-shadow: 2px 2px 0 var(--color-black);
    margin-top: 0;
    margin-bottom: 25px;
    -webkit-text-stroke: 1px black;
    letter-spacing: 2px;
}

/* ====================================================================== */
/* IN-GAME HUD (LEFT) — coins, diamonds, plus button */
/* ====================================================================== */

#hud-left {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 25;
    direction: ltr;
    display: flex;
    align-items: center;
    gap: 8px;
}

#score-container {

    background-color: rgba(33, 44, 57, 0.9);
    border: 2px solid var(--color-white);
    border-radius: 50px;
    height: 49px;
    padding: 0 8px;
    padding-right: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

#score-container.no-plus {
    padding: 0 20px;
    padding-right: 20px;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: white;
    font-family: 'Changa', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    line-height: 1;
    direction: ltr;
    text-shadow: 2px 2px 0px var(--color-black);
}

.score-item img {
    height: 26px;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.4));
}

/* ====================================================================== */
/* LIVES DISPLAY — disabled (kept for future use) */
/* ====================================================================== */

.lives-display {
    display: none;
    align-items: center;
    gap: 4px;
}

body.in-game .lives-display {
    display: none;
}
.heart-icon {
    height: 22px;
    width: auto;

    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.4));
    object-fit: contain;
}

/* ====================================================================== */
/* PLUS BUTTON — opens the currency shop */
/* ====================================================================== */

.plus-btn {
    position: absolute;
    right: -8px;
    top: 20%;
    transform: translateY(-50%);
    width: 33px;
    height: 33px;
    background-color: #00C853;
    border: 2px solid var(--color-white);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.1s;
    z-index: 30;
}

.plus-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.plus-btn svg {
    width: 65%;
    height: 65%;
    stroke-width: 4.5px;
    display: block;
    margin: auto;
}

/* ====================================================================== */
/* HEADER BUTTONS — gallery / shop / settings */
/* ====================================================================== */

#header-buttons-container {
    position: absolute;
    top: 20px;
    right: 20px;
    direction: ltr;
    display: flex;
    gap: 10px;
    z-index: 155;
}

/* ====================================================================== */
/* GENERIC MENU — shared overlay style for every menu panel */
/* ====================================================================== */

.menu {
    position: relative;
    width: 100%;
    max-width: 90%;
    max-height: 90%;
    padding: 20px;
    pointer-events: auto;
    will-change: opacity;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
}

.menu::-webkit-scrollbar {
    display: none;
}

/* ====================================================================== */
/* START MENU */
/* ====================================================================== */

#startMenu.menu {
    background: none;
    box-shadow: none;
    border: none;
    padding: 0;
    backdrop-filter: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    overflow: visible;
}

/* ====================================================================== */
/* SETTINGS & LANGUAGE MENUS */
/* ====================================================================== */

#settingsMenu.menu,
#langMenu.menu {
    background: linear-gradient(135deg, var(--color-blue-dark), var(--color-slate));
    border: 4px solid var(--color-white);
    border-radius: 25px;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 15px 0 rgba(0,0,0,0.3), 0 20px 30px rgba(0,0,0,0.4);
    width: 500px;
    max-width: 90%;
    height: auto;
    max-height: 85vh;
    margin: auto;
    overflow: visible;
}

#settingsMenu .settings-list {
    overflow-y: auto;
    max-height: 65vh;
    padding: 2px 5px;
}

#langMenu.menu {
    padding: 26px 20px;
}

#langMenu .settings-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-height: 65vh;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#langMenu .settings-list::-webkit-scrollbar {
    display: none;
}

#langMenu .menu-title,
#langMenu .search-input {
    display: none;
}

/* ====================================================================== */
/* SETTINGS LIST — shared list styling */
/* ====================================================================== */

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

/* ====================================================================== */
/* SETTINGS ITEM — row inside settings list */
/* ====================================================================== */

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-panel-dark);
    padding: 10px 15px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: all 0.1s ease-out;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
    min-height: 55px;
}

.settings-item.selected {
    background-color: var(--game-btn-green);
    border-color: var(--color-white);
    box-shadow: 0 4px 0 var(--game-btn-shadow);
    transform: translateY(2px);
}

.settings-item.selected span {
    color: var(--color-white);
}

.settings-item.selected .checkmark {
    display: none;
}

#langMenu .settings-list .settings-item {
    justify-content: center;
    min-height: 50px;
    font-size: 1.1rem;
    font-weight: bold;
}

.settings-item:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.2);
}

/* ====================================================================== */
/* SETTING INFO — icon + label wrapper */
/* ====================================================================== */

.setting-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ====================================================================== */
/* ICON BOX — square container for setting icons */
/* ====================================================================== */

.icon-box {
    width: 28px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--color-accent-bright);
}

.icon-box svg {
    width: 100%;
    height: 100%;
    stroke-width: 2.5;
}

.settings-item span {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ====================================================================== */
/* TOGGLE SWITCH — sound on/off */
/* ====================================================================== */

.toggle-switch {
    width: 50px;
    height: 28px;
    background-color: var(--color-panel-dark);
    border-radius: 14px;
    padding: 0;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    border: 3px solid #3d4a55;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
    cursor: pointer;
}

.toggle-switch .thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(to bottom, var(--color-white), #e0e0e0);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 4px;
    transform: translateY(-50%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.toggle-switch.is-active {
    background-color: var(--game-btn-green);
    border-color: #00A78E;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

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

/* ====================================================================== */
/* NAV ARROW — chevron shown on tappable settings rows */
/* ====================================================================== */

.nav-arrow {
    width: 20px;
    height: 20px;
    color: #7f8c8d;
    transition: color 0.2s ease, transform 0.2s ease;
}

[dir="rtl"] .nav-arrow { transform: scaleX(-1); }

/* LTR menu rules — non-Arabic languages in settings page */
.ltr-menu .settings-item { direction: ltr; }
.ltr-menu .settings-item .setting-info { direction: ltr; }
.ltr-menu .nav-arrow { transform: scaleX(1); }

.settings-item:hover .nav-arrow { color: white; }

/* ====================================================================== */
/* CHECKMARK — selected state indicator */
/* ====================================================================== */

.checkmark {
    width: 20px;
    height: 20px;
    color: var(--primary-accent);
}

/* ====================================================================== */
/* GALLERY MENU — preview & select cosmetics */
/* ====================================================================== */

#galleryMenu.menu,
#shopMenu.menu,
#productsMenu.menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--color-off-white);
    backdrop-filter: none;
    background-image: none;
}

#galleryMenu.menu {
    padding: 95px 30px 0;
}

/* ====================================================================== */
/* SHOP MENU — buy currency (coins/diamonds) */
/* ====================================================================== */

#shopMenu.menu {
    padding: calc(var(--header-height) + 20px) 30px 20px;
}

/* ====================================================================== */
/* PRODUCTS MENU — buy balls & backgrounds */
/* ====================================================================== */

#productsMenu.menu {
    padding-top: calc(var(--header-height) + 20px);
    padding-bottom: 0;
    padding-left: 30px;
    padding-right: 10px;
}

#galleryMenu::before,
/* ====================================================================== */
/* DECORATIVE GLOW — behind shop/gallery/products panels */
/* ====================================================================== */

#shopMenu::before,
#productsMenu::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--color-white);
    border-bottom: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 101;
}

#galleryMenu::after,
#shopMenu::after,
#productsMenu::after {
    content: '';
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to bottom, var(--color-white), transparent);
    z-index: 102;
    pointer-events: none;
}

/* ====================================================================== */
/* CLOSE / BACK BUTTONS — shared back-button styling */
/* ====================================================================== */

/* Base styles for all close/back buttons */
.close-btn,
#shopMenu #shopBackBtn,
#galleryMenu #galleryActionBtn,
#productsMenu #productsBackBtn,
#settingsBackBtn,
#langBackBtn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    cursor: pointer;
    border: 3px solid var(--color-white);
    z-index: 200;
    background-color: var(--game-btn-green);
    box-shadow: 0 4px 0 var(--game-btn-shadow);
    position: absolute;
    top: -15px;
}

/* Fixed positioning for overlay menu back buttons */
#shopMenu #shopBackBtn,
#galleryMenu #galleryActionBtn,
#productsMenu #productsBackBtn {
    position: fixed;
}

/* Settings & language back button default top */
#settingsBackBtn,
#langBackBtn {
    top: -15px;
}

/* LTR positioning (right side) */
.close-btn,
#settingsBackBtn,
#langBackBtn {
    right: -15px;
    left: auto;
}

/* RTL positioning (left side) */
[dir="rtl"] .close-btn,
[dir="rtl"] #settingsBackBtn,
[dir="rtl"] #langBackBtn {
    left: -15px;
    right: auto;
}

/* Header-aligned back buttons (shop, gallery, products) */
#shopMenu #shopBackBtn,
#galleryMenu #galleryActionBtn,
#productsMenu #productsBackBtn {
    top: calc(var(--header-height) / 2);
    transform: translateY(-50%);
    left: 10px;
    right: auto;
    background-color: var(--color-slate);
    box-shadow: 0 4px 0 rgba(0,0,0,0.3);
    z-index: 200;
}

/* Active (pressed) state */
.close-btn:active,
#settingsBackBtn:active,
#langBackBtn:active {
    box-shadow: 0 0 0 var(--game-btn-shadow);
    transform: translateY(4px);
}

/* SVG icon sizing */
.close-btn svg,
#shopMenu #shopBackBtn svg,
#galleryMenu #galleryActionBtn svg,
#productsMenu #productsBackBtn svg,
#settingsBackBtn svg,
#langBackBtn svg {
    width: 60%;
    height: 60%;
    stroke-width: 4;
}

/* Transparent variant — non-settings close buttons have no border/bg */
.close-btn:not(#settingsBackBtn):not(#langBackBtn),
#shopMenu #shopBackBtn:not(#settingsBackBtn):not(#langBackBtn),
#galleryMenu #galleryActionBtn:not(#settingsBackBtn):not(#langBackBtn),
#productsMenu #productsBackBtn:not(#settingsBackBtn):not(#langBackBtn) {
    background: transparent;
    border: none;
    box-shadow: none;
}

.close-btn:not(#settingsBackBtn):not(#langBackBtn) {
    color: black;
}

.close-btn:not(#settingsBackBtn):not(#langBackBtn) svg,
#shopMenu #shopBackBtn:not(#settingsBackBtn):not(#langBackBtn) svg,
#galleryMenu #galleryActionBtn:not(#settingsBackBtn):not(#langBackBtn) svg,
#productsMenu #productsBackBtn:not(#settingsBackBtn):not(#langBackBtn) svg {
    stroke: black;
    color: black;
}

/* ====================================================================== */
/* MENU TITLE — large heading inside shop-style menus */
/* ====================================================================== */

#shopMenu .menu-title,
#galleryMenu .menu-title,
#productsMenu .menu-title {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    font-family: 'Changa', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    z-index: 105;
    pointer-events: none;
}

#productsMenu .menu-title {
    color: var(--color-black);
    text-shadow: none;
    -webkit-text-stroke: 0;
}

.shop-tabs-container {
    position: fixed;
    top: 0;
    right: 20px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    z-index: 160;
}

/* ====================================================================== */
/* SHOP TABS — coins vs diamonds switch */
/* ====================================================================== */

.unified-shop-tab {
    display: flex;
    align-items: center;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(30, 41, 59, 0.6);
}

/* ====================================================================== */
/* SHOP TAB HALF — individual tab inside the unified shop tab */
/* ====================================================================== */

.tab-half {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-half img {
    width: 20px;
    height: 20px;
    filter: grayscale(0.8) opacity(0.7);
}

.tab-half.active-tab-coins {
    background: linear-gradient(135deg, #FFC107 0%, #FF8F00 100%);
    box-shadow: 0 4px 10px rgba(255, 193, 7, 0.4);
}

.tab-half.active-tab-diamonds {
    background: linear-gradient(135deg, #00E5FF 0%, #0091EA 100%);
    box-shadow: 0 4px 10px rgba(0, 229, 255, 0.4);
}

.tab-half.active-tab-coins img,
.tab-half.active-tab-diamonds img {
    filter: none;
    transform: scale(1.1);
}

/* ====================================================================== */
/* SHOP ITEMS GRID — responsive grid of purchasable items */
/* ====================================================================== */

.shop-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    padding: 10px 10px 30px 10px;
    width: 100%;
    max-width: 1200px;
    scrollbar-width: thin;
    margin-top: 10px;
}

#shopContainerCoins,
#shopContainerDiamonds {
    grid-template-columns: repeat(4, 1fr);
    padding: 10px 0 30px 0;
    max-width: none;
    margin-top: 0;
}

#shopMenu .shop-item {
    gap: 0;
    min-height: 250px;
    justify-content: space-between;
    padding-bottom: 15px;
    padding-top: 20px;
}

#shopMenu .item-visual {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0;
}

#shopMenu .item-amount {
    margin: auto;
    font-size: 25px;
    -webkit-text-stroke: 0;
    text-shadow: none;
}

/* ====================================================================== */
/* SHOP ITEM — single product card */
/* ====================================================================== */

.shop-item {
    background-color: var(--color-panel-dark);
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.shop-item:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ====================================================================== */
/* ITEM VISUAL — icon/preview area at top of shop item */
/* ====================================================================== */

.item-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

#shopMenu .item-visual img {
    display: block;
    width: 70px;
    height: 70px;
    max-width: 70px;
    max-height: 70px;
    transform: none;
    margin-bottom: 5px;
    object-fit: contain;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.3));
}

.shop-item .item-visual img.shop-bg-preview {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    min-width: 0;
    max-width: none;
    min-height: 0;
    max-height: none;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.shop-item .item-visual img.shop-ball-preview {
    width: 60px;
    height: 60px;
    min-width: 0;
    max-width: none;
    min-height: 0;
    max-height: none;
    object-fit: contain;
    filter: drop-shadow(0 6px 6px rgba(0,0,0,0.4));
    margin-bottom: 5px;
}

.shop-item:hover .item-visual img {
    transform: scale(1.1);
}

#productsMenu .shop-item:hover .item-visual img {
    transform: none;
}

.item-amount {
    font-family: 'Luckiest Guy', cursive;
    font-size: 1.2rem;
    color: white;
    -webkit-text-stroke: 1.5px black;
    text-shadow: 3px 3px 0 var(--color-black);
}

/* ====================================================================== */
/* BUY BUTTON — price/owned label on each shop item */
/* ====================================================================== */

.buy-btn {
    background-color: var(--game-btn-green);
    color: white;
    border: 2px solid var(--color-white);
    border-radius: 8px;
    padding: 6px 0;
    font-family: 'Changa', sans-serif;
    font-weight: 900;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 3px 0 var(--game-btn-shadow), 0 6px 6px rgba(0,0,0,0.2);
    width: 100%;
    transition: all 0.1s;
    text-transform: uppercase;
}

.buy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 var(--game-btn-shadow), 0 8px 8px rgba(0,0,0,0.3);
}

.buy-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--game-btn-shadow);
}

.buy-btn.is-owned {
    background-color: var(--color-muted);
    border-color: var(--color-slate-light);
    color: #64748b;
    cursor: default;
    box-shadow: none;
}

/* ====================================================================== */
/* PRODUCTS SIDEBAR — Balls / Menu BG / Game BG */
/* ====================================================================== */

.products-sidebar-buttons {
    position: fixed;
    left: 0;
    top: calc(var(--header-height) + 30px);
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 20px;
    z-index: 110;
}

.products-sidebar-buttons::after {
    content: '';
    position: fixed;
    left: 280px;
    top: calc(var(--header-height) + 30px);
    bottom: 30px;
    width: 3px;
    background: var(--color-black);
    border-radius: 1px;
    pointer-events: none;
}

/* ====================================================================== */
/* PRODUCTS SIDEBAR BUTTON */
/* ====================================================================== */

.products-sidebar-btn {
    border: 3px solid var(--color-white);
    color: var(--color-white);
    font-family: 'Changa', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 12px 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.1s ease;
    border-radius: 8px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.products-sidebar-btn:hover {
    background: linear-gradient(145deg, var(--color-indigo), #1a2744);
}

#prodTabBalls,
#prodTabMenuBg,
#prodTabGameBg {
    background: linear-gradient(145deg, #1e2a4a, #131d35);
    box-shadow: 0 5px 0 var(--color-panel-darker), 0 8px 12px rgba(0,0,0,0.3);
}

#prodTabBalls:active,
#prodTabMenuBg:active,
#prodTabGameBg:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--color-panel-darker);
}

#prodTabBalls.active,
#prodTabMenuBg.active,
#prodTabGameBg.active {
    background: linear-gradient(145deg, var(--color-indigo), #1a2744);
    border-color: #00e89a;
    color: #00e89a;
    box-shadow: 0 3px 0 var(--color-panel-darker), 0 8px 12px rgba(0,0,0,0.3);
}

#productsMenu .shop-items-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 10px 10px 30px 270px;
    width: 100%;
    max-width: none;
    position: relative;
    margin-top: 0;
}

#productsMenu .shop-items-grid.bg-view {
    grid-template-columns: repeat(2, 1fr);
}

#productsMenu .shop-item {
    background: linear-gradient(145deg, #1e2a4a, #131d35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    padding: 20px 10px 15px;
    gap: 27px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: visible;
}

#productsMenu .shop-item.has-bg {
    padding-top: 15px;
    padding-bottom: 12px;
    gap: 10px;
}

#productsMenu .shop-item.has-bg .item-visual {
    margin-bottom: 0;
    position: relative;
    padding-bottom: 10px;
}

#productsMenu .shop-item.has-bg .item-visual::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    width: 80%;
    height: 1px;
    background: var(--color-white);
}

#productsMenu .shop-item:hover {
    transform: none;
}

#productsMenu .item-visual {
    width: 100%;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.shop-bg-preview {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.1);
}

#productsMenu .shop-ball-preview {
    width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 8px 8px rgba(0,0,0,0.5));
}

#productsMenu .item-amount {
    display: none;
}

#productsMenu .buy-btn {
    margin-top: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

#productsMenu .buy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 var(--game-btn-shadow), 0 8px 8px rgba(0,0,0,0.3);
}

#productsMenu .buy-btn img {
    width: 20px;
    height: 20px;
    display: block;
}

.shop-section-header {
    grid-column: 1 / -1;
    width: 100%;
    background-color: #161b24;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-top: 15px;
    margin-bottom: 15px;
    height: 40px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    border-radius: 25px;
    position: relative;
    left: 0;
}

.shop-section-header::before,
.shop-section-header::after {
    display: none;
}

.shop-section-header h2,
.header-balls h2,
.header-menu h2,
.header-game h2 {
    font-family: 'Luckiest Guy', cursive;
    font-size: 1.5rem;
    color: var(--color-off-white);
    -webkit-text-stroke: 2px var(--color-black);
    text-shadow: 0 5px 15px rgba(0,0,0,0.5);
    paint-order: stroke fill;
    letter-spacing: 2px;
    margin: 0;
    padding: 0;
    line-height: 1;
    text-transform: uppercase;
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.gallery-nav-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 102;
    pointer-events: none;
}

/* ====================================================================== */
/* DIVIDER — horizontal separator line */
/* ====================================================================== */

.divider {
    display: none;
}

/* ====================================================================== */
/* GALLERY ROOT — category selection cards */
/* ====================================================================== */

.category-container {
    display: flex;
    gap: 30px;
    width: 100%;
    max-width: 960px;
    justify-content: center;
    margin: auto;
    padding-bottom: 30px;
    flex-wrap: wrap;
    animation: fadeInUp 0.5s ease-out;
    z-index: 105;
}

/* ====================================================================== */
/* CATEGORY CARD — selectable card in the gallery root */
/* ====================================================================== */

.category-card {
    flex: 1;
    min-width: 340px;
    max-width: 600px;
    aspect-ratio: 16/10;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.game-theme {
    background-color: var(--game-btn-green);
    box-shadow: 0 6px 0 var(--game-btn-shadow), 0 12px 12px rgba(0,0,0,0.3);
}

.menu-theme {
    background-color: #3498db;
    box-shadow: 0 6px 0 #1f618d, 0 12px 12px rgba(0,0,0,0.3);
}

.category-card:hover {
    transform: translateY(-5px);
}

.category-card:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.2) inset;
}

.category-card .card-icon {
    width: 80px;
    height: 80px;
    color: white;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 0 rgba(0,0,0,0.2));
}

.category-card .card-icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 2.5;
}

.category-card span {
    font-family: 'Changa', sans-serif;
    font-size: 34px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.gallery-view-container {
    width: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.4s ease-out;
}

/* ====================================================================== */
/* BACKGROUNDS GRID — owned backgrounds gallery */
/* ====================================================================== */

.backgrounds-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 15px;
    row-gap: 15px;
    width: 100%;
    padding: 0 0 30px 0;
    overflow-y: visible;
    scrollbar-width: thin;
    margin-top: 0;
}

.bg-option {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    background-color: #1e293b;
    aspect-ratio: 16/9;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 12px rgba(0,0,0,0.3);
}

.bg-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7) grayscale(0.3);
}

.bg-option.skin-mode {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-option.skin-mode img {
    width: 75%;
    height: 75%;
    object-fit: contain;
}

.bg-option:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.5);
}

.bg-option.selected {
    border-color: #00E676;
    box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.2), 0 15px 30px rgba(0, 200, 83, 0.4);
    transform: scale(1.02);
}

.bg-option.selected img { filter: brightness(1) grayscale(0); }

.bg-option.selected::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 40px;
    height: 40px;
    background-color: #00C853;
    border-radius: 50%;
    border: 2px solid var(--color-white);

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center;
    animation: popIn 0.4s forwards;
}

.bg-option.locked { pointer-events: none; border-color: #e74c3c; }

.bg-option.locked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 5;
}

.bg-option.locked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e74c3c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'%3E%3C/rect%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.8));
    z-index: 6;
    animation: lockPulse 2s infinite;
}

.score-wrapper-relative {
    position: relative;
    display: flex;
    align-items: center;

    flex: 1 1 0;
    width: calc(42% - 6px);
    max-width: calc(42% - 6px);
    min-width: 0;
    box-sizing: border-box;
}

.score-wrapper-relative .final-score-container {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
}

/* ====================================================================== */
/* MULTIPLIER TAG — x2 badge shown on win screen */
/* ====================================================================== */

.multiplier-tag {
    background-color: #ffeb3b;
    color: var(--color-orange-dark);
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Luckiest Guy', cursive;
    border: 2px solid var(--color-white);
    transform: rotate(10deg);
    animation: pulseBadge 1s infinite;
    position: absolute;
    top: -15px;
    right: -8px;
    left: auto;
    z-index: 10;
}

/* ====================================================================== */
/* MENU BANNER — large WIN/LOSE label */
/* ====================================================================== */

.menu-banner {

    width: 92%;
    max-width: 450px;
    margin: 0 auto;
    padding: 10px 20px;

    border-radius: 28px 28px 0 0;
    border: 3px solid transparent;
    border-bottom: none;

    font-family: 'Luckiest Guy', cursive;
    font-size: 1.6rem;
    text-align: center;
    color: var(--color-white);
    letter-spacing: 2px;

    animation: fadeInUp 0.5s ease-out;

    margin-bottom: -3px;
    position: relative;
    z-index: 2;
    box-sizing: border-box;
}

.win-banner {
    background:
        linear-gradient(180deg, var(--color-gold) 0%, var(--color-warning-bright) 60%, #c47100 100%);
    border-color: rgba(255, 215, 0, 0.85);
    color: #2a1500;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4), 0 -1px 0 rgba(0, 0, 0, 0.3);
    box-shadow:
        0 0 0 2px rgba(0, 0, 0, 0.5),
        0 -10px 25px rgba(255, 215, 0, 0.30),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -2px 4px rgba(0, 0, 0, 0.25);
}

.lose-banner {
    position: absolute;
    bottom: 100%;
    left: 28px;
    right: 28px;
    width: auto;
    max-width: none;
    margin: 0;
    border-radius: 24px 24px 0 0;
    border: 3px solid rgba(255, 60, 60, 0.7);
    border-bottom: none;
    z-index: 5;

    background:
        linear-gradient(180deg, #ff5050 0%, #c41020 60%, #5c0f18 100%);
    color: var(--color-white);
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5), 0 0 12px rgba(255, 30, 30, 0.7);

    box-shadow:
        0 -10px 25px rgba(255, 30, 30, 0.30),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* #levelCompleteMenu.menu — defined later with level-complete section (avoids duplicate) */

#levelCompleteTitle {
    font-size: 4rem;
    background: linear-gradient(180deg, #fff8c4 0%, var(--color-gold) 45%, var(--color-warning-bright) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 1px rgba(120, 80, 0, 0.6);
    text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 30px rgba(255, 215, 0, 0.6);
    margin-bottom: 5px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
    direction: ltr;
    position: relative;
    z-index: 1;
}

/* #winLevelDisplay — defined later with level-complete section (avoids duplicate) */

#gameOverMenu.menu {
    background: linear-gradient(135deg, var(--color-danger-bright) 0%, var(--color-danger) 50%, var(--color-deep-red) 100%);
    background-color: var(--color-danger);
    border: 5px solid var(--color-white);
    border-radius: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6), inset 0 0 0 5px rgba(255,255,255,0.2), 0 0 30px rgba(200, 16, 46, 0.5);
    padding: 30px;
    width: 92%;
    max-width: 450px;

    opacity: 0;
    transform: translateY(-120vh) rotate(-3deg);
    transform-origin: center top;
}
#gameOverMenu.menu:not(.hidden) {

    animation: cardDrop 1.5s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

@keyframes cardDrop {
    0% {
        transform: translateY(-120vh) rotate(-3deg);
        opacity: 0;
    }
    8% {
        opacity: 1;
    }

    45% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    52% {
        transform: translateY(-18px) rotate(7deg);
    }

    62% {
        transform: translateY(-6px) rotate(-6deg);
    }

    72% {
        transform: translateY(-10px) rotate(4deg);
    }

    82% {
        transform: translateY(-3px) rotate(-2deg);
    }
    90% {
        transform: translateY(-2px) rotate(1deg);
    }
    100% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
}

#gameOverMenu.menu::before { display: none; content: none; }

#gameOverMenu h1 {
    font-size: 50px;
    color: var(--color-white);
    background: none;
    -webkit-text-fill-color: var(--color-white);
    -webkit-text-stroke: 0;
    text-shadow: 0 4px 0 rgba(0,0,0,0.3), 0 0 20px rgba(255,255,255,0.4);
    margin-bottom: 8px;
    direction: rtl;
}

.gameover-buttons {
    display: flex; flex-direction: row;
    justify-content: center; align-items: center;
    gap: 17px; width: 100%; flex-wrap: nowrap;
    margin-top: 10px;
}

#gameOverMenu .gameover-buttons .button:not(.icon-btn) {
    flex: 1 1 0; min-width: 0; width: auto;
    max-width: 50%; margin: 0; padding: 10px 8px;
    font-size: 1rem; white-space: nowrap; box-sizing: border-box;
}

.final-scores-wrapper-win, #final-scores-wrapper {
    display: flex; flex-direction: row;
    justify-content: center; align-items: center;
    gap: 12px; width: 100%; flex-wrap: nowrap;
    margin-bottom: 10px;
}

.final-scores-wrapper-win {
    position: relative;
    z-index: 1;
}

/* ====================================================================== */
/* FINAL SCORE CONTAINER — coin/diamond tally on win/lose */
/* ====================================================================== */

.final-score-container {
    display: flex; flex-direction: row;
    align-items: center; justify-content: center;
    gap: 5px; flex: 1 1 0; min-width: 0;
    max-width: 42%; background-color: rgba(0, 0, 0, 0.3);
    padding: 8px 12px; border-radius: 15px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
    min-width: 80px; border: 2px solid rgba(255,255,255,0.4);
    box-sizing: border-box;
}

.final-score-container img {
    height: 25px;
    width: auto;
    vertical-align: middle;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.final-score-container span {
    font-family: 'Luckiest Guy', cursive; font-size: 1.5rem; color: var(--color-white);
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3); white-space: nowrap;
    display: flex; align-items: center; justify-content: center;
    line-height: 1; margin: 0;

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

#confirmExitMenu.menu,
#purchaseConfirmMenu.menu,
#genericAlertMenu.menu {
    background: linear-gradient(145deg, rgba(18, 24, 38, 0.97), rgba(22, 32, 50, 0.98));
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0.75),
                0 0 40px rgba(0, 167, 142, 0.15),
                0 20px 40px rgba(0,0,0,0.5),
                inset 0 1px 0 rgba(255,255,255,0.05);
    z-index: 300;
    position: absolute;
    width: 90%;
    max-width: 340px;
    padding: 28px 24px;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

#confirmExitMenu.menu {

    width: auto;
    max-width: 92%;
    min-width: 240px;
    padding: 34px 30px;
    border: 5px solid var(--color-white);
}

/* --- Game Over variant (red gradient + glow) --- */
#confirmExitMenu.confirm-from-gameover {
    background: linear-gradient(135deg, var(--color-danger-bright) 0%, var(--color-danger) 50%, var(--color-deep-red) 100%);
    border: 5px solid var(--color-white);
    border-radius: 30px;
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0.75),
                0 20px 50px rgba(0,0,0,0.6),
                inset 0 0 0 5px rgba(255,255,255,0.2),
                0 0 30px rgba(200, 16, 46, 0.5);
}
#confirmExitMenu.confirm-from-gameover h1 {
    text-shadow: none;
}

/* --- Win variant (green solid + glow) --- */
#confirmExitMenu.confirm-from-win {
    background: var(--color-success);
    border: 5px solid var(--color-white);
    border-radius: 30px;
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0.75),
                0 20px 50px rgba(0,0,0,0.6),
                inset 0 0 0 5px rgba(255,255,255,0.2),
                0 0 30px rgba(30, 132, 73, 0.6);
}
#confirmExitMenu.confirm-from-win h1 {
    text-shadow: none;
}

/* --- Shared glass-morphism styles for gameover & win buttons --- */
#confirmExitMenu.confirm-from-gameover h1,
#confirmExitMenu.confirm-from-win h1 {
    color: var(--color-white);
    font-size: 1.25rem;
}

#confirmExitMenu.confirm-from-gameover #confirmExitBtn,
#confirmExitMenu.confirm-from-win #confirmExitBtn {
    background: rgba(255, 255, 255, 0.28);
    border: 2px solid rgba(255, 255, 255, 0.7);
    color: var(--color-white);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.25);
    backdrop-filter: blur(5px);
}

#confirmExitMenu.confirm-from-gameover #confirmExitBtn:hover,
#confirmExitMenu.confirm-from-win #confirmExitBtn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.35);
}

#confirmExitMenu.confirm-from-gameover #confirmExitBtn:active,
#confirmExitMenu.confirm-from-win #confirmExitBtn:active {
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(0) scale(0.97);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

#confirmExitMenu.confirm-from-gameover #cancelExitBtn,
#confirmExitMenu.confirm-from-win #cancelExitBtn {
    background: rgba(255, 255, 255, 0.10);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: rgba(255,255,255,0.8);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    backdrop-filter: blur(5px);
}

#confirmExitMenu.confirm-from-gameover #cancelExitBtn:hover,
#confirmExitMenu.confirm-from-win #cancelExitBtn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255,255,255,0.6);
    color: var(--color-white);
    transform: translateY(-2px);
}

#confirmExitMenu.confirm-from-gameover #cancelExitBtn:active,
#confirmExitMenu.confirm-from-win #cancelExitBtn:active {
    transform: translateY(0) scale(0.97);
}

#confirmExitMenu.confirm-from-settings {
    background: linear-gradient(135deg, var(--color-blue-dark), var(--color-slate));
    border: 4px solid var(--color-white);
    border-radius: 25px;
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0.75),
                0 15px 0 rgba(0,0,0,0.3),
                0 20px 30px rgba(0,0,0,0.4);
}
#confirmExitMenu.confirm-from-settings h1 {
    color: var(--color-white);
    text-shadow: none;
    font-size: 1.25rem;
}
#confirmExitMenu.confirm-from-settings #confirmExitBtn {
    background: var(--game-btn-green);
    border: 3px solid var(--color-white);
    color: var(--color-white);
    box-shadow: 0 4px 0 var(--game-btn-shadow), 0 5px 10px rgba(0,0,0,0.3);
    border-radius: 40px;
}
#confirmExitMenu.confirm-from-settings #confirmExitBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--game-btn-shadow), 0 7px 14px rgba(0,0,0,0.3);
}
#confirmExitMenu.confirm-from-settings #confirmExitBtn:active {
    transform: translateY(2px);
    box-shadow: 0 0 0 var(--game-btn-shadow);
}
#confirmExitMenu.confirm-from-settings #cancelExitBtn {
    background: var(--color-panel-dark);
    border: 2px solid rgba(255,255,255,0.2);
    color: var(--color-white);
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
}
#confirmExitMenu.confirm-from-settings #cancelExitBtn:hover {
    background: #263545;
    transform: translateY(-1px);
}
#confirmExitMenu.confirm-from-settings #cancelExitBtn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}

#purchaseConfirmMenu.menu,
#genericAlertMenu.menu {
    border: 2px solid var(--primary-accent);
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0.75),
                0 0 30px rgba(0, 167, 142, 0.2),
                0 0 60px rgba(0, 167, 142, 0.08),
                0 20px 40px rgba(0,0,0,0.5),
                inset 0 1px 0 rgba(255,255,255,0.08);
}

#confirmExitMenu h1,
#purchaseConfirmMenu h1,
#genericAlertMenu h2 {
    color: var(--text-light);
    text-shadow: none;
    text-align: center;
    width: 100%;
}
#confirmExitMenu h1 {
    margin-bottom: 12px;
    font-size: 1.25rem;
    white-space: nowrap;
    unicode-bidi: plaintext;
}
#purchaseConfirmMenu h1,
#genericAlertMenu h2 {
    margin-bottom: 8px;
    font-size: 1.3rem;
}

#purchaseConfirmMenu h2 {
    color: var(--text-dark);
    margin-bottom: 20px;
    direction: ltr;
    font-size: 1.05rem;
    text-align: center;
    line-height: 1.5;
    padding: 0 4px;
    unicode-bidi: plaintext;
}

#genericAlertMenu h2 {
    color: var(--text-dark);
    margin-bottom: 15px;
    direction: ltr;
    font-size: 1.2rem;
    unicode-bidi: plaintext;
}

#confirmExitMenu .confirm-buttons {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 10px;
    width: auto;
    margin-top: 8px;
}
#confirmExitMenu .confirm-buttons .button {
    flex: 0 0 auto;
    min-width: 0;
    padding: 8px 14px;
    min-height: 34px;
    font-size: 0.85rem;
    font-family: 'Changa', sans-serif;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease-out;
    text-align: center;
}

#confirmExitBtn,
#purchaseConfirmBtn {
    background: linear-gradient(145deg, var(--primary-accent), var(--primary-accent-dark));
    color: var(--text-light);
    box-shadow: 0 4px 12px rgba(0, 167, 142, 0.3),
                inset 0 1px 1px rgba(255,255,255,0.2);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
#confirmExitBtn:hover,
#purchaseConfirmBtn:hover {
    background: linear-gradient(145deg, #00BF9E, #008F78);
    box-shadow: 0 6px 16px rgba(0, 167, 142, 0.4),
                inset 0 1px 1px rgba(255,255,255,0.3);
    transform: translateY(-1px);
}
#confirmExitBtn:active,
#purchaseConfirmBtn:active {
    transform: translateY(1px) scale(0.97);
    box-shadow: 0 2px 6px rgba(0, 167, 142, 0.3);
}

#cancelExitBtn,
#purchaseCancelBtn {
    background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
    color: var(--text-dark);
    border: 1.5px solid rgba(255,255,255,0.12);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
#cancelExitBtn:hover,
#purchaseCancelBtn:hover {
    background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
    border-color: rgba(255,255,255,0.2);
    color: var(--text-light);
    transform: translateY(-1px);
}
#cancelExitBtn:active,
#purchaseCancelBtn:active {
    transform: translateY(1px) scale(0.97);
}

#purchaseConfirmMenu .confirm-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 8px;
}

#purchaseConfirmMenu .confirm-buttons .button {
    flex: 1;
    min-width: 0;
    padding: 12px 8px;
    min-height: 44px;
    font-size: 0.95rem;
    font-family: 'Changa', sans-serif;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease-out;
    text-align: center;
}

@keyframes rotatePhone {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-90deg); }
    50% { transform: rotate(-90deg); }
    75% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

@keyframes pulseBadge {
    0% { transform: scale(1) rotate(10deg); }
    50% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(10deg); }
}

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

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

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

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

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

.menu-title {
    font-family: 'Changa', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-black);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 1.5px;
    margin-top: 5px;
}

#gameTitle {
    font-family: 'Luckiest Guy', cursive;
    font-size: clamp(3rem, 12vw, 8rem);
    color: white;
    text-transform: uppercase;
    line-height: 0.95;
    margin-bottom: 80px;
    transform: rotate(-3deg);
    -webkit-text-stroke: 2px black;
    text-shadow: 4px 4px 0px var(--color-black), 8px 8px 0px var(--game-title-shadow);
}

html[lang="ar"] #gameTitle {
    -webkit-text-stroke: 3px black;
    paint-order: stroke fill;
}

html[lang="ar"] #menuLevelDisplay {
    -webkit-text-stroke: 2px black;
    paint-order: stroke fill;
}

#settingsTitleDisplay {
    color: white;
    text-shadow: none;
    -webkit-text-stroke: 0;
}

.menu:not(#startMenu) h1:not(.menu-title) {
    font-family: 'Changa', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5em;
    text-shadow: 0 0 15px var(--accent-glow);
    color: var(--color-white);
    -webkit-text-stroke: 0;
}

#startBtn {
    background: var(--game-btn-green);
    border: 4px solid white;
    border-radius: 50px;
    color: white;
    font-family: 'Changa', sans-serif;
    font-weight: 900;
    font-size: 1.5rem;
    text-transform: uppercase;
    padding: 15px 40px;
    width: auto;
    min-width: 200px;
    max-width: 300px;
    box-shadow: 0 8px 0 var(--game-btn-shadow), 0 15px 20px rgba(0,0,0,0.2);
    transition: all 0.1s ease;
    margin-top: 50px;
}

#startBtn:hover {
    transform: translateY(-2px);
    background: #00ed9d;
}

#startBtn:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 var(--game-btn-shadow);
}

.button:not(#startBtn) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0.6em 1.2em;
    min-height: 45px;
    width: 100%;
    max-width: 280px;
    font-family: 'Changa', sans-serif;
    font-weight: 700;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--primary-accent), var(--primary-accent-dark));
    color: var(--text-light);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.2), 0 0 0 1px rgba(0,0,0,0.4);
    transition: all 0.2s ease-out;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.button:not(#startBtn):active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
}

/* ====================================================================== */
/* HEADER 3D BUTTONS — gallery / shop / settings */
/* ====================================================================== */

.green-3d-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 30% 30%, var(--color-accent-bright), #009688);
    border: 3px solid var(--color-white);
    box-shadow: 0 6px 0 #005f52, 0 10px 10px rgba(0,0,0,0.3);
    color: white;
    transition: all 0.1s ease;
    outline: none;
}

.green-3d-btn svg {
    width: 55%;
    height: 55%;
    stroke-width: 2.5;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.green-3d-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #005f52;
}

#restartBtn,
#nextLevelBtn,
#gameOverMenuBtn {
    width: 100%;
    padding: 10px 0;
    font-size: 1.4rem;
    font-family: 'Luckiest Guy', cursive;
    text-transform: uppercase;
    color: white;
    border: 3px solid var(--color-white);
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.1s;
    margin-top: 10px;
}

#nextLevelBtn {
    background: linear-gradient(to bottom, #2ecc71, #27ae60);
    box-shadow: 0 6px 0 var(--color-success), 0 5px 10px rgba(0,0,0,0.3);
}

#nextLevelBtn:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 var(--color-success);
}

#restartBtn {
    background: linear-gradient(to bottom, var(--color-warning), var(--color-orange-dark));
    box-shadow: 0 6px 0 var(--color-brown), 0 5px 10px rgba(0,0,0,0.3);
}

#restartBtn:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 var(--color-brown);
}

#gameOverMenuBtn {
    background: linear-gradient(to bottom, var(--color-muted), #333);
    box-shadow: 0 6px 0 #111, 0 5px 10px rgba(0,0,0,0.3);
}

#gameOverMenuBtn:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 #111;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--color-panel-dark);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: white;
    font-family: 'Changa', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 10px;
    pointer-events: auto;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 10px var(--primary-glow);
}

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

/* ====================================================================== */
/* CONFIRM DIALOG BUTTONS */
/* ====================================================================== */

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

.confirm-buttons .button {
    flex: 1;
    min-width: 100px;
    padding: 0.5em 1em;
    min-height: 40px;
    font-size: 0.9rem;
}

::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* ====================================================================== */
/* TOUCH CONTROLS — on-screen movement & jump buttons */
/* ====================================================================== */

#touch-controls {
    position: fixed;
    bottom: 20px;
    left: 0;
    width: 100%;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 200;
    pointer-events: none;
    height: 100px;
}

#move-controls-container,
/* ====================================================================== */
/* ACTION CONTROLS — jump button */
/* ====================================================================== */

#action-controls-container {
    display: flex;
    gap: 20px;
    pointer-events: auto;
}

/* ====================================================================== */
/* CONTROL BUTTON — generic on-screen control button */
/* ====================================================================== */

.control-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.05) 70%);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.1s, background 0.1s;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.control-btn svg {
    width: 30px;
    height: 30px;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
}

.control-btn:active {
    transform: scale(0.92);
    background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.1) 70%);
    border-color: rgba(255, 255, 255, 0.8);
}

#levelSelectMenu.menu {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 20px 20px 40px 20px;
    gap: 0;
    width: 100%;
    max-width: none;
    max-height: none;
    height: 100%;
    margin: 0;
    overflow: hidden;
    box-sizing: border-box;
    position: fixed;
    top: 0;
    left: 0;
}

#levelSelectMenu .menu-title {
    color: var(--color-white);
    margin: 0;
    font-size: 1.8rem;
    line-height: 1;
    flex-shrink: 0;
    align-self: flex-start;
}

#levelSelectMenu #levelSelectBackBtn.close-btn svg {
    stroke: var(--color-white);
    color: var(--color-white);
}

html:not([lang="ar"]) #levelSelectMenu #levelSelectBackBtn.close-btn svg {
    transform: scaleX(-1);
}

#levelSelectMenu #levelSelectBackBtn.close-btn {
    color: var(--color-white);
    background: transparent;
    border: none;
    box-shadow: none;
    right: 10px;
    left: auto;
    top: 10px;
}

html[lang="ar"] #levelSelectMenu #levelSelectBackBtn.close-btn {
    left: 10px;
    right: auto;
}

html:not([lang="ar"]) #levelSelectMenu .menu-title {
    align-self: flex-end;
}

/* ====================================================================== */
/* LEVEL GRID — paginated level selector layout */
/* ====================================================================== */

.level-grid-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    width: 100%;
    padding-bottom: 20px;
}

.level-grid-row {
    display: grid;
    grid-template-columns: minmax(60px, 1fr) minmax(auto, 750px) minmax(60px, 1fr);
    align-items: center;
    width: 100%;
}

/* ====================================================================== */
/* LEVEL PAGINATION ARROWS */
/* ====================================================================== */

.level-page-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: white;
    opacity: 0.7;
    transition: opacity 0.1s;
}

.level-page-arrow:hover {
    opacity: 1;
}

.level-page-arrow svg {
    width: 100px;
    height: 100px;
    display: block;
}

.level-page-arrow:first-child {
    justify-self: center;
}

.level-page-arrow:last-child {
    justify-self: center;
}

/* ====================================================================== */
/* LEVEL GRID CELLS */
/* ====================================================================== */

.level-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-auto-rows: auto;
    gap: 8px;
    max-width: min(750px, calc((100vh - 240px) * 2));
    width: 100%;
    padding: 0;
}

.level-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 8px;
    font-family: 'Changa', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.1s ease;
    border: 3px solid rgba(255,255,255,0.2);
    background-color: var(--color-panel-dark);
    color: white;
    box-shadow: 0 6px 0 rgba(0,0,0,0.35), inset 0 -3px 5px rgba(0,0,0,0.15);
}

.level-cell.animate {
    animation: cellAppear 0.3s ease backwards;
    animation-delay: var(--delay, 0s);
}

.level-cell:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.35), inset 0 -1px 2px rgba(0,0,0,0.1);
}

.level-cell.current {
    background-color: var(--game-btn-green);
    border-color: var(--color-white);
    color: var(--color-white);
    box-shadow: 0 6px 0 var(--game-btn-shadow), 0 0 14px rgba(0,214,143,0.5), inset 0 -3px 5px rgba(0,0,0,0.15);
}

.level-cell.current:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 var(--game-btn-shadow), 0 0 8px rgba(0,214,143,0.3), inset 0 -1px 2px rgba(0,0,0,0.1);
}

.level-cell.locked {
    background-color: #0f1420;
    color: var(--color-slate-light);
    border-color: rgba(255,255,255,0.05);
    cursor: not-allowed;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2), inset 0 1px 3px rgba(0,0,0,0.3);
}

.level-cell.completed {
    background-color: #2d3748;
    border-color: var(--color-white);
    color: var(--color-white);
    box-shadow: 0 5px 0 rgba(0,0,0,0.3), inset 0 -3px 5px rgba(0,0,0,0.1);
}

.level-cell.completed:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.3), inset 0 -1px 2px rgba(0,0,0,0.1);
}

.page-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--color-white);
    background-color: var(--game-btn-green);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 0 var(--game-btn-shadow);
    transition: all 0.1s;
}

.page-btn:active {
    transform: translateY(3px);
    box-shadow: 0 0 0 var(--game-btn-shadow);
}

/* ====================================================================== */
/* LEVEL SELECT — Play button */
/* ====================================================================== */

.level-play-btn {
    background: var(--game-btn-green);
    border: 3px solid white;
    border-radius: 40px;
    color: white;
    font-family: 'Changa', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    text-transform: uppercase;
    padding: 10px 30px;
    width: 100%;
    max-width: 750px;
    box-shadow: 0 6px 0 var(--game-btn-shadow), 0 10px 15px rgba(0,0,0,0.2);
    transition: all 0.1s ease;
    cursor: pointer;
}

.level-play-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 var(--game-btn-shadow);
}

.menu-banner.lose-banner, #loseBanner, .lose-banner { display: none; }

#gameOverMenu.menu.hidden {
    display: none;
}
#gameOverMenu.menu:not(.hidden) {
    display: flex;

}

#gameOverMenu .button, #restartBtn, #gameOverMenuBtn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.6);
    color: var(--color-white);
    box-shadow: none;
    backdrop-filter: blur(5px);
}
#restartBtn:hover, #gameOverMenuBtn:hover,
#restartBtn:active, #gameOverMenuBtn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: none;
    box-shadow: none;
}

#gameOverMenu h1#gameOverTitle, #gameOverTitle {
    color: var(--color-white);
    -webkit-text-fill-color: var(--color-white);
    background: none;
}

#loseLevelDisplay {
    color: var(--color-white);
    text-shadow: 0 2px 0 rgba(0,0,0,0.3), 0 0 10px rgba(255,255,255,0.4);
    margin-bottom: 30px;
    font-size: 1.3rem;
    font-family: 'Luckiest Guy', cursive;
    letter-spacing: 2px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.menu-banner.win-banner, #winBanner, .win-banner { display: none; }

#levelCompleteMenu.menu {
    background: var(--color-success);
    background-color: var(--color-success);
    border: 5px solid var(--color-white);
    border-radius: 30px;
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6), inset 0 0 0 5px rgba(255,255,255,0.2), 0 0 30px rgba(30, 132, 73, 0.6);
    padding: 30px;
    padding-top: 30px;
    width: 92%;
    max-width: 450px;

    opacity: 0;
    transform: translateY(-120vh) rotate(-3deg);
    transform-origin: center top;
    overflow: visible;
}
#levelCompleteMenu.menu:not(.hidden) {
    display: flex;
    animation: cardDrop 1.5s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}
#levelCompleteMenu.menu.hidden {
    display: none;
}

#levelCompleteMenu h1, #levelCompleteTitle {
    color: var(--color-white);
    -webkit-text-fill-color: var(--color-white);
    background: none;
    -webkit-text-stroke: 0;
    font-size: 50px;
    text-shadow: 0 4px 0 rgba(0,0,0,0.3), 0 0 20px rgba(255,255,255,0.5);
    margin-bottom: 8px;
    filter: none;
    direction: rtl;
    position: relative;
    z-index: 1;
}

#winLevelDisplay {
    color: var(--color-white);
    text-shadow: 0 2px 0 rgba(0,0,0,0.3), 0 0 10px rgba(255,255,255,0.4);
    margin-bottom: 30px;
    font-size: 1.3rem;
    position: relative;
    z-index: 1;
}

.final-scores-wrapper-win > .final-score-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 15px;
    border: 2px solid rgba(255,255,255,0.2);
    flex: 1 1 0;
    width: calc(42% - 6px);
    max-width: calc(42% - 6px);
}
.final-scores-wrapper-win > .final-score-container img { height: 25px; }
.final-scores-wrapper-win > .final-score-container span { font-size: 1.5rem; color: var(--color-white); }

.final-scores-wrapper-win .score-wrapper-relative .final-score-container {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
}

.win-buttons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 17px;
    width: 100%;
    flex-wrap: nowrap;
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

#gameOverMenu .button.icon-btn,
#levelCompleteMenu .button.icon-btn {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;

    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.7);
    color: var(--color-white);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.25);
    backdrop-filter: blur(5px);
    border-radius: 50%;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
#gameOverMenu .button.icon-btn svg,
#levelCompleteMenu .button.icon-btn svg {
    width: 34px;
    height: 34px;
    display: block;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
}
#gameOverMenu .button.icon-btn:hover,
#levelCompleteMenu .button.icon-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.35);
}
#gameOverMenu .button.icon-btn:active,
#levelCompleteMenu .button.icon-btn:active {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

