:root {
    color-scheme: light;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;
    color: #1a1d1f;
    background: #ffffff;
    font-size: 16px;
    letter-spacing: -0.01em;
}

* { box-sizing: border-box; }
body { 
    margin: 0; min-height: 100vh; display: flex; flex-direction: column; 
    background: radial-gradient(circle at 18% 12%, rgba(0, 98, 255, 0.045) 0%, transparent 45%),
                radial-gradient(circle at 82% 88%, rgba(99, 102, 241, 0.04) 0%, transparent 45%),
                linear-gradient(140deg, #fafbfc 0%, #f1f4f8 100%);
}

.auth-container {
    display: flex; flex: 1; align-items: center; justify-content: center;
    padding: 24px; width: 100%; min-height: 100vh;
}

.auth-card {
    background: #ffffff;
    width: 100%; max-width: 440px;
    border-radius: 28px;
    box-shadow: 0 20px 48px -12px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(226, 232, 240, 0.85);
    display: flex; flex-direction: column;
    position: relative;
    z-index: 10;
}

.header { padding: 40px 40px 20px; display: flex; justify-content: center; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; color: #1a1d1f; text-decoration: none; }
.brand-logo { height: 32px; width: auto; }
.brand span { font-weight: 600; }

main { width: 100%; padding: 20px 40px 40px; display: flex; flex-direction: column; }

h1 { font-size: 32px; line-height: 1.2; margin: 0 0 8px; font-weight: 700; color: #111827; text-align: center; }
.subtitle { color: #6b7280; font-size: 15px; margin-bottom: 32px; text-align: center; }

label { display: block; font-size: 14px; font-weight: 600; margin: 20px 0 8px; color: #374151; }

.input-group { position: relative; }
input {
    width: 100%; height: 52px; padding: 12px 16px 12px 48px;
    border: 1px solid #e5e7eb; border-radius: 12px; background: #fff;
    font: inherit; min-width: 0; transition: all 0.2s ease; color: #1f2937;
}
input:focus { outline: none; border-color: #0d6efd; box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.1); }
.input-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: #9ca3af; pointer-events: none; }

button {
    width: 100%; min-height: 52px; margin-top: 28px; padding: 12px 16px;
    background: #0062ff; color: white; border: none; border-radius: 12px;
    font: inherit; font-weight: 600; font-size: 16px; cursor: pointer;
    transition: all 0.2s ease; box-shadow: 0 4px 12px rgba(0, 98, 255, 0.2);
}
button:hover { background: #0056e0; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 98, 255, 0.25); }
button:active { transform: translateY(1px); }

.secondary { background: #ffffff; color: #374151; border: 1px solid #e5e7eb; box-shadow: 0 2px 4px rgba(0,0,0,0.02); margin-top: 16px; }
.secondary:hover { background: #f9fafb; border-color: #d1d5db; }
.secondary:disabled { opacity: 0.7; cursor: not-allowed; background: #f3f4f6; color: #9ca3af; border-color: #e5e7eb; transform: none; box-shadow: none; }

a { color: #0062ff; text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }

.switch { font-size: 14px; text-align: center; margin-top: 32px; color: #6b7280; }

.divider { display: flex; align-items: center; text-align: center; margin: 32px 0; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid #e5e7eb; }
.divider span { padding: 0 16px; color: #9ca3af; font-size: 14px; }

.social-buttons { display: flex; justify-content: center; gap: 16px; }
.social-btn {
    width: 52px; height: 52px; min-height: 52px; margin: 0; padding: 0;
    border-radius: 50%; background: #fff; border: 1px solid #e5e7eb;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02); transition: all 0.2s;
}
.social-btn:hover { background: #f9fafb; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.05); border-color: #d1d5db; }
.social-btn.facebook { background: #1877F2; border-color: #1877F2; }

.status, .errors { font-size: 14px; padding: 16px; border-radius: 12px; margin-bottom: 24px; }
.status { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.errors { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.errors p { margin: 0 0 4px; } .errors p:last-child { margin: 0; }

.muted { color: #6b7280; line-height: 1.5; font-size: 15px; }
.identity { font-weight: 700; font-size: 20px; margin-bottom: 4px; text-align: center; }

.otp-container { display: flex; gap: 10px; justify-content: space-between; margin-top: 8px; margin-bottom: 24px; }
.otp-box { width: 100%; height: 56px; padding: 0; text-align: center; font-size: 24px; font-weight: 700; border-radius: 12px; border: 1px solid #e5e7eb; background: #f9fafb; color: #1f2937; transition: all 0.2s; }
.otp-box:focus { outline: none; border-color: #0d6efd; box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.1); background: #fff; }
.resend button { margin-top: 16px; }

/* Account Dashboard Profile */
.account-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 24px;
}
.avatar-wrapper {
    position: relative;
    margin-bottom: 12px;
}
.avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0062ff 0%, #3b82f6 50%, #4f46e5 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    box-shadow: 0 8px 24px -4px rgba(0, 98, 255, 0.35);
}
.avatar-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 15px;
    height: 15px;
    background: #10b981;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.25);
}
.account-name {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 4px;
    line-height: 1.25;
}
.account-email {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 10px;
}
.account-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* App Launcher Section */
.apps-section {
    width: 100%;
    margin-bottom: 20px;
}
.apps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 10px;
    padding: 0 2px;
}
.apps-hint {
    font-size: 11px;
    font-weight: 600;
    color: #0062ff;
    text-transform: none;
    letter-spacing: normal;
}
.apps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}
.app-card {
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    min-height: 72px;
    padding: 12px 14px;
    background: #ffffff;
    text-decoration: none;
    color: #1f2937;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}
.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -6px rgba(15, 23, 42, 0.08);
    text-decoration: none;
}
.app-card-gamez:hover {
    border-color: #f59e0b;
    background: #fffdfa;
}
.app-card-market:hover {
    border-color: #0062ff;
    background: #fbfdff;
}
.app-card-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #edf2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    transition: transform 0.2s ease;
}
.app-card:hover .app-card-icon {
    transform: scale(1.06);
}
.app-card-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}
.app-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.app-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.app-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}
.app-card-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.gamez-tag {
    background: #fef3c7;
    color: #b45309;
}
.market-tag {
    background: #eff6ff;
    color: #1d4ed8;
}
.app-card-arrow {
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, color 0.2s ease;
}
.app-card:hover .app-card-arrow {
    color: #0062ff;
    transform: translateX(3px);
}

/* Logout Form */
.logout-form {
    margin-top: 6px;
    width: 100%;
}
.logout-btn {
    width: 100%;
    min-height: 48px;
    margin-top: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.logout-btn svg {
    color: #94a3b8;
    transition: color 0.2s ease, transform 0.2s ease;
}
.logout-btn:hover {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #e11d48;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.08);
}
.logout-btn:hover svg {
    color: #e11d48;
    transform: translateX(2px);
}
.logout-btn:active {
    transform: translateY(0);
}

footer { display: flex; justify-content: center; align-items: center; gap: 24px; padding: 20px 24px; font-size: 13px; color: #94a3b8; border-top: 1px solid #f1f5f9; background: #fafbfc; border-radius: 0 0 28px 28px; }
footer a { display: flex; align-items: center; gap: 8px; text-decoration: none; color: #64748b; font-weight: 500; font-size: 13px; transition: color 0.2s ease; }
footer a:hover { color: #0f172a; }
footer a img { height: 18px; width: auto; object-fit: contain; }

.auth-toggle { display: flex; background: #f3f4f6; border-radius: 12px; padding: 4px; margin-bottom: 32px; }
.auth-toggle a { flex: 1; text-align: center; padding: 10px; border-radius: 8px; font-size: 14px; font-weight: 600; color: #6b7280; text-decoration: none; transition: all 0.2s; }
.auth-toggle a.active { background: #fff; color: #111827; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

body[data-request-pending] { overflow: hidden; cursor: progress; }
.auth-container[inert] { pointer-events: none; opacity: 0.55; }
.request-overlay {
    position: fixed; inset: 0; z-index: 1000; display: flex;
    flex-direction: column; align-items: center; justify-content: center; gap: 16px;
    background: rgba(255, 255, 255, 0.65); color: #1f2937;
    padding: 24px; font-size: 15px; font-weight: 600; text-align: center; cursor: progress;
}
.request-overlay[hidden] { display: none; }
.request-spinner {
    width: 32px; height: 32px; flex: 0 0 32px;
    border: 3px solid #d1d5db; border-top-color: #0062ff; border-radius: 50%;
    animation: request-spin 0.8s linear infinite;
}
@keyframes request-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .request-spinner { animation: none; } }

@media (max-width: 480px) {
    .auth-container { padding: 16px; }
    .auth-card { border-radius: 24px; }
    .header { padding: 32px 24px 16px; }
    main { padding: 16px 20px 28px; }
    .app-card { padding: 10px 12px; gap: 10px; }
    .app-card-icon { width: 40px; height: 40px; }
}

.google-btn {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    width: 100%; min-height: 52px; padding: 0 16px; box-sizing: border-box;
    border-radius: 12px; background: #fff; border: 1px solid #dadce0;
    color: #1f1f1f; font-weight: 600; font-size: 15px; text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.google-btn:hover { background: #f8faff; border-color: #c6cbd2; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.google-btn:focus-visible { outline: 2px solid #0062ff; outline-offset: 2px; }

.recaptcha-box {
    display: flex;
    justify-content: center;
    margin-top: 22px;
    min-height: 78px;
}
