* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background:
        radial-gradient(circle at 20% 0%, rgba(46, 125, 200, 0.25), transparent 50%),
        radial-gradient(circle at 80% 100%, rgba(186, 104, 200, 0.20), transparent 50%),
        linear-gradient(135deg, #14131f 0%, #1a1a2e 60%, #16161f 100%);
    height: 100vh;
    height: 100dvh;
    padding: 10px;
    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; }

.ark-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 */
}

.ark-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;
}
.ark-status .best { color: #ffd980; }

.ark-canvas-wrap {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 0;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.08);
    touch-action: none;
}
#arkCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.ark-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
}
.ark-overlay.hidden { display: none; }
.ark-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);
}
.ark-overlay-box h2 { margin-bottom: 8px; font-size: 22px; color: #fff; }
.ark-overlay-box p  { margin-bottom: 16px; color: rgba(255,255,255,0.75); font-size: 14px; line-height: 1.4; }
.ark-overlay-box button {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #2ea6ff, #1c89e0);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(46,166,255,0.35);
}
.ark-overlay-box button:active { transform: scale(0.97); }
