/* ============================================================================
   STATAU 注册后新手引导样式 (static/css/onboarding.css)
   ============================================================================
   说明：
   - 聚光灯挖空目标区域、其余轻轻压暗，浅色主题使用更淡的遮罩
   - 卡片只保留步骤、标题和示例数据入口，尽量小
   - 四步必须走完，因此没有跳过入口，也不响应 Esc 关闭
   ============================================================================ */

.so-root {
    /* 深浅主题共用的可调变量 */
    --so-dim: rgba(5, 10, 22, 0.72);
    --so-ring: rgba(0, 212, 255, 0.9);
    position: fixed;
    inset: 0;
    z-index: 1200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* 浅色主题：压暗明显减弱，避免黑白对比过强 */
[data-theme="light"] .so-root {
    --so-dim: rgba(15, 23, 42, 0.26);
    --so-ring: rgba(8, 145, 178, 0.85);
}

.so-root.is-visible {
    opacity: 1;
}

.so-root[hidden] {
    display: none !important;
}

/* 透明点击拦截层：引导期间不响应页面操作 */
.so-blocker {
    position: fixed;
    inset: 0;
    pointer-events: auto;
    cursor: default;
}

/* 目标找不到时使用整屏压暗 */
.so-dim {
    position: fixed;
    inset: 0;
    background: var(--so-dim);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.so-root.is-centered .so-dim {
    opacity: 1;
}

.so-spotlight {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 12px;
    pointer-events: none;
    opacity: 0;
    box-shadow:
        0 0 0 9999px var(--so-dim),
        0 0 0 2px var(--so-ring);
    transition:
        top 0.28s cubic-bezier(0.22, 0.8, 0.22, 1),
        left 0.28s cubic-bezier(0.22, 0.8, 0.22, 1),
        width 0.28s cubic-bezier(0.22, 0.8, 0.22, 1),
        height 0.28s cubic-bezier(0.22, 0.8, 0.22, 1),
        border-radius 0.28s ease,
        opacity 0.2s ease;
    will-change: top, left, width, height;
}

.so-root.is-focused .so-spotlight {
    opacity: 1;
}

/* 聚光灯外圈呼吸动画，把视线引到目标控件 */
.so-spotlight::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    border: 1px solid var(--so-ring);
    animation: so-ring-pulse 2.2s ease-out infinite;
}

@keyframes so-ring-pulse {
    0% {
        opacity: 0.6;
        transform: scale(0.99);
    }
    70% {
        opacity: 0;
        transform: scale(1.03);
    }
    100% {
        opacity: 0;
        transform: scale(1.03);
    }
}

/* 打开引导的瞬间先关闭过渡 */
.so-root.is-no-transition .so-card,
.so-root.is-no-transition .so-spotlight,
.so-root.is-no-transition .so-dim {
    transition: none !important;
}

/* ----------------------------------------------------------------------------
   讲解卡片：只保留步骤、标题和示例入口
   ---------------------------------------------------------------------------- */
.so-card {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1;
    width: min(300px, calc(100vw - 24px));
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color, #2d3748);
    background: var(--bg-elevated, #252d44);
    color: var(--text-primary, #e2e8f0);
    box-shadow: 0 16px 38px rgba(2, 8, 20, 0.34);
    pointer-events: auto;
    transition:
        top 0.24s cubic-bezier(0.22, 0.8, 0.22, 1),
        left 0.24s cubic-bezier(0.22, 0.8, 0.22, 1);
}

[data-theme="light"] .so-card {
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
}

.so-card.is-animating {
    animation: so-card-in 0.24s ease-out;
}

@keyframes so-card-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.so-card:focus {
    outline: none;
}

.so-step {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #a7b5c6);
    font-variant-numeric: tabular-nums;
}

[data-theme="light"] .so-step {
    color: #64748b;
}

.so-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.4;
    color: var(--text-primary, #e2e8f0);
}

.so-extra-slot:empty {
    display: none;
}

.so-extra {
    margin-top: 8px;
    font-size: 0.78rem;
}

.so-sample-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent-primary, #00d4ff);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.so-sample-link:hover {
    opacity: 0.82;
    color: var(--accent-primary, #00d4ff);
}

[data-theme="light"] .so-sample-link {
    color: #0e7490;
}

.so-sample-link .bi {
    font-size: 11px;
}

.so-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.so-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
}

.so-btn:focus-visible {
    outline: 2px solid var(--accent-primary, #00d4ff);
    outline-offset: 2px;
}

.so-btn-ghost {
    border-color: var(--border-color, #2d3748);
    background: transparent;
    color: var(--text-secondary, #94a3b8);
}

.so-btn-ghost:hover {
    border-color: var(--accent-primary, #00d4ff);
    color: var(--text-primary, #e2e8f0);
}

.so-btn-primary {
    margin-left: auto;
    background: var(--accent-primary, #00d4ff);
    color: #04222b;
}

.so-btn-primary:hover {
    filter: brightness(1.08);
}

[data-theme="light"] .so-btn-primary {
    background: #0891b2;
    color: #ffffff;
}

.so-btn[hidden] {
    display: none !important;
}

@media (max-width: 991.98px) {
    .so-card {
        width: min(300px, calc(100vw - 20px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .so-root,
    .so-dim,
    .so-spotlight,
    .so-card,
    .so-btn {
        transition: none !important;
    }

    .so-card.is-animating,
    .so-spotlight::after {
        animation: none !important;
    }
}
