:root {
    --nexo-gate-bg: #05090b;
    --nexo-gate-panel: rgba(12, 20, 23, 0.94);
    --nexo-gate-border: rgba(128, 255, 215, 0.18);
    --nexo-gate-text: #f2fffb;
    --nexo-gate-muted: #8ba39e;
    --nexo-gate-accent: #59f3c2;
    --nexo-gate-danger: #ff7b83;
}

body.nexo-gate-open {
    overflow: hidden !important;
}

.nexo-gate {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: max(22px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    overflow: auto;
    background:
        radial-gradient(circle at 50% 42%, rgba(33, 198, 154, 0.12), transparent 36%),
        radial-gradient(circle at 12% 14%, rgba(45, 111, 124, 0.15), transparent 30%),
        var(--nexo-gate-bg);
    color: var(--nexo-gate-text);
    font-family: Inter, "SF Pro Display", "Segoe UI", "Microsoft YaHei", sans-serif;
    opacity: 1;
    visibility: visible;
    transition: opacity 220ms ease, visibility 220ms ease;
}

.nexo-gate.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.nexo-gate-grid {
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(89, 243, 194, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(89, 243, 194, 0.045) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(circle at center, #000 10%, transparent 76%);
    -webkit-mask-image: radial-gradient(circle at center, #000 10%, transparent 76%);
}

.nexo-gate-glow {
    position: absolute;
    width: min(660px, 120vw);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(89, 243, 194, 0.08);
    box-shadow:
        0 0 0 90px rgba(89, 243, 194, 0.018),
        0 0 0 180px rgba(89, 243, 194, 0.012);
    pointer-events: none;
}

.nexo-gate-card {
    position: relative;
    width: min(100%, 440px);
    box-sizing: border-box;
    padding: 34px 34px 26px;
    overflow: hidden;
    border: 1px solid var(--nexo-gate-border);
    border-radius: 24px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 36%),
        var(--nexo-gate-panel);
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.055);
    text-align: center;
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
    animation: nexo-gate-arrive 360ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.nexo-gate-card::before {
    position: absolute;
    top: 0;
    left: 16%;
    width: 68%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(89, 243, 194, 0.72), transparent);
    content: "";
}

.nexo-gate-radar {
    position: relative;
    width: 92px;
    height: 92px;
    box-sizing: border-box;
    margin: 0 auto 20px;
    overflow: hidden;
    border: 1px solid rgba(89, 243, 194, 0.2);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(89, 243, 194, 0.12), rgba(5, 16, 14, 0.8) 70%);
    box-shadow:
        0 0 36px rgba(22, 219, 160, 0.13),
        inset 0 0 20px rgba(89, 243, 194, 0.08);
}

.nexo-gate-radar-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    box-sizing: border-box;
    border: 1px solid rgba(89, 243, 194, 0.16);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.nexo-gate-radar-ring-a { width: 54%; height: 54%; }
.nexo-gate-radar-ring-b { width: 82%; height: 82%; }

.nexo-gate-radar-axis {
    position: absolute;
    top: 50%;
    left: 50%;
    background: rgba(89, 243, 194, 0.12);
    transform: translate(-50%, -50%);
}

.nexo-gate-radar-axis-x { width: 82%; height: 1px; }
.nexo-gate-radar-axis-y { width: 1px; height: 82%; }

.nexo-gate-radar-sweep {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(89, 243, 194, 0.02) 224deg, rgba(89, 243, 194, 0.42) 350deg, transparent 360deg);
    animation: nexo-radar-sweep 2.5s linear infinite;
}

.nexo-gate-radar-core,
.nexo-gate-radar-dot {
    position: absolute;
    border-radius: 50%;
    background: var(--nexo-gate-accent);
    box-shadow: 0 0 8px rgba(89, 243, 194, 0.9);
}

.nexo-gate-radar-core {
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    transform: translate(-50%, -50%);
}

.nexo-gate-radar-dot { width: 4px; height: 4px; opacity: 0.76; }
.nexo-gate-radar-dot-a { top: 24%; left: 66%; }
.nexo-gate-radar-dot-b { top: 67%; left: 28%; }
.nexo-gate-radar-dot-c { top: 58%; left: 72%; width: 3px; height: 3px; }

.nexo-gate-brand {
    margin: 0 0 7px;
    color: var(--nexo-gate-muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.28em;
}

.nexo-gate-brand span { color: var(--nexo-gate-accent); }

.nexo-gate h1 {
    margin: 0;
    color: var(--nexo-gate-text);
    font-size: 30px;
    font-weight: 650;
    letter-spacing: -0.035em;
}

.nexo-gate-desc {
    max-width: 300px;
    margin: 10px auto 25px;
    color: var(--nexo-gate-muted);
    font-size: 13px;
    line-height: 1.65;
}

.nexo-gate-form { text-align: left; }

.nexo-gate-label {
    display: block;
    margin: 0 0 8px 2px;
    color: #b8ccc7;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.nexo-gate-input-wrap {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    height: 58px;
    border: 1px solid rgba(151, 197, 187, 0.2);
    border-radius: 13px;
    background: rgba(0, 0, 0, 0.35);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.nexo-gate-input-wrap:focus-within {
    border-color: rgba(89, 243, 194, 0.68);
    background: rgba(0, 0, 0, 0.48);
    box-shadow: 0 0 0 3px rgba(89, 243, 194, 0.09);
}

.nexo-gate-input-prefix {
    padding-left: 17px;
    color: rgba(89, 243, 194, 0.66);
    font-size: 21px;
    font-weight: 400;
}

.nexo-gate-input {
    width: 100%;
    min-width: 0;
    height: 100%;
    box-sizing: border-box;
    padding: 0 17px 0 8px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--nexo-gate-text);
    caret-color: var(--nexo-gate-accent);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 23px;
    font-weight: 600;
    letter-spacing: 0.12em;
}

.nexo-gate-input::placeholder {
    color: #5e716d;
    font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    font-weight: 450;
    letter-spacing: 0.02em;
}

.nexo-gate-error {
    min-height: 18px;
    margin: 7px 2px 8px;
    color: var(--nexo-gate-danger);
    font-size: 12px;
    line-height: 1.45;
}

.nexo-gate.is-error .nexo-gate-input-wrap {
    border-color: rgba(255, 123, 131, 0.72);
    box-shadow: 0 0 0 3px rgba(255, 123, 131, 0.08);
    animation: nexo-gate-shake 260ms ease;
}

.nexo-gate-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #6dffd0, #21dca5 54%, #13bd8c);
    color: #05231a;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(22, 219, 160, 0.16);
    transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.nexo-gate-submit:hover:not(:disabled) {
    filter: brightness(1.06);
    box-shadow: 0 14px 32px rgba(22, 219, 160, 0.23);
    transform: translateY(-1px);
}

.nexo-gate-submit:active:not(:disabled) { transform: translateY(0); }
.nexo-gate-submit:focus-visible { outline: 2px solid #b7ffe9; outline-offset: 3px; }
.nexo-gate-submit:disabled { cursor: wait; filter: saturate(0.75); }

.nexo-gate-submit-arrow {
    font-size: 18px;
    font-weight: 500;
    transition: transform 140ms ease;
}

.nexo-gate-submit:hover .nexo-gate-submit-arrow { transform: translateX(3px); }

.nexo-gate-spinner {
    display: none;
    width: 17px;
    height: 17px;
    box-sizing: border-box;
    border: 2px solid rgba(5, 35, 26, 0.28);
    border-top-color: #05231a;
    border-radius: 50%;
    animation: nexo-gate-spin 700ms linear infinite;
}

.nexo-gate.is-busy .nexo-gate-spinner { display: inline-block; }
.nexo-gate.is-busy .nexo-gate-submit-arrow { display: none; }

.nexo-gate-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 21px;
    color: #687d78;
    font-size: 11px;
    line-height: 1.5;
}

.nexo-gate-signal {
    width: 5px;
    height: 5px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--nexo-gate-accent);
    box-shadow: 0 0 8px rgba(89, 243, 194, 0.8);
}

.nexo-room-chip {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 58px);
    left: 50%;
    z-index: 2147482000;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    max-width: calc(100vw - 28px);
    padding: 8px 11px 8px 13px;
    border: 1px solid rgba(89, 243, 194, 0.2);
    border-radius: 999px;
    background: rgba(5, 16, 14, 0.82);
    color: #dffff6;
    font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 11px;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
    transform: translateX(-50%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nexo-room-chip[hidden] { display: none; }
.nexo-room-chip:hover { border-color: rgba(89, 243, 194, 0.48); }
.nexo-room-chip:focus-visible { outline: 2px solid var(--nexo-gate-accent); outline-offset: 2px; }
.nexo-room-chip-label { color: #78908a; }
.nexo-room-chip strong { max-width: 180px; overflow: hidden; color: var(--nexo-gate-accent); font-family: "SFMono-Regular", Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.nexo-room-chip-change { padding-left: 7px; border-left: 1px solid rgba(255, 255, 255, 0.12); color: #c8ddd7; }

@keyframes nexo-radar-sweep { to { transform: rotate(360deg); } }
@keyframes nexo-gate-spin { to { transform: rotate(360deg); } }
@keyframes nexo-gate-arrive { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes nexo-gate-shake { 0%, 100% { transform: translateX(0); } 28% { transform: translateX(-4px); } 56% { transform: translateX(4px); } 78% { transform: translateX(-2px); } }

@media (max-width: 520px) {
    .nexo-gate-card { padding: 29px 22px 23px; border-radius: 20px; }
    .nexo-gate-radar { width: 82px; height: 82px; margin-bottom: 17px; }
    .nexo-gate h1 { font-size: 27px; }
    .nexo-gate-desc { margin-bottom: 22px; }
    .nexo-gate-input { font-size: 21px; }
    .nexo-gate-input-wrap { height: 55px; }
    .nexo-room-chip {
        top: auto;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 82px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .nexo-gate-card, .nexo-gate-radar-sweep, .nexo-gate-spinner { animation: none; }
    .nexo-gate, .nexo-gate-submit, .nexo-gate-input-wrap { transition: none; }
}
