* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #05070f;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    font-family: Arial, Helvetica, sans-serif;
}

.home-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(5, 7, 15, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.home-btn:hover {
    filter: brightness(1.15);
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#game-canvas {
    display: block;
    background: #000;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.35s ease;
    image-rendering: -webkit-optimize-contrast;
}

#game-canvas.ready {
    opacity: 1;
}

#loading-screen {
    position: fixed;
    inset: 0;
    background: #05070f;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: opacity 0.4s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#loading-title {
    color: #ffd35c;
    font-size: 42px;
    font-weight: bold;
    letter-spacing: 4px;
    margin-bottom: 30px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

#loading-bar {
    width: 320px;
    height: 18px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#loading-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffd35c, #ff9d3c);
    transition: width 0.15s ease;
}

#loading-text {
    margin-top: 14px;
    color: #cfd6e6;
    font-size: 14px;
    letter-spacing: 2px;
}

/* Landscape is the primary and only supported play orientation. On a narrow
   portrait viewport (phones/tablets held upright) ask the player to rotate --
   desktop windows are essentially never this narrow-and-tall, so this never
   interferes with the primary desktop target. */
#rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #05070f;
    color: #fff;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
}

#rotate-overlay .icon {
    font-size: 64px;
    margin-bottom: 18px;
    animation: rotate-hint 1.6s ease-in-out infinite;
}

#rotate-overlay p {
    font-size: 18px;
    max-width: 320px;
    line-height: 1.5;
    color: #cfd6e6;
}

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

@media (orientation: portrait) and (max-width: 900px) {
    #rotate-overlay { display: flex; }
    #game-container { display: none; }
}
