:root {
    color-scheme: dark;
    --ink: #0f1419;
    --aside: #141b24;
    --panel: #1a222d;
    --text: #e8eef4;
    --muted: #8b9cb3;
    --line: rgba(232, 238, 244, 0.14);
    --accent: #3d8bfd;
    --accent-2: #6366f1;
    --danger: #fecaca;
    --danger-bg: rgba(248, 113, 113, 0.12);
    --paper: #f7f4ee;
}

* {
    box-sizing: border-box;
}

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

body {
    font-family: Outfit, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(900px 480px at 8% -10%, rgba(61, 139, 253, 0.2), transparent 55%),
        radial-gradient(700px 420px at 100% 0%, rgba(99, 102, 241, 0.18), transparent 50%),
        var(--ink);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: radial-gradient(circle at 50% 40%, #000 20%, transparent 78%);
}

.skip {
    position: absolute;
    left: 1rem;
    top: -4rem;
    background: var(--paper);
    color: var(--ink);
    padding: 0.6rem 0.8rem;
    z-index: 5;
}

.skip:focus {
    top: 1rem;
}

.shell {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    align-items: safe center;
    padding: 1.5rem 1rem;
}

.gate {
    position: relative;
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    background: rgba(26, 34, 45, 0.92);
    border: 1px solid var(--line);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
}

.gate-aside,
.panel {
    padding: 2.4rem 2.2rem;
}

.gate-aside {
    background:
        linear-gradient(180deg, rgba(61, 139, 253, 0.08), transparent 30%),
        var(--aside);
    border-right: 1px solid var(--line);
}

.mark {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.monogram {
    width: 2.4rem;
    height: 2.4rem;
    display: grid;
    place-items: center;
    border-radius: 0.8rem;
    background: linear-gradient(145deg, #1d4ed8, #4338ca);
    color: white;
    font-family: Syne, Outfit, sans-serif;
    font-weight: 800;
    font-size: 0.82rem;
}

.panel-title {
    margin: 0 0 0.75rem;
    font-family: Syne, Outfit, sans-serif;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.lede,
.copy,
.hint,
.aside-note,
.fine-print,
.orbit-caption {
    color: var(--muted);
    line-height: 1.55;
}

.lede {
    max-width: 28rem;
    margin: 1.5rem 0 0;
    font-size: 1.05rem;
}

.orbit {
    position: relative;
    width: 210px;
    height: 210px;
    margin: 2rem 0 0.4rem;
}

.ring {
    position: absolute;
    inset: 0;
    border: 1px dashed rgba(139, 156, 179, 0.55);
    border-radius: 50%;
}

.ring i {
    position: absolute;
    top: -5px;
    left: calc(50% - 5px);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 16px var(--accent);
}

.ring-b {
    inset: 28px;
}

.ring-b i {
    background: #a5b4fc;
    box-shadow: 0 0 16px var(--accent-2);
}

.ring-a {
    animation: spin 28s linear infinite;
}

.ring-b {
    animation: spin-rev 18s linear infinite;
}

.core {
    position: absolute;
    inset: 72px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #202a38;
    color: var(--text);
}

.orbit-caption,
.aside-note {
    margin: 0.35rem 0 0;
    font-size: 0.92rem;
}

.steps {
    list-style: none;
    margin: 1.8rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.85rem;
}

.steps li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--muted);
}

.steps span {
    width: 2rem;
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
}

.steps .is-current {
    color: var(--text);
}

.steps .is-done span,
.steps .is-current span {
    color: var(--accent);
}

.panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kicker {
    margin: 0 0 0.55rem;
    color: #b9c7ff;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.copy {
    margin: 0 0 1.3rem;
}

.copy strong {
    color: var(--text);
    font-weight: 600;
}

.alert {
    margin: 0 0 1rem;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.35);
}

.alert-success {
    background: rgba(52, 211, 153, 0.12);
    color: #bbf7d0;
    border-color: rgba(52, 211, 153, 0.35);
}

form {
    display: grid;
    gap: 0.9rem;
}

.field,
.field-label {
    display: grid;
    gap: 0.4rem;
}

.field-label {
    grid-template-columns: 1fr auto;
    align-items: end;
}

label,
.field-label,
.field-label label {
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
.text-input {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--ink);
    color: var(--text);
    border-radius: 14px;
    min-height: 3.1rem;
    padding: 0.75rem 0.9rem;
    font: inherit;
    font-size: 16px;
}

input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

input:-webkit-autofill {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    box-shadow: 0 0 0 1000px var(--ink) inset;
}

.btn,
.text-button,
.text-link {
    font: inherit;
}

.btn {
    border: 0;
    border-radius: 999px;
    min-height: 3.1rem;
    padding: 0.75rem 1.1rem;
    background: var(--paper);
    color: var(--ink);
    font-weight: 600;
    cursor: pointer;
}

.btn:hover {
    background: white;
}

.btn:disabled {
    opacity: 0.65;
    cursor: progress;
}

.text-button,
.text-link {
    justify-self: start;
    border: 0;
    background: transparent;
    color: #c5d4ea;
    text-decoration: underline;
    text-underline-offset: 0.18em;
    padding: 0;
    cursor: pointer;
}

.quiet-form {
    margin-top: 0.15rem;
}

.panel > .quiet-form + .text-link {
    display: inline-block;
    margin-top: 0.85rem;
}

.digits {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.5rem;
}

.digits input {
    width: 100%;
    min-height: 3.4rem;
    padding: 0;
    text-align: center;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 1.35rem;
    border-radius: 12px;
}

.pair {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.2rem;
}

.qr-frame {
    background: white;
    padding: 0.7rem;
    border-radius: 18px;
    line-height: 0;
}

.qr {
    width: 196px;
    height: 196px;
}

.qr img,
.qr canvas {
    display: block;
    width: 196px;
    height: 196px;
}

.secret {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.75rem;
    align-items: center;
    margin-top: 0.35rem;
}

.secret-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.secret-groups code {
    padding: 0.28rem 0.42rem;
    border-radius: 8px;
    background: rgba(15, 20, 25, 0.55);
    border: 1px solid var(--line);
}

.secret code,
.codes code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    color: var(--text);
    letter-spacing: 0.04em;
    overflow-wrap: anywhere;
}

.spare {
    margin-top: 0.15rem;
}

.spare summary {
    width: fit-content;
    color: #c5d4ea;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.spare form {
    margin-top: 0.85rem;
}

.hint {
    margin: 0.45rem 0 0;
    font-size: 0.88rem;
}

.codes {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    margin: 0 0 0.8rem;
    padding: 0;
}

.codes li {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.7rem 0.5rem;
    text-align: center;
    background: rgba(15, 20, 25, 0.45);
}

.codes code {
    user-select: all;
}

.row-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.check {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    color: var(--text);
    font-size: 0.95rem;
}

.check input {
    margin-top: 0.25rem;
    accent-color: var(--accent);
}

.fine-print {
    margin: 1.5rem 0 0;
    font-size: 0.82rem;
}

@media (max-width: 860px) {
    .gate {
        grid-template-columns: 1fr;
    }

    .gate-aside {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding-bottom: 1.4rem;
    }

    .orbit,
    .orbit-caption {
        display: none;
    }

    .steps {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.4rem;
    }

    .steps li {
        display: block;
        font-size: 0.82rem;
    }

    .pair {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .secret {
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ring-a,
    .ring-b {
        animation: none;
    }
}

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

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

@media print {
    body,
    .gate,
    .panel {
        background: white;
        color: black;
        box-shadow: none;
    }

    body::before,
    .gate-aside,
    .btn,
    .row-actions,
    .check,
    .fine-print,
    .kicker {
        display: none !important;
    }

    .gate {
        display: block;
        border: 0;
    }

    .codes li {
        border-color: #bbb;
    }

    .codes code,
    .panel-title,
    .copy {
        color: black;
    }
}
