html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #2b1d14;
    color: #fff6e0;
    font-family: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
    /* no scrolling, selection, callouts or zoom gestures during play */
    overscroll-behavior: none;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

body {
    position: fixed;
    inset: 0;
}

#app {
    position: absolute;
    inset: 0;
    /* keep the game clear of notches / home indicators */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
    background: radial-gradient(ellipse at center, #ffd89a 0%, #e8a35c 100%);
}

#game-container {
    width: 100%;
    height: 100%;
}

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

#loading {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffc928;
    color: #2b1d14;
    font-weight: 800;
    font-size: 22px;
    z-index: 5;
}

#loading .spinner {
    font-size: 64px;
    animation: bob 0.6s ease-in-out infinite alternate;
}

@keyframes bob {
    from {
        transform: translateY(0) rotate(-3deg);
    }
    to {
        transform: translateY(-10px) rotate(3deg);
    }
}

#rotate {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20;
    background: #ffc928;
    color: #2b1d14;
    text-align: center;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

#rotate h2 {
    font-size: 32px;
    margin: 12px 0 4px;
}

#rotate p {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

#rotate .phone {
    font-size: 72px;
    animation: turn 1.8s ease-in-out infinite;
}

@keyframes turn {
    0%,
    30% {
        transform: rotate(0deg);
    }
    60%,
    100% {
        transform: rotate(-90deg);
    }
}

@media (orientation: portrait) and (pointer: coarse) {
    #rotate {
        display: flex;
    }
}

@media (prefers-reduced-motion: reduce) {
    #rotate .phone,
    #loading .spinner {
        animation: none;
    }
}

/* ── dev debug panel ─────────────────────────────── */
#debug-panel {
    position: fixed;
    left: 8px;
    bottom: 8px;
    z-index: 30;
    background: rgba(20, 16, 12, 0.88);
    color: #fff;
    font: 12px/1.3 ui-monospace, Menlo, monospace;
    border-radius: 8px;
    padding: 6px 10px;
    max-width: 320px;
    max-height: 90vh;
    overflow: auto;
    touch-action: auto;
    user-select: auto;
}

#debug-panel summary {
    cursor: pointer;
    font-weight: bold;
}

#debug-panel label {
    display: block;
    margin: 6px 0;
}

#debug-panel label span {
    color: #ffc928;
}

#debug-panel input[type='range'] {
    width: 100%;
}

#debug-panel button {
    margin: 6px 6px 0 0;
    font: inherit;
}

#debug-panel .dbg-stats {
    color: #9fe;
    margin: 4px 0;
}
