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

html,
body{
    width:100%;
    height:100%;
    overflow:hidden;
    font-family:"Segoe UI", Tahoma, sans-serif;
    background:#06182f;
    color:#fff;
}
html,
body{
    min-height:100%;
    overflow-x:hidden;
    overflow-y:auto;
}
body{
    min-height:100vh;
    overflow-y:auto;
}

.app{
    min-height:100vh;
    height:auto;
    padding-bottom:20px;
}
button,
a{
    font-family:inherit;
    -webkit-tap-highlight-color:transparent;
}

button{
    cursor:pointer;
}

a{
    text-decoration:none;
}

.app{
    width:100%;
    height:100vh;
    position:relative;
    overflow:hidden;

    background:
        linear-gradient(rgba(0,0,0,.06), rgba(0,0,0,.10)),
        url("imag/background-desktop.webp") center center / cover no-repeat;
}

/* =========================
   TOP BAR
========================= */

.top-bar{
    position:absolute;
    top:16px;
    left:18px;
    right:18px;
    height:66px;

    display:flex;
    align-items:center;
    justify-content:space-between;

    z-index:50;
    pointer-events:none;
}

.top-left{
    display:flex;
    align-items:center;
    gap:10px;
    pointer-events:auto;
}

.round-btn{
    width:54px;
    height:54px;

    display:flex;
    align-items:center;
    justify-content:center;

    border:none;
    border-radius:50%;

    background:linear-gradient(180deg,#ffffff,#dfeaf2);
    color:#111;

    font-size:25px;
    font-weight:1000;

    box-shadow:
        inset 0 2px 0 rgba(255,255,255,.85),
        0 10px 22px rgba(0,0,0,.28);

    transition:.18s ease;
}

.round-btn:hover{
    transform:translateY(-2px) scale(1.04);
}

.round-btn:active{
    transform:scale(.94);
}

.back-games-btn{
    font-size:30px;
}

.owner-logo{
    position:absolute;
    left:50%;
    transform:translateX(-50%);

    max-width:150px;
    max-height:48px;

    object-fit:contain;
    pointer-events:none;
}

.stats{
    display:flex;
    gap:12px;
    align-items:center;
    pointer-events:auto;
}

.stat{
    min-width:104px;
    height:50px;

    display:flex;
    align-items:center;
    justify-content:center;
    gap:6px;

    border-radius:17px;

    background:rgba(10,58,110,.90);
    color:#fff;

    font-size:23px;
    font-weight:1000;

    box-shadow:
        inset 0 2px 0 rgba(255,255,255,.18),
        0 8px 18px rgba(0,0,0,.25);
}

/* =========================
   MAIN SCREEN
========================= */

.screen{
    display:none;
}

.screen.active{
    display:flex;
}

#menuScreen{
    width:100%;
    height:100vh;

    display:flex;
    gap:18px;

    padding:92px 24px 22px;
    position:relative;
    z-index:5;
}

/* =========================
   LEFT MENU
========================= */

.hero-panel{
    width:42%;
    height:100%;

    position:relative;
    overflow:hidden;

    display:flex;
    align-items:center;
    justify-content:center;
}

.menu-logo{
    position:absolute;

    top:4%;
    left:50%;
    transform:translateX(-50%);

    width:min(52%, 420px);
    z-index:4;

    pointer-events:none;
    filter:drop-shadow(0 12px 18px rgba(0,0,0,.30));
}

.menu-flamingo{
    position:absolute;

    bottom:10%;
    left:50%;
    transform:translateX(-50%);

    width:min(48%, 360px);
    z-index:2;

    pointer-events:none;
    filter:drop-shadow(0 14px 18px rgba(0,0,0,.28));
}

.menu-content{
    position:absolute;

    left:50%;
    bottom:9%;
    transform:translateX(-50%);

    width:76%;

    display:flex;
    flex-direction:column;
    align-items:center;

    z-index:8;
}

/* =========================
   GAME BUTTONS 2027
========================= */

.game-btn{
    position:relative;
    overflow:hidden;

    border:none;
    border-radius:18px;

    color:#fff;
    font-size:15px;
    font-weight:1000;

    letter-spacing:.2px;
    text-shadow:0 2px 0 rgba(0,0,0,.36);

    background:
        linear-gradient(180deg,#c85cff 0%,#8c20ff 50%,#5600c8 100%);

    border:2px solid rgba(255,218,75,.98);

    box-shadow:
        inset 0 2px 0 rgba(255,255,255,.42),
        inset 0 -4px 0 rgba(0,0,0,.28),
        0 5px 0 #3b0878,
        0 12px 20px rgba(0,0,0,.28);

    transition:
        transform .18s ease,
        filter .18s ease,
        box-shadow .18s ease;
}

.game-btn::before{
    content:"";
    position:absolute;
    top:-90%;
    left:-55%;

    width:45%;
    height:280%;

    background:linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,.52),
        transparent
    );

    transform:rotate(22deg);
    animation:buttonShine 3.1s ease-in-out infinite;
}

.game-btn::after{
    content:"";
    position:absolute;
    inset:4px;

    border-radius:14px;

    background:linear-gradient(
        180deg,
        rgba(255,255,255,.18),
        transparent 48%,
        rgba(0,0,0,.10)
    );

    pointer-events:none;
}

.game-btn span,
.game-btn b,
.game-btn small{
    position:relative;
    z-index:2;
}

.game-btn:hover{
    transform:translateY(-3px) scale(1.035);
    filter:saturate(1.12) brightness(1.08);
}

.game-btn:active{
    transform:translateY(3px) scale(.97);

    box-shadow:
        inset 0 2px 0 rgba(255,255,255,.25),
        inset 0 -2px 0 rgba(0,0,0,.22),
        0 2px 0 #3b0878,
        0 8px 16px rgba(0,0,0,.25);
}

@keyframes buttonShine{
    0%{
        left:-60%;
        opacity:0;
    }

    35%{
        opacity:1;
    }

    65%{
        left:115%;
        opacity:0;
    }

    100%{
        left:115%;
        opacity:0;
    }
}

.big-start{
    width:min(62%, 320px);
    height:52px;
    margin-bottom:14px;
}

.bottom-menu-row{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:14px;
}

.small-menu-btn{
    width:122px;
    height:44px;
}

.blue{
    background:linear-gradient(180deg,#1ba5ff,#0069c7);
}

.red{
    background:linear-gradient(180deg,#ff5a5a,#c71f1f);
}

/* =========================
   RIGHT GAME PANEL
========================= */

.play-panel{
    flex:1;
    height:100%;

    position:relative;
    overflow:visible;

    display:flex;
    align-items:center;
    justify-content:center;
}

.game-frame{
    position:absolute;

    top:0;
    left:0;

    width:100%;
    height:108%;

    object-fit:fill;
    transform:translateY(10px);

    pointer-events:none;
    z-index:1;
}

.play-overlay{
    position:absolute;

    left:8%;
    top:7.5%;

    width:78%;
    height:74%;

    display:flex;
    flex-direction:column;
    align-items:center;

    z-index:5;
}

.play-header{
    width:100%;

    display:flex;
    justify-content:center;
    align-items:center;

    gap:24px;

    margin-bottom:8px;
}

.play-title{
    font-size:34px;
    font-weight:1000;
    line-height:1;

    text-shadow:
        0 3px 0 rgba(0,0,0,.35),
        0 8px 18px rgba(0,0,0,.25);
}

.restart-btn{
    width:54px;
    height:54px;
    font-size:24px;
}

.game-info{
    display:flex;
    justify-content:center;
    gap:14px;

    margin-bottom:12px;
}

.game-info div{
    min-width:112px;

    text-align:center;

    padding:9px 16px;
    border-radius:16px;

    background:rgba(255,255,255,.18);
    color:#fff;

    font-size:17px;
    font-weight:1000;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.18),
        0 6px 14px rgba(0,0,0,.18);

    backdrop-filter:blur(6px);
}

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

#curvycanvas{
    width:100%;
    flex:1;

    display:block;

    border-radius:24px;

    background:rgba(20,136,221,.78);

    box-shadow:
        inset 0 3px 0 rgba(255,255,255,.18),
        inset 0 -8px 0 rgba(0,0,0,.16),
        0 12px 25px rgba(0,0,0,.18);

    touch-action:none;
}

/* =========================
   MODALS
========================= */

.modal{
    position:fixed;
    inset:0;

    background:rgba(0,0,0,.58);

    display:flex;
    align-items:center;
    justify-content:center;

    z-index:1000;

    animation:fadeIn .18s ease;
}

.hidden{
    display:none !important;
}

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

.modal-card{
    width:min(92vw,540px);

    padding:28px;

    border-radius:28px;

    background:linear-gradient(180deg,#123f70,#08295c);
    color:#fff;

    box-shadow:0 25px 70px rgba(0,0,0,.45);

    animation:scaleIn .22s ease;
}

@keyframes scaleIn{
    from{
        transform:scale(.88);
        opacity:.3;
    }
    to{
        transform:scale(1);
        opacity:1;
    }
}

.modal-card h2{
    text-align:center;
    margin-bottom:18px;
    font-size:30px;
}

.close-btn{
    border:none;
    background:none;

    color:inherit;

    font-size:34px;
    font-weight:1000;

    cursor:pointer;

    float:right;
}

.paper{
    background:#f6edd2;
    color:#222;
}

.paper p{
    margin:14px 0;
    padding:16px;

    border-radius:14px;

    background:rgba(0,0,0,.07);

    font-size:18px;
    line-height:1.5;
}

.modal-main-btn{
    width:100%;
    height:56px;

    margin-top:16px;
}

/* =========================
   DIFFICULTY MODAL
========================= */

.difficulty-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:14px;

    margin-top:20px;
}

.difficulty-option{
    border:none;

    min-height:118px;
    padding:18px;

    cursor:pointer;

    border-radius:22px;

    background:linear-gradient(180deg,#fff,#dfeaf4);

    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:6px;

    box-shadow:
        inset 0 2px 0 rgba(255,255,255,.75),
        inset 0 -4px 0 rgba(0,0,0,.10),
        0 10px 20px rgba(0,0,0,.25);

    transition:.2s ease;
}

.difficulty-option:hover{
    transform:translateY(-4px) scale(1.04);
}

.difficulty-option span{
    font-size:34px;
}

.difficulty-option b{
    color:#123f73;
    font-size:20px;
}

.difficulty-option small{
    color:#5d6c7f;
    font-weight:900;
}

/* =========================
   SETTINGS
========================= */

.setting-row{
    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:14px;
    margin:16px 0;

    font-size:18px;
    font-weight:900;
}

.setting-row input{
    width:24px;
    height:24px;
}

.setting-buttons{
    display:flex;
    gap:10px;
}

.setting-buttons button,
.settings-difficulty button{
    border:none;

    min-width:64px;
    height:40px;

    border-radius:14px;

    background:linear-gradient(180deg,#fff,#dfeaf4);
    color:#0b3568;

    font-weight:1000;

    box-shadow:
        inset 0 2px 0 rgba(255,255,255,.8),
        0 6px 12px rgba(0,0,0,.20);
}

.setting-section{
    margin-top:20px;
}

.setting-section h3{
    margin-bottom:10px;
}

.settings-difficulty{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:10px;
}

/* =========================
   WIN
========================= */

.win-card{
    text-align:center;
}

.stars{
    font-size:48px;
    margin:18px 0;
}

/* =========================
   RTL
========================= */

html[dir="rtl"] .top-bar{
    direction:ltr;
}

html[dir="rtl"] .play-title,
html[dir="rtl"] .game-info,
html[dir="rtl"] .modal-card{
    direction:rtl;
}

/* =========================
   TABLET
========================= */

@media(max-width:1100px){

    #menuScreen{
        gap:12px;
        padding:84px 14px 16px;
    }

    .hero-panel{
        width:40%;
    }

    .menu-logo{
        width:min(62%, 300px);
    }

    .menu-flamingo{
        width:min(56%, 280px);
        bottom:12%;
    }

    .menu-content{
        width:82%;
        bottom:8%;
    }

    .big-start{
        width:72%;
        height:48px;
        font-size:14px;
    }

    .small-menu-btn{
        width:104px;
        height:40px;
        font-size:13px;
    }

    .bottom-menu-row{
        gap:10px;
    }

    .play-title{
        font-size:28px;
    }

    .restart-btn{
        width:48px;
        height:48px;
        font-size:21px;
    }

    .game-info div{
        min-width:96px;
        font-size:14px;
        padding:8px 12px;
    }
}

/* =========================
   MOBILE
========================= */

@media(max-width:900px){

    html,
    body{
        overflow:auto;
        height:auto;
        min-height:100%;
    }

    .app{
        height:auto;
        min-height:100vh;
        overflow:visible;


    background:
       
        url("imag/background-mobile.webp") ;

        background-position:center top;
    }

    .top-bar{
        position:relative;

        top:auto;
        left:auto;
        right:auto;

        height:70px;

        padding:10px 12px;
    }

    .top-left{
        gap:8px;
    }

    .round-btn{
        width:46px;
        height:46px;
        font-size:21px;
    }

    .back-games-btn{
        font-size:26px;
    }

    .owner-logo{
        max-width:110px;
        max-height:38px;
    }

    .stat{
        min-width:70px;
        height:40px;
        font-size:14px;
        border-radius:14px;
    }

    .stats{
        gap:8px;
    }

    #menuScreen{
        height:auto;
        min-height:calc(100vh - 70px);

        flex-direction:column;

        padding:8px 12px 18px;
        gap:16px;
    }

 
 .hero-panel{
    width:100%;
  height:400px;
    min-height:400px;
}

.menu-logo{
    top:8px;
    width:230px;
}

.menu-flamingo{
    width:230px;
    bottom:60px;
}

.menu-content{
    bottom:18px;
}

.play-panel{
    height:560px;
    min-height:560px;
}

.play-overlay{
    top:5%;
    height:76%;
}
    

    .big-start{
        width:250px;
        max-width:76%;
        height:50px;
        margin-bottom:12px;
        font-size:14px;
    }

    .bottom-menu-row{
        gap:10px;
    }

    .small-menu-btn{
        width:112px;
        height:42px;
        font-size:13px;
    }

   

    .game-frame{
        height:104%;
        transform:translateY(6px);
    }

   

    .play-header{
        gap:14px;
        margin-bottom:8px;
    }

    .play-title{
        font-size:24px;
    }

    .restart-btn{
        width:42px;
        height:42px;
        font-size:19px;
    }

    .game-info{
        gap:8px;
        margin-bottom:8px;
    }

    .game-info div{
        min-width:84px;
        font-size:12px;
        padding:7px 8px;
        border-radius:12px;
    }

    #curvycanvas{
        border-radius:18px;
    }

    .modal-card{
        width:90vw;
        padding:22px;
    }

    .modal-card h2{
        font-size:24px;
    }

    .difficulty-grid{
        grid-template-columns:1fr;
    }

    .difficulty-option{
        min-height:84px;
        flex-direction:row;
        justify-content:flex-start;
        padding:14px 18px;
    }

    .difficulty-option span{
        font-size:28px;
    }

    .settings-difficulty{
        grid-template-columns:1fr 1fr;
    }
    
    
  
    
   
}

/* =========================
   SMALL MOBILE
========================= */

@media(max-width:430px){

    .hero-panel{
        height:500px;
        min-height:500px;
    }

    .menu-logo{
        width:235px;
    }

    .menu-flamingo{
        width:235px;
        bottom:88px;
    }

    .big-start{
        width:230px;
        height:48px;
    }

    .small-menu-btn{
        width:102px;
        height:40px;
    }

    .play-panel{
        height:610px;
        min-height:610px;
    }
}


.settings-difficulty button.active{
    background:linear-gradient(180deg,#ffe66d,#f4a600);
    color:#3b2200;
}

.owner-logo-link{
    position:absolute;
    left:50%;
    top:50%;
    transform:translate(-50%, -50%);

    width:74px;
    height:74px;

    display:flex;
    align-items:center;
    justify-content:center;

    pointer-events:auto;
    z-index:9999;
}

.owner-logo{
    width:70px;
    height:70px;

    object-fit:contain;

    border-radius:50%;
    background:rgba(255,255,255,.88);
    padding:6px;

    box-shadow:0 8px 20px rgba(0,0,0,.25);

    pointer-events:auto;

    transition:.2s ease;
}

.owner-logo-link:hover .owner-logo{
    transform:scale(1.08);
}

/* =========================
   PREMIUM WIN SCREEN
========================= */

.win-card{
    position:relative;
    text-align:center;
    overflow:hidden;

    max-width:620px;

    background:
        radial-gradient(circle at top,#1d66b8 0%,#103c7c 45%,#071f4d 100%);

    border:3px solid rgba(255,214,76,.95);

    box-shadow:
        0 0 35px rgba(255,210,70,.35),
        0 30px 80px rgba(0,0,0,.55);
}

.win-close{
    position:absolute;
    top:14px;
    right:18px;
    z-index:5;
}

.win-badge{
    width:86px;
    height:86px;

    margin:0 auto 12px;

    display:flex;
    align-items:center;
    justify-content:center;

    border-radius:50%;

    font-size:48px;

    background:
        linear-gradient(180deg,#ffe477,#f5a400);

    box-shadow:
        inset 0 3px 0 rgba(255,255,255,.5),
        0 0 24px rgba(255,220,70,.75),
        0 12px 24px rgba(0,0,0,.35);

    animation:badgePop .65s ease both;
}

.win-card h2{
    font-size:36px;
    margin-bottom:14px;

    color:#fff;

    text-shadow:
        0 4px 0 rgba(0,0,0,.32),
        0 0 18px rgba(255,255,255,.25);
}

.win-stars{
    display:flex;
    justify-content:center;
    gap:12px;

    margin:16px 0 20px;
}

.win-stars span{
    font-size:48px;
    filter:drop-shadow(0 8px 8px rgba(0,0,0,.35));

    animation:starBounce .75s ease both;
}

.win-stars span:nth-child(2){
    animation-delay:.12s;
}

.win-stars span:nth-child(3){
    animation-delay:.24s;
}

.reward-box{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:12px;

    margin:20px 0 22px;
}

.reward-box div{
    padding:14px 10px;

    border-radius:18px;

    background:rgba(255,255,255,.14);

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.24),
        0 8px 18px rgba(0,0,0,.22);

    backdrop-filter:blur(8px);
}

.reward-box small{
    display:block;

    margin-bottom:6px;

    opacity:.88;

    font-size:13px;
    font-weight:800;
}

.reward-box b{
    font-size:20px;
}

.win-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
}

.win-actions .modal-main-btn{
    margin-top:0;
    height:58px;
}

.confetti span{
    position:absolute;
    top:-20px;

    width:10px;
    height:18px;

    border-radius:4px;

    opacity:.9;

    animation:confettiFall 2.8s linear infinite;
}

.confetti span:nth-child(1){ left:8%; background:#ffd43b; animation-delay:.1s; }
.confetti span:nth-child(2){ left:18%; background:#ff5ca8; animation-delay:.5s; }
.confetti span:nth-child(3){ left:28%; background:#56e2ff; animation-delay:.9s; }
.confetti span:nth-child(4){ left:38%; background:#69ff70; animation-delay:.2s; }
.confetti span:nth-child(5){ left:48%; background:#ffffff; animation-delay:.7s; }
.confetti span:nth-child(6){ left:58%; background:#ffd43b; animation-delay:1.1s; }
.confetti span:nth-child(7){ left:68%; background:#ff5ca8; animation-delay:.4s; }
.confetti span:nth-child(8){ left:78%; background:#56e2ff; animation-delay:.8s; }
.confetti span:nth-child(9){ left:88%; background:#69ff70; animation-delay:1.3s; }
.confetti span:nth-child(10){ left:96%; background:#ffffff; animation-delay:.6s; }

@keyframes badgePop{
    0%{
        transform:scale(.4) rotate(-12deg);
        opacity:0;
    }

    65%{
        transform:scale(1.15) rotate(6deg);
        opacity:1;
    }

    100%{
        transform:scale(1) rotate(0);
    }
}

@keyframes starBounce{
    0%{
        transform:translateY(20px) scale(.2);
        opacity:0;
    }

    65%{
        transform:translateY(-8px) scale(1.18);
        opacity:1;
    }

    100%{
        transform:translateY(0) scale(1);
    }
}

@keyframes confettiFall{
    0%{
        transform:translateY(-20px) rotate(0deg);
        opacity:0;
    }

    10%{
        opacity:1;
    }

    100%{
        transform:translateY(520px) rotate(360deg);
        opacity:0;
    }
}

/* Mobile Win Screen */
@media(max-width:600px){

    .win-card{
        width:90vw;
        padding:22px;
    }

    .win-badge{
        width:70px;
        height:70px;
        font-size:38px;
    }

    .win-card h2{
        font-size:28px;
    }

    .win-stars span{
        font-size:38px;
    }

    .reward-box{
        grid-template-columns:1fr;
        gap:10px;
    }

    .win-actions{
        grid-template-columns:1fr;
    }
}

.about-card{
    width:min(92vw,720px);
    min-height:480px;
    padding:0;
    overflow:hidden;

    background:
        linear-gradient(rgba(0,25,70,.25), rgba(0,25,70,.55)),
        url("imag/about-bg.png") center center / cover no-repeat;

    border:3px solid rgba(255,215,70,.95);
}

.about-overlay{
    width:100%;
    height:100%;
    padding:36px;

    background:rgba(5,25,60,.45);
    backdrop-filter:blur(5px);

    color:#fff;
    text-align:center;
}

.about-overlay h2{
    font-size:36px;
    margin-bottom:22px;
    text-shadow:0 4px 8px rgba(0,0,0,.45);
}

.about-overlay p{
    font-size:20px;
    line-height:1.6;
    margin-bottom:18px;

    background:rgba(255,255,255,.14);
    padding:16px;
    border-radius:18px;
}

.about-overlay .credit{
    font-size:17px;
    color:#ffe66d;
    font-weight:900;
}

@media(max-width:600px){
    .about-card{
        min-height:auto;
    }

    .about-overlay{
        padding:24px;
    }

    .about-overlay h2{
        font-size:28px;
    }

    .about-overlay p{
        font-size:16px;
    }
}

.game-footer {
    width: min(760px, 92vw);
    margin: 18px auto 0;
    padding: 14px 18px;

    text-align: center;
    color: #ffe66b;
    font-size: 15px;
    font-weight: 800;

    border-radius: 20px;
    border: 1px solid rgba(255, 230, 100, 0.35);
    background: rgba(5, 15, 45, 0.48);

    box-shadow:
        0 0 22px rgba(70, 190, 255, 0.18),
        inset 0 0 18px rgba(255, 255, 255, 0.06);
}

@media (max-width: 520px) {
    .game-footer {
        margin-top: 12px;
        padding: 12px 14px;
        font-size: 12px;
        border-radius: 16px;
    }
}