/* auth.css — Sign in / Sign up page.
   Performance rules: only transform/opacity animations, no backdrop-filter, no blur filters,
   animations stop for prefers-reduced-motion. */
body.route-auth .bottom-nav,
body.route-auth .header-stats { display: none; }

.auth-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; contain: strict; }
.auth-blob { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; opacity: .55; will-change: transform; }
.auth-blob--a { top: -35vmax; inset-inline-start: -25vmax; background: radial-gradient(circle at 50% 50%, rgba(99,102,241,.55), rgba(99,102,241,0) 62%); animation: authDriftA 22s ease-in-out infinite alternate; }
.auth-blob--b { bottom: -40vmax; inset-inline-end: -30vmax; background: radial-gradient(circle at 50% 50%, rgba(236,72,153,.38), rgba(236,72,153,0) 62%); animation: authDriftB 26s ease-in-out infinite alternate; }
.auth-blob--c { top: 30%; inset-inline-start: 35%; width: 45vmax; height: 45vmax; background: radial-gradient(circle at 50% 50%, rgba(45,212,191,.28), rgba(45,212,191,0) 62%); animation: authDriftA 30s ease-in-out infinite alternate-reverse; }
@keyframes authDriftA { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(8vmax,6vmax,0) scale(1.12); } }
@keyframes authDriftB { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(-7vmax,-5vmax,0) scale(1.1); } }

.auth-word { position: absolute; font-weight: 700; letter-spacing: .02em; color: var(--accent-primary); opacity: .13; font-size: 1.3rem; will-change: transform; animation: authFloat 14s ease-in-out infinite alternate; }
.auth-word--1 { top: 10%; inset-inline-start: 8%; animation-delay: -2s; }
.auth-word--2 { top: 22%; inset-inline-end: 10%; font-size: 1.7rem; animation-delay: -6s; }
.auth-word--3 { top: 48%; inset-inline-start: 4%; font-size: 1.1rem; animation-delay: -9s; }
.auth-word--4 { top: 62%; inset-inline-end: 6%; animation-delay: -4s; }
.auth-word--5 { bottom: 14%; inset-inline-start: 14%; font-size: 1.5rem; animation-delay: -11s; }
.auth-word--6 { bottom: 8%; inset-inline-end: 20%; font-size: 1.15rem; animation-delay: -7s; }
@keyframes authFloat { from { transform: translate3d(0,0,0) rotate(-4deg); } to { transform: translate3d(0,-26px,0) rotate(4deg); } }

.auth-wrap { position: relative; z-index: 1; display: grid; place-items: start center; padding-block: var(--space-4); }
.auth-card { width: 100%; max-width: 440px; display: grid; gap: var(--space-4); padding: var(--space-5, 1.25rem); border-radius: 26px; background: var(--surface-elevated); border: 1px solid var(--border-subtle); box-shadow: 0 18px 50px -18px rgba(79,70,229,.35), 0 2px 10px rgba(15,23,42,.06); animation: authRise .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes authRise { from { opacity: 0; transform: translate3d(0,22px,0) scale(.98); } to { opacity: 1; transform: none; } }

.auth-head { text-align: center; display: grid; gap: 6px; justify-items: center; }
.auth-head h1 { margin: 0; font-size: 1.35rem; background: linear-gradient(90deg, var(--accent-primary), #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-sub { margin: 0; color: var(--text-muted); font-size: var(--text-sm); line-height: 1.8; }
.auth-logo { position: relative; width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #ec4899); box-shadow: 0 10px 24px -8px rgba(99,102,241,.7); animation: authBob 4s ease-in-out infinite; }
.auth-logo::after { content: ''; position: absolute; inset: -6px; border-radius: 24px; border: 2px solid rgba(99,102,241,.45); animation: authPing 2.6s ease-out infinite; }
@keyframes authBob { 0%,100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(0,-5px,0); } }
@keyframes authPing { from { opacity: .7; transform: scale(.92); } to { opacity: 0; transform: scale(1.35); } }

.auth-head > *, .auth-tabs, .auth-form > *, .auth-link, .auth-skip { animation: authRise .5s cubic-bezier(.2,.8,.2,1) both; }
.auth-head > :nth-child(2) { animation-delay: .06s; } .auth-head > :nth-child(3) { animation-delay: .1s; }
.auth-tabs { animation-delay: .14s; }
.auth-form > :nth-child(1) { animation-delay: .18s; } .auth-form > :nth-child(2) { animation-delay: .22s; }
.auth-form > :nth-child(4) { animation-delay: .26s; } .auth-form > :nth-child(5) { animation-delay: .3s; }
.auth-link { animation-delay: .34s; } .auth-skip { animation-delay: .38s; }

.auth-tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 16px; background: var(--surface-muted); }
.auth-tabs::before { content: ''; position: absolute; inset-block: 4px; inset-inline-start: 4px; width: calc(50% - 4px); border-radius: 12px; background: var(--surface-elevated); box-shadow: 0 2px 8px rgba(15,23,42,.14); transition: transform .32s cubic-bezier(.3,.9,.3,1); }
html[dir="rtl"] .auth-tabs[data-mode="up"]::before { transform: translateX(-100%); }
html[dir="ltr"] .auth-tabs[data-mode="up"]::before { transform: translateX(100%); }
.auth-tab { position: relative; min-height: 44px; border: 0; background: transparent; color: var(--text-muted); font: inherit; font-weight: 700; cursor: pointer; transition: color .25s; }
.auth-tab[aria-selected="true"] { color: var(--text-primary); }

.auth-form { display: grid; gap: var(--space-3); }
.auth-field { display: grid; gap: 6px; }
.auth-label { font-weight: 600; font-size: var(--text-sm); }
.auth-input-wrap { position: relative; display: block; direction: ltr; }
.auth-input { width: 100%; min-height: 48px; padding: var(--space-2) var(--space-3); border-radius: 14px; border: 1.5px solid var(--border-subtle); background: var(--surface-muted); color: var(--text-primary); font: inherit; text-align: left; transition: border-color .2s, box-shadow .2s, background .2s; }
.auth-input-wrap .auth-input { padding-inline-end: 48px; }
.auth-input:focus { outline: none; border-color: var(--border-focus); background: var(--surface-elevated); box-shadow: 0 0 0 4px rgba(99,102,241,.18); }
.auth-eye { position: absolute; inset-block: 0; inset-inline-end: 0; width: 46px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; display: grid; place-items: center; transition: color .2s, transform .2s; }
.auth-eye.is-on { color: var(--accent-primary); }
.auth-eye:active { transform: scale(.88); }

.auth-strength { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 5px; align-items: center; }
.auth-strength[hidden] { display: none; }
.auth-strength i { height: 5px; border-radius: 3px; background: var(--surface-muted); transition: background .3s; }
.auth-strength span { font-size: .75rem; color: var(--text-muted); min-width: 3.2em; text-align: end; }
.auth-strength[data-level="1"] i:nth-child(-n+1) { background: #ef4444; }
.auth-strength[data-level="2"] i:nth-child(-n+2) { background: #f59e0b; }
.auth-strength[data-level="3"] i:nth-child(-n+3) { background: #84cc16; }
.auth-strength[data-level="4"] i:nth-child(-n+4) { background: #22c55e; }

.auth-collapse { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .35s cubic-bezier(.3,.9,.3,1), opacity .25s; }
.auth-collapse.is-open { grid-template-rows: 1fr; opacity: 1; }
.auth-collapse__inner { overflow: hidden; min-height: 0; }
.auth-match { margin: 0; min-height: 1.2em; font-size: .8rem; }
.auth-match[data-state="ok"] { color: #16a34a; }
.auth-match[data-state="no"] { color: var(--color-danger); }

.auth-error { margin: 0; padding: var(--space-2) var(--space-3); border-radius: 12px; background: var(--color-danger-soft); color: var(--color-danger); font-size: var(--text-sm); }
.auth-error.is-shake { animation: authShake .4s; }
@keyframes authShake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }

.auth-submit { position: relative; min-height: 52px; border: 0; border-radius: 16px; color: #fff; font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; overflow: hidden; background: linear-gradient(135deg, #6366f1, #8b5cf6 60%, #ec4899); box-shadow: 0 12px 24px -10px rgba(99,102,241,.8); transition: transform .15s, box-shadow .2s, opacity .2s; }
.auth-submit::after { content: ''; position: absolute; inset-block: 0; inset-inline-start: -60%; width: 40%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); transform: skewX(-20deg); animation: authShine 3.4s ease-in-out infinite; }
@keyframes authShine { 0% { inset-inline-start: -60%; } 55%,100% { inset-inline-start: 130%; } }
.auth-submit:active { transform: scale(.97); }
.auth-submit:disabled { opacity: .85; cursor: progress; }
.auth-spinner { display: none; width: 18px; height: 18px; margin-inline-start: 10px; vertical-align: -3px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: authSpin .7s linear infinite; }
.auth-card.is-busy .auth-spinner { display: inline-block; }
@keyframes authSpin { to { transform: rotate(360deg); } }
.auth-card.is-success { animation: authPop .35s ease both; }
@keyframes authPop { 50% { transform: scale(1.02); box-shadow: 0 0 0 6px rgba(34,197,94,.25); } }

.auth-link { border: 0; background: none; color: var(--accent-primary); font: inherit; font-weight: 700; cursor: pointer; padding: var(--space-2); }
.auth-skip { display: grid; gap: var(--space-2); text-align: center; padding-top: var(--space-3); border-top: 1px dashed var(--border-subtle); }
.auth-skip-btn { min-height: 46px; border-radius: 14px; border: 1.5px solid var(--border-subtle); background: transparent; color: var(--text-primary); font: inherit; font-weight: 600; cursor: pointer; transition: background .2s, transform .15s; }
.auth-skip-btn:active { transform: scale(.98); background: var(--surface-muted); }
.auth-note { margin: 0; color: var(--text-muted); font-size: .8rem; }

@media (prefers-reduced-motion: reduce) {
  .auth-blob, .auth-word, .auth-logo, .auth-logo::after, .auth-submit::after { animation: none; }
  .auth-card, .auth-head > *, .auth-tabs, .auth-form > *, .auth-link, .auth-skip { animation: none; }
  .auth-collapse, .auth-tabs::before { transition: none; }
}
