/* =====================================================================================================
   NeuroShrub KYC — page shell and wizard components (KYC-DESIGN 11.2-11.5). Mobile first from 375 px: one column, minmax(0, 1fr) grids,
   min-width: 0, buttons at least 44 px high, no horizontal overflow. Restrained compared with the game: square panels, no cut corners,
   no hover sweep or lift, the background grid dimmed as in NeuroShrub's admin.css, no animations. Logical properties only (RTL, 14.4).
   ===================================================================================================== */

html { font-size: 15px; -webkit-text-size-adjust: 100%; }
*, *::before, *::after { transition: none !important; animation: none !important; }

body.kyc-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    margin: 0;
    overflow-x: hidden;
    font-family: var(--ai-font-body);
    background-color: var(--ai-bg);
    color: var(--ai-text-secondary);
    -webkit-font-smoothing: antialiased;
}

/* Layered background on a fixed layer, the grid dimmed (admin.css). */
body.kyc-body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(900px 520px at 100% -8%, rgba(124, 58, 237, .14), transparent 62%),
        radial-gradient(760px 480px at -8% 6%, rgba(76, 29, 149, .22), transparent 60%),
        var(--ai-bg);
}
body.kyc-body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .25;
    background-image:
        linear-gradient(rgba(139, 92, 246, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 92, 246, .045) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
    mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
}

::selection { background: rgba(var(--ai-violet-rgb), .55); color: #fff; }
a { color: var(--ai-violet-soft); text-underline-offset: .2em; }
a:hover { color: var(--ai-violet-pale); }
:focus-visible { outline: 2px solid var(--ai-violet-soft); outline-offset: 2px; }
p { margin-block: 0 .85rem; }
p:last-child { margin-block-end: 0; }

h1, h2, h3, .h1, .h2, .h3 { font-family: var(--ai-font-display); color: var(--ai-text); font-weight: 600; letter-spacing: .02em; }
h1 { font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.9rem); text-transform: uppercase; letter-spacing: .05em; margin-block: 0 1rem; }
h2 { font-size: 1.1rem; margin-block: 1.4rem .6rem; }
h3 { font-size: .98rem; margin-block: 1rem .5rem; }

.kyc-skip { position: absolute; inset-inline-start: .5rem; top: .5rem; z-index: 2000; padding: .5rem .75rem; background: var(--ai-panel-elevated); }

/* ---------- Header and footer ---------- */
.kyc-header { border-bottom: 1px solid var(--ai-border-soft); background: linear-gradient(180deg, rgba(9, 6, 17, .98), rgba(13, 8, 26, .95)); }
.kyc-header__inner, .kyc-footer__inner, .kyc-main {
    width: 100%;
    max-width: 42rem;
    margin-inline: auto;
    padding-inline: 1rem;
    min-width: 0;
}
.kyc-header__inner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-block: .6rem; position: relative; }
.kyc-brand { display: flex; align-items: center; gap: .6rem; min-width: 0; color: var(--ai-text); }
.kyc-brand__mark { width: 2rem; height: 2rem; flex: none; }
.kyc-brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-word { font-family: "Chakra Petch", "Segoe UI", system-ui, sans-serif; font-weight: 700; font-size: 1.1rem; letter-spacing: .03em; white-space: nowrap; }
.brand-word b { color: var(--ai-violet-soft); font-weight: 700; }
.kyc-brand__sub { font-size: .78rem; color: var(--ai-text-muted); overflow-wrap: anywhere; }

.kyc-footer { margin-block-start: auto; border-top: 1px solid var(--ai-border-soft); font-size: .86rem; color: var(--ai-text-muted); }
.kyc-footer__inner { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; padding-block: 1rem 1.5rem; }
.kyc-footer__inner > * { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Language picker (no JavaScript needed: details/summary) ---------- */
.kyc-lang { position: static; }
.kyc-lang > summary { list-style: none; }
.kyc-lang > summary::-webkit-details-marker { display: none; }
.kyc-lang__button { min-height: 44px; display: inline-flex; align-items: center; gap: .35rem; font-family: var(--ai-font-display); font-weight: 600; }
.kyc-lang__list {
    position: absolute;
    inset-inline: 1rem;
    top: calc(100% + .25rem);
    z-index: 1040;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
    padding: .6rem;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--ai-panel-elevated);
    border: 1px solid var(--ai-border);
    box-shadow: var(--ai-shadow);
}
@media (min-width: 576px) {
    .kyc-lang__list { inset-inline: auto 1rem; width: 24rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.kyc-lang__option {
    min-height: 44px;
    min-width: 0;
    padding: .45rem .6rem;
    text-align: start;
    color: var(--ai-text);
    background: rgba(13, 9, 24, .6);
    border: 1px solid var(--ai-border-soft);
    border-radius: var(--ai-radius-1);
    overflow-wrap: anywhere;
}
.kyc-lang__option:hover, .kyc-lang__option:focus-visible { border-color: var(--ai-violet-soft); background: rgba(124, 58, 237, .14); }
.kyc-lang__option.is-current { border-color: var(--ai-violet-bright); background: rgba(124, 58, 237, .22); }

/* ---------- Main column ---------- */
.kyc-main { padding-block: 1.25rem 2rem; flex: 1 0 auto; }
.kyc-main > * { min-width: 0; }

/* One square card per page: no cut corners, no hover lift. */
.kyc-panel {
    position: relative;
    padding: 1.1rem;
    margin-block-end: 1rem;
    background: var(--ai-panel);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-0);
    min-width: 0;
    overflow-wrap: break-word;
}
@media (min-width: 576px) { .kyc-panel { padding: 1.5rem; } }
.kyc-panel--center { text-align: center; }
.kyc-panel__icon { display: block; font-size: 2rem; color: var(--ai-violet-soft); margin-block-end: .5rem; }
.kyc-lead { color: var(--ai-text); font-size: 1.02rem; }
.kyc-muted { color: var(--ai-text-muted); font-size: .9rem; }
.kyc-subtitle { font-size: .98rem; }
.kyc-reference { margin-block-start: 1rem; font-size: .86rem; color: var(--ai-text-muted); overflow-wrap: anywhere; }
.kyc-legal h2 { border-bottom: 1px solid var(--ai-border-soft); padding-block-end: .3rem; }
.kyc-legal ul { padding-inline-start: 1.2rem; }

/* ---------- Step indicator (NeuroShrub .reward-step look) ---------- */
.kyc-steps {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(2.6rem, 1fr));
    gap: .3rem;
}
.kyc-steps__item { display: flex; flex-direction: column; align-items: center; gap: .25rem; min-width: 0; text-align: center; }
.kyc-steps__number {
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    font-family: var(--ai-font-display);
    font-weight: 600;
    color: var(--ai-text-muted);
    background: var(--ai-panel-sunken);
    border: 1px solid var(--ai-border);
}
.kyc-steps__label { font-size: .68rem; line-height: 1.2; color: var(--ai-text-muted); overflow-wrap: anywhere; display: none; }
@media (min-width: 576px) { .kyc-steps__label { display: block; } }
.kyc-steps__item.is-done .kyc-steps__number { color: var(--ai-violet-soft); border-color: rgba(139, 92, 246, .45); background: rgba(124, 58, 237, .16); }
.kyc-steps__item.is-current .kyc-steps__number { color: #fff; border-color: var(--ai-violet-soft); background: var(--ai-violet); }
.kyc-steps__item.is-current .kyc-steps__label { display: block; color: var(--ai-text); }

/* ---------- Messages ---------- */
.kyc-message, .kyc-notice, .kyc-done, .kyc-callout {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    padding: .75rem .9rem;
    margin-block-end: 1rem;
    border: 1px solid var(--ai-border);
    border-inline-start-width: 3px;
    background: var(--ai-panel-sunken);
    min-width: 0;
}
.kyc-message > *, .kyc-notice > *, .kyc-done > *, .kyc-callout > * { min-width: 0; }
.kyc-message > .bi, .kyc-notice > .bi, .kyc-done > .bi, .kyc-callout > .bi { flex: 0 0 1.25rem; font-size: 1.05rem; line-height: 1.4; text-align: center; }
.kyc-message { border-color: rgba(var(--ai-danger-rgb), .45); border-inline-start-color: var(--ai-danger); color: var(--ai-text); }
.kyc-message .bi { color: var(--ai-danger); }
.kyc-notice { border-inline-start-color: var(--ai-warning); }
.kyc-notice .bi { color: var(--ai-warning); }
.kyc-notice__title { font-weight: 600; color: var(--ai-text); }
.kyc-done { border-inline-start-color: var(--ai-success); color: var(--ai-text); }
.kyc-done .bi { color: var(--ai-success); }
.kyc-callout { border-inline-start-color: var(--ai-violet-bright); }
.kyc-callout .bi { color: var(--ai-violet-soft); }
.kyc-callout--warning { border-inline-start-color: var(--ai-warning); }
.kyc-callout--warning .bi { color: var(--ai-warning); }
.kyc-hints, .kyc-tips { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .35rem; }
.kyc-hints li, .kyc-tips li { display: flex; gap: .5rem; align-items: flex-start; min-width: 0; }
.kyc-hints .bi { color: var(--ai-warning); }
.kyc-tips .bi { color: var(--ai-violet-soft); }

.kyc-basis { display: grid; grid-template-columns: minmax(0, 1fr); gap: .2rem; }
.kyc-basis dt { color: var(--ai-text); font-weight: 600; }
.kyc-basis dd { margin: 0 0 .5rem; }

/* ---------- Forms and buttons (sharp, no sweep) ---------- */
.kyc-form { display: grid; gap: .75rem; margin-block-start: 1rem; min-width: 0; }
.form-label { color: var(--ai-text-secondary); font-weight: 500; }
.form-select, .form-control {
    min-height: 44px;
    color: var(--ai-text);
    background-color: var(--ai-panel-sunken);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-1);
    max-width: 100%;
}
.form-select:focus, .form-control:focus { border-color: var(--ai-violet-soft); box-shadow: 0 0 0 .2rem rgba(var(--ai-violet-bright-rgb), .25); }
.kyc-check { display: flex; gap: .65rem; align-items: flex-start; padding: .75rem; padding-inline-start: .75rem; background: var(--ai-panel-sunken); border: 1px solid var(--ai-border); }
.kyc-check .form-check-input { flex: none; width: 1.35rem; height: 1.35rem; margin: .1rem 0 0; float: none; }
.form-check-input { background-color: var(--ai-panel-sunken); border-color: var(--ai-border-strong); border-radius: var(--ai-radius-1); }
.form-check-input:checked { background-color: var(--ai-violet); border-color: var(--ai-violet-soft); }
.kyc-check .form-check-label { color: var(--ai-text); }

.btn {
    --bs-btn-border-radius: var(--ai-radius-1);
    --bs-btn-font-family: var(--ai-font-display);
    --bs-btn-font-weight: 600;
    --bs-btn-padding-x: 1rem;
    --bs-btn-padding-y: .55rem;
    --bs-btn-focus-box-shadow: 0 0 0 .2rem rgba(var(--ai-violet-bright-rgb), .35);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .86rem;
    white-space: normal;
    overflow-wrap: anywhere;
}
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--ai-violet);
    --bs-btn-border-color: var(--ai-violet-bright);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--ai-violet-bright);
    --bs-btn-hover-border-color: var(--ai-violet-soft);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #6d28d9;
    --bs-btn-active-border-color: var(--ai-violet-soft);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--ai-violet-dark);
    --bs-btn-disabled-border-color: var(--ai-violet-dark);
}
.btn-outline-light {
    --bs-btn-color: var(--ai-text);
    --bs-btn-border-color: var(--ai-border-strong);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: rgba(124, 58, 237, .18);
    --bs-btn-hover-border-color: var(--ai-violet-soft);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: rgba(124, 58, 237, .28);
    --bs-btn-active-border-color: var(--ai-violet-soft);
}
.btn-link { text-transform: none; letter-spacing: 0; font-family: var(--ai-font-body); font-weight: 500; --bs-btn-color: var(--ai-violet-soft); }
.btn-sm { --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .7rem; font-size: .78rem; }

/* Primary actions are full width on phones. */
.kyc-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; margin-block-start: 1rem; }
.kyc-actions > form, .kyc-actions > form > .btn, .kyc-actions > .btn { width: 100%; }
@media (min-width: 576px) {
    .kyc-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; }
    .kyc-actions > form, .kyc-actions > form > .btn, .kyc-actions > .btn { width: auto; }
}
.kyc-next { margin-block: 0 1rem; }
.kyc-panel--center .kyc-actions { justify-content: center; }
.kyc-cancel { margin-block-start: .5rem; text-align: center; }
.kyc-cancel__button { color: var(--ai-text-muted); }

/* ---------- Document type choices ---------- */
.kyc-choices { border: 0; margin: 0; padding: 0; display: grid; gap: .5rem; min-width: 0; }
.kyc-choice { position: relative; min-width: 0; }
.kyc-choice__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kyc-choice__label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "icon name" "icon sides";
    column-gap: .75rem;
    align-items: center;
    min-height: 44px;
    padding: .7rem .9rem;
    cursor: pointer;
    background: var(--ai-panel-sunken);
    border: 1px solid var(--ai-border);
}
.kyc-choice__label .bi { grid-area: icon; font-size: 1.5rem; color: var(--ai-violet-soft); }
.kyc-choice__name { grid-area: name; color: var(--ai-text); font-weight: 600; overflow-wrap: anywhere; }
.kyc-choice__sides { grid-area: sides; font-size: .82rem; color: var(--ai-text-muted); }
.kyc-choice__input:checked + .kyc-choice__label { border-color: var(--ai-violet-soft); background: rgba(124, 58, 237, .16); }
.kyc-choice__input:focus-visible + .kyc-choice__label { outline: 2px solid var(--ai-violet-soft); outline-offset: 2px; }

/* ---------- Capture ---------- */
.kyc-frame { margin: 0 0 1rem; display: flex; justify-content: center; }
.kyc-frame__image { width: 100%; max-width: 20rem; height: auto; }
.kyc-capture { display: grid; gap: .75rem; min-width: 0; }
.kyc-capture__pick { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; }
@media (min-width: 576px) { .kyc-capture__pick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kyc-capture__limit { grid-column: 1 / -1; margin: 0; }
.kyc-capture__button { width: 100%; }
.kyc-capture__nojs { grid-column: 1 / -1; }
.kyc-js .kyc-capture__nojs { display: none; }
/* The file inputs stay focusable and clickable through their labels; they are visually replaced by the label buttons. */
.kyc-file { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; opacity: 0; }
.kyc-capture__pick:focus-within .kyc-capture__button { outline-offset: 2px; }
.kyc-capture__preview { display: grid; gap: .6rem; justify-items: center; min-width: 0; }
.kyc-capture__preview[hidden], .kyc-capture__done[hidden], [hidden] { display: none !important; }
.kyc-capture__image { display: block; width: 100%; max-width: 24rem; height: auto; max-height: 50vh; object-fit: contain; border: 1px solid var(--ai-border); background: #000; }
.kyc-capture__progress { width: 100%; max-width: 24rem; height: .5rem; accent-color: var(--ai-violet); }
.kyc-capture__status:empty { display: none; }
.kyc-capture__status { color: var(--ai-text); }
.kyc-capture__status.is-error { color: var(--ai-danger); }
.kyc-capture__preview .kyc-actions { width: 100%; max-width: 24rem; }

/* ---------- Technical values stay left-to-right (14.4) ---------- */
.ltr { direction: ltr; unicode-bidi: isolate; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
}
