.iframe_fs_back{z-index:1999;}
.iframeoverlay{z-index:2000;}
.contentLoader{z-index:2001;}
.gameStrip_in{z-index:2002;}
.iframe_fs_back{top:auto;bottom:20px;z-index:20;}

/* ============================================================
   ZipSaw — Main Stylesheet
   ============================================================ */

:root {
    --bg: #5FCBCC;
    --wood-base: #C28B59;
    --wood-shadow: #754418;
    --wood-highlight: #D8A572;
    --btn-orange: #F27B13;
    --btn-orange-shadow: #A34E01;
    --btn-green: #7DC210;
    --btn-green-shadow: #3A8004;
    --btn-blue: #1C75FF;
    --btn-blue-shadow: #003AA3;
    --btn-tan: #FDE8C0;
    --btn-tan-shadow: #B28345;
    --text-brown: #5C3A21;
    --text: #ffffff;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-full: 9999px;
}
.thsMainGameContainer{position:relative;top:0;left:0;width:100%;height:100%;}
.thsMainGameContainer * { box-sizing: border-box; margin: 0; padding: 0; }
.thsMainGameContainer * { -webkit-tap-highlight-color: transparent !important; }
.thsMainGameContainer *::-webkit-scrollbar { display: none; }
.thsMainGameContainer * { -ms-overflow-style: none; scrollbar-width: none; }

.thsMainGameContainer{
    font-family: 'Fredoka', 'Nunito', sans-serif;
    /*background: url('./GameAsset/game_bg.jpg') no-repeat center center fixed;*/
    background-size: cover;
    color: var(--text);
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior: none;
}

/* ============================================================
   SCREEN SYSTEM
   ============================================================ */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100% !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}
.screen.active {
    opacity: 1;
    pointer-events: all;
    transform: none !important;
}

.screen.slide-out-left  { transform: translateX(-100%); }
.screen.slide-out-right { transform: translateX(100%); }

/* ============================================================
   BACKGROUND ENVIRONMENT (Flat Vector Scenery)
   ============================================================ */
.bg-flat {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background: linear-gradient(180deg, #60C3FF 0%, #BFE7FF 100%);
}
.f-cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50px;
}
.f-cloud::before, .f-cloud::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
}
.c1 { width: 120px; height: 35px; top: 12%; left: 8%; opacity: 0.9; }
.c1::before { width: 60px; height: 60px; top: -30px; left: 15px; }
.c1::after { width: 50px; height: 50px; top: -20px; right: 15px; }

.c2 { width: 160px; height: 45px; top: 20%; right: 5%; opacity: 0.8; }
.c2::before { width: 80px; height: 80px; top: -45px; left: 20px; }
.c2::after { width: 60px; height: 60px; top: -25px; right: 20px; }

.c3 { width: 100px; height: 30px; top: 10%; left: 55%; opacity: 0.85; }
.c3::before { width: 50px; height: 50px; top: -25px; left: 15px; }

.flat-mountain {
    position: absolute;
    bottom: 25%;
    width: 0; 
    height: 0; 
    border-left: 100px solid transparent;
    border-right: 100px solid transparent;
    border-bottom: 200px solid #2D8C5B; /* Darker green mountains */
}
.m-left { left: -5%; border-bottom-color: #216E45; }
.m-right { right: 5%; border-bottom-color: #2D8C5B; }

.flat-hills {
    position: absolute;
    bottom: 0; left: -10%; right: -10%;
    border-radius: 50% 50% 0 0;
}
.flat-hills.back {
    height: 35%;
    background: #62B831;
    transform: rotate(4deg);
    bottom: -5vh;
}
.flat-hills.front {
    height: 48%;
    background: #84CC3A;
    transform: rotate(-3deg);
    bottom: -15vh;
    box-shadow: inset 0 20px 0 #79C22E;
}
.flat-path {
    display: none; /* Removed the orange path, pure grass now! */
}

.icon-img {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: #f59e0b;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2), inset 0 2px 2px rgba(255,255,255,0.5);
}
.icon-img.small-icon { width: 20px; height: 20px; }
.icon-img.xs-icon { width: 16px; height: 16px; border-width: 1.5px; }

/* ============================================================
   HOME SCREEN
   ============================================================ */
#home-screen { gap: 0; padding: 24px 20px; z-index:10; }

.icon-btn {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--btn-tan);
    color: var(--text-brown);
    border: none;
    box-shadow: 0 6px 0 var(--btn-tan-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s;
}
.icon-btn:active { transform: translateY(6px); box-shadow: 0 0px 0 var(--btn-tan-shadow); }
.icon-btn.sound-off svg { opacity: 0.5; }

.wooden-board {
    background: var(--wood-base);
    border: 4px solid var(--text-brown);
    border-radius: 16px;
    padding: 24px 32px;
    box-shadow: 0 8px 0 var(--wood-shadow);
    position: relative;
    text-align: center;
}
.home-logo-wrap {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    max-width: 380px;
    z-index: 5;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}
.home-board {
    margin: 4% auto;
    width: 80%;
    max-width: 320px;
}

.home-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: #FFF;
    /* Rich, clean 3D text shadow instead of a messy border */
    text-shadow: 
        0 1px 0 #DDA066,
        0 2px 0 #C28B59,
        0 3px 0 #A6764B,
        0 4px 0 #8B623E,
        0 8px 15px rgba(0,0,0,0.4);
    line-height: 1;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.home-tagline {
    font-size: 1.1rem;
    color: #64748b;
    font-weight: 700;
    letter-spacing: 0px;
}

.home-actions { 
    display: flex; 
    flex-direction: column; 
    gap: 24px; 
    width: 100%; 
    max-width: 300px; 
    z-index: 1; 
    margin: 0 auto; 
    align-items:center; 
}

.play-btn {
    width: 100%;
    max-width: 280px;
    padding: 20px;
    border-radius: 20px;
    border: none;
    background: linear-gradient(180deg, #81D225 0%, #64B11C 100%);
    /* Better border: thinner, more subtle glow */
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: #FFF9E0; /* Creamy white */
    font-family: inherit;
    font-size: 1.5rem;
    font-weight: 900;
    cursor: pointer;
    /* Clean depth shadow */
    box-shadow: 0 8px 0 #397A0A, 0 12px 20px rgba(0,0,0,0.3);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.play-btn:active { transform: translateY(8px); box-shadow: 0 0px 0 #397A0A; }

.home-lower-btns-circle {
    display: flex;
    gap: 24px;
    width: 100%;
    justify-content: center;
    position: absolute;
    bottom: 40px;
    left: 0;
    padding: 0 20px;
}

/* New Circle Button System */
.circle-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 4px solid #F8B41D;
    background: #F8B41D;
    box-shadow: 0 6px 0 #D47913, 0 8px 12px rgba(0,0,0,0.2);
    padding: 0;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.1s;
    position: relative;
}
.circle-btn:active { transform: translateY(6px); box-shadow: 0 0px 0 #D47913; }

.circle-btn-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 -5px 0 rgba(0,0,0,0.2);
    position: relative;
}

/* Circle Themes */
.blue-theme .circle-btn-inner { background: linear-gradient(180deg, #37C2FA 0%, #1793DD 100%); }
.purple-theme .circle-btn-inner { background: linear-gradient(180deg, #A85CF0 0%, #7632BF 100%); }
.green-theme .circle-btn-inner { background: linear-gradient(180deg, #A5DE37 0%, #7CB416 100%); }
.orange-theme .circle-btn-inner { background: linear-gradient(180deg, #FF9E3D 0%, #F27B13 100%); }
.gray-theme .circle-btn-inner { background: linear-gradient(180deg, #CBD5E1 0%, #94A3B8 100%); }
.red-theme .circle-btn-inner { background: linear-gradient(180deg, #F87171 0%, #DC2626 100%); }

.btn-badge {
    position: absolute;
    bottom: -6px;
    right: -8px;
    background: #E83F3F;
    color: white;
    font-size: 13px;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 12px;
    border: 2px solid #F8B41D;
    box-shadow: 0 2px 0 #AF2525;
}

.home-coin-display {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    background: #475a7a;
    padding: 4px 4px 4px 14px;
    border-radius: 20px;
    color: white;
    font-weight: 800;
    gap: 6px;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2);
}
.coin-icon { font-size: 1.1rem; }

/* ============================================================
   IN-GAME SCREEN
   ============================================================ */
#game-screen {
    padding: 0;
    gap: 0;
    justify-content: flex-start;
}

.game-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    width: 100%;
    max-width: 480px;
    padding: 16px 16px 12px; /* reduced h-padding */
    z-index: 10;
    flex-shrink: 0;
    position: relative;
}

.topbar-left {
    display: flex;
    gap: 8px;
    z-index: 2;
}

.game-back-btn {
    width: 48px; /* Slightly smaller to prevent crunching */
    height: 48px; 
}
.game-back-btn .circle-btn-inner svg {
    width: 24px;
    height: 24px;
}

.game-level-badge {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    border: none;
    color: #FFF;
    padding: 8px 16px;
    font-weight: 900;
    font-size: 1.5rem;
    /* Soft but distinct depth shadow */
    text-shadow: 0 2px 4px rgba(0,0,0,0.4), 0 0 10px rgba(255,255,255,0.2);
    z-index: 1;
}
.game-level-badge span { color: #FFF; font-size: 1.8rem; }

.game-stats-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pill-coin {
    display: flex;
    align-items: center;
    background: #475a7a; 
    border-radius: var(--radius-full);
    padding: 2px 6px 2px 18px; 
    font-weight: 900;
    font-size: 1.4rem;
    color: #fff; 
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.2); 
    height: 42px;
    gap: 8px;
}
.pill-coin-icon-img {
    width: 44px;
    height: 44px;
    margin-right: -10px;
    object-fit: contain;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.25));
    transition: transform 0.15s cubic-bezier(0.175,0.885,0.32,1.275);
}

.game-board-wrap {
    width: 100%;
    padding: 0 16px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.main-board {
    position: relative;
    box-sizing: border-box;
    width: 90%;
    height: 90%;
    max-width: 480px;
    max-height: 480px;
    border-radius: 20px;
    background: var(--wood-highlight);
    border: 6px solid var(--wood-shadow);
    box-shadow: 0 10px 0 var(--wood-shadow), 0 15px 25px rgba(0,0,0,0.3);
    overflow: visible;
    touch-action: none;
    background-size: cover;
    background-position: center;
}

#grid-container {
    display: grid;
    width: 100%;
    height: 100%;
    gap: 0;
    z-index: 10;
    position: relative;
}

#lines-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 5;
}

.path-line {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cell {
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    cursor: pointer;
    position: relative;
    border-radius: var(--cell-radius, 8px);
    margin: var(--cell-margin, 2px);
    min-width: 0;
    min-height: 0;
}
.cell.visited {
    background: transparent;
    box-shadow: none;
}
.cell span {
    opacity: 0;
    --ns: 0.5;
    box-sizing: border-box;
    transform: scale(var(--ns));
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #FF8014; /* Cleaner vibrant orange */
    color: #fff;
    width: 85%;
    height: 85%;
    max-width: 42px;
    max-height: 42px;
    min-width: 0;
    min-height: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    font-weight: 900;
    position: relative;
    z-index: 2;
    border: var(--clue-border, 3px) solid #FFF; /* Pure white border for high contrast */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); /* Subtle soft shadow instead of heavy dark one */
}
.cell span::after {
    content: "";
    display: block;
    padding-bottom: 100%;
}
#grid-container[data-size="3"] .cell span, #grid-container[data-size="4"] .cell span { font-size: 1.3rem; }
#grid-container[data-size="5"] .cell span, #grid-container[data-size="6"] .cell span { font-size: 1.1rem; }
#grid-container[data-size="7"] .cell span, #grid-container[data-size="8"] .cell span { font-size: 0.95rem; }
#grid-container[data-size="9"] .cell span, #grid-container[data-size="10"] .cell span { font-size: 0.85rem; }
#grid-container[data-size="11"] .cell span, #grid-container[data-size="12"] .cell span { font-size: 0.68rem; }
#grid-container[data-size="13"] .cell span, #grid-container[data-size="14"] .cell span {
    font-size: 0.58rem;
    width: 92%;
    height: 92%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.12);
}

.cell.clue span    { opacity: 1; --ns: 1;    transform: scale(var(--ns)); }
.cell.visited span { opacity: 1; --ns: 1;    transform: scale(var(--ns)); }
.cell.current span { --ns: 1.15; transform: scale(var(--ns)); }
.cell.win-anim span { display: none !important; }
.cell.win-anim {
    background-color: transparent !important;
    box-shadow: none !important;
}

/* Hint revealed cell glow */
.cell.hint-reveal span {
    background: var(--btn-blue) !important;
    box-shadow: 0 4px 0 var(--btn-blue-shadow) !important;
    animation: hintPulse 1.5s ease-in-out;
}
@keyframes hintPulse {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.15); box-shadow: 0 6px 0 var(--btn-blue-shadow) !important; }
}

.game-footer {
    width: 100%;
    max-width: 320px;
    display: flex;
    gap: 16px;
    padding: 16px 20px 24px;
    flex-shrink: 0;
    z-index: 10;
    align-items: center;
    justify-content: center;
    box-sizing: border-box; /* Ensures padding stays within bounds */
}

.footer-btn {
    flex: 1;
    min-width: 0;
    padding: 16px 10px;
    border-radius: 12px;
    border: none;
    background: #EF4444;
    color: white;
    font-family: inherit;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 6px 0 #B91C1C;
    transition: transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.footer-btn:active { transform: translateY(6px); box-shadow: 0 0px 0 #B91C1C; }
.hint-btn { 
    flex: none;
    width: 68px;
    height: 68px;
    flex-shrink: 0;
}
.hint-btn .circle-btn-inner svg {
    width: 24px;
    height: 24px;
}
.hint-btn .btn-badge {
    bottom: -6px;
    right: -8px;
    font-size: 13px;
    padding: 3px 8px;
    border-width: 2px;
}
.footer-btn.next-level-inline-btn { 
    background: linear-gradient(180deg, #dd2b2b 0%, #bb1111 100%); 
    box-shadow:0 6px 0 #880303, 0 12px 20px rgb(255 0 0 / 20%);
    color: #FFFFFF;
    font-size: 1.5rem; 
    padding: 16px 12px; 
    border-radius: 20px; 
    border: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    /* Clean, professional 3D text shadow */
    text-shadow: 0 2px 0 #880303, 0 3px 6px rgba(0, 0, 0, 0.3);
}
.footer-btn.next-level-inline-btn:active { transform: translateY(6px); box-shadow: 0 0px 0 #468803; }

.hide-footer { display: none !important; }

/* ============================================================
   INLINE WIN ANIMATIONS
   ============================================================ */
.inline-win-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 30;
    pointer-events: none;
}
.inline-stars {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
}
.star.inline {
    transition: all 0.5s cubic-bezier(0.175,0.885,0.32,1.275);
    width: 70px;
    height: 70px;
    object-fit: contain;
    opacity: 0.8; /* Show as not-full by default */
}
#star_pos_0 { transform: scale(0.8) rotate(-15deg); margin-top: 15px; }
#star_pos_1 { transform: scale(1.1); z-index: 2; }
#star_pos_2 { transform: scale(0.8) rotate(15deg); margin-top: 15px; }

.star.inline.active {
    opacity: 1;
    filter: drop-shadow(0 0 10px rgba(251,191,36,0.6));
}

.star.inline.active#star_pos_0 { animation: star0Pop 0.6s cubic-bezier(0.175,0.885,0.32,1.275) forwards; }
.star.inline.active#star_pos_1 { animation: star1Pop 0.6s cubic-bezier(0.175,0.885,0.32,1.275) forwards; }
.star.inline.active#star_pos_2 { animation: star2Pop 0.6s cubic-bezier(0.175,0.885,0.32,1.275) forwards; }

@keyframes star0Pop {
    0% { transform: scale(0.8) rotate(-15deg); }
    50% { transform: scale(1.1) rotate(-10deg); }
    100% { transform: scale(0.8) rotate(-15deg); }
}
@keyframes star1Pop {
    0% { transform: scale(1.1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1.1); }
}
@keyframes star2Pop {
    0% { transform: scale(0.8) rotate(15deg); }
    50% { transform: scale(1.1) rotate(10deg); }
    100% { transform: scale(0.8) rotate(15deg); }
}
.inline-reward-text {
    font-size: 1.8rem;
    font-weight: 900;
    color: #facc15;
    text-shadow: 0 4px 0 var(--btn-orange-shadow);
    margin-top: -10px;
    opacity: 0;
    transform: translateY(20px);
}
.inline-reward-text.active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.175,0.885,0.32,1.275) 0.5s;
}

.ghost-coin {
    position: fixed;
    width: 44px;
    height: 44px;
    z-index: 9999;
    pointer-events: none;
    margin-top: -22px;
    margin-left: -22px;
}

/* ============================================================
   MODALS / OVERLAYS
   ============================================================ */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10,14,26,0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}
.overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background: #FFF9ED; /* Warm cream */
    border: 4px solid #DFB58C;
    border-radius: 24px;
    padding: 24px 20px;
    text-align: center;
    max-width: 380px;
    width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.2s;
    position: relative;
    box-shadow: 0 8px 0 #DFB58C, 0 16px 30px rgba(0,0,0,0.25);
}
.overlay.show .modal-card { transform: scale(1) translateY(0); }

/* How to Play */
.how-to-list {
    text-align: left;
    margin: 16px 0 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow:auto;
}
.how-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.95rem;
    color: #5C3A21;
    line-height: 1.4;
    font-weight: 600;
}
.how-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF9E3D, #F27B13);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.inline-coin-cost {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}
.inline-coin-cost img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: middle;
}

.reset-card {
    gap: 18px;
}
.reset-copy {
    line-height: 1.45;
    max-width: 300px;
    align-self: center;
}
.reset-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
}
.reset-actions .footer-btn {
    min-width: 120px;
    height: 54px;
    padding: 0 18px;
    font-size: 1.05rem;
}
.reset-cancel-btn {
    background: var(--btn-blue);
    box-shadow: 0 6px 0 var(--btn-blue-shadow);
}
.reset-confirm-btn {
    background: #ef4444;
    box-shadow: 0 6px 0 #991b1b;
}
.reset-confirm-btn:active,
.reset-cancel-btn:active {
    transform: translateY(6px);
    box-shadow: none;
}

/* Shop Modal */
.shop-tabs {
    margin-bottom: 12px;
}
.shop-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: #EBE1D0;
    border-radius: 8px;
    font-weight: 800;
    color: #8C6A51;
    cursor: pointer;
    box-shadow: inset 0 -3px rgba(0,0,0,0.1);
}
.shop-tab.active {
    background: var(--btn-blue);
    color: white;
    box-shadow: inset 0 -3px var(--btn-blue-shadow);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: max-content;
    align-content: start;
    gap: 12px;
    margin: 20px 0 24px;
    flex-shrink: 1;
    overflow-y: auto;
    padding: 4px;
}
.theme-item {
    border-radius: 16px;
    padding: 12px 6px;
    border: 3px solid #EBE1D0;
    background: #FFFFFF;
    color: #5C3A21;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 800;
    box-shadow: 0 4px 0 #EBE1D0;
}
.theme-item.active { 
    border-color: #64B11C; 
    background: #F4FCEB; 
    color: #397A0A;
    box-shadow: 0 4px 0 #64B11C;
    transform: translateY(2px);
}
.theme-swatch { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
.theme-cost { display: flex; align-items: center; gap: 4px; color: #E27B08; font-size: 0.8rem; font-weight: 900;}
.theme-item.owned .theme-cost { color: #84CC3A; }

/* ============================================================
 /* WIN SCREEN STYLES REMOVED (Replaced by Inline Animation) */

.modal-x-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    box-shadow: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
    z-index: 10;
    padding: 0;
}
.modal-x-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}
.modal-x-btn:active { transform: scale(0.9); }

.modal-title { font-size: 1.8rem; font-weight: 900; margin-bottom: 4px; color: #5C3A21; text-shadow: none; }
.modal-sub   { font-size: 1rem; color: #8C6A51; margin-bottom: 0; font-weight:700; }

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: max-content;
    align-content: start;
    gap: 12px;
    flex-shrink: 1;
    overflow-y: auto;
    padding: 4px;
    margin-bottom: 8px;
}

/* Gallery Item */
.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1/1;
    min-height: 120px;
    background: #CBD5E1;
    border: 4px solid #DFB58C;
    box-shadow: 0 4px 0 #DFB58C;
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.gallery-item.locked img {
    filter: grayscale(100%) brightness(0.5);
}
.gallery-item.locked::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: url('/games/zip-saw-directembedcode/GameAsset/lock_icon.png') no-repeat center center;
    background-size: contain;
}
.gallery-level-badge {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    background: rgba(0,0,0,0.6);
    color: white;
    text-align: center;
    font-weight: bold;
    font-size: 0.8rem;
    padding: 4px 0;
}

/* Stars rating */
.stars-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
    font-size: 3rem;
    color: #e2e8f0;
}
.star.active {
    color: #fbbf24;
    text-shadow: 0 0 15px rgba(251,191,36,0.6);
    animation: starPop 0.4s cubic-bezier(0.175,0.885,0.32,1.275) forwards;
}
@keyframes starPop {
    0%   { transform: scale(0); }
    100% { transform: scale(1); }
}

/* ============================================================
   CONFETTI CANVAS
   ============================================================ */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 199;
    display: none;
}

/* ============================================================
   COIN FLOAT ANIMATION
   ============================================================ */
.coin-float {
    position: fixed;
    font-size: 1.3rem;
    pointer-events: none;
    z-index: 300;
    animation: coinFly 1.2s ease-out forwards;
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
@keyframes coinFly {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    80%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-80px) scale(0.7); }
}

@media (max-width: 380px), (max-height: 680px) {
    .game-topbar {
        margin-bottom: 8px;
        padding: 10px 12px 8px;
    }

    .game-back-btn {
        width: 42px;
        height: 42px;
    }

    .game-level-badge {
        font-size: 1.1rem;
        padding: 6px 10px;
    }

    .game-level-badge span {
        font-size: 1.35rem;
    }

    .pill-coin {
        height: 36px;
        font-size: 1.05rem;
        padding-left: 14px;
    }

    .pill-coin-icon-img {
        width: 38px;
        height: 38px;
        margin-right: -6px;
    }

    .game-board-wrap {
        padding: 0 8px;
    }

    .main-board {
        border-width: 4px;
        border-radius: 14px;
        box-shadow: 0 6px 0 var(--wood-shadow), 0 10px 18px rgba(0,0,0,0.28);
    }

    .game-footer {
        padding: 10px 16px 14px;
    }
}
