/* =====================================================
   RO'YXATDAN O'TISH — markazda animatsiyali karta
   Mustaqil fayl: boshqa CSS'larga bog'liq emas.
   Oq / qora / yashil, kun-tun rejimi.
   ===================================================== */

/* ===== TOKENLAR ===== */
:root {
  --blue: #16a34a;
  --a-bg: #f5f9ff;
  --a-card: #ffffff;
  --a-glass: rgba(255, 255, 255, 0.78);
  --a-field: #f3f7fc;
  --a-chip: rgba(11, 18, 32, 0.055);
  --a-line: #dbe6f5;
  --a-line-hover: #b3c7e3;
  --a-text: #0b1220;
  --a-muted: #5b6b82;
  --a-ph: #8592a6;
  --a-danger: #b91c1c;
  --a-shadow: 0 18px 44px rgba(11, 18, 32, 0.1);
  --a-g1: #1faa52;
  --a-g2: #15803d;
  --a-gdeep: #166534;
  --a-radius: 14px;
  font-size: 16px;
}

html[data-theme="dark"] {
  --blue: #22c55e;
  --a-bg: #05070c;
  --a-card: #101720;
  --a-glass: rgba(12, 17, 25, 0.76);
  --a-field: #0a0f16;
  --a-chip: rgba(255, 255, 255, 0.08);
  --a-line: rgba(255, 255, 255, 0.14);
  --a-line-hover: rgba(255, 255, 255, 0.28);
  --a-text: #ffffff;
  --a-muted: #c5cad3;
  --a-ph: #7d8796;
  --a-danger: #fca5a5;
  --a-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--a-bg);
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--a-bg);
  color: var(--a-text);
  font-family: "Manrope", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background 0.45s ease, color 0.45s ease;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

/* ===== ANIMATSIYA KALITLARI ===== */
@keyframes rDrop {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes rUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cardRise {
  from { opacity: 0; transform: translateY(54px) scale(0.93); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes wordDrop {
  0%   { opacity: 0; transform: translateY(-115%) rotate(-4deg); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) rotate(0); }
}

@keyframes bubblePop {
  from { opacity: 0; transform: translateY(-14px) scale(0.5); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes correctPop {
  0% {
    opacity: 0;
    transform: translateY(-14px) scale(0.5);
    background: var(--a-chip);
    border-color: var(--a-line-hover);
    color: var(--a-text);
  }
  35% {
    opacity: 1;
    transform: translateY(0) scale(1);
    background: var(--a-chip);
    border-color: var(--a-line-hover);
    color: var(--a-text);
  }
  70% {
    transform: scale(1.22);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    background: linear-gradient(180deg, var(--a-g1), var(--a-g2));
    border-color: var(--a-g2);
    color: #ffffff;
  }
}

@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

@keyframes tabPop {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(3px); }
}

@keyframes errIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes showNow {
  to { opacity: 1; }
}

/* ===== ORQA FON: neytral, sekin siljuvchi nuqtalar to'ri ===== */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--a-text) 16%, transparent) 1px, transparent 1.6px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 5%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 5%, transparent 75%);
  animation: gridDrift 14s linear infinite;
}

@keyframes gridDrift {
  from { background-position: 0 0; }
  to   { background-position: 28px 28px; }
}

/* ===== TEPADAGI PANEL ===== */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 12px 12px 0;
  pointer-events: none;
  animation: rDrop 0.85s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.top__bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--a-line);
  border-radius: 999px;
  background: var(--a-glass);
  box-shadow: var(--a-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
}

.top__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: var(--a-text);
}

.top__logo {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--a-line);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.top__brand:hover .top__logo {
  transform: rotate(-12deg) scale(1.06);
}

.top__name {
  font-weight: 800;
  font-size: 1rem;
}

.top__short {
  display: none;
}

.top__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Kun-tun tugmasi */
.theme-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--a-line);
  background: var(--a-chip);
  color: var(--a-text);
  transition: transform 0.3s ease;
}

.theme-btn:hover {
  transform: rotate(18deg) scale(1.06);
}

.theme-btn:active {
  transform: scale(0.94);
}

.theme-btn svg {
  grid-area: 1 / 1;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.theme-btn__moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.4);
}

html[data-theme="dark"] .theme-btn__sun {
  opacity: 0;
  transform: rotate(90deg) scale(0.4);
}

html[data-theme="dark"] .theme-btn__moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* Login tugmasi */
.top__login {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--a-g1), var(--a-g2));
  color: #ffffff;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(21, 128, 61, 0.32);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.top__login::after,
.btn-submit::after {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  transform: skewX(-20deg);
  transition: left 0.7s ease;
  pointer-events: none;
  z-index: -1;
}

.top__login:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(21, 128, 61, 0.45);
}

.top__login:hover::after,
.btn-submit:hover::after {
  left: 130%;
}

.top__login:active {
  transform: translateY(0);
}

/* ===== MARKAZ ===== */
.stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 96px 16px 28px;
}

.stage__col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 480px;
}

.auth__back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px 9px 12px;
  border: 1px solid var(--a-line);
  border-radius: 999px;
  background: var(--a-glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--a-muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.88rem;
  transition: color 0.2s ease;
  animation: rDrop 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.3s backwards;
}

.auth__back svg {
  width: 16px;
  height: 16px;
  transition: transform 0.25s ease;
}

.auth__back:hover {
  color: var(--a-text);
}

.auth__back:hover svg {
  transform: translateX(-3px);
}

/* ===== KARTA ===== */
.auth__wrap {
  position: relative;
  width: 100%;
}

.auth__card {
  position: relative;
  padding: 22px 26px 22px;
  border: 1px solid var(--a-line);
  border-radius: 28px;
  background: var(--a-card);
  box-shadow: var(--a-shadow);
  animation: cardRise 1s cubic-bezier(0.22, 1, 0.36, 1) 0.15s backwards;
}

/* A B C D */
.answer-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.answer-bubble {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--a-line-hover);
  background: var(--a-chip);
  color: var(--a-text);
  font-weight: 800;
  font-size: 0.88rem;
  animation: bubblePop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.answer-bubble:nth-child(1) { animation-delay: 650ms; }
.answer-bubble:nth-child(2) { animation-delay: 770ms; }
.answer-bubble:nth-child(3) { animation-delay: 890ms; }

.answer-bubble.is-correct {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: linear-gradient(180deg, var(--a-g1), var(--a-g2));
  border-color: var(--a-g2);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(21, 128, 61, 0.35);
  animation: correctPop 1.5s cubic-bezier(0.34, 1.2, 0.64, 1) 1010ms backwards;
}

.answer-bubble.is-correct svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.answer-bubble.is-correct svg path {
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  animation: drawCheck 0.5s ease-out 2s forwards;
}

/* Sarlavha: so'zlar tepadan tushadi */
.auth__title {
  margin: 0 0 18px;
  text-align: center;
  font-size: clamp(1.02rem, 3.6vw, 1.2rem);
  line-height: 1.4;
  font-weight: 800;
  letter-spacing: -0.005em;
}

.js .auth__title:not(.split-ready) {
  opacity: 0;
  animation: showNow 0s linear 2s forwards;
}

.w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: 0.06em 0.02em 0.14em;
  margin: -0.06em -0.02em -0.14em;
}

.w__in {
  display: inline-block;
  opacity: 0;
  transform: translateY(-115%) rotate(-4deg);
  transform-origin: left top;
}

.split-ready.is-in .w__in {
  animation: wordDrop 0.95s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--base, 0ms) + var(--i) * 70ms);
}

/* Tablar — segmentli kapsula */
.auth__tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: 999px;
  background: var(--a-chip);
  animation: rDrop 0.6s cubic-bezier(0.22, 1, 0.36, 1) 1.2s backwards;
}

.auth__tab {
  flex: 1;
  padding: 11px 10px;
  border-radius: 999px;
  text-align: center;
  text-decoration: none;
  color: var(--a-muted);
  font-weight: 800;
  font-size: 0.92rem;
  transition: color 0.25s ease;
}

.auth__tab:hover:not(.is-active) {
  color: var(--a-text);
}

.auth__tab.is-active {
  background: linear-gradient(180deg, var(--a-g1), var(--a-g2));
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(21, 128, 61, 0.35);
  animation: tabPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.45s backwards;
}

/* ===== FORMA ===== */
.auth__form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth__form > * {
  animation: rDrop 0.65s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: calc(1300ms + var(--i, 0) * 75ms);
}

.auth__form-lead {
  margin: -2px 0 8px;
  color: var(--a-muted);
  font-size: 0.94rem;
}

.auth__server-error {
  margin: 0;
  padding: 11px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--a-danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--a-danger) 30%, transparent);
  color: var(--a-danger);
  font-size: 0.88rem;
  font-weight: 700;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--a-text);
  transition: color 0.2s ease;
}

.field:focus-within label {
  color: color-mix(in srgb, var(--blue) 75%, var(--a-text));
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid var(--a-line);
  border-radius: var(--a-radius);
  background-color: var(--a-field);
  color: var(--a-text);
  font-family: inherit;
  font-size: 0.96rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.field input:hover,
.field select:hover {
  border-color: var(--a-line-hover);
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%235b6b82' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

html[data-theme="dark"] .field select {
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%23c5cad3' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

.field input::placeholder {
  color: var(--a-ph);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--blue);
  background-color: var(--a-card);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent);
}

.field.has-error > input,
.field.has-error > select,
.field.has-error > .field__input-wrap {
  border-color: var(--a-danger);
  animation: shake 0.45s ease;
}

.field__error {
  min-height: 15px;
  color: var(--a-danger);
  font-size: 0.78rem;
  font-weight: 600;
}

.field__error:not(:empty) {
  animation: errIn 0.3s ease;
}

.field__input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--a-line);
  border-radius: var(--a-radius);
  background-color: var(--a-field);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.field__input-wrap:hover {
  border-color: var(--a-line-hover);
}

.field__input-wrap:focus-within {
  border-color: var(--blue);
  background-color: var(--a-card);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent);
}

.field .field__input-wrap input {
  flex: 1;
  min-width: 0;
  min-height: 45px;
  border: none;
  background: transparent;
  padding: 12px 6px 12px 14px;
}

.field .field__input-wrap input:focus {
  box-shadow: none;
  background: transparent;
}

/* Brauzerning o'zi qo'shadigan ko'z / tozalash belgilarini yashiramiz
   (Edge, Safari va h.k.) — faqat bizning ko'z tugmasi qoladi */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none;
  width: 0;
  height: 0;
}

input[type="password"]::-webkit-credentials-auto-fill-button,
input[type="password"]::-webkit-contacts-auto-fill-button {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
  position: absolute;
  right: 0;
}

.field__toggle-visibility {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 44px;
  border: none;
  background: none;
  color: var(--a-muted);
  border-radius: 0 12px 12px 0;
  transition: color 0.2s ease;
}

.field__toggle-visibility svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.field__toggle-visibility:hover {
  color: var(--blue);
}

.field__toggle-visibility:active svg {
  transform: scale(0.82);
}

/* Asosiy tugma */
.btn-submit {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 50px;
  margin-top: 8px;
  margin-bottom: 4px;
  padding: 0 20px;
  border: none;
  border-radius: var(--a-radius);
  background: linear-gradient(180deg, var(--a-g1), var(--a-g2));
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 10px 22px rgba(21, 128, 61, 0.34);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(21, 128, 61, 0.48);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit.is-loading {
  pointer-events: none;
  color: transparent;
}

.btn-submit.is-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.auth__switch {
  margin: 0;
  text-align: center;
  color: var(--a-muted);
  font-size: 0.9rem;
}

.auth__switch-link {
  color: color-mix(in srgb, var(--blue) 70%, var(--a-text));
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-submit:focus-visible,
.top__login:focus-visible,
.auth__tab:focus-visible,
.auth__back:focus-visible,
.theme-btn:focus-visible,
.auth__switch-link:focus-visible,
.field__toggle-visibility:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

/* ===== TELEFON ===== */
@media (max-width: 520px) {
  .stage {
    padding: 92px 12px 32px;
  }

  .auth__card {
    padding: 20px 16px 22px;
    border-radius: 24px;
  }

  .field-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 420px) {
  .top {
    padding: 8px 8px 0;
  }

  .top__bar {
    padding: 6px 8px;
  }

  .top__full {
    display: none;
  }

  .top__short {
    display: inline;
  }

  .top__logo {
    width: 36px;
    height: 36px;
  }

  .top__actions {
    gap: 6px;
  }

  .theme-btn {
    width: 38px;
    height: 38px;
  }

  .top__login {
    min-height: 38px;
    padding: 0 16px;
    font-size: 0.84rem;
  }
}

@media (max-width: 340px) {
  .top__logo {
    width: 32px;
    height: 32px;
  }

  .theme-btn {
    width: 34px;
    height: 34px;
  }

  .theme-btn svg {
    width: 17px;
    height: 17px;
  }

  .top__login {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.78rem;
  }

  .answer-bubble {
    width: 34px;
    height: 34px;
  }

  .auth__tab {
    font-size: 0.82rem;
    padding: 10px 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .w__in {
    opacity: 1 !important;
    transform: none !important;
  }

  .answer-bubble.is-correct svg path {
    stroke-dashoffset: 0;
  }
}

/* ===== LOGIN SAHIFASI UCHUN QO'SHIMCHALAR ===== */
.field--row-end {
  flex-direction: row;
  justify-content: flex-end;
  margin-top: -2px;
}

.auth__link-muted {
  color: var(--a-muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 700;
  transition: color 0.2s ease;
}

.auth__link-muted:hover {
  color: var(--blue);
}

.auth__link-muted:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Tepadagi tugma matni tor ekranda qisqaradi */
.top__login-short {
  display: none;
}

@media (max-width: 520px) {
  .top__login-full {
    display: none;
  }

  .top__login-short {
    display: inline;
  }
}