/* spot_podbor.css — волна 9e: «AI подбор» (страница /podbor, шторки выбора слов, кнопки входа на главной и в каталоге).
   Цвета и размеры только из токенов spot_ui.css. Мобильный вид первичен: без hover-зависимостей, безопасные зоны, зоны касания ≥ 44px. */

/* ---------- кнопка входа «AI подбор» рядом с поиском (главная, каталог): светло-серая, --spot-field ---------- */
.spot-pb-entry {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    box-sizing: border-box;
    height: var(--spot-control-h-l);
    min-width: var(--spot-control-h-l);
    padding: 0 16px;
    border: 0;
    border-radius: var(--spot-radius);
    background: var(--spot-field);
    color: var(--spot-ink);
    font-family: var(--spot-font);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.spot-pb-entry svg {
    flex: 0 0 auto;
}

.spot-pb-entry:active {
    background: var(--spot-line);
}

.spot-pb-entry:focus-visible {
    outline: 2px solid var(--spot-focus);
    outline-offset: 2px;
}

.spot-pb-entry--sm {
    height: var(--spot-control-h);
    min-width: var(--spot-control-h);
    padding: 0 12px;
    font-size: 14px;
}

/* строка «поиск + AI подбор» на главной: на телефоне кнопка под поиском во всю ширину, на десктопе рядом */
.spot-home-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.spot-home-row .spot-home-search {
    flex: 1 1 auto;
    min-width: 0;
}

.spot-home-ai {
    width: 100%;
    height: var(--spot-control-h);
}

@media (min-width: 992px) {
    .spot-home-row {
        flex-direction: row;
        align-items: flex-start;
        justify-content: center;
        max-width: 900px;
        margin: 0 auto;
    }

    .spot-home-row .spot-home-search {
        max-width: 760px;
        margin: 0;
    }

    .spot-home-ai {
        width: auto;
        height: 56px;
    }
}

/* ---------- страница ---------- */
.spot-pb-body {
    background: var(--spot-bg);
}

.spot-pb {
    padding-top: 12px;
    padding-bottom: calc(96px + var(--spot-safe-bottom, 0px));
    font-family: var(--spot-font);
    color: var(--spot-ink);
}

.spot-pb-crumbs {
    display: none;
}

.spot-pb-crumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--spot-mut);
    font-size: 13px;
}

.spot-pb-crumbs li + li::before {
    content: "›";
    margin-left: 6px;
}

.spot-pb-crumbs a {
    color: var(--spot-mut);
    text-decoration: none;
}

.spot-pb-h1 {
    margin: 4px 0 12px;
    font-size: 22px;
    line-height: 28px;
    font-weight: 800;
}

.spot-pb-h2 {
    margin: 0;
    font-size: 17px;
    line-height: 22px;
    font-weight: 800;
}

.spot-pb-h3 {
    margin: 0;
    font-size: 17px;
    line-height: 22px;
    font-weight: 800;
}

.spot-pb-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.spot-pb-grid {
    display: block;
}

.spot-pb-card {
    margin: 0 0 12px;
    padding: 16px;
    border-radius: var(--spot-radius-l);
    background: var(--spot-surface);
}

/* фраза: слова-кнопки внутри предложения */
.spot-pb-sentence {
    margin: 0 0 12px;
    font-size: 20px;
    line-height: 34px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.spot-pb-word {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: 1px 0;
    padding: 1px 8px;
    box-sizing: border-box;
    border: 0;
    border-radius: var(--spot-radius-s);
    background: var(--spot-red-soft);
    color: var(--spot-red-dark-fg);
    font-family: inherit;
    font-size: inherit;
    font-weight: 700;
    line-height: 1.2;
    text-align: right;
    text-decoration: underline dotted;
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.spot-pb-word:active {
    opacity: .6;
}

.spot-pb-word:focus-visible,
.spot-pb-add:focus-visible,
.spot-pb-btn:focus-visible,
.spot-pb-save:focus-visible,
.spot-pb-go:focus-visible,
.spot-pb-tile:focus-visible,
.spot-pb-curb:focus-visible,
.spot-pb-examples a:focus-visible,
.spot-pb-link:focus-visible {
    outline: 2px solid var(--spot-focus);
    outline-offset: 2px;
}

.spot-pb-adds {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.spot-pb-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: var(--spot-control-h);
    box-sizing: border-box;
    padding: 0 14px;
    border: 1px solid var(--spot-line);
    border-radius: 22px;
    background: var(--spot-surface);
    color: var(--spot-ink);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.spot-pb-add:active {
    background: var(--spot-bg);
}

.spot-pb-add--more {
    color: var(--spot-mut);
}

/* поле «своими словами» */
.spot-pb-free {
    display: flex;
    gap: 8px;
    align-items: center;
}

.spot-pb-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100px;
    height: var(--spot-control-h-l);
    box-sizing: border-box;
    padding: 0 14px;
    border: 1px solid var(--spot-field-border);
    border-radius: var(--spot-radius);
    background: var(--spot-surface);
    color: var(--spot-ink);
    font-family: inherit;
    font-size: 16px;
    text-overflow: ellipsis;
    -webkit-appearance: none;
    appearance: none;
}

.spot-pb-input::placeholder {
    color: var(--spot-mut);
    opacity: 1;
}

/* фокус: рамка 1.5px цвета текста, без сдвига вёрстки */
.spot-pb-input:focus {
    outline: none;
    border-color: var(--spot-ink);
    box-shadow: 0 0 0 .5px var(--spot-ink);
}

.spot-pb-input--field {
    width: 100%;
}

.spot-pb-go {
    flex: 0 0 var(--spot-control-h-l);
    width: var(--spot-control-h-l);
    height: var(--spot-control-h-l);
    padding: 0;
    border: 0;
    border-radius: var(--spot-radius);
    background: var(--spot-inv);
    color: var(--spot-on-inv);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.spot-pb-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.spot-pb-examples a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--spot-mut);
    font-size: 13px;
    line-height: 18px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* «Ваши параметры» */
.spot-pb-params[hidden],
.spot-pb-card[hidden] {
    display: none;
}

.spot-pb-params-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.spot-pb-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--spot-red-fg);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.spot-pb-rows {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.spot-pb-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    padding: 10px 0;
    border-top: 1px solid var(--spot-field);
    font-size: 14px;
    line-height: 20px;
}

.spot-pb-row:first-child {
    border-top: 0;
}

.spot-pb-src {
    color: var(--spot-mut);
    font-weight: 600;
}

.spot-pb-arr {
    color: var(--spot-mut);
}

.spot-pb-cond b {
    font-weight: 700;
}

.spot-pb-row--implied .spot-pb-cond {
    color: var(--spot-ink-2);
}

.spot-pb-left,
.spot-pb-note {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: var(--spot-radius);
    font-size: 13px;
    line-height: 18px;
}

.spot-pb-left {
    background: var(--spot-amber-soft);
    color: var(--spot-amber);
    font-weight: 600;
}

.spot-pb-note {
    background: var(--spot-bg);
    color: var(--spot-ink-2);
}

.spot-pb-left[hidden],
.spot-pb-note[hidden] {
    display: none;
}

.spot-pb-hint {
    margin: 12px 0 0;
    color: var(--spot-mut);
    font-size: 12px;
    line-height: 17px;
}

/* кнопки */
.spot-pb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    height: var(--spot-control-h-l);
    box-sizing: border-box;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 14px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.spot-pb-btn--red {
    background: var(--spot-red);
    color: #fff;
}

.spot-pb-btn--red:active {
    background: var(--spot-red-dark);
}

.spot-pb-btn--line {
    border-color: var(--spot-field-border);
    background: var(--spot-surface);
    color: var(--spot-ink);
}

.spot-pb-btn.is-off,
.spot-pb-save.is-off {
    opacity: .45;
    pointer-events: none;
}

.spot-pb-btn[hidden] {
    display: none;
}

/* нижняя панель: закладка «Следить» и «Показать» (телефон — прибита к низу с безопасной зоной) */
.spot-pb-bar {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: 900;
    display: flex;
    gap: 8px;
    padding: 10px calc(16px + var(--spot-safe-left, 0px)) calc(10px + var(--spot-safe-bottom, 0px)) calc(16px + var(--spot-safe-right, 0px));
    background: var(--spot-surface);
    border-top: 1px solid var(--spot-line);
}

.spot-pb-bar .spot-pb-show {
    flex: 1 1 auto;
}

.spot-pb-save {
    flex: 0 0 var(--spot-control-h-l);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--spot-control-h-l);
    min-width: var(--spot-control-h-l);
    box-sizing: border-box;
    padding: 0;
    border: 1px solid var(--spot-field-border);
    border-radius: 14px;
    background: var(--spot-surface);
    color: var(--spot-ink);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.spot-pb-save:disabled {
    opacity: .45;
}

.spot-pb-save-t {
    display: none;
}

/* результаты и состояния */
.spot-pb-res {
    margin: 0 0 12px;
}

.spot-pb-idle {
    margin: 0;
    padding: 4px 4px 0;
    color: var(--spot-mut);
    font-size: 14px;
    line-height: 20px;
}

.spot-pb-state[hidden],
.spot-pb-found[hidden],
.spot-pb-idle[hidden],
.spot-pb-near[hidden] {
    display: none;
}

.spot-pb-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    border-radius: var(--spot-radius-l);
    background: var(--spot-surface);
    text-align: center;
    font-size: 14px;
    line-height: 20px;
    color: var(--spot-ink-2);
}

.spot-pb-state p {
    margin: 0;
}

.spot-pb-loading {
    flex-direction: row;
    justify-content: center;
    min-height: 56px;
    font-weight: 600;
    color: var(--spot-ink);
}

.spot-pb-spin {
    color: var(--spot-red-fg);
    animation: spot-pb-rot 0.9s linear infinite;
}

@keyframes spot-pb-rot {
    to { transform: rotate(-360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .spot-pb-spin { animation: none; }
}

.spot-pb-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 22px;
    background: var(--spot-field);
    color: var(--spot-ink-2);
}

.spot-pb-ic--err {
    background: #FDECEA;
    color: #C4262E;
}

.spot-pb-ic--ok {
    background: var(--spot-green-soft);
    color: var(--spot-green-fg);
}

.spot-pb-actions {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.spot-pb-kept {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.spot-pb-kept li {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 10px;
    border-radius: var(--spot-radius-s);
    background: var(--spot-bg);
    font-size: 13px;
    font-weight: 600;
    color: var(--spot-ink);
}

.spot-pb-found .spot-pb-h2 {
    margin: 4px 4px 10px;
}

.spot-pb-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.spot-pb-cards > .spot-pb-col {
    display: flex;
    min-width: 0;
    padding: 0;
}

.spot-pb-near {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--spot-radius-l);
    background: var(--spot-surface);
}

.spot-pb-near-t {
    margin: 6px 0 12px;
    color: var(--spot-ink-2);
    font-size: 14px;
    line-height: 20px;
}

.spot-pb-noscript {
    padding: 16px;
    color: var(--spot-ink-2);
}

/* ---------- шторка выбора слова ---------- */
.spot-pb-sheet .spot-sheet-panel {
    max-height: calc(100% - 40px - var(--spot-safe-top, 0px));
}

.spot-pb-sheet-body {
    padding-bottom: 12px;
}

.spot-pb-sheet-in {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 4px;
}

.spot-pb-sheet-hint {
    margin: 0;
    padding: 0 4px;
    color: var(--spot-mut);
    font-size: 14px;
    line-height: 20px;
}

.spot-pb-sheet-list {
    display: flex;
    flex-direction: column;
}

.spot-pb-rowcheck {
    display: inline-flex;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    visibility: hidden;
}

.spot-sheet .spot-row-on .spot-pb-rowcheck {
    visibility: visible;
}

.spot-pb-search {
    margin-right: 0;
    margin-left: 0;
}

.spot-pb-sheet-foot {
    display: flex;
    gap: 8px;
    padding-top: 6px;
}

.spot-pb-sheet-foot .spot-pb-btn {
    flex: 1 1 0;
}

.spot-pb-numform {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.spot-pb-numpair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.spot-pb-numf {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.spot-pb-lab {
    display: block;
    margin-bottom: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--spot-ink);
}

.spot-pb-cur {
    display: inline-flex;
    align-self: flex-start;
    padding: 3px;
    border-radius: var(--spot-radius);
    background: var(--spot-field);
}

.spot-pb-curb {
    min-width: 56px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--spot-ink-2);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.spot-pb-curb.is-on {
    background: var(--spot-surface);
    color: var(--spot-ink);
    box-shadow: 0 1px 2px rgba(20, 22, 26, 0.12);
}

.spot-pb-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.spot-pb-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 84px;
    padding: 12px;
    box-sizing: border-box;
    border: 1px solid var(--spot-field-border);
    border-radius: 14px;
    background: var(--spot-surface);
    color: var(--spot-ink);
    font-family: inherit;
    text-align: right;
    cursor: pointer;
}

.spot-pb-tile.is-on {
    border-color: var(--spot-ink);
    box-shadow: inset 0 0 0 1px var(--spot-ink);
}

.spot-pb-tile-t {
    font-size: 15px;
    font-weight: 700;
}

.spot-pb-tile-h {
    color: var(--spot-mut);
    font-size: 12px;
    line-height: 16px;
}

/* сохранить поиск */
.spot-pb-subform {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 4px;
}

.spot-pb-subform[hidden],
.spot-pb-subdone[hidden] {
    display: none;
}

.spot-pb-subsum {
    margin: 0;
    padding: 14px;
    border-radius: 14px;
    background: var(--spot-bg);
    font-size: 15px;
    line-height: 22px;
    font-weight: 600;
}

.spot-pb-period {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    border: 0;
}

.spot-pb-period legend {
    margin: 0 0 2px;
    padding: 0;
    font-size: 15px;
    font-weight: 700;
}

.spot-pb-opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    margin: 0;
    border-bottom: 1px solid var(--spot-field);
    font-size: 16px;
    font-weight: 600;
}

.spot-pb-opt input {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    accent-color: var(--spot-ink);
}

.spot-pb-suberr {
    margin: 0;
    color: #C4262E;
    font-size: 13px;
    line-height: 18px;
}

.spot-pb-suberr[hidden] {
    display: none;
}

.spot-pb-subnote {
    margin: 0;
    color: var(--spot-mut);
    font-size: 12px;
    line-height: 17px;
    text-align: center;
}

.spot-pb-subdone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-align: center;
}

/* ---------- десктоп ---------- */
@media (min-width: 992px) {
    .spot-pb {
        padding-top: 20px;
        padding-bottom: 48px;
    }

    .spot-pb-crumbs {
        display: block;
        margin-bottom: 8px;
    }

    .spot-pb-h1 {
        margin: 0 0 20px;
        font-size: 32px;
        line-height: 40px;
    }

    .spot-pb-grid {
        display: grid;
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        gap: 24px;
        align-items: start;
    }

    .spot-pb-main {
        position: sticky;
        top: 76px;
    }

    .spot-pb-card {
        padding: 24px;
    }

    .spot-pb-sentence {
        font-size: 26px;
        line-height: 44px;
    }

    .spot-pb-bar {
        position: static;
        padding: 0;
        background: none;
        border-top: 0;
        margin: 4px 0 12px;
    }

    .spot-pb-save {
        flex: 0 0 auto;
        padding: 0 18px;
    }

    .spot-pb-save-t {
        display: inline;
    }

    .spot-pb-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
    }

    .spot-pb-actions {
        flex-direction: row;
        justify-content: center;
    }

    .spot-pb-actions .spot-pb-btn {
        flex: 0 1 auto;
    }

    /* шторка на десктопе — окно по центру, а не лист снизу */
    .spot-pb-sheet {
        align-items: center;
        justify-content: center;
    }

    .spot-pb-sheet .spot-sheet-panel {
        width: 460px;
        max-width: calc(100% - 48px);
        max-height: min(80vh, 680px);
        border-radius: var(--spot-radius-l);
        box-shadow: 0 16px 48px rgba(20, 22, 26, 0.24);
    }

    .spot-pb-sheet .spot-sheet-grab {
        display: none;
    }
}

/* кнопка-иконка (мобильный поиск каталога) и десктопная кнопка в шапке */
.spot-pb-entry--ic {
    width: var(--spot-control-h);
    padding: 0;
}

.spot-dh-ai {
    margin: 0 0 0 8px;
}

/* волна 10: ссылка «Вернуться к диалогу» (ручной конструктор, podbor.tpl) */
.spot-pb-back {
    margin: 0 0 12px;
}

.spot-pb-back .spot-pb-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--spot-control-h);
}
