:root {
  color-scheme: light;
  --bg: #e7f6ff;
  --panel: #f8fcff;
  --panel-soft: #e2f3fd;
  --ink: #173247;
  --muted: #607f92;
  --line: #badced;
  --accent: #258fd0;
  --accent-strong: #176fae;
  --danger: #e0001b;
  --warning: #f2ba5b;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(330px, 0.9fr) minmax(520px, 1.1fr);
}

.brand-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(42px, 7vw, 96px);
  background:
    radial-gradient(circle at 76% 18%, rgba(40, 209, 178, 0.18), transparent 24%),
    linear-gradient(90deg, rgba(40, 209, 178, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(40, 209, 178, 0.06) 1px, transparent 1px),
    #0b100d;
  background-size: auto, 44px 44px, 44px 44px, auto;
  border-right: 1px solid var(--line);
}

.brand-panel::after {
  content: "";
  position: absolute;
  width: 440px;
  height: 440px;
  right: -260px;
  bottom: -230px;
  border: 1px solid rgba(40, 209, 178, 0.32);
  border-radius: 50%;
  box-shadow: 0 0 0 60px rgba(40, 209, 178, 0.025), 0 0 0 120px rgba(40, 209, 178, 0.018);
}

.brand-mark {
  width: 76px;
  height: 38px;
  position: relative;
  margin-bottom: clamp(34px, 7vh, 78px);
}

.brand-scale {
  position: absolute;
  left: 0;
  top: 14px;
  width: 76px;
  height: 10px;
  border-top: 3px solid var(--accent);
  background: repeating-linear-gradient(90deg, transparent 0 5px, var(--accent) 5px 6px);
}

.brand-jaw,
.brand-jaw::after {
  position: absolute;
  content: "";
  width: 14px;
  height: 31px;
  border: 3px solid var(--accent);
  border-right: 0;
  border-radius: 2px 0 0 2px;
}

.brand-jaw {
  left: 3px;
  top: 0;
}

.brand-jaw::after {
  left: 38px;
  top: -3px;
  transform: scaleX(-1);
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.brand-panel h1 {
  margin: 16px 0 22px;
  font-size: clamp(38px, 5vw, 68px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.form-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 36px;
  background:
    radial-gradient(circle at 50% 45%, rgba(40, 209, 178, 0.06), transparent 34%),
    var(--bg);
}

.form-card {
  width: min(100%, 560px);
  padding: clamp(26px, 4vw, 46px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16, 23, 19, 0.92);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.demo-notice {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  margin-bottom: 22px;
  border: 1px solid rgba(242, 186, 91, 0.32);
  border-radius: 9px;
  background: rgba(242, 186, 91, 0.07);
  color: #e6d1a8;
  font-size: 12px;
  line-height: 1.5;
}

.demo-notice strong {
  color: var(--warning);
}

.auth-form {
  display: grid;
  gap: 17px;
}

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

.auth-subform {
  display: grid;
  gap: 17px;
}

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

.login-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
}

.login-methods button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.login-methods button.active {
  background: var(--panel);
  color: var(--accent-strong);
  box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgba(32, 111, 160, 0.12);
  font-weight: 800;
}

.auth-links {
  display: flex;
  justify-content: flex-end;
  margin-top: -7px;
}

.auth-entry-links {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.auth-entry-links p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-links a,
.back-auth-link,
.text-link {
  color: var(--accent-strong);
  font-size: 13px;
  text-decoration: none;
}

.text-link {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.text-link:hover,
.auth-links a:hover {
  text-decoration: underline;
}

.back-auth-link {
  display: inline-flex;
  margin-bottom: 24px;
}

.field-hint {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.field-hint.success {
  color: #08752f;
}

.field-hint.error {
  color: var(--danger);
}

.form-heading {
  display: grid;
  gap: 5px;
  margin-bottom: 4px;
}

.form-heading p {
  margin: 0;
  font-size: 25px;
  font-weight: 750;
}

.form-heading span,
.security-note {
  color: var(--muted);
  font-size: 13px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label > span {
  color: #bed0c7;
  font-size: 13px;
}

input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #0a100d;
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 209, 178, 0.12);
}

input::placeholder {
  color: #62756c;
}

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 152px;
  align-items: end;
  gap: 11px;
}

.code-button {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--accent);
  cursor: pointer;
}

.code-button:disabled {
  color: var(--muted);
  cursor: wait;
}

.submit-button {
  min-height: 48px;
  margin-top: 5px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #05110d;
  font-weight: 800;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

.submit-button:hover {
  background: #42e5c7;
}

.submit-button:active {
  transform: translateY(1px);
}

.submit-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.form-message {
  min-height: 22px;
  margin-top: 16px;
  color: var(--accent);
  font-size: 13px;
  line-height: 1.6;
}

.form-message.error {
  color: var(--danger);
}

@media (max-width: 900px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: auto;
    padding: 34px 28px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand-mark {
    margin-bottom: 28px;
  }

  .brand-panel h1 {
    margin: 10px 0 14px;
    font-size: 36px;
  }

  .form-panel {
    min-height: auto;
    padding: 24px 16px 48px;
    place-items: start center;
  }
}

@media (max-width: 560px) {
  .brand-panel {
    padding: 26px 20px;
  }

  .form-card {
    padding: 22px 17px;
    border-radius: 12px;
  }

  .two-columns {
    grid-template-columns: 1fr;
  }

  .code-row {
    grid-template-columns: minmax(0, 1fr) 126px;
  }

  .code-button {
    padding: 0 8px;
    font-size: 12px;
  }
}

.language-picker { position:relative; display:inline-flex; z-index:30; }
.form-card > .language-picker { position:absolute; top:16px; right:18px; }
.form-card > .language-picker .auth-language-toggle { position:static; }
.language-menu { position:absolute; right:0; top:calc(100% + 8px); z-index:40; display:none; min-width:150px; padding:6px; border:1px solid var(--line); border-radius:10px; background:var(--panel); box-shadow:0 18px 48px rgba(20,52,94,.22); }
.language-picker.open .language-menu { display:grid; gap:4px; }
.language-menu button { width:100%; min-height:38px; border:0; border-radius:7px; padding:0 11px; color:var(--ink); background:transparent; text-align:left; }
.language-menu button.active { color:var(--accent-strong); background:var(--accent-soft); }
.language-menu button.active::before { content:"✓"; margin-right:8px; color:var(--accent); }
html[data-language="en"] .auth-card button,html[data-language="en"] .login-links { line-height:1.25; }
@media (max-width:560px) { .form-card > .language-picker { top:14px; right:15px; } }

html[data-theme="sky"] {
  color-scheme: light;
  --bg: #e7f6ff;
  --panel: #f8fcff;
  --panel-soft: #e2f3fd;
  --ink: #173247;
  --muted: #607f92;
  --line: #badced;
  --accent: #35ace2;
  --accent-strong: #168bc3;
}

html[data-theme="white"] {
  color-scheme: light;
  --bg: #f7fbff;
  --panel: #ffffff;
  --panel-soft: #eef7fd;
  --ink: #17334a;
  --muted: #5d7a90;
  --line: #c7deee;
  --accent: #176fc1;
  --accent-strong: #0f5da6;
}

html[data-theme="purple"] {
  color-scheme: light;
  --bg: #f7f4ff;
  --panel: #ffffff;
  --panel-soft: #f0eaff;
  --ink: #2d2450;
  --muted: #756b91;
  --line: #ddd3f2;
  --accent: #7c56da;
  --accent-strong: #5e38bd;
}

html[data-theme="green"] {
  color-scheme: light;
  --bg: #f1faf6;
  --panel: #ffffff;
  --panel-soft: #e7f6ef;
  --ink: #173c2d;
  --muted: #637f72;
  --line: #cfe7db;
  --accent: #219b69;
  --accent-strong: #14784f;
}

html[data-theme] body,
html[data-theme] .form-panel {
  background: var(--bg);
}

html[data-theme] .brand-panel {
  background:
    radial-gradient(circle at 76% 18%, color-mix(in srgb, var(--accent) 19%, transparent), transparent 24%),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 7%, transparent) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--accent) 6%, transparent) 1px, transparent 1px),
    var(--panel);
  background-size: auto, 44px 44px, 44px 44px, auto;
}

html[data-theme] .form-card,
html[data-theme] input {
  background: var(--panel);
  color: var(--ink);
}

html[data-theme] .submit-button {
  color: #ffffff;
}

html[data-theme] .login-methods,
html[data-theme] .code-button {
  background: var(--panel-soft);
}

html[data-theme] .login-methods button.active {
  background: var(--panel);
  color: var(--accent-strong);
}

.form-card {
  position: relative;
  padding-top: clamp(58px, 5vw, 68px);
}

.auth-language-toggle {
  position: absolute;
  top: 16px;
  right: 18px;
  min-width: 58px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

html[data-language="en"] .brand-panel h1 {
  font-size: clamp(34px, 4.6vw, 62px);
  letter-spacing: -0.035em;
}

html[data-language="en"] .form-card {
  width: min(100%, 610px);
}

html[data-language="en"] .login-methods button,
html[data-language="en"] .submit-button,
html[data-language="en"] .code-button {
  line-height: 1.25;
}

@media (max-width: 560px) {
  .form-card {
    padding-top: 58px;
  }

  .auth-language-toggle {
    top: 14px;
    right: 15px;
  }
}
