* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background:
        radial-gradient(circle at 30% 0%, rgba(77, 171, 247, 0.30), transparent 55%),
        radial-gradient(circle at 80% 100%, rgba(105, 219, 124, 0.20), transparent 50%),
        linear-gradient(135deg, #102031 0%, #16243a 60%, #1a1a2e 100%);
    height: 100vh;
    height: 100dvh;
    padding: 10px;
    /* Extra bottom gap so the play-field clears the home indicator / nav bar. */
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px) + 34px);
    color: #fff;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    /* Flex column so the game fills exactly the space left after the user-bar
       and whatever top padding Telegram's safe-area injects in fullscreen. */
    display: flex;
    flex-direction: column;
}
.user-bar { margin: 0 auto 10px; flex-shrink: 0; }

.fl-game {
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-height: 0;   /* allow the canvas to shrink to fit the viewport */
}

.fl-status {
    display: flex;
    justify-content: space-between;
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 9px 16px;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
}
.fl-status .best { color: #ffd980; }

.fl-canvas-wrap {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 0;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(180deg, #4dabf7 0%, #74c0fc 70%, #a5d8ff 100%);
    border: 1px solid rgba(255,255,255,0.08);
    touch-action: none;
    cursor: pointer;
}
#flCanvas { display: block; width: 100%; height: 100%; }

.fl-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
}
.fl-overlay.hidden { display: none; }
.fl-overlay-box {
    background: #1c1a2b;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 18px;
    padding: 24px 26px;
    text-align: center;
    max-width: 300px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.fl-overlay-box h2 { margin-bottom: 8px; font-size: 22px; color: #fff; }
.fl-overlay-box p  { margin-bottom: 16px; color: rgba(255,255,255,0.75); font-size: 14px; line-height: 1.4; }
.fl-overlay-box button {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffd43b, #fab005);
    color: #1a1a2e;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(250,176,5,0.4);
}
.fl-overlay-box button:active { transform: scale(0.97); }
