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

:root {
    --bg: #000000;
    --surface: #0d0d0d;
    --surface-2: #161616;
    --border: #262626;
    --text: #f5f5f5;
    --text-dim: #8a8a8a;
    --accent: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 32px;
    animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
    justify-content: center;
}

.brand svg {
    width: 28px;
    height: 28px;
}

.brand span {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 6px;
    text-align: center;
}

.subtitle {
    font-size: 14px;
    color: var(--text-dim);
    text-align: center;
    margin-bottom: 28px;
}

.field {
    position: relative;
    margin-bottom: 16px;
}

.field svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--text-dim);
    transition: stroke 0.2s ease;
    pointer-events: none;
}

.field input {
    width: 100%;
    padding: 13px 14px 13px 42px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.field input:focus + svg,
.field:has(input:focus) svg {
    stroke: var(--accent);
}

.toggle-eye {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
}

.toggle-eye svg {
    position: static;
    width: 18px;
    height: 18px;
    stroke: var(--text-dim);
}

.btn {
    width: 100%;
    padding: 13px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}

.btn:hover {
    opacity: 0.85;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn .spinner {
    width: 16px;
    height: 16px;
    display: none;
    animation: spin 0.7s linear infinite;
}

.btn.loading .spinner {
    display: block;
}

.btn.loading .btn-label {
    display: none;
}

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

.error-box {
    background: rgba(255, 80, 80, 0.1);
    border: 1px solid rgba(255, 80, 80, 0.3);
    color: #ff8080;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: none;
    align-items: center;
    gap: 8px;
    animation: shake 0.4s ease;
}

.error-box.show {
    display: flex;
}

.error-box svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: #ff8080;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.switch-link {
    text-align: center;
    margin-top: 22px;
    font-size: 13px;
    color: var(--text-dim);
}

.switch-link a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.switch-link a:hover {
    opacity: 0.7;
}

.hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: -10px;
    margin-bottom: 16px;
    padding-left: 2px;
}

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    z-index: 10;
}

.topbar .brand span {
    font-size: 17px;
}

.topbar .brand svg {
    width: 22px;
    height: 22px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 6px 8px 6px 14px;
    border-radius: 24px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.user-pill span {
    font-size: 14px;
    font-weight: 500;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.icon-btn {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: var(--text);
}

.auth-actions {
    display: flex;
    gap: 10px;
}

.btn-ghost {
    padding: 9px 18px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.btn-ghost:hover {
    border-color: var(--text-dim);
    background: var(--surface-2);
}

.btn-solid {
    padding: 9px 18px;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 8px;
    color: #000;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.btn-solid:hover {
    opacity: 0.85;
}

.main-content {
    padding-top: 96px;
    max-width: 720px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
    text-align: center;
    animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.hero-sub {
    font-size: 15px;
    color: var(--text-dim);
    line-height: 1.6;
}

.skeleton {
    width: 100px;
    height: 32px;
    background: var(--surface-2);
    border-radius: 24px;
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@media (max-width: 480px) {
    .card {
        padding: 32px 22px;
        border-radius: 14px;
    }

    .topbar {
        padding: 14px 16px;
    }

    .user-pill span {
        display: none;
    }

    .hero-title {
        font-size: 24px;
    }

    .auth-actions {
        gap: 8px;
    }

    .btn-ghost, .btn-solid {
        padding: 8px 14px;
        font-size: 12px;
    }
}
