#onboarding {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 35%, rgba(40, 36, 70, 0.45) 0%, rgba(5, 6, 13, 0.92) 60%, rgba(5, 6, 13, 0.98) 100%);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s var(--ease);
}

#onboarding.visible {
    opacity: 1;
    pointer-events: auto;
}

#onboarding.leaving {
    opacity: 0;
    pointer-events: none;
}

#onboarding .ob-card {
    width: min(560px, calc(100vw - 32px));
    background: linear-gradient(180deg, rgba(20, 22, 38, 0.78) 0%, rgba(14, 15, 28, 0.82) 100%);
    border: 1px solid var(--line-2);
    border-radius: 22px;
    padding: 32px 32px 24px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    transform: translateY(14px) scale(0.985);
    opacity: 0;
    transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}

#onboarding.visible .ob-card {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#onboarding.leaving .ob-card {
    opacity: 0;
    transform: translateY(-10px) scale(0.99);
}

.ob-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.ob-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--fg);
    letter-spacing: 0.04em;
}

.ob-brand-mark {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 70% 35%, var(--bg) 38%, transparent 39%),
        radial-gradient(circle at 50% 50%, var(--accent) 0%, var(--accent-2) 100%);
    box-shadow: 0 0 24px rgba(184, 176, 218, 0.28);
}

.ob-skip {
    font-size: 12px;
    color: var(--fg-3);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.ob-skip:hover {
    color: var(--fg-2);
    background: var(--line);
}

.ob-steps {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 18px;
}

.ob-step-dot {
    flex: 1;
    height: 3px;
    border-radius: 999px;
    background: var(--line-2);
    overflow: hidden;
    position: relative;
}

.ob-step-dot::after {
    content: "";
    position: absolute;
    inset: 0;
    transform-origin: left center;
    transform: scaleX(0);
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
    transition: transform 0.55s var(--ease);
}

.ob-step-dot.done::after { transform: scaleX(1); }
.ob-step-dot.active::after { transform: scaleX(1); }

.ob-stage {
    position: relative;
    min-height: 320px;
}

.ob-step {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: translate3d(var(--enter-x, 18px), 4px, 0) scale(0.99);
    pointer-events: none;
    filter: blur(1px);
    transition:
        opacity 0.34s var(--ease),
        transform 0.34s var(--ease),
        filter 0.24s var(--ease);
    will-change: transform, opacity, filter;
    backface-visibility: hidden;
}

.ob-step.active {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    pointer-events: auto;
    filter: blur(0);
    z-index: 2;
}

.ob-step.exit-left {
    opacity: 0;
    transform: translate3d(-18px, -3px, 0) scale(0.99);
    filter: blur(1px);
    z-index: 1;
}

.ob-step.exit-right {
    opacity: 0;
    transform: translate3d(18px, -3px, 0) scale(0.99);
    filter: blur(1px);
    z-index: 1;
}

.ob-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--fg);
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}

.ob-sub {
    font-size: 13px;
    color: var(--fg-2);
    line-height: 1.55;
    margin-bottom: 22px;
}

.ob-welcome-body {
    padding-top: 8px;
}

.ob-welcome-orb {
    width: 84px;
    height: 84px;
    margin: 12px auto 24px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 70% 35%, var(--bg) 38%, transparent 39%),
        radial-gradient(circle at 50% 50%, var(--accent) 0%, var(--accent-2) 100%);
    box-shadow: 0 0 60px rgba(184, 176, 218, 0.35), 0 0 0 1px rgba(184, 176, 218, 0.1) inset;
    animation: obOrbPulse 4.5s var(--ease) infinite;
}

@keyframes obOrbPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 60px rgba(184, 176, 218, 0.35), 0 0 0 1px rgba(184, 176, 218, 0.1) inset; }
    50%      { transform: scale(1.04); box-shadow: 0 0 80px rgba(184, 176, 218, 0.5), 0 0 0 1px rgba(184, 176, 218, 0.18) inset; }
}

.ob-welcome-headline {
    text-align: center;
    font-size: 26px;
    font-weight: 600;
    color: var(--fg);
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.ob-welcome-tag {
    text-align: center;
    font-size: 13px;
    color: var(--fg-2);
    line-height: 1.6;
    max-width: 340px;
    margin: 0 auto 26px;
}

.ob-grid {
    display: grid;
    gap: 10px;
}

.ob-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
.ob-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.ob-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.ob-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.ob-swatch {
    aspect-ratio: 1;
    border-radius: 14px;
    border: 1.5px solid var(--line-2);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), box-shadow 0.22s var(--ease);
}

.ob-swatch::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--swatch-color, var(--accent));
    opacity: 0.95;
    transition: opacity 0.22s var(--ease);
}

.ob-swatch::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.16), transparent 60%);
    pointer-events: none;
}

.ob-swatch:hover {
    transform: translateY(-2px);
    border-color: var(--line-3);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.ob-swatch.selected {
    border-color: var(--fg);
    box-shadow: 0 0 0 1px var(--fg) inset, 0 0 30px var(--swatch-glow, rgba(184, 176, 218, 0.5));
}

.ob-swatch .ob-swatch-check {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.2s var(--ease), transform 0.25s var(--ease);
}

.ob-swatch.selected .ob-swatch-check {
    opacity: 1;
    transform: scale(1);
}

.ob-swatch .ob-swatch-check svg {
    color: #fff;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.ob-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 12px;
    border-radius: 14px;
    border: 1.5px solid var(--line-2);
    background: rgba(20, 22, 38, 0.45);
    cursor: pointer;
    transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), background 0.22s var(--ease);
    text-align: center;
}

.ob-tile-preview {
    width: 100%;
    aspect-ratio: 1.55;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background: var(--bg-2);
}

.ob-tile-preview.stars {
    background:
        radial-gradient(1.5px 1.5px at 18% 22%, rgba(255, 255, 255, 0.9), transparent 60%),
        radial-gradient(1px 1px at 62% 36%, rgba(255, 255, 255, 0.7), transparent 60%),
        radial-gradient(1.4px 1.4px at 78% 70%, rgba(255, 255, 255, 0.85), transparent 60%),
        radial-gradient(1px 1px at 36% 78%, rgba(201, 193, 255, 0.7), transparent 60%),
        radial-gradient(2px 2px at 88% 18%, rgba(255, 255, 255, 0.9), transparent 60%),
        radial-gradient(circle at 30% 60%, rgba(138, 128, 182, 0.18), transparent 60%),
        var(--bg);
}

.ob-tile-preview.aurora {
    background:
        radial-gradient(80% 60% at 20% 20%, rgba(155, 218, 176, 0.25), transparent 60%),
        radial-gradient(70% 60% at 80% 80%, rgba(149, 200, 224, 0.3), transparent 60%),
        radial-gradient(60% 50% at 60% 30%, rgba(184, 176, 218, 0.28), transparent 60%),
        var(--bg);
    animation: obAuroraDrift 6s var(--ease) infinite alternate;
}

@keyframes obAuroraDrift {
    from { filter: hue-rotate(0deg); }
    to   { filter: hue-rotate(20deg); }
}

.ob-tile-preview.nebula {
    background:
        radial-gradient(75% 60% at 25% 30%, rgba(190, 110, 210, 0.35), transparent 60%),
        radial-gradient(65% 55% at 78% 72%, rgba(110, 110, 230, 0.32), transparent 60%),
        radial-gradient(55% 50% at 50% 50%, rgba(220, 140, 200, 0.18), transparent 60%),
        var(--bg);
    animation: obNebulaShift 5s var(--ease) infinite alternate;
}
@keyframes obNebulaShift {
    from { filter: hue-rotate(0deg) saturate(1);    transform: scale(1); }
    to   { filter: hue-rotate(-12deg) saturate(1.1); transform: scale(1.03); }
}

.ob-tile-preview.ocean {
    background:
        radial-gradient(80% 60% at 20% 25%, rgba(80, 150, 200, 0.32), transparent 60%),
        radial-gradient(65% 55% at 80% 75%, rgba(60, 200, 180, 0.28), transparent 60%),
        radial-gradient(50% 45% at 50% 55%, rgba(100, 180, 220, 0.22), transparent 60%),
        linear-gradient(180deg, #03060d 0%, #060d18 100%);
}

.ob-tile-preview.sunset {
    background:
        radial-gradient(80% 60% at 22% 78%, rgba(232, 130, 102, 0.30), transparent 60%),
        radial-gradient(70% 60% at 78% 28%, rgba(186, 96, 138, 0.34), transparent 60%),
        radial-gradient(60% 50% at 50% 50%, rgba(220, 150, 132, 0.22), transparent 60%),
        linear-gradient(180deg, #0d0612 0%, #1c0a1a 100%);
}

.ob-tile-preview.mono {
    background:
        radial-gradient(70% 55% at 30% 30%, rgba(200, 200, 222, 0.10), transparent 60%),
        radial-gradient(60% 50% at 70% 70%, rgba(180, 180, 210, 0.08), transparent 60%),
        linear-gradient(180deg, #0a0a10 0%, #050508 100%);
}

.ob-tile-preview.embers {
    background:
        radial-gradient(55% 45% at 24% 72%, rgba(224, 112, 60, 0.28), transparent 60%),
        radial-gradient(45% 38% at 76% 28%, rgba(204, 80, 52, 0.22), transparent 60%),
        radial-gradient(40% 32% at 60% 60%, rgba(232, 142, 80, 0.18), transparent 60%),
        linear-gradient(180deg, #0a0508 0%, #08060d 100%);
    animation: obEmbersFlick 4s var(--ease) infinite alternate;
}
@keyframes obEmbersFlick {
    from { opacity: 0.96; }
    to   { opacity: 1; }
}

.ob-tile-preview.off {
    background: var(--bg);
}

.ob-tile-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--fg);
    letter-spacing: 0.01em;
}

.ob-tile:hover {
    transform: translateY(-2px);
    border-color: var(--line-3);
    background: rgba(28, 30, 50, 0.55);
}

.ob-tile.selected {
    border-color: var(--accent);
    background: rgba(40, 36, 70, 0.45);
    box-shadow: 0 0 0 1px var(--accent) inset, 0 0 24px rgba(184, 176, 218, 0.22);
}

.ob-engines, .ob-cloaks {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.ob-engine, .ob-cloak {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--line-2);
    background: rgba(20, 22, 38, 0.45);
    cursor: pointer;
    transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
    text-align: left;
}

.ob-engine:hover, .ob-cloak:hover {
    transform: translateY(-1px);
    border-color: var(--line-3);
    background: rgba(28, 30, 50, 0.55);
}

.ob-engine.selected, .ob-cloak.selected {
    border-color: var(--accent);
    background: rgba(40, 36, 70, 0.5);
    box-shadow: 0 0 0 1px var(--accent) inset;
}

.ob-engine-icon, .ob-cloak-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
    font-size: 14px;
    font-weight: 600;
    color: var(--fg);
}

.ob-engine-icon img, .ob-cloak-icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.ob-engine-meta, .ob-cloak-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}

.ob-engine-name, .ob-cloak-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ob-engine-sub, .ob-cloak-sub {
    font-size: 11px;
    color: var(--fg-3);
}

.ob-done {
    text-align: center;
    padding-top: 12px;
}

.ob-done-tick {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 8px auto 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px rgba(184, 176, 218, 0.45);
    animation: obTickPop 0.6s var(--ease);
}

@keyframes obTickPop {
    0%   { transform: scale(0.4); opacity: 0; }
    60%  { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.ob-done-tick svg {
    color: var(--bg);
    width: 26px;
    height: 26px;
    stroke-width: 3;
    animation: obTickDraw 0.4s var(--ease) 0.2s both;
}

@keyframes obTickDraw {
    from { stroke-dashoffset: 30; }
    to   { stroke-dashoffset: 0; }
}

.ob-done-tick svg path {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    animation: obTickDraw 0.4s var(--ease) 0.2s forwards;
}

.ob-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 20px 0 6px;
    text-align: left;
}

.ob-summary-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    background: rgba(20, 22, 38, 0.4);
    border-radius: 10px;
}

.ob-summary-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-3);
}

.ob-summary-value {
    font-size: 13px;
    color: var(--fg);
    font-weight: 500;
}

.ob-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.ob-foot-left {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--fg-3);
    font-size: 11px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.ob-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--line-2);
    background: rgba(28, 30, 50, 0.55);
    color: var(--fg);
    cursor: pointer;
    transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.ob-btn:hover {
    transform: translateY(-1px);
    border-color: var(--line-3);
    background: rgba(38, 40, 64, 0.65);
}

.ob-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.ob-btn.primary {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
    color: var(--bg);
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(184, 176, 218, 0.25);
}

.ob-btn.primary:hover {
    box-shadow: 0 10px 28px rgba(184, 176, 218, 0.35);
}

.ob-foot-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 520px) {
    #onboarding .ob-card {
        padding: 24px 20px 18px;
        border-radius: 18px;
    }
    .ob-grid.cols-6 { grid-template-columns: repeat(3, 1fr); }
    .ob-engines, .ob-cloaks { grid-template-columns: 1fr; }
    .ob-summary { grid-template-columns: 1fr; }
    .ob-stage { min-height: 380px; }
}
