@font-face {
    font-family: 'Lilita One';
    src: url('assets/fonts/LilitaOne.woff2') format('woff2');
    font-display: block;
}

@font-face {
    font-family: 'Nunito';
    src: url('assets/fonts/Nunito-Black.woff2') format('woff2');
    font-weight: 900;
    font-display: block;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1b1033;
    overscroll-behavior: none;
}

body {
    position: fixed;
    inset: 0;
    font-family: 'Nunito', system-ui, sans-serif;
    font-weight: 900;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

#stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

canvas {
    display: block;
    touch-action: none;
    outline: none;
}

/* Portrait phones get a prompt to rotate; the game is landscape-only on small screens */
#rotateHint {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: radial-gradient(circle at 50% 40%, #3a2470 0%, #1b1033 70%);
    color: #fff;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: 'Lilita One', 'Nunito', sans-serif;
    font-size: 26px;
    letter-spacing: 0.5px;
    text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

#rotateHint p {
    margin: 28px 32px 0;
}

#rotateHint .phone {
    width: 64px;
    height: 110px;
    border: 6px solid #fff;
    border-radius: 14px;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3);
    animation: rotatePhone 2.2s ease-in-out infinite;
}

@keyframes rotatePhone {
    0%, 20% { transform: rotate(0deg); }
    50%, 80% { transform: rotate(-90deg); }
    100% { transform: rotate(0deg); }
}

@media (orientation: portrait) and (max-width: 900px) and (pointer: coarse) {
    #rotateHint { display: flex; }
}

/* Level editor toolbar */
#editorToolbar {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    max-width: calc(100vw - 24px);
    padding: 8px 10px;
    background: rgba(27, 16, 51, 0.92);
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    z-index: 40;
    touch-action: auto;
}

#editorToolbar.active {
    display: flex;
}

#editorToolbar .group {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0 6px;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}

#editorToolbar .group:last-child {
    border-right: none;
}

#editorToolbar .label {
    color: #cbb8ff;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 4px;
}

.tool-button {
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    border: 2px solid transparent;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font: 900 14px 'Nunito', sans-serif;
    cursor: pointer;
    transition: transform 0.08s, background 0.12s;
}

.tool-button:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.tool-button.selected {
    background: #ffcf3f;
    border-color: #fff4c2;
    color: #3b2400;
}

.tool-button.action { background: #3dbb6b; }
.tool-button.save { background: #f08a24; }
.tool-button.load { background: #8e5bd9; }
.tool-button.danger { background: #e2474b; }
