:root {
  --bg: #ffffff;
  --text: #0f1012;
  --muted: #a9adb4;
  --line: #c7cad0;
  --brand: #10b26c;
  --brand-deep: #08a964;
  --card-soft: #f7f8fa;
  --card-glow: rgba(17, 20, 24, 0.03);
  --focus-ring: rgba(16, 178, 108, 0.2);
  --content-max: 430px;
  --pad-x: clamp(16px, 4.8vw, 24px);
  --pad-bottom: max(22px, env(safe-area-inset-bottom));
  --vvh: 100dvh;
  --keyboard-lift: 0px;
  --submit-idle: #87d8b3;
  --submit-active: #08b05a;
  --submit-text: #effaf3;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", "Nunito", "Avenir Next", "Segoe UI", sans-serif;
  overflow: hidden;
}

body {
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(150px 80px at 88% 0%, rgba(16, 178, 108, 0.08), transparent 72%),
    radial-gradient(190px 110px at 7% 100%, rgba(16, 178, 108, 0.05), transparent 75%),
    var(--bg);
}

.page {
  width: min(100%, var(--content-max));
  height: var(--vvh);
  padding: max(6px, env(safe-area-inset-top)) var(--pad-x) max(8px, env(safe-area-inset-bottom));
  overflow: hidden;
  display: flex;
}

.login-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: calc(var(--vvh) - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: clamp(-2px, 0.2vh, 2px);
}

.icon-btn,
.help-btn,
.eye-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
}

.icon-btn {
  width: clamp(32px, 8vw, 38px);
  height: clamp(32px, 8vw, 38px);
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.arrow {
  font-size: clamp(24px, 7vw, 34px);
  line-height: 1;
  transform: translateY(-1px);
}

.help-btn {
  display: inline-flex;
  align-items: center;
  gap: clamp(6px, 2vw, 10px);
  height: clamp(40px, 10vw, 52px);
  padding: 0 clamp(13px, 3vw, 18px);
  border-radius: 999px;
  background: #050505;
  color: #ffffff;
  font-size: clamp(16px, 4.1vw, 21px);
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 6px 16px rgba(9, 10, 10, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.help-icon {
  width: clamp(18px, 4.8vw, 24px);
  height: clamp(18px, 4.8vw, 24px);
  border-radius: 50%;
  border: 2px solid #ffffff;
  display: grid;
  place-items: center;
  font-size: clamp(11px, 2.8vw, 15px);
  font-weight: 700;
  line-height: 1;
}

.brand {
  margin: clamp(8px, 2.2vh, 16px) 0 clamp(4px, 1.2vh, 10px);
  text-align: center;
}

.brand-logo {
  width: clamp(170px, 47vw, 230px);
  height: auto;
  display: block;
  margin: 0 auto;
  mix-blend-mode: normal;
  filter: none;
}

.login-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding-bottom: calc(clamp(58px, 14vw, 82px) + 18px + env(safe-area-inset-bottom));
  gap: clamp(8px, 2.2vw, 14px);
}

.phone-row {
  display: grid;
  grid-template-columns: clamp(74px, 22vw, 108px) 1fr;
  gap: clamp(8px, 2.8vw, 14px);
}

.code-box,
.phone-input {
  border: 2px solid #eef2f6;
  background: linear-gradient(180deg, #f8f9fb 0%, #f4f6f9 100%);
  border-radius: clamp(18px, 4.8vw, 24px);
  height: clamp(70px, 18vw, 88px);
  font-size: clamp(20px, 5.8vw, 36px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 2px 8px rgba(17, 20, 24, 0.025);
}

.code-box {
  display: grid;
  place-items: center;
  font-weight: 600;
}

.phone-input {
  width: 100%;
  padding: 0 clamp(14px, 3.8vw, 24px);
  color: #171c22;
  font-weight: 500;
  transition: box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.phone-input::placeholder {
  color: #b1b8c2;
}

.phone-input:focus,
.password-input:focus {
  outline: 0;
  box-shadow: none;
}

.phone-input:focus {
  border-color: #b8c0ca;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(16, 178, 108, 0.05);
}

.password-group {
  border: 2px solid #eef2f6;
  background: linear-gradient(180deg, #f8f9fb 0%, #f4f6f9 100%);
  border-radius: clamp(18px, 4.8vw, 24px);
  padding: clamp(10px, 2.7vw, 14px) clamp(14px, 3.8vw, 22px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 2px 8px rgba(17, 20, 24, 0.025);
}

.password-group:focus-within {
  border-color: #b8c0ca;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(16, 178, 108, 0.05);
}

.password-label {
  display: block;
  color: var(--brand);
  font-size: clamp(16px, 4.8vw, 30px);
  line-height: 1.1;
  margin-bottom: clamp(2px, 0.9vw, 5px);
  font-weight: 600;
}

.password-wrap {
  display: flex;
  align-items: center;
  gap: clamp(6px, 2vw, 10px);
}

.password-input {
  border: 0;
  width: 100%;
  min-width: 0;
  padding: 0;
  font-size: clamp(23px, 5.9vw, 38px);
  color: #171c22;
  background: transparent;
  transition: box-shadow 0.2s ease;
}

.password-input::placeholder {
  color: #b1b8c2;
  font-size: 0.84em;
}

.eye-btn {
  width: clamp(38px, 10vw, 52px);
  height: clamp(32px, 8vw, 44px);
  display: grid;
  place-items: center;
  color: #0f1012;
  cursor: pointer;
  border-radius: 999px;
  transition: background-color 0.2s ease, transform 0.2s ease;
  flex: 0 0 auto;
}

.eye-btn svg {
  width: clamp(24px, 6.5vw, 30px);
  height: auto;
}

.eye-btn .eye-open {
  opacity: 0;
}

.eye-btn .eye-closed,
.eye-btn .eye-open {
  transition: opacity 0.18s ease;
}

.eye-btn.is-visible .eye-open {
  opacity: 1;
}

.eye-btn.is-visible .eye-closed {
  opacity: 0;
}

.forgot-link {
  text-align: center;
  text-decoration: none;
  color: var(--brand);
  font-size: clamp(15px, 4.1vw, 26px);
  font-weight: 500;
  margin: 2px 0 6px;
  transition: color 0.2s ease;
}

.submit-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(8px + env(safe-area-inset-bottom));
  width: min(calc(100% - (var(--pad-x) * 2)), var(--content-max));
  margin-top: 0;
  padding: 0;
  transform: translate(-50%, calc(-1 * var(--keyboard-lift)));
  transition: transform 240ms cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
  z-index: 20;
}

.submit-btn {
  border: 0;
  width: 100%;
  height: clamp(58px, 14vw, 82px);
  border-radius: clamp(18px, 5.4vw, 26px);
  background: var(--submit-idle);
  color: var(--submit-text);
  font-size: clamp(20px, 5.8vw, 34px);
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  margin-top: 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow:
    0 8px 20px rgba(16, 178, 108, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.16s ease, box-shadow 0.22s ease, filter 0.22s ease, background-color 0.2s ease, border-color 0.2s ease;
}

body.keyboard-open .page {
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

body.keyboard-open .brand {
  margin-top: clamp(8px, 2.2vh, 14px);
  margin-bottom: clamp(4px, 1vh, 8px);
}

body.keyboard-open .login-form {
  gap: clamp(8px, 2.4vw, 14px);
  padding-bottom: calc(clamp(58px, 14vw, 82px) + 18px + env(safe-area-inset-bottom));
}

body.keyboard-open .forgot-link {
  margin: 6px 0 8px;
}

body.keyboard-open .submit-btn {
  margin-top: 0;
  height: clamp(58px, 14vw, 82px);
}

body.password-filled .submit-btn {
  background: var(--submit-active);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 12px 26px rgba(10, 168, 88, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.icon-btn:hover,
.eye-btn:hover {
  background: rgba(15, 16, 18, 0.06);
}

.help-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 10px 20px rgba(9, 10, 10, 0.17),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.submit-btn:hover {
  filter: saturate(1.04) brightness(1.01);
  box-shadow:
    0 13px 26px rgba(16, 178, 108, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.submit-btn:active,
.help-btn:active,
.icon-btn:active,
.eye-btn:active {
  transform: translateY(1px) scale(0.995);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 17, 20, 0.62);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  z-index: 80;
}

.loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

.loading-mark {
  width: clamp(90px, 24vw, 128px);
  height: auto;
}

.loading-mark-svg {
  width: 100%;
  height: auto;
  display: block;
}

.loading-mark-track,
.loading-mark-active {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.loading-mark-track {
  stroke: rgba(255, 255, 255, 0.9);
}

.loading-mark-active {
  stroke: #06c867;
  stroke-dasharray: 56 220;
  animation: mark-run 1.1s linear infinite;
}

@keyframes mark-run {
  from {
    stroke-dashoffset: 0;
  }

  to {
    stroke-dashoffset: -278;
  }
}

.forgot-link:hover {
  color: var(--brand-deep);
}

.icon-btn:focus-visible,
.help-btn:focus-visible,
.eye-btn:focus-visible,
.forgot-link:focus-visible,
.submit-btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

@media (max-width: 360px) {
  .brand-logo {
    width: clamp(160px, 46vw, 188px);
  }

  .forgot-link {
    margin-bottom: 16px;
  }
}

@media (min-width: 768px) {
  .page {
    padding-top: 24px;
  }

  .brand {
    margin-top: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
    transition: none !important;
  }
}


.loading-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
}

.loading-text {
  margin: 0;
  color: #f4f7fa;
  font-size: clamp(14px, 3.8vw, 18px);
  font-weight: 500;
  text-align: center;
}

.loading-cancel {
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}

.otp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 17, 20, 0.55);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  z-index: 90;
  padding: 20px;
}

.otp-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

.otp-card {
  width: min(100%, 420px);
  background: #fff;
  border-radius: 18px;
  padding: 22px 18px 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.otp-card h2 {
  margin: 0;
  font-size: 22px;
}

.otp-desc {
  margin: 0;
  color: #66707c;
  font-size: 14px;
  line-height: 1.45;
}

.otp-input {
  border: 2px solid #e7ecf1;
  border-radius: 14px;
  height: 56px;
  padding: 0 14px;
  font-size: 20px;
  outline: none;
}

.otp-input:focus {
  border-color: #09ad58;
}

.otp-submit {
  margin-top: 4px;
}

