
:root {
  --bg: #111827;
  --page-bg: #111827;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --muted-2: #94a3b8;
  --line: rgba(148, 163, 184, 0.22);
  --field-bg: rgba(15, 23, 42, 0.62);
  --primary: #3b82f6;
  --primary-2: #2563eb;
  --danger: #fb7185;
  --success: #86efac;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100vh;
  color: var(--text);
  background: var(--page-bg);
  overflow-x: hidden;
}

.auth-header {
  position: fixed;
  top: 28px;
  left: 34px;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-size: 25px;
  font-weight: 850;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 112px 22px 110px;
}

.auth-shell {
  width: 100%;
  max-width: 560px;
  padding: 0;
  text-align: center;
}

.icon-wrap {
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: rgba(56, 189, 248, 0.13);
  border: 1px solid rgba(56, 189, 248, 0.26);
}

.icon-wrap svg {
  width: 31px;
  height: 31px;
  fill: #7dd3fc;
}

.eyebrow {
  width: fit-content;
  margin: 0 auto 18px;
  padding: 8px 15px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.16);
  color: #bfdbfe;
  font-size: 14px;
  font-weight: 750;
}

.auth-shell h1 {
  margin: 0 0 16px;
  color: var(--text);
  font-size: clamp(38px, 3vw, 48px);
  line-height: 1.1;
  font-weight: 850;
}

.subtitle {
  max-width: 500px;
  margin: 0 auto 30px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.auth-form {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  text-align: left;
}

.input-label {
  display: block;
  margin: 0 0 10px 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.auth-form input {
  width: 100%;
  height: 66px;
  margin: 0 0 16px;
  padding: 0 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  background: var(--field-bg);
  color: var(--text);
  font-size: 18px;
  font-weight: 650;
  transition: border 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.auth-form input::placeholder { color: rgba(203, 213, 225, 0.68); }
.auth-form input:focus {
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.14);
  background: rgba(15, 23, 42, 0.82);
}

.auth-password-field {
  position: relative;
  width: 100%;
  margin: 0 0 16px;
}

.auth-password-field input {
  margin-bottom: 0;
  padding-inline-end: 58px;
}

html[dir="rtl"] .auth-password-field input {
  padding-inline-end: 24px;
  padding-inline-start: 58px;
}

.auth-password-toggle {
  position: absolute;
  inset-inline-end: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(203, 213, 225, 0.86);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

html[dir="rtl"] .auth-password-toggle {
  inset-inline-end: auto;
  inset-inline-start: 16px;
}


.auth-password-toggle::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
  opacity: 0.95;
  pointer-events: none;
}

.auth-password-toggle.is-visible::after {
  opacity: 0;
}

.auth-password-toggle:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #ffffff;
}

.auth-password-toggle svg {
  width: 21px;
  height: 21px;
  display: block;
}

.auth-password-toggle.is-visible {
  color: #7dd3fc;
}

#codeInput,
#resetCode {
  height: 66px;
  font-size: 28px;
  font-weight: 750;
  letter-spacing: 0.42em;
  text-align: center;
}

.primary-btn {
  width: 100%;
  height: 66px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.24);
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 22px 42px rgba(37, 99, 235, 0.3); }
.primary-btn:disabled { opacity: 0.62; cursor: not-allowed; transform: none; box-shadow: none; }

.actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.text-btn, .text-link {
  border: none;
  background: transparent;
  color: #bae6fd;
  font-size: 14.5px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
}

.text-btn:hover, .text-link:hover { color: #fff; text-decoration: underline; }

.auth-identifier {
  margin: 0 0 16px;
  color: #fff;
  font-size: 14.5px;
  font-weight: 800;
  word-break: break-word;
}

.hint {
  margin: -4px 0 16px;
  color: var(--muted-2);
  font-size: 13px;
  text-align: center;
}

.auth-code-info {
  width: 100%;
  margin: 2px 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.42);
  box-shadow: 0 16px 42px rgba(2, 6, 23, 0.16);
  text-align: start;
}

.auth-code-timer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #dbeafe;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}

.auth-code-timer-row strong {
  min-width: 54px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.22);
  color: #bfdbfe;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.auth-code-timer-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #86efac;
  box-shadow: 0 0 0 5px rgba(134, 239, 172, 0.12);
}

.auth-code-help {
  max-width: 430px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.65;
  text-align: center;
}

.auth-code-info.is-warning .auth-code-timer-dot {
  background: #fbbf24;
  box-shadow: 0 0 0 5px rgba(251, 191, 36, 0.13);
}

.auth-code-info.is-warning .auth-code-timer-row strong {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.16);
}

.auth-code-info.is-expired {
  border-color: rgba(251, 113, 133, 0.38);
  background: rgba(127, 29, 29, 0.16);
}

.auth-code-info.is-expired .auth-code-timer-dot {
  background: #fb7185;
  box-shadow: 0 0 0 5px rgba(251, 113, 133, 0.13);
}

.auth-code-info.is-expired .auth-code-timer-row strong {
  color: #fecdd3;
  background: rgba(251, 113, 133, 0.18);
}

.auth-rebind-notice {
  width: 100%;
  margin: 0 0 20px;
  padding: 20px;
  border: 1px solid rgba(251, 191, 36, 0.34);
  border-radius: 20px;
  background: rgba(120, 53, 15, 0.16);
  box-shadow: 0 16px 42px rgba(2, 6, 23, 0.16);
  text-align: start;
}

.auth-rebind-platform {
  width: fit-content;
  margin: 0 0 12px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.16);
  color: #fde68a;
  font-size: 13px;
  font-weight: 850;
}

.auth-rebind-notice p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.8;
}

.auth-rebind-actions {
  display: grid;
  gap: 12px;
}

.message {
  min-height: 22px;
  margin: 22px 0 0;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}
.message.success { color: var(--success); }
.auth-back { display: inline-block; margin-top: 16px; }

.auth-legal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 18px;
  text-align: center;
  color: #dbeafe;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.4;
}

.auth-legal a {
  color: #dbeafe;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.16s ease, opacity 0.16s ease;
}

.auth-legal a:hover {
  color: #ffffff;
}

.auth-legal-separator {
  color: rgba(219, 234, 254, 0.72);
  font-weight: 800;
}

html[dir="rtl"] .auth-legal {
  direction: rtl;
}

.secondary-btn {
  width: 100%;
  height: 58px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 850;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.secondary-btn {
  background: transparent;
  color: #bae6fd;
  border: 1px solid rgba(186, 230, 253, 0.55);
}

.secondary-btn:hover {
  color: #fff;
  border-color: #fff;
  transform: translateY(-1px);
}

.secondary-btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
}

[dir="rtl"] .auth-header { left: auto; right: 34px; }
[dir="rtl"] .auth-form { text-align: right; }

[dir="rtl"] .input-label { margin-left: 0; margin-right: 8px; }

html[dir="rtl"] .auth-code-info {
  direction: rtl;
}

html[dir="rtl"] .auth-code-help {
  text-align: center;
}

@media (max-width: 640px) {
  body {
    min-height: 100svh;
    display: grid;
    grid-template-rows: auto 1fr auto;
  }

  .auth-header {
    position: static;
    width: 100%;
    padding: 18px 18px 0;
  }

  [dir="rtl"] .auth-header {
    left: auto;
    right: auto;
  }

  .brand {
    font-size: 22px;
  }

  .auth-page {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 18px 16px;
  }

  .auth-shell {
    max-width: 460px;
  }

  .icon-wrap {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
    border-radius: 17px;
  }

  .icon-wrap svg {
    width: 24px;
    height: 24px;
  }

  .eyebrow {
    margin-bottom: 10px;
    padding: 6px 12px;
    font-size: 13px;
  }

  .auth-shell h1 {
    margin-bottom: 10px;
    font-size: clamp(30px, 8.5vw, 34px);
    line-height: 1.12;
  }

  .subtitle {
    margin-bottom: 18px;
    font-size: 15px;
    line-height: 1.5;
  }

  .auth-form {
    max-width: 100%;
  }

  .input-label {
    margin-bottom: 8px;
    font-size: 13.5px;
  }

  .auth-form input,
  .primary-btn,
  #codeInput,
  #resetCode {
    height: 56px;
  }

  .auth-form input {
    margin-bottom: 12px;
    padding-inline: 20px;
    font-size: 16px;
  }

  .auth-password-field {
    margin-bottom: 12px;
  }

  .auth-password-field input {
    margin-bottom: 0;
    padding-inline-end: 54px;
  }

  html[dir="rtl"] .auth-password-field input {
    padding-inline-end: 20px;
    padding-inline-start: 54px;
  }

  #codeInput,
  #resetCode {
    font-size: 23px;
    letter-spacing: 0.28em;
  }

  #unlinkPlatformCode {
    font-size: 21px;
    letter-spacing: 0.26em;
  }

  .primary-btn {
    font-size: 16px;
  }

  .actions {
    gap: 14px;
    margin-top: 16px;
  }

  .text-btn,
  .text-link {
    font-size: 14px;
  }

  .auth-code-info {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 16px;
  }

  .auth-rebind-notice {
    margin-bottom: 16px;
    padding: 16px;
    border-radius: 16px;
  }

  .auth-rebind-notice p {
    font-size: 14px;
    line-height: 1.7;
  }

  .auth-code-timer-row {
    gap: 8px;
    font-size: 13.5px;
  }

  .auth-code-help {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.5;
  }

  .message {
    min-height: 20px;
    margin-top: 14px;
    font-size: 13.5px;
    line-height: 1.45;
  }

  .unlink-actions {
    gap: 10px;
  }

  .secondary-btn,
  .danger-btn {
    height: 54px;
    font-size: 15px;
  }

  .auth-legal {
    position: static;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    margin: 0;
    padding: 10px 18px calc(16px + env(safe-area-inset-bottom));
    gap: 12px;
    font-size: 14px;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) and (max-height: 720px) {
  .auth-page {
    align-items: flex-start;
    padding-top: 10px;
    padding-bottom: 12px;
  }

  .icon-wrap {
    width: 44px;
    height: 44px;
    margin-bottom: 8px;
  }

  .eyebrow {
    margin-bottom: 8px;
  }

  .auth-shell h1 {
    margin-bottom: 8px;
  }

  .subtitle {
    margin-bottom: 14px;
    line-height: 1.45;
  }

  .auth-code-help {
    line-height: 1.45;
  }
}

.auth-phone-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  direction: ltr;
}

.auth-phone-prefix {
  height: 66px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--field-bg);
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  direction: ltr;
  unicode-bidi: isolate;
}

#phoneInput {
  margin-bottom: 0;
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
}

@media (max-width: 640px) {
  .auth-phone-row {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .auth-phone-prefix {
    height: 60px;
    font-size: 16px;
  }
}
