* { box-sizing: border-box; }

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Inter, system-ui, -apple-system, Arial, sans-serif;
    background: #0b0716;
    color: #fff;
    -webkit-user-select: none;
    user-select: none;
}

#game-container, #game-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#ui-container {
    position: fixed;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
}

#ui-container > div {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

#minimap-wrap {
    position: fixed;
    bottom: 34px;
    left: 12px;
    display: flex;
    align-items: stretch;
    gap: 6px;
    z-index: 100;
}

#minimap {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.45);
    image-rendering: auto;
}

#height-bar {
    position: relative;
    width: 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.45);
    overflow: visible;
}

#height-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, #ad43f4, #ff00ae);
    transition: height 0.15s linear;
}

#height-castle {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    line-height: 1;
}

#copyright {
    position: fixed;
    bottom: 10px;
    left: 12px;
    font-size: 12px;
    opacity: 0.6;
}

#game-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 100;
}

.horizontal-buttons { display: flex; }

.control-btn {
    width: 56px;
    height: 56px;
    font-size: 22px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    margin: 3px;
    touch-action: none;
    cursor: pointer;
    color: #fff;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
}

.control-btn:hover { background: rgba(0, 0, 0, 0.65); }
.control-btn:active { background: rgba(173, 67, 244, 0.7); border-color: #ad43f4; }

#loader, .overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 7, 22, 0.82);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 24px;
    z-index: 1000;
}

#loader { font-size: 22px; }
.overlay { display: none; }

.overlay h1 {
    font-size: clamp(28px, 6vw, 48px);
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.howto {
    max-width: 480px;
    line-height: 1.7;
    color: #d4d4d8;
    margin: 0 0 24px;
}

.primary-btn, #menu button {
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, #ff00ae, #ad43f4);
    box-shadow: 0 8px 24px rgba(173, 67, 244, 0.35);
}

.primary-btn:hover { filter: brightness(1.1); }

#menu-btn {
    position: fixed;
    top: 10px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 22px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #fff;
    z-index: 200;
}

#menu {
    position: fixed;
    top: 58px;
    right: 12px;
    background: rgba(11, 7, 22, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px;
    border-radius: 12px;
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 200;
}

#menu button { display: block; width: 100%; padding: 10px 18px; font-size: 14px; margin: 4px 0; }

@media (max-width: 768px) {
    #game-controls { bottom: 12px; right: 12px; }
    #minimap-wrap { bottom: 30px; left: 8px; transform: scale(0.72); transform-origin: bottom left; }
    .control-btn { width: 50px; height: 50px; font-size: 20px; }
    #ui-container { font-size: 13px; }
}

