:root {
  --bg: #121214;
  --surface: #242429;
  --text-strong: #fbfbfb;
  --text: #efeff1;
  --text-muted: #96979e;
  --link: #798df9;
  --blurple: #5865f2;
  --blurple-hover: #4752c4;
  --danger: #f87e7a;
  --border-soft: rgba(151, 151, 159, 0.2);
  --field-bg: rgba(0, 0, 0, 0.12);
  --font: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Fondo ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("discord-bg.svg") center / cover no-repeat;
}

/* ---------- Marca ---------- */

.brand {
  position: absolute;
  top: 48px;
  left: 48px;
}

.brand img {
  display: block;
}

/* ---------- Estructura ---------- */

.layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 48px 24px;
}

.auth-card {
  display: flex;
  align-items: center;
  gap: 64px;
  width: 784px;
  max-width: 100%;
  padding: 32px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.login-col {
  flex: 0 0 416px;
  width: 416px;
}

.qr-col {
  flex: 0 0 240px;
  width: 240px;
  padding-bottom: 8px;
  text-align: center;
}

/* ---------- Cabecera del formulario ---------- */

.auth-header {
  margin-bottom: 20px;
  text-align: center;
}

.auth-header h1 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  color: var(--text-strong);
}

.auth-header p {
  margin: 0;
  font-size: 16px;
  line-height: 20px;
  color: var(--text);
}

/* ---------- Campos ---------- */

.field {
  margin-bottom: 20px;
}

.field--tight {
  margin-bottom: 0;
}

.field label {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 20px;
  font-weight: 500;
  color: var(--text-strong);
}

.required {
  color: var(--danger);
}

.input-shell {
  display: flex;
  align-items: center;
  height: 44px;
  background: var(--field-bg);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  transition: border-color 0.15s ease;
}

.input-shell:focus-within {
  border-color: var(--blurple);
}

.input-shell--error,
.input-shell--error:focus-within {
  border-width: 2px;
  border-color: var(--danger);
}

.field__error {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 4px;
  margin: 4px 12px 0 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--danger);
}

.field__error[hidden] {
  display: none;
}

.field__error svg {
  display: block;
  width: 16px;
  height: 16px;
}

.input-shell input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.input-shell input::placeholder {
  color: var(--text-muted);
}

.input-shell--password {
  height: 40px;
  padding-right: 4px;
}

.input-shell--password input {
  padding: 0 0 0 12px;
}

.eye {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-strong);
  cursor: pointer;
}

.eye:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* ---------- Acciones ---------- */

.forgot {
  margin: 4px 0 20px;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  line-height: 18px;
  color: var(--link);
  text-align: left;
  cursor: pointer;
}

.link:hover {
  text-decoration: underline;
}

.btn-primary {
  display: block;
  width: 100%;
  height: 40px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: var(--blurple);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-primary:hover {
  background: var(--blurple-hover);
}

.need-account {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 19px;
  color: var(--text-muted);
}

/* ---------- Columna QR ---------- */

.qr {
  position: relative;
  width: 176px;
  height: 176px;
  margin: 0 auto 32px;
  padding: 8px;
  background: #fff;
  border-radius: 4px;
}

.qr__code {
  display: block;
  width: 100%;
  height: 100%;
}

.qr__mark {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 50px;
  height: 50px;
}

.qr-col h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  color: var(--text-strong);
}

.qr-col p {
  margin: 0;
  font-size: 16px;
  line-height: 20px;
  color: var(--text);
}

.qr-col p strong {
  font-weight: 600;
}

.qr-col__passkey {
  display: block;
  width: 100%;
  margin-top: 8px;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1002;
  display: flex;
}

.modal[hidden] {
  display: none;
}

.modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  animation: modal-fade 0.1s ease-out;
}

.modal__layer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 56px 24px;
}

.modal__card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 480px;
  max-width: 100%;
  max-height: 100%;
  overflow-y: auto;
  padding: 8px 0 16px;
  background: var(--surface);
  border: 1px solid rgba(151, 151, 159, 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  animation: modal-pop 0.12s ease-out;
}

.modal__header {
  padding: 16px 64px 8px 24px;
}

.modal__title {
  margin: 0;
  font-size: 20px;
  line-height: 24px;
  font-weight: 600;
  color: var(--text-strong);
}

.modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgb(171, 172, 178);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-strong);
}

.modal__body {
  margin: 16px 0 8px;
  padding: 0 24px;
}

.modal__body p {
  margin: 0;
  font-size: 16px;
  line-height: 20px;
  color: var(--text);
}

.modal__footer {
  padding: 16px 24px 8px;
}

.modal__footer .btn-primary {
  margin-bottom: 0;
}

@keyframes modal-fade {
  from {
    opacity: 0;
  }
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal__scrim,
  .modal__card {
    animation: none;
  }
}

/* ---------- Adaptación a pantallas pequeñas ---------- */

@media (max-width: 840px) {
  .auth-card {
    width: 480px;
    gap: 0;
  }

  .qr-col {
    display: none;
  }

  .login-col {
    flex: 1 1 auto;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .brand {
    top: 16px;
    left: 16px;
  }

  .layout {
    padding: 24px 12px;
  }

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

  .modal__layer {
    padding: 24px 12px;
  }

  .modal__card {
    width: 100%;
  }
}
