:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #e9f1fb;
  background: #071528;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 5%, rgba(32, 113, 204, .2), transparent 52%),
    linear-gradient(145deg, #071528 0%, #0a1830 52%, #091323 100%);
}

button,
input,
select {
  font: inherit;
}

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

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-header {
  width: min(1120px, calc(100% - 40px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #f3f8ff;
  text-decoration: none;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .14em;
}

.auth-brand img {
  display: block;
  object-fit: contain;
}

.language-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #9eb0c8;
  font-size: 13px;
}

.language-select-wrap {
  position: relative;
  display: inline-flex;
  min-width: 132px;
  min-height: 40px;
  border: 1px solid rgba(111, 145, 190, .4);
  border-radius: 12px;
  background: linear-gradient(155deg, rgba(33, 56, 85, .96), rgba(12, 27, 47, .98));
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.language-select-wrap:hover {
  border-color: rgba(56, 200, 242, .72);
  background-color: #142742;
}

.language-select-wrap:focus-within {
  outline: 2px solid #38c8f2;
  outline-offset: 2px;
}

.language-select-visual {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  color: #e9f1fb;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}

.language-select-visual img {
  display: block;
  flex: 0 0 auto;
  width: 20px;
  height: 14px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .18);
}

.language-select-visual > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.language-select-visual svg {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-left: auto;
  fill: none;
  stroke: #9eb0c8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.language-select-wrap select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.language-control select option {
  color: #e9f1fb;
  background: #101f35;
}

.auth-main {
  flex: 1;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 34px 20px 48px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.auth-card {
  width: 100%;
  padding: clamp(22px, 5vw, 40px);
  border: 1px solid rgba(135, 165, 206, .19);
  border-radius: 20px;
  background: linear-gradient(155deg, rgba(20, 38, 63, .97), rgba(11, 24, 42, .98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

.auth-card-heading {
  text-align: center;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 9px;
  color: #32c8f4;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .22em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 9px;
  font-size: clamp(25px, 5vw, 32px);
  letter-spacing: -.025em;
}

h2 {
  margin-bottom: 10px;
  font-size: 21px;
}

.intro {
  margin: 0;
  color: #a9bad0;
  font-size: 14px;
  line-height: 1.55;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid rgba(137, 165, 202, .13);
  border-radius: 12px;
  background: rgba(3, 12, 24, .38);
}

.auth-tab,
.mode-switch button {
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  color: #9eafc5;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.auth-tab[aria-selected="true"],
.mode-switch button[aria-pressed="true"] {
  color: #f5f9ff;
  background: #203854;
  box-shadow: inset 0 0 0 1px rgba(121, 165, 215, .2);
}

.auth-view[hidden],
[hidden] {
  display: none !important;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 0 0 17px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(3, 12, 24, .38);
}

form {
  display: grid;
  gap: 15px;
}

.field {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: #d7e3f2;
  font-size: 13px;
  font-weight: 650;
}

.field small {
  color: #8da1ba;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #30445f;
  border-radius: 10px;
  outline: none;
  color: #f0f6ff;
  background: #0a1729;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.password-input-wrap {
  position: relative;
  display: block;
  min-width: 0;
}

.password-input-wrap > input {
  padding-right: 48px;
}

.password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  color: #9eb4cf;
  background: transparent;
  cursor: pointer;
}

.password-visibility-toggle:hover {
  color: #57d2f3;
  background: rgba(67, 117, 166, .2);
}

.password-visibility-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.password-visibility-toggle__slash {
  display: none;
}

.password-visibility-toggle[aria-pressed="true"] .password-visibility-toggle__slash {
  display: block;
}

.field input::placeholder {
  color: #71849c;
}

.field input:focus,
.field select:focus,
.language-control select:focus,
button:focus-visible,
a:focus-visible,
.backup-code:focus-visible {
  outline: 2px solid #38c8f2;
  outline-offset: 2px;
}

.field input:focus,
.field select:focus {
  border-color: #35bfe9;
  box-shadow: 0 0 0 3px rgba(53, 191, 233, .12);
}

.challenge-block {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(95, 140, 191, .24);
  border-radius: 12px;
  background: rgba(7, 18, 33, .58);
}

.challenge-title {
  margin: 0;
  color: #aebed2;
  font-size: 12px;
  font-weight: 700;
}

.challenge-question {
  margin: 0;
  color: #f4f8ff;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: .04em;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  transition: transform .15s ease, filter .15s ease, opacity .15s ease;
}

.primary-button {
  color: #041522;
  background: linear-gradient(100deg, #45d0f0, #9b83ff);
}

.primary-button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: .65;
}

.button-link {
  display: flex;
  align-items: center;
  justify-content: center;
}

.button-link[aria-disabled="true"] {
  cursor: not-allowed;
  filter: grayscale(.45);
  opacity: .5;
}

.secondary-button {
  color: #dbe8f8;
  background: #243a56;
  border: 1px solid rgba(150, 178, 215, .2);
}

.secondary-link {
  display: inline-block;
  margin-top: 15px;
  color: #70d7f4;
  font-size: 13px;
  text-align: center;
  text-decoration: none;
}

.notice,
.footnote {
  color: #aebed2;
  font-size: 12px;
  line-height: 1.55;
}

.notice {
  margin: 16px 0 0;
  padding: 11px 12px;
  border: 1px solid rgba(95, 140, 191, .22);
  border-radius: 10px;
  background: rgba(10, 25, 43, .6);
}

.footnote {
  margin: 23px 0 0;
  color: #879ab2;
  text-align: center;
}

.status-message {
  margin: 0 0 16px;
  padding: 12px 13px;
  border: 1px solid rgba(95, 140, 191, .24);
  border-radius: 10px;
  color: #eaf3ff;
  background: rgba(14, 33, 55, .8);
  font-size: 13px;
  line-height: 1.5;
}

.status-message[data-kind="error"] {
  border-color: rgba(255, 112, 132, .42);
  color: #ffd5dc;
  background: rgba(83, 24, 39, .32);
}

.status-message[data-kind="success"] {
  border-color: rgba(71, 218, 172, .38);
  color: #c9ffeb;
  background: rgba(13, 69, 58, .26);
}

.success-title {
  margin-bottom: 8px;
  color: #d9ffef;
  font-size: 18px;
  font-weight: 750;
}

.account-email {
  margin: 0 0 14px;
  color: #b7c8dd;
  overflow-wrap: anywhere;
}

.save-confirmation {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0;
  color: #d8e4f2;
  font-size: 13px;
  line-height: 1.45;
}

.save-confirmation input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #39c7ee;
}

.question-summary {
  margin: 15px 0;
  color: #aebed2;
  font-size: 13px;
  line-height: 1.5;
}

.question-summary strong {
  display: inline-block;
  margin-inline-start: 5px;
  color: #f4f8ff;
  letter-spacing: .04em;
}

.remember-control {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #aebed2;
  font-size: 13px;
}

.privacy-consent {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #aebed2;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

.privacy-consent input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 1px 0 0;
  accent-color: #45d0f0;
}

.privacy-consent__copy {
  min-width: 0;
  overflow-wrap: anywhere;
}

.privacy-consent a {
  color: #70d7f4;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.remember-control input,
.save-confirmation input {
  accent-color: #45d0f0;
}

.recovery-question-display {
  padding: 12px;
  border: 1px solid rgba(95, 140, 191, .24);
  border-radius: 10px;
  background: rgba(7, 18, 33, .58);
}

.backup-code-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 13px;
  padding: 10px;
  border: 1px solid rgba(95, 140, 191, .35);
  border-radius: 12px;
  background: rgba(6, 22, 38, .68);
}

.backup-code-row .backup-code {
  flex: 1;
  min-width: 0;
  margin: 0;
  border: 0;
  background: transparent;
}

.backup-code {
  margin: 0 0 13px;
  padding: 14px 10px;
  border: 1px dashed rgba(68, 206, 244, .6);
  border-radius: 10px;
  color: #b6f1ff;
  background: rgba(6, 22, 38, .9);
  font-family: Consolas, "Courier New", monospace;
  font-size: clamp(17px, 4vw, 21px);
  font-weight: 800;
  letter-spacing: .04em;
  overflow-wrap: anywhere;
  text-align: center;
  user-select: all;
}

.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.passkey-panel {
  display: grid;
  gap: 14px;
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid rgba(137, 165, 202, .18);
}

.passkey-panel h2,
.passkey-panel .notice {
  margin-bottom: 0;
}

.passkey-notice {
  border: 1px solid rgba(95, 140, 191, .24);
  border-radius: 10px;
  color: #d7e3f2;
  background: rgba(7, 18, 33, .58);
  font-size: 13px;
}

.passkey-notice summary {
  padding: 12px;
  cursor: pointer;
  font-weight: 700;
}

.passkey-notice-copy {
  padding: 0 12px 4px;
  color: #aebed2;
  line-height: 1.55;
}

.passkey-notice-copy p:last-child {
  margin-bottom: 8px;
}

.passkey-list {
  display: grid;
  gap: 10px;
}

.passkey-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(95, 140, 191, .24);
  border-radius: 10px;
  background: rgba(7, 18, 33, .58);
}

.passkey-item-name {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #f0f6ff;
  font-weight: 700;
}

.passkey-item-date {
  display: block;
  margin-top: 4px;
  color: #8da1ba;
  font-size: 11px;
  font-weight: 400;
}

.passkey-item input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #30445f;
  border-radius: 9px;
  color: #f0f6ff;
  background: #0a1729;
}

.passkey-item button {
  min-height: 40px;
  padding: 8px 10px;
}

@media (max-width: 480px) {
  .auth-header {
    width: calc(100% - 28px);
    min-height: 65px;
  }

  .auth-main {
    padding: 20px 12px 32px;
  }

  .auth-card {
    padding: 22px 17px;
    border-radius: 16px;
  }

  .auth-tabs {
    gap: 2px;
  }

  .auth-tab {
    padding: 7px 4px;
    font-size: 11px;
  }

  .passkey-item {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .passkey-item-name {
    grid-column: 1 / -1;
  }

  .passkey-item input {
    grid-column: 1 / -1;
  }
}

@media (max-width: 360px) {
  .auth-header {
    gap: 8px;
  }

  .language-control {
    gap: 6px;
    font-size: 12px;
  }

  .language-select-wrap {
    width: 132px;
    min-width: 132px;
    max-width: 132px;
  }

  .language-control > span[data-i18n] {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
