:root {
    --startup-progress: 18%;
}

body.startup-active {
    overflow: hidden !important;
}

.startup-splash {
    --startup-accent: var(--brand-primary, #112233);
    --startup-accent-soft: var(--brand-secondary, #334155);
    --startup-glow: rgba(var(--brand-primary-rgb, 17, 34, 51), 0.24);
    --startup-panel: rgba(15, 23, 42, 0.78);
    --startup-panel-strong: rgba(15, 23, 42, 0.92);
    --startup-border: rgba(148, 163, 184, 0.2);
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 18%, var(--startup-glow), transparent 26%),
        radial-gradient(circle at 82% 20%, rgba(var(--brand-secondary-rgb, 56, 189, 248), 0.22), transparent 24%),
        radial-gradient(circle at 50% 85%, rgba(var(--brand-primary-rgb, 17, 34, 51), 0.16), transparent 32%),
        linear-gradient(180deg, rgba(2, 6, 23, 0.98), rgba(7, 12, 24, 0.98));
    overflow: hidden;
    isolation: isolate;
    transition: opacity 0.52s ease, visibility 0.52s ease;
}

.startup-splash[hidden] {
    display: none;
}

.startup-splash::before,
.startup-splash::after {
    content: '';
    position: absolute;
    inset: -20%;
    pointer-events: none;
}

.startup-splash::before {
    background:
        linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 48%, transparent 52%),
        linear-gradient(0deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 180px 180px, 26px 26px, 26px 26px;
    opacity: 0.34;
    transform: perspective(900px) rotateX(76deg) translateY(22%);
    transform-origin: center bottom;
    animation: startup-grid-drift 14s linear infinite;
}

.startup-splash::after {
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.12) 0 2px, transparent 2px 100%),
        radial-gradient(circle, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 100%);
    background-size: 140px 140px, 88px 88px;
    opacity: 0.26;
    animation: startup-stars 10s linear infinite;
}

.startup-splash--scanner {
    --startup-accent: #0ea5e9;
    --startup-accent-soft: #2dd4bf;
    --startup-glow: rgba(14, 165, 233, 0.22);
}

.startup-splash--admin {
    --startup-accent: var(--brand-primary, #112233);
    --startup-accent-soft: var(--brand-secondary, #334155);
    --startup-glow: rgba(var(--brand-primary-rgb, 17, 34, 51), 0.22);
}

.startup-splash--command {
    --startup-accent: #38bdf8;
    --startup-accent-soft: #60a5fa;
    --startup-glow: rgba(56, 189, 248, 0.22);
}

.startup-splash__shell {
    position: relative;
    width: min(100%, 780px);
    max-height: min(calc(100dvh - 48px), 860px);
    padding: 30px;
    border-radius: 32px;
    border: 1px solid var(--startup-border);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 24%),
        linear-gradient(180deg, var(--startup-panel), var(--startup-panel-strong));
    box-shadow:
        0 36px 100px rgba(2, 6, 23, 0.54),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 0 80px var(--startup-glow);
    -webkit-backdrop-filter: blur(26px);
    backdrop-filter: blur(26px);
    overflow: auto;
    overscroll-behavior: contain;
    animation: startup-shell-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.startup-splash__shell::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(circle at top right, rgba(var(--brand-secondary-rgb, 56, 189, 248), 0.22), transparent 28%),
        radial-gradient(circle at bottom left, var(--startup-glow), transparent 24%);
    pointer-events: none;
}

.startup-splash__badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(226, 232, 240, 0.92);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.startup-splash__badge::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--startup-accent-soft), var(--startup-accent));
    box-shadow: 0 0 18px var(--startup-glow);
    animation: startup-pulse 1.8s ease-in-out infinite;
}

.startup-splash__hero {
    position: relative;
    display: grid;
    grid-template-columns: 172px minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    margin-top: 22px;
}

.startup-splash__icon-wrap {
    position: relative;
    width: 172px;
    height: 172px;
    border-radius: 34px;
    display: grid;
    place-items: center;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04)),
        linear-gradient(145deg, var(--startup-glow), rgba(15, 23, 42, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 28px 60px rgba(2, 6, 23, 0.4);
    overflow: hidden;
}

.startup-splash__icon-wrap::before,
.startup-splash__icon-wrap::after {
    content: '';
    position: absolute;
    inset: auto -28% 24%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
    opacity: 0.8;
}

.startup-splash__icon-wrap::before {
    animation: startup-scan 2.6s ease-in-out infinite;
}

.startup-splash__icon-wrap::after {
    inset: 22% -22% auto;
    animation: startup-scan 2.6s ease-in-out infinite reverse;
    opacity: 0.45;
}

.startup-splash__icon-ring {
    position: absolute;
    inset: 18px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.startup-splash__icon {
    width: auto;
    height: auto;
    max-width: 118px;
    max-height: 136px;
    object-fit: contain;
    object-position: center;
    filter: drop-shadow(0 10px 22px rgba(15, 23, 42, 0.38));
    animation: startup-float 4.4s ease-in-out infinite;
}

.startup-splash__copy {
    position: relative;
    z-index: 1;
}

.startup-splash__eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--startup-accent-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.startup-splash__title {
    color: #f8fafc;
    font-size: clamp(34px, 5vw, 56px);
    line-height: 0.95;
    letter-spacing: -0.05em;
    font-weight: 800;
}

.startup-splash__surface {
    margin-top: 10px;
    color: rgba(226, 232, 240, 0.94);
    font-size: clamp(17px, 2.1vw, 22px);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.startup-splash__description {
    margin-top: 14px;
    max-width: 440px;
    color: rgba(203, 213, 225, 0.86);
    font-size: 15px;
    line-height: 1.65;
}

.startup-splash__metrics {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 26px;
}

.startup-splash__metric {
    padding: 14px 15px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    min-height: 74px;
}

.startup-splash__metric-label {
    display: block;
    color: rgba(148, 163, 184, 0.92);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.startup-splash__metric-value {
    display: block;
    margin-top: 8px;
    color: #f8fafc;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.startup-splash__footer {
    position: relative;
    margin-top: 22px;
}

.startup-splash__progress-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.16);
    box-shadow: inset 0 1px 2px rgba(2, 6, 23, 0.36);
}

.startup-splash__progress-fill {
    width: var(--startup-progress);
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--startup-accent), var(--startup-accent-soft), #ffffff);
    box-shadow: 0 0 20px var(--startup-glow);
    transition: width 0.38s ease;
}

.startup-splash__status-row {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: rgba(226, 232, 240, 0.92);
    font-size: 13px;
}

.startup-splash__status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.startup-splash__status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--startup-accent-soft), var(--startup-accent));
    box-shadow: 0 0 18px var(--startup-glow);
    animation: startup-pulse 1.6s ease-in-out infinite;
    flex: 0 0 auto;
}

.startup-splash__status-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.startup-splash__status-meta {
    flex: 0 0 auto;
    color: rgba(148, 163, 184, 0.92);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.startup-splash.is-ready .startup-splash__progress-fill {
    width: 100%;
}

.startup-splash.is-exiting {
    opacity: 0;
    visibility: hidden;
}

.startup-splash.is-exiting .startup-splash__shell {
    animation: startup-shell-out 0.54s ease forwards;
}

@keyframes startup-shell-in {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes startup-shell-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.985);
    }
}

@keyframes startup-grid-drift {
    from {
        transform: perspective(900px) rotateX(76deg) translate3d(0, 22%, 0);
    }
    to {
        transform: perspective(900px) rotateX(76deg) translate3d(-3%, 18%, 0);
    }
}

@keyframes startup-stars {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(-40px, 28px, 0);
    }
}

@keyframes startup-scan {
    0% {
        transform: translateY(-54px);
        opacity: 0;
    }
    18% {
        opacity: 0.95;
    }
    50% {
        transform: translateY(54px);
        opacity: 0.95;
    }
    100% {
        transform: translateY(120px);
        opacity: 0;
    }
}

@keyframes startup-float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

@keyframes startup-pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.78);
        opacity: 0.65;
    }
}

@media (max-width: 720px) {
    .startup-splash {
        padding: 16px;
    }

    .startup-splash__shell {
        padding: 22px 18px;
        border-radius: 26px;
    }

    .startup-splash__hero {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .startup-splash__icon-wrap {
        width: 130px;
        height: 130px;
        border-radius: 26px;
    }

    .startup-splash__icon-ring {
        inset: 14px;
        border-radius: 20px;
    }

    .startup-splash__icon {
        max-width: 96px;
        max-height: 110px;
    }

    .startup-splash__metrics {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .startup-splash__metric {
        min-height: 0;
    }

    .startup-splash__status-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .startup-splash__status-meta {
        letter-spacing: 0.12em;
    }
}

@media (max-width: 520px), (max-height: 760px) {
    .startup-splash {
        padding: 14px;
    }

    .startup-splash__shell {
        max-height: calc(100dvh - 28px);
        padding: 18px 16px;
        border-radius: 22px;
    }

    .startup-splash__badge {
        gap: 8px;
        padding: 8px 12px;
        font-size: 10px;
        letter-spacing: 0.14em;
    }

    .startup-splash__hero {
        margin-top: 16px;
        gap: 14px;
    }

    .startup-splash__icon-wrap {
        width: 116px;
        height: 116px;
        border-radius: 22px;
    }

    .startup-splash__icon-ring {
        inset: 12px;
        border-radius: 18px;
    }

    .startup-splash__icon {
        max-width: 88px;
        max-height: 100px;
    }

    .startup-splash__eyebrow {
        margin-bottom: 8px;
        font-size: 11px;
    }

    .startup-splash__title {
        font-size: clamp(28px, 10vw, 40px);
    }

    .startup-splash__surface {
        margin-top: 8px;
        font-size: clamp(15px, 4.5vw, 18px);
    }

    .startup-splash__description {
        margin-top: 12px;
        font-size: 13px;
        line-height: 1.55;
    }

    .startup-splash__metrics {
        margin-top: 20px;
    }

    .startup-splash__metric {
        padding: 12px 13px;
        border-radius: 16px;
    }

    .startup-splash__metric-value {
        font-size: 15px;
    }

    .startup-splash__footer {
        margin-top: 18px;
    }

    .startup-splash__status-row {
        gap: 10px;
        font-size: 12px;
    }

    .startup-splash__status-text {
        white-space: normal;
    }

    .startup-splash__status-meta {
        font-size: 10px;
        letter-spacing: 0.1em;
    }
}

@media (max-width: 380px), (max-height: 680px) {
    .startup-splash {
        padding: 12px;
    }

    .startup-splash__shell {
        max-height: calc(100dvh - 24px);
        padding: 16px 14px;
        border-radius: 18px;
    }

    .startup-splash__hero {
        gap: 12px;
    }

    .startup-splash__icon-wrap {
        width: 102px;
        height: 102px;
        border-radius: 20px;
    }

    .startup-splash__icon-ring {
        inset: 10px;
        border-radius: 16px;
    }

    .startup-splash__icon {
        max-width: 80px;
        max-height: 92px;
    }

    .startup-splash__title {
        font-size: clamp(24px, 9vw, 34px);
    }

    .startup-splash__surface {
        font-size: 14px;
    }

    .startup-splash__description {
        font-size: 12.5px;
    }

    .startup-splash__metric-label {
        font-size: 10px;
    }

    .startup-splash__metric-value {
        font-size: 14px;
    }

    .startup-splash__progress-track {
        height: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .startup-splash,
    .startup-splash::before,
    .startup-splash::after,
    .startup-splash__shell,
    .startup-splash__icon,
    .startup-splash__icon-wrap::before,
    .startup-splash__icon-wrap::after,
    .startup-splash__badge::before,
    .startup-splash__status-dot {
        animation: none !important;
        transition: none !important;
    }
}