/*
 * Flabby Bird — app styles
 *
 * The game stage is a dark golden-hour surface (the engine's own visual
 * language); its palette is declared once below and confined to the stage.
 * All portal chrome (container, help panel, use cases, related tools) uses
 * the design tokens from main.css. Every overlay is position:absolute inside
 * the stage — no fixed positioning, no body/:root overrides.
 */

/* Engine palette (in-stage HUD only) */
.flabby-bird-container {
    --fb-gold: #ffc24d;
    --fb-cyan: #33e1ff;
    --fb-ink: #0a0d18;
    --fb-ink-deep: #06080f;
    --fb-text: #eef2ff;
    --fb-label: #bed7ff;
    --fb-dim: #96b4e6;

    max-width: 960px;
    margin: 0 auto;
}

/* ---------- Stage ---------- */

.flabby-bird-container .fb-stage {
    position: relative;
    width: 100%;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    min-height: clamp(380px, 62vh, 720px);
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    background: var(--fb-ink-deep);
    box-shadow: var(--shadow-lg);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.flabby-bird-container .fb-stage:focus {
    outline: none;
}

.flabby-bird-container .fb-stage:focus-visible {
    box-shadow: var(--shadow-lg), 0 0 0 3px rgba(255, 194, 77, 0.55);
}

.flabby-bird-container .fb-stage > canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.flabby-bird-container .fb-stage .hidden {
    display: none !important;
}

/* ---------- Launch cover (pre-boot) ---------- */

.flabby-bird-container .fb-launch-cover {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-4);
    text-align: center;
    background:
        radial-gradient(120% 90% at 50% 110%, rgba(255, 157, 92, 0.34) 0%, rgba(255, 157, 92, 0) 55%),
        radial-gradient(90% 70% at 78% 8%, rgba(51, 225, 255, 0.14) 0%, rgba(51, 225, 255, 0) 60%),
        linear-gradient(180deg, #0b1020 0%, #14203d 42%, #33294a 72%, #5d4256 100%);
}

.flabby-bird-container .fb-launch-kicker {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    letter-spacing: 0.55em;
    text-transform: uppercase;
    color: var(--fb-gold);
    text-shadow: 0 0 12px rgba(255, 194, 77, 0.6);
}

.flabby-bird-container .fb-launch-title {
    margin: 0;
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: clamp(28px, 5vw, 56px);
    line-height: 1.05;
    letter-spacing: 0.04em;
    background: linear-gradient(180deg, #ffffff 15%, #ffd98f 55%, #ff9d5c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 4px 26px rgba(255, 170, 90, 0.35));
}

.flabby-bird-container .fb-launch-tagline {
    margin: 0;
    max-width: 52ch;
    font-size: var(--font-size-sm);
    line-height: 1.55;
    color: rgba(210, 225, 255, 0.85);
}

.flabby-bird-container .fb-launch {
    margin-top: var(--space-2);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: var(--font-size-sm);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #06121a;
    background: linear-gradient(180deg, #ffd98f, var(--fb-gold));
    border: 0;
    border-radius: 999px;
    padding: 14px 38px;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(255, 194, 77, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.flabby-bird-container .fb-launch:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 44px rgba(255, 194, 77, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.flabby-bird-container .fb-launch:active {
    transform: translateY(0) scale(0.98);
}

.flabby-bird-container .fb-launch:focus-visible {
    outline: none;
    box-shadow: 0 0 44px rgba(255, 194, 77, 0.65), 0 0 0 3px rgba(255, 194, 77, 0.9);
}

.flabby-bird-container .fb-loading {
    position: absolute;
    bottom: 11%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 35;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--fb-gold);
    text-shadow: 0 0 12px rgba(255, 194, 77, 0.55);
    animation: fb-blink 1.4s ease-in-out infinite;
}

/* ---------- Scrim ---------- */

.flabby-bird-container .fb-scrim {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    background: linear-gradient(180deg, rgba(4, 6, 14, 0.55) 0%, rgba(4, 6, 14, 0) 26%,
        rgba(4, 6, 14, 0) 46%, rgba(4, 6, 14, 0.62) 82%, rgba(4, 6, 14, 0.86) 100%);
}

/* ---------- HUD ---------- */

.flabby-bird-container .fb-score {
    position: absolute;
    top: 4%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: clamp(26px, 5vw, 60px);
    letter-spacing: 0.06em;
    color: #fff;
    text-shadow: 0 0 18px rgba(120, 220, 255, 0.55), 0 2px 10px rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity 0.4s;
}

.flabby-bird-container .fb-combo {
    position: absolute;
    top: calc(4% + clamp(40px, 8vw, 78px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    font-weight: 600;
    font-size: clamp(11px, 1.5vw, 14px);
    letter-spacing: 0.35em;
    color: var(--fb-gold);
    text-shadow: 0 0 14px rgba(255, 194, 77, 0.8);
    opacity: 0;
    transition: opacity 0.35s;
}

.flabby-bird-container .fb-hud-side {
    position: absolute;
    top: 3.5%;
    left: 2.5%;
    z-index: 10;
    pointer-events: none;
    font-size: 11px;
    letter-spacing: 0.22em;
    color: rgba(190, 215, 255, 0.85);
    text-transform: uppercase;
    line-height: 1.9;
    opacity: 0;
    transition: opacity 0.5s;
}

.flabby-bird-container .fb-hud-side b {
    color: #fff;
    font-weight: 600;
}

.flabby-bird-container .fb-bar {
    display: inline-block;
    width: 52px;
    height: 3px;
    background: rgba(140, 180, 255, 0.18);
    vertical-align: middle;
    margin-left: 8px;
    border-radius: 2px;
    overflow: hidden;
}

.flabby-bird-container .fb-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--fb-cyan), var(--fb-gold));
    width: 0%;
}

.flabby-bird-container .fb-best {
    position: absolute;
    top: 3.5%;
    right: 2.5%;
    z-index: 10;
    pointer-events: none;
    font-size: 11px;
    letter-spacing: 0.28em;
    color: rgba(190, 215, 255, 0.8);
    text-transform: uppercase;
    text-align: right;
    line-height: 1.9;
    opacity: 0;
    transition: opacity 0.5s;
}

.flabby-bird-container .fb-best b {
    color: var(--fb-gold);
    font-weight: 600;
}

.flabby-bird-container .fb-fps {
    position: absolute;
    bottom: 3%;
    left: 2.5%;
    z-index: 10;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: rgba(150, 180, 230, 0.6);
}

.flabby-bird-container .fb-build {
    position: absolute;
    bottom: 3%;
    right: 2.5%;
    z-index: 10;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.24em;
    color: rgba(150, 180, 230, 0.45);
    text-transform: uppercase;
}

.flabby-bird-container .fb-hint {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    white-space: nowrap;
    color: rgba(210, 225, 255, 0.9);
    background: rgba(10, 14, 26, 0.55);
    border: 1px solid rgba(140, 180, 255, 0.25);
    border-radius: 999px;
    padding: 6px 14px;
    backdrop-filter: blur(4px);
}

/* ---------- Menu ---------- */

.flabby-bird-container .fb-menu {
    position: absolute;
    inset: 0;
    z-index: 15;
    opacity: 1;
    transition: opacity 0.7s;
}

.flabby-bird-container .fb-menu.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.flabby-bird-container .fb-menu-content {
    position: absolute;
    left: 5%;
    bottom: 9%;
    max-width: 640px;
}

.flabby-bird-container .fb-kicker {
    font-family: var(--font-mono);
    font-size: clamp(9px, 1.1vw, 12px);
    letter-spacing: 0.55em;
    color: var(--fb-gold);
    text-transform: uppercase;
    margin-bottom: 14px;
    text-shadow: 0 0 12px rgba(255, 194, 77, 0.6);
}

.flabby-bird-container .fb-menu-title {
    margin: 0;
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: clamp(26px, 5.5vw, 68px);
    line-height: 0.98;
    letter-spacing: 0.02em;
    background: linear-gradient(180deg, #ffffff 15%, #ffd98f 55%, #ff9d5c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 4px 26px rgba(255, 170, 90, 0.35));
}

.flabby-bird-container .fb-menu-sub {
    margin-top: 14px;
    font-size: clamp(12px, 1.5vw, 16px);
    color: rgba(210, 225, 255, 0.85);
    font-weight: 400;
    letter-spacing: 0.02em;
    max-width: 46ch;
    line-height: 1.55;
}

.flabby-bird-container .fb-chips {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.flabby-bird-container .fb-chip {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(200, 220, 255, 0.9);
    border: 1px solid rgba(140, 180, 255, 0.28);
    border-radius: 999px;
    padding: 7px 14px;
    background: rgba(20, 30, 60, 0.35);
    backdrop-filter: blur(4px);
}

.flabby-bird-container .fb-chip b {
    color: #fff;
}

.flabby-bird-container .fb-prompt {
    margin-top: 26px;
    font-family: var(--font-mono);
    font-size: clamp(11px, 1.5vw, 14px);
    letter-spacing: 0.5em;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    animation: fb-pulse 1.6s ease-in-out infinite;
}

/* ---------- Game over ---------- */

.flabby-bird-container .fb-over {
    position: absolute;
    inset: 0;
    z-index: 20;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.9s ease 0.15s, visibility 0s 1s;
}

.flabby-bird-container .fb-over.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.9s ease 0.15s;
}

.flabby-bird-container .fb-over-content {
    position: absolute;
    left: 50%;
    bottom: 9%;
    text-align: center;
    transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.9s ease;
    transform: translateX(-50%) translateY(26px);
    opacity: 0;
}

.flabby-bird-container .fb-over.show .fb-over-content {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    transition-delay: 1.1s, 1.1s;
}

.flabby-bird-container .fb-over-title {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: clamp(24px, 4.4vw, 50px);
    letter-spacing: 0.14em;
    color: #fff;
    text-shadow: 0 0 26px rgba(255, 120, 90, 0.5);
}

.flabby-bird-container .fb-over-cause {
    margin-top: 8px;
    font-size: 11px;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: rgba(255, 150, 120, 0.95);
}

.flabby-bird-container .fb-over-row {
    margin-top: 22px;
    display: flex;
    gap: 28px;
    justify-content: center;
    align-items: flex-end;
}

.flabby-bird-container .fb-over-cell {
    min-width: 88px;
}

.flabby-bird-container .fb-over-lbl {
    font-size: 10px;
    letter-spacing: 0.4em;
    color: rgba(190, 215, 255, 0.75);
    text-transform: uppercase;
}

.flabby-bird-container .fb-over-val {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: clamp(24px, 4.6vw, 48px);
    color: #fff;
    margin-top: 4px;
    text-shadow: 0 0 20px rgba(120, 220, 255, 0.5);
}

.flabby-bird-container .fb-over-val-gold {
    color: var(--fb-gold);
    text-shadow: 0 0 22px rgba(255, 194, 77, 0.55);
}

.flabby-bird-container .fb-newbest {
    display: none;
    margin: 14px auto 0;
    width: max-content;
    font-size: 10px;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: var(--fb-ink-deep);
    background: var(--fb-gold);
    border-radius: 999px;
    padding: 6px 16px;
    font-weight: 600;
    box-shadow: 0 0 26px rgba(255, 194, 77, 0.5);
}

.flabby-bird-container .fb-newbest.on {
    display: block;
}

.flabby-bird-container .fb-btn {
    pointer-events: auto;
    margin-top: 24px;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3em;
    color: #06121a;
    background: linear-gradient(180deg, #8ff0ff, var(--fb-cyan));
    border: 0;
    border-radius: 999px;
    padding: 13px 38px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 0 30px rgba(51, 225, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    transition: transform 0.12s, box-shadow 0.2s;
}

.flabby-bird-container .fb-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 0 44px rgba(51, 225, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.flabby-bird-container .fb-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 44px rgba(51, 225, 255, 0.7), 0 0 0 3px rgba(51, 225, 255, 0.9);
}

.flabby-bird-container .fb-over-hint {
    margin-top: 14px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.4em;
    color: rgba(190, 215, 255, 0.55);
    text-transform: uppercase;
}

/* ---------- Pause ---------- */

.flabby-bird-container .fb-pause {
    position: absolute;
    inset: 0;
    z-index: 25;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(6, 8, 15, 0.55);
    backdrop-filter: blur(2px);
}

.flabby-bird-container .fb-pause.on {
    display: flex;
}

.flabby-bird-container .fb-pause-t {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: clamp(20px, 4vw, 38px);
    letter-spacing: 0.5em;
    color: #fff;
    text-shadow: 0 0 24px rgba(120, 220, 255, 0.6);
}

.flabby-bird-container .fb-pause-s {
    margin-top: 14px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.4em;
    color: rgba(200, 220, 255, 0.7);
    text-transform: uppercase;
}

/* ---------- Fatal / noscript ---------- */

.flabby-bird-container .fb-fatal {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    background: var(--fb-ink-deep);
    text-align: center;
    padding: var(--space-4);
    font-size: var(--font-size-base);
    line-height: 1.7;
    color: #aab8e0;
    max-width: 90%;
    margin: 0 auto;
}

.flabby-bird-container .fb-fatal b {
    color: #fff;
    display: block;
    font-size: var(--font-size-xl);
    margin-bottom: 10px;
    letter-spacing: 0.1em;
    font-family: var(--font-mono);
}

.flabby-bird-container .fb-noscript {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    text-align: center;
    background: var(--fb-ink-deep);
    color: #aab8e0;
    font-size: var(--font-size-base);
    line-height: 1.7;
}

/* ---------- Toast (M-key sound toggle) ---------- */

.flabby-bird-container .fb-toast {
    position: absolute;
    bottom: 16%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--fb-ink-deep);
    background: var(--fb-gold);
    border-radius: 999px;
    padding: 7px 18px;
    font-weight: 600;
    box-shadow: 0 0 26px rgba(255, 194, 77, 0.5);
    opacity: 0;
    transition: opacity 0.25s;
}

.flabby-bird-container .fb-toast.on {
    opacity: 1;
}

/* ---------- Screen-reader only ---------- */

.flabby-bird-container .fb-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;
}

/* ---------- Keyframes ---------- */

@keyframes fb-pulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

@keyframes fb-blink {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ---------- Narrow screens (down to 360px) ---------- */

@media (max-width: 640px) {
    .flabby-bird-container .fb-score {
        font-size: clamp(22px, 7vw, 34px);
    }

    .flabby-bird-container .fb-combo {
        top: calc(4% + 44px);
    }

    .flabby-bird-container .fb-hud-side,
    .flabby-bird-container .fb-best {
        font-size: 9px;
        top: 2.5%;
    }

    .flabby-bird-container .fb-hud-side {
        left: 1.5%;
    }

    .flabby-bird-container .fb-best {
        right: 1.5%;
    }

    .flabby-bird-container .fb-hint {
        bottom: 7%;
        font-size: 9px;
        letter-spacing: 0.12em;
    }

    .flabby-bird-container .fb-build {
        display: none;
    }

    .flabby-bird-container .fb-menu-content {
        left: 6%;
        bottom: 6%;
        right: 6%;
        max-width: none;
    }

    .flabby-bird-container .fb-menu-title {
        font-size: clamp(24px, 9vw, 44px);
    }

    .flabby-bird-container .fb-menu-sub {
        font-size: 12px;
    }

    .flabby-bird-container .fb-chips {
        gap: 6px;
    }

    .flabby-bird-container .fb-chip {
        font-size: 9px;
        padding: 5px 10px;
    }

    .flabby-bird-container .fb-prompt {
        margin-top: 18px;
        letter-spacing: 0.3em;
    }

    .flabby-bird-container .fb-over-row {
        gap: 16px;
    }

    .flabby-bird-container .fb-over-cell {
        min-width: 60px;
    }

    .flabby-bird-container .fb-btn {
        padding: 12px 28px;
        font-size: 12px;
    }

    .flabby-bird-container .fb-launch {
        padding: 12px 30px;
        font-size: 13px;
    }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .flabby-bird-container .fb-prompt,
    .flabby-bird-container .fb-loading {
        animation: none;
    }

    .flabby-bird-container .fb-over,
    .flabby-bird-container .fb-over-content,
    .flabby-bird-container .fb-btn {
        transition: none;
    }
}
