/* ============================================================
   CHECKERS GAME — style.css
   ============================================================
   Visual stylesheet for the Checkers game UI. All screens
   (home, levels, difficulty, shop, coin shop, game board,
   settings, boards/pieces pickers, modals) are styled here.

   Style language:
     - Wooden / royal casino palette (browns + gold accents)
     - Cairo variable font for all text
     - FontAwesome icons for buttons and badges
     - Mobile-first single-column layout, max 480px wide
     - Responsive @media queries at the bottom of the file

   File map (top -> bottom):
     1. Reset / base body                       (~L1)
     2. App wrapper & layout containers         (~L19)
     3. Coins badge & add-coins button          (~L49)
     4. Top shop button                         (~L101)
     5. Logo / title badge                      (~L121)
     6. Homepage action buttons                 (~L163)
     7. Shared page headers & coins pill        (~L222)
     8. Levels page styles                      (~L296)
     9. Difficulty page styles                 (~L397)
    10. Shop page styles                        (~L507)
    11. Coin shop page styles                  (~L640)
    12. Icon buttons (back / settings)         (~L717)
    13. Settings panel & overlay               (~L742)
    14. Page-visibility state rules             (~L786)
    15. Game container & captured-info bar     (~L826)
    16. Board grid & squares (themes)          (~L872)
    17. Pieces, king, selected & moves         (~L1059)
    18. Modal overlays                         (~L1118)
    19. Modal window boxes                     (~L1134)
    20. Theme & Pieces selection grids         (~L1163)
    21. Confirm modals & action buttons        (~L1215)
    22. @media tablet (>=768px)                (~L1286)
    23. @media small phone (360-767px)         (~L1428)
    24. @media max-width 767px                 (~L1496)
   ============================================================ */

/* ===== 1. RESET / BASE BODY ===== */
body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    background: #000000;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
    color: #eee;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    box-sizing: border-box;
}

/* ===== 2. APP WRAPPER & LAYOUT CONTAINERS ===== */
#app-wrapper {
    position: relative;
    height: 100vh;
    width: min(100vw, calc(100vh * (9 / 16)));
    max-width: 480px;
    background: radial-gradient(circle at center, #5c351b 0%, #351c0d 60%, #1c0e06 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: none;
    border-radius: 0;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
    box-sizing: border-box;
}

.centered-flex-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    width: 100%;
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
    position: relative;
}

/* ===== 3. COINS BADGE & ADD-COINS BUTTON ===== */
.coins-badge-container {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(180deg, #4a2711 0%, #2a1508 100%);
    border: 2px solid #a36934;
    border-radius: 20px;
    padding: 4px 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(255, 215, 0, 0.2);
    z-index: 20;
    cursor: pointer;
}

.coin-icon-wrapper {
    font-size: 1.15em;
    color: #ffd700;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
    display: flex;
    align-items: center;
}

.coins-amount {
    font-size: 1.05em;
    font-weight: 900;
    color: #fff2c6;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    min-width: 25px;
    text-align: center;
}

.add-coins-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffca28 0%, #f57f17 100%);
    border: 1px solid #ffe082;
    color: #3e2005;
    font-size: 0.75em;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease;
    padding: 0;
}

.add-coins-btn:hover { transform: scale(1.18); }

/* ===== 4. TOP SHOP BUTTON ===== */
.top-shop-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.65em;
    color: #ffca28;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    z-index: 20;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.8));
    transition: transform 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-shop-btn:hover { color: #ffffff; transform: scale(1.18); }

/* ===== 5. LOGO / TITLE BADGE ===== */
.logo-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    transform: translateY(-20px);
}

.crown-icon-wrapper {
    font-size: 2.3em;
    color: #ffca28;
    margin-bottom: -4px;
    filter: drop-shadow(0 0 8px rgba(255, 202, 40, 0.6));
}

.royal-title {
    font-family: 'Cairo', sans-serif;
    font-size: 3em;
    font-weight: 900;
    letter-spacing: 2px;
    margin: 0;
    color: #ffca28;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.9), 0 0 16px rgba(255, 202, 40, 0.3);
    line-height: 1.1;
}

.royal-divider {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #d1a56f;
    font-size: 0.85em;
    margin-top: 2px;
}

.royal-divider .subtitle {
    letter-spacing: 2px;
    font-size: 0.8em;
    font-weight: 700;
    color: #e8c688;
}

/* ===== 6. HOMEPAGE ACTION BUTTONS ===== */
#homepage-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 290px;
}

.wood-action-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 9px 14px;
    width: 100%;
    background: linear-gradient(180deg, #6c3b1a 0%, #4a240d 48%, #361706 52%, #4d230d 100%);
    border: 2px solid #a36934;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6),
                inset 0 1px 2px rgba(255, 235, 175, 0.4),
                inset 0 -2px 4px rgba(0, 0, 0, 0.7);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.wood-action-btn:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: #ffd700;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.7), 0 0 12px rgba(255, 215, 0, 0.3);
}

.btn-icon-holder {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle at 35% 35%, #9b5a26 0%, #441d06 100%);
    border: 2px solid #d49847;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25em;
    color: #ffeb99;
    box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.3), 0 2px 4px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.btn-text-holder {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-left: 12px;
    flex-grow: 1;
    text-align: left;
}

.btn-main-title { font-size: 1.18em; font-weight: 800; color: #fff2c6; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9); }

/* ===== 7. SHARED PAGE HEADERS & COINS PILL ===== */
.btn-arrow { font-size: 1em; color: #d49847; }

.page-top-header {
    text-align: center;
    width: 100%;
    margin-top: 5px;
    margin-bottom: 10px;
    position: relative;
}

.page-coins-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.5);
    border: 1px solid #ffd700;
    color: #ffd700;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.95em;
    font-weight: 800;
    margin-top: 6px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.page-coins-pill:hover { transform: scale(1.05); }

.top-right-coins {
    position: absolute;
    top: 18px;
    right: 18px;
    margin-top: 0;
    z-index: 10;
}

.shop-coins-pill {
    padding: 3px 9px;
    font-size: 0.82em;
    border-radius: 12px;
    gap: 5px;
}

.shop-page-title {
    position: absolute;
    top: 18px;
    left: 60px;
    margin-top: 0;
    margin-bottom: 0;
    text-align: left;
    z-index: 100;
}

.shop-page-title .section-title {
    margin: 0;
    line-height: 1.2;
    font-size: 1.4em;
}

.shop-page-title .gold-line { display: none; }

.section-title {
    font-size: 1.8em;
    font-weight: 800;
    color: #fff1c2;
    margin: 0;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.8);
}

.gold-line {
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
    margin: 6px auto 0;
}

/* ===== 8. LEVELS PAGE STYLES ===== */
.levels-header-box {
    margin-top: auto;
    margin-bottom: 40px;
    text-align: center;
    width: 100%;
}

.levels-header-box .section-title { margin: 0; line-height: 1.1; }

.levels-view-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 18px;
    margin-top: 0;
    margin-bottom: auto;
}

.arrow-side {
    background: none;
    border: none;
    box-shadow: none;
    color: #ffca28;
    font-size: 1.9em;
    cursor: pointer;
    padding: 6px;
    margin-left: 10px;
    margin-right: 10px;
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

.arrow-side:hover { color: #ffffff; transform: scale(1.2); }

.levels-grid-clean {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(5, auto);
    gap: 12px 16px;
    justify-items: center;
    align-items: center;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
}

.level-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.level-card:hover:not(.locked) { transform: scale(1.08); }

.level-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #7b431e 0%, #361706 100%);
    border: 2px solid #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15em;
    font-weight: 900;
    color: #fff2c6;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.4);
    margin-bottom: 3px;
}

.level-card.locked { cursor: not-allowed; opacity: 0.35; }

.level-card.locked .level-circle {
    border: 2px solid #5a3b2b;
    background: radial-gradient(circle at 35% 35%, #2a1508 0%, #120602 100%);
    color: #8c725c;
    box-shadow: none;
}

.level-stars { display: flex; gap: 2px; transform: translateY(3px); }

.level-stars i { font-size: 0.6em; color: #4a3120; }

.level-stars i.earned { color: #ffd700; filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.8)); }

.level-card.locked .level-stars i { color: #261105; }

.levels-page-footer {
    margin-top: 10px;
    margin-bottom: 8px;
    text-align: center;
    transform: translateY(-30px);
}

#levels-page-text { font-size: 1.1em; font-weight: 800; color: #ffca28; }

/* ===== 9. DIFFICULTY PAGE STYLES ===== */
.menu-heading-box {
    margin-top: auto;
    margin-bottom: 40px;
    text-align: center;
    width: 100%;
}

.menu-heading-box .section-title { margin: 0; line-height: 1.1; }

.difficulty-options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 290px;
    margin-top: 0;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.difficulty-opt-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    min-height: 58px;
    background: linear-gradient(180deg, #5c351b 0%, #361706 100%);
    border: 2px solid #8b5527;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    transition: all 0.25s ease;
    box-sizing: border-box;
    user-select: none;
}

.difficulty-opt-card:hover { transform: translateY(-2px); border-color: #ffd700; }

.difficulty-opt-card.selected {
    background: linear-gradient(180deg, #7b431e 0%, #441d06 100%);
    border: 2px solid #ffd700;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.7), 0 0 15px rgba(255, 215, 0, 0.4);
    transform: scale(1.02);
}

.diff-card-left { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }

.diff-title { font-size: 1.25em; font-weight: 800; color: #fff2c6; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9); }

.diff-stars { display: flex; gap: 4px; }

.diff-stars i { font-size: 0.85em; color: #4a3120; }

.diff-stars i.active { color: #ffd700; filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.8)); }

.diff-card-indicator { font-size: 1.35em; color: #4a3120; transition: color 0.2s ease; }

.difficulty-opt-card.selected .diff-card-indicator {
    color: #76ff03; filter: drop-shadow(0 0 4px rgba(118, 255, 3, 0.7));
}

.yellow-start-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    width: 100%;
    max-width: 290px;
    background: linear-gradient(180deg, #ffca28 0%, #ffb300 50%, #f57f17 100%);
    border: 2px solid #ffe082;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6);
    transition: all 0.2s ease;
    box-sizing: border-box;
    margin-bottom: auto;
}

.yellow-start-btn:hover { transform: translateY(-2px); }

.yellow-start-btn .start-icon { font-size: 1.25em; color: #3e2005; }

.yellow-start-btn .btn-main-title { font-size: 1.25em; font-weight: 900; color: #3e2005; }

#shop-page, #coin-shop-page, #boards-page, #pieces-page {
    justify-content: flex-start;
    padding: 50px 14px 15px 14px;
    align-items: stretch;
}

#coin-shop-page .page-top-header {
    margin-top: 0;
    top: 21px;
}

#shop-page .page-top-header {
    margin-top: 0;
    top: 21px;
}

#boards-page .page-top-header, #pieces-page .page-top-header {
    margin-top: 0;
    top: 21px;
}

#coin-shop-page .coin-packs-scrollable {
    margin-top: 31px;
}

/* ===== 10. SHOP PAGE STYLES (TABS, ITEMS, PREVIEWS) ===== */
.shop-tabs-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 320px;
    margin: 30px auto 12px auto;
}

.shop-tab-btn {
    flex: 1;
    padding: 9px 0;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.1em;
    background: #361706;
    border: 1px solid #8b5527;
    color: #d1a56f;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shop-tab-btn.active {
    background: linear-gradient(180deg, #7b431e, #441d06);
    border-color: #ffd700;
    color: #fff2c6;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
}

.shop-page-scrollable {
    width: 100%;
    max-width: 340px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    box-sizing: border-box;
    padding-bottom: 15px;
    margin-top: 20px;
}

.shop-page-scrollable::-webkit-scrollbar { display: none; }

.shop-items-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    align-content: start;
}

.shop-item-card {
    background: linear-gradient(180deg, #5c351b 0%, #361706 100%);
    border: 1.5px solid #8b5527;
    border-radius: 14px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.shop-item-card.equipped { border-color: #ffd700; box-shadow: 0 0 12px rgba(255, 215, 0, 0.35); }

.shop-item-name {
    font-size: 0.88em;
    font-weight: 800;
    color: #fff2c6;
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    min-height: 2.2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-action-btn {
    width: 100%;
    padding: 6px 0;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.9em;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.btn-buy {
    background: linear-gradient(180deg, #ffca28, #f57f17);
    color: #3e2005;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

.btn-equip {
    background: linear-gradient(180deg, #4caf50, #2e7d32);
    color: #ffffff;
}

.btn-equipped {
    background: #2e7d32;
    color: #ffffff;
    cursor: default;
}

.theme-preview-container {
    width: 80%;
    max-width: 110px;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border-radius: 0;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.25);
}

.preview-square { width: 100%; height: 100%; }

.piece-preview-container {
    width: 90%;
    max-width: 120px;
    height: 50px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.preview-piece { width: 28px; height: 28px; border-radius: 50%; }

/* ===== 11. COIN SHOP PAGE STYLES (PACK CARDS) ===== */
.coin-packs-scrollable {
    width: 100%;
    max-width: 520px;
    height: 100%;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    box-sizing: border-box;
    padding: 4px 4px 16px 4px;
}

.coin-packs-scrollable::-webkit-scrollbar { display: none; }

.coin-packs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.coin-pack-card {
    background: linear-gradient(180deg, #5c351b 0%, #361706 100%);
    border: 1.5px solid #8b5527;
    border-radius: 14px;
    padding: 14px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.coin-pack-card.popular {
    border-color: #ffd700;
    background: linear-gradient(180deg, #7b431e 0%, #441d06 100%);
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.35);
}

.pack-tag {
    position: absolute;
    top: -8px;
    right: -4px;
    background: #e53935;
    color: #fff;
    font-size: 0.65em;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.gift-tag { background: #2e7d32; }

.pack-icon {
    font-size: 2.2em;
    color: #ffd700;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.8));
}

.pack-amount { font-size: 1.05em; font-weight: 800; color: #fff2c6; }

.pack-buy-btn {
    width: 100%;
    padding: 7px 0;
    border-radius: 10px;
    font-weight: 900;
    font-size: 0.95em;
    background: linear-gradient(180deg, #ffca28, #f57f17);
    border: none;
    color: #3e2005;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.free-btn { background: linear-gradient(180deg, #4caf50, #2e7d32); color: #fff; }

/* ===== 12. ICON BUTTONS (BACK / SETTINGS) ===== */
.clean-icon-btn {
    position: absolute;
    top: 18px;
    background: none;
    border: none;
    color: #ffca28;
    font-size: 1.6em;
    cursor: pointer;
    padding: 6px;
    transition: transform 0.2s ease, color 0.2s ease;
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

.clean-icon-btn:hover { color: #ffffff; transform: scale(1.15); }

.back-btn { left: 18px; top: 17px; }

.settings-btn { right: 18px; display: none; }

body.game-active .settings-btn { display: flex; }

/* ===== 13. SETTINGS PANEL & OVERLAY ===== */
#settings-panel {
    position: absolute;
    top: 55px;
    right: 18px;
    background: linear-gradient(180deg, #4a2711, #2a1508);
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
    z-index: 115;
    display: none;
    flex-direction: column;
    gap: 8px;
    border: 2px solid #8b5527;
}

#settings-panel.visible { display: flex; }

#settings-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 114;
    display: none;
}

#settings-overlay.visible { display: block; }

.settings-icon-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(180deg, #6c3b1a, #361706);
    border: 1px solid #c9883f;
    color: #ffeb99;
    font-size: 1.1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-icon-button:hover { transform: scale(1.08); color: #ffd700; }

#sound-toggle-button.sound-off { background: #555; color: #aaa; border-color: #777; }

/* ===== 14. PAGE-VISIBILITY STATE RULES ===== */
/* Hides every screen by default; body classes reveal one at a time. */
#homepage-content, #difficulty-selection, #levels-selection, #shop-page, #coin-shop-page, #boards-page, #pieces-page, .game-container {
    display: none;
}

body:not(.game-active):not(.selecting-difficulty):not(.selecting-levels):not(.viewing-shop):not(.viewing-coin-shop):not(.viewing-boards):not(.viewing-pieces) #homepage-content {
    display: flex;
}

body.selecting-difficulty #difficulty-selection {
    display: flex;
    justify-content: flex-start;
    padding: 0 10px 10px 10px;
}

body.selecting-levels #levels-selection {
    display: flex;
    justify-content: flex-start;
    padding: 25px 10px 10px 10px;
}

body.viewing-shop #shop-page {
    display: flex;
}

body.viewing-coin-shop #coin-shop-page {
    display: flex;
}

body.viewing-boards #boards-page {
    display: flex;
}

body.viewing-pieces #pieces-page {
    display: flex;
}

body.game-active .game-container {
    display: flex;
}

/* ===== 15. GAME CONTAINER & CAPTURED-INFO BAR ===== */
.game-container {
    z-index: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    gap: 16px;
    width: 100%;
    padding: 6px 0;
    box-sizing: border-box;
}

/* Current-level badge — top-left of the game screen.
   Pure text + icon (no background, no border) for a clean look. */
.current-level-badge {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    color: #ffe082;
    font-weight: 800;
    font-size: 0.95em;
    letter-spacing: 0.5px;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.95),
        0 0 6px rgba(0, 0, 0, 0.6);
    box-shadow: none;
    pointer-events: none;
}
.current-level-badge i {
    color: #ffd700;
    font-size: 0.95em;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.95),
        0 0 6px rgba(0, 0, 0, 0.6);
}
.current-level-badge span span { color: #fff2c6; }

#captured-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: calc(100% - 40px);
    max-width: calc(100% - 40px);
    padding: 6px 10px;
    background-color: rgba(40, 25, 10, 0.85);
    border: 1px solid #7a542e;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
    box-sizing: border-box;
    margin: 0 20px;
}

.player-info-bar { display: flex; align-items: center; gap: 6px; }

.player-avatar { width: 28px; height: 28px; border-radius: 50%; box-sizing: border-box; box-shadow: 0 1px 2px rgba(0,0,0,0.3); }

#player1-info-bar .player-avatar { margin-left: -2px; }

#player2-info-bar .player-avatar { margin-right: -2px; }

.captured-count-display { font-size: 1.05em; color: #ffdd77; font-weight: bold; }

.captured-count-display i { margin-right: 3px; color: #ffcc00; }

#vs-separator { font-size: 1.15em; color: #ffcc00; font-weight: bold; }

.player-avatar.is-current-player { box-shadow: 0 0 0 3px limegreen; }

.player-avatar.is-other-player { box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.6); }

/* ===== 16. BOARD GRID & SQUARES (BASE + THEME VARIANTS) ===== */
#board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: calc(100% - 40px);
    max-width: calc(100% - 40px);
    height: auto;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    margin: 0 20px;
    border: 5px solid #8b5a2b;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 15px 35px rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    touch-action: none;
}

.square {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.square.dark { background: var(--square-dark-bg, #4a2c1d); }

.square.light { background: var(--square-light-bg, #d0b48f); }

#board.theme-default {
    --square-dark-bg: linear-gradient(135deg, #4a2c1d, #402516);
    --square-light-bg: linear-gradient(135deg, #d0b48f, #b99d74);
    border-color: #8b5a2b;
}

#board.theme-marble {
    --square-dark-bg: linear-gradient(135deg, #4a5a68 0%, #3a4a58 100%);
    --square-light-bg: linear-gradient(135deg, #d0d4d5 0%, #c0c4c5 100%);
    border-color: #6c7a89;
}

#board.theme-red-white {
    --square-dark-bg: linear-gradient(135deg, #c0392b 0%, #a93124 100%);
    --square-light-bg: linear-gradient(135deg, #d0d4d5 0%, #c0c4c5 100%);
    border-color: #616a6b;
}

#board.theme-green-white {
    --square-dark-bg: linear-gradient(135deg, #004d43 0%, #002c24 100%);
    --square-light-bg: linear-gradient(135deg, #c0d8e0 0%, #bcdbc4 100%);
    border-color: #003d33;
}

#board.theme-blueprint {
    --square-dark-bg: #2c3e50;
    --square-light-bg: repeating-linear-gradient(0deg, #aeb6bf, #aeb6bf 1px, transparent 1px, transparent 15px), #d0d4d5;
    border-color: #2980b9;
}

#board.theme-fire {
     --square-dark-bg: linear-gradient(135deg, #8b0000 0%, #4d0000 100%);
     --square-light-bg: linear-gradient(135deg, #ff8c00 0%, #ff4500 100%);
     border-color: #451000;
}

#board.theme-desert {
    --square-dark-bg: linear-gradient(135deg, #8b4513, #7a3c10);
    --square-light-bg: linear-gradient(135deg, #deb887, #d1a770);
    border-color: #8B4513;
}

#board.theme-stone {
    --square-dark-bg: linear-gradient(135deg, #6a6a6a 0%, #4a4a4a 100%);
    --square-light-bg: linear-gradient(135deg, #e0e0e0 0%, #c0c0c0 100%);
    border-color: #4a423a;
}

#board.theme-water {
    --square-dark-bg: linear-gradient(135deg, #004f5f 0%, #087375 100%);
    --square-light-bg: linear-gradient(135deg, #80bfa3 0%, #d0c490 100%);
    border-color: #004d40;
}

#board.theme-grassland {
    --square-dark-bg: linear-gradient(135deg, #386641 0%, #2b4f32 100%);
    --square-light-bg: linear-gradient(135deg, #a3b18a 0%, #588157 100%);
    border-color: #556b2f;
}

#board.theme-space {
    --square-dark-bg: #1a1a2e;
    --square-light-bg: linear-gradient(135deg, #4a0350 0%, #8a3974 100%);
    border-color: #2c3e50;
}

#board.theme-candy {
    --square-dark-bg: #8e44ad;
    --square-light-bg: linear-gradient(135deg, #ffb6c1 0%, #87cefa 100%);
    border-color: #f4a7b6;
}

body.piece-theme-classic-bw {
    --piece-player1-bg: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.4) 0%, transparent 30%), radial-gradient(circle at 75% 75%, rgba(0, 0, 0, 0.3) 0%, transparent 30%), radial-gradient(circle at center, #333333 0%, #000000 80%);
    --piece-player1-border: #000000;
    --piece-player2-bg: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.6) 0%, transparent 40%), radial-gradient(circle at 75% 75%, rgba(0, 0, 0, 0.2) 0%, transparent 30%), radial-gradient(circle at center, #ffffff 0%, #cccccc 80%);
    --piece-player2-border: #cccccc;
}

body.piece-theme-default-red-blue {
    --piece-player1-bg: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.4) 0%, transparent 30%), radial-gradient(circle at 75% 75%, rgba(0, 0, 0, 0.3) 0%, transparent 30%), radial-gradient(circle at center, #cc4a4a 0%, #a02c1d 80%);
    --piece-player1-border: #8b0000;
    --piece-player2-bg: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.4) 0%, transparent 30%), radial-gradient(circle at 75% 75%, rgba(0, 0, 0, 0.3) 0%, transparent 30%), radial-gradient(circle at center, #4a8ecc 0%, #3462db 80%);
    --piece-player2-border: #00008b;
}

body.piece-theme-green-yellow {
    --piece-player1-bg: radial-gradient(circle at center, #4a8c5a 0%, #386641 80%);
    --piece-player1-border: #1d3520;
    --piece-player2-bg: radial-gradient(circle at center, #fcdb64 0%, #f4d35e 80%);
    --piece-player2-border: #c1a64b;
}

body.piece-theme-purple-orange {
    --piece-player1-bg: radial-gradient(circle at center, #8a2be2 0%, #6a0572 80%);
    --piece-player1-border: #4a0350;
    --piece-player2-bg: radial-gradient(circle at center, #ffa500 0%, #f77f00 80%);
    --piece-player2-border: #c56500;
}

body.piece-theme-teal-pink {
    --piece-player1-bg: radial-gradient(circle at center, #48d1cc 0%, #0a9396 80%);
    --piece-player1-border: #065a5c;
    --piece-player2-bg: radial-gradient(circle at center, #f08080 0%, #ee6c4d 80%);
    --piece-player2-border: #c0553c;
}

body.piece-theme-brown-beige {
    --piece-player1-bg: radial-gradient(circle at center, #a0522d 0%, #7f5539 80%);
    --piece-player1-border: #5c3e2a;
    --piece-player2-bg: radial-gradient(circle at center, #f5f5dc 0%, #d4a373 80%);
    --piece-player2-border: #a17f5a;
}

body.piece-theme-navy-gold {
    --piece-player1-bg: radial-gradient(circle at center, #000080 0%, #023e8a 80%);
    --piece-player1-border: #012a4a;
    --piece-player2-bg: radial-gradient(circle at center, #ffd700 0%, #ffc300 80%);
    --piece-player2-border: #cc9c00;
}

body.piece-theme-grey-blue {
    --piece-player1-bg: radial-gradient(circle at center, #808080 0%, #495057 80%);
    --piece-player1-border: #343a40;
    --piece-player2-bg: radial-gradient(circle at center, #add8e6 0%, #4895ef 80%);
    --piece-player2-border: #3a7ad0;
}

body.piece-theme-red-green {
    --piece-player1-bg: radial-gradient(circle at center, #ff6347 0%, #e63946 80%);
    --piece-player1-border: #c02d3a;
    --piece-player2-bg: radial-gradient(circle at center, #90ee90 0%, #a7c957 80%);
    --piece-player2-border: #8a9d46;
}

body.piece-theme-darkgreen-lightblue {
    --piece-player1-bg: radial-gradient(circle at center, #2f4f4f 0%, #081c15 80%);
    --piece-player1-border: #040f0c;
    --piece-player2-bg: radial-gradient(circle at center, #87cefa 0%, #1b9aaa 80%);
    --piece-player2-border: #157b88;
}

body.piece-theme-wood {
    --piece-player1-bg: radial-gradient(circle at center, #6b4e39 0%, #5a3e31 80%);
    --piece-player1-border: #3c281e;
    --piece-player2-bg: radial-gradient(circle at center, #d2b48c 0%, #b8a080 80%);
    --piece-player2-border: #8a735a;
}

body.piece-theme-diamond {
    --piece-player1-bg: linear-gradient(135deg, #7F9AA6 0%, #5A7D8C 100%);
    --piece-player1-border: #3E5A66;
    --piece-player2-bg: linear-gradient(135deg, #FFFFFF 0%, #E0F2F7 100%);
    --piece-player2-border: #B3D9E5;
}

/* ===== 17. PIECES, KING, SELECTED & POSSIBLE-MOVE INDICATORS ===== */
.piece {
    width: 90%;
    height: 90%;
    border-radius: 50%;
    cursor: pointer;
    box-sizing: border-box;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    position: relative;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6), inset 0 0 10px rgba(255, 255, 255, 0.2);
}

.player1 { background: var(--piece-player1-bg); border: 2px solid var(--piece-player1-border); }

.player2 { background: var(--piece-player2-bg); border: 2px solid var(--piece-player2-border); }

.player-info-bar:first-child .player-avatar { background: var(--piece-player1-bg); border: 1px solid var(--piece-player1-border); }

.player-info-bar:last-child .player-avatar { background: var(--piece-player2-bg); border: 1px solid var(--piece-player2-border); }

.piece.king::after {
    content: '\265B';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2em;
    color: gold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    pointer-events: none;
}

.player1.king::after { color: #ffd700; }

.player2.king::after { color: #000000; text-shadow: 1px 1px 2px rgba(255,255,255,0.4); }

.selected {
    box-shadow: 0 0 12px 7px rgba(255, 255, 150, 1.0), 0 5px 10px rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
    z-index: 10;
}

.possible-move { position: relative; cursor: pointer; }

.possible-move::after {
    content: '';
    display: block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background-color: #39ff14;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px rgba(57, 255, 20, 0.95);
    pointer-events: none;
    z-index: 15;
}

/* ===== 18. MODAL OVERLAYS ===== */
/* Shared full-screen dark backdrop for logout / win / purchase confirm modals. */
#logout-confirm-modal-overlay, #win-modal-overlay, #purchase-confirm-modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

#logout-confirm-modal-overlay.visible, #win-modal-overlay.visible, #purchase-confirm-modal-overlay.visible {
    display: flex;
    z-index: 9999;
    pointer-events: auto;
}

/* ===== 18B. THEME & PIECES LIST GRIDS (inside #boards-page / #pieces-page) ===== */
/* Grid layout for the unlocked board themes and piece color themes. */
#theme-list, #pieces-list {
    list-style: none; padding: 0; margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    align-content: start;
}

/* ===== 19. THEME & PIECES SELECTION GRIDS ===== */
.theme-pieces-scrollable {
    width: 100%;
    max-width: 500px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    box-sizing: border-box;
    padding: 6px 4px 16px 4px;
    margin-top: 30px;
}

.theme-pieces-scrollable::-webkit-scrollbar { display: none; }

.theme-item, .piece-item {
    background: #361706;
    border: 2px solid #ffd700;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    position: relative;
    transition: all 0.2s ease;
    width: 100%;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
}

.theme-item:hover, .piece-item:hover { border-color: #ffd700; }

.theme-item.selected-theme, .piece-item.selected-piece-theme {
    border-color: #ffd700; background: #55270d; box-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
}

.theme-item .selection-indicator, .piece-item .selection-indicator {
    position: absolute; top: 4px; left: 6px; color: #ffd700; font-size: 1.2em; display: none;
}

.theme-item.selected-theme .selection-indicator, .piece-item.selected-piece-theme .selection-indicator { display: block; }

.modal-close-button {
    position: absolute; top: 8px; right: 8px;
    background: none;
    border: none;
    font-size: 1.3em;
    color: #ffeb99;
    cursor: pointer;
    z-index: 20;
    padding: 6px;
}

/* ===== 20. MODAL WINDOW BOXES ===== */
#logout-confirm-modal {
    background: linear-gradient(180deg, #4a2711 0%, #2a1508 100%);
    border: 2px solid #c9883f;
    border-radius: 16px;
    padding: 16px 14px;
    width: 80%;
    max-width: 270px;
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.9);
    box-sizing: border-box;
}

#logout-confirm-modal.visible { display: flex; }

#purchase-confirm-modal {
    background: linear-gradient(180deg, #4a2711 0%, #2a1508 100%);
    border: 2px solid #c9883f;
    border-radius: 16px;
    padding: 16px 14px;
    width: 80%;
    max-width: 270px;
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.9);
    box-sizing: border-box;
}

#purchase-confirm-modal.visible { display: flex; }

#purchase-confirm-buttons { display: flex; flex-direction: column; gap: 8px; width: 100%; }

.modal-title { font-size: 1.35em; font-weight: 900; color: #ffca28; margin: 0 0 4px 0; }

.modal-desc { font-size: 0.85em; color: #e0d0c0; line-height: 1.3; margin: 0 0 12px 0; }

#logout-confirm-buttons { display: flex; flex-direction: column; gap: 8px; width: 100%; }

/* ===== 21. CONFIRM MODALS, ACTION BUTTONS & WIN BUTTON ===== */
.modal-action-btn {
    display: flex; align-items: center; justify-content: center; padding: 7px 16px; font-size: 1.1em;
    font-weight: 800; border-radius: 10px; cursor: pointer; border: 2px solid transparent; width: 100%;
    color: #ffe082; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.btn-danger { background: linear-gradient(180deg, #d32f2f 0%, #8b0000 100%); border-color: #ef5350; }

.btn-cancel { background: linear-gradient(180deg, #5c351b 0%, #361706 100%); border-color: #8b5527; }

/* ===== 21B. RESULT MODALS — VICTORY & DEFEAT ===== */

/* Backdrop shared by both result modals */
.result-modal-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.88);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.result-modal-overlay.visible { display: flex; }

/* Common modal card */
.result-modal {
    position: relative;
    width: calc(100% - 36px);
    max-width: 360px;
    border-radius: 20px;
    padding: 60px 18px 20px 18px;
    box-sizing: border-box;
    text-align: center;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.95), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    /* No overflow:hidden: the heart icon sits above the card and must stay visible */
    animation: result-pop-in 0.55s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}

/* Show the modal card when its parent overlay is visible */
.result-modal.visible,
.result-modal-overlay.visible .result-modal { display: flex; }

/* Victory — gold gradient sloping downward (lighter gold on top, deeper bronze at bottom) */
.result-modal-win {
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 215, 0, 0.18) 0%, transparent 55%),
        linear-gradient(180deg, #6b4a1f 0%, #4a3210 45%, #2a1c08 100%);
    border: 2px solid #ffd700;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.95), 0 0 30px rgba(255, 215, 0, 0.15);
}

/* Defeat — royal red gradient sloping downward (true royal red, not pink) */
.result-modal-lose {
    background:
        radial-gradient(circle at 50% 0%, rgba(211, 47, 47, 0.20) 0%, transparent 55%),
        linear-gradient(180deg, #5a0a0a 0%, #3d0606 45%, #1a0303 100%);
    border: 2px solid #d32f2f;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.95), 0 0 30px rgba(211, 47, 47, 0.22);
}

/* Trophy (heart) icon — gold circular badge on the top edge of the victory card */
.result-trophy-wrapper {
    position: absolute;
    top: -34px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px; height: 70px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffe082 0%, #ffca28 35%, #c98a17 75%, #8a5a0a 100%);
    border: 3px solid #ffe082;
    display: flex; align-items: center; justify-content: center;
    font-size: 2em;
    color: #4a2a08;
    text-shadow:
        0 1px 2px rgba(255, 255, 255, 0.45),
        0 -1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6), inset 0 -5px 10px rgba(0, 0, 0, 0.25), inset 0 3px 6px rgba(255, 255, 255, 0.4);
    z-index: 3;
    animation: heart-beat 1.4s ease-in-out infinite;
}

/* Skull (broken-heart) icon — royal-red circular badge on the top edge of the defeat card */
.result-skull-wrapper {
    position: absolute;
    top: -34px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px; height: 70px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ef5350 0%, #d32f2f 35%, #8b0000 75%, #4a0a0a 100%);
    border: 3px solid #ef5350;
    display: flex; align-items: center; justify-content: center;
    font-size: 2em;
    color: #ffe0e0;
    text-shadow:
        0 1px 2px rgba(255, 255, 255, 0.25),
        0 -1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6), inset 0 -5px 10px rgba(0, 0, 0, 0.3), inset 0 3px 6px rgba(255, 255, 255, 0.25);
    z-index: 3;
    animation: heart-crack 0.9s ease-in-out 0s 2;
}

/* Confetti dots falling around the victory heart */
.result-confetti {
    position: absolute;
    top: 6px;
    left: 0; right: 0;
    height: 0;
    pointer-events: none;
    z-index: 2;
    overflow: visible;
}
.result-confetti span {
    position: absolute;
    top: 30px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffd700;
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.85), 0 0 12px rgba(255, 215, 0, 0.45);
    opacity: 0;
    animation: confetti-fall 2.6s ease-in 0.2s infinite;
}
.result-confetti span:nth-child(1) { left: 12%; animation-delay: 0.2s; background: #ffca28; }
.result-confetti span:nth-child(2) { left: 26%; animation-delay: 0.7s; background: #ffd700; }
.result-confetti span:nth-child(3) { left: 40%; animation-delay: 1.1s; background: #ffca28; }
.result-confetti span:nth-child(4) { left: 56%; animation-delay: 0.4s; background: #ffd700; }
.result-confetti span:nth-child(5) { left: 72%; animation-delay: 0.9s; background: #ffca28; }
.result-confetti span:nth-child(6) { left: 86%; animation-delay: 1.4s; background: #ffd700; }

/* Title */
.result-title {
    margin: 6px 0 0 0;
    font-family: 'Cairo', sans-serif;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    z-index: 3;
    position: relative;
}

.result-title-win {
    font-size: 2.2em;
    color: #ffd700;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.85),
        0 0 22px rgba(255, 215, 0, 0.55),
        0 2px 4px rgba(0, 0, 0, 0.9);
    animation: title-glow-win 1.8s ease-in-out infinite alternate;
}

.result-title-lose {
    font-size: 2.0em;
    color: #ef5350;
    text-shadow:
        0 0 10px rgba(211, 47, 47, 0.85),
        0 0 22px rgba(211, 47, 47, 0.45),
        0 2px 4px rgba(0, 0, 0, 0.9);
    animation: title-flicker 2.2s ease-in-out infinite;
}

/* Subtitle message */
.result-message {
    margin: 0;
    font-size: 0.95em;
    color: #e8d5b5;
    line-height: 1.4;
    z-index: 3;
    position: relative;
}

/* Reward badge (gold pill) shown on victory */
.result-reward-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(180deg, #ffca28 0%, #f57f17 100%);
    color: #2a1508;
    border: 2px solid #ffe082;
    border-radius: 999px;
    font-weight: 900;
    font-size: 1.05em;
    box-shadow: 0 4px 10px rgba(255, 200, 0, 0.45), inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    animation: reward-pulse 1.4s ease-in-out infinite;
    z-index: 3;
    position: relative;
}
.result-reward-badge i { font-size: 0.9em; }

/* Buttons row */
.result-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
    z-index: 3;
    position: relative;
}

.result-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 14px;
    font-size: 1.0em;
    font-weight: 800;
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    color: #fff2c6;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    width: 100%;
    box-sizing: border-box;
}
.result-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.result-btn:active { transform: translateY(1px); }
.result-btn i { font-size: 0.9em; }

/* Primary (gold) — Next Level on victory */
.result-btn-primary {
    background: linear-gradient(180deg, #ffca28 0%, #f57f17 100%);
    color: #2a1508;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
    border-color: #ffe082;
    box-shadow: 0 5px 12px rgba(255, 180, 0, 0.4);
}

/* Secondary (wooden) — Play Again */
.result-btn-secondary {
    background: linear-gradient(180deg, #6c3b1a 0%, #361706 100%);
    border-color: #c9883f;
}

/* Retry (red) — Try Again on defeat */
.result-btn-retry {
    background: linear-gradient(180deg, #d32f2f 0%, #8b0000 100%);
    border-color: #ef5350;
    box-shadow: 0 5px 12px rgba(211, 47, 47, 0.35);
}

/* Ghost (subtle) — Main Menu */
.result-btn-ghost {
    background: linear-gradient(180deg, rgba(108, 59, 26, 0.5) 0%, rgba(54, 23, 6, 0.5) 100%);
    border-color: rgba(201, 136, 63, 0.5);
    color: #c9a87a;
}

/* ===== Result modal animations ===== */
@keyframes result-pop-in {
    0%   { opacity: 0; transform: scale(0.7) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
/* Heartbeat (victory heart — pulses like a real heart) */
@keyframes heart-beat {
    0%, 100% { transform: translateX(-50%) scale(1); }
    15%      { transform: translateX(-50%) scale(1.15); }
    30%      { transform: translateX(-50%) scale(1); }
    45%      { transform: translateX(-50%) scale(1.10); }
    60%      { transform: translateX(-50%) scale(1); }
}
/* Heart-crack (defeat broken heart — small shake then settles) */
@keyframes heart-crack {
    0%, 100% { transform: translateX(-50%); }
    15%      { transform: translateX(-58%) rotate(-4deg); }
    30%      { transform: translateX(-42%) rotate(4deg); }
    45%      { transform: translateX(-56%) rotate(-2deg); }
    60%      { transform: translateX(-44%) rotate(2deg); }
    75%      { transform: translateX(-50%) rotate(0deg); }
}
@keyframes title-glow-win {
    from { text-shadow: 0 0 10px rgba(255, 215, 0, 0.85), 0 0 22px rgba(255, 215, 0, 0.55), 0 2px 4px rgba(0, 0, 0, 0.9); }
    to   { text-shadow: 0 0 18px rgba(255, 215, 0, 1), 0 0 38px rgba(255, 215, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.9); }
}
@keyframes title-flicker {
    0%, 100% { opacity: 1; }
    45%      { opacity: 1; }
    48%      { opacity: 0.65; }
    52%      { opacity: 1; }
    70%      { opacity: 0.85; }
    74%      { opacity: 1; }
}
@keyframes confetti-fall {
    0%   { top: 30px; opacity: 0; transform: scale(0.5); }
    10%  { opacity: 1; }
    100% { top: 200px; opacity: 0; transform: scale(1.2); }
}
@keyframes reward-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.06); }
}

/* ===== 22. RESPONSIVE: TABLET / IPAD (min-width 768px) ===== */
@media only screen and (min-width: 768px) and (min-aspect-ratio: 1/2) and (max-aspect-ratio: 3/2) {
    html, body {
        background: radial-gradient(circle at center, #5c351b 0%, #351c0d 60%, #1c0e06 100%);
        margin: 0;
        padding: 0;
        width: 100vw;
        height: 100vh;
    }
    body {
        display: block;
        justify-content: initial;
        align-items: initial;
    }
    #app-wrapper {
        width: 100vw;
        max-width: 100vw;
        min-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        box-shadow: none;
        border-radius: 0;
    }
    #homepage-content, #difficulty-selection, #levels-selection,
    #shop-page, #coin-shop-page, #boards-page, #pieces-page,
    .game-container, .centered-flex-container {
        width: 100%;
        max-width: 100%;
    }

    #homepage-buttons, .difficulty-options-grid, .yellow-start-btn {
        max-width: 540px;
        width: 80%;
    }
    .shop-tabs-nav           { max-width: 680px; }
    .shop-page-scrollable    { max-width: 900px; }
    .coin-packs-scrollable   { max-width: 1100px; }
    .theme-pieces-scrollable { max-width: 1100px; }

    .shop-items-grid, .coin-packs-grid, #theme-list, #pieces-list {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    .levels-grid-clean {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(4, auto);
        gap: 22px 20px;
    }

    .level-circle { width: 56px; height: 56px; font-size: 1.4em; }

    .royal-title    { font-size: 5.0em; }
    .section-title  { font-size: 2.4em; }

    .royal-divider      { font-size: 1.0em; }
    .royal-divider .subtitle { font-size: 0.95em; }

    .crown-icon-wrapper { font-size: 2.7em; }

    .wood-action-btn .btn-main-title, .diff-title { font-size: 1.5em; }

    #homepage-buttons { max-width: 560px; width: 80%; }

    .wood-action-btn { padding: 14px 18px; }
    .wood-action-btn .btn-icon-holder { width: 56px; height: 56px; font-size: 1.5em; }

    #board {
        width: min(70vw, 70vh);
        max-width: min(70vw, 70vh);
        margin: 0 auto;
    }
    #captured-info {
        width: min(70vw, 70vh);
        max-width: min(70vw, 70vh);
        margin: 0 auto 14px auto;
        font-size: 1.25em;
    }
    .player-avatar { width: 40px; height: 40px; }

    #logout-confirm-modal, #purchase-confirm-modal { max-width: 420px; padding: 24px 20px; }
    .modal-title      { font-size: 1.7em; }
    .modal-desc       { font-size: 1.1em; }
    .modal-action-btn { font-size: 1.35em; padding: 12px 18px; }

    .coins-badge-container { font-size: 1.25em; top: 26px; left: 26px; }
    .top-shop-btn          { font-size: 2em;    top: 26px; right: 26px; }
    .back-btn              { font-size: 1.9em;  top: 22px; left: 22px; }
    .top-right-coins       { top: 24px; right: 24px; font-size: 1.15em; }

    #shop-page .page-top-header .section-title,
    #coin-shop-page .page-top-header .section-title,
    #boards-page .page-top-header .section-title,
    #pieces-page .page-top-header .section-title {
        font-size: 1.55em;
    }

    #shop-page .page-top-header,
    #coin-shop-page .page-top-header,
    #boards-page .page-top-header,
    #pieces-page .page-top-header {
        top: 25px;
    }

    #coin-shop-page .coin-packs-scrollable {
        margin-top: 40px;
        padding-top: 12px;
    }

    #shop-page .shop-tabs-nav {
        margin-top: 50px;
        margin-bottom: 22px;
    }

    .difficulty-options-grid {
        gap: 22px;
        margin-bottom: 30px;
    }
    .difficulty-opt-card {
        min-height: 70px;
        padding-top: 14px;
        padding-bottom: 14px;
        box-sizing: border-box;
    }
    .difficulty-opt-card.selected {
        transform: none;
    }

    .wood-action-btn:hover,
    .level-card:hover:not(.locked),
    .difficulty-opt-card:hover,
    .yellow-start-btn:hover,
    .arrow-side:hover,
    .clean-icon-btn:hover,
    .top-shop-btn:hover,
    .add-coins-btn:hover,
    .page-coins-pill:hover,
    .shop-tab-btn:hover,
    .settings-icon-button:hover,
    .modal-action-btn:hover {
        transform: none;
    }
}

/* ===== 23. RESPONSIVE: SMALL PHONE (360-767px) ===== */
@media only screen and (min-width: 360px) and (max-width: 767px) {

    #shop-page,
    #coin-shop-page,
    #boards-page,
    #pieces-page {
        justify-content: flex-start;
        align-items: center;
    }

    #shop-page .shop-page-scrollable,
    #boards-page .theme-pieces-scrollable,
    #pieces-page .theme-pieces-scrollable {
        max-width: 520px;
    }
    #shop-page .shop-page-scrollable {
        margin-top: 30px;
    }
    #shop-page .shop-page-scrollable,
    #coin-shop-page .coin-packs-scrollable,
    #boards-page .theme-pieces-scrollable,
    #pieces-page .theme-pieces-scrollable {
        margin-left: auto;
        margin-right: auto;
        align-self: center;
    }

    .crown-icon-wrapper { font-size: 2.85em; }

    .royal-title { font-size: 3.7em; }

    .royal-divider { font-size: 1.05em; }

    .royal-divider .subtitle { font-size: 1.0em; }

    .wood-action-btn { padding: 9px 14px; }

    .wood-action-btn .btn-icon-holder { width: 56px; height: 56px; font-size: 1.4em; }

    .wood-action-btn .btn-main-title { font-size: 1.4em; }

    #homepage-buttons { max-width: 340px; }

    #levels-selection .section-title,
    #difficulty-selection .section-title { font-size: 2.3em; }

    .level-circle { width: 62px; height: 62px; font-size: 1.4em; margin-bottom: 6px; }

    .level-stars i { font-size: 0.75em; }

    .difficulty-options-grid { max-width: 340px; gap: 16px; }

    .difficulty-opt-card { padding: 9px 14px; min-height: 58px; }

    .diff-title { font-size: 1.5em; }

    .diff-stars i { font-size: 1.05em; }
    .diff-stars { gap: 6px; }

    .diff-card-indicator { font-size: 1.6em; }

    .yellow-start-btn { max-width: 340px; padding: 12px 20px; }

    .yellow-start-btn .start-icon { font-size: 1.5em; }

    .yellow-start-btn .btn-main-title { font-size: 1.5em; }
}

/* ===== 24. RESPONSIVE: FULL-WIDTH BUTTONS (max-width 767px) ===== */
@media only screen and (max-width: 767px) {
    #homepage-buttons,
    .difficulty-options-grid,
    .yellow-start-btn {
        max-width: calc(100vw - 40px);
        width: calc(100vw - 40px);
    }
}
