/* ============================================
   MemoryBox Gate — Identity Verification
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

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

:root {
    --bg: #08080e;
    --surface: rgba(255,255,255,0.03);
    --surface-hover: rgba(255,255,255,0.06);
    --surface-active: rgba(139,92,246,0.10);
    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.12);
    --border-active: rgba(139,92,246,0.40);
    --text: #e4e4eb;
    --text-dim: #5a5a72;
    --text-muted: #3a3a50;
    --purple: #8b5cf6;
    --purple-glow: rgba(139,92,246,0.25);
    --pink: #d946ef;
    --pink-glow: rgba(217,70,239,0.15);
    --error: #f43f5e;
    --error-bg: rgba(244,63,94,0.08);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Noto Sans SC', 'Outfit', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ====== Particle Canvas ====== */
#bgCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ====== Main Container ====== */
.gate {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 24px;
    width: 100%;
    max-width: 440px;
    animation: gateIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes gateIn {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ====== Brand ====== */
.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.brand-icon {
    position: relative;
    width: 72px;
    height: 72px;
}

.brain-core {
    position: absolute;
    top: 50%; left: 50%;
    width: 28px; height: 28px;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--purple), var(--pink));
    border-radius: 50%;
    box-shadow: 0 0 30px var(--purple-glow), 0 0 60px var(--pink-glow);
    animation: corePulse 3s ease-in-out infinite;
}

@keyframes corePulse {
    0%, 100% { box-shadow: 0 0 30px var(--purple-glow), 0 0 60px var(--pink-glow); transform: translate(-50%,-50%) scale(1); }
    50%      { box-shadow: 0 0 40px var(--purple-glow), 0 0 80px var(--pink-glow); transform: translate(-50%,-50%) scale(1.08); }
}

.orbit {
    position: absolute;
    top: 50%; left: 50%;
    border: 1px solid rgba(139,92,246,0.12);
    border-radius: 50%;
    animation: spin 12s linear infinite;
}
.orbit::after {
    content: '';
    position: absolute;
    width: 5px; height: 5px;
    background: var(--purple);
    border-radius: 50%;
    top: -2.5px; left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 8px var(--purple-glow);
}

.o1 { width: 52px; height: 52px; margin: -26px 0 0 -26px; animation-duration: 8s; }
.o2 { width: 64px; height: 64px; margin: -32px 0 0 -32px; animation-duration: 12s; animation-direction: reverse; }
.o2::after { background: var(--pink); box-shadow: 0 0 8px var(--pink-glow); }
.o3 { width: 72px; height: 72px; margin: -36px 0 0 -36px; animation-duration: 18s; border-color: rgba(217,70,239,0.08); }
.o3::after { width: 3px; height: 3px; top: -1.5px; background: rgba(255,255,255,0.3); box-shadow: none; }

@keyframes spin { to { transform: rotate(360deg); } }

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, #e4e4eb 30%, var(--purple) 70%, var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-tagline {
    font-size: 12.5px;
    font-weight: 300;
    color: var(--text-dim);
    letter-spacing: 2px;
}

/* ====== Role Cards ====== */
.role-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    width: 100%;
    animation: gateIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.role-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 16px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
    overflow: hidden;
}

.role-card:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    color: var(--text);
    transform: translateY(-2px);
}

.role-card.active {
    background: var(--surface-active);
    border-color: var(--border-active);
    color: var(--text);
    transform: translateY(-2px);
}

/* Internal glow for active card */
.card-glow {
    position: absolute;
    inset: 0;
    border-radius: 18px;
    opacity: 0;
    transition: opacity 0.4s;
    background: radial-gradient(ellipse at 50% 0%, var(--purple-glow), transparent 70%);
    pointer-events: none;
}
.role-card.active .card-glow {
    opacity: 1;
}

.card-icon {
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    transition: all 0.35s;
}
.role-card:hover .card-icon,
.role-card.active .card-icon {
    background: rgba(139,92,246,0.08);
    border-color: rgba(139,92,246,0.20);
}
.role-card.active .card-icon svg {
    stroke: var(--purple);
    filter: drop-shadow(0 0 6px var(--purple-glow));
}

.card-label {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card-hint {
    font-size: 11.5px;
    font-weight: 300;
    color: var(--text-muted);
    transition: color 0.3s;
}
.role-card:hover .card-hint,
.role-card.active .card-hint {
    color: var(--text-dim);
}

/* ====== Auth Section ====== */
.auth-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: authIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.auth-role-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 10px;
    background: rgba(139,92,246,0.06);
    border: 1px solid rgba(139,92,246,0.15);
    border-radius: 20px;
    font-size: 12.5px;
    color: var(--purple);
    font-weight: 500;
}

.auth-role-icon {
    font-size: 14px;
}

.auth-back {
    display: flex; align-items: center; justify-content: center;
    width: 20px; height: 20px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-dim);
    cursor: pointer;
    margin-left: 2px;
    transition: all 0.2s;
}
.auth-back:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text);
}

.auth-input-wrap {
    width: 100%;
    display: flex;
    gap: 10px;
    position: relative;
}

.auth-input-wrap input {
    flex: 1;
    padding: 14px 18px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
    letter-spacing: 2px;
}
.auth-input-wrap input:focus {
    border-color: rgba(139,92,246,0.35);
    background: rgba(139,92,246,0.03);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.06);
}
.auth-input-wrap input::placeholder {
    color: var(--text-muted);
    letter-spacing: 0;
    font-size: 14px;
}

.auth-submit {
    width: 52px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--purple), #7c3aed);
    border: none;
    border-radius: 14px;
    color: white;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}
.auth-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.1));
    opacity: 0;
    transition: opacity 0.25s;
}
.auth-submit:hover::before { opacity: 1; }
.auth-submit:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 20px var(--purple-glow);
}
.auth-submit:active {
    transform: scale(0.97);
}

/* Loading state */
.auth-submit.loading svg {
    display: none;
}
.auth-submit.loading::after {
    content: '';
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* Error */
.auth-error {
    font-size: 12.5px;
    color: var(--error);
    background: var(--error-bg);
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid rgba(244,63,94,0.12);
    animation: errIn 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes errIn {
    0%   { opacity: 0; transform: translateY(4px) scale(0.98); }
    40%  { transform: translateX(-4px); }
    60%  { transform: translateX(4px); }
    80%  { transform: translateX(-2px); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

/* ====== Utility ====== */
.hidden { display: none !important; }

/* ====== Mobile ====== */
@media (max-width: 480px) {
    .gate { gap: 32px; padding: 20px 16px; }
    .brand-icon { width: 60px; height: 60px; }
    .brain-core { width: 22px; height: 22px; }
    .o1 { width: 42px; height: 42px; margin: -21px 0 0 -21px; }
    .o2 { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
    .o3 { width: 60px; height: 60px; margin: -30px 0 0 -30px; }
    .brand-name { font-size: 24px; }
    .role-card { padding: 24px 12px 22px; border-radius: 14px; }
    .card-icon { width: 44px; height: 44px; border-radius: 12px; }
    .auth-input-wrap input { padding: 12px 16px; font-size: 14px; border-radius: 12px; }
    .auth-submit { width: 48px; border-radius: 12px; }
}

@media (max-height: 600px) {
    .gate { gap: 24px; }
    .brand-icon { width: 52px; height: 52px; }
    .brand-tagline { display: none; }
    .role-card { padding: 20px 12px 18px; }
}
