html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0e1116;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

canvas {
    display: block;
}

#hud {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    left: calc(14px + env(safe-area-inset-left));
    padding: 8px 12px;
    font: 15px/1.5 monospace;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 4px;
    white-space: pre;
    pointer-events: none;
    display: none;
}

#hud.vidno {
    display: block;
}

#akce {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    left: calc(14px + env(safe-area-inset-left));
    max-width: min(420px, 70vw);
    padding: 9px 13px;
    border-radius: 9px;
    background: rgba(12, 16, 22, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #e8eef6;
    font: 14px/1.4 system-ui, -apple-system, sans-serif;
    pointer-events: none;
    z-index: 25;
}

#rychlost {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    right: calc(14px + env(safe-area-inset-right));
    padding: 6px 14px;
    font: 24px/1.2 monospace;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 4px;
    white-space: pre;
    pointer-events: none;
}

#touch {
    display: none;
}

#touch.on {
    display: block;
}

#touch .pad {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#touch .vlevo {
    left: calc(16px + env(safe-area-inset-left));
}

#touch .vpravo {
    right: calc(16px + env(safe-area-inset-right));
}

#touch .stred {
    left: 50%;
    transform: translateX(-50%);
}

#touch .stred button {
    width: 64px;
    height: 64px;
    font-size: 10.5px;
    line-height: 1.1;
    overflow: hidden;
}

@media (orientation: portrait) {
    #touch .stred {
        bottom: calc(104px + env(safe-area-inset-bottom));
    }
}

#touch button {
    width: 88px;
    height: 88px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    background: rgba(18, 22, 28, 0.55);
    color: #fff;
    font: 600 13px/1.15 system-ui, -apple-system, sans-serif;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#touch .vlevo button,
#touch .vpravo button {
    width: 96px;
    height: 96px;
    font-size: 15px;
}

#touch .vlevo button {
    font-size: 26px;
    line-height: 1;
}

@media (orientation: portrait) {
    #touch .vlevo button,
    #touch .vpravo button {
        width: 78px;
        height: 78px;
    }
}

#touch button.drzeno {
    background: rgba(110, 195, 255, 0.8);
    border-color: #fff;
}

#touch button.zap {
    border-color: #7fd0ff;
    color: #7fd0ff;
}

@media (max-width: 900px) {
    #hud {
        font-size: 12px;
        max-width: 62vw;
        white-space: pre-wrap;
    }

    #rychlost {
        font-size: 19px;
    }
}

#kompas {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 14px 8px;
    border-radius: 999px;
    background: rgba(12, 16, 22, 0.72);
    color: #e8eef6;
    font: 12px/1.3 system-ui, -apple-system, sans-serif;
    text-align: center;
    pointer-events: none;
}

#sipka {
    display: block;
    width: 34px;
    height: 34px;
    margin: 0 auto 1px;
    transform-origin: 50% 50%;
}

#sipka path {
    fill: #8fd694;
    stroke: rgba(8, 12, 16, 0.85);
    stroke-width: 5;
    paint-order: stroke;
}

#odvezeno {
    position: fixed;
    right: calc(14px + env(safe-area-inset-right));
    bottom: calc(14px + env(safe-area-inset-bottom));
    padding: 7px 13px;
    border-radius: 6px;
    background: rgba(12, 16, 22, 0.72);
    color: #e8eef6;
    font: 13px/1.4 system-ui, -apple-system, sans-serif;
    pointer-events: none;
}

#odvezeno b {
    font-size: 17px;
    font-weight: 600;
    color: #8fd694;
}

@media (max-width: 820px) {
    #odvezeno {
        right: auto;
        bottom: auto;
        top: calc(12px + env(safe-area-inset-top));
        left: calc(14px + env(safe-area-inset-left));
    }

    #kompas {
        top: calc(58px + env(safe-area-inset-top));
    }
}

body.dotyk #odvezeno {
    left: auto;
    bottom: auto;
    right: calc(14px + env(safe-area-inset-right));
    top: calc(64px + env(safe-area-inset-top));
}

@media (orientation: portrait) {
    body.dotyk #kompas {
        top: calc(112px + env(safe-area-inset-top));
    }
}

#zprava {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 130px);
    transform: translateX(-50%);
    max-width: min(560px, 88vw);
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(12, 16, 22, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #e8eef6;
    font: 13px/1.45 system-ui, -apple-system, sans-serif;
    text-align: center;
    z-index: 30;
    pointer-events: none;
}

@media (orientation: portrait) {
    body.dotyk #zprava {
        bottom: calc(env(safe-area-inset-bottom, 0px) + 284px);
    }
}

#menu {
    position: fixed;
    inset: 0;
    background: rgba(6, 9, 14, 0.72);
    z-index: 60;
}

#menu:not([hidden]) {
    display: grid;
    place-items: center;
}

#menu .karta {
    min-width: min(360px, 86vw);
    padding: 22px 24px 18px;
    border-radius: 16px;
    background: rgba(14, 19, 26, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #e8eef6;
    font: 14px/1.5 system-ui, -apple-system, sans-serif;
    text-align: center;
}

#menu h1 {
    margin: 0 0 6px;
    font-size: 19px;
    letter-spacing: 0.02em;
}

#menu p {
    margin: 0 0 16px;
    color: #9fb0c4;
    font-size: 12.5px;
}

#menu button:not([hidden]) {
    display: block;
    width: 100%;
    margin: 8px 0 0;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.08);
    color: #e8eef6;
    font: 14px/1 system-ui, -apple-system, sans-serif;
    cursor: pointer;
}

#menu button:hover {
    background: rgba(255, 255, 255, 0.16);
}

#menu button:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 2px rgba(120, 170, 240, 0.45);
}

#menu .tise {
    margin-top: 14px;
    color: #7e8fa3;
    font-size: 11.5px;
}

#sponzor {
    position: fixed;
    left: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    padding: 7px 11px;
    border-radius: 10px;
    background: rgba(12, 16, 22, 0.72);
    color: #9fb0c4;
    font: 11px/1.35 system-ui, -apple-system, sans-serif;
    z-index: 25;
    pointer-events: none;
}

#sponzor a {
    color: #e8eef6;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    pointer-events: auto;
}

#sponzor a:hover {
    text-decoration: underline;
}

#sponzor.nadPadem {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 220px);
}

#loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 16px monospace;
    color: #9ab;
    background: #0e1116;
    z-index: 70;
    transition: opacity 0.4s ease;
}

#loading.hotovo {
    opacity: 0;
    pointer-events: none;
}

#loading .nacitani {
    width: min(320px, 80vw);
    text-align: center;
}

#loading .pruh {
    height: 8px;
    margin: 14px 0 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

#loadingPruh {
    width: 0;
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #4f8fdc, #8ab4f8);
}

#loadingProcenta {
    color: #e8eef6;
    font-size: 15px;
}

#loadingFaze {
    margin-top: 6px;
    color: #6f8194;
    font-size: 12px;
}
	

#menu #ucet {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

#menu h2 {
    margin: 0 0 4px;
    font-size: 15px;
}

#menu #ucet p {
    margin-bottom: 8px;
}

#menu input {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 8px 0 0;
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(0, 0, 0, 0.3);
    color: #e8eef6;
    font: 16px/1.2 system-ui, -apple-system, sans-serif; /* pod 16 px iPhone při psaní zoomuje */
}

#menu input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.75);
    box-shadow: 0 0 0 2px rgba(120, 170, 240, 0.45);
}

#menu #ucetChyba {
    margin: 10px 0 0;
    color: #ffb4a8;
}
