html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* --- iOS "Add to Home Screen" prompt --- */
#a2hs-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: flex-end;
    justify-content: center;
    background: rgba(2, 6, 23, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#a2hs-overlay.a2hs-visible {
    display: flex;
}
#a2hs-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 420px;
    margin: 0 12px;
    margin-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    padding: 20px 20px 16px;
    border-radius: 20px;
    background: #0F172A;
    border: 1px solid #334155;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    color: #E2E8F0;
    text-align: left;
    animation: a2hs-rise 0.35s ease-out;
}
@keyframes a2hs-rise {
    from { transform: translateY(24px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
/* Dismissal walks the entrance back down the same path instead of snapping away.
   Shared by both popups; the JS adds .popup-leaving just before removing them. */
@keyframes a2hs-sink {
    from { transform: translateY(0);    opacity: 1; }
    to   { transform: translateY(24px); opacity: 0; }
}
@keyframes a2hs-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes a2hs-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}
#a2hs-overlay.popup-leaving,
#founder-overlay.popup-leaving {
    pointer-events: none;
    animation: a2hs-fade-out 0.28s ease-in forwards;
}
#a2hs-overlay.popup-leaving #a2hs-card,
#founder-overlay.popup-leaving #founder-card {
    animation: a2hs-sink 0.28s ease-in forwards;
}
#a2hs-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
#a2hs-head img {
    width: 48px;
    height: 48px;
    border-radius: 11px;
    flex: none;
}
#a2hs-title {
    font-size: 17px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.3;
}
#a2hs-subtitle {
    font-size: 13px;
    color: #94A3B8;
    margin-top: 2px;
}
.a2hs-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    line-height: 1.45;
    margin: 10px 0;
}
.a2hs-step svg {
    flex: none;
    width: 24px;
    height: 24px;
}
.a2hs-step b {
    color: #6EE7B7;
    font-weight: 600;
}
#a2hs-browser-note {
    display: none;
    font-size: 13px;
    color: #FDE68A;
    margin: 0 0 10px;
}
#a2hs-dismiss {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: #10B981;
    color: #022C22;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}
#a2hs-arrow {
    text-align: center;
    color: #6EE7B7;
    margin-top: 10px;
    line-height: 0;
    /* Three bounces to point at the button, then it rests. A hint that never stops
       asking stops being a hint, and an endlessly animating element keeps the phone
       redrawing for as long as the prompt is on screen. */
    animation: a2hs-nudge 1.4s ease-in-out 3 both;
}
@keyframes a2hs-nudge {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(6px); }
}

/* --- Founder pre-registration prompt --- */
#founder-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.6);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#founder-overlay.founder-visible {
    display: flex;
}
#founder-card {
    box-sizing: border-box;
    width: calc(100% - 24px);
    max-width: 420px;
    margin: 12px;
    margin-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 22px 20px 18px;
    border-radius: 20px;
    background: #0F172A;
    border: 1px solid #B08D2F;
    box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.15), 0 12px 40px rgba(0, 0, 0, 0.65);
    color: #E2E8F0;
    text-align: left;
    animation: a2hs-rise 0.35s ease-out;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
}
#founder-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
#founder-head img {
    width: 48px;
    height: 48px;
    border-radius: 11px;
    flex: none;
}
#founder-title {
    font-size: 18px;
    font-weight: 700;
    color: #F3D47A;
    line-height: 1.25;
}
#founder-subtitle {
    font-size: 13px;
    color: #94A3B8;
    margin-top: 2px;
}
#founder-body {
    font-size: 14px;
    line-height: 1.5;
    color: #CBD5E1;
    margin: 0 0 14px;
}
#founder-badge {
    display: inline-block;
    margin-bottom: 10px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.14);
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: #F3D47A;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
#founder-email {
    box-sizing: border-box;
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #334155;
    background: rgba(2, 6, 23, 0.6);
    color: #FFFFFF;
    font-size: 15px;
    font-family: inherit;
    outline: none;
}
#founder-email:focus {
    border-color: #D4AF37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.25);
}
#founder-submit {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(180deg, #F3D47A 0%, #D4AF37 100%);
    color: #171308;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}
#founder-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
#founder-later {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #94A3B8;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
}
#founder-msg {
    font-size: 13px;
    line-height: 1.4;
    margin: 10px 0 0;
    min-height: 18px;
}
#founder-msg.ok { color: #6EE7B7; }
#founder-msg.err { color: #FCA5A5; }

/* --- Motion, transparency and contrast preferences --- */
@media (prefers-reduced-motion: reduce) {
    /* The install prompt's arrow bounces forever. That is the one that has to stop. */
    #a2hs-arrow {
        animation: none;
    }
    /* The popups still announce themselves, but by fading rather than travelling. */
    #a2hs-card,
    #founder-card {
        animation: a2hs-fade-in 0.2s ease-out;
    }
    #a2hs-overlay.popup-leaving,
    #founder-overlay.popup-leaving,
    #a2hs-overlay.popup-leaving #a2hs-card,
    #founder-overlay.popup-leaving #founder-card {
        animation: a2hs-fade-out 0.2s ease-in forwards;
    }
}

@media (prefers-reduced-transparency: reduce) {
    /* Solid scrim, no blur — the game behind stops showing through. */
    #a2hs-overlay,
    #founder-overlay {
        background: #020617;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    #founder-email {
        background: #020617;
    }
    #founder-badge {
        background: #2C2411;
    }
}

@media (prefers-contrast: more) {
    #a2hs-overlay,
    #founder-overlay {
        background: #020617;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    #a2hs-card {
        border-color: #E2E8F0;
    }
    #founder-card {
        border-color: #F3D47A;
    }
    #a2hs-subtitle,
    #founder-subtitle {
        color: #CBD5E1;
    }
    #founder-body {
        color: #E2E8F0;
    }
    #founder-email {
        background: #020617;
        border-color: #94A3B8;
    }
    #founder-badge {
        background: #020617;
        border-color: #F3D47A;
        color: #F8E7B0;
    }
    #founder-later {
        color: #CBD5E1;
    }
}