body[data-page="flappy"] {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
}

body[data-page="flappy"] .content {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    padding: 16px 20px 14px;
    gap: 10px;
}

body[data-page="flappy"] .top-bar {
    flex: 0 0 auto;
    margin-bottom: 0;
    padding-bottom: 10px;
}

body[data-page="flappy"] .top-bar h1 {
    font-size: clamp(1.35rem, 2vw, 1.8rem);
}

body[data-page="flappy"] .top-bar p {
    margin-top: 4px;
}

.flappy-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flappy-stage {
    position: relative;
    width: min(100%, 420px);
    aspect-ratio: 9 / 16;
    max-height: 100%;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    background: #161b33;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#flappyCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.flappy-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 14px;
    background: linear-gradient(180deg, rgba(9, 9, 11, 0.05) 0%, rgba(9, 9, 11, 0.28) 38%, rgba(9, 9, 11, 0.82) 100%);
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.flappy-overlay.is-hidden {
    display: none;
}

.flappy-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.flappy-kicker {
    color: #f5c400;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.flappy-panel h2 {
    font-size: clamp(1.8rem, 6vw, 2.4rem);
    letter-spacing: -0.04em;
    line-height: 0.95;
}

.flappy-hint,
.flappy-note,
.flappy-best {
    color: var(--text-muted);
    line-height: 1.4;
}

.flappy-best strong,
.flappy-scoreline {
    color: var(--text-main);
}

.flappy-scoreline {
    font-size: clamp(3rem, 10vw, 4.2rem);
    font-weight: 700;
    letter-spacing: -0.05em;
    line-height: 0.9;
}

.flappy-board-wrap h3 {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 6px 0 2px;
}

.flappy-board {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.flappy-board li {
    display: grid;
    grid-template-columns: 1.4rem 1fr auto;
    gap: 8px;
    padding: 2px 0;
    font-variant-numeric: tabular-nums;
    font-size: 0.92rem;
}

.flappy-board li span:last-child {
    font-weight: 700;
}

.flappy-empty {
    color: var(--text-muted);
}

.flappy-board-wrap.is-hidden,
.flappy-form.is-hidden,
.flappy-note.is-hidden,
.flappy-error.is-hidden,
.is-hidden {
    display: none;
}

.flappy-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.flappy-form label {
    font-weight: 600;
}

.flappy-form input {
    width: 100%;
    background: rgba(10, 10, 12, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 10px 12px;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.42em;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    user-select: text;
    -webkit-user-select: text;
    touch-action: manipulation;
}

.flappy-form input:focus {
    border-color: #f5c400;
    box-shadow: 0 0 0 3px rgba(245, 196, 0, 0.2);
}

.flappy-form button,
#retryBtn {
    width: 100%;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 14px;
    background: #f5c400;
    color: #1a1404;
    font-weight: 700;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    touch-action: manipulation;
}

.flappy-form button:disabled {
    opacity: 0.6;
    cursor: default;
}

#retryBtn {
    margin-top: 8px;
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-strong);
}

.flappy-error {
    color: #f87171;
    font-size: 0.88rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 720px) {
    body[data-page="flappy"] .content {
        padding: 10px 12px 10px;
    }
}

@media (max-height: 740px) {
    body[data-page="flappy"] .top-bar p {
        display: none;
    }

    .flappy-overlay {
        padding: 10px;
    }

    .flappy-board li {
        font-size: 0.82rem;
        padding: 1px 0;
    }
}
