/* Подсказки панели: полоса шагов «как запустить» (PageHelp) и значок «?» (HelpTip). */

/* ===== PageHelp ===== */
.ph {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.ph-track {
    display: flex;
    align-items: center;
    gap: 18px;
}

.ph-label {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.ph-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.ph-count {
    margin-left: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(145, 70, 255, 0.12);
    color: #c4a1ff;
    white-space: nowrap;
}

/* Кружки шагов и линии между ними в одну строку */
.ph-steps {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
}

.ph-line {
    flex: 1;
    min-width: 10px;
    height: 2px;
    border-radius: 1px;
    background: var(--border-card);
}

.ph-line.is-done {
    background: rgba(34, 197, 94, 0.45);
}

.ph-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 4px;
    border: 1px solid transparent;
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.ph-step:hover {
    background: rgba(255, 255, 255, 0.04);
}

.ph-step.is-selected {
    border-color: rgba(145, 70, 255, 0.4);
    background: rgba(145, 70, 255, 0.08);
}

.ph-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1.5px solid var(--border-card);
}

.ph-short {
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.ph-step.is-done {
    color: var(--text-secondary);
}

.ph-step.is-done .ph-dot {
    border-color: transparent;
    background: rgba(34, 197, 94, 0.18);
    color: #22c55e;
}

.ph-step.is-next {
    color: var(--text-primary);
}

.ph-step.is-next .ph-dot {
    border-color: var(--accent-purple);
    background: var(--accent-purple);
    color: #fff;
}

.ph-reopen {
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 4px 6px;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #c4a1ff;
    cursor: pointer;
    white-space: nowrap;
}

.ph-reopen:hover {
    color: var(--text-primary);
}

/* Карточка выбранного шага */
.ph-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    padding: 12px 44px 12px 14px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
}

.ph-card-body {
    flex: 1;
    min-width: 0;
}

.ph-card-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ph-done-chip {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.ph-card-hint {
    margin-top: 3px;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.ph-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ph-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.18s ease, background 0.18s ease;
}

.ph-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.06);
}

.ph-btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border-radius: 9px;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.ph-btn:hover {
    text-decoration: none;
}

.ph-btn-primary {
    background: var(--accent-purple);
    border: 1px solid var(--accent-purple);
    color: #fff;
}

.ph-btn-primary:hover {
    background: #7c3aed;
    color: #fff;
}

.ph-btn-ghost {
    background: transparent;
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
}

.ph-btn-ghost:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

/* Подписи шагов первыми уступают место: на средней ширине остаются у следующего
   и выбранного шага (остальные — в title), на телефоне пропадают все */
@media (max-width: 1280px) {
    .ph-step:not(.is-next):not(.is-selected) .ph-short {
        display: none;
    }

    .ph-step:not(.is-next):not(.is-selected) {
        padding-right: 4px;
    }
}

@media (max-width: 760px) {
    .ph {
        padding: 12px;
    }

    .ph-track {
        flex-wrap: wrap;
        gap: 10px;
    }

    .ph-steps {
        flex-basis: 100%;
        order: 3;
    }

    .ph-step .ph-short {
        display: none;
    }

    .ph-step {
        padding: 3px;
    }

    .ph-card {
        flex-wrap: wrap;
        gap: 10px;
        padding-right: 40px;
    }

    .ph-card-body {
        flex-basis: 100%;
    }

    .ph-close {
        top: 10px;
        transform: none;
    }
}

/* ===== HelpTip ===== */
.help-label:has(> .ht) {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    max-width: 100%;
    min-width: 0;
    min-height: 1lh;
    vertical-align: middle;
}

.help-label-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Убираем у подписи только внешние поля строки: круг центрируется по буквам,
   а не по месту, которое шрифт оставляет для верхних и нижних выносных элементов. */
@supports (text-box-trim: trim-both) and (text-box-edge: cap alphabetic) {
    .help-label-text {
        text-box-trim: trim-both;
        text-box-edge: cap alphabetic;
    }
}

@supports not ((text-box-trim: trim-both) and (text-box-edge: cap alphabetic)) {
    .help-label > .ht { top: -1px; }
}

.help-label > .ht {
    margin: 0;
}

.ht {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    line-height: 1;
    vertical-align: middle;
    margin-inline-start: 4px;
}

.ht > .ht-btn {
    position: relative;
    box-sizing: border-box;
    flex: 0 0 18px;
    min-width: 18px;
    max-width: 18px;
    width: 18px;
    min-height: 18px;
    max-height: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    border: 1px solid rgba(145, 70, 255, 0.45);
    background: rgba(145, 70, 255, 0.12);
    color: #c4a1ff;
    font-size: 11px;
    font-weight: 700;
    font-style: normal;
    line-height: 1;
    font-family: inherit;
    text-transform: none;
    text-indent: 0;
    letter-spacing: normal;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s ease;
}

/* Зона нажатия остаётся 24px, не увеличивая высоту строки и сам кружок. */
.ht > .ht-btn::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
}

.ht > .ht-btn > svg {
    display: block;
    width: 11px;
    height: 11px;
    flex-shrink: 0;
}

.ht > .ht-btn:hover,
.ht.ht-open > .ht-btn {
    background: var(--accent-purple);
    color: #fff;
}

.ht-pop {
    position: fixed;
    inset: auto;
    margin: 0;
    z-index: 10000;
    width: max-content;
    max-width: min(300px, calc(100vw - 16px));
    box-sizing: border-box;
    overflow-y: auto;
    overflow-wrap: anywhere;
    padding: 10px 12px;
    border-radius: 10px;
    background: #24243a;
    border: 1px solid rgba(145, 70, 255, 0.35);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
    /* display: none, а не visibility: скрытое окошко у правого края иначе
       растягивает страницу и даёт горизонтальную прокрутку */
    display: none;
    pointer-events: auto;
}

/* Координаты считает help-tip.js. Popover выводит текст поверх overflow и диалогов. */
.ht-open .ht-pop {
    display: block;
}

.ht-pop::backdrop {
    background: transparent;
    pointer-events: none;
}

.ht-btn:focus-visible,
.ph button:focus-visible,
.ph a:focus-visible {
    outline: 2px solid #c4a1ff;
    outline-offset: 3px;
}
