/*
 * Bowlio "Install App" banner.
 * Mobile-only PWA install prompt. Loaded by install-banner.js, which injects
 * the markup that these rules style. See install-banner.js for behavior.
 */

:root {
    --bib-bg: rgba(255, 255, 255, 0.86);
    --bib-border: rgba(0, 48, 32, 0.12);
    --bib-text: #0f1f18;
    --bib-subtext: #4b5a53;
    --bib-shadow: 0 -8px 30px rgba(0, 48, 32, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
    --bib-accent-start: #003020;
    --bib-accent-end: #0b5533;
    --bib-accent-text: #ffffff;
    --bib-close-bg: rgba(15, 31, 24, 0.06);
    --bib-close-fg: #4b5a53;
    --bib-sheet-bg: rgba(255, 255, 255, 0.96);
    --bib-step-bg: rgba(0, 48, 32, 0.05);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bib-bg: rgba(20, 26, 23, 0.78);
        --bib-border: rgba(255, 255, 255, 0.1);
        --bib-text: #f3f6f4;
        --bib-subtext: #b7c2bc;
        --bib-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
        --bib-accent-start: #064027;
        --bib-accent-end: #16663d;
        --bib-accent-text: #ffffff;
        --bib-close-bg: rgba(255, 255, 255, 0.08);
        --bib-close-fg: #cdd6d1;
        --bib-sheet-bg: rgba(28, 35, 32, 0.98);
        --bib-step-bg: rgba(255, 255, 255, 0.06);
    }
}

.bowlio-install-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    justify-content: center;
    padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
}

.bowlio-install-banner__card {
    pointer-events: auto;
    width: 100%;
    max-width: 480px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 12px 12px 14px;
    border-radius: 18px;
    background: var(--bib-bg);
    border: 1px solid var(--bib-border);
    box-shadow: var(--bib-shadow);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    transform: translateY(calc(100% + 24px));
    opacity: 0;
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.32s ease;
    touch-action: pan-x;
    position: relative;
}

.bowlio-install-banner__card::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--bib-close-bg);
}

.bowlio-install-banner.is-visible .bowlio-install-banner__card {
    transform: translateY(0);
    opacity: 1;
}

.bowlio-install-banner__icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    background: #fff;
}

.bowlio-install-banner__icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bowlio-install-banner__body {
    flex: 1 1 auto;
    min-width: 0;
}

.bowlio-install-banner__title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--bib-text);
    line-height: 1.25;
}

.bowlio-install-banner__subtitle {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: var(--bib-subtext);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bowlio-install-banner__actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bowlio-install-banner__install {
    appearance: none;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--bib-accent-text);
    background: linear-gradient(135deg, var(--bib-accent-start), var(--bib-accent-end));
    padding: 9px 16px;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 48, 32, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.bowlio-install-banner__install:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 48, 32, 0.42);
}

.bowlio-install-banner__install:active {
    transform: translateY(0);
}

.bowlio-install-banner__close {
    appearance: none;
    border: none;
    cursor: pointer;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bib-close-bg);
    color: var(--bib-close-fg);
    transition: background 0.15s ease;
}

.bowlio-install-banner__close:hover {
    background: rgba(217, 4, 41, 0.14);
    color: #d90429;
}

.bowlio-install-banner__close svg {
    width: 14px;
    height: 14px;
}

.bowlio-install-banner__install:focus-visible,
.bowlio-install-banner__close:focus-visible {
    outline: 2px solid #d90429;
    outline-offset: 2px;
}

/* iOS "Add to Home Screen" instruction sheet */
.bowlio-ios-sheet {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 10px;
    background: rgba(6, 12, 9, 0);
    transition: background 0.28s ease;
    pointer-events: none;
}

.bowlio-ios-sheet.is-visible {
    background: rgba(6, 12, 9, 0.45);
    pointer-events: auto;
}

.bowlio-ios-sheet__panel {
    width: 100%;
    max-width: 480px;
    background: var(--bib-sheet-bg);
    border: 1px solid var(--bib-border);
    border-radius: 20px 20px 16px 16px;
    padding: 18px 18px calc(16px + env(safe-area-inset-bottom, 0px));
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    backdrop-filter: blur(24px) saturate(160%);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(16px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.bowlio-ios-sheet.is-visible .bowlio-ios-sheet__panel {
    transform: translateY(0);
    opacity: 1;
}

.bowlio-ios-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.bowlio-ios-sheet__header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--bib-text);
}

.bowlio-ios-sheet__steps {
    list-style: none;
    margin: 0 0 4px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bowlio-ios-sheet__step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bib-step-bg);
}

.bowlio-ios-sheet__step-num {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--bib-accent-text);
    background: linear-gradient(135deg, var(--bib-accent-start), var(--bib-accent-end));
}

.bowlio-ios-sheet__step-icon {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    color: var(--bib-text);
}

.bowlio-ios-sheet__step-icon svg {
    width: 100%;
    height: 100%;
}

.bowlio-ios-sheet__step p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--bib-text);
    line-height: 1.35;
}

.bowlio-ios-sheet__step strong {
    font-weight: 700;
}

/* Narrow phones: give the copy its own row instead of clipping it. */
@media (max-width: 400px) {
    .bowlio-install-banner__card {
        flex-wrap: wrap;
    }

    .bowlio-install-banner__body {
        flex-basis: calc(100% - 58px);
    }

    .bowlio-install-banner__actions {
        flex-basis: 100%;
        justify-content: flex-end;
        margin-top: 4px;
    }
}

/* Only ever show on touch/mobile viewports */
@media (min-width: 769px) {
    .bowlio-install-banner,
    .bowlio-ios-sheet {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bowlio-install-banner__card,
    .bowlio-ios-sheet,
    .bowlio-ios-sheet__panel,
    .bowlio-install-banner__install,
    .bowlio-install-banner__close {
        transition-duration: 0.001ms !important;
    }
}
