/* UltenerWebCaptcha — дизайн 1:1 с captcha.reallyworld.me (v2).
   Значения взяты из их main.1798701a.css. Наши компоненты
   (капча, шаги, таймер) оформлены в том же стиле. */

html[data-theme="light"] {
    color-scheme: light;
    --page-bg: #f4f4f6;
    --card: #ffffff;
    --card-line: rgba(50, 55, 69, .08);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
    --title: #323745;
    --muted: #9096a2;
    --soft: #f8f8fa;
    --soft-line: rgba(50, 55, 69, .06);
    --input-line: rgba(50, 55, 69, .12);
    --input-line-focus: #fca800;
    --accent: #fca800;
    --accent-ink: #b07800;
    --accent-bg: #fef8eb;
    --accent-line: rgba(252, 168, 0, .2);
    --btn-bg: #323745;
    --btn-text: #ffffff;
    --btn-hover: #1f2430;
    --ok-ink: #16794a;
    --ok-bg: #edfcf2;
    --ok-line: rgba(34, 197, 94, .2);
    --err-ink: #b91c1c;
    --err-bg: #fef2f2;
    --err-line: rgba(239, 68, 68, .15);
    --footer: #c0c4cc;
    --footer-link: #a0a5b0;
    --overlay: rgba(244, 244, 246, .92);
    --frame-bg: #0b0f1a;
    --track: #eeeef0;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --page-bg: #0e1013;
    --card: #171a20;
    --card-line: rgba(255, 255, 255, .08);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .4);
    --title: #e8eaee;
    --muted: #9aa1ad;
    --soft: #1d2129;
    --soft-line: rgba(255, 255, 255, .07);
    --input-line: rgba(255, 255, 255, .14);
    --input-line-focus: #fca800;
    --accent: #fca800;
    --accent-ink: #f5b83d;
    --accent-bg: rgba(252, 168, 0, .12);
    --accent-line: rgba(252, 168, 0, .3);
    --btn-bg: #e8eaee;
    --btn-text: #14171c;
    --btn-hover: #ffffff;
    --ok-ink: #4ade80;
    --ok-bg: rgba(34, 197, 94, .12);
    --ok-line: rgba(34, 197, 94, .25);
    --err-ink: #f87171;
    --err-bg: rgba(239, 68, 68, .12);
    --err-line: rgba(239, 68, 68, .25);
    --footer: #6b7280;
    --footer-link: #8a93a1;
    --overlay: rgba(10, 12, 16, .9);
    --frame-bg: #04060d;
    --track: #262b34;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.hidden {
    display: none !important;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    background: var(--page-bg);
    background-image: radial-gradient(ellipse 70% 50% at 50% 0, rgba(252, 168, 0, .07) 0, transparent 70%);
    color: var(--title);
    font-family: Inter, Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.v2-page {
    width: 100%;
    max-width: 420px;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Карточка (v2-card) ---------- */

.v2-card {
    background: var(--card);
    border: 1px solid var(--card-line);
    border-radius: 24px;
    box-shadow: var(--card-shadow);
    padding: 48px 40px 40px;
    text-align: center;
    width: 100%;
    animation: v2-fadeIn .5s ease-out;
}

@keyframes v2-fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Логотип (v2-logo) ---------- */

.v2-logo {
    width: 52px;
    height: 56px;
    margin: 0 auto 32px;
    filter: drop-shadow(0 4px 16px rgba(252, 168, 0, .2));
    transition: filter .3s ease;
}

.v2-logo:hover {
    filter: drop-shadow(0 4px 24px rgba(252, 168, 0, .35));
}

.v2-logo img {
    width: 100%;
    height: 100%;
}

.v2-logo-text {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--title);
    margin: 0 auto 32px;
    line-height: 56px;
}

/* ---------- Тайтл / сабтайтл (v2-title, v2-subtitle) ---------- */

.v2-title {
    color: var(--title);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -.01em;
    margin-bottom: 8px;
}

.v2-subtitle {
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    margin-bottom: 32px;
}

/* ---------- Виджет (v2-turnstile) — сюда встроена наша капча ---------- */

.v2-turnstile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 65px;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 14px;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 7px 14px;
    border: 1px solid var(--soft-line);
    border-radius: 100px;
    background: var(--soft);
    font-size: 13px;
    font-weight: 500;
    color: var(--title);
}

.meta-item svg {
    width: 13px;
    height: 13px;
    flex: none;
    color: var(--muted);
}

.meta-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--title);
}

.meta-item.warn {
    color: var(--accent-ink);
    border-color: var(--accent);
}

.steps {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-bottom: 4px;
}

.step {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--soft-line);
    border-radius: 100px;
    background: var(--soft);
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-align: center;
    letter-spacing: .02em;
}

.step.active {
    border-color: var(--accent-line);
    color: var(--accent-ink);
    background: var(--accent-bg);
}

.step.done {
    border-color: var(--ok-line);
    color: var(--ok-ink);
    background: var(--ok-bg);
}

.panel {
    width: 100%;
    margin-top: 14px;
}

.prompt {
    font-size: 15px;
    font-weight: 600;
    color: var(--title);
    text-align: center;
    margin-bottom: 12px;
}

.hint {
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    margin: 12px 0;
}

.hcaptcha-holder {
    display: flex;
    justify-content: center;
    min-height: 78px;
    padding: 10px;
    border: 1px solid var(--soft-line);
    border-radius: 14px;
    background: var(--soft);
}

.frame {
    position: relative;
    border: 1px solid var(--card-line);
    border-radius: 14px;
    background: var(--frame-bg);
    overflow: hidden;
    aspect-ratio: 2 / 1;
}

.frame.clickable {
    cursor: crosshair;
}

.frame.clickable:hover {
    border-color: var(--input-line);
}

.frame img {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
    transition: opacity .2s;
}

.frame img.loading {
    opacity: .12;
}

.frame.shake {
    animation: shake .35s ease;
}

@keyframes shake {
    20%, 60% { transform: translateX(-3px); }
    40%, 80% { transform: translateX(3px); }
}

.marker {
    position: absolute;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid #22d3ee;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
}

.marker.show {
    opacity: 1;
}

.loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(4, 6, 13, .5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
}

.loading.show {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(148, 163, 184, .3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: v2-spin .7s linear infinite;
}

@keyframes v2-spin {
    to { transform: rotate(360deg); }
}

input[type="text"] {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--input-line);
    border-radius: 100px;
    background: var(--soft);
    color: var(--title);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    letter-spacing: .18em;
    text-transform: uppercase;
    outline: none;
    transition: border-color .15s;
}

input[type="text"]::placeholder {
    color: var(--muted);
    letter-spacing: .04em;
    font-weight: 400;
    text-transform: none;
}

input[type="text"]:focus {
    border-color: var(--input-line-focus);
}

input[type="text"]:disabled {
    opacity: .6;
}

.btn {
    width: 100%;
    height: 46px;
    margin-top: 10px;
    border: 0;
    border-radius: 100px;
    background: var(--btn-bg);
    color: var(--btn-text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}

.btn:hover {
    background: var(--btn-hover);
}

.btn:active {
    opacity: .85;
}

.btn:disabled {
    cursor: default;
    opacity: .5;
}

.btn.loading .label {
    display: none;
}

.ghost-btn {
    width: 100%;
    height: 40px;
    margin-top: 10px;
    border: 1px solid var(--input-line);
    border-radius: 100px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.ghost-btn:hover {
    background: var(--soft);
    color: var(--title);
}

.small {
    position: absolute;
    top: 16px;
    right: 16px;
    width: auto;
    height: auto;
    margin: 0;
    padding: 6px 12px;
    font-size: 12px;
}

/* ---------- Статусы (v2-status) ---------- */

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    animation: v2-statusIn .3s ease-out;
}

@keyframes v2-statusIn {
    from {
        opacity: 0;
        transform: scale(.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.status.ok {
    background: var(--ok-bg);
    border: 1px solid var(--ok-line);
    color: var(--ok-ink);
}

.status.error {
    background: var(--err-bg);
    border: 1px solid var(--err-line);
    color: var(--err-ink);
}

.status.warn {
    background: var(--accent-bg);
    border: 1px solid var(--accent-line);
    color: var(--accent-ink);
}

.status.muted {
    background: transparent;
    border: 1px solid var(--soft-line);
    color: var(--muted);
    font-weight: 400;
}

.invalid {
    width: 100%;
    margin-top: 14px;
    padding: 22px;
    border: 1px solid var(--err-line);
    border-radius: 16px;
    background: var(--err-bg);
    text-align: center;
}

.invalid h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--err-ink);
    margin-bottom: 6px;
}

.invalid p {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
}

/* ---------- Разделитель / футер (v2-divider, v2-footer) ---------- */

.v2-divider {
    height: 1px;
    margin: 32px 0;
    background: linear-gradient(90deg, transparent, var(--card-line), transparent);
}

.v2-footer {
    color: var(--footer);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: .02em;
}

.v2-footer a {
    color: var(--footer-link);
    text-decoration: none;
    transition: color .2s ease;
}

.v2-footer a:hover {
    color: var(--title);
}

/* ---------- Экран успеха / перенаправление (как в копии) ---------- */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    padding: 20px;
    background: var(--overlay);
    background-image: radial-gradient(ellipse 70% 50% at 50% 0, rgba(252, 168, 0, .07) 0, transparent 70%);
}

.v2-success-card {
    width: 100%;
    max-width: 420px;
}

.v2-result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin: 0 auto 28px;
    border-radius: 50%;
    animation: v2-iconPop .5s cubic-bezier(.34, 1.56, .64, 1);
}

.v2-result-icon.is-success {
    background: var(--ok-bg);
    border: 1.5px solid var(--ok-line);
    box-shadow: 0 8px 24px rgba(34, 197, 94, .1);
}

@keyframes v2-iconPop {
    from {
        opacity: 0;
        transform: scale(.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.v2-result-icon svg {
    width: 32px;
    height: 32px;
}

.v2-check-path {
    stroke: #22c55e;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: v2-draw .6s ease .2s forwards;
}

@keyframes v2-draw {
    to { stroke-dashoffset: 0; }
}

.v2-message {
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.7;
    margin-bottom: 32px;
}

.v2-link {
    display: inline-flex;
    align-items: center;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    gap: 6px;
    margin-bottom: 32px;
    padding: 10px 20px;
    text-decoration: none;
    transition: all .2s ease;
}

.v2-link.is-success {
    background: var(--ok-bg);
    border: 1px solid rgba(34, 197, 94, .15);
    color: var(--ok-ink);
}

.v2-link.is-success:hover {
    background: #dcfce7;
    border-color: rgba(34, 197, 94, .25);
}

.v2-link svg {
    width: 14px;
    height: 14px;
}

.v2-progress-wrap {
    margin-bottom: 32px;
}

.v2-progress-track {
    background: var(--track);
    border-radius: 100px;
    height: 4px;
    margin-bottom: 10px;
    overflow: hidden;
}

.v2-progress-bar {
    border-radius: 100px;
    height: 100%;
}

.v2-progress-bar.is-success {
    animation: v2-countdown 15s linear forwards;
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

@keyframes v2-countdown {
    0% { width: 100%; }
    to { width: 0; }
}

.v2-hint {
    color: var(--footer);
    font-size: 12px;
}

/* ---------- Демо-hCaptcha ---------- */

.fake-hcaptcha {
    width: 100%;
    max-width: 303px;
    min-height: 74px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    border: 1px solid var(--soft-line);
    border-radius: 12px;
    background: var(--soft);
    color: var(--title);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.fake-box {
    width: 26px;
    height: 26px;
    flex: none;
    display: grid;
    place-items: center;
    border: 2px solid var(--input-line);
    border-radius: 6px;
    transition: border-color .2s;
}

.fake-box svg {
    width: 15px;
    height: 15px;
    opacity: 0;
    color: #22c55e;
}

.fake-box.checking {
    border-color: var(--muted);
}

.fake-box.checking::after {
    content: "";
    width: 13px;
    height: 13px;
    border: 2px solid var(--card-line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: v2-spin .7s linear infinite;
}

.fake-box.done {
    border-color: #22c55e;
}

.fake-box.done svg {
    opacity: 1;
}

.fake-text {
    flex: 1;
    text-align: left;
}

.fake-logo {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

@media (max-width: 430px) {
    .v2-card { padding: 40px 20px 32px; }
    .v2-title { font-size: 18px; }
    .step { font-size: 11px; padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .001s !important;
        transition-duration: .001s !important;
    }
}