* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #111827;
    color: white;
    font-family: Arial, sans-serif;
    overflow: hidden;
    touch-action: none;
}

#game {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.topbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 65px;

    background: rgba(15, 23, 42, 0.94);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 20px;

    z-index: 10;

    border-bottom: 2px solid #334155;
}

.gameTitle {
    font-size: 21px;
    font-weight: bold;
}

.stats {
    display: flex;
    gap: 18px;
    font-size: 16px;
}

#message {
    position: absolute;

    top: 78px;
    left: 50%;

    transform: translateX(-50%);

    background: rgba(0,0,0,.65);

    padding: 9px 18px;

    border-radius: 20px;

    font-weight: bold;

    z-index: 5;

    pointer-events: none;
}

#gameCanvas {
    display: block;

    width: 100%;
    height: 100%;

    background: #87ceeb;
}

.controls {
    position: absolute;

    bottom: 20px;
    left: 0;

    width: 100%;

    display: flex;

    justify-content: space-between;

    align-items: end;

    padding: 0 25px;

    z-index: 20;

    pointer-events: none;
}

.moveControls {
    display: flex;
    gap: 12px;

    pointer-events: auto;
}

.controls button {
    border: 0;

    width: 62px;
    height: 62px;

    border-radius: 18px;

    background: rgba(15,23,42,.85);

    color: white;

    font-size: 25px;

    font-weight: bold;

    box-shadow: 0 5px 15px rgba(0,0,0,.35);

    user-select: none;
}

.controls button:active {
    transform: scale(.9);
}

#restartBtn {
    width: 110px;
    font-size: 15px;

    pointer-events: auto;
}

.overlay {
    position: absolute;

    inset: 0;

    background: rgba(0,0,0,.72);

    display: flex;

    justify-content: center;
    align-items: center;

    z-index: 100;
}

.hidden {
    display: none !important;
}

.panel {
    width: min(90%, 400px);

    background: #1e293b;

    padding: 35px 25px;

    border-radius: 25px;

    text-align: center;

    box-shadow: 0 20px 60px rgba(0,0,0,.5);

    border: 2px solid #475569;
}

.panel h1 {
    font-size: 36px;

    margin-bottom: 15px;
}

.panel p {
    color: #cbd5e1;

    margin-bottom: 20px;

    line-height: 1.5;
}

.result {
    background: #0f172a;

    padding: 15px;

    border-radius: 15px;

    line-height: 2;

    margin-bottom: 20px;
}

.panel button {
    width: 100%;

    padding: 15px;

    border: 0;

    border-radius: 12px;

    background: #22c55e;

    color: white;

    font-size: 17px;

    font-weight: bold;

    cursor: pointer;
}

.panel button:active {
    transform: scale(.97);
}

.win {
    border-color: #22c55e;
}

@media(max-width:600px) {

    .topbar {
        height: 58px;
        padding: 0 10px;
    }

    .gameTitle {
        font-size: 15px;
    }

    .stats {
        gap: 8px;
        font-size: 12px;
    }

    #message {
        top: 68px;
        font-size: 12px;
    }

    .controls {
        bottom: 12px;
        padding: 0 12px;
    }

    .controls button {
        width: 55px;
        height: 55px;
    }

    #restartBtn {
        width: 85px;
        font-size: 12px;
    }
}