* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    background: #05070b;
}

#game {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* TOP BAR */

#topBar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 68px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 22px;

    color: white;

    background:
        linear-gradient(
            180deg,
            rgba(4, 8, 15, .94),
            rgba(4, 8, 15, .55)
        );

    border-bottom: 1px solid rgba(255,255,255,.08);

    z-index: 10;
}

.logo {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: .5px;
}

.logo small {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    color: #8b9aaa;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.stats {
    display: flex;
    gap: 18px;
    font-size: 15px;
}

.stats span {
    padding: 8px 13px;
    border-radius: 10px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.08);
}

#resetBtn {
    border: 0;
    border-radius: 9px;
    padding: 9px 14px;

    background: rgba(255,255,255,.1);
    color: white;

    cursor: pointer;
    font-weight: bold;
}

#resetBtn:hover {
    background: rgba(255,255,255,.18);
}

/* CROSSHAIR */

#crosshair {
    position: absolute;

    left: 50%;
    top: 50%;

    width: 24px;
    height: 24px;

    transform: translate(-50%, -50%);

    pointer-events: none;
    z-index: 5;
}

#crosshair span {
    position: absolute;
    background: white;
    box-shadow: 0 0 5px black;
}

#crosshair span:first-child {
    width: 20px;
    height: 2px;
    top: 11px;
    left: 2px;
}

#crosshair span:last-child {
    width: 2px;
    height: 20px;
    left: 11px;
    top: 2px;
}

/* MESSAGE */

#message {
    position: absolute;

    left: 50%;
    top: 82px;

    transform: translateX(-50%);

    padding: 9px 15px;

    background: rgba(0,0,0,.55);
    border: 1px solid rgba(255,255,255,.08);

    border-radius: 10px;

    color: #dce6ef;

    font-size: 12px;
    text-align: center;

    z-index: 5;

    pointer-events: none;
}

/* HOTBAR */

#hotbar {
    position: absolute;

    left: 50%;
    bottom: 24px;

    transform: translateX(-50%);

    display: flex;
    gap: 7px;

    padding: 8px;

    background: rgba(5,8,13,.86);

    border: 1px solid rgba(255,255,255,.12);

    border-radius: 14px;

    backdrop-filter: blur(10px);

    z-index: 20;
}

.slot {
    position: relative;

    width: 58px;
    height: 58px;

    border: 2px solid rgba(255,255,255,.15);
    border-radius: 9px;

    background: rgba(255,255,255,.05);

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    transition: .15s;
}

.slot:hover {
    transform: translateY(-3px);
}

.slot.selected {
    border-color: #ffffff;
    box-shadow:
        0 0 0 2px rgba(255,255,255,.15),
        0 0 18px rgba(255,255,255,.15);
}

.slot span {
    position: absolute;

    bottom: 3px;
    right: 5px;

    color: rgba(255,255,255,.7);

    font-size: 10px;
}

/* BLOCK ICONS */

.block-icon {
    width: 31px;
    height: 31px;

    border-radius: 3px;

    box-shadow:
        inset 3px 3px rgba(255,255,255,.15),
        inset -4px -4px rgba(0,0,0,.25);
}

.grass-block {
    background:
        linear-gradient(
            #4e9e43 0 28%,
            #75482d 28% 100%
        );
}

.dirt-block {
    background: #765035;
}

.stone-block {
    background:
        radial-gradient(circle at 25% 30%, #858b90 0 8%, transparent 9%),
        radial-gradient(circle at 70% 65%, #5d6368 0 10%, transparent 11%),
        #73797e;
}

.crystal-block {
    background:
        linear-gradient(
            135deg,
            #51f0e4,
            #247ad8 45%,
            #5635a9
        );
}

.wood-block {
    background:
        repeating-linear-gradient(
            90deg,
            #7c4a28 0 6px,
            #9d6134 6px 10px
        );
}

/* HELP */

#help {
    position: absolute;

    right: 18px;
    bottom: 18px;

    padding: 12px 15px;

    color: #c9d3dc;

    font-size: 11px;
    line-height: 1.7;

    background: rgba(4,7,11,.7);

    border: 1px solid rgba(255,255,255,.08);

    border-radius: 10px;

    z-index: 10;
}

#help b {
    color: white;
}

/* MOBILE */

#mobileControls {
    display: none;

    position: absolute;

    left: 0;
    bottom: 100px;

    width: 100%;

    padding: 15px;

    z-index: 30;

    pointer-events: none;
}

#mobileControls button {
    width: 48px;
    height: 48px;

    border-radius: 12px;

    border: 1px solid rgba(255,255,255,.2);

    background: rgba(0,0,0,.55);

    color: white;

    font-size: 20px;

    touch-action: none;
}

.moveControls {
    position: absolute;
    left: 15px;
    bottom: 0;

    text-align: center;
}

.moveControls > button {
    display: block;
    margin: auto;
}

.moveControls div {
    display: flex;
    gap: 5px;
}

.actionControls {
    position: absolute;

    right: 15px;
    bottom: 5px;

    display: flex;
    gap: 10px;
}

#mobileControls button {
    pointer-events: auto;
}

/* RESPONSIVE */

@media(max-width: 700px) {

    #topBar {
        height: 58px;
        padding: 0 12px;
    }

    .logo {
        font-size: 17px;
    }

    .stats {
        gap: 5px;
    }

    .stats span {
        padding: 6px 8px;
        font-size: 12px;
    }

    #resetBtn {
        padding: 7px 9px;
        font-size: 11px;
    }

    #message {
        top: 68px;
        font-size: 10px;
        width: 85%;
    }

    #help {
        display: none;
    }

    #mobileControls {
        display: block;
    }

    #hotbar {
        bottom: 18px;
    }

    .slot {
        width: 48px;
        height: 48px;
    }

    .block-icon {
        width: 26px;
        height: 26px;
    }
}