:root {
  --login-bg-top: #f3edff;
  --login-bg-mid: #e7f2ff;
  --login-bg-bottom: #f9fbff;
  --login-card: rgba(255, 255, 255, 0.68);
  --login-card-border: rgba(255, 255, 255, 0.64);
  --login-text: #1f2a44;
  --login-muted: #6c7694;
  --login-primary: #7b6dff;
  --login-primary-strong: #5b65ff;
  --login-secondary: #70d6ff;
  --login-shadow-lg: 0 32px 80px rgba(116, 113, 255, 0.18);
  --login-shadow-md: 0 20px 50px rgba(60, 72, 128, 0.12);
  --login-radius-xl: 34px;
  --login-radius-lg: 26px;
  --login-radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.login-page {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", sans-serif;
  color: var(--login-text);
  background:
    radial-gradient(circle at 20% 15%, rgba(173, 195, 255, 0.55), transparent 22%),
    radial-gradient(circle at 85% 22%, rgba(196, 170, 255, 0.44), transparent 20%),
    linear-gradient(180deg, var(--login-bg-top) 0%, var(--login-bg-mid) 46%, var(--login-bg-bottom) 100%);
  overflow-x: hidden;
}

body.login-page.modal-open {
  overflow: hidden;
}

.login-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px 16px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-content {
  position: relative;
  z-index: 2;
  width: min(100%, 460px);
  overflow: visible;
}

.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(14px);
  opacity: 0.7;
  pointer-events: none;
}

.orb-one {
  width: 220px;
  height: 220px;
  top: 36px;
  left: -70px;
  background: rgba(162, 182, 255, 0.48);
}

.orb-two {
  width: 180px;
  height: 180px;
  right: -48px;
  top: 120px;
  background: rgba(194, 162, 255, 0.4);
}

.orb-three {
  width: 160px;
  height: 160px;
  right: 10%;
  bottom: 58px;
  background: rgba(123, 214, 255, 0.28);
}

.floating-accent {
  position: absolute;
  z-index: 1;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #7a72d8;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 18px 34px rgba(123, 109, 255, 0.12);
  backdrop-filter: blur(12px);
  animation: floatCard 7s ease-in-out infinite;
}

.accent-book {
  left: 18px;
  top: 18%;
  transform: rotate(-14deg);
}

.accent-star {
  right: 24px;
  top: 12%;
  color: #f3b844;
  animation-delay: -1.2s;
}

.accent-pencil {
  right: 18px;
  bottom: 21%;
  transform: rotate(14deg);
  animation-delay: -2.2s;
}

.accent-note {
  left: 20px;
  bottom: 20%;
  animation-delay: -3.3s;
}

.brand-block {
  position: relative;
  text-align: center;
  margin-bottom: 22px;
}

.brand-glow {
  position: absolute;
  inset: 14px 18% auto;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0));
  filter: blur(10px);
  z-index: -1;
}

.brand-mark {
  width: 92px;
  height: 92px;
  margin: 0 auto 14px;
  padding: 5px;
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(230, 238, 255, 0.78));
  box-shadow: var(--login-shadow-lg);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 26px;
}

.brand-kicker {
  margin: 0 0 4px;
  color: #7d86a2;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-block h1 {
  margin: 0;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: clamp(2rem, 8vw, 2.8rem);
  line-height: 1;
  letter-spacing: 0.04em;
}

.brand-subtitle {
  width: min(100%, 290px);
  margin: 10px auto 0;
  color: var(--login-muted);
  font-size: 0.96rem;
  line-height: 1.55;
}

.login-card {
  position: relative;
  overflow: hidden;
  padding: 24px 18px 18px;
  border-radius: var(--login-radius-xl);
  background: var(--login-card);
  border: 1px solid var(--login-card-border);
  box-shadow: var(--login-shadow-md);
  backdrop-filter: blur(20px);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 110px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent);
  pointer-events: none;
}

.login-card-header {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-bottom: 18px;
}

.login-card-header h2 {
  margin: 0 0 6px;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
}

.login-card-header p {
  margin: 0;
  color: var(--login-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.form-message {
  display: none;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  font-weight: 600;
}

.form-message.is-success {
  display: block;
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}

.form-message.is-error {
  display: block;
  background: rgba(239, 68, 68, 0.12);
  color: #991b1b;
}

.login-form {
  position: relative;
  z-index: 1;
}

.input-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.88rem;
  font-weight: 700;
}

.phone-field,
.otp-field {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 60px;
  border-radius: 22px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(214, 223, 255, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.phone-field:focus-within,
.otp-field:focus-within {
  border-color: rgba(123, 109, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(123, 109, 255, 0.12);
  transform: translateY(-1px);
}

.country-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding-right: 12px;
  margin-right: 12px;
  border-right: 1px solid rgba(214, 223, 255, 0.9);
  font-weight: 800;
  color: #60698d;
}

.field-icon {
  color: #8a93b3;
  margin-right: 10px;
  font-size: 0.95rem;
}

.phone-field input,
.otp-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--login-text);
  font-size: 1rem;
  font-weight: 600;
}

.phone-field input::placeholder,
.otp-field input::placeholder {
  color: #9ea5c0;
  font-weight: 500;
}

.field-help {
  margin: 8px 2px 16px;
  color: var(--login-muted);
  font-size: 0.8rem;
}

.primary-button,
.secondary-button,
.google-button {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.96rem;
  font-weight: 800;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--login-primary), var(--login-primary-strong), var(--login-secondary));
  box-shadow: 0 18px 36px rgba(108, 105, 255, 0.24);
}

.secondary-button {
  margin-top: 12px;
  color: #fff;
  background: linear-gradient(135deg, #6d7cff, #7387ff);
  box-shadow: 0 14px 28px rgba(109, 124, 255, 0.18);
}

.google-button {
  color: #42506f;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(216, 224, 255, 0.95);
  box-shadow: 0 14px 28px rgba(97, 110, 170, 0.08);
}

.primary-button:hover,
.secondary-button:hover,
.google-button:hover {
  transform: translateY(-2px);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.google-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #fff 0%, #f3f6ff 100%);
  color: #db4437;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(220, 228, 255, 0.9);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
}

.divider span {
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(153, 164, 208, 0.55), transparent);
}

.divider em {
  color: var(--login-muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.recaptcha-slot {
  margin-top: 12px;
}

.otp-section[hidden] {
  display: none;
}

.otp-section {
  margin-top: 14px;
}

.otp-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.otp-help {
  margin: 0;
}

.text-button {
  border: 0;
  background: transparent;
  color: #5962d8;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}

.text-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.terms-footer {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  text-align: center;
}

.terms-footer p {
  margin: 0;
  color: var(--login-muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.terms-footer a {
  color: #5962d8;
  font-weight: 700;
  text-decoration: none;
}

.profile-modal[hidden] {
  display: none;
}

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.profile-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 32, 53, 0.55);
  backdrop-filter: blur(6px);
}

.profile-modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 28px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 255, 0.98));
  box-shadow: 0 30px 80px rgba(31, 42, 68, 0.28);
}

.profile-modal-card::-webkit-scrollbar {
  width: 8px;
}

.profile-modal-card::-webkit-scrollbar-thumb {
  background: rgba(123, 109, 255, 0.28);
  border-radius: 999px;
}

.profile-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.profile-modal-kicker {
  margin: 0 0 6px;
  color: #6f77a0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-modal-header h3 {
  margin: 0;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
}

.profile-modal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(123, 109, 255, 0.12);
  color: #5648da;
  font-size: 0.78rem;
  font-weight: 800;
}

.profile-modal-copy {
  margin: 12px 0 18px;
  color: var(--login-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.profile-modal-highlight {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(123, 109, 255, 0.12), rgba(112, 214, 255, 0.14));
  border: 1px solid rgba(173, 184, 255, 0.32);
}

.profile-highlight-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.82);
  color: #5f58df;
  font-size: 1.15rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.profile-modal-highlight strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.98rem;
  font-weight: 800;
  color: #253254;
}

.profile-modal-highlight p {
  margin: 0;
  color: #667293;
  font-size: 0.86rem;
  line-height: 1.55;
}

.profile-form {
  display: grid;
  gap: 12px;
}

.profile-field {
  display: grid;
}

.profile-input-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 0 16px;
  border: 1px solid rgba(214, 223, 255, 0.95);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.profile-input-shell:focus-within {
  border-color: rgba(123, 109, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(123, 109, 255, 0.12);
  transform: translateY(-1px);
}

.profile-input-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  color: #8a93b3;
  font-size: 0.95rem;
}

.profile-field input {
  width: 100%;
  min-height: 56px;
  padding: 0 2px 0 10px;
  border: 0;
  background: transparent;
  color: var(--login-text);
  font-size: 1rem;
  font-weight: 600;
  outline: 0;
}

.profile-field input::placeholder {
  color: #9ea5c0;
  font-weight: 500;
}

.profile-input-shell.is-readonly {
  background: rgba(244, 246, 255, 0.92);
}

.profile-field input[readonly] {
  color: #6a7293;
}

.profile-email-hint {
  margin: -2px 2px 2px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(96, 165, 250, 0.1);
  color: #365f98;
}

.profile-form-note {
  margin: -4px 2px 4px;
  color: #75809f;
  font-size: 0.8rem;
  line-height: 1.55;
}

.profile-form-actions {
  position: sticky;
  bottom: -24px;
  margin: 2px -24px -24px;
  padding: 14px 24px 18px;
  background: linear-gradient(180deg, rgba(246, 249, 255, 0), rgba(246, 249, 255, 0.94) 24%, rgba(246, 249, 255, 0.99) 100%);
  backdrop-filter: blur(6px);
}

.profile-form-actions .primary-button {
  min-height: 54px;
}

@keyframes floatCard {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@media (min-width: 768px) {
  .login-shell {
    padding: 36px 24px;
  }

  .login-content {
    width: min(100%, 520px);
  }

  .login-card {
    padding: 28px 24px 22px;
  }
}

@media (max-width: 420px) {
  .profile-modal {
    align-items: stretch;
    justify-content: center;
    padding: 6px;
  }

  .login-shell {
    padding-inline: 12px;
  }

  .floating-accent {
    width: 46px;
    height: 46px;
    border-radius: 16px;
  }

  .brand-mark {
    width: 82px;
    height: 82px;
  }

  .login-card {
    border-radius: 28px;
    padding-inline: 16px;
  }

  .phone-field,
  .otp-field {
    min-height: 56px;
  }

  .profile-modal-card {
    width: 100%;
    max-width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
    padding: 18px 16px 16px;
    border-radius: 22px;
  }

  .profile-modal-highlight {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
    margin-bottom: 14px;
  }

  .profile-modal-header {
    gap: 10px;
  }

  .profile-modal-header h3 {
    font-size: 1.35rem;
  }

  .profile-modal-copy {
    margin: 10px 0 14px;
    font-size: 0.88rem;
  }

  .profile-form {
    gap: 12px;
  }

  .profile-field .input-label {
    margin-bottom: 6px;
  }

  .profile-input-shell {
    min-height: 54px;
    padding: 0 14px;
  }

  .profile-field input {
    min-height: 52px;
    font-size: 0.96rem;
  }

  .profile-form-note {
    margin-top: -4px;
    margin-bottom: 0;
    font-size: 0.76rem;
    line-height: 1.45;
  }

  .profile-email-hint {
    margin-top: -2px;
    margin-bottom: 0;
    padding: 8px 10px;
    font-size: 0.76rem;
  }

  .profile-form-actions {
    bottom: -16px;
    margin: 0 -16px -16px;
    padding: 10px 16px 14px;
  }
}

@media (max-height: 760px) {
  .profile-modal {
    align-items: center;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .profile-modal-card {
    max-height: calc(100vh - 16px);
    padding: 18px;
  }

  .profile-modal-highlight {
    margin-bottom: 14px;
    padding: 14px;
  }

  .profile-form {
    gap: 12px;
  }

  .profile-form-actions {
    bottom: -18px;
    margin: 0 -18px -18px;
    padding: 10px 18px 14px;
  }
}

@media (max-height: 700px) {
  .profile-modal-card {
    max-height: calc(100vh - 10px);
    padding: 16px;
  }

  .profile-modal-header h3 {
    font-size: 1.3rem;
  }

  .profile-modal-copy {
    margin: 8px 0 12px;
    font-size: 0.86rem;
  }

  .profile-modal-highlight {
    gap: 10px;
    padding: 12px;
    margin-bottom: 12px;
  }

  .profile-highlight-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    font-size: 1rem;
  }

  .profile-modal-highlight strong {
    font-size: 0.92rem;
  }

  .profile-modal-highlight p {
    font-size: 0.8rem;
  }

  .profile-input-shell {
    min-height: 50px;
  }

  .profile-field input {
    min-height: 48px;
    font-size: 0.94rem;
  }

  .profile-form-actions {
    bottom: -16px;
    margin: 0 -16px -16px;
    padding: 8px 16px 12px;
  }
}
