/* Define fallback for custom viewport height */
:root {
    --vh: 1vh;
}

body {
    margin: 0;
    padding: 0;
    background: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Use custom viewport height that accounts for browser UI */
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    /* Prevent iOS bounce scrolling */
    position: fixed;
    width: 100%;
    overflow: hidden;
    /* Prevent text selection on mobile */
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

#game-container {
    position: relative;
    background: #000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    /* Ensure container respects safe viewport */
    max-width: 100vw;
    max-height: calc(var(--vh, 1vh) * 100);
}

canvas {
    display: block;
    /* Ensure canvas doesn't exceed viewport */
    max-width: 100vw;
    max-height: calc(var(--vh, 1vh) * 100);
    /* Prevent canvas from being selected/highlighted */
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #FF8C61;
    font-size: 24px;
    text-align: center;
}

.spinner {
    border: 4px solid rgba(255, 140, 97, 0.3);
    border-top: 4px solid #FF8C61;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#error {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff4444;
    font-size: 18px;
    text-align: center;
    max-width: 80%;
}
