:root {
  --auth-bg: #000814;
  --auth-blue: #0075ff;
  --auth-blue-soft: #6ba8ff;
  --auth-text: #ffffff;
  --auth-muted: rgba(255, 255, 255, 0.62);
  --auth-soft: rgba(255, 255, 255, 0.4);
  --auth-field: rgba(255, 255, 255, 0.1);
  --auth-field-strong: rgba(255, 255, 255, 0.16);
  --auth-line: rgba(255, 255, 255, 0.14);
  --auth-panel: rgba(12, 18, 29, 0.72);
  --auth-radius: 22px;
  --auth-font: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  overscroll-behavior: none;
  background: var(--auth-bg);
}

body.auth-body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 88% 0%, rgba(0, 117, 255, 0.34), transparent 36%),
    radial-gradient(circle at 16% 18%, rgba(79, 85, 241, 0.18), transparent 34%),
    linear-gradient(145deg, #092644 0%, #000814 58%, #02050d 100%);
  color: var(--auth-text);
  font-family: var(--auth-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.auth-body::before {
  content: "";
  position: fixed;
  inset: -20%;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 16%, rgba(255, 255, 255, 0.045) 38%, transparent 54%),
    radial-gradient(circle at 56% 26%, rgba(94, 151, 255, 0.18), transparent 24%);
  filter: blur(18px);
  opacity: 0.75;
  animation: auth-bg-shift 14s ease-in-out infinite alternate;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.auth-card {
  display: flex;
  flex-direction: column;
  width: min(100%, 440px);
  min-height: min(860px, calc(100vh - 56px));
  padding: 42px 28px 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(6, 14, 25, 0.72), rgba(2, 5, 13, 0.78));
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(28px);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
  margin-bottom: clamp(52px, 8vh, 88px);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.auth-brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: #0b1320;
}

.auth-brand-mark svg {
  width: 27px;
  height: 27px;
  fill: currentColor;
  stroke: none;
}

.auth-view {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  animation: auth-view-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

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

.auth-copy h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(2.5rem, 11vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 0.96;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.auth-copy p {
  max-width: 340px;
  margin: 22px 0 0;
  color: var(--auth-muted);
  font-size: 1.04rem;
  line-height: 1.58;
}

.auth-form {
  display: grid;
  gap: 13px;
  margin-top: 36px;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-field span {
  color: var(--auth-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  height: 58px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 18px;
  outline: none;
  background: var(--auth-field);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.auth-field input::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.auth-field input:focus {
  border-color: rgba(107, 168, 255, 0.72);
  background: var(--auth-field-strong);
  box-shadow: 0 0 0 5px rgba(0, 117, 255, 0.16);
}

.auth-field--password {
  position: relative;
}

.auth-field--password input {
  padding-right: 76px;
}

.auth-field--password button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 60px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.8rem;
  font-weight: 800;
}

.auth-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 2px 0 10px;
}

.auth-link {
  padding: 0;
  background: transparent;
  color: var(--auth-blue-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-primary,
.auth-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 64px;
  border-radius: 999px;
  font-size: 1.12rem;
  font-weight: 800;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, opacity 180ms ease;
}

.auth-primary {
  background: #fff;
  color: #0b0e14;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
}

.auth-primary:disabled {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.4);
  box-shadow: none;
  cursor: not-allowed;
}

.auth-primary--ready {
  margin-top: 32px;
}

.auth-secondary {
  background: rgba(255, 255, 255, 0.055);
  color: #fff;
}

.auth-primary:not(:disabled):active,
.auth-secondary:active,
.auth-social:active,
.auth-back:active {
  transform: scale(0.97);
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  margin: 42px 0 28px;
  color: rgba(255, 255, 255, 0.42);
}

.auth-divider span {
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
}

.auth-divider strong {
  font-size: 0.88rem;
  font-weight: 600;
}

.auth-social-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.auth-social {
  display: grid;
  justify-items: center;
  gap: 11px;
  padding: 0;
  background: transparent;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 800;
}

.auth-social-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transition: background 180ms ease, box-shadow 180ms ease;
}

.auth-social-icon svg {
  width: 26px;
  height: 26px;
}

.auth-social-icon--google svg {
  stroke: none;
}

.auth-social.is-selected .auth-social-icon,
.auth-social:hover .auth-social-icon {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.auth-create-prompt {
  display: grid;
  gap: 20px;
  margin-top: auto;
  padding-top: 46px;
  text-align: center;
}

.auth-create-prompt span {
  color: var(--auth-muted);
  font-size: 1.02rem;
  font-weight: 700;
}

.auth-back {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.auth-back svg {
  width: 25px;
  height: 25px;
}

.qr-card {
  display: grid;
  gap: 22px;
  justify-items: center;
  margin-top: 42px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.07);
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.qr-code {
  width: 176px;
  height: 176px;
  color: #fff;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.34));
}

.qr-code rect {
  fill: rgba(255, 255, 255, 0.96);
  stroke: none;
}

.qr-code path {
  fill: #050b16;
  stroke: none;
}

.qr-card strong,
.qr-card span {
  display: block;
}

.qr-card strong {
  font-size: 1.08rem;
  font-weight: 800;
}

.qr-card span {
  margin-top: 7px;
  color: var(--auth-muted);
  line-height: 1.45;
}

.auth-desktop-qr {
  display: none;
}

.auth-message {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--auth-blue-soft);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.auth-message.is-error {
  color: #ff8f86;
}

.auth-message.is-success {
  color: #74f1b7;
}

.auth-footer {
  display: grid;
  gap: 18px;
  justify-items: center;
  margin-top: 22px;
  color: rgba(255, 255, 255, 0.68);
}

.auth-footer button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.95rem;
  font-weight: 600;
}

.auth-footer svg {
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.4);
}

.auth-footer a {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.92rem;
  font-weight: 600;
}

.uk-flag {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 16px;
  overflow: hidden;
  border-radius: 2px;
  background:
    linear-gradient(33deg, transparent 42%, #fff 42% 48%, #c8102e 48% 54%, #fff 54% 60%, transparent 60%),
    linear-gradient(147deg, transparent 42%, #fff 42% 48%, #c8102e 48% 54%, #fff 54% 60%, transparent 60%),
    linear-gradient(90deg, transparent 38%, #fff 38% 45%, #c8102e 45% 55%, #fff 55% 62%, transparent 62%),
    linear-gradient(0deg, transparent 34%, #fff 34% 42%, #c8102e 42% 58%, #fff 58% 66%, transparent 66%),
    #012169;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

@keyframes auth-view-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes auth-bg-shift {
  from {
    transform: translate3d(-1%, -1%, 0) scale(1);
  }
  to {
    transform: translate3d(1%, 1%, 0) scale(1.04);
  }
}

@media (min-width: 721px) {
  body.auth-body {
    min-height: 100vh;
    background:
      radial-gradient(circle at 10% 20%, rgba(10, 40, 80, 0.98) 0%, rgba(2, 8, 20, 0.98) 58%),
      linear-gradient(135deg, #09264b 0%, #020814 70%);
  }

  body.auth-body::before {
    inset: -12% auto auto -8%;
    width: 56vw;
    height: 56vw;
    background: radial-gradient(circle, rgba(29, 78, 216, 0.18) 0%, transparent 68%);
    filter: blur(64px);
  }

  .auth-shell {
    min-height: 100vh;
    align-items: stretch;
    padding: clamp(32px, 4vw, 56px) clamp(42px, 5vw, 76px);
  }

  .auth-card {
    position: relative;
    display: grid;
    width: min(100%, 1420px);
    min-height: calc(100vh - clamp(64px, 8vw, 112px));
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    grid-template-columns: minmax(420px, 560px) minmax(380px, 440px);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas:
      "view qr"
      "message qr"
      "footer footer";
    column-gap: clamp(92px, 14vw, 260px);
    align-items: center;
  }

  .auth-brand {
    position: absolute;
    top: 0;
    left: 0;
    justify-content: flex-start;
    min-height: 44px;
    margin: 0;
    font-size: 1.62rem;
  }

  .auth-brand-mark {
    display: none;
  }

  .auth-view {
    grid-area: view;
    align-self: start;
    display: flex;
    flex: initial;
    width: 100%;
    max-width: 560px;
    min-height: 0;
    margin-top: clamp(118px, 16vh, 178px);
  }

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

  .auth-copy h1 {
    font-size: 2.2rem;
    line-height: 1.08;
    letter-spacing: -0.04em;
  }

  .auth-copy p {
    max-width: 100%;
    margin-top: 20px;
    font-size: 1rem;
    line-height: 1.55;
  }

  .auth-form {
    gap: 12px;
    margin-top: 26px;
  }

  .auth-field {
    gap: 0;
  }

  .auth-field > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .auth-field input {
    height: 56px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(255, 255, 255, 0.16);
    font-size: 1.04rem;
  }

  .auth-field--password button {
    bottom: 8px;
    height: 40px;
    border-radius: 14px;
  }

  .auth-row {
    margin: 4px 0 10px;
  }

  .auth-primary,
  .auth-secondary {
    min-height: 58px;
    font-size: 1.05rem;
  }

  .auth-primary {
    background: #fff;
  }

  .auth-primary:disabled {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.48);
  }

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

  .auth-social-grid {
    display: flex;
    justify-content: center;
    gap: 32px;
  }

  .auth-social[data-switch-view="qr"] {
    display: none;
  }

  .auth-social-icon {
    width: 46px;
    height: 46px;
    background: rgba(255, 255, 255, 0.055);
  }

  .auth-create-prompt {
    gap: 16px;
    margin-top: 22px;
    padding-top: 0;
  }

  .auth-create-prompt span {
    font-size: 1rem;
    font-weight: 600;
  }

  .auth-secondary {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
  }

  .auth-back {
    width: 50px;
    height: 50px;
    margin-bottom: 28px;
    background: rgba(255, 255, 255, 0.055);
  }

  .qr-card {
    max-width: 420px;
  }

  .auth-view[data-auth-view="qr"] .qr-card {
    display: none;
  }

  .auth-desktop-qr {
    grid-area: qr;
    align-self: start;
    display: grid;
    justify-items: center;
    gap: 42px;
    margin-top: clamp(146px, 18vh, 220px);
  }

  .auth-qr-device {
    display: grid;
    place-items: center;
    width: 342px;
    height: 342px;
    padding: 12px;
    border-radius: 34px;
    background: #fff;
    box-shadow: 0 34px 80px rgba(0, 0, 0, 0.34);
  }

  .auth-qr-device-screen {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 86px;
    gap: 18px;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 76px 44px;
    overflow: hidden;
    border-radius: 24px;
    background:
      radial-gradient(circle at 18% 8%, rgba(0, 117, 255, 0.2), transparent 48%),
      linear-gradient(145deg, #05172d, #000814 72%);
  }

  .auth-qr-mini-form {
    display: grid;
    gap: 9px;
    color: #fff;
  }

  .auth-qr-mini-form strong {
    font-size: 0.62rem;
    line-height: 1;
  }

  .auth-qr-mini-form span {
    max-width: 120px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.42rem;
    line-height: 1.3;
  }

  .auth-qr-mini-row {
    height: 16px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.12);
  }

  .auth-qr-mini-row--short {
    width: 74%;
  }

  .auth-qr-mini-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
  }

  .auth-qr-mini-actions i {
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
  }

  .auth-qr-device-code {
    width: 84px;
    height: 84px;
  }

  .auth-qr-device-code rect {
    fill: #fff;
    stroke: none;
  }

  .auth-qr-device-code path {
    fill: #05101f;
    stroke: none;
  }

  .auth-qr-caption {
    max-width: 360px;
    text-align: center;
  }

  .auth-qr-caption h2 {
    margin: 0;
    color: #fff;
    font-size: 1.55rem;
    line-height: 1.15;
  }

  .auth-qr-caption p {
    margin: 18px 0 0;
    color: var(--auth-muted);
    font-size: 1rem;
    line-height: 1.52;
  }

  .auth-message {
    grid-area: message;
    max-width: 560px;
    margin: 16px 0 0;
    text-align: left;
  }

  .auth-footer {
    grid-area: footer;
    position: absolute;
    bottom: 24px;
    left: 0;
    display: flex;
    gap: 44px;
    justify-content: flex-start;
    align-self: end;
    margin: 0;
  }
}

@media (min-width: 721px) and (max-width: 1040px) {
  .auth-card {
    grid-template-columns: minmax(360px, 1fr) minmax(300px, 360px);
    column-gap: 48px;
  }

  .auth-qr-device {
    width: 300px;
    height: 300px;
  }

  .auth-qr-device-screen {
    padding: 58px 34px;
  }
}

@media (max-width: 560px) {
  .auth-shell {
    align-items: stretch;
    padding: 0;
  }

  .auth-card {
    width: 100%;
    min-height: 100vh;
    padding: 50px 24px 32px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .auth-brand {
    margin-bottom: 76px;
  }

  .auth-brand-mark {
    display: none;
  }

  .auth-copy h1 {
    font-size: 3.15rem;
  }

  .auth-copy p {
    font-size: 1.08rem;
  }

  .auth-social-icon {
    width: 58px;
    height: 58px;
  }
}

@media (max-width: 380px) {
  .auth-card {
    padding-left: 20px;
    padding-right: 20px;
  }

  .auth-copy h1 {
    font-size: 2.65rem;
  }

  .auth-social-grid {
    gap: 10px;
  }

  .auth-social-icon {
    width: 52px;
    height: 52px;
  }
}

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