:root {
  --bg: #080b12;
  --surface: #0f1621;
  --surface-2: #0b111a;
  --line: rgba(163, 185, 215, 0.13);
  --line-strong: rgba(163, 185, 215, 0.22);
  --text: #e9eff8;
  --muted: #8b9ab0;
  --faint: #5f6f85;
  --accent: #5eead4;
  --blue: #7aa2ff;
  --danger: #ff7f8c;
  --warning: #e7b875;
  --radius: 18px;
  --font: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(760px 460px at 50% -12%, rgba(94, 234, 212, 0.07), transparent 64%),
    radial-gradient(600px 400px at 90% 100%, rgba(122, 162, 255, 0.04), transparent 70%),
    var(--bg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  color: #04110e;
  background: var(--accent);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.topbar {
  width: min(980px, calc(100% - 48px));
  margin: 0 auto;
  padding: 26px 0 14px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 620;
  letter-spacing: 0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.07);
  border: 1px solid rgba(94, 234, 212, 0.22);
  border-radius: 10px;
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(980px, calc(100% - 48px));
  min-height: calc(100vh - 90px);
  margin: 0 auto;
  padding: 36px 0 72px;
}

.card {
  width: 100%;
  max-width: 400px;
  color: var(--text);
  background: linear-gradient(165deg, rgba(17, 26, 40, 0.94), rgba(10, 16, 26, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.46);
}

.auth-card {
  padding: 30px;
}

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

.card-heading h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 620;
  letter-spacing: -0.03em;
  line-height: 1.22;
}

.card-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.alert {
  margin: 0 0 18px;
  padding: 11px 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 12.5px;
  line-height: 1.55;
}

.alert-error {
  color: #ffb0b8;
  background: rgba(255, 127, 140, 0.07);
  border-color: rgba(255, 127, 140, 0.2);
}

.alert-warning {
  color: #eccb97;
  background: rgba(231, 184, 117, 0.06);
  border-color: rgba(231, 184, 117, 0.18);
}

.alert-info {
  color: #a9c0ff;
  background: rgba(122, 162, 255, 0.06);
  border-color: rgba(122, 162, 255, 0.18);
}

.flash {
  width: min(100%, 400px);
  padding: 11px 13px;
  color: var(--muted);
  background: rgba(15, 22, 33, 0.92);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 12px;
  text-align: center;
  animation: fade-in 180ms ease-out;
}

.flash-success {
  color: #a4f4e7;
  border-color: rgba(94, 234, 212, 0.24);
  background: rgba(94, 234, 212, 0.06);
}

.flash-warning {
  color: #eccb97;
  border-color: rgba(231, 184, 117, 0.2);
  background: rgba(231, 184, 117, 0.05);
}

.flash-error {
  color: #ffb0b8;
  border-color: rgba(255, 127, 140, 0.2);
  background: rgba(255, 127, 140, 0.06);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label,
.label-row label {
  color: #c9d5e6;
  font-size: 12px;
  font-weight: 540;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.label-hint {
  color: var(--faint);
  font-size: 10px;
}

.label-hint.is-mismatch {
  color: var(--danger);
}

.label-hint.is-match {
  color: var(--accent);
}

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
}

.input-shell input {
  width: 100%;
  height: 48px;
  padding: 0 46px 0 41px;
  color: var(--text);
  background: rgba(7, 12, 20, 0.72);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  font-size: 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.input-shell input:hover {
  border-color: var(--line-strong);
}

.input-shell input:focus {
  background: rgba(9, 15, 24, 0.9);
  border-color: rgba(94, 234, 212, 0.6);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.07);
}

.input-shell input::placeholder {
  color: #536277;
}

.input-shell input:-webkit-autofill,
.input-shell input:-webkit-autofill:hover,
.input-shell input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px #0b131f inset;
  caret-color: var(--text);
}

.input-icon {
  position: absolute;
  left: 13px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #64758c;
  pointer-events: none;
}

.input-icon svg {
  width: 18px;
  height: 18px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #70839c;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease;
}

.password-toggle:hover {
  color: #d7e4f3;
  background: rgba(141, 168, 205, 0.08);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye-off {
  display: block;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: filter 150ms ease, transform 150ms ease, background-color 150ms ease;
}

.btn-block {
  width: 100%;
  margin-top: 2px;
}

.btn-primary {
  color: #051411;
  background: linear-gradient(105deg, #7df0dd, #4fe0c8 55%, #86aeff);
  box-shadow: 0 10px 28px rgba(72, 211, 190, 0.13);
}

.btn-primary:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.btn-secondary {
  color: var(--text);
  background: rgba(21, 31, 47, 0.9);
  border: 1px solid var(--line-strong);
}

.btn:disabled {
  cursor: wait;
  filter: saturate(0.8);
  transform: none;
}

.btn-loading {
  display: none;
  align-items: center;
  gap: 7px;
}

.btn.is-loading .btn-label {
  display: none;
}

.btn.is-loading .btn-loading {
  display: inline-flex;
}

.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(4, 17, 14, 0.22);
  border-top-color: #04110e;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.destination {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 20px 0 0;
  padding-top: 15px;
  color: var(--faint);
  border-top: 1px solid rgba(163, 185, 215, 0.09);
  font-size: 10.5px;
  line-height: 1.55;
}

.destination svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-top: 1px;
  color: #5d8f86;
}

.account-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(163, 185, 215, 0.09);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: #06201a;
  background: linear-gradient(140deg, #c5fff6, #4fe0c8);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 750;
}

.account-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.account-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 590;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy small {
  color: var(--faint);
  font-size: 10px;
}

.logout-form {
  display: flex;
  margin-left: auto;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #6d8099;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.icon-button:hover {
  color: #ff9ba5;
  background: rgba(255, 127, 140, 0.06);
  border-color: rgba(255, 127, 140, 0.16);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.strength {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 16px;
  margin-top: 1px;
}

.strength-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  width: 108px;
  flex: 0 0 108px;
}

.strength-bars span {
  height: 3px;
  background: #243146;
  border-radius: 99px;
  transition: background-color 170ms ease;
}

.strength[data-level="1"] .strength-bars span:nth-child(-n + 1) {
  background: #ff7f8c;
}

.strength[data-level="2"] .strength-bars span:nth-child(-n + 2) {
  background: var(--warning);
}

.strength[data-level="3"] .strength-bars span:nth-child(-n + 3) {
  background: var(--blue);
}

.strength[data-level="4"] .strength-bars span:nth-child(-n + 4) {
  background: var(--accent);
}

.strength-label {
  overflow: hidden;
  color: #64758c;
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strength-line {
  display: flex;
  justify-content: flex-end;
  margin-top: -3px;
}

.text-button {
  padding: 2px 0;
  color: #87d9cc;
  background: transparent;
  border: 0;
  font-size: 10px;
  cursor: pointer;
  transition: color 140ms ease;
}

.text-button:hover {
  color: #c9fff7;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.result-card {
  max-width: 430px;
  padding: 38px 30px 30px;
  text-align: center;
}

.success-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  color: #a2f7e9;
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid rgba(94, 234, 212, 0.28);
  border-radius: 50%;
  box-shadow: 0 0 38px rgba(94, 234, 212, 0.08);
}

.success-mark svg {
  width: 28px;
  height: 28px;
}

.result-card h1 {
  margin: 0 0 9px;
  font-size: 26px;
  font-weight: 620;
  letter-spacing: -0.03em;
}

.result-card p {
  margin: 0 auto 24px;
  max-width: 300px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.result-card p strong {
  color: var(--text);
  font-weight: 590;
}

.error-code {
  display: block;
  margin-bottom: 8px;
  color: var(--danger);
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 650;
  letter-spacing: -0.06em;
}

.error-card .btn {
  margin-top: 4px;
}

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

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 520px) {
  .topbar {
    width: calc(100% - 32px);
    padding-top: 20px;
  }

  .shell {
    width: calc(100% - 32px);
    min-height: calc(100vh - 76px);
    padding: 26px 0 44px;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .result-card {
    padding: 32px 21px 24px;
  }

  .card-heading h1 {
    font-size: 23px;
  }

  .input-shell input {
    height: 48px;
    font-size: 16px;
  }

  .flash {
    font-size: 11.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
