html,
body {
    margin: 0;
    height: 100%;
    background: #000;
    font-family: system-ui, Segoe UI, Roboto;
}

#wrap {
    position: fixed;
    inset: 0;
    overflow: hidden;
}

canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.ui {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    gap: .5rem;
    justify-content: center;
    align-items: center;
    padding: .75rem;
}

/* 流れ星送信時に表示するふわっとテキスト */
.shoot-message {
    position: fixed;
    left: 50%;
    /* place slightly above center so the toast feels like it appears in the sky */
    top: 40%;
    /* start slightly smaller for a soft pop-in effect */
    transform: translate(-50%, 0) scale(0.96);
    color: #ffffff;
    /* make the element itself transparent so the hard box isn't visible */
    background: transparent;
    /* blur the content behind the toast slightly for a soft glass effect */
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: .6rem 1rem;
    border-radius: 10px;
    font-size: 1.05rem;
    pointer-events: none;
    opacity: 0;
    z-index: 30;
    text-shadow: 0 6px 18px rgba(0,0,0,0.6);
    /* softer, snappy easing for a gentle pop-in */
    transition: opacity 1000ms cubic-bezier(.22,.9,.28,1), transform 1000ms cubic-bezier(.22,.9,.28,1);
    will-change: opacity, transform;
}
.shoot-message.show {
    opacity: 1;
    /* no vertical drift — just scale up to appear */
    transform: translate(-50%, 0) scale(1);
}
/* soften the element edge by drawing a slightly larger blurred layer behind it */
.shoot-message {
    /* ensure pseudo-element is positioned relative to this box */
    position: fixed;
    /* make it a containing block for pseudo-elements */
    transform-origin: center center;
}
.shoot-message::before {
    content: '';
    position: absolute;
    /* extend slightly beyond the element to create a soft halo */
    inset: -10px;
    border-radius: 14px;
    /* stronger, slightly more opaque halo so the underlying transparent box doesn't look empty */
    background: rgba(255,255,255,0.06);
    filter: blur(12px);
    opacity: 0.95;
    z-index: -1;
    pointer-events: none;
}

.pill {
    color: #fff;
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 999px;
    padding: .4rem .8rem;
    font-size: .9rem;
}

#shootBtn {
    position: fixed;
    /* shift left a bit so a right-bottom footer can sit in the corner without overlap */
    bottom: 2rem;
    z-index: 10;
}

#shootBtn[disabled] {
    opacity: .5;
    cursor: not-allowed;
}

.count {
    min-width: 4.5rem;
    text-align: center;
}

#supportBtn {
    position: fixed;
    /* shift left a bit so a right-bottom footer can sit in the corner without overlap */
    right: 1rem;
    bottom: 5rem;
    z-index: 10;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.18);
    color: #fff;
    background: rgba(255, 255, 255, .10);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    padding: .4rem .8rem;
    font-size: .9rem;
    cursor: pointer;
    transition: all .2s;
}

/* Share button (X) — positioned above the support button on desktop,
   stacks vertically on mobile to match existing support button behavior */
#shareBtn {
    position: fixed;
    right: 1rem;
    bottom: 2rem; /* sits above #supportBtn */
    z-index: 10;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.18);
    color: #fff;
    background: rgba(255, 255, 255, .10);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    padding: .4rem .8rem;
    font-size: .9rem;
    cursor: pointer;
    transition: all .2s;
}

/* help button (左下) */
#helpBtn {
    position: fixed;
    left: 1rem;
    bottom: 2rem;
    z-index: 10;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.18);
    color: #fff;
    background: rgba(255, 255, 255, .10);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    padding: .4rem .8rem;
    font-size: .9rem;
    cursor: pointer;
    transition: all .2s;
}

@media (max-width: 480px) {
    #shareBtn {
        position: static;
        display: block;
        margin: 0 auto 2rem auto;
        box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.10);
        width: auto;
        right: auto;
        bottom: auto;
    }

    #shootBtn {
        bottom: 5rem;
    }

    /* #shareBtn {
        position: static;
        display: block;
        margin: 0 auto 1rem auto;
    } */
    
    #helpBtn, #supportBtn {
        bottom: 2rem;
    }

    #wrap {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        align-items: center;
    }

    .ui {
        /* Make the UI layer positioned so we can lift it above the canvas
           on some mobile browsers where stacking differs from desktop emulation. */
        position: relative;
        z-index: 15;
        margin-bottom: 1rem;
        width: 100%;
        justify-content: center;
        /* ensure UI isn't obscured by device safe area (home indicator) */
        padding-bottom: env(safe-area-inset-bottom, 0.75rem);
    }
}



/* Modal (fade/scale animation) */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    z-index: 1000;
    /* start hidden but present for transition */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 220ms ease, visibility 220ms linear;
}
.modal.open,
.modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.modal__dialog {
    background: transparent;
    color: #fff;
    max-width: 640px;
    width: calc(100% - 3rem);
    margin: 1rem;
    padding: 1.25rem 1.25rem 1.5rem 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    position: relative;
    /* dialog animation */
    transform: translateY(8px) scale(0.99);
    opacity: 0;
    transition: transform 240ms cubic-bezier(.2,.9,.2,1), opacity 200ms ease;
}
.modal.open .modal__dialog,
.modal[aria-hidden="false"] .modal__dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.modal__dialog h2 { margin-top: 0; margin-bottom: .5rem; font-size: 1.1rem }
.modal__dialog p { color: rgba(255,255,255,0.9); line-height: 1.6; margin: .5rem 0 }
.modal__close {
    position: absolute;
    top: .5rem;
    right: .5rem;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    cursor: pointer;
    padding: .25rem .5rem;
}

/* modal footer link */
.modal__foot { margin-top: 0.75rem; text-align: right }
.modal__foot a { color: #aee7ff; text-decoration: underline; font-weight: 300 }

/* Support modal: modal-scoped action button styles */
#supportModal .modal__dialog .pill {
    padding: .55rem .9rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: .95rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

#supportModal .modal__dialog a.pill { color: inherit }

/* Primary (FANBOX) — muted for dark theme */
#supportModal .modal__dialog .primary {
    background: linear-gradient(180deg, #e4be8d 0%, #ddac6f 100%);
    color: rgba(255,255,255,0.92);
    box-shadow: 0 6px 18px rgba(10,40,60,0.48);
    border: 1px solid rgba(120,190,220,0.08);
}

/* Secondary (doneru) — muted for dark theme */
#supportModal .modal__dialog .secondary {
    background: linear-gradient(180deg, #886cc9 0%, #944fb4 100%);
    color: rgba(255,255,255,0.92);
    box-shadow: 0 6px 18px rgba(60,30,10,0.44);
    border: 1px solid rgba(200,140,70,0.06);
}

/* Ghost / dismiss — subtle and spaced */
#supportModal .modal__dialog .ghost {
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.92);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: none;
    font-weight: 500;    
    padding: .5rem .95rem;
    font-size: 0.85rem;
    margin-top: 2rem; /* add top spacing as requested */
}

/* subtle hover lift */
/* subtle hover lift that suits dark background */
#supportModal .modal__dialog .pill:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 10px 22px rgba(0,0,0,0.32);
}
#supportModal .modal__dialog .pill:active { transform: translateY(0); opacity: .98 }

/* Ensure spacing in the action row on small screens */
#supportModal .modal__dialog p { margin-bottom: 0 }

/* Increase spacing in the modal footer row for support modal */
#supportModal .modal__dialog .modal__foot { display:flex; justify-content:space-between; gap:1.25rem; align-items:center }

.tk-footer {
    position: fixed;
    right: 0.7rem; /* corner on desktop */
    bottom: 0.3rem;
    z-index: 5; /* below floating buttons */
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.02);
    padding: 0.125rem 0.4rem;
    border-radius: 6px;
    pointer-events: none; /* never intercept clicks */
    user-select: none;
}

@media (max-width: 480px) {
    .tk-footer {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        bottom: calc(0.5rem + env(safe-area-inset-bottom, 0.5rem));
        z-index: 6;
    }
}