:root {
    color-scheme: dark;
    --bg: #07080a;
    --surface: rgba(20, 21, 25, .3);
    --surface-solid: #1c1d21;
    --sidebar: rgba(25, 26, 31, .2);
    --line: rgba(235, 235, 245, .15);
    --line-soft: rgba(235, 235, 245, .08);
    --text: #f5f5f7;
    --muted: #98989f;
    --blue: #0a84ff;
    --blue-pressed: #0071dc;
    --green: #30d158;
    --red: #ff453a;
    --amber: #ff9f0a;
}

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

html {
    min-width: 320px;
    background: #07080a;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

#networkCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 1;
    filter: none;
}

.page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 0;
}

.terminal {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: rgba(7, 8, 10, .08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    isolation: isolate;
}

.terminal::before { display: none; }

.rail {
    display: flex;
    flex-direction: row;
    align-items: center;
    min-width: 0;
    margin: 16px 20px 0;
    padding: 13px 16px;
    border: 1px solid rgba(235, 235, 245, .15);
    border-radius: 8px;
    background: rgba(25, 26, 31, .34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 12px 36px rgba(0, 0, 0, .18);
    backdrop-filter: blur(28px) saturate(175%) brightness(1.06);
    -webkit-backdrop-filter: blur(28px) saturate(175%) brightness(1.06);
}

.brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 11px;
    padding: 0;
}

.brand > div { display: block; min-width: 0; }

.brand-logo {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    flex-shrink: 0;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #1c1d21;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .22);
}

.brand-name {
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    font-weight: 650;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-code {
    margin-top: 3px;
    color: #808088;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
}

.rail-divider {
    width: 1px;
    height: 30px;
    margin: 0 18px;
    background: var(--line-soft);
}

.rail-label {
    display: none;
    margin: 0;
    color: #8b8b93;
    font-size: 11px;
    font-weight: 600;
    text-transform: none;
}

.steps {
    position: relative;
    display: grid;
    list-style: none;
    grid-template-columns: repeat(3, max-content);
    gap: 34px;
    justify-items: stretch;
    width: auto;
}

.step {
    position: relative;
    display: grid;
    grid-template-columns: 8px max-content;
    gap: 9px;
    min-height: 30px;
    align-items: center;
    padding: 0;
    border-radius: 0;
    color: #808088;
    transition: background .2s ease, color .2s ease;
}

.step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    left: calc(100% + 10px);
    width: 14px;
    height: 1px;
    background: rgba(235, 235, 245, .13);
}

.step-index {
    width: 8px;
    height: 8px;
    display: grid;
    place-items: center;
    border-color: var(--line);
    background: rgba(235, 235, 245, .15);
    color: transparent;
    font-family: inherit;
    font-size: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
}

.step-copy { display: block; padding: 0; }
.step-title { color: inherit; font-size: 13px; font-weight: 600; }
.step-meta { display: none; }

.step.active {
    color: var(--text);
    background: transparent;
}

.step.active .step-index {
    border-color: rgba(120, 195, 255, .85);
    background: var(--blue);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(10, 132, 255, .1);
}

.step.done { color: #b1b1b7; }
.step.done .step-index { border-color: rgba(48, 209, 88, .28); color: var(--green); background: rgba(48, 209, 88, .1); }
.step.done:not(:last-child)::after { background: rgba(48, 209, 88, .35); }

.rail-footer { display: block; margin: 0 0 0 auto; padding: 0 0 0 14px; }

.system-state {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 32px;
    padding: 0;
    border-top: 0;
    color: var(--muted);
    font-size: 11px;
}

.system-state > span:first-child { display: none; }
.system-state .state-value { color: #a8a8ae; font-size: 11px; }
.state-value { display: inline-flex; align-items: center; gap: 7px; }
.state-mark {
    width: 12px;
    height: 12px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 12px;
    color: var(--green);
    font-size: 11px;
    font-style: normal;
    font-weight: 750;
    line-height: 1;
}

.workspace {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 18px 32px 32px;
    background: transparent;
    isolation: isolate;
}

.workspace::before,
.workspace::after,
.flow-layer { display: none; }

.topbar {
    position: relative;
    z-index: 1;
    display: none;
    min-height: 28px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 20px;
    padding-bottom: 0;
    border-color: var(--line-soft);
}

.topbar { display: none; }

.terminal-id {
    display: none;
    color: #8e8e95;
    font-family: inherit;
    font-size: 12px;
    font-weight: 550;
    line-height: 1.5;
}

.connection {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #b0b0b6;
    font-family: inherit;
    font-size: 12px;
    font-weight: 550;
}

.connection span { display: inline; }

.content {
    position: relative;
    z-index: 1;
    width: min(820px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    grid-template-rows: auto auto;
    column-gap: 54px;
    align-items: center;
    margin: auto;
    padding: 36px 38px;
    border: 1px solid rgba(235, 235, 245, .15);
    border-radius: 8px;
    background: rgba(24, 25, 30, .3);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .1),
        0 24px 70px rgba(0, 0, 0, .32);
    backdrop-filter: blur(26px) saturate(180%) brightness(1.06);
    -webkit-backdrop-filter: blur(26px) saturate(180%) brightness(1.06);
}

.eyebrow { display: none; }

h1 {
    grid-column: 1;
    grid-row: 1;
    max-width: none;
    color: var(--text);
    font-size: 42px;
    font-weight: 700;
    line-height: 1.16;
}

.subtitle {
    grid-column: 1;
    grid-row: 2;
    max-width: none;
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.action-zone {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-width: 0;
    margin-top: 0;
}

.realname-form {
    display: grid;
    gap: 15px;
    margin-bottom: 16px;
    padding: 16px;
    border-color: var(--line-soft);
    border-radius: 8px;
    background: rgba(118, 118, 128, .11);
}

.form-heading { color: var(--text); font-size: 14px; }
.field { display: grid; gap: 8px; }
.field label { color: #c2c2c7; font-size: 12px; }

.field input {
    width: 100%;
    height: 48px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-color: var(--line);
    border-radius: 7px;
    background: rgba(9, 9, 11, .5);
    color: var(--text);
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .02);
}

.field input::placeholder { color: #68686f; }

.field input:focus {
    border-color: rgba(10, 132, 255, .65);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, .14);
}

.button-row { display: flex; gap: 10px; }

.button {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 21px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s ease, background .18s ease, opacity .18s ease;
}

.button svg { width: 18px; height: 18px; flex: 0 0 18px; }

.button:active:not(:disabled) { transform: scale(.985); }

.button-primary {
    position: relative;
    width: 100%;
    min-height: 56px;
    justify-content: space-between;
    padding: 0 11px 0 19px;
    color: #f5f8fb;
    border-color: rgba(235, 235, 245, .18);
    background: rgba(235, 235, 245, .075);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .11),
        inset 0 -1px 0 rgba(0, 0, 0, .16),
        0 10px 26px rgba(0, 0, 0, .18);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
}

.button-primary::before { display: none; }
.button-primary svg {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    padding: 8px;
    border: 1px solid rgba(157, 214, 255, .42);
    border-radius: 50%;
    background: linear-gradient(180deg, #2d9cff, #0878e8);
    color: #fff;
    opacity: 1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 5px 14px rgba(0, 122, 255, .28);
}

.button-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(235, 235, 245, .26);
    background: rgba(235, 235, 245, .11);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .14),
        inset 0 -1px 0 rgba(0, 0, 0, .14),
        0 13px 30px rgba(0, 0, 0, .22);
}

.button-primary:active:not(:disabled) {
    transform: translateY(0) scale(.985);
    background: rgba(235, 235, 245, .055);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, .24), 0 4px 12px rgba(0, 0, 0, .14);
}

.button-secondary {
    flex: 1;
    border-color: var(--line);
    background: rgba(118, 118, 128, .18);
    color: #f2f2f5;
}

.button-secondary:hover:not(:disabled) { border-color: var(--line); background: rgba(118, 118, 128, .25); }
.button:disabled { cursor: wait; opacity: .45; }

.loading {
    min-height: 24px;
    display: none;
    align-items: center;
    gap: 9px;
    margin-top: 13px;
    color: var(--muted);
    font-family: inherit;
    font-size: 12px;
}

.loading.visible { display: flex; }

.scanner { width: 36px; height: 2px; overflow: hidden; border-radius: 2px; background: rgba(10, 132, 255, .18); }
.scanner::after { content: ""; display: block; width: 45%; height: 100%; background: var(--blue); animation: scan 1.1s ease-in-out infinite; }

.result {
    display: none;
    margin-top: 18px;
    padding: 18px;
    border-color: var(--line-soft);
    border-radius: 8px;
    background: rgba(118, 118, 128, .1);
}

.result.visible { display: block; animation: resultIn .28s ease-out; }

.result.success { border-color: rgba(48, 209, 88, .2); background: rgba(48, 209, 88, .07); }
.result.error { border-color: rgba(255, 69, 58, .22); background: rgba(255, 69, 58, .07); }

.result-icon { border: 0; background: rgba(48, 209, 88, .12); }
.result-head { display: flex; align-items: flex-start; gap: 12px; }
.result-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 34px; border-radius: 50%; }
.result-icon svg { width: 17px; height: 17px; }
.error .result-icon { background: rgba(255, 69, 58, .12); }
.success .result-icon { color: var(--green); }
.error .result-icon { color: var(--red); }
.result h2, .result h3 { color: var(--text); font-size: 15px; }
.result p { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.65; }

.verify-note {
    margin-top: 15px;
    padding: 12px 13px;
    border-left: 2px solid var(--amber);
    border-left-color: var(--amber);
    background: rgba(255, 159, 10, .09);
    color: #ffd18a;
    font-size: 13px;
    line-height: 1.6;
}

.result-actions { display: flex; gap: 9px; margin-top: 16px; }
.result-actions .button { min-height: 44px; }

.code-block {
    max-height: 230px;
    overflow: auto;
    margin-top: 16px;
    padding: 13px;
    border: 1px solid var(--line-soft);
    border-color: var(--line-soft);
    border-radius: 7px;
    background: rgba(8, 8, 10, .55);
    color: #8de5a5;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 20;
    padding: 12px 16px;
    border: 1px solid rgba(48, 209, 88, .2);
    border-color: rgba(48, 209, 88, .2);
    border-radius: 8px;
    background: rgba(35, 35, 38, .94);
    color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
    backdrop-filter: blur(16px);
    animation: toastIn .22s ease-out;
}

.hidden { display: none !important; }

@keyframes scan {
    0%, 100% { transform: translateX(-20%); }
    50% { transform: translateX(145%); }
}

@keyframes resultIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) and (min-width: 701px) {
    .terminal { width: 100%; grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .rail { margin: 12px 14px 0; padding: 12px 14px; }
    .brand-code { display: none; }
    .rail-divider { margin-right: 14px; margin-left: 14px; }
    .steps { width: min(350px, 50vw); }
    .rail-footer { display: block; }
    .workspace { padding: 24px 24px 28px; }
    .content { width: min(540px, 100%); display: block; }
    .action-zone { margin-top: 28px; }
}

@media (max-width: 700px) {
    .page { min-height: 100dvh; padding: 0; }

    .terminal {
        min-height: 100dvh;
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .rail {
        position: relative;
        display: grid;
        grid-template-columns: 1fr;
        margin: 10px 10px 0;
        padding: 15px 16px 13px;
        border: 1px solid rgba(235, 235, 245, .14);
        border-radius: 8px;
        background: rgba(24, 25, 30, .28);
    }

    .brand { padding: 0; }
    .brand-logo { width: 40px; height: 40px; flex-basis: 40px; }
    .brand-name { font-size: 15px; }
    .brand-code { display: none; }
    .rail-divider, .rail-label { display: none; }
    .rail-footer { position: absolute; top: 17px; right: 16px; display: block; padding: 0; }

    .steps {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        width: 100%;
        margin-top: 13px;
    }

    .step {
        grid-template-columns: 8px max-content;
        gap: 7px;
        min-height: 28px;
        padding: 0 4px;
        border-radius: 0;
        background: transparent;
    }

    .step.active { background: transparent; }
    .step-index { width: 8px; height: 8px; font-size: 0; }
    .step-title { font-size: 10px; white-space: nowrap; }

    .workspace {
        min-height: 0;
        padding: 12px 14px 22px;
        background: transparent;
    }

    .topbar { min-height: 28px; padding-bottom: 8px; }
    .terminal-id { font-size: 11px; }
    .connection { font-size: 11px; }
    .content {
        width: 100%;
        display: block;
        margin: auto;
        padding: 28px 18px;
        background: rgba(24, 25, 30, .28);
        backdrop-filter: blur(22px) saturate(175%) brightness(1.05);
        -webkit-backdrop-filter: blur(22px) saturate(175%) brightness(1.05);
    }
    h1 { font-size: 32px; }
    .subtitle { font-size: 14px; }
    .action-zone { margin-top: 26px; }
    .button { min-height: 52px; }
    .button-primary { width: 100%; }
}

@media (max-width: 390px) {
    .step-title { font-size: 9px; }
    .workspace { padding-right: 14px; padding-left: 14px; }
    .content { padding-top: 28px; }
    h1 { font-size: 30px; }
    .result-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    .button, .step { transition: none; }
}
