:root {
    --auth-bg: #06050b;
    --auth-line: rgba(255, 255, 255, 0.085);
    --auth-text: #f5f3ff;
    --auth-muted: #9a96ab;
    --auth-purple: #9146FF;
    --auth-purple-soft: #BF94FF;
    --auth-cyan: #67e8f9;
    --auth-green: #4ade80;
    --auth-red: #fb7185;
    --auth-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --auth-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(18px, 4vw, 48px);
    background: var(--auth-bg);
    color: var(--auth-text);
    font-family: var(--auth-sans);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(760px 560px at 8% 4%, rgba(145, 70, 255, 0.28), transparent 62%),
        radial-gradient(720px 620px at 96% 98%, rgba(34, 211, 238, 0.12), transparent 62%),
        radial-gradient(900px 700px at 54% 44%, rgba(145, 70, 255, 0.08), transparent 72%);
}

body::after {
    content: '';
    position: fixed;
    left: -55%;
    right: -55%;
    bottom: -34%;
    height: 72%;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(145, 70, 255, 0.16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(145, 70, 255, 0.16) 1px, transparent 1px);
    background-size: 62px 62px;
    transform: perspective(540px) rotateX(62deg);
    transform-origin: center bottom;
    -webkit-mask-image: linear-gradient(to top, #000 18%, transparent 82%);
    mask-image: linear-gradient(to top, #000 18%, transparent 82%);
    opacity: 0.38;
}

.auth-console {
    position: relative;
    width: 100%;
    max-width: 1120px;
    overflow: hidden;
    border: 1px solid var(--auth-line);
    border-radius: 32px;
    background: linear-gradient(180deg, rgba(17, 15, 26, 0.92), rgba(8, 7, 13, 0.96));
    box-shadow: 0 60px 150px -50px rgba(0, 0, 0, 0.95), 0 0 100px rgba(145, 70, 255, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    -webkit-backdrop-filter: blur(26px);
    backdrop-filter: blur(26px);
    animation: authIn 0.6s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.auth-console::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(191, 148, 255, 0.5), transparent 28%, transparent 72%, rgba(103, 232, 249, 0.24));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    opacity: 0.65;
    pointer-events: none;
    z-index: 3;
}

@keyframes authIn {
    from { opacity: 0; transform: translateY(20px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.console-top {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.016);
}

.console-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none;
}

.console-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2a2735;
}

.console-dots span:nth-child(1) { background: #fb7185; }
.console-dots span:nth-child(2) { background: #fbbf24; }
.console-dots span:nth-child(3) { background: #4ade80; }

.console-url {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--auth-mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    color: #6f6a80;
}

.console-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    padding: 4px 8px;
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: 999px;
    background: rgba(74, 222, 128, 0.05);
    color: #86efac;
    font-family: var(--auth-mono);
    font-size: 0.52rem;
    font-weight: 600;
    letter-spacing: 0.12em;
}

.console-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--auth-green);
    box-shadow: 0 0 9px var(--auth-green);
    animation: authPulse 1.8s ease-in-out infinite;
}

@keyframes authPulse {
    0%, 100% { opacity: 0.55; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1.1); }
}

.console-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    align-items: stretch;
}

.console-rail {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(28px, 4vw, 46px);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background:
        radial-gradient(620px 420px at 16% 0%, rgba(145, 70, 255, 0.20), transparent 64%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent 55%);
}

.console-rail::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.018) 0px, rgba(255, 255, 255, 0.018) 1px, transparent 1px, transparent 5px);
    opacity: 0.35;
}

.console-rail > * {
    position: relative;
    z-index: 1;
}

.console-main {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(24px, 3.6vw, 40px);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent 40%);
}

.brand-line {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}

.brand-line img {
    width: 42px;
    height: 42px;
    display: block;
    filter: drop-shadow(0 0 14px rgba(145, 70, 255, 0.55));
}

.brand-name {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
}

.brand-name span {
    color: var(--auth-purple-soft);
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border: 1px solid rgba(74, 222, 128, 0.22);
    border-radius: 999px;
    background: rgba(74, 222, 128, 0.06);
    color: #86efac;
    font-family: var(--auth-mono);
    font-size: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.brand-pill-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--auth-green);
    box-shadow: 0 0 8px var(--auth-green);
}

.brand-kicker {
    font-family: var(--auth-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--auth-cyan);
    margin-bottom: 11px;
}

.brand-title {
    font-size: clamp(2rem, 3.2vw, 2.85rem);
    font-weight: 700;
    letter-spacing: -0.055em;
    line-height: 1.03;
    margin: 0 0 14px;
}

.brand-title .grad {
    background: linear-gradient(108deg, #ffffff 0%, #d7c8ff 46%, #67e8f9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-sub {
    max-width: 40ch;
    color: var(--auth-muted);
    font-size: 0.9rem;
    line-height: 1.65;
}

.brand-terminal {
    margin-top: 24px;
    padding: 15px 16px;
    border: 1px solid var(--auth-line);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.terminal-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2a2735;
}

.terminal-dot:nth-child(1) { background: #fb7185; }
.terminal-dot:nth-child(2) { background: #fbbf24; }
.terminal-dot:nth-child(3) { background: #4ade80; }

.terminal-label {
    margin-left: auto;
    font-family: var(--auth-mono);
    font-size: 0.54rem;
    letter-spacing: 0.08em;
    color: #625e70;
}

.terminal-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    font-family: var(--auth-mono);
    font-size: 0.64rem;
    color: #7e798e;
}

.terminal-line:last-child {
    border-bottom: 0;
}

.terminal-line b {
    color: var(--auth-green);
    font-weight: 600;
}

.terminal-cursor {
    color: var(--auth-cyan);
    animation: authBlink 1.2s steps(2, start) infinite;
}

@keyframes authBlink {
    50% { opacity: 0; }
}

.brand-features {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 20px;
}

.brand-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--auth-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.028);
    color: #c9c5d6;
    font-size: 0.7rem;
    font-weight: 600;
}

.brand-chip svg {
    width: 13px;
    height: 13px;
    flex: none;
    fill: none;
    stroke: var(--auth-green);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-trust {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 20px;
    color: #777385;
    font-size: 0.68rem;
}

.brand-trust svg {
    width: 13px;
    height: 13px;
    flex: none;
    fill: none;
    stroke: var(--auth-cyan);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--auth-line);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.024);
}

.auth-tab {
    flex: 1;
    padding: 9px 10px;
    border-radius: 9px;
    color: #8f8a9f;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.auth-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
}

.auth-tab.active {
    background: linear-gradient(135deg, rgba(191, 148, 255, 0.95), rgba(145, 70, 255, 0.95));
    color: #fff;
    box-shadow: 0 10px 24px -14px rgba(145, 70, 255, 0.85);
}

.auth-head {
    margin-bottom: 18px;
}

.auth-kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
    font-family: var(--auth-mono);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--auth-cyan);
}

.auth-kicker::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--auth-green);
    box-shadow: 0 0 10px var(--auth-green);
}

.auth-title {
    font-size: clamp(1.65rem, 2.7vw, 2.05rem);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 1.08;
    margin: 0 0 7px;
}

.auth-sub {
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.86rem;
    line-height: 1.5;
}

.error-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    margin-bottom: 16px;
    border: 1px solid rgba(251, 113, 133, 0.3);
    border-radius: 13px;
    background: rgba(251, 113, 133, 0.08);
    color: #fecdd3;
    font-size: 0.8rem;
    line-height: 1.45;
}

.error-message i {
    color: var(--auth-red);
    margin-top: 2px;
    flex: none;
}

.field {
    margin-bottom: 14px;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.field-grid .field {
    margin-bottom: 0;
}

.field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-family: var(--auth-mono);
    font-size: 0.58rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: #8f8a9f;
}

.field-box {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 0 13px;
    border: 1px solid var(--auth-line);
    border-radius: 13px;
    background: rgba(10, 9, 16, 0.62);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field-box:focus-within {
    border-color: rgba(145, 70, 255, 0.62);
    background: rgba(12, 11, 20, 0.84);
    box-shadow: 0 0 0 4px rgba(145, 70, 255, 0.12), 0 0 28px rgba(145, 70, 255, 0.10);
}

.field-icon {
    width: 17px;
    height: 17px;
    flex: none;
    display: block;
    fill: none;
    stroke: #6f6a80;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s;
}

.field-box:focus-within .field-icon {
    stroke: var(--auth-purple-soft);
}

.field-input {
    flex: 1;
    min-width: 0;
    padding: 13px 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    font-family: var(--auth-sans);
    font-size: 0.9rem;
}

.field-input::placeholder {
    color: #5d596b;
}

.toggle-password {
    width: 29px;
    height: 29px;
    flex: none;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #8f8a9f;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-password:hover {
    color: #fff;
    background: rgba(145, 70, 255, 0.16);
    border-color: rgba(145, 70, 255, 0.35);
}

.toggle-password i {
    font-size: 0.78rem;
}

.verify-row {
    display: grid;
    grid-template-columns: 1.12fr 0.88fr;
    gap: 10px;
    align-items: stretch;
}

.captcha-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px;
    border: 1px solid var(--auth-line);
    border-radius: 13px;
    background: rgba(10, 9, 16, 0.62);
}

.captcha-image-wrap {
    flex: 1;
    min-width: 0;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 9px;
    background: #000;
}

.captcha-image-wrap svg {
    width: 100%;
    height: 100%;
    display: block;
}

.captcha-refresh-btn {
    width: 38px;
    height: 38px;
    flex: none;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.04);
    color: #a7a2b8;
    cursor: pointer;
    transition: all 0.2s;
}

.captcha-refresh-btn:hover {
    color: #fff;
    background: rgba(145, 70, 255, 0.16);
    border-color: rgba(145, 70, 255, 0.35);
}

.captcha-refresh-btn i {
    font-size: 0.85rem;
}

.captcha-input-box {
    margin-top: 0;
}

.pw-strength {
    font-family: var(--auth-mono);
    font-size: 0.54rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6f6a80;
    transition: color 0.2s;
}

.pw-strength[data-level="weak"] { color: var(--auth-red); }
.pw-strength[data-level="fair"] { color: #fbbf24; }
.pw-strength[data-level="good"] { color: var(--auth-cyan); }
.pw-strength[data-level="strong"] { color: var(--auth-green); }

.pw-rules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 12px;
    margin: 8px 0 12px;
    padding: 10px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.055);
    list-style: none;
}

.pw-rules li {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.67rem;
    color: #6f6a80;
    transition: color 0.2s;
}

.pw-rules li i {
    font-size: 0.6rem;
    color: #45414f;
    transition: color 0.2s;
}

.pw-rules li.ok {
    color: #9a96ab;
}

.pw-rules li.ok i {
    color: var(--auth-green);
}

.pw-mismatch {
    display: none;
    margin-top: 5px;
    color: var(--auth-red);
    font-size: 0.68rem;
}

.pw-mismatch.show {
    display: block;
}

.submit-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 4px;
    padding: 14px 18px;
    border: 0;
    border-radius: 13px;
    background: linear-gradient(135deg, #BF94FF, #9146FF 55%, #772CE8);
    color: #fff;
    font-family: var(--auth-sans);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 18px 40px -18px rgba(145, 70, 255, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform 0.2s, filter 0.2s, box-shadow 0.2s;
}

.submit-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 22px 48px -18px rgba(145, 70, 255, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.submit-btn svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.switch {
    margin-top: 15px;
    text-align: center;
    color: #8f8a9f;
    font-size: 0.8rem;
}

.switch a {
    color: var(--auth-purple-soft);
    font-weight: 700;
    text-decoration: none;
}

.switch a:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-quick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 17px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-quick a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    border: 1px solid var(--auth-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.025);
    color: #8f8a9f;
    font-size: 0.68rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.auth-quick a:hover {
    color: #fff;
    border-color: rgba(145, 70, 255, 0.35);
    background: rgba(145, 70, 255, 0.10);
    transform: translateY(-1px);
}

.auth-quick a i {
    font-size: 0.7rem;
}

.auth-quick .quick-backup {
    width: 28px;
    height: 28px;
    padding: 4px;
    justify-content: center;
}

.auth-quick .quick-backup svg,
.auth-quick .quick-backup img,
.auth-quick .quick-backup .tg-logo {
    width: 18px;
    height: 18px;
    display: block;
    border-radius: 50%;
}

.auth-tiny {
    margin-top: 12px;
    text-align: center;
    font-family: var(--auth-mono);
    font-size: 0.54rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #5d596b;
}

.auth-tiny span {
    color: var(--auth-green);
}

@media (max-width: 900px) {
    body {
        align-items: flex-start;
        padding: 18px 14px 86px;
    }

    .auth-console {
        max-width: 580px;
        border-radius: 26px;
    }

    .console-grid {
        grid-template-columns: 1fr;
    }

    .console-rail {
        padding: 24px 22px 22px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .brand-line {
        margin-bottom: 16px;
    }

    .brand-title {
        font-size: 2.1rem;
    }

    .brand-sub {
        font-size: 0.85rem;
    }

    .brand-terminal,
    .brand-features,
    .brand-trust {
        display: none;
    }

    .console-main {
        padding: 22px 20px 24px;
    }
}

@media (max-width: 560px) {
    .console-url {
        display: none;
    }

    .field-grid,
    .verify-row {
        grid-template-columns: 1fr;
    }

    .pw-rules {
        grid-template-columns: 1fr;
    }

    .brand-pill {
        display: none;
    }

    .auth-quick a {
        font-size: 0.64rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-console,
    .console-status::before,
    .terminal-cursor {
        animation: none;
    }

    .submit-btn,
    .auth-quick a {
        transition: none;
    }
}
