html.bp-page, body.bp-page {
    height: 100%;
    overflow: hidden;
    background: radial-gradient(1200px 800px at 50% 18%, #243044 0%, #1a1a2e 42%, #0f1c30 100%);
}

body.bp-page {
    color: #fff;
}

.bp-stage {
    position: relative;
    height: calc(100dvh - 58px);
    height: calc(100svh - 58px);
    min-height: 420px;
}

.bp-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
    touch-action: none;
    cursor: grab;
}

.bp-stage canvas:active { cursor: grabbing; }

.bp-hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 0 20px calc(28px + env(safe-area-inset-bottom));
    z-index: 3;
}

.bp-kicker {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42);
    pointer-events: none;
}

.bp-count {
    margin-bottom: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.62);
}

.bp-busy {
    margin: 0 0 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.72);
}

.bp-add-wrap {
    pointer-events: auto;
    position: relative;
}

.bp-add {
    pointer-events: auto;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font: inherit;
    font-weight: 650;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    padding: 12px 22px;
    min-height: 44px;
    border-radius: 999px;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.bp-add:hover { background: rgba(255, 255, 255, 0.14); }
.bp-add:focus-visible {
    outline: 2px solid #e94560;
    outline-offset: 3px;
}

.bp-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.bp-sheet-pop {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    min-width: 200px;
    background: rgba(18, 22, 34, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    overflow: hidden;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.bp-sheet-pop button {
    appearance: none;
    background: transparent;
    color: #fff;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 16px;
    min-height: 44px;
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.bp-sheet-pop button:last-child { border-bottom: 0; }
.bp-sheet-pop button:hover { background: rgba(255, 255, 255, 0.08); }

.bp-sheet-pop[hidden] { display: none !important; }

.bp-empty {
    pointer-events: none;
    position: absolute;
    top: 46%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: min(92vw, 320px);
}

.bp-empty[hidden] { display: none !important; }

.bp-empty-title {
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.bp-empty-sub {
    color: rgba(255, 255, 255, 0.58);
    margin-bottom: 18px;
    font-size: 0.98rem;
}

.bp-add-inline {
    pointer-events: auto;
}

.bp-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

.bp-fallback[hidden] { display: none !important; }

.bp-overlay { pointer-events: none; }

.bp-dialog {
    pointer-events: auto;
    border: 0;
    padding: 0;
    background: transparent;
    max-width: calc(100vw - 28px);
    max-height: calc(100dvh - 24px);
    margin: auto;
    z-index: 40;
}

.bp-dialog::backdrop {
    background: rgba(8, 10, 18, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.bp-sheet {
    width: min(380px, 92vw);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(20, 24, 38, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 22px 20px 18px;
    color: #fff;
    position: relative;
    color-scheme: dark;
}

.bp-icon-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
}

.bp-preview {
    display: block;
    width: 100%;
    max-height: 220px;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 16px;
    margin-bottom: 16px;
    background: radial-gradient(circle at 50% 58%, rgba(255,255,255,0.06), rgba(0,0,0,0.28));
}

.bp-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
}

.bp-field input,
.bp-field select {
    font: inherit;
    font-size: 16px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 10px 12px;
    min-height: 44px;
}

.bp-status-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
    margin: 4px 0 8px;
}

.bp-toggle {
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    margin-bottom: 16px;
}

.bp-toggle.is-on {
    background: rgba(80, 180, 120, 0.22);
    border-color: rgba(120, 210, 150, 0.35);
}

.bp-sheet-actions {
    display: flex;
    gap: 10px;
}

.bp-btn {
    flex: 1;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.bp-btn-ghost { background: transparent; }

.bp-btn-danger {
    background: rgba(233, 69, 96, 0.16);
    border-color: rgba(233, 69, 96, 0.35);
    color: #ffc1cc;
}

body.bp-page .topbar {
    max-width: none;
    position: relative;
    z-index: 4;
}

body.bp-page .wrap { display: none; }

@media (max-width: 640px) {
    .bp-stage {
        height: calc(100dvh - 54px);
        height: calc(100svh - 54px);
    }
    body.bp-page.has-os-nav .bp-stage {
        height: calc(100dvh - 54px - 56px);
        height: calc(100svh - 54px - 56px);
    }
    body.bp-page.has-os-nav .bp-hud {
        padding-bottom: calc(84px + env(safe-area-inset-bottom));
    }
    body.bp-page.has-os-nav .bp-faq {
        bottom: calc(64px + env(safe-area-inset-bottom));
    }
    .bp-empty-title { font-size: 1.18rem; }
}

@media (prefers-reduced-motion: reduce) {
    .bp-add, .bp-toggle, .bp-dialog {
        transition: none;
    }
}

.bp-faq {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 6;
    max-width: 420px;
    max-height: 42vh;
    overflow: auto;
    pointer-events: auto;
    background: rgba(10, 12, 22, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #e8e8f0;
    font-size: 0.82rem;
    backdrop-filter: blur(8px);
}

.bp-faq summary {
    cursor: pointer;
    padding: 8px 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.bp-faq details,
.bp-faq > summary + details {
    padding: 0 12px 10px;
}

.bp-faq p { margin: 6px 0 0; color: rgba(255, 255, 255, 0.72); }
