:root {
  color-scheme: dark;
  font: 16px/1.55 system-ui, sans-serif;
  color: #f1f4fb;
  background: #0d1522;
}

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

body {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding: 2rem max(5vw, calc((100vw - 76rem) / 2));
}

.scene {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(90deg, #0d1522bd, #0d152251 38%, transparent 76%),
    #0d1522 url("/mountain-dusk.webp") 64% center / cover no-repeat;
}

.scene::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(0deg, #0d1522 0%, #0d152284 14%, transparent 45%);
}

.mist {
  position: absolute;
  inset: 0;
}

.mist::before, .mist::after {
  --rise-drift: 9%;
  position: absolute;
  bottom: -21%;
  left: -13%;
  width: 108%;
  height: 48%;
  content: "";
  background:
    radial-gradient(ellipse 26% 17% at 28% 59%, #bfd8eba0, #9ebdd557 43%, transparent 100%),
    radial-gradient(ellipse 30% 20% at 49% 49%, #c1d9ee98, #a6c4db48 44%, transparent 100%),
    radial-gradient(ellipse 25% 16% at 70% 55%, #b4cde39c, transparent 100%),
    radial-gradient(ellipse 22% 13% at 63% 36%, #b8d2e86b, transparent 100%);
  filter: blur(12px);
  mask-image: radial-gradient(ellipse closest-side, #000 43%, #000b 67%, transparent 100%);
  animation: mist-rise 15s linear -8s infinite;
}

.mist::after {
  --rise-drift: -11%;
  bottom: -25%;
  left: 24%;
  width: 97%;
  height: 55%;
  background:
    radial-gradient(ellipse 25% 19% at 30% 52%, #afcce389, transparent 100%),
    radial-gradient(ellipse 27% 23% at 57% 48%, #c1daedaa, #9bbbd55c 41%, transparent 100%),
    radial-gradient(ellipse 21% 16% at 73% 62%, #c7ddef82, transparent 100%),
    radial-gradient(ellipse 18% 12% at 44% 34%, #acc8df63, transparent 100%);
  animation: mist-rise 21s linear -8s infinite;
}

@keyframes mist-rise {
  from { opacity: 0; transform: translate(0, 63%) scale(.83, .77); }
  29% { opacity: .64; }
  54% { opacity: .86; }
  77% { opacity: .53; }
  to { opacity: 0; transform: translate(var(--rise-drift), -94%) scale(1.23, 1.17); }
}

.ronin {
  position: absolute;
  right: -2%;
  bottom: -13%;
  display: block;
  width: min(67vw, 116svh, 66rem);
  height: auto;
}

.checker {
  width: min(100%, 28rem);
  padding: clamp(1.4rem, 4vw, 2.3rem);
  border: 1px solid #4a5d7b;
  border-top-color: #7388ab;
  border-radius: .6rem;
  background: linear-gradient(145deg, #192538, #141d2d 73%);
  box-shadow: 0 1.2rem 4rem #050a155c;
}

h1 {
  margin: 0;
  font: 400 clamp(2.5rem, 4.2vw, 3.65rem)/1 Georgia, "Times New Roman", serif;
  letter-spacing: -.055em;
}

.intro { margin: .9rem 0 1.55rem; color: #bac8da; }
label { display: block; margin-bottom: .45rem; font-size: .94rem; font-weight: 650; }

input, button {
  width: 100%;
  min-height: 3.15rem;
  padding: .7rem .8rem;
  border-radius: .32rem;
  font: inherit;
}

input {
  border: 1px solid #7186a6;
  background: #0d1625;
  color: inherit;
  font-family: ui-monospace, Consolas, monospace;
}

input::placeholder { color: #9caec5; }
input[aria-invalid="true"] { border-color: #ef9fa9; }
input:focus-visible, button:focus-visible { outline: 2px solid #d4e3ff; outline-offset: 3px; }

button {
  margin-top: .75rem;
  border: 1px solid transparent;
  color: #101d34;
  background: #adc6f2;
  font-weight: 750;
  cursor: pointer;
}

button:hover { background: #c7dafb; }
button:disabled { opacity: .75; cursor: wait; }

.result:not(:empty) {
  margin-top: 1rem;
  padding: .65rem .75rem;
  border: 1px solid #4a5d7b;
  border-radius: .32rem;
  color: #dce8f8;
  background: #202d43;
  overflow-wrap: anywhere;
}

.result[data-state="eligible"] { border-color: #548477; color: #d0efdf; background: #182f2b; }
.result[data-state="invalid"] { border-color: #a65f6e; color: #ffd0ca; background: #312129; }

@media (min-width: 721px) and (max-width: 1020px) {
  .checker { max-width: 47vw; }
  .ronin { right: -9%; width: min(77vw, 116svh); }
}

@media (max-width: 720px) {
  body { justify-items: center; align-items: start; padding: clamp(14rem, 58vw, 23rem) 1.15rem 2.2rem; }

  .scene { background-position: 74% top; }
  .scene::after { background: linear-gradient(0deg, #0d1522 9%, #0d152269 39%, transparent 77%); }
  .mist::before { left: -37%; width: 162%; }
  .mist::after { left: 2%; width: 144%; }

  .ronin {
    top: -1.2rem;
    right: 50%;
    bottom: auto;
    width: clamp(25rem, 110vw, 43rem);
    transform: translateX(50%);
    mask-image: linear-gradient(#000 76%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mist::before, .mist::after {
    animation: none;
    opacity: .46;
    transform: translateY(-28%);
  }
}
