html, body {
    margin: 0;
    height: 100%;
    background: #070916;
    color: #ecf4ff;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: "Segoe UI", Calibri, Arial, sans-serif;
}

canvas {
    width: 100vw;
    width: min(100vw, calc(100vh * 960 / 840));
    width: min(100vw, calc(100dvh * 960 / 840));
    height: auto;
    max-height: 100vh;
    max-height: 100dvh;
    display: block;
    background: #070916;
    touch-action: none;
}

body.pointing canvas {
    cursor: pointer;
}

#pad {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    height: calc(150px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    padding: 6px 18px calc(8px + env(safe-area-inset-bottom));
    align-items: center;
    justify-content: space-between;
    user-select: none;
    pointer-events: none;
}

.stick {
    position: relative;
    width: 136px;
    height: 136px;
    border-radius: 50%;
    pointer-events: auto;
    touch-action: none;
    background: rgba(10, 14, 32, 0.92);
    border: 2px solid rgba(78, 232, 255, 0.55);
    box-shadow: 0 0 28px rgba(78, 232, 255, 0.16), inset 0 0 24px rgba(78, 232, 255, 0.08);
}

.stick .glow {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from -45deg, rgba(78, 232, 255, 0.38) 0 90deg, transparent 0);
    opacity: 0;
    pointer-events: none;
}

.stick.dir-cw .glow { opacity: 1; transform: rotate(0deg); }
.stick.dir-right .glow { opacity: 1; transform: rotate(90deg); }
.stick.dir-soft .glow { opacity: 1; transform: rotate(180deg); }
.stick.dir-left .glow { opacity: 1; transform: rotate(270deg); }

.stick .sector {
    position: absolute;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa6c4;
    font: 700 22px "Segoe UI", Calibri, Arial, sans-serif;
    pointer-events: none;
}

.stick .up { top: 10px; left: 50%; transform: translateX(-50%); }
.stick .down { bottom: 10px; left: 50%; transform: translateX(-50%); }
.stick .left { left: 12px; top: 50%; transform: translateY(-50%); }
.stick .right { right: 12px; top: 50%; transform: translateY(-50%); }

.stick.dir-cw .up,
.stick.dir-soft .down,
.stick.dir-left .left,
.stick.dir-right .right {
    color: #4ee8ff;
    text-shadow: 0 0 10px #4ee8ff;
}

.stick .hub {
    position: absolute;
    width: 40px;
    height: 40px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(7, 9, 22, 0.95);
    border: 1px solid rgba(78, 232, 255, 0.35);
    pointer-events: none;
}

.actions {
    display: flex;
    align-items: center;
    gap: 14px;
    pointer-events: auto;
}

.actions button {
    appearance: none;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 2px solid rgba(78, 232, 255, 0.5);
    background: rgba(10, 14, 32, 0.92);
    color: #ecf4ff;
    font: 700 16px "Segoe UI", Calibri, Arial, sans-serif;
    touch-action: none;
    box-shadow: 0 0 18px rgba(78, 232, 255, 0.12);
}

.actions button.drop {
    width: 78px;
    height: 78px;
    border-color: rgba(255, 78, 186, 0.7);
    color: #ffd0ec;
}

.actions button:active {
    background: rgba(78, 232, 255, 0.22);
}

body.mobile.play-layout {
    justify-content: flex-start;
    padding-top: 0;
}

body.mobile.play-layout canvas {
    width: min(100vw, calc((100vh - 150px - env(safe-area-inset-bottom)) * 480 / 860));
    width: min(100vw, calc((100dvh - 150px - env(safe-area-inset-bottom)) * 480 / 860));
    max-height: calc(100vh - 150px - env(safe-area-inset-bottom));
    max-height: calc(100dvh - 150px - env(safe-area-inset-bottom));
}

body.mobile.in-game #pad,
body.mobile.naming #pad {
    display: flex;
}

@media (max-height: 520px) {
    #pad { height: 118px; padding-top: 4px; }
    .stick { width: 100px; height: 100px; }
    .stick .hub { width: 28px; height: 28px; }
    .stick .sector { font-size: 16px; width: 22px; height: 22px; }
    .actions button { width: 54px; height: 54px; font-size: 13px; }
    .actions button.drop { width: 62px; height: 62px; }
    body.mobile.play-layout canvas {
        width: min(100vw, calc((100vh - 118px) * 480 / 860));
        width: min(100vw, calc((100dvh - 118px) * 480 / 860));
        max-height: calc(100vh - 118px);
        max-height: calc(100dvh - 118px);
    }
}

noscript p {
    max-width: 28rem;
    text-align: center;
    line-height: 1.5;
    padding: 24px;
}
