/* 逐步操作说明：遮罩挖孔 + 箭头弹窗 */

.coach-root {
    position: fixed;
    inset: 0;
    z-index: 300000;
    pointer-events: none;
    font-family: inherit;
    -webkit-app-region: no-drag !important;
}

.coach-veil {
    position: absolute;
    z-index: 1;
    background: rgba(8, 18, 36, 0.58);
    pointer-events: auto;
    -webkit-app-region: no-drag !important;
}

.coach-spot {
    position: absolute;
    z-index: 2;
    border-radius: 12px;
    box-shadow: 0 0 0 3px #38bdf8, 0 0 0 8px rgba(56, 189, 248, 0.28);
    pointer-events: none;
    transition: top 0.18s ease, left 0.18s ease, width 0.18s ease, height 0.18s ease;
    opacity: 0;
}

.coach-root.is-ready .coach-spot { opacity: 1; }

.coach-pointer {
    position: absolute;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    background: #0ea5e9;
    box-shadow: 0 0 0 6px rgba(14, 165, 233, 0.28);
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    animation: none;
}

.coach-root.is-ready .coach-pointer {
    opacity: 1;
    animation: coach-pulse 1.15s ease-in-out infinite;
}

.coach-pointer::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    border: 9px solid transparent;
    transform-origin: center;
}

.coach-pointer.is-right::after { border-left-color: #0ea5e9; transform: translate(-2px, -50%); }
.coach-pointer.is-left::after { border-right-color: #0ea5e9; transform: translate(calc(-100% + 2px), -50%); }
.coach-pointer.is-bottom::after { border-top-color: #0ea5e9; transform: translate(-50%, -2px); }
.coach-pointer.is-top::after { border-bottom-color: #0ea5e9; transform: translate(-50%, calc(-100% + 2px)); }

@keyframes coach-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.18); opacity: 0.72; }
}

.coach-card {
    position: absolute;
    z-index: 20;
    width: min(380px, calc(100vw - 24px));
    background: #ffffff;
    color: #0f172a;
    border-radius: 16px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
    border: 1px solid #dbe7f3;
    pointer-events: auto;
    overflow: visible;
    opacity: 0;
    visibility: visible;
    -webkit-app-region: no-drag !important;
}

.coach-card.is-ready,
.coach-root.is-ready .coach-card { opacity: 1; }

.coach-card,
.coach-card * {
    -webkit-app-region: no-drag !important;
}

.coach-card-arrow {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border: 1px solid #dbe7f3;
    transform: rotate(45deg);
    z-index: 0;
}

.coach-card-body {
    position: relative;
    z-index: 1;
    padding: 16px 16px 12px;
}

.coach-kicker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #0369a1;
    text-transform: uppercase;
}

.coach-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
    color: #0f172a;
}

.coach-card p {
    margin: 0;
    font-size: 13px;
    line-height: 1.65;
    color: #334155;
}

.coach-card-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid #e8eef5;
}

.coach-progress {
    margin-right: auto;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
}

.coach-card .btn {
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

.coach-catalog {
    position: fixed;
    inset: 0;
    z-index: 300010;
    background: rgba(8, 18, 36, 0.52);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    -webkit-app-region: no-drag !important;
}

.coach-catalog-panel {
    width: min(860px, 100%);
    max-height: min(86vh, 760px);
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.32);
    border: 1px solid #dbe7f3;
}

.coach-catalog-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 14px;
    background: linear-gradient(135deg, #0a2f5c 0%, #0369a1 100%);
    color: #fff;
    border-bottom: 0;
}

.coach-catalog-head h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.coach-catalog-head p {
    margin: 0;
    font-size: 13px;
    color: rgba(224, 242, 254, 0.92);
    line-height: 1.5;
}

.coach-catalog-head .btn {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;
}

.coach-catalog-head .btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.coach-catalog-card {
    text-align: left;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 12px 10px;
    cursor: pointer;
    color: inherit;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.coach-catalog-card:hover {
    border-color: #7dd3fc;
    background: #f0f9ff;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(3, 105, 161, 0.12);
}

.coach-catalog-body { padding: 8px 20px 20px; }

.coach-catalog-group { margin-top: 16px; }

.coach-catalog-group h3 {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 800;
    color: #0369a1;
    letter-spacing: 0.04em;
}

.coach-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}

.coach-catalog-card strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.coach-catalog-card small {
    display: block;
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
}

.coach-fab {
    position: fixed;
    right: 16px;
    bottom: 36px;
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    box-shadow: 0 8px 20px rgba(22, 163, 74, 0.38);
    cursor: pointer;
    overflow: visible;
    -webkit-app-region: no-drag !important;
}

.coach-fab.is-on { display: inline-flex; }

.coach-fab-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(74, 222, 128, 0.85);
    animation: coach-fab-blink 1.15s ease-in-out infinite;
    pointer-events: none;
}

.coach-fab svg { position: relative; z-index: 1; }

.coach-fab:hover {
    background: #15803d;
    filter: brightness(1.05);
}

.coach-fab[hidden],
body.is-coach-running:has(.coach-root.is-ready) .coach-fab,
body.is-login .coach-fab {
    display: none !important;
}

@keyframes coach-fab-blink {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55);
    }
    50% {
        opacity: 0.35;
        transform: scale(1.18);
        box-shadow: 0 0 0 8px rgba(74, 222, 128, 0);
    }
}

.coach-hint {
    position: fixed;
    z-index: 5000;
    width: 260px;
    padding: 12px 12px 10px;
    background: #0a2f5c;
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(10, 47, 92, 0.28);
    font-size: 13px;
    line-height: 1.55;
}

.coach-hint::after {
    content: '';
    position: absolute;
    top: -7px;
    right: 28px;
    width: 12px;
    height: 12px;
    background: #0a2f5c;
    transform: rotate(45deg);
}

.coach-hint strong { display: block; margin-bottom: 4px; }
.coach-hint-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.coach-hint-actions button {
    border: 0;
    border-radius: 8px;
    min-height: 28px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.coach-hint-skip { background: transparent; color: #cbd5e1; }
.coach-hint-go { background: #38bdf8; color: #082f49; }

html.dark .coach-card,
html[data-theme="dark"] .coach-card,
html.dark .coach-catalog-panel,
html[data-theme="dark"] .coach-catalog-panel {
    background: #152033;
    color: #e8eef6;
    border-color: #2a3d57;
}

html.dark .coach-card-arrow,
html[data-theme="dark"] .coach-card-arrow { background: #152033; border-color: #2a3d57; }
html.dark .coach-card h3,
html[data-theme="dark"] .coach-card h3 { color: #f8fafc; }
html.dark .coach-card p,
html[data-theme="dark"] .coach-card p { color: #cbd5e1; }
html.dark .coach-card-foot,
html[data-theme="dark"] .coach-card-foot { border-top-color: #2a3d57; }
html.dark .coach-catalog-head,
html[data-theme="dark"] .coach-catalog-head {
    background: linear-gradient(135deg, #0a2f5c 0%, #0369a1 100%);
    color: #fff;
    border-bottom: 0;
}
html.dark .coach-catalog-card,
html[data-theme="dark"] .coach-catalog-card { background: #1b2a40; border-color: #2a3d57; color: #e8eef6; }

@media (prefers-reduced-motion: reduce) {
    .coach-pointer,
    .coach-fab-ring { animation: none; }
    .coach-catalog-card,
    .header-apps-item { transition: none; }
}

@media (max-width: 720px) {
    .coach-catalog-grid { grid-template-columns: 1fr; }
}
