/* NEONIX gate shell — index / login / register / recovery / settings / master SSOT */
:root {
    --shell-max: 860px;
    --shell-pad-x: 16px;
    --shell-pad-y: 12px;
    --shell-header-offset: 84px;
    --gate-card-max: 420px;
    --gate-card-pad-y: 36px;
    --gate-card-pad-x: 24px;
    --gate-main-pad-top: 16px;
    --gate-main-pad-bottom: 24px;
    --gate-viewport: 100dvh;
    --bg-main: #08090a;
    --bg-base: #08090a;
    --surface-1: #0f1012;
    --surface-2: #17181c;
    --surface-3: #22242a;
    --hairline: rgba(255, 255, 255, 0.07);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f7f8f8;
    --text-sub: #8a8f98;
    --text-dim: #5c6068;
    --neon-cyan: #38bdf8;
    --neon-blue: #38bdf8;
    --neon-green: #34d399;
    --neon-gold: #fbbf24;
    --neon-amber: #fbbf24;
    --neon-red: #f87171;
    --neon-purple: #a855f7;
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-bg: rgba(15, 16, 18, 0.88);
    --glass-bg-solid: #0f1012;
}

.gate-body {
    margin: 0;
    padding: var(--shell-pad-x) var(--shell-pad-x) var(--shell-pad-y);
    min-height: 100vh;
    min-height: var(--gate-viewport);
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Pretendard', -apple-system, sans-serif;
    word-break: keep-all;
    overflow-x: hidden;
    box-sizing: border-box;
    position: relative;
}

/* Living backdrop — slow-drifting neon aurora behind the grid */
.gate-body::before {
    display: none;
    content: "";
    position: fixed;
    inset: -25%;
    z-index: -1;
    pointer-events: none;
    background-repeat: no-repeat;
    background-image:
        radial-gradient(closest-side, rgba(139, 92, 246, 0.30), transparent 70%),
        radial-gradient(closest-side, rgba(34, 211, 238, 0.24), transparent 70%);
    background-size: 60% 60%, 52% 52%;
    background-position: 12% 16%, 86% 84%;
    filter: blur(36px);
    animation: gateAurora 22s ease-in-out infinite alternate;
}

@keyframes gateAurora {
    0%   { background-position: 8% 14%, 90% 86%; }
    50%  { background-position: 32% 46%, 62% 56%; }
    100% { background-position: 20% 78%, 80% 22%; }
}

/* Perspective floor — faint receding grid for depth (NEONIX cyan/purple) */
.gate-body::after {
    display: none;
    content: "";
    position: fixed;
    left: -50%;
    right: -50%;
    bottom: -6%;
    height: 48vh;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(to top, rgba(34, 211, 238, 0.12), transparent 75%),
        repeating-linear-gradient(to right, rgba(124, 200, 255, 0.16) 0 1px, transparent 1px 58px),
        repeating-linear-gradient(to bottom, rgba(124, 200, 255, 0.16) 0 1px, transparent 1px 58px);
    -webkit-mask: linear-gradient(to top, #000 5%, transparent 90%);
            mask: linear-gradient(to top, #000 5%, transparent 90%);
    transform: perspective(540px) rotateX(67deg);
    transform-origin: bottom center;
}

/* Brand symbol — NEONIX hexagon circuit mark, sits above the wordmark */
.brand-mark {
    display: block;
    width: clamp(44px, 13vw, 52px);
    height: clamp(44px, 13vw, 52px);
    margin: 0 auto 14px;
    filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.45)) drop-shadow(0 0 18px rgba(139, 92, 246, 0.30));
}

.gate-body *,
.gate-body *::before,
.gate-body *::after {
    box-sizing: border-box;
}

.wrapper {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: 0 0 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    min-height: calc(100vh - (var(--shell-pad-x) * 2));
    min-height: calc(var(--gate-viewport) - (var(--shell-pad-x) * 2));
}

.wrapper--solo {
    justify-content: center;
}

.header-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0 0 16px;
    margin: 0 0 20px;
    background: transparent;
    border-bottom: 1px solid var(--glass-border);
    min-height: 44px;
    flex-shrink: 0;
}

.shell-title {
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--text-sub);
    text-align: center;
    line-height: 1.3;
}

.nav-btn-v2 {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 7px 11px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-sub);
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    cursor: pointer;
}

.back-btn-v2 { left: 0; }
.back-btn-v2:hover {
    color: var(--neon-blue);
    border-color: rgba(0, 225, 255, 0.35);
    background: rgba(0, 225, 255, 0.05);
}

.logout-btn-v2 { right: 0; }
.logout-btn-v2:hover {
    color: var(--neon-red);
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.06);
}

.header-nav-spacer {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    visibility: hidden;
    pointer-events: none;
}

.gate-main {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gate-main--center {
    justify-content: center;
    padding: var(--gate-main-pad-top) 0 var(--gate-main-pad-bottom);
    min-height: calc(100vh - var(--shell-header-offset));
    min-height: calc(var(--gate-viewport) - var(--shell-header-offset));
}

.gate-main--scroll {
    justify-content: flex-start;
    padding: var(--gate-main-pad-top) 0 var(--gate-main-pad-bottom);
    min-height: calc(100vh - var(--shell-header-offset));
    min-height: calc(var(--gate-viewport) - var(--shell-header-offset));
}

.gate-main--solo {
    justify-content: center;
    padding: var(--gate-main-pad-top) 0 var(--gate-main-pad-bottom);
    min-height: calc(100vh - (var(--shell-pad-x) * 2) - 40px);
    min-height: calc(var(--gate-viewport) - (var(--shell-pad-x) * 2) - 40px);
}

.gate-card {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: var(--gate-card-pad-y) var(--gate-card-pad-x);
    width: 100%;
    max-width: var(--gate-card-max);
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(139, 92, 246, 0.16),
        0 0 24px rgba(34, 211, 238, 0.10);
}

/* Glowing gradient border ring — cyan→purple, drawn via masked padding */
.gate-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1.5px;
    background: linear-gradient(135deg,
        rgba(34, 211, 238, 0.55) 0%,
        rgba(99, 152, 246, 0.50) 50%,
        rgba(139, 92, 246, 0.55) 100%);
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    z-index: 1;
}

.gate-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: 16px 0 8px;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.35);
    font-weight: 500;
}

@media (max-width: 600px) {
    :root {
        --shell-header-offset: 72px;
        --gate-card-pad-y: 28px;
        --gate-card-pad-x: 20px;
        --gate-main-pad-top: 8px;
        --gate-main-pad-bottom: 20px;
    }

    .gate-body {
        padding: 12px 12px 8px;
    }

    .wrapper {
        padding: 0 0 8px;
        min-height: calc(100vh - 24px);
        min-height: calc(var(--gate-viewport) - 24px);
    }

    .header-nav {
        padding: 0 0 12px;
        margin: 0 0 16px;
        min-height: 44px;
    }

    .shell-title {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 52%;
    }

    /* 5px/0.68rem 이면 실측 높이 24px — 손가락으로 누르기엔 작다(권장 44px).
       헤더라 44 까지 키우면 답답해지므로 34px 선에서 타협한다. */
    .nav-btn-v2 {
        padding: 9px 10px;
        font-size: 0.72rem;
    }

    .back-btn-v2 { left: 0; }
    .logout-btn-v2 { right: 0; }

    .gate-main--center,
    .gate-main--scroll {
        justify-content: flex-start;
    }

    .gate-main--solo {
        min-height: calc(100vh - 32px);
        min-height: calc(var(--gate-viewport) - 32px);
    }
}


/* ═══════════════════════════════════════════════
   NEONIX UI Utilities — toast / spinner / pw-toggle / input-error
   ═══════════════════════════════════════════════ */

/* ── Toast ── */
#toast-container {
    position: fixed;
    bottom: 28px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
    max-width: calc(100vw - 40px);
}
.nx-toast {
    background: rgba(15, 16, 18, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 14px 18px;
    color: var(--text-main, #f7f8f8);
    font-family: 'Pretendard', -apple-system, sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.5;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
    pointer-events: auto;
    min-width: 200px;
    max-width: 340px;
    word-break: keep-all;
    animation: nxToastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.nx-toast--success { border-color: rgba(16, 185, 129, 0.5); }
.nx-toast--error   { border-color: rgba(239, 68, 68, 0.5); }
.nx-toast--info    { border-color: rgba(34, 211, 238, 0.4); }
.nx-toast--out     { animation: nxToastOut 0.25s ease forwards; }
@keyframes nxToastIn  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes nxToastOut { to   { opacity: 0; transform: translateX(16px); } }

@media (max-width: 600px) {
    #toast-container { right: 12px; left: 12px; bottom: 20px; max-width: none; }
    .nx-toast { min-width: 0; max-width: none; }
    @keyframes nxToastIn  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
    @keyframes nxToastOut { to   { opacity: 0; transform: translateY(10px); } }
}

/* ── Button loading state ── */
.btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: nxSpin 0.6s linear infinite;
    vertical-align: middle;
    margin-left: 8px;
    flex-shrink: 0;
}
@keyframes nxSpin { to { transform: rotate(360deg); } }
.btn--loading { pointer-events: none; opacity: 0.8; cursor: not-allowed; }
.btn--loading .btn-label { opacity: 0.75; }
.btn--loading .btn-spinner { display: inline-block; }

/* ── Password toggle ── */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px !important; }
.pw-toggle-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-sub, #94a3b8);
    transition: color 0.2s;
    border-radius: 0 14px 14px 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.pw-toggle-btn:hover { color: var(--neon-cyan, #22d3ee); }

/* ── Input error state ── */
.input-error {
    border-color: rgba(239, 68, 68, 0.65) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08) !important;
}

/* ── Accessibility: honor reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
    .gate-body::before { animation: none; }
}