:root {
  --red: #d9272e;
  --red-dark: #a9141b;
  --red-soft: #fff0f0;
  --ink: #202126;
  --muted: #77747a;
  --line: #e7e2df;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: #faf9f7;
  font-family:
    "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 0.92fr) minmax(540px, 1.08fr);
}

.back-link {
  position: fixed;
  z-index: 10;
  top: 24px;
  right: 28px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #615d5a;
  background: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  text-decoration: none;
  backdrop-filter: blur(10px);
}

.back-link:hover {
  color: var(--red);
  border-color: #efb5b7;
}

.auth-visual {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 52px clamp(42px, 5vw, 78px);
  color: white;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.13), transparent 22%),
    linear-gradient(145deg, #8e1018, #ca222b 55%, #ec5e50);
}

.visual-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.15;
  background-image:
    linear-gradient(30deg, transparent 48%, rgba(255, 255, 255, 0.3) 50%, transparent 52%),
    linear-gradient(-30deg, transparent 48%, rgba(255, 255, 255, 0.25) 50%, transparent 52%);
  background-size: 38px 38px;
}

.auth-brand {
  position: absolute;
  z-index: 2;
  top: 34px;
  left: clamp(42px, 5vw, 78px);
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  text-decoration: none;
}

.brand-panda,
.mobile-panda {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #262629;
  background: #fffaf6;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  box-shadow: 0 6px 18px rgba(69, 7, 11, 0.18);
}

.auth-brand > span:last-child {
  display: flex;
  flex-direction: column;
}

.auth-brand strong {
  font-size: 20px;
}

.auth-brand small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 9px;
  letter-spacing: 1px;
}

.visual-copy {
  position: relative;
  z-index: 2;
  max-width: 520px;
  margin-top: -55px;
}

.visual-tag {
  display: inline-flex;
  padding: 6px 11px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
}

.visual-copy h1 {
  margin: 20px 0 14px;
  font-size: clamp(35px, 4.2vw, 58px);
  line-height: 1.18;
  letter-spacing: 1px;
}

.visual-copy p {
  max-width: 420px;
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 15px;
  line-height: 1.8;
}

.visual-panda {
  position: absolute;
  right: -45px;
  bottom: -70px;
  width: 260px;
  height: 245px;
  border-radius: 49% 49% 18% 18%;
  background: #fff9f4;
  box-shadow: inset 0 -25px 45px rgba(133, 27, 28, 0.08);
  transform: rotate(-7deg);
}

.visual-ear {
  position: absolute;
  top: -25px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: #252528;
}

.visual-ear.left {
  left: 12px;
}

.visual-ear.right {
  right: 12px;
}

.visual-eye {
  position: absolute;
  top: 75px;
  width: 45px;
  height: 58px;
  border-radius: 50%;
  background: #27272a;
}

.visual-eye::after {
  position: absolute;
  top: 17px;
  left: 17px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: white;
  content: "";
}

.visual-eye.left {
  left: 54px;
  transform: rotate(17deg);
}

.visual-eye.right {
  right: 54px;
  transform: rotate(-17deg);
}

.visual-nose {
  position: absolute;
  top: 137px;
  left: 116px;
  width: 28px;
  height: 18px;
  border-radius: 50% 50% 55% 55%;
  background: #27272a;
}

.trust-row {
  position: absolute;
  z-index: 2;
  bottom: 33px;
  left: clamp(42px, 5vw, 78px);
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 10px;
}

.auth-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 72px 30px 38px;
}

.mobile-brand {
  display: none;
}

.auth-card {
  width: min(500px, 100%);
  padding: 10px;
}

.auth-heading {
  margin-bottom: 24px;
}

.heading-eyebrow {
  color: var(--red);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.auth-heading h2 {
  margin: 7px 0 6px;
  font-size: 29px;
  letter-spacing: -0.5px;
}

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

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: 11px;
  background: #eeecea;
}

.auth-tab {
  height: 40px;
  border: 0;
  border-radius: 8px;
  color: #77716e;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.auth-tab.active {
  color: var(--red-dark);
  background: white;
  box-shadow: 0 2px 8px rgba(44, 32, 29, 0.08);
}

.form-alert {
  margin-bottom: 15px;
  padding: 11px 13px;
  border: 1px solid #f0c5c6;
  border-radius: 8px;
  color: #9d1920;
  background: #fff2f2;
  font-size: 12px;
  line-height: 1.5;
}

.auth-form {
  display: none;
  gap: 15px;
}

.auth-form.active {
  display: grid;
}

.field > span:first-child,
.avatar-picker legend {
  display: block;
  margin-bottom: 7px;
  color: #4c4947;
  font-size: 11px;
  font-weight: 650;
}

.input-wrap {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #dad6d3;
  border-radius: 9px;
  background: white;
  transition: 0.2s ease;
}

.input-wrap:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.input-wrap input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.input-wrap input::placeholder {
  color: #aaa5a1;
}

.input-icon,
.input-prefix {
  width: 20px;
  color: #aaa4a0;
  text-align: center;
  font-size: 15px;
}

.id-input {
  gap: 0;
}

.password-toggle,
.text-button {
  border: 0;
  color: var(--red-dark);
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}

.text-button.standalone {
  justify-self: center;
  margin-top: -2px;
}

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

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.remember-row,
.terms-row {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #6e6966;
  font-size: 11px;
}

.remember-row input,
.terms-row input {
  accent-color: var(--red);
}

.terms-row {
  align-items: flex-start;
  line-height: 1.6;
}

.terms-row a {
  color: var(--red-dark);
  text-decoration: none;
}

.avatar-picker {
  margin: 0;
  padding: 0;
  border: 0;
}

.avatar-options {
  display: flex;
  gap: 10px;
}

.avatar-options label {
  cursor: pointer;
}

.avatar-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-preview {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 3px solid white;
  border-radius: 50%;
  color: #fffaf5;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1px;
  box-shadow: 0 0 0 1px #ddd8d4;
  transition: 0.18s ease;
}

.avatar-options input:checked + .avatar-preview {
  box-shadow:
    0 0 0 2px var(--red),
    0 5px 13px rgba(217, 39, 46, 0.22);
  transform: translateY(-2px);
}

.style-0 {
  background: linear-gradient(145deg, #d9272e, #8f1117);
}

.style-1 {
  background: linear-gradient(145deg, #ef6b54, #bd2730);
}

.style-2 {
  background: linear-gradient(145deg, #db3340, #f09b69);
}

.style-3 {
  background: linear-gradient(145deg, #ba1f34, #6e1832);
}

.style-4 {
  background: linear-gradient(145deg, #e54435, #eea84c);
}

.style-5 {
  background: linear-gradient(145deg, #c52731, #64232c);
}

.submit-button {
  position: relative;
  height: 48px;
  margin-top: 2px;
  border: 0;
  border-radius: 9px;
  color: white;
  background: var(--red);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(217, 39, 46, 0.2);
}

.submit-button:hover {
  background: var(--red-dark);
}

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

.button-loader {
  display: none;
  width: 17px;
  height: 17px;
  margin: auto;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.submit-button.loading span {
  display: none;
}

.submit-button.loading .button-loader {
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: #99938f;
  font-size: 10px;
}

.auth-toast {
  position: fixed;
  z-index: 20;
  bottom: 24px;
  left: 50%;
  padding: 11px 17px;
  border-radius: 8px;
  color: white;
  background: rgba(32, 31, 31, 0.94);
  font-size: 12px;
  opacity: 0;
  transform: translate(-50%, 15px);
  transition: 0.2s ease;
  pointer-events: none;
}

.auth-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .auth-page {
    display: block;
  }

  .auth-visual {
    display: none;
  }

  .auth-panel {
    min-height: 100vh;
    padding: 75px 20px 35px;
  }

  .mobile-brand {
    position: absolute;
    top: 22px;
    left: 22px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--red);
  }

  .mobile-panda {
    width: 36px;
    height: 36px;
    color: white;
    background: var(--red);
    font-size: 9px;
  }

  .back-link {
    top: 22px;
    right: 18px;
  }
}

@media (max-width: 520px) {
  .auth-panel {
    align-items: start;
    padding-top: 104px;
  }

  .auth-card {
    padding: 0;
  }

  .auth-heading h2 {
    font-size: 26px;
  }

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

  .avatar-options {
    justify-content: space-between;
    gap: 5px;
  }

  .avatar-preview {
    width: 40px;
    height: 40px;
  }
}
