/* Реєстрація: кроки, вибір ролі, чипи, пошук населеного пункту.
   Спільні стилі (панель, картка, поля, кнопка) — shared/auth-ui.css. */

.reg-step { display: none; }
.reg-step.active { display: block; animation: regFadeIn 0.3s cubic-bezier(0.22, 0.8, 0.3, 1) both; }
@keyframes regFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .reg-step.active { animation: none; } }

/* ---------- Крок 1: вибір ролі ---------- */
.role-cards { display: flex; flex-direction: column; gap: 10px; }

.role-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 74px;
    padding: 14px 16px 14px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.18s ease, box-shadow 0.2s ease, transform 0.15s ease, background-color 0.18s ease;
    touch-action: manipulation;
}
@media (hover: hover) {
    .role-card:hover {
        border-color: #c9ced6;
        box-shadow: 0 10px 24px -14px rgba(26, 26, 26, 0.35);
        transform: translateY(-1px);
    }
    .role-card:hover .role-arrow { transform: translateX(3px); color: var(--ink); }
}
.role-card:active { transform: scale(0.99); background: var(--field); }
.role-card:focus-visible { outline: 3px solid var(--gold-ring); outline-offset: 2px; }
.role-card.picked { border-color: var(--ink); box-shadow: 0 0 0 4px var(--gold-ring); background: var(--field); }

.role-ico {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: linear-gradient(135deg, #1a1a1a 0%, #3a3a3a 100%);
    color: #f1e6c8;
}
.role-ico svg { width: 22px; height: 22px; }
.role-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.role-name { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.role-desc { font-size: 12.5px; color: var(--muted); }
.role-arrow { flex: 0 0 auto; width: 18px; height: 18px; color: #b3b7bf; transition: transform 0.18s ease, color 0.18s ease; }

/* ---------- Чипи сфер ---------- */
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 32px;
    padding: 0 11px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}
.chip .chip-ico { font-size: 13px; line-height: 1; }
@media (hover: hover) { .chip:hover:not(.on) { border-color: #c9ced6; background: var(--field); } }
.chip:active { transform: scale(0.97); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip input { display: none; }

.chip.chip-add {
    border-style: dashed;
    border-color: #b9bec7;
    background: transparent;
    color: #4a4e57;
    font-family: inherit;
}
.chip.chip-add svg { width: 12px; height: 12px; flex: 0 0 auto; }
@media (hover: hover) { .chip.chip-add:hover { border-color: var(--ink); color: var(--ink); background: var(--field); } }
.chip.chip-add:disabled { opacity: 0.45; cursor: default; }

.chip.chip-custom { padding-right: 5px; }
.chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 1px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    cursor: pointer;
}
.chip-x svg { width: 10px; height: 10px; }
@media (hover: hover) { .chip-x:hover { background: rgba(255, 255, 255, 0.34); } }

.sphere-add { display: flex; gap: 8px; margin-top: 8px; }
.sphere-add .input-field { flex: 1 1 auto; min-width: 0; }
.sphere-add-ok {
    flex: 0 0 auto;
    padding: 0 18px;
    height: var(--ctl-h);
    border: 0;
    border-radius: 14px;
    background: var(--ink);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
}
.sphere-add-ok:active { transform: scale(0.97); }
.sphere-add-ok:disabled { opacity: 0.45; cursor: default; }

/* ---------- Дрібні допоміжні елементи форми ---------- */
#stepForm .auth-kicker { display: none; }
.box-gap { margin-top: 8px; }
.link-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: #4a4e57;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(26, 26, 26, 0.3);
    text-underline-offset: 3px;
    cursor: pointer;
    touch-action: manipulation;
}
@media (hover: hover) { .link-btn:hover { color: var(--ink); text-decoration-color: var(--ink); } }
#commentBox { margin-top: 8px; }

/* ---------- Вибір населеного пункту ---------- */
.settlement-search { position: relative; }
.settlement-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    max-height: 260px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 16px 36px -12px rgba(26, 26, 26, 0.28);
}
.settlement-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(26, 26, 26, 0.06);
    padding: 12px 16px;
    font-size: 15px;
    color: var(--ink);
    cursor: pointer;
}
.settlement-item:last-child { border-bottom: 0; }
@media (hover: hover) { .settlement-item:hover { background: var(--field); } }
.settlement-item:active { background: rgba(26, 26, 26, 0.06); }
.settlement-item small { display: block; font-size: 12px; color: #878b94; margin-top: 2px; }
.settlement-empty { padding: 13px 16px; font-size: 13px; color: #878b94; }

.settlement-picked {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: var(--ctl-h);
    padding: 6px 8px 6px 16px;
    border: 1px solid var(--ink);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 0 0 4px var(--gold-ring);
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}
.settlement-picked-text small { display: block; font-size: 12px; font-weight: 400; color: #878b94; }
.settlement-picked-clear {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(26, 26, 26, 0.07);
    color: #444;
    cursor: pointer;
    transition: background-color 0.18s ease;
}
@media (hover: hover) { .settlement-picked-clear:hover { background: rgba(26, 26, 26, 0.14); } }

/* ---------- Сфери: акуратна сітка на всю ширину (2 колонки), без емодзі, текст видно повністю ---------- */
.auth-card.reg-container { padding: 18px 14px 14px; --field-gap: 12px; }
@media (max-width: 480px) { .auth-card.reg-container { max-width: none; border-radius: 18px; } }
#categoryChips { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
#categoryChips .chip {
    position: relative;
    min-height: 46px;
    padding: 7px 34px 7px 12px;
    border-radius: 12px;
    white-space: normal;
    text-align: left;
    justify-content: flex-start;
    font-size: 13.5px;
    line-height: 1.2;
    letter-spacing: .01em;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 0 rgba(26, 26, 26, .03);
}
#categoryChips .chip-name { min-width: 0; }
#categoryChips .chip .chip-ico { font-size: 15px; margin-right: 2px; }
.chip-tick { position: absolute; right: 10px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; border: 1.5px solid #cdd1d8; box-sizing: border-box; transition: background-color .18s ease, border-color .18s ease; }
.chip.on .chip-tick { background: #d9b24c; border-color: #d9b24c; }
.chip.on .chip-tick::after { content: ''; position: absolute; left: 4px; top: 1.5px; width: 4px; height: 8px; border: solid #1a1a1a; border-width: 0 2px 2px 0; transform: rotate(45deg); }
#categoryChips .chip.chip-add { grid-column: 1 / -1; justify-content: center; min-height: 42px; padding-right: 12px; }
#categoryChips .chip.chip-custom { padding-right: 8px; }
#categoryChips .chip.chip-custom .chip-name { flex: 1 1 auto; }
html[data-theme="dark"] .chip-tick { border-color: #555a63; }
html[data-theme="dark"] .chip.on .chip-tick { border-color: #d9b24c; }
@media (max-width: 600px) { body { padding-left: 6px; padding-right: 6px; } .auth-main { padding-top: 8px; } }

/* ---------- Вибір сфер: кнопка + плитки у вікні ---------- */
#categoryChips { display: block; }
.cat-open { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--field); color: var(--ink); font-weight: 600; font-size: 15px; line-height: 1.2; font-family: inherit; text-align: left; cursor: pointer; }
.cat-open:active { transform: scale(.99); }
.cat-open-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: rgba(217, 178, 76, .16); color: #8f6f26; flex: none; }
.cat-open-ico svg, .cat-tag-ico svg { width: 18px; height: 18px; }
.cat-open-txt { flex: 1 1 auto; }
.cat-open > svg { width: 18px; height: 18px; color: #9aa0a8; flex: none; }
.cat-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cat-tag { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 6px 0 10px; border-radius: 999px; background: rgba(217, 178, 76, .16); border: 1px solid rgba(217, 178, 76, .55); font-size: 13.5px; font-weight: 600; color: var(--ink); }
.cat-tag-ico { display: grid; place-items: center; color: #8f6f26; }
.cat-tag .chip-x { background: rgba(26, 26, 26, .1); }
.cat-add { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 0; border: 0; background: none; color: var(--ink); font-weight: 600; font-size: 14px; line-height: 1.2; font-family: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cat-add svg { width: 14px; height: 14px; }
.cat-add:disabled { opacity: .45; }
.cat-lock { overflow: hidden; }
.cat-sheet { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
.cat-sheet[hidden] { display: none; }
.cat-back { position: absolute; inset: 0; background: rgba(15, 16, 18, .55); }
.cat-panel { position: relative; width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column; gap: 12px; padding: 16px 14px calc(14px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: #fff; box-shadow: 0 -12px 40px rgba(0, 0, 0, .25); }
.cat-head { display: flex; align-items: center; justify-content: space-between; }
.cat-head h3 { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); }
.cat-close { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--field); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.cat-close svg { width: 14px; height: 14px; }
.cat-search { width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); font-size: 16px; color: var(--ink); font-family: inherit; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; overflow-y: auto; overscroll-behavior: contain; padding: 2px; -webkit-overflow-scrolling: touch; }
.cat-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 92px; padding: 10px 6px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-family: inherit; text-align: center; cursor: pointer; }
.cat-tile[hidden] { display: none; }
.cat-tile:active { transform: scale(.97); }
.cat-tile-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--field); color: #8f6f26; }
.cat-tile-ico svg { width: 24px; height: 24px; }
.cat-tile-name { font-size: 13.5px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.cat-tile-tick { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #cdd1d8; box-sizing: border-box; }
.cat-tile.on { border-color: #d9b24c; background: rgba(217, 178, 76, .12); }
.cat-tile.on .cat-tile-ico { background: #d9b24c; color: #1a1a1a; }
.cat-tile.on .cat-tile-tick { background: #d9b24c; border-color: #d9b24c; }
.cat-tile.on .cat-tile-tick::after { content: ''; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #1a1a1a; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.cat-done { min-height: 50px; border: 0; border-radius: 14px; background: #d9b24c; color: #1a1a1a; font-weight: 800; font-size: 16px; line-height: 1; font-family: inherit; cursor: pointer; }
@media (min-width: 560px) { .cat-sheet { align-items: center; } .cat-panel { border-radius: 22px; } }
html[data-theme="dark"] .cat-panel { background: #17181b; }
html[data-theme="dark"] .cat-tile { background: #1d1f23; border-color: #2d3036; color: #f3efe6; }
html[data-theme="dark"] .cat-tile.on { background: rgba(217, 178, 76, .16); border-color: #d9b24c; }
html[data-theme="dark"] .cat-head h3, html[data-theme="dark"] .cat-tag { color: #f3efe6; }
html[data-theme="dark"] .cat-search, html[data-theme="dark"] .cat-close, html[data-theme="dark"] .cat-tile-ico, html[data-theme="dark"] .cat-open { background: #1d1f23; color: #f3efe6; border-color: #2d3036; }

.region-more { margin-top: 8px; }
.region-more summary { cursor: pointer; font-size: 13px; color: #6b7078; list-style: none; padding: 4px 0; }
.region-more summary::-webkit-details-marker { display: none; }
.region-more summary::after { content: " ▾"; }
.region-more[open] select { margin-top: 6px; }

/* країна — компактним рядком (за замовчуванням Україна) */
#groupCountry:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
#groupCountry label { margin: 0; flex: none; }
#groupCountry select { flex: 1 1 140px; min-height: 40px; }
#groupCountry #newCountryBox { flex-basis: 100%; }

/* телефон: форма зверху, щоб екранна клавіатура її не перекривала (як на сторінці входу) */
@media (max-width: 700px) {
    .page-register .auth-main { justify-content: flex-start; min-height: 0; padding-top: 12px; padding-bottom: max(260px, env(safe-area-inset-bottom)); }
}
