* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background:
        radial-gradient(circle at top, #263653, #101725 70%);
    color: white;
    font-family: Arial, Helvetica, sans-serif;
    min-height: 100vh;
    overflow: hidden;
}

.game-wrap {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: rgba(10, 15, 25, .94);
    border-bottom: 1px solid rgba(255,255,255,.1);
    z-index: 10;
}

.brand {
    font-size: 21px;
    font-weight: 800;
}

.stats {
    display: flex;
    gap: 12px;
}

.stats div {
    min-width: 70px;
    padding: 8px 12px;
    text-align: center;
    background: rgba(255,255,255,.08);
    border-radius: 10px;
    font-weight: bold;
}

.game-container {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
}

#gameCanvas {
    width: min(1100px, 96vw);
    height: min(680px, 78vh);
    border-radius: 18px;
    background: #202b36;
    box-shadow:
        0 20px 60px rgba(0,0,0,.45),
        inset 0 0 0 2px rgba(255,255,255,.08);
    touch-action: none;
}

.message {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    padding: 9px 18px;
    border-radius: 20px;
    background: rgba(0,0,0,.65);
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
    transition: .2s;
}

.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(3,7,14,.72);
    backdrop-filter: blur(5px);
    z-index: 20;
}

.hidden {
    display: none !important;
}

.panel {
    width: min(380px, 90vw);
    text-align: center;
    padding: 35px 25px;
    border-radius: 22px;
    background: #172131;
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.panel h1 {
    font-size: 38px;
    margin: 8px 0;
}

.panel p {
    color: #c8d1df;
    margin: 8px 0;
}

.big-icon {
    font-size: 60px;
}

.panel button {
    border: 0;
    padding: 13px 25px;
    margin-top: 18px;
    border-radius: 12px;
    background: #ffca28;
    color: #111;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

.panel button:active {
    transform: scale(.96);
}

.mobile-controls {
    display: none;
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 25px;
    pointer-events: none;
}

.joystick {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    border: 2px solid rgba(255,255,255,.2);
    position: relative;
    pointer-events: auto;
}

#stick {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255,255,255,.7);
    position: absolute;
    left: 30px;
    top: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,.3);
}

.run-btn {
    position: absolute;
    right: 5px;
    bottom: 10px;
    width: 85px;
    height: 85px;
    border-radius: 50%;
    border: 0;
    background: #ef5350;
    color: white;
    font-size: 17px;
    font-weight: 900;
    pointer-events: auto;
    box-shadow: 0 7px 20px rgba(0,0,0,.35);
}

.run-btn.active {
    transform: scale(.92);
    background: #ff7043;
}

footer {
    height: 38px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(5,9,16,.8);
    color: #9eabbc;
    font-size: 12px;
}

@media (max-width: 700px) {

    .topbar {
        height: 55px;
        padding: 0 10px;
    }

    .brand {
        font-size: 15px;
    }

    .stats {
        gap: 5px;
    }

    .stats div {
        min-width: 52px;
        padding: 7px 5px;
        font-size: 12px;
    }

    .game-container {
        padding: 5px;
        align-items: center;
    }

    #gameCanvas {
        width: 98vw;
        height: 76vh;
        border-radius: 12px;
    }

    .mobile-controls {
        display: block;
    }

    footer {
        height: 32px;
        font-size: 9px;
    }

    footer span:first-child {
        display: none;
    }

    footer span:last-child {
        width: 100%;
        text-align: center;
    }
}

@media (max-height: 600px) {

    #gameCanvas {
        height: 72vh;
    }

    .mobile-controls {
        bottom: 10px;
    }

    .joystick {
        width: 85px;
        height: 85px;
    }

    #stick {
        width: 38px;
        height: 38px;
        left: 22px;
        top: 22px;
    }

    .run-btn {
        width: 65px;
        height: 65px;
        font-size: 13px;
    }
}