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

:root {
  --bg: #070b16;
  --surface: rgba(17, 23, 43, 0.78);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2ff;
  --muted: #8b93b5;
  --primary-a: #6366f1;
  --primary-b: #a855f7;
  --danger: #f87171;
  --radius: 14px;
}

html, body { min-height: 100%; }
html, body, button, a, input, label { touch-action: manipulation; }

body {
  min-height: 100svh;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(168, 85, 247, 0.16), transparent 60%),
    var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Decorative okey tiles */
.tiles { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.tile {
  position: absolute;
  width: 54px; height: 76px;
  border-radius: 10px;
  background: linear-gradient(160deg, #fbf7ec 0%, #e7dec7 100%);
  box-shadow: 0 5px 0 #b5a98c, 0 18px 30px rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 10px;
  font-weight: 800; font-size: 24px;
  opacity: 0.16;
  animation: float 9s ease-in-out infinite;
}
.tile::after {
  content: '';
  width: 12px; height: 12px; border-radius: 50%;
  margin-top: 8px;
  border: 2px solid currentColor;
  opacity: 0.7;
}
.tile.red    { color: #dc2626; }
.tile.yellow { color: #d97706; }
.tile.blue   { color: #2563eb; }
.tile.black  { color: #111827; }
.tile:nth-child(1) { top: 8%;  left: 7%;   transform: rotate(-14deg); animation-delay: 0s; }
.tile:nth-child(2) { top: 16%; right: 9%;  transform: rotate(12deg);  animation-delay: -2s; }
.tile:nth-child(3) { bottom: 14%; left: 11%; transform: rotate(9deg);  animation-delay: -4s; }
.tile:nth-child(4) { bottom: 8%; right: 13%; transform: rotate(-8deg); animation-delay: -6s; }
.tile:nth-child(5) { top: 48%; left: -10px; transform: rotate(22deg); animation-delay: -3s; }
.tile:nth-child(6) { top: 56%; right: -8px; transform: rotate(-20deg); animation-delay: -5s; }

@keyframes float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -12px; }
}

@media (min-width: 720px) {
  .tile { opacity: 0.32; }
}

.auth {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.brand { text-align: center; margin-bottom: 22px; }
.brand-logo {
  width: 68px; height: 68px; object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(99, 102, 241, 0.45));
  margin-bottom: 12px;
}
.brand-title {
  font-size: 1.7rem; font-weight: 800; letter-spacing: -0.03em;
}
.brand-title span {
  background: linear-gradient(135deg, #a5b4fc, #e879f9);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-sub { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px 22px 22px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.card-title { font-size: 1.15rem; font-weight: 800; margin-bottom: 4px; }
.card-sub { color: var(--muted); font-size: 0.85rem; margin-bottom: 18px; }

.err {
  display: none;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.28);
  color: #fecaca;
  font-size: 0.85rem; font-weight: 600;
}
.err.show { display: block; animation: shake 0.35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.field { margin-bottom: 14px; }
.field label {
  display: block; margin-bottom: 7px;
  font-size: 0.78rem; font-weight: 700; color: var(--muted);
}
.input-wrap { position: relative; }
.input-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--muted); pointer-events: none;
}
.field input {
  width: 100%; height: 52px;
  padding: 0 46px 0 44px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit; font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
}
.field input::placeholder { color: rgba(139, 147, 181, 0.6); }
.field input:focus {
  border-color: #818cf8;
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16);
}
.eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: none; background: none;
  color: var(--muted); cursor: pointer; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.eye svg { position: static; transform: none; width: 18px; height: 18px; }
.eye:hover { color: var(--text); }

.btn {
  width: 100%; height: 52px;
  border: none; border-radius: var(--radius);
  font: inherit; font-size: 1rem; font-weight: 800;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
  transition: transform 0.12s, opacity 0.15s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  margin-top: 6px;
  background: linear-gradient(135deg, var(--primary-a), var(--primary-b));
  color: #fff;
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.4);
}
.btn-primary:hover { box-shadow: 0 14px 34px rgba(99, 102, 241, 0.55); }
.btn-primary[disabled] { opacity: 0.6; cursor: wait; }
.btn-ghost {
  height: 48px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 0.92rem; font-weight: 700;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted); font-size: 0.78rem;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.langs {
  display: flex; justify-content: center; gap: 6px;
  margin-top: 18px;
}
.langs a {
  padding: 6px 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none;
  font-size: 0.78rem; font-weight: 700;
  border: 1px solid transparent;
}
.langs a.active { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.05); }

.back {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted); text-decoration: none;
  font-size: 0.85rem; font-weight: 700;
  margin-bottom: 14px;
}
.back svg { width: 18px; height: 18px; }
.back:hover { color: var(--text); }

@media (max-width: 420px) {
  .card { padding: 22px 18px 18px; border-radius: 20px; }
}
