* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --dark-bg: #0a0a15;
    --darker-bg: #05050a;
    --purple-accent: #7b2cbf;
    --purple-light: #9d4edd;
    --gold: #d4af37;
    --silver: #c0c0c0;
    --text-primary: #e8e4f3;
    --text-secondary: #a89fc4;
    --border-color: #2d0052;
    --input-bg: #1a1a2e;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--darker-bg) 0%, #1a0033 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background decorative elements */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(123, 44, 191, 0.5) 2px, rgba(123, 44, 191, 0.5) 4px);
    pointer-events: none;
    z-index: -1;
}

.glow-orbs {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
    animation: void-pulse 6s ease-in-out infinite;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.1;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--purple-accent) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    animation: float 20s ease-in-out infinite;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--gold) 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
    animation: float 25s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}

@keyframes void-pulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.25; }
}

/* Container Layout */
.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    max-width: 1200px;
    width: 100%;
    align-items: center;
}

/* Info Section */
.info-section {
    z-index: 1;
}

.logo {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--gold) 0%, var(--purple-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    letter-spacing: 2px;
    text-shadow: 0 0 30px rgba(157, 78, 221, 0.3);
}

.tagline {
    font-size: 1.3rem;
    color: var(--purple-light);
    margin-bottom: 30px;
    font-weight: 300;
    letter-spacing: 1px;
}

.description {
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 1.05rem;
}

.features {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

.feature {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    border-left: 3px solid var(--purple-accent);
    background: rgba(123, 44, 191, 0.05);
    border-radius: 4px;
}

.feature-icon {
    color: var(--gold);
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.feature-text {
    flex: 1;
}

.feature-title {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.feature-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Auth Section */
.auth-section {
    z-index: 1;
}

.auth-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 50px;
    box-shadow: 0 20px 60px rgba(123, 44, 191, 0.15);
    backdrop-filter: blur(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 40px;
    border-bottom: 2px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    position: relative;
    transition: color 0.3s ease;
}

.auth-tab.active {
    color: var(--gold);
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gold);
}

.auth-form {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, visibility 0.5s ease;
}

.auth-form.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    max-height: 600px;
}

/* Hide signup-only fields by default (login mode) */
.signup-only {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    margin: 0;
    padding: 0;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                visibility 0.5s ease,
                margin-bottom 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Show signup-only fields when form has signup-mode class */
.auth-form.signup-mode .signup-only {
    max-height: 120px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    margin-bottom: 25px;
}

/* Reuse the same animated reveal pattern for Google account linking password field. */
.google-username-auth-form.password-mode .signup-only {
    max-height: 120px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    margin-bottom: 25px;
}

/* Hide login button in signup mode, hide signup button in login mode */
.submit-btn {
    display: none;
}

.auth-form.active .login-btn {
    display: block;
}

.auth-form.signup-mode .login-btn {
    display: none;
}

.auth-form.signup-mode .signup-btn {
    display: block;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--purple-accent);
    box-shadow: 0 0 15px rgba(123, 44, 191, 0.3);
    background: rgba(123, 44, 191, 0.05);
}

.form-group input.error-state {
    border-color: #ff6b6b;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.2);
    background: rgba(255, 107, 107, 0.02);
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

.password-group {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 16px;
    top: 42px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: var(--purple-light);
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--purple-accent) 0%, var(--purple-light) 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 10px 30px rgba(157, 78, 221, 0.3);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(157, 78, 221, 0.5);
}

.submit-btn:active {
    transform: translateY(0);
}

.merge-header h2 {
    margin: 0 0 10px;
    color: var(--gold);
    font-size: 1.35rem;
}

.merge-accounts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.merge-account-card {
    background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border-primary, var(--border-color));
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.merge-account-card:hover {
    border-color: var(--gold);
    transform: translateY(-1px);
}

.merge-account-card.selected {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold), 0 12px 22px rgba(0, 0, 0, 0.24);
}

.merge-account-card h3 {
    margin: 0 0 12px;
    font-size: 1rem;
    color: var(--text-primary);
    text-align: center;
}

.merge-account-card:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.merge-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.merge-row span {
    color: var(--text-secondary);
}

.merge-row strong {
    color: var(--text-primary);
    text-align: right;
    max-width: 65%;
    overflow-wrap: anywhere;
}

.merge-mode .container {
    align-items: stretch;
    padding: 16px 16px 28px;
}

.merge-mode .content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 1160px;
    width: 100%;
    min-height: calc(100vh - 44px);
}

.merge-mode .info-section {
    text-align: center;
    max-width: none;
    padding-top: 6px;
}

.merge-mode .info-section .description,
.merge-mode .info-section .features {
    display: none !important;
}

.merge-mode .auth-section {
    width: 100%;
    flex: 1;
    display: flex;
}

.merge-mode .auth-card {
    width: 100%;
    height: 100%;
    padding: 22px;
    display: flex;
    flex-direction: column;
}

.merge-mode #googleMergeDecision {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.merge-mode .merge-accounts-grid {
    flex: 1;
    align-content: start;
}

.merge-mode .merge-account-card {
    min-height: 100%;
}

#merge-cancel-btn {
    margin-top: 12px;
}

/* OAuth Styles */
.oauth-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.oauth-separator::before,
.oauth-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.oauth-separator span {
    padding: 0 16px;
}

.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.oauth-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.oauth-btn:active {
    transform: translateY(0);
}

.oauth-btn svg {
    flex-shrink: 0;
}

.error-message {
    color: #ff6b6b;
    font-size: 0.9rem;
    margin-top: 8px;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    color: var(--gold);
    font-size: 0.9rem;
    margin-top: 8px;
    display: none;
}

.success-message.show {
    display: block;
}

/* Responsive Design */
@media (max-width: 900px) {
    .container {
        align-items: stretch;
        padding: 8px;
    }

    .content-wrapper {
        display: flex;
        flex-direction: column;
        gap: 24px;
        max-width: none;
        width: 100%;
        min-height: calc(100vh - 16px);
    }

    .logo {
        font-size: 2.5rem;
    }

    .auth-card {
        padding: 28px 16px;
        width: 100%;
    }

    .info-section {
        order: 1;
    }

    .auth-section {
        order: 2;
        margin-top: auto;
        width: 100%;
    }

    .features {
        margin-bottom: 30px;
    }

    .feature {
        padding: 12px;
    }

    .merge-accounts-grid {
        grid-template-columns: 1fr;
    }

    .merge-mode .container {
        padding: 8px 8px 18px;
    }

    .merge-mode .content-wrapper {
        min-height: calc(100vh - 26px);
    }

    .merge-mode .auth-card {
        padding: 18px 14px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 6px;
    }

    .content-wrapper {
        min-height: calc(100vh - 12px);
        max-width: none;
    }

    .auth-card {
        padding: 24px 14px;
        width: 100%;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    animation: fadeIn 0.8s ease-out;
}

/* Loading state */
.submit-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.submit-btn.loading::after {
    content: ' ⏳';
}