/* Trainer's Manual (/help) and the guided tour */

.manual {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 760px;
    margin: 0 auto;
    padding: calc(16px + var(--sc-safe-top)) 16px calc(40px + var(--sc-safe-bottom));
}

.manual-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 60px 22px 18px;
    border: 1px solid var(--sc-line);
    border-radius: var(--sc-radius-lg);
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(var(--sc-primary-rgb), 0.18) 0%, transparent 55%),
        linear-gradient(160deg, var(--sc-surface-2), var(--sc-surface));
    box-shadow: var(--sc-shadow);
}

.manual-back {
    position: absolute;
    top: 12px;
    right: 12px;
}

.manual-logo {
    filter: drop-shadow(0 6px 18px rgba(var(--sc-primary-rgb), 0.4));
}

.manual-title {
    margin: 0;
    font-family: var(--sc-font-display);
    font-size: clamp(26px, 6vw, 34px);
    font-weight: 700;
    line-height: 1.1;
}

.manual-subtitle {
    margin: 4px 0 0;
    color: var(--sc-text-muted);
    font-size: 14px;
}

.manual-search {
    position: sticky;
    top: calc(8px + var(--sc-safe-top));
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 12px;
    padding: 0 14px;
    border: 1px solid var(--sc-line-strong);
    border-radius: var(--sc-radius-pill);
    background: rgba(var(--sc-bg-rgb), 0.85);
    backdrop-filter: blur(12px);
    box-shadow: var(--sc-shadow);
}

.manual-search:focus-within {
    border-color: var(--sc-primary);
    box-shadow: var(--sc-glow-primary);
}

.manual-search > ion-icon {
    flex: none;
    color: var(--sc-primary);
    font-size: 20px;
}

.manual-search input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--sc-text);
    font-size: 16px;
    outline: none;
}

.manual-search input::-webkit-search-cancel-button {
    display: none;
}

.manual-search-clear {
    display: flex;
    padding: 4px;
    border: 0;
    background: none;
    color: var(--sc-text-faint);
    font-size: 20px;
    cursor: pointer;
}

.manual-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 8px;
}

.manual-tour {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.manual-chips {
    display: flex;
    gap: 8px;
    margin: 0 -16px;
    padding: 2px 16px 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.manual-chips::-webkit-scrollbar {
    display: none;
}

.manual-chip {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--sc-line-strong);
    border-radius: var(--sc-radius-pill);
    background: var(--sc-surface);
    color: var(--sc-text-muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.manual-chip.is-active {
    border-color: transparent;
    background: var(--sc-gradient-primary);
    color: var(--sc-navy);
}

.manual-section {
    margin-top: 22px;
    animation: sk-loader-in 0.3s var(--sc-ease-out) both;
}

.manual-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-family: var(--sc-font-display);
    font-size: 21px;
    font-weight: 700;
}

.manual-section-title ion-icon {
    color: var(--sc-primary);
}

.manual-section-blurb {
    margin: 2px 0 10px;
    color: var(--sc-text-muted);
    font-size: 14px;
}

.manual-topic {
    margin-bottom: 8px;
    border: 1px solid var(--sc-line);
    border-radius: var(--sc-radius);
    background: var(--sc-surface);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.manual-topic[open] {
    border-color: rgba(var(--sc-primary-rgb), 0.35);
}

.manual-topic summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    list-style: none;
    cursor: pointer;
}

.manual-topic summary::-webkit-details-marker {
    display: none;
}

.manual-topic-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--sc-primary-soft);
    color: var(--sc-primary);
    font-size: 18px;
}

.manual-topic-title {
    flex: 1;
    font-weight: 600;
}

.manual-topic-chevron {
    color: var(--sc-text-faint);
    transition: transform 0.25s var(--sc-ease-out);
}

.manual-topic[open] .manual-topic-chevron {
    transform: rotate(180deg);
}

.manual-topic-body {
    padding: 0 16px 14px 60px;
    color: var(--sc-text-muted);
    font-size: 14.5px;
    line-height: 1.55;
}

.manual-topic-body p {
    margin: 0 0 8px;
}

.manual-steps {
    margin: 0 0 10px;
    padding: 0;
    counter-reset: step;
    list-style: none;
}

.manual-steps li {
    position: relative;
    margin-bottom: 6px;
    padding-left: 30px;
    color: var(--sc-text);
    counter-increment: step;
}

.manual-steps li::before {
    content: counter(step);
    position: absolute;
    top: 1px;
    left: 0;
    display: grid;
    place-items: center;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: rgba(var(--sc-primary-rgb), 0.16);
    color: var(--sc-primary);
    font-size: 12px;
    font-weight: 700;
}

.manual-callout {
    display: flex;
    gap: 8px;
    padding: 9px 12px;
    border-radius: var(--sc-radius-sm);
    background: var(--sc-primary-soft);
    color: var(--sc-text);
}

.manual-callout ion-icon {
    flex: none;
    margin-top: 3px;
    color: var(--sc-primary);
}

.manual-callout.is-warning {
    background: var(--sc-danger-soft);
}

.manual-callout.is-warning ion-icon {
    color: var(--sc-danger);
}

.manual mark {
    padding: 0 2px;
    border-radius: 3px;
    background: rgba(var(--sc-primary-rgb), 0.3);
    color: inherit;
}

.manual-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 16px;
    color: var(--sc-text-muted);
    text-align: center;
}

@media (max-width: 480px) {
    .manual-topic-body {
        padding-left: 16px;
    }
}

/* Guided tour */

.tour {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.tour-dim {
    position: absolute;
    inset: 0;
    background: rgba(var(--sc-bg-rgb), 0.8);
    backdrop-filter: blur(3px);
    animation: sk-loader-in 0.25s ease both;
}

.tour-spotlight {
    position: absolute;
    border-radius: 20px;
    box-shadow: 0 0 0 9999px rgba(var(--sc-bg-rgb), 0.8), 0 0 0 2px var(--sc-primary), 0 0 24px rgba(var(--sc-primary-rgb), 0.6);
    transition: left 0.35s var(--sc-ease-out), top 0.35s var(--sc-ease-out), width 0.35s var(--sc-ease-out), height 0.35s var(--sc-ease-out);
    pointer-events: none;
}

.tour-card {
    position: absolute;
    left: 50%;
    width: min(340px, calc(100vw - 32px));
    padding: 18px;
    border: 1px solid rgba(var(--sc-primary-rgb), 0.35);
    border-radius: var(--sc-radius-lg);
    background: linear-gradient(160deg, var(--sc-surface-2), var(--sc-surface));
    box-shadow: var(--sc-shadow-lg);
    transform: translateX(-50%);
    animation: tour-pop 0.35s var(--sc-ease-spring) both;
}

.tour-card.is-centered {
    top: 50%;
    text-align: center;
    transform: translate(-50%, -50%);
    animation-name: tour-pop-center;
}

/* A little arrow pointing at the spotlight */
.tour-card.is-above::after,
.tour-card.is-below::after {
    content: "";
    position: absolute;
    left: calc(var(--tour-arrow-x) - 8px);
    width: 16px;
    height: 16px;
    background: var(--sc-surface);
    border: 1px solid rgba(var(--sc-primary-rgb), 0.35);
    transform: rotate(45deg);
}

.tour-card.is-above::after {
    bottom: -9px;
    border-top: 0;
    border-left: 0;
}

.tour-card.is-below::after {
    top: -9px;
    border-right: 0;
    border-bottom: 0;
    background: var(--sc-surface-2);
}

.tour-logo {
    margin: 0 auto 8px;
}

.tour-count {
    color: var(--sc-primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.tour-title {
    margin: 2px 0 6px;
    font-family: var(--sc-font-display);
    font-size: 22px;
    font-weight: 700;
}

.tour-text {
    margin: 0 0 14px;
    color: var(--sc-text-muted);
    font-size: 14.5px;
    line-height: 1.5;
}

.tour-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.tour-card.is-centered .tour-actions {
    justify-content: center;
}

.tour-actions .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tour-skip {
    color: var(--sc-text-muted);
    text-decoration: none;
}

@keyframes tour-pop {
    from { opacity: 0; transform: translateX(-50%) scale(0.92); }
}

@keyframes tour-pop-center {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
}
