/* Mobile navigation: unified drawer + compact topbar */

.mobile-balance-pill {
    display: none;
    font-size: 0.72rem;
    color: #a3ff12;
    border: 1px solid rgba(163, 255, 18, 0.35);
    border-radius: 999px;
    padding: 6px 10px;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(163, 255, 18, 0.06);
    margin-left: auto;
    margin-right: 8px;
}

.app-drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99970;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.app-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 99975;
    width: min(300px, 88vw);
    max-width: 100%;
    background: #0a0a0a;
    border-right: 2px solid rgba(163, 255, 18, 0.35);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.55);
    transform: translateX(-105%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    overflow: hidden;
}

body.app-drawer-open .app-drawer-backdrop {
    display: block;
    opacity: 1;
}

body.app-drawer-open .app-drawer {
    transform: translateX(0);
}

body.app-drawer-open {
    overflow: hidden;
}

.app-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.app-drawer-brand {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #a3ff12;
}

.app-drawer-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    min-width: 44px;
    min-height: 44px;
}

.app-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    -webkit-overflow-scrolling: touch;
}

.app-drawer-section {
    margin-bottom: 18px;
}

.app-drawer-section-title {
    margin: 0 0 8px;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #666;
    font-weight: 600;
}

.app-drawer-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-drawer-links a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #ccc;
    text-decoration: none;
    font-size: 0.88rem;
    border: 1px solid transparent;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.app-drawer-links a:hover,
.app-drawer-links a:focus-visible {
    border-color: rgba(163, 255, 18, 0.35);
    color: #f5f5f5;
    background: rgba(163, 255, 18, 0.04);
}

.app-drawer-studio-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-drawer-studio-nav .studio-nav-item {
    min-height: 0;
    padding: 7px 11px;
    font-size: 0.94rem;
    line-height: 1.25;
    border-radius: 8px;
}

.app-drawer-studio-nav .studio-nav-item > span:first-child {
    font-size: 0.96rem;
    font-weight: 600;
    color: inherit;
}

.app-drawer-studio-nav .studio-nav-item small {
    margin-top: 1px;
    font-size: 0.72rem;
    line-height: 1.2;
    opacity: 0.85;
}

.app-drawer-section--studio .app-drawer-section-title {
    font-size: 0.78rem;
    margin-bottom: 6px;
    color: #888;
}

.app-drawer-tips {
    margin-top: 8px;
    font-size: 0.82rem;
    line-height: 1.45;
}

.app-drawer-tips strong {
    font-size: 0.76rem;
}

.app-drawer-account {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.app-drawer-account-balance {
    font-size: 0.82rem;
    color: #aaa;
    padding: 8px 12px;
    border: 1px dashed rgba(163, 255, 18, 0.25);
    border-radius: 8px;
    margin-bottom: 4px;
}

.app-drawer-account .studio-side-btn,
.app-drawer-account .act {
    min-height: 44px;
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
}

.app-drawer-foot {
    flex-shrink: 0;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0));
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-drawer-foot .act {
    min-height: 44px;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

.studio-mobile-mode-hint {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin: 0 0 8px;
    text-align: center;
}

.studio-mobile-mode-hint.is-hidden {
    display: none !important;
}

.studio-mobile-mode-hint__text {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #a3ff12;
}

.studio-mobile-mode-hint__arrow {
    display: block;
    font-size: 1.15rem;
    line-height: 1;
    color: #a3ff12;
    animation: studio-mode-hint-bounce 1.35s ease-in-out infinite;
}

@keyframes studio-mode-hint-bounce {
    0%,
    100% {
        transform: translateY(0);
        opacity: 0.55;
    }
    50% {
        transform: translateY(5px);
        opacity: 1;
    }
}

.studio-mobile-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 0 0 10px;
    border: 1px solid rgba(163, 255, 18, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
}

.studio-mobile-bar__menu {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #111;
    color: #ccc;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.studio-mobile-bar__mode {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 600;
    color: #f5f5f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-index .app-drawer-section--studio {
    display: none;
}

.hot-scene-pick-btn {
    display: none;
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    min-height: 48px;
    margin: 4px 0 10px;
}

@media (max-width: 768px) {
    .hot-scene-pick-btn.is-visible {
        display: flex;
    }
}

@media (max-width: 768px) {
    .mobile-balance-pill {
        display: inline-block;
    }

    .topbar .menu {
        display: none !important;
    }

    .topbar-actions {
        display: none !important;
    }

    .topbar-row {
        position: relative;
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
    }

    .topbar .logo {
        flex: 0 1 auto;
        min-width: 0;
    }

    .topbar .logo span:not(.logo-mark) {
        font-size: 0.9rem;
    }

    .tag-toggle {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        background: transparent;
        border: 1px solid var(--line-2, #333);
        border-radius: 8px;
        padding: 10px;
        cursor: pointer;
        flex-shrink: 0;
        margin-left: 0;
    }

    .tag-toggle span {
        width: 18px;
        height: 1.5px;
        background: var(--txt, #f5f5f5);
    }

    .studio-mobile-bar {
        display: flex;
    }

    .page-studio .studio-mobile-mode-hint:not(.is-hidden) {
        display: flex;
    }

    .studio-page {
        padding-top: 12px;
    }

    .studio-page .shell {
        padding-left: max(12px, env(safe-area-inset-left, 0));
        padding-right: max(12px, env(safe-area-inset-right, 0));
    }

    .studio-history-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding-bottom: 12px;
    }

    .studio-history-filter {
        flex: 0 0 auto;
        scroll-snap-align: start;
        min-height: 32px;
    }

    .hot-scene-grid {
        grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)) !important;
    }

    .result-viewer-nav {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
        font-size: 24px;
    }

    .result-viewer-toolbar .act,
    .result-viewer-actions .act {
        min-height: 44px;
    }

    .drop-zone {
        padding: 28px 16px;
    }

    .studio-run-block .act {
        min-height: 48px;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding-top: env(safe-area-inset-top, 0);
    }

    .app-drawer {
        width: min(100vw, 320px);
    }

    .hero-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-cta .act {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }

    .gen-result-card__thumb {
        max-height: 160px;
    }
}
