/* SKYNET login — ported verbatim from the faceoff "bounty" login so it matches
   exactly: jagged cyan→orange glitch frame, Stargate-glyph password entry (no
   plaintext, no username), and a single orange jagged-arrow submit with the
   filled BoxGlitch treatment. Effects driven by login.js (useJitter + BoxGlitch
   ports). */

@font-face {
  font-family: 'sg-glyphs';
  src: url('/fonts/sg-glyphs.ttf') format('truetype');
  font-display: block;
}

.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(var(--cyan-rgb),0.06), transparent 60%),
    radial-gradient(900px 500px at 50% 110%, rgba(var(--orange-rgb),0.05), transparent 60%),
    var(--bg);
}
.login-bare { display: flex; flex-direction: column; align-items: center; gap: 12px; transform: scale(1.1); }
.login-mark { display: inline-flex; margin-bottom: 7px; }   /* slightly larger gap to the box */
.login-mark .sk-pixmark { height: 27px; }                   /* 10% smaller wordmark */

/* Jagged cyberpunk frame: cyan→orange body clipped to a jagged polygon with a
   chromatic split shadow; a dark inner (same clip) leaves the jagged edge as the border. */
.login-glitch {
  --jag: polygon(0 9px, 7px 9px, 7px 0, 34% 0, 34% 5px, 62% 5px, 62% 0, 100% 0,
    100% 66%, calc(100% - 7px) 66%, calc(100% - 7px) 100%, 30% 100%, 30% calc(100% - 5px),
    9px calc(100% - 5px), 9px 100%, 0 100%);
  position: relative; width: 300px; padding: 3px;
  background: linear-gradient(90deg, #19ecff, #ff9422);
  clip-path: var(--jag);
  transform: translate(calc(var(--lx, 0) * 1.9), calc(var(--ly, 0) * 1.9));
  filter: drop-shadow(calc(-2.4px * var(--sp, 2.6)) 0 rgba(var(--cyan-rgb),0.82))
          drop-shadow(calc(2.4px * var(--sp, 2.6)) 0 rgba(var(--orange-rgb),0.72))
          drop-shadow(0 0 calc(2px * var(--gl, 0)) rgba(var(--cyan-rgb),0.95));
  animation: fo-login-flicker 5.4s steps(1) infinite;
}
@keyframes fo-login-flicker {
  0%, 100% { opacity: 1; } 7% { opacity: .68; } 8% { opacity: 1; }
  19% { opacity: .88; } 19.6% { opacity: 1; } 38% { opacity: .55; }
  39.5% { opacity: 1; } 58% { opacity: .82; } 59% { opacity: 1; }
  74% { opacity: .4; } 75.5% { opacity: 1; } 89% { opacity: .9; } 90% { opacity: 1; }
}
.login-glitch::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; clip-path: var(--jag);
  background:
    linear-gradient(90deg, rgba(var(--cyan-rgb),.55) 0%, transparent 3%),
    linear-gradient(90deg, transparent 97%, rgba(var(--orange-rgb),.5) 100%);
  mix-blend-mode: screen; opacity: 0; animation: fo-login-rgbclip 4.4s steps(1) infinite;
}
@keyframes fo-login-rgbclip {
  0%, 20%, 100% { opacity: 0; transform: translate(0,0); }
  20.3% { opacity: .95; transform: translate(7px,0); } 20.7% { opacity: .95; transform: translate(-8px,0); }
  21.2% { opacity: 0; transform: translate(0,0); }
  49% { opacity: 0; } 49.3% { opacity: .9; transform: translate(-6px,0); }
  49.7% { opacity: .9; transform: translate(6px,0); } 50.2% { opacity: 0; transform: translate(0,0); }
  76% { opacity: 0; } 76.3% { opacity: .85; transform: translate(9px,0); }
  76.6% { opacity: .95; transform: translate(-5px,0); } 77.1% { opacity: 0; transform: translate(0,0); }
}
.login-glitch-inner {
  display: flex; align-items: stretch; background: #06080c; clip-path: var(--jag);
  background-image: linear-gradient(#06080c, #06080c),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.25) 0 1px, transparent 1px 3px);
}

/* Password field: real input captures the password but renders nothing; the
   visible representation is the cyan Stargate-glyph overlay. No plaintext, no dots. */
.login-pass-field { position: relative; flex: 1 1 auto; min-width: 0; display: flex; }
.login-pass {
  flex: 1 1 auto; min-width: 0; height: 50px;
  background: transparent; border: none; outline: none;
  font-size: 18px; letter-spacing: 0.4em; padding: 0 4px 0 16px;
  color: transparent; caret-color: transparent; text-shadow: none;
  -webkit-text-security: square;
}
.login-pass::placeholder { color: transparent; }
.login-pass-glyphs {
  position: absolute; inset: 0; padding: 0 12px;
  display: flex; align-items: center; justify-content: center; gap: 0.22em;
  pointer-events: none; color: #d4fdff; font-size: 17px; line-height: 1;
  text-shadow: 0 0 14px rgba(var(--cyan-rgb),1), 0 0 6px #9af4ff, 0 0 3px #ffffff;
  background: #06080c;
}
.login-pass-glyphs .lpg { display: inline-block; font-family: 'sg-glyphs'; letter-spacing: 0; }
.lpg-caret { flex: 0 0 auto; width: 2px; height: 24px; background: var(--cyan);
  box-shadow: 0 0 7px rgba(var(--cyan-rgb),0.95); animation: lpgblink 1.1s steps(1) infinite; display: none; }
.login-pass-field:focus-within .lpg-caret { display: inline-block; }
@keyframes lpgblink { 50% { opacity: 0; } }

/* Right orange jagged-arrow submit — filled BoxGlitch treatment. */
.login-side {
  flex: 0 0 auto; width: 52px; height: 50px; border: none; cursor: pointer;
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; transition: filter .12s ease;
}
.login-side:disabled { cursor: default; }
.login-side:not(:disabled):hover { filter: brightness(1.12); }
.login-side svg { position: relative; z-index: 5; }
.login-go { background: transparent; color: #ff9422;
  box-shadow: inset 0 0 0 2px #ff9422, 0 0 32px -4px #ff9422; }
.login-side .fo-glitchbox { background: repeating-linear-gradient(0deg, rgba(0,0,0,.20) 0 1px, transparent 1px 3px); }
.login-side:not(:disabled) { background: #0b0e14; }
.login-side:not(:disabled) .fo-glitchbox {
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.34) 0 1px, transparent 1px 3px),
    color-mix(in srgb, var(--gc) 42%, transparent);
}
.login-side .spinner {
  width: 18px; height: 18px; border: 2px solid rgba(255,148,34,.35); border-top-color: #ff9422;
  border-radius: 50%; animation: login-spin .7s linear infinite; position: relative; z-index: 5;
}
@keyframes login-spin { to { transform: rotate(360deg); } }

.login-err {
  font-family: 'Consolas', 'Courier New', ui-monospace, monospace;
  font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: #ff4d4d; background: transparent; border: none; padding: 4px 8px; text-align: center;
  /* smooth fade in/out + an irregular, glitchy red glow that only lands as a
     shadow on some frames (radiating, not constant). */
  animation: sk-denied-pulse 1.9s ease-in-out infinite, sk-denied-glow 3.3s steps(1) infinite;
}
@keyframes sk-denied-pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes sk-denied-glow {
  0%, 14%, 41%, 66%, 100% { text-shadow: none; }
  8%  { text-shadow: -1px 0 rgba(255,40,40,.9), 0 0 8px rgba(255,40,40,.55); }
  30% { text-shadow: 1px 0 rgba(255,70,70,.85), 0 0 12px rgba(255,0,0,.5); }
  52% { text-shadow: -2px 0 rgba(255,30,30,.9), 2px 0 rgba(120,0,0,.6), 0 0 10px rgba(255,40,40,.6); }
  74% { text-shadow: 0 0 15px rgba(255,55,55,.8); }
}
@media (prefers-reduced-motion: reduce) {
  .login-err { animation: none; opacity: 1; text-shadow: 0 0 8px rgba(255,50,50,.5); }
}

/* Success: "// ACCESS GRANTED..." typed in, each letter fading in. Green = the
   theme/faceoff success colour. */
.login-granted {
  font-family: 'Consolas', 'Courier New', ui-monospace, monospace;
  font-size: 14px; font-weight: 700; letter-spacing: .14em; text-align: center;
  color: var(--success); text-shadow: 0 0 9px rgba(52, 211, 153, .55);
}
.login-granted .lg-ch { display: inline-block; white-space: pre; opacity: 0; transition: opacity .3s ease; }
.login-granted .lg-ch.show { opacity: 1; }

/* Per-box CRT/derelict overlay (BoxGlitch) — filled with the box's own colour. */
.fo-glitchbox {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; border-radius: inherit;
  --gc: var(--cyan); --gy: 50%; --gy2: 50%; --gop: 0; --gsplit: 0;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.34) 0 1px, transparent 1px 3px),
    color-mix(in srgb, var(--gc) 42%, transparent);
}
.fo-gscan {
  position: absolute; left: 0; right: 0; top: var(--gy); height: 2px; opacity: var(--gop);
  background: linear-gradient(90deg, var(--gc) 0%, color-mix(in srgb, var(--gc) 45%, #fff) 50%, var(--gc) 100%);
  box-shadow: 0 0 10px var(--gc), 0 0 3px #fff; clip-path: inset(0 calc(var(--gsplit) * 52%) 0 0); transition: top .05s linear;
}
.fo-gscan2 {
  position: absolute; left: 0; right: 0; top: var(--gy2); height: 2px; opacity: calc(var(--gop) * var(--gsplit));
  background: linear-gradient(90deg, var(--gc) 0%, color-mix(in srgb, var(--gc) 45%, #fff) 55%, var(--gc) 100%);
  box-shadow: 0 0 10px var(--gc); clip-path: inset(0 0 0 48%); transition: top .05s linear;
}
.fo-gsplat {
  position: absolute; width: var(--ss, 3px); height: var(--ss, 3px); opacity: 0;
  background: var(--gc); box-shadow: 0 0 5px var(--gc); image-rendering: pixelated; transition: opacity .14s linear;
}
.fo-gbreak { position: absolute; opacity: 0; background: #05070b; z-index: 5; transition: opacity .1s linear; }

@media (prefers-reduced-motion: reduce) {
  .login-glitch { transform: none; animation: none; opacity: 1;
    filter: drop-shadow(-1.8px 0 rgba(var(--cyan-rgb),0.7)) drop-shadow(1.8px 0 rgba(var(--orange-rgb),0.6)); }
  .login-glitch::after { animation: none; opacity: 0; }
  .lpg-caret { animation: none; }
  .fo-glitchbox { display: none; }
}

/* Mobile: keep the (scaled) login box inside the viewport width. */
@media (max-width: 640px) {
  .login-bare { transform: none; max-width: 100%; }
  .login-glitch { width: min(300px, 84vw); }
}
