:root {
    --bg: #0c0c10;
    --card: #161620;
    --card-border: #28273a;
    --field: #1c1b26;
    --field-border: #2f2e42;
    --text: #e1e1e6;
    --text-strong: #ffffff;
    --text-muted: #9f9eb5;
    --text-dim: #6e6d82;
    --accent: #9341e6;
    --accent-hover: #a855f7;
    --ok: #00e676;
    --warn: #f5a524;
    --danger: #ff6b6b;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 16px;
    overflow-x: hidden;
}

.glow {
    position: fixed;
    inset: -30vh -10vw auto;
    height: 70vh;
    background: radial-gradient(ellipse at center, rgba(147, 65, 230, 0.22), transparent 65%);
    pointer-events: none;
    z-index: 0;
}

.card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.card::before {
    content: "";
    display: block;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
}

.card__header {
    text-align: center;
    padding: 30px 32px 20px;
    border-bottom: 1px solid #222130;
}

.logo { width: 200px; max-width: 70%; height: auto; display: block; margin: 0 auto; }

.subtitle { margin: 12px 0 0; color: var(--text-dim); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }

.state { padding: 28px 32px 32px; text-align: center; }
.state[hidden] { display: none; }

h1 { margin: 0 0 8px; font-size: 22px; font-weight: 700; color: var(--text-strong); }

.muted { margin: 0; color: var(--text-muted); font-size: 15px; line-height: 1.55; }

.account { color: var(--text-strong); word-break: break-all; }

form { margin-top: 22px; text-align: left; }

.field { display: block; margin-bottom: 14px; }
.field__label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }

.field__box {
    display: flex;
    align-items: center;
    background: var(--field);
    border: 1px solid var(--field-border);
    border-radius: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field__box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(147, 65, 230, 0.25); }

.field input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: none;
    color: var(--text-strong);
    font-size: 15px;
    padding: 12px 14px;
}

.reveal {
    flex: none;
    width: 42px;
    height: 42px;
    border: 0;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    display: grid;
    place-items: center;
    border-radius: 10px;
}
.reveal:hover, .reveal[aria-pressed="true"] { color: var(--accent-hover); }
.reveal svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.rules { list-style: none; margin: -4px 0 16px; padding: 0; display: grid; gap: 6px; }
.rules li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); transition: color 0.15s ease; }
.rules .dot { width: 8px; height: 8px; border-radius: 50%; background: #3a3950; transition: background 0.15s ease; }
.rules li.ok { color: var(--ok); }
.rules li.ok .dot { background: var(--ok); }

.error {
    margin: 4px 0 14px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--danger);
    background: rgba(255, 68, 68, 0.12);
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 8px;
}

.primary {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 6px 20px rgba(147, 65, 230, 0.35);
    transition: background 0.15s ease, opacity 0.15s ease;
}
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.primary .spinner { display: none; }
.primary.is-busy .spinner { display: block; }
.primary.is-busy .primary__text { opacity: 0.8; }

.footnote { margin: 14px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-dim); text-align: center; }

.spinner {
    width: 38px;
    height: 38px;
    margin: 4px auto 18px;
    border: 3px solid rgba(168, 85, 247, 0.2);
    border-top-color: var(--accent-hover);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.spinner--small { width: 18px; height: 18px; margin: 0; border-width: 2px; border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }

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

.badge { width: 60px; height: 60px; margin: 4px auto 16px; border-radius: 50%; display: grid; place-items: center; }
.badge svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.badge--ok { color: var(--ok); background: rgba(0, 230, 118, 0.12); border: 1px solid rgba(0, 230, 118, 0.35); }
.badge--warn { color: var(--warn); background: rgba(245, 165, 36, 0.12); border: 1px solid rgba(245, 165, 36, 0.35); }

.hint {
    margin-top: 22px;
    text-align: left;
    background: var(--field);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    padding: 14px 16px;
}
.hint__title { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-strong); }
.hint ol { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; color: var(--text-muted); }

.copyright { position: relative; z-index: 1; margin: 20px 0 0; font-size: 11px; color: #525164; }

@media (max-width: 420px) {
    .state { padding: 24px 20px 26px; }
    .card__header { padding: 24px 20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 2.4s; }
}
