@charset "utf-8";
:root{
    --board-height: 500px;
    --pipe-width: 80px;
    --mario-width: 150px;
    --jump-peak: 190px;
    --jump-duration: 750ms;
}
*{
    padding: 0px;
    margin: 0px;
    box-sizing: border-box;
}
body{
    overflow: hidden;
    background-color: #4d2b05;
    min-height: 100vh;
    position: relative;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}
.game-board{
    width: 100%;
    height: var(--board-height);
    border:1px  solid #333;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border-bottom: 20px solid rgb(35,160, 35);
    background:linear-gradient(#87ceeb,#e0f6ff);
    
    
}
.claud{
    width: 550px;
    position: absolute;
    z-index: 3;
    animation: claud-animation 20s infinite linear;

}
.pipe{
    position: absolute;
    bottom: 0;
    width: var(--pipe-width);
    animation: pipe-animation 2s infinite linear; 
    z-index: 1;
}
.mario{
    width: var(--mario-width);
    position: absolute;
    bottom: 0;
    z-index: 2;
}
.ranking-panel {

    position: fixed;
    top: 10px;
    left: 12px;
    margin: 0 auto;
    width: 350px;
    height: 170px;
    z-index: 999;

    border: 4px solid rgba(45, 27, 10, 0.568);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255, 245, 196, 0.96) 0%, rgba(255, 223, 128, 0.94) 100%);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
    overflow: hidden;

}

.ranking-header{
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 12px;
    margin-left: 5px;
    color: #5a2f0b;
    font-family: "Press Start 2P", system-ui;
}
.ranking-header h2{
    font-size: 0.8rem;
}
.ranking-status{
    font-size: 0.55rem;
    margin-right: 10px;
}
.ranking-table-wrap{
    max-height: 230px;
    overflow: auto;
}
.ranking-table{
    width: 100%;
    border-collapse: collapse;
    color: #3f2208;
    font-family: "Press Start 2P", system-ui;
    font-size: 0.65rem;
}
.ranking-table th,
.ranking-table td{
    padding: 10px 8px;
    border-bottom: 2px solid rgba(90, 47, 11, 0.16);
    text-align: left;
}
.ranking-table th:last-child,
.ranking-table td:last-child{
    text-align: right;
}
.ranking-table tbody tr:last-child td{
    border-bottom: none;
}
.ranking-table tbody tr.is-current-player{
    background: rgba(230, 126, 34, 0.18);
}
.ranking-table tbody tr.is-current-player td{
    color: #8a3f00;
}
.ranking-panel.is-focused{
    box-shadow: 0 0 0 4px rgba(255, 248, 196, 0.9), 0 12px 26px rgba(0, 0, 0, 0.22);
}
.hud{
    position: absolute;
    top: 24px;
    right: 24px;
    display: flex;
    align-items: flex-end;
    gap: 18px;
    z-index: 6;
    font-family: "Press Start 2P", system-ui;
    color: #fff;
    text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}
.hud-item{
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.score-label{
    font-size: 0.8rem;
}
.score-value,
.record-value{
    min-width: 72px;
    text-align: right;
    font-size: 1.2rem;
}
.game-board.is-paused .pipe,
.game-board.is-paused .claud{
    animation-play-state: paused;
}
.start-panel,
.game-over-panel{
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    background: rgba(0, 0, 0, 0.35);
    z-index: 10;
    font-family: "Press Start 2P", system-ui;
    text-align: center;
}
.start-panel{
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.22), transparent 42%),
        rgba(17, 24, 39, 0.45);
    z-index: 9;
}
.start-panel.show,
.game-over-panel.show{
    display: flex;
}
.start-panel h1,
.game-over-panel h1{
    color: #fff;
    font-size: 2rem;
    text-shadow: 4px 4px 0 #c0392b;
}
.start-panel p{
    max-width: 420px;
    padding: 0 20px;
    color: #fff7d6;
    font-size: 0.8rem;
    line-height: 1.8;
}
.name-field{
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(360px, calc(100% - 48px));
    color: #fff7d6;
    font-size: 0.68rem;
    letter-spacing: 1px;
}
.player-name-input{
    width: 100%;
    padding: 14px 16px;
    border: 3px solid #ffd66b;
    border-radius: 14px;
    outline: none;
    background: rgba(255, 255, 255, 0.95);
    color: #4a2810;
    font-family: "Press Start 2P", system-ui;
    font-size: 0.72rem;
}
.player-name-input:focus{
    border-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(255, 214, 107, 0.2);
}
.player-result,
.start-feedback,
.save-feedback{
    min-height: 1.8em;
    max-width: 420px;
    padding: 0 20px;
    color: #ffe9a6;
    font-size: 0.7rem;
    line-height: 1.6;
}
.player-result{
    color: #ffffff;
    font-size: 0.8rem;
}
.start-button,
.restart-button,
.play-again-button{
    border: none;
    padding: 14px 24px;
    font-family: "Press Start 2P", system-ui;
    font-size: 0.9rem;
    color: #fff;
    background: #e67e22;
    cursor: pointer;
    box-shadow: 0 6px 0 #a95413;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.start-button:hover,
.restart-button:hover,
.play-again-button:hover{
    transform: translateY(2px);
    box-shadow: 0 4px 0 #a95413;
}
.start-button:active,
.restart-button:active,
.play-again-button:active{
    transform: translateY(6px);
    box-shadow: none;
}
.jump{
 animation: jump var(--jump-duration) ease-out;
}

footer{
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    padding: 10px 18px;
    border: 3px solid #2f1b08;
    border-radius: 999px;
    background:
        linear-gradient(180deg, #fff3bf 0%, #f4c542 100%);
    color: #5a2f0b;
    font-family: "Press Start 2P", system-ui;
    font-size: 0.65rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.45);
    box-shadow: 0 6px 0 #8f5a16, 0 12px 24px rgba(0, 0, 0, 0.28);
    z-index: 20;
}
.restart-button{
    display: none;
}

@media (max-width: 700px){
    :root{
        --board-height: min(78vh, 420px);
        --pipe-width: 64px;
        --mario-width: 120px;
        --jump-peak: 205px;
        --jump-duration: 700ms;
    }

    .ranking-panel{
        top: auto;
        bottom: 82px;
        left: 12px;
        width: calc(100% - 24px);
        padding: 14px;
        border-radius: 18px;
        
    }

    .ranking-header h2{
        font-size: 0.62rem;
    }

    .ranking-status,
    .ranking-table{
        font-size: 0.5rem;
    }

    .ranking-table-wrap{
        max-height: 160px;
    }

    .hud{
        top: 16px;
        right: 16px;
    }

    .score-label{
        font-size: 0.65rem;
    }

    .score-value,
    .record-value{
        min-width: 56px;
        font-size: 0.95rem;
    }

    .start-panel h1,
    .game-over-panel h1{
        font-size: 1.4rem;
    }

    .start-panel p,
    .start-button,
    .restart-button,
    .play-again-button{
        font-size: 0.7rem;
    }

    .name-field,
    .player-result,
    .player-name-input,
    .start-feedback,
    .save-feedback{
        font-size: 0.58rem;
    }

    footer{
        bottom: 14px;
        padding: 8px 14px;
        font-size: 0.5rem;
    }
}


@keyframes pipe-animation {
    from {
        right: calc(var(--pipe-width) * -1);
    }

    to {
        right: 100%;
    } 
}

@keyframes jump {
    0% {
        bottom: 0;

    }
    

    40% {
        bottom: calc(var(--jump-peak) - 10px);
    }

    50% {
        bottom: var(--jump-peak);

    }
    60%{
        bottom: calc(var(--jump-peak) - 5px);
    }
    70%{
        bottom: calc(var(--jump-peak) - 10px);

    }
    80%{
        bottom: calc(var(--jump-peak) - 30px);
    }

     

    100% {
        bottom: 0;
    }
}
@keyframes claud-animation{

    from {
        right: -550px;
    }

    to {
        right: 100%;
    } 

}
