/* =================================
   TETRIS STYLE v5.0
   Tutorial & Ranking Edition
================================= */

/* =================================
   RESET
================================= */

*{

    margin:0;

    padding:0;

    box-sizing:border-box;

}

/* =================================
   HTML / BODY
================================= */

html,
body{

    width:100%;

    height:100%;

    overflow:hidden;

}

body{

    background:
    linear-gradient(
        135deg,
        #fff7fb 0%,
        #fdf6ff 25%,
        #f4fbff 50%,
        #fffde7 75%,
        #fff7f0 100%
    );

    font-family:
        "Yu Gothic",
        sans-serif;

    color:#444;

    touch-action:manipulation;

    -webkit-user-select:none;

    user-select:none;

}

/* =================================
   FLOATING SHAPES
================================= */

.floating-shapes{

    position:fixed;

    inset:0;

    overflow:hidden;

    pointer-events:none;

    z-index:-1;

}

.shape{

    position:absolute;

    border-radius:50%;

    opacity:.22;

    animation:
        floatShape linear infinite;

}

/* PINK */

.shape1{

    width:90px;

    height:90px;

    background:#ff8fab;

    left:5%;

    top:10%;

    animation-duration:18s;

}

/* SKY */

.shape2{

    width:140px;

    height:140px;

    background:#a0c4ff;

    left:82%;

    top:15%;

    animation-duration:24s;

}

/* PURPLE */

.shape3{

    width:70px;

    height:70px;

    background:#cdb4db;

    left:20%;

    top:65%;

    animation-duration:20s;

}

/* GREEN */

.shape4{

    width:110px;

    height:110px;

    background:#95d5b2;

    left:75%;

    top:70%;

    animation-duration:22s;

}

/* YELLOW */

.shape5{

    width:80px;

    height:80px;

    background:#ffd166;

    left:45%;

    top:35%;

    animation-duration:26s;

}

/* ORANGE */

.shape6{

    width:120px;

    height:120px;

    background:#ffb4a2;

    left:90%;

    top:55%;

    animation-duration:30s;

}

@keyframes floatShape{

    0%{

        transform:
            translateY(0)
            rotate(0deg);

    }

    50%{

        transform:
            translateY(-40px)
            rotate(180deg);

    }

    100%{

        transform:
            translateY(0)
            rotate(360deg);

    }

}

/* =================================
   GAME AREA
================================= */

.game-area{

    width:100vw;

    height:100vh;

    overflow:hidden;

    padding:6px;

    display:flex;

    flex-direction:column;

    justify-content:center;

    align-items:center;

}

/* =================================
   STATUS
================================= */

.status-panel{

    display:flex;

    flex-direction:column;

    align-items:center;

    margin-bottom:6px;

}

#score{

    color:#ff8fab;

    font-size:1.4rem;

    font-weight:bold;

    margin-bottom:4px;

    text-shadow:
        0 3px 10px
        rgba(
            255,
            143,
            171,
            .35
        );

}

.sub-status{

    display:flex;

    justify-content:center;

    align-items:center;

    gap:20px;

}

#level{

    color:#7b68ee;

    font-size:.95rem;

    font-weight:bold;

}

#lines{

    color:#4ecdc4;

    font-size:.95rem;

    font-weight:bold;

}

/* =================================
   GAME WRAPPER
================================= */

.game-wrapper{

    display:flex;

    justify-content:center;

    align-items:flex-start;

    gap:12px;

}
/* =================================
   BOARD
================================= */

#gameCanvas{

    width:210px;

    height:420px;

    background:#fffdfd;

    border:4px solid #ff8fab;

    border-radius:20px;

    box-shadow:
        0 15px 35px rgba(255,143,171,.25),
        0 5px 15px rgba(123,104,238,.18);

    touch-action:none;

}

/* =================================
   SIDE PANEL
================================= */

.side-panel{

    display:flex;

    flex-direction:column;

    align-items:center;

    gap:12px;

}

/* =================================
   NEXT PANEL
================================= */

.next-panel{

    display:flex;

    flex-direction:column;

    align-items:center;

}

.next-panel h3{

    color:#7b68ee;

    font-size:.9rem;

    font-weight:bold;

    margin-bottom:6px;

    letter-spacing:2px;

}

#nextCanvas{

    width:70px;

    height:70px;

    background:white;

    border:3px solid #7b68ee;

    border-radius:15px;

    box-shadow:
        0 6px 15px
        rgba(
            123,
            104,
            238,
            .20
        );

}

/* =================================
   RANKING PANEL
================================= */

.ranking-panel{

    width:110px;

    background:
        rgba(
            255,
            255,
            255,
            .85
        );

    border:2px solid #cdb4db;

    border-radius:16px;

    padding:10px;

    box-shadow:
        0 4px 12px
        rgba(
            123,
            104,
            238,
            .12
        );

}

.ranking-panel h3{

    color:#ff8fab;

    text-align:center;

    font-size:.8rem;

    margin-bottom:8px;

    letter-spacing:1px;

}

#rankingList{

    padding-left:20px;

    font-size:.75rem;

    font-weight:bold;

    color:#555;

}

#rankingList li{

    margin-bottom:4px;

}

/* =================================
   MENU BUTTONS
================================= */

.menu-buttons{

    display:flex;

    justify-content:center;

    align-items:center;

    gap:6px;

    margin-top:8px;

    flex-wrap:wrap;

}

/* =================================
   START BUTTON
================================= */

.start-button{

    min-width:130px;

    padding:8px 12px;

    border:none;

    border-radius:999px;

    background:
    linear-gradient(
        135deg,
        #ff8fab,
        #ffb4a2
    );

    color:white;

    font-size:.8rem;

    font-weight:bold;

    cursor:pointer;

    transition:.3s;

}

.start-button:hover{

    transform:
        translateY(-2px);

    box-shadow:
        0 10px 20px
        rgba(
            255,
            143,
            171,
            .25
        );

}

/* =================================
   HOME BUTTON
================================= */

.home-button{

    min-width:130px;

    padding:8px 12px;

    border-radius:999px;

    text-decoration:none;

    text-align:center;

    color:white;

    font-size:.8rem;

    font-weight:bold;

    background:
    linear-gradient(
        135deg,
        #95d5b2,
        #4ecdc4
    );

    transition:.3s;

}

.home-button:hover{

    transform:
        translateY(-2px);

    box-shadow:
        0 10px 20px
        rgba(
            78,
            205,
            196,
            .25
        );

}
/* =================================
   MOBILE CONTROLS
================================= */

.mobile-controls{

    margin-top:8px;

    display:flex;

    justify-content:center;

    align-items:center;

    gap:8px;

}

.mobile-controls button{

    width:48px;

    height:48px;

    border:none;

    border-radius:14px;

    background:
    linear-gradient(
        135deg,
        #a0c4ff,
        #cdb4db
    );

    color:white;

    font-size:20px;

    font-weight:bold;

    cursor:pointer;

    touch-action:none;

    -webkit-tap-highlight-color:
        transparent;

    box-shadow:
        0 4px 12px
        rgba(
            123,
            104,
            238,
            .25
        );

    transition:.15s;

}

.mobile-controls button:active{

    transform:
        scale(.95);

}

/* =================================
   HELP BUTTON
================================= */

.help-button{

    position:fixed;

    top:20px;

    right:20px;

    width:55px;

    height:55px;

    border:none;

    border-radius:50%;

    z-index:9000;

    cursor:pointer;

    font-size:1.4rem;

    font-weight:bold;

    color:white;

    background:
    linear-gradient(
        135deg,
        #ff8fab,
        #7b68ee
    );

    box-shadow:
        0 8px 20px
        rgba(
            123,
            104,
            238,
            .25
        );

    transition:.3s;

}

.help-button:hover{

    transform:
        scale(1.1);

}

.help-button:active{

    transform:
        scale(.95);

}

/* =================================
   TUTORIAL MODAL
================================= */

.tutorial-modal{

    position:fixed;

    inset:0;

    background:
        rgba(
            0,
            0,
            0,
            .75
        );

    display:flex;

    justify-content:center;

    align-items:center;

    z-index:9999;

    padding:20px;

}

.tutorial-content{

    width:min(
        90%,
        720px
    );

    background:white;

    border-radius:25px;

    padding:30px;

    text-align:center;

    box-shadow:
        0 20px 50px
        rgba(
            0,
            0,
            0,
            .2
        );

    animation:
        tutorialFade .3s ease;

}

.tutorial-content h2{

    color:#7b68ee;

    margin-bottom:25px;

}

/* =================================
   TUTORIAL GRID
================================= */

.tutorial-grid{

    display:grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(
                250px,
                1fr
            )
        );

    gap:20px;

}

/* =================================
   TUTORIAL CARD
================================= */

.tutorial-card{

    background:#f8f8ff;

    border:
        2px solid
        #ece7ff;

    border-radius:20px;

    padding:20px;

}

.tutorial-card h3{

    color:#ff8fab;

    margin-bottom:15px;

}

.tutorial-card ul{

    list-style:none;

    line-height:2;

    font-size:.95rem;

}

/* =================================
   TUTORIAL BUTTON
================================= */

.tutorial-button{

    margin-top:25px;

    padding:14px 30px;

    border:none;

    border-radius:999px;

    cursor:pointer;

    color:white;

    font-size:1rem;

    font-weight:bold;

    background:
    linear-gradient(
        135deg,
        #ff8fab,
        #7b68ee
    );

    transition:.3s;

}

.tutorial-button:hover{

    transform:
        translateY(-2px);

}

.tutorial-button:active{

    transform:
        scale(.97);

}

/* =================================
   ANIMATION
================================= */

@keyframes tutorialFade{

    from{

        opacity:0;

        transform:
            translateY(20px);

    }

    to{

        opacity:1;

        transform:
            translateY(0);

    }

}
/* =================================
   TABLET
================================= */

@media(max-width:768px){

    .game-wrapper{

        flex-direction:row;

        justify-content:center;

        align-items:flex-start;

        gap:10px;

    }

    .menu-buttons{

        flex-direction:column;

    }

    .start-button,
    .home-button{

        width:150px;

    }

    .tutorial-content{

        padding:24px;

    }

    .tutorial-grid{

        grid-template-columns:1fr;

    }

    .help-button{

        width:48px;

        height:48px;

        top:15px;

        right:15px;

        font-size:1.2rem;

    }

}

/* =================================
   SMALL MOBILE
================================= */

@media(max-width:400px){

    #gameCanvas{

        width:190px;

        height:380px;

    }

    #nextCanvas{

        width:60px;

        height:60px;

    }

    .ranking-panel{

        width:95px;

        padding:8px;

    }

    #rankingList{

        font-size:.7rem;

    }

    .mobile-controls button{

        width:44px;

        height:44px;

        font-size:18px;

    }

    .sub-status{

        gap:12px;

    }

    #score{

        font-size:1.2rem;

    }

    .tutorial-content{

        padding:18px;

    }

    .tutorial-card{

        padding:15px;

    }

    .tutorial-card ul{

        font-size:.85rem;

    }

}

/* =================================
   DESKTOP
================================= */

@media(min-width:769px){

    .mobile-controls{

        display:none;

    }

}

/* =================================
   SCROLLBAR
================================= */

::-webkit-scrollbar{

    width:10px;

}

::-webkit-scrollbar-track{

    background:#f7f7ff;

}

::-webkit-scrollbar-thumb{

    background:#cdb4db;

    border-radius:999px;

}

/* =================================
   EXTRA EFFECTS
================================= */

.start-button,
.home-button,
.mobile-controls button,
.help-button,
.tutorial-button{

    will-change:transform;

}

#gameCanvas{

    transition:
        box-shadow .3s ease;

}

#gameCanvas:hover{

    box-shadow:
        0 20px 40px
        rgba(
            255,
            143,
            171,
            .30
        ),
        0 8px 20px
        rgba(
            123,
            104,
            238,
            .20
        );

}

/* =================================
   TUTORIAL TITLE
================================= */

.tutorial-content h2{

    font-size:1.8rem;

    font-weight:bold;

}

.tutorial-card li{

    margin-bottom:4px;

}

/* =================================
   END
================================= */