:root {
    --xas-panel: #0d1016;
    --xas-card: #121720;
    --xas-border: rgba(255, 255, 255, .1);
    --xas-muted: #929aa9;
    --xas-blue: #77adff;
    --xas-green: #43d995;
    --xas-red: #ff6b72;
}

.xas-locked { overflow: hidden; }
.xas-root[hidden] { display: none; }
.xas-root {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: grid;
    place-items: center;
    padding: 24px;
    font-family: Outfit, system-ui, sans-serif;
    color: #f6f8fc;
}
.xas-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(1, 3, 7, .78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.xas-panel {
    position: relative;
    width: min(900px, 100%);
    max-height: min(820px, calc(100vh - 48px));
    overflow: auto;
    overscroll-behavior: contain;
    background:
        radial-gradient(circle at 92% 2%, rgba(74, 139, 255, .12), transparent 27%),
        var(--xas-panel);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 24px;
    box-shadow: 0 28px 100px rgba(0, 0, 0, .62);
    outline: none;
    animation: xas-enter .18s ease-out;
}
.xas-header {
    display: flex;
    justify-content: space-between;
    gap: 28px;
    padding: 28px 30px 22px;
    border-bottom: 1px solid var(--xas-border);
}
.xas-kicker, .xas-card__eyebrow, .xas-step__number {
    margin: 0 0 8px;
    color: var(--xas-blue);
    font-family: "JetBrains Mono", monospace;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .15em;
}
.xas-header h2, .xas-content h3 { margin: 0; color: #fff; }
.xas-header h2 { font-size: clamp(1.35rem, 3vw, 2rem); letter-spacing: -.025em; }
.xas-header p:last-child { margin: 7px 0 0; color: var(--xas-muted); font-size: .9rem; }
.xas-close {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--xas-border);
    border-radius: 11px;
    background: rgba(255, 255, 255, .035);
    color: #c5cad4;
    font: 300 1.55rem/1 sans-serif;
    cursor: pointer;
}
.xas-content { padding: 26px 30px 30px; }
.xas-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.xas-circuit {
    display: flex;
    align-items: center;
    margin-bottom: 22px;
    color: #687180;
    font-family: "JetBrains Mono", monospace;
    font-size: .58rem;
    letter-spacing: .09em;
}
.xas-circuit__node { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.xas-circuit__node i {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border: 1px solid #3d4552;
    border-radius: 50%;
    font-style: normal;
}
.xas-circuit__node.is-active { color: #c8f8df; }
.xas-circuit__node.is-active i { border-color: rgba(67, 217, 149, .45); background: rgba(67, 217, 149, .12); color: var(--xas-green); }
.xas-circuit__line { flex: 1 1 40px; height: 1px; margin: 0 10px; background: linear-gradient(90deg, rgba(67, 217, 149, .25), #343b46); }
.xas-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.xas-card, .xas-methods, .xas-recovery, .xas-confirm, .xas-message {
    min-width: 0;
    border: 1px solid var(--xas-border);
    border-radius: 17px;
    background: rgba(18, 23, 32, .88);
}
.xas-card { display: flex; flex-direction: column; padding: 20px; }
.xas-card.is-active { border-color: rgba(67, 217, 149, .27); box-shadow: inset 0 1px 0 rgba(67, 217, 149, .07); }
.xas-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.xas-card h3, .xas-step h3, .xas-recovery h3, .xas-confirm h3 { font-size: 1.1rem; }
.xas-card__description, .xas-card__meta, .xas-step__copy > p, .xas-recovery > p, .xas-confirm > p, .xas-message p {
    color: var(--xas-muted);
    font-size: .83rem;
    line-height: 1.55;
}
.xas-card__description { min-height: 64px; margin: 14px 0 5px; }
.xas-card__meta { margin: 0 0 18px; color: #c0c6d0; overflow-wrap: anywhere; }
.xas-card .xas-actions { margin-top: auto; }
.xas-badge {
    flex: none;
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 999px;
    color: #9da5b3;
    font-family: "JetBrains Mono", monospace;
    font-size: .55rem;
    letter-spacing: .08em;
}
.xas-badge.is-active { border-color: rgba(67, 217, 149, .3); background: rgba(67, 217, 149, .09); color: #7ce7b5; }
.xas-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.xas-button {
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-family: Outfit, system-ui, sans-serif;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, border-color .15s, background .15s;
}
.xas-button:not(:disabled):hover { transform: translateY(-1px); }
.xas-button:disabled { cursor: wait; opacity: .55; }
.xas-button--primary { background: #f4f7fb; color: #080a0e; }
.xas-button--secondary { border-color: rgba(255, 255, 255, .13); background: #191f29; color: #e8ebf0; }
.xas-button--ghost, .xas-button--danger-ghost { border-color: transparent; background: transparent; color: #aeb5c0; }
.xas-button--danger-ghost { color: #ff8e93; }
.xas-button--danger { background: #ff6b72; color: #160405; }
.xas-button:focus-visible, .xas-close:focus-visible, .xas-code-input:focus-visible, .xas-check input:focus-visible {
    outline: 2px solid var(--xas-blue);
    outline-offset: 2px;
}
.xas-methods { margin-top: 14px; padding: 18px 20px; }
.xas-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.xas-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid var(--xas-border);
    border-radius: 9px;
    color: #d6dae1;
    font-size: .72rem;
}
.xas-chip i { color: var(--xas-green); font-style: normal; }
.xas-footnote { margin: 13px 0 0; color: #6f7886; font-size: .72rem; line-height: 1.45; }
.xas-loading { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 280px; color: var(--xas-muted); }
.xas-spinner { width: 19px; height: 19px; border: 2px solid #343b47; border-top-color: var(--xas-blue); border-radius: 50%; animation: xas-spin .7s linear infinite; }
.xas-step { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 30px; align-items: start; }
.xas-qr { width: 240px; max-width: 100%; height: auto; padding: 8px; border-radius: 16px; background: #fff; }
.xas-step__copy > p { margin: 8px 0 17px; }
.xas-secret { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px 10px; padding: 12px 13px; border: 1px solid var(--xas-border); border-radius: 12px; background: #080b10; }
.xas-secret > span { grid-column: 1; color: #6e7785; font: 600 .56rem/1.2 "JetBrains Mono", monospace; letter-spacing: .11em; }
.xas-secret code { grid-column: 1; color: #dbe6fa; font: 600 .72rem/1.5 "JetBrains Mono", monospace; letter-spacing: .08em; overflow-wrap: anywhere; }
.xas-secret .xas-button { grid-column: 2; grid-row: 1 / 3; }
.xas-verify { margin-top: 18px; }
.xas-verify label { display: block; margin-bottom: 8px; color: #c9ced7; font-size: .77rem; font-weight: 600; }
.xas-code-input {
    width: 100%;
    box-sizing: border-box;
    height: 52px;
    padding: 0 14px;
    border: 1px solid var(--xas-border);
    border-radius: 12px;
    background: #080b10;
    color: #fff;
    font: 700 1.15rem/1 "JetBrains Mono", monospace;
    letter-spacing: .25em;
}
.xas-verify .xas-actions { margin-top: 14px; justify-content: flex-end; }
.xas-inline-error { margin: 7px 0 0; color: #ff9297; font-size: .72rem; }
.xas-recovery, .xas-confirm, .xas-message { max-width: 650px; margin: 0 auto; padding: 24px; }
.xas-recovery > p, .xas-confirm > p { margin: 8px 0 18px; }
.xas-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.xas-codes code { padding: 10px; border: 1px solid var(--xas-border); border-radius: 9px; background: #080b10; color: #dce6f8; text-align: center; font: 600 .76rem/1.2 "JetBrains Mono", monospace; overflow-wrap: anywhere; }
.xas-check { display: flex; align-items: flex-start; gap: 10px; margin: 22px 0 14px; color: #d8dce3; font-size: .78rem; line-height: 1.4; cursor: pointer; }
.xas-check input { margin-top: 2px; accent-color: var(--xas-green); }
.xas-recovery > .xas-button { width: 100%; }
.xas-confirm .xas-actions { margin-top: 22px; }
.xas-message { margin-bottom: 15px; color: #dfe5ec; font-size: .8rem; }
.xas-message--success { max-width: none; padding: 12px 15px; border-color: rgba(67, 217, 149, .24); background: rgba(67, 217, 149, .08); color: #9cebc5; }
.xas-message--error { border-color: rgba(255, 107, 114, .25); }
.xas-message .xas-actions { margin-top: 18px; }

@keyframes xas-enter { from { opacity: 0; transform: translateY(8px) scale(.99); } }
@keyframes xas-spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
    .xas-root { align-items: end; padding: 0; }
    .xas-panel { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; }
    .xas-header { padding: 22px 19px 17px; }
    .xas-content { padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); }
    .xas-circuit__node span { display: none; }
    .xas-circuit__line { margin-inline: 7px; }
    .xas-grid, .xas-step { grid-template-columns: 1fr; }
    .xas-step { gap: 18px; }
    .xas-qr { justify-self: center; width: min(220px, 75vw); }
    .xas-card__description { min-height: 0; }
    .xas-codes { grid-template-columns: 1fr; }
    .xas-actions .xas-button { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
    .xas-panel, .xas-spinner { animation: none; }
    .xas-button { transition: none; }
}
