/* Public auth/plan shell styles */
#public-auth-overlay {
    --public-g1: #60a5fa;
    --public-g2: #a78bfa;
    --public-g3: #f472b6;
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--card-bg, rgba(15, 23, 42, 0.6)) 44%, rgba(2, 6, 23, 0.9) 56%);
    backdrop-filter: blur(6px);
}

#public-auth-overlay.active {
    display: flex;
    animation: public-auth-fade-in 0.22s ease-out;
}

@keyframes public-auth-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.public-auth-card {
    position: relative;
    overflow: hidden;
    text-align: center;
    width: min(560px, calc(100vw - 28px));
    border-radius: 24px;
    border: 1px solid color-mix(in srgb, var(--bd, #334155) 62%, var(--public-g1) 38%);
    background: color-mix(in srgb, var(--card-bg, rgba(15, 23, 42, 0.72)) 90%, rgba(3, 7, 16, 0.97) 10%);
    backdrop-filter: blur(18px) saturate(115%);
    -webkit-backdrop-filter: blur(18px) saturate(115%);
    box-shadow:
        0 24px 66px rgba(2, 6, 23, 0.64),
        inset 0 1px 0 color-mix(in srgb, white 10%, transparent);
    padding: 22px 22px 18px;
    animation: public-auth-card-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.public-auth-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(120deg,
            color-mix(in srgb, var(--public-g1) 16%, transparent) 0%,
            transparent 36%,
            color-mix(in srgb, var(--public-g3) 14%, transparent) 100%);
    opacity: 0.9;
}

.public-auth-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 84% 18%, color-mix(in srgb, var(--public-g3) 22%, transparent) 0%, transparent 42%);
    opacity: 0.5;
}

@keyframes public-auth-card-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.public-auth-orb {
    position: absolute;
    pointer-events: none;
    border-radius: 999px;
    filter: blur(1px);
    opacity: 0.34;
    z-index: 0;
}

.public-auth-orb.orb-a {
    width: 200px;
    height: 200px;
    right: -46px;
    top: -70px;
    background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--public-g1) 60%, white 40%) 0%, transparent 70%);
    animation: public-auth-float-a 8s ease-in-out infinite;
}

.public-auth-orb.orb-b {
    width: 180px;
    height: 180px;
    left: -54px;
    bottom: -82px;
    background: radial-gradient(circle at 62% 40%, color-mix(in srgb, var(--public-g2) 54%, white 46%) 0%, transparent 72%);
    animation: public-auth-float-b 9s ease-in-out infinite;
}

@keyframes public-auth-float-a {
    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(10px) scale(1.06);
    }
}

@keyframes public-auth-float-b {
    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-8px) scale(1.05);
    }
}

.public-auth-scanline {
    position: absolute;
    inset: 0 auto 0 -46%;
    width: 46%;
    pointer-events: none;
    background: linear-gradient(104deg, transparent 0%, color-mix(in srgb, var(--public-g1) 28%, transparent) 44%, transparent 100%);
    mix-blend-mode: screen;
    opacity: 0.25;
    animation: public-auth-scan 4.8s linear infinite;
    z-index: 0;
}

@keyframes public-auth-scan {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(340%);
    }
}

.public-auth-brand-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    margin-bottom: 0.45rem;
}

.public-auth-brand-main {
    font-size: clamp(1.9rem, 4vw, 2.45rem);
    font-weight: 900;
    letter-spacing: 0.015em;
    line-height: 1;
    background-image: linear-gradient(94deg, var(--public-g1), color-mix(in srgb, var(--public-g2) 72%, white 28%), var(--public-g1));
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: public-auth-brand-shift 6.2s linear infinite;
}

@keyframes public-auth-brand-shift {
    from {
        background-position: 0% 50%;
    }

    to {
        background-position: 220% 50%;
    }
}

.public-auth-copy {
    position: relative;
    z-index: 1;
    margin: 0 0 12px;
    color: var(--text-sub, #94a3b8);
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.55;
}

#public-google-login-btn {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    min-height: 42px;
    margin: 6px 0 8px;
}

.public-auth-status {
    position: relative;
    z-index: 1;
    display: none;
    margin: 4px 0 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: color-mix(in srgb, var(--card-bg, rgba(15, 23, 42, 0.7)) 86%, rgba(255, 255, 255, 0.04) 14%);
    color: var(--text-sub, #94a3b8);
    font-size: 0.84rem;
    line-height: 1.45;
    text-align: left;
}

.public-auth-status.active {
    display: block;
    animation: public-auth-status-in 0.2s ease-out;
}

.public-auth-status.is-info {
    border-color: color-mix(in srgb, var(--public-g1) 54%, rgba(255, 255, 255, 0.24));
    color: color-mix(in srgb, var(--text-main, #e2e8f0) 68%, var(--public-g1) 32%);
}

.public-auth-status.is-warning {
    border-color: color-mix(in srgb, #f59e0b 62%, rgba(255, 255, 255, 0.2) 38%);
    color: color-mix(in srgb, #facc15 70%, var(--text-main, #e2e8f0) 30%);
    background: color-mix(in srgb, #f59e0b 12%, var(--card-bg, rgba(15, 23, 42, 0.72)) 88%);
}

.public-auth-status.is-error {
    border-color: color-mix(in srgb, #ef4444 62%, rgba(255, 255, 255, 0.2) 38%);
    color: color-mix(in srgb, #fca5a5 74%, var(--text-main, #e2e8f0) 26%);
    background: color-mix(in srgb, #ef4444 10%, var(--card-bg, rgba(15, 23, 42, 0.72)) 90%);
}

@keyframes public-auth-status-in {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.public-auth-actions {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 2px;
}

.public-auth-actions > button {
    min-width: 120px;
}

#public-account-pill {
    position: fixed;
    right: 14px;
    top: 12px;
    z-index: 11000;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--bd, #334155) 75%, white 25%);
    background: color-mix(in srgb, var(--card-bg, rgba(15, 23, 42, 0.68)) 88%, rgba(2, 6, 23, 0.95) 12%);
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.35);
    font-size: 0.78rem;
}

#public-account-pill.active {
    display: inline-flex;
}

#public-account-pill .plan {
    font-weight: 700;
    letter-spacing: 0.02em;
}

#public-account-pill .credits {
    color: var(--text-sub, #94a3b8);
}

#public-account-pill button {
    border: none;
    background: transparent;
    color: var(--text-sub, #94a3b8);
    cursor: pointer;
    padding: 0;
    font-size: 0.78rem;
}

#public-account-pill button:hover {
    color: var(--text-main, #e2e8f0);
}

.public-plan-disabled {
    opacity: 0.55 !important;
    filter: saturate(0.75);
    cursor: not-allowed !important;
}

body.public-locked #work-area {
    pointer-events: none;
    user-select: none;
}

#public-tour-widget {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 16040;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}

#public-tour-widget>* {
    pointer-events: auto;
}

#public-tour-launcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 0 16px 0 14px;
    border: 1px solid color-mix(in srgb, var(--bd, #334155) 52%, #60a5fa 48%);
    border-radius: 999px;
    background:
        radial-gradient(circle at 25% 30%, color-mix(in srgb, #60a5fa 28%, transparent) 0%, transparent 54%),
        linear-gradient(145deg, color-mix(in srgb, var(--card-bg, rgba(15, 23, 42, 0.9)) 76%, #08111f 24%) 0%, rgba(6, 11, 22, 0.96) 100%);
    color: var(--text-main, #e2e8f0);
    box-shadow:
        0 18px 44px rgba(2, 6, 23, 0.48),
        inset 0 1px 0 color-mix(in srgb, white 12%, transparent);
    cursor: pointer;
    font-weight: 800;
    letter-spacing: 0.01em;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    animation: public-tour-launcher-pulse 3.4s ease-in-out infinite;
}

#public-tour-launcher:hover,
#public-tour-launcher:focus-visible {
    transform: translateY(-2px) scale(1.01);
    border-color: color-mix(in srgb, #60a5fa 60%, #f472b6 40%);
    box-shadow:
        0 20px 50px rgba(2, 6, 23, 0.54),
        0 0 24px color-mix(in srgb, #60a5fa 20%, transparent),
        inset 0 1px 0 color-mix(in srgb, white 16%, transparent);
}

#public-tour-launcher .public-tour-launcher-mark {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #60a5fa, #34d399);
    color: #04111f;
    font-size: 1rem;
    line-height: 1;
    box-shadow: 0 0 18px color-mix(in srgb, #60a5fa 34%, transparent);
}

#public-tour-launcher .public-tour-launcher-label {
    font-size: 0.92rem;
}

#public-tour-widget.tour-running #public-tour-launcher {
    animation: none;
}

@keyframes public-tour-launcher-pulse {
    0%,
    100% {
        transform: translateY(0);
        box-shadow:
            0 18px 44px rgba(2, 6, 23, 0.48),
            inset 0 1px 0 color-mix(in srgb, white 12%, transparent);
    }

    50% {
        transform: translateY(-1px);
        box-shadow:
            0 22px 52px rgba(2, 6, 23, 0.56),
            0 0 24px color-mix(in srgb, #60a5fa 18%, transparent),
            inset 0 1px 0 color-mix(in srgb, white 14%, transparent);
    }
}

#public-tour-card {
    width: min(390px, calc(100vw - 24px));
    border-radius: 24px;
    border: 1px solid color-mix(in srgb, var(--bd, #334155) 54%, #60a5fa 46%);
    background:
        linear-gradient(165deg, color-mix(in srgb, var(--card-bg, rgba(15, 23, 42, 0.96)) 86%, #091120 14%) 0%, rgba(5, 10, 20, 0.97) 100%);
    box-shadow:
        0 26px 70px rgba(2, 6, 23, 0.62),
        inset 0 1px 0 color-mix(in srgb, white 10%, transparent);
    padding: 18px 18px 16px;
    backdrop-filter: blur(18px) saturate(118%);
    -webkit-backdrop-filter: blur(18px) saturate(118%);
}

#public-tour-card[hidden],
#public-tour-overlay[hidden] {
    display: none !important;
}

.public-tour-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, #60a5fa 14%, rgba(255, 255, 255, 0.02));
    color: color-mix(in srgb, #bfdbfe 72%, white 28%);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.public-tour-progress-meta {
    margin-top: 12px;
    color: var(--text-sub, #94a3b8);
    font-size: 0.8rem;
    font-weight: 700;
}

.public-tour-progress-track {
    width: 100%;
    height: 8px;
    margin-top: 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    overflow: hidden;
}

.public-tour-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #60a5fa 0%, #34d399 52%, #facc15 100%);
    box-shadow: 0 0 18px color-mix(in srgb, #60a5fa 22%, transparent);
}

.public-tour-title {
    margin: 14px 0 8px;
    color: var(--text-main, #f8fafc);
    font-size: 1.2rem;
    line-height: 1.2;
}

.public-tour-body {
    margin: 0;
    color: var(--text-sub, #cbd5e1);
    font-size: 0.94rem;
    line-height: 1.65;
}

.public-tour-note {
    margin-top: 12px;
    padding: 11px 12px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, #34d399 24%, rgba(255, 255, 255, 0.08));
    background: color-mix(in srgb, #34d399 9%, rgba(255, 255, 255, 0.02));
    color: color-mix(in srgb, #d1fae5 74%, white 26%);
    font-size: 0.84rem;
    line-height: 1.55;
}

.public-tour-home-actions,
.public-tour-step-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.public-tour-home-actions>*,
.public-tour-step-actions>* {
    flex: 1 1 150px;
}

.public-tour-close-link {
    margin-top: 12px;
    border: none;
    background: transparent;
    padding: 0;
    color: var(--text-sub, #94a3b8);
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
}

.public-tour-close-link:hover,
.public-tour-close-link:focus-visible {
    color: var(--text-main, #e2e8f0);
}

#public-tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 16000;
    background: rgba(2, 6, 23, 0.76);
    backdrop-filter: blur(4px) saturate(92%);
    -webkit-backdrop-filter: blur(4px) saturate(92%);
}

.public-tour-layer-active {
    position: relative;
    z-index: 16018 !important;
}

.public-tour-target-active {
    position: relative;
    z-index: 16020 !important;
    isolation: isolate;
    box-shadow:
        0 0 0 2px color-mix(in srgb, #f8fafc 36%, transparent),
        0 0 0 8px color-mix(in srgb, #60a5fa 16%, transparent),
        0 0 28px color-mix(in srgb, #60a5fa 26%, transparent),
        0 20px 60px rgba(2, 6, 23, 0.42) !important;
    animation: public-tour-target-pulse 1.5s ease-in-out infinite;
}

@keyframes public-tour-target-pulse {
    0%,
    100% {
        box-shadow:
            0 0 0 2px color-mix(in srgb, #f8fafc 34%, transparent),
            0 0 0 8px color-mix(in srgb, #60a5fa 14%, transparent),
            0 0 24px color-mix(in srgb, #60a5fa 20%, transparent),
            0 20px 50px rgba(2, 6, 23, 0.38);
    }

    50% {
        box-shadow:
            0 0 0 2px color-mix(in srgb, #f8fafc 44%, transparent),
            0 0 0 10px color-mix(in srgb, #34d399 18%, transparent),
            0 0 36px color-mix(in srgb, #60a5fa 32%, transparent),
            0 24px 64px rgba(2, 6, 23, 0.48);
    }
}

@media (max-width: 640px) {
    .public-auth-card {
        width: min(560px, calc(100vw - 20px));
        border-radius: 18px;
        padding: 18px 16px 14px;
    }

    .public-auth-brand-wrap {
        align-items: flex-start;
        gap: 0.46rem;
        flex-direction: column;
        margin-bottom: 0.45rem;
    }

    .public-auth-copy {
        font-size: 0.9rem;
    }

    .public-auth-actions {
        justify-content: stretch;
    }

    #public-retry-auth {
        width: 100%;
    }

    #public-tour-widget {
        right: 12px;
        bottom: 12px;
        left: 12px;
        align-items: stretch;
    }

    #public-tour-launcher {
        justify-content: center;
    }

    #public-tour-card {
        width: 100%;
        border-radius: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #public-auth-overlay.active,
    .public-auth-card,
    .public-auth-orb,
    .public-auth-scanline,
    .public-auth-brand-main,
    .public-auth-status.active,
    #public-tour-launcher,
    .public-tour-target-active {
        animation: none !important;
    }
}
