:root {
  color-scheme: dark;
  --ink: #eaf8ff;
  --muted: #8cb7c8;
  --cyan: #65e7ff;
  --blue: #3878ff;
  --space: #02050d;
}

* { box-sizing: border-box; }

html,
body { min-height: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  overflow-x: hidden;
  background: var(--space);
  color: var(--ink);
  font-family: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

button,
input { font: inherit; }

.universe,
.stars,
.nebula,
.orbit {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.universe {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 115%, #0d3150 0, transparent 32%),
    radial-gradient(circle at 15% 10%, #081a35 0, transparent 26%),
    linear-gradient(180deg, #01030a 0%, #020711 55%, #030913 100%);
}

.nebula {
  inset: -25%;
  background:
    radial-gradient(ellipse at 28% 60%, rgb(38 106 140 / 16%), transparent 31%),
    radial-gradient(ellipse at 67% 36%, rgb(82 56 170 / 14%), transparent 28%);
  filter: blur(28px);
  animation: drift 18s ease-in-out infinite alternate;
}

.stars {
  --shift-x: 0px;
  --shift-y: 0px;
  inset: -5%;
  background-repeat: repeat;
  transform: translate3d(var(--shift-x), var(--shift-y), 0) scale(1.05);
  transition: transform 120ms linear;
  will-change: transform;
}

.stars--far {
  opacity: 0.38;
  background-image:
    radial-gradient(1px 1px at 18px 24px, #b9eaff, transparent),
    radial-gradient(1px 1px at 84px 72px, #fff, transparent),
    radial-gradient(1px 1px at 142px 132px, #79b7d5, transparent);
  background-size: 180px 180px;
}

.stars--mid {
  opacity: 0.6;
  background-image:
    radial-gradient(1.5px 1.5px at 35px 48px, #fff, transparent),
    radial-gradient(1px 1px at 126px 24px, #8cecff, transparent),
    radial-gradient(1px 1px at 208px 116px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 74px 196px, #85a9ff, transparent);
  background-size: 250px 230px;
  animation: breathe-mid 9s ease-in-out infinite alternate;
}

.stars--near {
  opacity: 0.78;
  background-image:
    radial-gradient(2px 2px at 70px 90px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 260px 42px, #8cecff, transparent),
    radial-gradient(2px 2px at 344px 218px, #fff, transparent);
  background-size: 390px 290px;
  animation: breathe-near 6s ease-in-out 1s infinite alternate-reverse;
}

.orbit {
  inset: auto 50% -48vmax;
  width: 112vmax;
  height: 62vmax;
  border: 1px solid rgb(101 231 255 / 12%);
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 -20px 80px rgb(44 144 255 / 6%);
}

.page-shell {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 24px 20px 18px;
}

.site-controls {
  position: fixed;
  z-index: 3;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.language-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgb(101 231 255 / 18%);
  border-radius: 50%;
  background: rgb(2 10 20 / 56%);
  box-shadow: 0 0 20px rgb(54 176 255 / 6%);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.language-toggle {
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 180ms ease, border-color 180ms ease;
}

.language-toggle:hover { transform: translateY(-1px); border-color: rgb(101 231 255 / 38%); }

.hero {
  grid-row: 2;
  align-self: center;
  justify-self: center;
  width: min(760px, 100%);
  text-align: center;
  padding: 30px 22px 42px;
}

h1 {
  margin: 0;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: clamp(3.8rem, 13vw, 7.8rem);
  line-height: 0.95;
  letter-spacing: 0.03em;
  color: transparent;
  background: linear-gradient(180deg, #f5fdff 12%, #83ddf4 58%, #3878ff 118%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 22px rgb(72 210 255 / 24%));
}

h1::after {
  content: "";
  display: block;
  width: 72px;
  height: 1px;
  margin: 25px auto 28px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 14px var(--cyan);
}

blockquote { margin: 0 auto; max-width: 700px; }

blockquote p,
.error-message {
  margin: 0;
  color: #c6e0e8;
  font-size: clamp(0.9rem, 1.7vw, 1.04rem);
  line-height: 1.85;
  font-style: italic;
  text-wrap: balance;
}

blockquote cite {
  display: block;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.planet {
  margin-top: 28px;
  font-size: clamp(1.45rem, 4vw, 2rem);
  letter-spacing: 0.14em;
  filter: drop-shadow(0 0 10px rgb(91 217 255 / 35%));
}

footer {
  grid-row: 3;
  align-self: end;
  color: #507381;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

footer a {
  color: inherit;
  text-decoration: none;
  cursor: default;
}

footer a:focus-visible {
  color: var(--cyan);
  outline: 1px solid var(--cyan);
  outline-offset: 4px;
}

.page-login .hero,
.page-error .hero { max-width: 560px; }

.page-login h1,
.page-error h1 { font-size: clamp(3.2rem, 12vw, 6rem); }

.login-form {
  width: min(390px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 16px;
  text-align: left;
}

.field { display: grid; gap: 7px; }

.field label {
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid rgb(101 231 255 / 17%);
  border-radius: 8px;
  outline: none;
  background: rgb(1 8 18 / 64%);
  color: var(--ink);
  box-shadow: inset 0 0 22px rgb(52 130 210 / 4%);
}

.field input:focus {
  border-color: rgb(101 231 255 / 52%);
  box-shadow: 0 0 0 3px rgb(101 231 255 / 7%);
}

.submit-button,
.home-link {
  display: inline-grid;
  place-items: center;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid rgb(101 231 255 / 28%);
  border-radius: 999px;
  background: linear-gradient(135deg, rgb(101 231 255 / 15%), rgb(56 120 255 / 16%));
  color: var(--ink);
  cursor: pointer;
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-decoration: none;
  text-transform: uppercase;
}

.submit-button { margin-top: 4px; }

.form-note {
  margin: 2px 0 0;
  color: #4f7280;
  font-size: 0.65rem;
  line-height: 1.6;
  text-align: center;
}

.error-code {
  margin: 0;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: clamp(5.5rem, 22vw, 10rem);
  line-height: 0.85;
  color: transparent;
  background: linear-gradient(180deg, #f5fdff, #5aa4ea);
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0.9;
  filter: drop-shadow(0 0 28px rgb(72 210 255 / 18%));
}

.error-message { margin: 34px auto 28px; max-width: 530px; }

@keyframes breathe-mid { from { opacity: 0.32; } to { opacity: 0.78; } }
@keyframes breathe-near { from { opacity: 0.45; } to { opacity: 0.9; } }
@keyframes drift {
  from { transform: translate3d(-2%, -1%, 0) rotate(-2deg); }
  to { transform: translate3d(3%, 2%, 0) rotate(2deg); }
}

@media (max-height: 760px) and (min-width: 601px) {
  .page-shell { padding-top: 16px; }
  .hero { padding-block: 16px 24px; }
  h1::after { margin-block: 18px 20px; }
  blockquote p { line-height: 1.65; }
  .planet { margin-top: 18px; }
}

@media (max-width: 600px) {
  .page-shell { padding: 18px 16px max(18px, env(safe-area-inset-bottom)); }
  .site-controls {
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
  }
  .hero { padding: 48px 0 54px; }
  h1 { font-size: clamp(3.4rem, 20vw, 5.2rem); }
  h1::after { margin-block: 22px 25px; }
  blockquote p,
  .error-message { font-size: 1.125rem; line-height: 1.72; text-wrap: pretty; }
  blockquote cite { font-size: 0.75rem; line-height: 1.5; }
  .field label,
  .form-note,
  .submit-button,
  .home-link { font-size: 0.75rem; }
  .planet { margin-top: 25px; }
  footer { font-size: 0.6rem; line-height: 1.6; }
  .page-login .hero,
  .page-error .hero { padding-block: 40px; }
}

html.touch-device .page-home .hero {
  width: min(84vw, 620px);
  padding-inline: 0;
}

html.touch-device .site-controls {
  top: max(clamp(14px, 2.8vw, 26px), env(safe-area-inset-top));
  right: max(clamp(14px, 2.8vw, 26px), env(safe-area-inset-right));
}

html.touch-device .language-toggle {
  width: clamp(44px, 10vw, 96px);
  height: clamp(44px, 10vw, 96px);
  font-size: clamp(1.3rem, 5vw, 3rem);
  border-width: clamp(1px, 0.18vw, 2px);
}

html.touch-device .hero {
  padding-block: clamp(30px, 5vh, 48px);
}

html.touch-device .page-home h1 {
  font-size: clamp(3.6rem, 16vw, 7.4rem);
}

html.touch-device .page-home blockquote {
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  text-align: center;
}

html.touch-device .page-home blockquote p {
  font-size: clamp(1.16rem, 3.8vw, 2.15rem);
  line-height: 1.68;
  text-align: center;
  text-wrap: pretty;
}

html.touch-device .page-home blockquote cite {
  font-size: clamp(0.78rem, 2vw, 1.35rem);
  line-height: 1.5;
  text-align: center;
}

html.touch-device .page-login .hero,
html.touch-device .page-error .hero {
  width: min(86vw, 760px);
  max-width: none;
  padding-inline: 0;
}

html.touch-device .page-login h1,
html.touch-device .page-error h1 {
  font-size: clamp(3rem, 10vw, 5.4rem);
}

html.touch-device .login-form {
  width: 100%;
  max-width: none;
  gap: clamp(16px, 3vw, 30px);
}

html.touch-device .field label,
html.touch-device .form-note,
html.touch-device .submit-button,
html.touch-device .home-link {
  font-size: clamp(0.82rem, 3.2vw, 2rem);
}

html.touch-device .field label {
  letter-spacing: 0.04em;
  text-transform: none;
}

html.touch-device .field input {
  min-height: clamp(52px, 10vw, 98px);
  padding-inline: clamp(15px, 3.4vw, 32px);
  border-radius: clamp(9px, 1.5vw, 15px);
  font-size: clamp(1rem, 3.4vw, 2rem);
}

html.touch-device .submit-button,
html.touch-device .home-link {
  min-height: clamp(52px, 10vw, 94px);
  padding-inline: clamp(22px, 5vw, 48px);
  letter-spacing: 0.06em;
  text-transform: none;
}

html.touch-device .submit-button {
  width: 100%;
  border-radius: clamp(14px, 5vw, 48px);
}

html.touch-device .form-note {
  line-height: 1.55;
}

html.touch-device .error-message {
  max-width: min(90%, 680px);
  margin-block: clamp(26px, 4vw, 38px);
  font-size: clamp(1.1rem, 3.4vw, 2rem);
  line-height: 1.65;
  text-align: center;
}

html.touch-device .home-link {
  width: min(76vw, 620px);
  border-radius: clamp(14px, 5vw, 48px);
}

html.touch-device footer {
  padding-inline: 8px;
  font-size: clamp(0.68rem, 2.1vw, 1.25rem);
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  .nebula,
  .stars { animation: none; transition: none; }
}
