body {
    margin: 0;
    padding: 0;
    color: rgba(255, 255, 255, 0.87);
    background-color: #0f0f0f;
}

/* Text for search engines and screen readers, hidden visually (the game is a canvas) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Pin the game to the visible screen. Fixed + inset tracks the real viewport through
   rotation and full screen; 100vh / 100dvh go stale on phones (iOS home-screen app
   especially) and push the bottom of the game - the ground - off screen. */
#app {
    position: fixed;
    inset: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Give Phaser a full-window parent to FIT the canvas into */
#game-container {
    width: 100%;
    height: 100%;
}

/* Maximize / fullscreen button (see src/game/Fullscreen.ts) */
#fullscreen-btn {
    position: fixed;
    right: 16px;
    bottom: 16px;
    /* stay clear of the notch / home bar on phones */
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 10;
    width: 56px;
    height: 56px;
    border: 3px solid #1b2a41;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.85);
    color: #1b2a41;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 0 #1b2a41;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#fullscreen-btn:hover { background: #ffd32a; }
#fullscreen-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1b2a41; }

#fullscreen-btn.hint { animation: fs-hint 0.4s ease-in-out 3; }

@keyframes fs-hint {
    50% { transform: scale(1.3); background: #ffd32a; }
}

/* Phones / tablets: a little see-through so it doesn't hide the game */
#fullscreen-btn.touch { opacity: 0.8; }
#fullscreen-btn.touch:hover { background: rgba(255, 255, 255, 0.85); }

/* iPhone "Add to Home Screen" tip (see showTip in Fullscreen.ts) */
#fullscreen-tip {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 15, 15, 0.6);
    touch-action: manipulation;
}

#fullscreen-tip .card {
    max-width: min(420px, calc(100vw - 32px));
    padding: 20px 24px;
    border: 3px solid #1b2a41;
    border-radius: 18px;
    background: #fff;
    color: #1b2a41;
    font: 600 18px/1.4 system-ui, sans-serif;
    text-align: center;
    box-shadow: 0 6px 0 #1b2a41;
}

#fullscreen-tip .big { font-size: 40px; line-height: 1; }
#fullscreen-tip .share { font-size: 22px; }
#fullscreen-tip .small { font-size: 15px; font-weight: 500; opacity: 0.8; }
#fullscreen-tip p { margin: 10px 0; }

#fullscreen-tip button {
    margin-top: 6px;
    padding: 8px 32px;
    border: 3px solid #1b2a41;
    border-radius: 12px;
    background: #ffd32a;
    color: #1b2a41;
    font: 700 20px system-ui, sans-serif;
    box-shadow: 0 4px 0 #1b2a41;
}

/* TV browsers in cursor mode: hide the cursor where the browser lets us (see PointerRemote.ts) */
html.tv, html.tv body, html.tv canvas { cursor: none; }

/* "Turn your phone sideways" screen (see src/game/Orientation.ts) */
#rotate-tip {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #38bdf8;
    color: #1b2a41;
    font: 700 24px/1.3 system-ui, sans-serif;
    text-align: center;
    touch-action: none;
}
#rotate-tip.show { display: flex; }
#rotate-tip .phone { font-size: 96px; animation: rotate-phone 1.6s ease-in-out infinite; }
@keyframes rotate-phone {
    0%, 20%   { transform: rotate(0deg); }
    50%, 80%  { transform: rotate(-90deg); }
    100%      { transform: rotate(0deg); }
}

/* Smart TV on-screen JUMP / DUCK buttons (see src/game/input/TvButtons.ts) */
#tv-pad {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 10;
    display: none;
    flex-direction: column;
    gap: 20px;
    transform: translate(-50%, -50%);
}
#tv-pad.show { display: flex; }

#tv-pad .tv-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 150px;
    height: 110px;
    border: 4px solid #1b2a41;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.55);
    color: #1b2a41;
    font: 900 26px/1.1 "Arial Black", "Arial Bold", sans-serif;
    box-shadow: 0 5px 0 rgba(27, 42, 65, 0.8);
    opacity: 0.75;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.08s, background 0.08s, opacity 0.08s;
}
#tv-pad .tv-btn .icon { font-size: 40px; }

#tv-pad .tv-btn:hover { opacity: 1; background: rgba(255, 255, 255, 0.9); }
#tv-pad .tv-btn.lit,
#tv-pad .tv-btn:active {
    opacity: 1;
    background: #ffd32a;
    transform: translateY(4px);
    box-shadow: 0 1px 0 rgba(27, 42, 65, 0.8);
}

/* Show the TV cursor again while the buttons need aiming at */
html.tv.tv-pad, html.tv.tv-pad body, html.tv.tv-pad canvas { cursor: default; }
