: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-offset: 0px;
}

* {
  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(10px, 3.4vh, 24px) 0 clamp(10px, 2.4vh, 18px);
  text-align: center;
}

.brand-logo {
  width: clamp(170px, 47vw, 230px);
  height: auto;
  display: block;
  margin: 0 auto;
  mix-blend-mode: multiply;
  filter: drop-shadow(0 5px 10px rgba(16, 178, 108, 0.05));
}

.login-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  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 transparent;
  background: linear-gradient(180deg, #f7f8fa 0%, #f4f6f8 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.92),
    0 5px 14px var(--card-glow);
}

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

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

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

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

.phone-input:focus {
  border-color: #aeb4bc;
  background: #ffffff;
}

.password-group {
  border: 2px solid transparent;
  background: linear-gradient(180deg, #f7f8fa 0%, #f4f6f8 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.92),
    0 5px 14px var(--card-glow);
}

.password-group:focus-within {
  border-color: #aeb4bc;
  background: #ffffff;
}

.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(24px, 6vw, 40px);
  color: #111216;
  background: transparent;
  transition: box-shadow 0.2s ease;
}

.password-input::placeholder {
  color: #afb4bd;
  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-slash {
  opacity: 1;
}

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

.eye-btn.is-visible .eye-pupil {
  opacity: 0.72;
}

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

.submit-wrap {
  margin-top: auto;
  padding-top: clamp(8px, 2.2vw, 12px);
  padding-bottom: calc(max(8px, env(safe-area-inset-bottom)) + var(--keyboard-offset));
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.submit-btn {
  border: 0;
  width: 100%;
  height: clamp(58px, 14vw, 82px);
  border-radius: clamp(18px, 5.4vw, 26px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0) 34%),
    linear-gradient(180deg, #98e1bd 0%, #8addb7 100%);
  color: #f6f8f8;
  font-size: clamp(20px, 5.8vw, 34px);
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  margin-top: 0;
  box-shadow:
    0 10px 22px rgba(16, 178, 108, 0.23),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

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

body.keyboard-open .brand {
  margin-top: clamp(12px, 3.4vh, 24px);
  margin-bottom: clamp(10px, 2.2vh, 18px);
}

body.keyboard-open .login-form {
  gap: clamp(10px, 2.8vw, 16px);
}

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

body.keyboard-open .submit-wrap {
  padding-bottom: calc(max(8px, env(safe-area-inset-bottom)) + var(--keyboard-offset));
}

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

.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.03);
  box-shadow:
    0 13px 24px rgba(16, 178, 108, 0.27),
    inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

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

.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;
  }
}