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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

:root {
  --paper: #222b34;
  --ink: #111417;
  --shadow: rgba(10, 14, 18, 0.22);
  --glass: rgba(242, 246, 250, 0.16);
  --glass-border: rgba(224, 235, 245, 0.7);
  --sequence-delay: 2.5s;
}

body {
  font-family: "Fjalla One", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #0b0e10;
  color: var(--paper);
  overflow: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 120vw;
  height: 100vh;
  left: -10vw;
  background-image: url("/assets/img/background/background_start.png");
  background-size: cover;
  background-position: left center;
  background-repeat: no-repeat;
  transform: translateX(0);
  animation: pan 3s linear forwards;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(12, 16, 20, 0.12), transparent 62%),
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.12), transparent 75%),
    linear-gradient(180deg, rgba(10, 14, 18, 0.18), rgba(10, 14, 18, 0.32));
}

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px 56px;
  position: relative;
  z-index: 1;
}

.glass {
  width: min(92vw, 460px);
  padding: 32px 24px 28px;
  border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(34px) saturate(132%);
  box-shadow:
    0 24px 60px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  display: flex;
  flex-direction: column;
  gap: 26px;
  text-align: center;
  opacity: 0;
  transform: translateY(16px);
  animation: glassIn 0.75s cubic-bezier(0.22, 1, 0.36, 1)
    var(--sequence-delay) forwards;
}

.logo {
  width: min(82vw, 520px);
  height: auto;
  display: block;
  margin: 0 auto;
  color: #d4c79a;
}

.auth {
  width: 100%;
  text-align: center;
}

.auth__title {
  margin: 0 0 20px;
  font-size: 1.25rem;
  letter-spacing: 0.03em;
  font-weight: 600;
  color: #000000;
}

.auth__form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  text-align: left;
}

.field__label {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: #000000;
}

.field__input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(212, 199, 154, 0.35);
  background: rgba(245, 242, 232, 0.88);
  color: #1d1b14;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

.field__input:focus {
  border-color: rgba(212, 199, 154, 0.75);
  box-shadow: 0 0 0 1px rgba(212, 199, 154, 0.3);
}

.auth__button {
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(212, 199, 154, 0.7);
  background: #d4c79a;
  color: #2a261b;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-family: inherit;
  cursor: pointer;
}

.auth__button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth__button:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(212, 199, 154, 0.3);
}

.auth__switch {
  margin: 18px 0 0;
  font-size: 0.95rem;
  color: rgba(212, 199, 154, 0.75);
}

.auth__link {
  color: var(--paper);
  text-decoration: none;
  border-bottom: 1px solid rgba(212, 199, 154, 0.5);
  padding-bottom: 2px;
}

.auth__error {
  min-height: 1.2em;
  margin-top: 12px;
  font-size: 0.95rem;
  color: #7a1e1e;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: rgba(9, 12, 14, 0.55);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.auth-modal[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.auth-modal__panel {
  width: min(92vw, 420px);
  border-radius: 18px;
  padding: 24px 22px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  overscroll-behavior: contain;
  background: rgba(242, 246, 250, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 24px 60px var(--shadow);
  position: relative;
}

@media (max-height: 720px) {
  .auth-modal {
    align-items: flex-start;
    padding-top: 16px;
    padding-bottom: 16px;
  }
}

.auth-modal__title {
  margin: 0 0 16px;
  color: #000000;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}

.auth-modal__form {
  display: grid;
  gap: 12px;
}

.auth-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  color: #1d1b14;
  cursor: pointer;
}

.letter {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: center bottom;
  transform: scaleY(0);
  animation: rise 1.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#P {
  animation-delay: calc(var(--sequence-delay) + 0.1s);
}

#R {
  animation-delay: calc(var(--sequence-delay) + 0.18s);
}

#O1 {
  animation-delay: calc(var(--sequence-delay) + 0.26s);
}

#O2 {
  animation-delay: calc(var(--sequence-delay) + 0.34s);
}

#F {
  animation-delay: calc(var(--sequence-delay) + 0.42s);
}

@keyframes pan {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(10vw);
  }
}

@keyframes glassIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

@media (min-width: 768px) {
  html {
    overflow-x: hidden;
  }

  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  @supports (overflow: clip) {
    html {
      overflow-x: clip;
    }
  }

  .glass {
    padding: 40px 36px 34px;
    width: min(80vw, 520px);
    overflow: hidden;
  }

  .logo {
    max-height: 140px;
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  .auth__title {
    font-size: 1.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg::before {
    animation: none;
    transform: none;
  }

  .glass {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .letter {
    animation: none;
    transform: scaleY(1);
  }
}
