
@font-face {
    font-family: 'IRANSansWeb';
    src: url('../../fonts/iransans/IRANSansWeb(FaNum).woff2') format('woff2'), url('../../fonts/iransans/IRANSansWeb(FaNum).woff') format('woff');
    font-weight: normal;
    font-display: swap;
}


:root {
    --green: #7CC342;
    --green-d: #6BAF36;
    --green-dd: #5A9B2A;
    --orange: #F7941E;
    --orange-d: #E07D0A;
    --pink: #EC4699;
    --pink-d: #D4348A;
    --blue: #29ABE2;
    --blue-d: #1F92CB;
    --yellow: #FFB300;
    --yellow-d: #E69F00;
    --red: #ef4444;
    --purple: #8b6ee8;
    --purple-d: #6f55c9;
    --cream: #fffaf0;
    --card: #fffdf8;
    --ink: #4a3b22;
    --muted: #a99b7e;
    --tan: #f1e3c6;
    --tan-d: #e3d0a8;
    --shadow: 0 16px 34px rgba(120,80,20,.20);
    --fred: "IRANSansWeb",sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none
}

html, body {
    height: 100%
}

body {
    margin: 0;
    font-family: "IRANSansWeb",Tahoma,system-ui,sans-serif;
    color: var(--ink);
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #FFF6E0 0%, #FFEFD9 100%);
}

/* ===== floating bubbles / sparkles ===== */
.fx-layer {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0
}

    .fx-layer i {
        position: absolute;
        border-radius: 50%;
        background: radial-gradient(circle at 35% 30%,rgba(255,255,255,.95),rgba(255,255,255,.1));
        opacity: .5;
        animation: rise linear infinite;
        bottom: -60px
    }

@keyframes rise {
    0% {
        transform: translateY(0) scale(.6);
        opacity: 0
    }

    10% {
        opacity: .55
    }

    90% {
        opacity: .45
    }

    100% {
        transform: translateY(-118vh) translateX(40px) scale(1.1);
        opacity: 0
    }
}

.spark {
    position: absolute;
    color: #fff;
    opacity: .85;
    animation: twinkle 2.6s ease-in-out infinite
}

@keyframes twinkle {
    0%,100% {
        transform: scale(.5);
        opacity: .25
    }

    50% {
        transform: scale(1);
        opacity: .9
    }
}

/* ===== STAGE ===== */
.stage {
    position: relative;
    z-index: 1;
    width: min(100vw, 440px);
    height: min(100svh, 100vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(160deg, #ffffff, #fff7fb);
    border-radius: 15px;
    box-shadow: var(--shadow);
}

    /* بگراند متحرک داخل stage */
    .stage > #bgCanvas {
        position: absolute;
        inset: 0;
        z-index: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
    }

    .stage > #skyParticles {
        position: absolute;
        inset: 0;
        z-index: 1;
        overflow: hidden;
        pointer-events: none;
    }

/* ===== SCREENS ===== */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    border-radius: 15px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scale(.96);
    transition: opacity .4s ease,transform .4s ease,visibility .4s;
    z-index: 2;
}

    .screen.active {
        opacity: 1;
        visibility: visible;
        transform: scale(1)
    }

/* ============ candyland background (CSS, swappable) ============ */
.candyland {
    position: absolute;
    inset: 0;
    z-index: -1;
    /* background: url(images/bg.jpg); */
    /* بگراند متحرک از canvas نشون داده میشه */
    background: transparent;
}

    .candyland .hill {
        position: absolute;
        left: -10%;
        right: -10%;
        border-radius: 50%/40px
    }

    .candyland .h1 {
        bottom: -30px;
        height: 160px;
        background: linear-gradient(180deg,#aee06a,#7ec43a);
        border-radius: 50% 50% 0 0/70px 70px 0 0
    }

    .candyland .h2 {
        bottom: 30px;
        left: -25%;
        width: 70%;
        height: 120px;
        background: #9ad84f;
        border-radius: 50%;
        opacity: .9
    }

    .candyland .h3 {
        bottom: 20px;
        right: -25%;
        left: auto;
        width: 70%;
        height: 130px;
        background: #8ccf3f;
        border-radius: 50%;
        opacity: .9
    }

    .candyland .cloud {
        position: absolute;
        background: #fff;
        border-radius: 50px;
        filter: blur(.4px);
        opacity: .92;
        box-shadow: 0 8px 16px rgba(80,120,160,.12)
    }

        .candyland .cloud::before, .candyland .cloud::after {
            content: "";
            position: absolute;
            background: #fff;
            border-radius: 50%
        }

.lolly {
    position: absolute;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: conic-gradient(from 0deg,#ff6fae,#ffd24d,#7ee06a,#5fc8ff,#c08bff,#ff6fae);
    box-shadow: 0 4px 8px rgba(0,0,0,.18),inset 0 0 0 5px rgba(255,255,255,.55)
}

    .lolly::after {
        content: "";
        position: absolute;
        top: 100%;
        left: 50%;
        width: 7px;
        height: 46px;
        margin-left: -3px;
        background: linear-gradient(90deg,#fff,#e9e3d2);
        border-radius: 4px
    }

.candylog {
    position: absolute;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    transform: rotate(20deg);
    background: repeating-linear-gradient(45deg,#ff7eb3 0 8px,#fff 8px 16px);
    box-shadow: 0 3px 6px rgba(0,0,0,.15)
}

/* ============ START SCREEN ============ */
#screen-start {
    align-items: center;
    padding: 20px 22px;
    padding-top: 10%;
}

    #screen-start .logo {
        width: min(72%,250px);
        filter: drop-shadow(0 10px 12px rgba(0,0,0,.22));
        margin-bottom: 20px;
        animation: logoIn .7s cubic-bezier(.2,1.3,.4,1) both
    }

@keyframes logoIn {
    from {
        transform: translateY(-30px) scale(.55) rotate(-7deg);
        opacity: 0
    }
}

.start-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 28px;
    padding: 22px 20px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 14px 36px rgba(247, 148, 30, .14), inset 0 2px 0 rgba(255, 255, 255, .8);
    position: relative;
    z-index: 2;
}

.headline {
    font-weight: 900;
    font-size: 26px;
    margin: 0px 0 15px;
    text-align: center;
    /* background: linear-gradient(90deg, #b2d234, #f36f21, #d9166e, #069edb, #b2d234); */
    /* -webkit-background-clip: text; */
    /* background-clip: text; */
    /* -webkit-text-fill-color: transparent; */
    color: #3f3f3f;
    padding: 0px;
}

}


.sub {
    color: #000000;
    font-size: 16px;
    margin: 0 0 16px;
    line-height: 1.8;
    text-align: center
}

.field {
    margin-bottom: 12px
}

    .field label {
        display: block;
        font-weight: 800;
        font-size: 17px;
        margin: 0 4px 6px;
        color: var(--ink)
    }

.input-wrap {
    position: relative
}

    .input-wrap .ico {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: 10px;
        width: 35px;
        height: 35px;
        display: grid;
        place-items: center;
        border-radius: 50%;
        font-size: 14px;
    }

        .input-wrap .ico.person {
            background: #eef0f3;
            color: #9aa1ad
        }

        .input-wrap .ico.phone {
            background: #e6f6dc;
            color: var(--green-d)
        }

.field input {
    width: 100%;
    padding: 16px 18px 16px 52px;
    border-radius: 16px;
    border: 2.5px solid #efe6d2;
    background: #fffdf9;
    font-family: inherit;
    font-size: 18px;
    color: var(--ink);
    outline: none;
    transition: border-color .2s,box-shadow .2s
}

    .field input::placeholder {
        color: #cbc1aa
    }

    .field input:focus {
        border-color: var(--green);
        box-shadow: 0 0 0 4px rgba(126,196,58,.18)
    }

/* ===== Difficulty buttons (Index 2 style) ===== */
.diff-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 0;
    margin-bottom: 22px;
}

.diff-btn {
    --level-main: #FF9F1C;
    --level-dark: #D76800;
    --level-soft: #FFF4C6;
    --level-ring: rgba(255,159,28,.28);
    position: relative;
    min-height: 96px;
    border: 0;
    border-radius: 24px;
    padding: 14px 8px 12px;
    font-family: inherit;
    font-weight: 900;
    color: #1c4f1f;
    background: linear-gradient(180deg,#ffffff 0%,var(--level-soft) 100%);
    box-shadow: inset 0 2px 0 rgba(255,255,255,.95), inset 0 -3px 0 rgba(0,0,0,.05), 0 4px 0 rgba(175,130,30,.14), 0 8px 18px rgba(180,120,0,.10);
    cursor: pointer;
    overflow: hidden;
    transition: transform .12s ease, box-shadow .18s ease, filter .18s ease;
    text-align: center;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

    .diff-btn:hover {
        filter: brightness(1.02);
        transform: translateY(-1px);
    }

    .diff-btn:active {
        transform: translateY(2px) scale(.985);
        box-shadow: inset 0 2px 0 rgba(255,255,255,.8), inset 0 -2px 0 rgba(0,0,0,.05), 0 2px 0 rgba(175,130,30,.14), 0 4px 10px rgba(180,120,0,.08);
    }

    .diff-btn.easy {
        --level-main: #6AC539;
        --level-dark: #3B8E1B;
        --level-soft: #E8F9D6;
        --level-ring: rgba(106,197,57,.30);
    }

    .diff-btn.medium {
        --level-main: #FF9F1C;
        --level-dark: #D66800;
        --level-soft: #FFF0B8;
        --level-ring: rgba(255,159,28,.32);
    }

    .diff-btn.hard {
        --level-main: #E91E63;
        --level-dark: #A71248;
        --level-soft: #FFE1EC;
        --level-ring: rgba(233,30,99,.30);
    }

    .diff-btn .level-icon {
        position: relative;
        z-index: 2;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        margin-bottom: 8px;
        border-radius: 50%;
        background: linear-gradient(180deg,#fff, var(--level-soft));
        box-shadow: inset 0 2px 0 rgba(255,255,255,.9), 0 2px 6px var(--level-ring);
        font-size: 0;
        color: transparent;
        overflow: hidden;
    }

        .diff-btn .level-icon::after {
            content: "";
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: var(--level-main);
            box-shadow: 0 0 0 4px color-mix(in srgb, var(--level-main) 18%, white);
            display: block;
        }

@supports not (background: color-mix(in srgb, red, white)) {
    .diff-btn .level-icon::after {
        box-shadow: 0 0 0 4px rgba(255,255,255,.55);
    }
}

.diff-btn .level-title {
    position: relative;
    z-index: 2;
    display: block;
    font-size: 16px;
    line-height: 1.25;
    font-weight: 900;
    color: #143d18;
    text-shadow: 0 1px 0 rgba(255,255,255,.7);
}

.diff-btn.active {
    color: #fff;
    background: linear-gradient(180deg, color-mix(in srgb, var(--level-main) 85%, white 15%) 0%, var(--level-main) 46%, var(--level-dark) 100%);
    box-shadow: inset 0 2px 0 rgba(255,255,255,.45), inset 0 -4px 0 rgba(60,20,0,.18), 0 4px 0 var(--level-dark), 0 10px 22px var(--level-ring), 0 0 0 3px color-mix(in srgb, var(--level-main) 22%, transparent);
    transform: translateY(-2px);
    animation: levelPulse 2.2s ease-in-out infinite;
}

    .diff-btn.active .level-title {
        color: #fff;
        text-shadow: 0 2px 0 rgba(90,30,0,.22);
    }

    .diff-btn.active .level-icon {
        background: rgba(255,255,255,.22);
        box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 2px 6px rgba(0,0,0,.12);
    }

        .diff-btn.active .level-icon::after {
            width: 18px;
            height: 18px;
            background: var(--level-dark);
            box-shadow: 0 0 0 3px rgba(255,255,255,.28);
            -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/14px 14px no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/14px 14px no-repeat;
            border-radius: 3px;
        }

    .diff-btn.active::before {
        inset: 0;
        height: auto;
        border-radius: inherit;
        background: transparent;
        box-shadow: inset 0 0 0 2px rgba(255,255,255,.55);
    }

@supports not (background: color-mix(in srgb, red, white)) {
    .diff-btn.easy.active {
        background: linear-gradient(180deg,#8DE454,#6AC539 46%,#3B8E1B 100%);
        box-shadow: inset 0 2px 0 rgba(255,255,255,.45), inset 0 -4px 0 rgba(40,80,10,.2), 0 4px 0 #3B8E1B, 0 10px 20px rgba(106,197,57,.28);
    }

    .diff-btn.medium.active {
        background: linear-gradient(180deg,#FFBD4A,#FF9F1C 46%,#D66800 100%);
        box-shadow: inset 0 2px 0 rgba(255,255,255,.45), inset 0 -4px 0 rgba(120,50,0,.2), 0 4px 0 #D66800, 0 10px 20px rgba(255,159,28,.28);
    }

    .diff-btn.hard.active {
        background: linear-gradient(180deg,#FF5A95,#E91E63 46%,#A71248 100%);
        box-shadow: inset 0 2px 0 rgba(255,255,255,.45), inset 0 -4px 0 rgba(100,10,40,.22), 0 4px 0 #A71248, 0 10px 20px rgba(233,30,99,.28);
    }
}

@keyframes levelPulse {
    0%,100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.045);
    }
}

@media (max-width:380px) {
    .diff-btn {
        min-height: 88px;
        padding: 12px 6px 10px;
        border-radius: 20px;
    }

        .diff-btn .level-title {
            font-size: 14.5px;
        }

        .diff-btn .level-icon {
            width: 30px;
            height: 30px;
            margin-bottom: 6px;
        }
}

@media (max-height:700px) {
    .diff-btn {
        min-height: 84px;
    }
}

.field.err input {
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(239,68,68,.14)
}

.field .msg {
    color: var(--red);
    font-size: 12px;
    margin: 5px 6px 0;
    min-height: 14px;
    font-weight: 700
}

.mascot-wave {
    position: absolute;
    right: 8px;
    bottom: 6px;
    width: 130px;
    z-index: 3;
    pointer-events: none;
    filter: drop-shadow(0 8px 8px rgba(0,0,0,.22));
    transform-origin: bottom center;
    animation: floaty 3.2s ease-in-out infinite
}

@keyframes floaty {
    50% {
        transform: translateY(-10px) rotate(-3deg)
    }
}

/* ===== candy button ===== */
.btn-candy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    border: none;
    cursor: pointer;
    font-family: var(--fred);
    font-weight: 800;
    font-size: 15px;
    color: #fff;
    padding: 18px 22px;
    border-radius: 18px;
    background: linear-gradient(180deg,#93d650,var(--green-d));
    box-shadow: 0 6px 0 var(--green-dd),0 12px 18px rgba(95,165,36,.4);
    transition: transform .08s,box-shadow .08s,filter .15s;
    letter-spacing: .3px;
    font-family: "IRANSansWeb",sans-serif
}

    .btn-candy .arr {
        font-family: var(--fred)
    }

    .btn-candy:active {
        transform: translateY(4px);
        box-shadow: 0 2px 0 var(--green-dd),0 6px 10px rgba(95,165,36,.4)
    }

    .btn-candy.blue {
        background: linear-gradient(180deg,#54c4ee,var(--blue-d));
        box-shadow: 0 6px 0 #176f96,0 12px 18px rgba(41,171,226,.4)
    }

        .btn-candy.blue:active {
            box-shadow: 0 2px 0 #176f96,0 6px 10px rgba(41,171,226,.4)
        }

    .btn-candy.purple {
        background: linear-gradient(180deg,#a98ef2,var(--purple-d));
        box-shadow: 0 6px 0 #5946a8,0 12px 18px rgba(139,110,232,.4)
    }

        .btn-candy.purple:active {
            box-shadow: 0 2px 0 #5946a8,0 6px 10px rgba(139,110,232,.4)
        }

    .btn-candy.cream {
        background: linear-gradient(180deg,#fff,#f1e6cc);
        color: var(--ink);
        box-shadow: 0 6px 0 #d9c79c,0 12px 18px rgba(120,80,20,.18)
    }

        .btn-candy.cream:active {
            box-shadow: 0 2px 0 #d9c79c,0 6px 10px rgba(120,80,20,.18)
        }

    .btn-candy.sm {
        font-size: 16px;
        padding: 13px 16px;
        border-radius: 16px
    }

/* ============ GAME SCREEN ============ */
#screen-game {
    /* background: url(images/bg.jpg); */
    background: transparent;
}

    #screen-game .gclouds {
        position: absolute;
        inset: 0;
        z-index: 0;
        pointer-events: none;
        opacity: .7
    }

.topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 12px 6px;
    position: relative;
    z-index: 2
}

.player-card {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 9px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 18px;
    padding: 6px 12px 6px 8px;
    box-shadow: 0 5px 14px rgba(80,120,160,.18),inset 0 2px 0 #fff;
    min-width: 0;
    border: 1.5px solid rgba(255,255,255,.7);
}

.avatar {
    position: relative;
    width: 60px;
    height: 60px;
    flex: none;
    border-radius: 14px;
    background: linear-gradient(160deg,#bfe88f,#8ccf3f);
    display: grid;
    place-items: center;
    box-shadow: inset 0 2px 0 #fff,0 3px 6px rgba(0,0,0,.15);
    overflow: visible
}

    .avatar img {
        width: 38px;
        height: 38px;
        object-fit: contain;
        filter: drop-shadow(0 1px 1px rgba(0,0,0,.25))
    }

    .avatar .lvl {
        position: absolute;
        bottom: -7px;
        left: 50%;
        transform: translateX(-50%);
        background: linear-gradient(180deg,#ffd24d,var(--orange));
        color: #fff;
        font-family: var(--fred);
        font-weight: 700;
        font-size: 11px;
        padding: 1px 8px;
        border-radius: 999px;
        box-shadow: 0 2px 4px rgba(0,0,0,.25);
        border: 1.5px solid #fff
    }

.pcol {
    flex: 1;
    min-width: 0
}

.pname {
    font-weight: 800;
    font-size: 14px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block
}

.xp {
    height: 22px;
    background: #ece3d0;
    border-radius: 999px;
    margin-top: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgb(0 0 0 / 62%);
}

    .xp i {
        display: block;
        height: 100%;
        width: 0;
        border-radius: 999px;
        background: linear-gradient(90deg,#ffd24d,var(--orange));
        transition: width .6s
    }

.ctrl-btns {
    display: flex;
    gap: 7px;
    flex: none
}

.cbtn {
    width: 40px;
    /* height: 40px; */
    border: none;
    border-radius: 100%;
    cursor: pointer;
    font-size: 18px;
    display: grid;
    place-items: center;
    /* box-shadow: 0 4px 0 rgba(0, 0, 0, .18), inset 0 2px 0 rgba(255, 255, 255, .4); */
    transition: transform .08s, box-shadow .08s;
    color: #fff;
    padding: 0px;
}

    .cbtn img {
        width: inherit;
    }

    .cbtn:active {
        transform: translateY(3px);
        box-shadow: 0 1px 0 rgba(0,0,0,.18)
    }

    /*     .cbtn.pause {
                     background: linear-gradient(180deg,#a98ef2,var(--purple-d))
                 }*/

    .cbtn.sound {
        background: linear-gradient(180deg,#ffd24d,var(--orange))
    }

.stats-row {
    display: flex;
    gap: 8px;
    padding: 6px 12px 8px;
    position: relative;
    z-index: 2
}

.scard {
    flex: 1;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 13px 8px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(120, 80, 20, .10);
    border: 1.5px solid rgba(255, 255, 255, 0.7);
}

    .scard .lbl {
        font-size: 11px;
        color: var(--muted);
        font-weight: 800
    }

    .scard .val {
        font-family: var(--fred);
        font-weight: 700;
        font-size: 21px;
        line-height: 1.15;
        margin-top: 1px
    }

    .scard.time .val {
        color: var(--blue-d)
    }

    .scard.goal .val {
        color: var(--green-d)
    }

    .scard.score .val {
        color: var(--orange)
    }

    .scard.time.low {
        animation: tp .6s ease-in-out infinite
    }

        .scard.time.low .val {
            color: var(--red)
        }

@keyframes tp {
    50% {
        transform: scale(1.07)
    }
}

.timebar-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 14px;
    position: relative;
    z-index: 2
}

    .timebar-wrap .clk {
        /*   width: 22px;
                     height: 22px;*/
        flex: none;
        border-radius: 50%;
        background: #fff;
        display: grid;
        place-items: center;
        font-size: 12px;
        box-shadow: 0 2px 5px rgba(0,0,0,.18)
    }

.timebar {
    flex: 1;
    height: 25px;
    background: rgba(255,255,255,.6);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 2px 3px rgb(0 0 0 / 58%);
}

    .timebar i {
        display: block;
        height: 100%;
        width: 100%;
        border-radius: 999px;
        background: linear-gradient(90deg,#7ec43a 0%,#ffd24d 55%,#ef4444 100%);
        transition: width 1s linear
    }

/* ===== BOARD ===== */
.board-shell {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 12px 12px 4px;
    position: relative;
    z-index: 2;
    min-height: 0
}

.board {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    display: grid;
    grid-template-columns: repeat(var(--size),1fr);
    gap: 5px;
    background: linear-gradient(160deg,#f3e6c8,#e6d3aa);
    padding: 8px;
    border-radius: 24px;
    box-shadow: inset 0 3px 9px rgba(120,80,20,.28),0 10px 22px rgba(120,80,20,.18),inset 0 -3px 0 rgba(255,255,255,.3);
    touch-action: none
}

.cell {
    position: relative;
    border-radius: 13px;
    background: rgba(90,60,20,.10);
    box-shadow: inset 0 2px 4px rgba(120,80,20,.18)
}

    .cell.sel::after, .cell.target::after {
        content: "";
        position: absolute;
        inset: -3px;
        border-radius: 16px;
        border: 3px solid #fff;
        box-shadow: 0 0 0 3px var(--green),0 0 12px var(--green);
        pointer-events: none;
        z-index: 4
    }

    .cell.target::after {
        box-shadow: 0 0 0 3px var(--pink),0 0 12px var(--pink)
    }

    .cell.armed::after {
        content: "";
        position: absolute;
        inset: -2px;
        border-radius: 15px;
        border: 2.5px dashed var(--orange);
        animation: armspin 6s linear infinite;
        pointer-events: none;
        z-index: 4
    }

@keyframes armspin {
    to {
        transform: rotate(360deg)
    }
}

.cell.hintcell::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 15px;
    border: 3px solid var(--yellow);
    box-shadow: 0 0 12px var(--yellow);
    animation: tp .55s ease-in-out infinite;
    pointer-events: none;
    z-index: 5
}

.tile {
    position: absolute;
    inset: 0;
    border-radius: 13px;
    display: grid;
    place-items: center;
    cursor: grab;
    background: linear-gradient(165deg, #ffffff, #f5f5f5);
    border-bottom: 4px solid var(--ca,#888);
    box-shadow: inset 0 2px 3px rgba(255,255,255,.18),inset 0 -2px 4px rgba(0,0,0,.4),0 2px 5px rgba(0,0,0,.25),0 0 0 2px rgba(0,0,0,.05);
    will-change: transform,opacity;
    transition: transform .16s ease,opacity .18s ease
}

    .tile::before {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: 13px;
        background: linear-gradient(155deg,rgba(255,255,255,.22),rgba(255,255,255,0) 42%);
        pointer-events: none
    }

    .tile .pic {
        position: absolute;
        inset: 12%;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        filter: drop-shadow(0 2px 2px rgba(0,0,0,.45));
        pointer-events: none
    }

    .tile.k-worm {
        --ca: #f7a01e
    }

    .tile.k-bear {
        --ca: #29abe2
    }

    .tile.k-dino {
        --ca: #7ec43a
    }

    .tile.k-bottle {
        --ca: #ef4444
    }

    .tile.k-heart {
        --ca: #ec4699
    }

    .tile.dragging {
        transform: scale(1.1);
        z-index: 6;
        cursor: grabbing;
        box-shadow: 0 10px 18px rgba(0,0,0,.4),0 0 0 2px rgba(255,255,255,.25)
    }

    .tile.pop {
        animation: pop .32s cubic-bezier(.2,1.4,.4,1) both
    }

@keyframes pop {
    from {
        transform: scale(0) rotate(-25deg);
        opacity: 0
    }
}

.tile.removing {
    animation: remv .34s ease forwards;
    z-index: 3
}

@keyframes remv {
    30% {
        transform: scale(1.2) rotate(8deg);
        filter: brightness(1.6)
    }

    100% {
        transform: scale(0) rotate(40deg);
        opacity: 0
    }
}

.tile.spawn {
    opacity: 0;
    transform: translateY(-60%) scale(.7)
}

    .tile.spawn.in {
        opacity: 1;
        transform: none;
        transition: transform .32s cubic-bezier(.3,.9,.3,1.25),opacity .3s
    }

/* floaters / particles / combo */
.floater {
    position: absolute;
    font-family: var(--fred);
    font-weight: 700;
    font-size: 20px;
    color: #fff;
    pointer-events: none;
    z-index: 30;
    text-shadow: 0 2px 0 rgba(0,0,0,.3);
    animation: floatUp 1s ease-out forwards
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(.6);
        opacity: 0
    }

    20% {
        opacity: 1;
        transform: translateY(-6px) scale(1.15)
    }

    100% {
        transform: translateY(-48px) scale(1);
        opacity: 0
    }
}

.particle {
    position: absolute;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 25
}

.combo-banner {
    position: absolute;
    top: 46%;
    left: 50%;
    transform: translate(-50%,-50%);
    z-index: 40;
    pointer-events: none;
    opacity: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
    white-space: nowrap;
    font-family: var(--fred);
    font-weight: 700
}

    .combo-banner.show {
        animation: comboPop 1s cubic-bezier(.2,1.4,.4,1)
    }

    .combo-banner .c1 {
        font-size: 34px;
        color: #fff;
        -webkit-text-stroke: 6px var(--pink);
        paint-order: stroke;
        text-shadow: 0 4px 0 var(--pink-d),0 6px 10px rgba(0,0,0,.25)
    }

    .combo-banner .c2 {
        font-size: 42px;
        color: #fff;
        -webkit-text-stroke: 6px var(--yellow);
        paint-order: stroke;
        text-shadow: 0 4px 0 #d99e00,0 6px 10px rgba(0,0,0,.25)
    }

@keyframes comboPop {
    0% {
        opacity: 0;
        transform: translate(-50%,-50%) scale(.3) rotate(-8deg)
    }

    35% {
        opacity: 1;
        transform: translate(-50%,-50%) scale(1.12) rotate(3deg)
    }

    72% {
        opacity: 1;
        transform: translate(-50%,-58%) scale(1)
    }

    100% {
        opacity: 0;
        transform: translate(-50%,-88%) scale(.9)
    }
}

.shake {
    animation: shake .35s
}

@keyframes shake {
    0%,100% {
        transform: none
    }

    20% {
        transform: translate(-5px,2px)
    }

    40% {
        transform: translate(5px,-2px)
    }

    60% {
        transform: translate(-4px,-2px)
    }

    80% {
        transform: translate(4px,2px)
    }
}

.toast {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.75);
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    padding: 10px 18px;
    border-radius: 999px;
    z-index: 50;
    opacity: 0;
    pointer-events: none
}

    .toast.show {
        animation: toastA 1.8s ease
    }

@keyframes toastA {
    10%,80% {
        opacity: 1
    }

    0%,100% {
        opacity: 0
    }
}

/* ===== power dock ===== */
.dock {
    display: flex;
    justify-content: center;
    gap: 3px;
    padding: 8px 0 12px;
    position: relative;
    z-index: 2;
    margin-bottom: 30px;
}

    .dock img {
        width: 73px;
    }

.pu {
    position: relative;
    /*   width: 56px;
                 height: 56px;*/
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    background: radial-gradient(circle at 35% 28%,#fffdf6,#f0e3c6);
    display: grid;
    place-items: center;
    box-shadow: 0 5px 0 #d9c79c,0 9px 14px rgba(120,80,20,.25),inset 0 2px 0 #fff;
    transition: transform .08s,box-shadow .08s,filter .15s
}

    .pu:active {
        transform: translateY(4px);
        box-shadow: 0 1px 0 #d9c79c,0 4px 8px rgba(120,80,20,.25)
    }

    .pu.armed {
        filter: brightness(1.05);
        box-shadow: 0 0 0 3px var(--orange),0 5px 0 #d9c79c,0 9px 14px rgba(247,148,30,.4)
    }

    .pu.empty {
        filter: grayscale(.7) opacity(.55);
        pointer-events: none
    }

    .pu .cnt {
        position: absolute;
        bottom: 0px;
        right: 12px;
        min-width: 30px;
        height: 30px;
        padding: 0 4px;
        border-radius: 999px;
        background: var(--red);
        color: #fff;
        font-family: var(--fred);
        font-weight: 700;
        font-size: 12px;
        display: grid;
        place-items: center;
        box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
        border: 1.5px solid #fff;
    }

/* ===== pause overlay ===== */
.pause-ov {
    position: absolute;
    inset: 0;
    z-index: 60;
    background: rgba(40,30,60,.55);
    backdrop-filter: blur(3px);
    display: none;
    place-items: center;
    border-radius: 34px
}

    .pause-ov.show {
        display: grid
    }

.pause-box {
    background: var(--card);
    border-radius: 26px;
    padding: 26px 24px;
    width: 80%;
    text-align: center;
    box-shadow: var(--shadow);
    border: 3px solid #fff
}

    .pause-box h3 {
        margin: 0 0 16px;
        font-size: 22px;
        color: var(--green-d);
        font-weight: 900
    }

    .pause-box .btn-candy {
        margin-bottom: 10px
    }

/* ============ GAME OVER - ساده و شیک ============ */
#screen-over {
    background: transparent;
    padding: 16px 18px 20px;
    overflow: hidden;
    justify-content: center;
    align-items: center;
}

.over-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    position: relative;
    z-index: 2;
    animation: overFadeIn .6s ease both;
}

@keyframes overFadeIn {
    from {
        opacity: 0;
        transform: scale(.94);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* لوگو در بالای صفحه پایان */
.over-logo {
    width: min(72%, 230px);
    filter: drop-shadow(0 10px 18px rgba(124, 195, 66, .35));
    animation: logoIn .8s cubic-bezier(.2,1.3,.4,1) both;
    margin-bottom: 4px;
}

@keyframes logoIn {
    from {
        transform: translateY(-30px) scale(.55);
        opacity: 0
    }
}

.over-celebrate {
    font-size: 26px;
    font-weight: 900;
    margin: 0;
    background: linear-gradient(90deg, #7CC342, #29ABE2, #EC4699, #FFB300);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: rainbow 4s linear infinite;
    letter-spacing: -.5px;
}

@keyframes rainbow {
    to {
        background-position: 200% center;
    }
}

.over-lottery {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
    color: #b25a04;
    background: linear-gradient(160deg, #fff7e6, #ffe6bd);
    padding: 8px 18px;
    border-radius: 999px;
    border: 2px solid #fff;
    box-shadow: 0 4px 12px rgba(255, 179, 0, .25);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .over-lottery .gift-emoji {
        animation: bounce 1.4s ease-in-out infinite;
        font-size: 18px;
    }

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px) rotate(-8deg);
    }
}

/* دو کارت آماری - ساده */
.over-stats {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 6px;
}

.stat-card {
    flex: 1;
    background: #fff;
    border-radius: 22px;
    padding: 16px 10px 14px;
    text-align: center;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .10);
    border: 2.5px solid #fff;
    position: relative;
    overflow: hidden;
}

    .stat-card.score-card {
        background: linear-gradient(160deg, #FFCB47 0%, #FFB300 100%);
        box-shadow: 0 8px 22px rgba(255, 179, 0, .35);
    }

    .stat-card.tiles-card {
        background: linear-gradient(160deg, #F7941E 0%, #E07D0A 100%);
        box-shadow: 0 8px 22px rgba(247, 148, 30, .35);
    }

    .stat-card::before {
        content: "";
        position: absolute;
        top: -30px;
        left: -30px;
        width: 90px;
        height: 90px;
        background: rgba(255, 255, 255, .25);
        border-radius: 50%;
        pointer-events: none;
    }

    .stat-card .stat-icon {
        font-size: 30px;
        /*           margin-bottom: 4px;*/
        position: relative;
        z-index: 1;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .15));
    }

    .stat-card .stat-label {
        font-size: 13px;
        font-weight: 800;
        color: rgba(255, 255, 255, .92);
        margin-bottom: 4px;
        position: relative;
        z-index: 1;
        text-shadow: 0 1px 0 rgba(0, 0, 0, .12);
    }

    .stat-card .stat-value {
        font-family: var(--fred);
        font-weight: 800;
        font-size: 32px;
        color: #fff;
        line-height: 1;
        position: relative;
        z-index: 1;
        text-shadow: 0 2px 0 rgba(0, 0, 0, .18);
        animation: scorePop 1s cubic-bezier(.2, 1.5, .4, 1) both;
        display: inline-block;
    }

@keyframes scorePop {
    0% {
        transform: scale(.4);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* دکمه‌ها - فقط دو دکمه */
.over-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}

    .over-actions .btn-candy {
        flex: 1;
    }

/* دکمه سبز برای "دوباره بازی" */
.btn-candy.green {
    background: linear-gradient(180deg, #A8E063, var(--green-d));
    box-shadow: 0 6px 0 var(--green-dd), 0 12px 18px rgba(124, 195, 66, .4);
}

    .btn-candy.green:active {
        box-shadow: 0 2px 0 var(--green-dd), 0 6px 10px rgba(124, 195, 66, .4);
    }

/* دکمه صورتی برای اشتراک‌گذاری */
.btn-candy.pink {
    background: linear-gradient(180deg, #F47AB3, var(--pink-d));
    box-shadow: 0 6px 0 #b32574, 0 12px 18px rgba(236, 70, 153, .4);
}

    .btn-candy.pink:active {
        box-shadow: 0 2px 0 #b32574, 0 6px 10px rgba(236, 70, 153, .4);
    }

.confetti {
    position: absolute;
    top: -12px;
    width: 10px;
    height: 10px;
    z-index: 2;
    border-radius: 2px;
    animation: fall linear forwards
}

    .confetti.circle {
        border-radius: 50%;
    }

    .confetti.star {
        background: transparent !important;
        color: #ffd24d;
        font-size: 14px;
        line-height: 1;
        text-shadow: 0 0 4px rgba(255,210,77,.5);
    }

@keyframes fall {
    to {
        transform: translateY(540px) rotate(560deg);
        opacity: .15
    }
}

.disabled {
    pointer-events: none
}

.difficulty-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 900;
    color: #1a6a2a;
    letter-spacing: -.2px;
}

    .difficulty-title::before,
    .difficulty-title::after {
        content: "";
        width: 36px;
        height: 3px;
        border-radius: 999px;
        background: linear-gradient(90deg,#FFD21F,#FF9F1C);
        opacity: .9;
    }

    .difficulty-title::after {
        background: linear-gradient(90deg,#4FC3F7,#E91E63);
    }

