* { box-sizing: border-box; }

:root {
  --ink: #0b2e3a;
  --muted: #66808b;
  --brand: #18c7c5;
  --brand-strong: #0d9f9e;
  --line: #d7e6eb;
  --surface: #ffffff;
  --soft: #edf7f8;
}

html {
  min-height: 100%;
  background: #e8f3f5;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: linear-gradient(135deg, #d9eef1, #f7fbfb 56%, #e5f3f4);
  color: var(--ink);
  font-family: "Noto Sans SC", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.login-shell {
  width: min(100%, 1120px);
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
  overflow: hidden;
  background: rgba(247, 253, 253, 0.88);
  box-shadow: 0 0 60px rgba(26, 91, 95, 0.14);
}

.login-visual {
  position: relative;
  min-width: 0;
  min-height: 100vh;
  overflow: hidden;
  background: #dff7f5;
}

.login-visual > picture:first-child {
  position: absolute;
  inset: 0;
  display: block;
}

.login-visual .login-scene {
  position: absolute;
  right: 0;
  bottom: 0;
  display: block;
  width: 46%;
  height: 100%;
  object-fit: cover;
  border-radius: 100px 0 0 0;
  opacity: 0.92;
}

.login-visual::after {
  display: none;
}

.login-visual > div {
  position: absolute;
  z-index: 1;
  right: clamp(28px, 5vw, 64px);
  bottom: clamp(42px, 8vh, 78px);
  left: clamp(24px, 2vw, 36px);
  max-width: 54%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.login-visual > div > picture {
  display: block;
  width: min(100%, 300px);
  aspect-ratio: 2.8 / 1;
  overflow: hidden;
}

.login-visual .login-brand-logo {
  display: block;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
  object-fit: cover !important;
  object-position: center !important;
}

.login-visual strong,
.login-visual span {
  display: block;
}

.login-visual strong {
  display: none;
}

.login-visual span {
  max-width: 300px;
  margin-top: 0;
  color: #31565f;
  font-size: 14px;
  line-height: 1.7;
}

.login-brand-break-mobile {
  display: none;
}

.login-panel {
  min-width: 0;
  min-height: 100vh;
  padding: clamp(34px, 6vw, 72px) clamp(28px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
  background: var(--surface);
}

.login-heading {
  min-width: 0;
}

.login-heading small {
  display: block;
  color: var(--brand-strong);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.login-heading h1 {
  margin: 10px 0 12px;
  color: var(--ink);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
}

.login-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.auth-tabs,
.auth-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  padding: 4px;
  border-radius: 12px;
  background: var(--soft);
}

.auth-tabs {
  margin: 26px 0 20px;
}

.auth-methods {
  margin: 16px 0 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.auth-tabs button,
.auth-methods button {
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.auth-methods button {
  min-height: 42px;
  border: 1px solid #bde3e0;
  border-radius: 9px;
  background: #f7fbfb;
  color: var(--brand-strong);
  font-size: 13px;
}

.auth-methods [data-auth-method="password"] {
  display: none;
}

.login-shell[data-auth-method="sms"] .auth-methods [data-auth-method="password"] {
  display: block;
}

.login-shell[data-auth-method="sms"] .auth-methods [data-auth-method="sms"] {
  display: none;
}

.auth-tabs button.active,
.auth-methods button.active {
  background: #fff;
  color: var(--brand-strong);
  box-shadow: 0 3px 10px rgba(22, 99, 105, 0.1);
}

.login-panel form {
  display: grid;
  gap: 15px;
  min-width: 0;
  margin: 0;
}

.login-panel form > label,
.auth-captcha-field > label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #36545c;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.login-panel input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.login-panel input::placeholder {
  color: #9aaeb4;
}

.login-panel input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(24, 199, 197, 0.14);
}

.sms-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 8px;
  min-width: 0;
}

.sms-code-row button {
  min-width: 0;
  border: 1px solid #bde3e0;
  border-radius: 9px;
  background: #edf8f6;
  color: #0b7775;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.sms-code-row button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-captcha-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.auth-captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 142px;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.auth-captcha-row input {
  text-transform: uppercase;
}

.auth-captcha-image {
  display: grid;
  place-items: center;
  width: 142px;
  height: 48px;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #bde3e0;
  border-radius: 8px;
  background: #edf8f6;
  color: #0b5363;
  font-size: 13px;
  cursor: pointer;
}

.auth-captcha-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-captcha-image [hidden],
.login-panel [hidden] {
  display: none !important;
}

.auth-captcha-image:focus-visible {
  outline: 3px solid rgba(24, 199, 197, 0.4);
  outline-offset: 2px;
}

.login-panel #captcha-status,
.login-error,
.auth-cooldown {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.login-panel #captcha-status {
  min-height: 0;
  color: #b54425;
  font-size: 12px;
  line-height: 18px;
}

.login-panel #captcha-status:empty,
.login-error:empty {
  display: none;
}

.login-error {
  margin: 0;
  color: #b54425;
  font-size: 13px;
  line-height: 20px;
}

.auth-cooldown {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff0e5;
  color: #9a4014;
  font-size: 13px;
  line-height: 20px;
}

.auth-cooldown[hidden] {
  display: none;
}

.login-submit,
.login-back {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.login-submit {
  margin-top: 2px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 7px 16px rgba(24, 199, 197, 0.2);
}

.login-submit:hover:not(:disabled) {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.login-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.login-back {
  margin-top: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: #52717a;
}

.login-back:hover {
  border-color: #a9d8d7;
  background: #f7fbfb;
  color: var(--brand-strong);
}

@media (max-width: 940px) and (min-width: 769px) {
  .login-shell {
    grid-template-columns: minmax(0, 0.94fr) minmax(360px, 1.06fr);
  }

  .login-panel {
    padding-inline: 32px;
  }
}

@media (max-width: 768px) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .login-shell {
    width: 100%;
    min-height: calc(100svh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    overflow: visible;
    background: transparent;
    box-shadow: none;
  }

  .login-visual {
    flex: 0 0 clamp(190px, 34svh, 270px);
    min-height: 0;
    max-height: 270px;
  }

  .login-shell[data-auth-mode="register"] .login-visual {
    flex-basis: clamp(130px, 22svh, 190px);
  }

  .login-visual > div {
    right: 22px;
    bottom: max(20px, env(safe-area-inset-bottom));
    left: 22px;
    max-width: 56%;
  }

  .login-visual > div > picture {
    width: 220px;
  }

  .login-visual .login-brand-logo {
    width: 100% !important;
    height: 100% !important;
  }

  .login-visual strong {
    display: none;
  }

  .login-visual span {
    font-size: 11px;
  }

  .login-brand-break-mobile {
    display: block;
  }

  .login-panel {
    flex: 1;
    align-self: stretch;
    min-height: 0;
    margin: 0;
    padding: 28px max(20px, 6vw) calc(24px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -8px 28px rgba(26, 91, 95, 0.1);
  }

  .login-heading h1 {
    font-size: 28px;
  }
}

@media (max-width: 420px) {
  .login-visual .login-scene {
    width: 44%;
  }

  .login-visual > div {
    max-width: 62%;
  }

  .login-visual > div > picture {
    width: 188px;
  }

  .login-visual .login-brand-logo {
    width: 100% !important;
    height: 100% !important;
  }

  .login-panel {
    padding-inline: 20px;
  }

  .auth-captcha-row {
    grid-template-columns: minmax(0, 1fr) 124px;
    gap: 8px;
  }

  .auth-captcha-image {
    width: 124px;
  }
}

@media (max-width: 380px), (max-height: 700px) {
  .login-visual {
    flex-basis: 160px;
  }

  .login-visual > div {
    bottom: 16px;
  }

  .login-panel {
    padding-top: 20px;
    padding-bottom: 16px;
  }

  .login-heading h1 {
    margin-top: 6px;
    font-size: 25px;
  }

  .login-heading p {
    margin-bottom: 12px;
  }

  .auth-tabs {
    margin-top: 18px;
    margin-bottom: 14px;
  }

  .login-panel form {
    gap: 11px;
  }

  .login-back {
    min-height: 44px;
    margin-top: 8px;
  }
}

@media (max-width: 380px) {
  .login-visual .login-scene {
    width: 36%;
  }

  .login-visual > div > picture {
    width: 165px;
  }

  .login-visual span {
    font-size: 10px;
  }
}

@media (max-width: 359px) {
  .auth-captcha-row {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .auth-captcha-image {
    width: 112px;
  }

  .auth-captcha-row input {
    padding-inline: 10px;
  }
}

@media (max-width: 768px) and (orientation: landscape) and (max-height: 560px) {
  body {
    overflow: auto;
  }

  .login-shell {
    display: grid;
    grid-template-columns: minmax(210px, 0.8fr) minmax(300px, 1.2fr);
    min-height: 100dvh;
  }

  .login-visual {
    min-height: 100dvh;
    max-height: none;
  }

  .login-panel {
    max-height: 100dvh;
    overflow-y: auto;
    border-radius: 0;
    padding: 24px max(24px, 5vw);
  }

  .login-heading p {
    margin-bottom: 18px;
  }

  .login-panel form {
    gap: 12px;
  }
}

@media (min-width: 769px) {
  .login-shell {
    border-radius: 0;
  }
}
