/* The login page: a rainy night. The canvas behind (login.js) draws the weather; this is the glass,
   the neon and the type. Everything here also works with scripts off. Motion runs regardless of
   the system's reduced-motion setting, by choice. */
:root { color-scheme: dark; --ink: #eef0ff; --dim: #9aa3c7; --pink: #ff4fa3; --peach: #ffc98c; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100dvh; overflow: hidden; color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(130% 55% at 50% 100%, #3b1742 0%, transparent 62%),
    radial-gradient(90% 40% at 15% 88%, #12305a 0%, transparent 70%),
    linear-gradient(#03040b 0%, #090d26 40%, #161235 78%, #0d0a1c 100%);
}
#sky { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

main {
  position: relative; min-height: 100dvh; display: grid; place-items: center;
  padding: calc(48px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom));
}

/* Frosted glass with a neon sign hung off its corner. */
.gate {
  position: relative; display: grid; gap: 12px; width: min(340px, 100%); margin-top: -9vh;
  padding: 30px 22px 22px; border-radius: 22px;
  background: linear-gradient(160deg, rgb(255 255 255 / 0.11), rgb(255 255 255 / 0.03) 60%);
  border: 1px solid rgb(255 255 255 / 0.13);
  box-shadow: 0 40px 90px -30px rgb(0 0 0 / 0.85), inset 0 1px 0 rgb(255 255 255 / 0.16);
  -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.45s, filter 0.45s, box-shadow 0.25s, border-color 0.25s;
}
/* Pink light from the sign spilling across the glass. */
.gate::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: radial-gradient(70% 45% at 92% -6%, rgb(255 79 163 / 0.26), transparent 70%);
}

.sign {
  position: absolute; right: -12px; top: -40px; z-index: 1;
  writing-mode: vertical-rl; font-size: 27px; font-weight: 700; letter-spacing: 0.18em; line-height: 1;
  padding: 12px 7px; border-radius: 9px; color: #ffe3f1; background: rgb(28 5 22 / 0.6);
  border: 2px solid rgb(255 79 163 / 0.95);
  text-shadow: 0 0 3px #ffb0d6, 0 0 10px var(--pink), 0 0 26px var(--pink);
  box-shadow: 0 0 14px rgb(255 79 163 / 0.65), 0 0 46px rgb(255 79 163 / 0.25), inset 0 0 12px rgb(255 79 163 / 0.45);
  animation: flicker 9s infinite steps(1);
}
/* A tired neon tube: mostly steady, the odd stutter. */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  2% { opacity: 0.3; } 2.6% { opacity: 1; } 4% { opacity: 0.55; } 4.4% { opacity: 1; }
  57% { opacity: 1; } 57.5% { opacity: 0.25; } 58.5% { opacity: 1; }
}

h1 {
  margin: 0 0 10px; font-size: 54px; line-height: 0.95; font-weight: 800; letter-spacing: -0.055em;
  background: linear-gradient(180deg, #ffffff 25%, #a9b7ff 115%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Floating labels: the label sits in the field until there's something in it. */
.field { position: relative; display: block; }
.field input {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  padding: 21px 14px 7px; border-radius: 12px; border: 1px solid rgb(255 255 255 / 0.13);
  background: rgb(4 6 20 / 0.5); outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus { border-color: rgb(169 183 255 / 0.75); box-shadow: 0 0 0 4px rgb(110 140 255 / 0.18); }
.field span {
  position: absolute; left: 15px; top: 15px; color: var(--dim); pointer-events: none;
  transition: top 0.18s, font-size 0.18s, color 0.18s, letter-spacing 0.18s;
}
.field input:focus + span, .field input:not(:placeholder-shown) + span {
  top: 6px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #bcc6ff;
}
.field input:-webkit-autofill { -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 40px #0d1030 inset; caret-color: var(--ink); }

.gate button {
  position: relative; overflow: hidden; margin-top: 4px; padding: 14px; border: 0; border-radius: 12px; cursor: pointer;
  font: inherit; font-size: 16px; font-weight: 750; letter-spacing: 0.01em; color: #1d0b22;
  background: linear-gradient(90deg, #ff8cc6, var(--peach));
  box-shadow: 0 10px 34px -10px rgb(255 110 175 / 0.8);
  transition: transform 0.15s;
}
/* A glint sweeping across the button now and then. */
.gate button::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 35%, rgb(255 255 255 / 0.6) 50%, transparent 65%);
  transform: translateX(-130%); animation: glint 5s 1.2s infinite;
}
@keyframes glint { 0% { transform: translateX(-130%); } 28%, 100% { transform: translateX(130%); } }
.gate button:active { transform: translateY(1px) scale(0.99); }
.gate button:disabled { cursor: progress; filter: saturate(0.6) brightness(0.92); }

.err {
  margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 14px;
  color: #ffc0cf; background: rgb(255 60 95 / 0.14); border: 1px solid rgb(255 80 115 / 0.38);
}

/* Wrong password: the glass shudders (login.js adds the thunderbolt). */
body.denied .gate { animation: shudder 0.55s 0.2s both; border-color: rgb(255 90 120 / 0.55); }
@keyframes shudder {
  10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-9px) rotate(-0.4deg); } 40%, 60% { transform: translateX(9px) rotate(0.4deg); }
}
/* Lightning lights up the glass edge and blows the sign's power for a moment. */
body.flash .gate { border-color: rgb(225 232 255 / 0.6); box-shadow: 0 40px 90px -30px rgb(0 0 0 / 0.85), inset 0 1px 0 rgb(255 255 255 / 0.7), 0 0 70px rgb(190 205 255 / 0.35); }
body.flash .sign { opacity: 0.2; animation-play-state: paused; }
/* Logging in: the glass dissolves into the rain. */
body.entering .gate { transform: scale(1.07) translateY(-6px); opacity: 0; filter: blur(8px); }

@media (max-height: 560px) {
  .gate { margin-top: 0; }
  h1 { font-size: 44px; }
}
