/* ALF97+ access gate — 1024×24000 world + login + short punch intro.
   Colors follow PLUS :root (swap alf-plus.css tokens to restyle). */

#gate {
  position: fixed; inset: 0; z-index: 80;
  display: none;
  background: var(--paper, #fafafa);
  color: var(--ink, #000);
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  overflow: hidden;
}
#gate.on { display: block; }

.gate-grain {
  position: absolute; inset: 0; z-index: 6; pointer-events: none; opacity: .05;
  mix-blend-mode: multiply;
}
.gate-grain svg { width: 100%; height: 100%; }

#gate-burst {
  position: absolute; inset: 0; z-index: 7; pointer-events: none;
  width: 100%; height: 100%;
}

.gate-frame {
  position: absolute; inset: 10px; border: 2px solid var(--ink, #000);
  pointer-events: none; z-index: 8;
}
.gate-crop {
  position: absolute; width: 14px; height: 14px; pointer-events: none; z-index: 9;
  border: 2px solid var(--red, #ff3300);
}
.gate-crop.tl { top: 4px; left: 4px; border-right: 0; border-bottom: 0; }
.gate-crop.tr { top: 4px; right: 4px; border-left: 0; border-bottom: 0; }
.gate-crop.bl { bottom: 4px; left: 4px; border-right: 0; border-top: 0; }
.gate-crop.br { bottom: 4px; right: 4px; border-left: 0; border-top: 0; }

.gate-stage {
  position: absolute; left: 50%; top: 0; z-index: 1;
  width: 1024px; height: 100%;
  overflow: hidden;
  transform: translateX(-50%) scale(var(--gate-scale, 1));
  transform-origin: top center;
}
.gate-world {
  width: 1024px; height: 24000px;
  background: var(--paper, #fafafa);
  will-change: transform;
}
.gw {
  position: relative; width: 1024px; height: 1500px;
  border-bottom: 8px solid var(--ink, #000);
  overflow: hidden;
}
.gw .n {
  position: absolute; top: 48px; left: 48px;
  font-size: 11px; letter-spacing: .22em; font-weight: 700;
}
.gw .w {
  position: absolute; left: 48px; right: 48px; top: 38%;
  font-family: var(--disp, "Darker Grotesque", system-ui, sans-serif);
  font-weight: 900; font-size: 180px; line-height: .78;
  letter-spacing: -.04em; text-transform: uppercase;
}
.gw .w em { font-style: normal; color: var(--red, #ff3300); }
.gw .w.blue { color: var(--blue, #0033ff); }
.gw .w.yel { color: var(--yellow, #ffaa00); }
.gw .s {
  position: absolute; left: 48px; bottom: 72px;
  font-size: 14px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim, #222);
}
.gw .blk {
  position: absolute; border: 4px solid var(--ink, #000);
}
.gw .blk.r { background: var(--red, #ff3300); }
.gw .blk.b { background: var(--blue, #0033ff); }
.gw .blk.y { background: var(--yellow, #ffaa00); }
.gw .rule {
  position: absolute; background: var(--ink, #000);
}

/* login HUD — redpaper dialog, over the world */
.gate-hud {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.gate-card {
  width: 420px; pointer-events: auto;
  border: 2px solid var(--ink, #000);
  background: #fff;
  box-shadow: 10px 10px 0 var(--ink, #000);
}
.gate-card .dlg-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 13px;
  font: 800 11px/1 var(--mono, monospace);
  letter-spacing: .18em; text-transform: uppercase; color: #000;
  background: repeating-linear-gradient(45deg, #000 0 9px, var(--yellow, #ffaa00) 9px 18px);
}
.gate-card .dlg-bar span { background: var(--yellow, #ffaa00); padding: 3px 6px; }
.gate-card .body { padding: 22px 18px 18px; }
.gate-card h3 {
  font-family: var(--disp, "Darker Grotesque", system-ui, sans-serif);
  font-weight: 900; font-size: 42px; line-height: .85;
  text-transform: uppercase; margin: 0 0 8px;
}
.gate-card p { font-size: 11px; color: var(--dim, #222); letter-spacing: .08em; text-transform: uppercase; margin: 0 0 18px; }
.gate-row { margin-bottom: 12px; }
.gate-row label {
  display: block; font-size: 9px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--faint, #555); margin-bottom: 5px;
}
.gate-row .fld {
  width: 100%; border: 2px solid var(--ink, #000); background: #fff;
  font: 700 16px/1 var(--mono, monospace);
  padding: 12px 12px; color: var(--ink, #000);
  letter-spacing: .06em;
}
.gate-row .fld.pw { letter-spacing: .14em; }
.gate-row .fld .cur {
  display: inline-block; width: 8px; height: 16px; background: var(--ink, #000);
  vertical-align: text-bottom; margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}
.gate-act {
  display: flex; border-top: 2px solid var(--ink, #000); margin: 16px -18px -18px;
}
.gate-act .st {
  flex: 1; padding: 13px; font: 700 11px/1 var(--mono, monospace);
  letter-spacing: .12em; text-transform: uppercase;
  background: var(--red, #ff3300); color: #000; text-align: center;
}
.gate-act .st.go { background: var(--blue, #0033ff); color: #fff; }

/* short intro (welcome punch) */
.gate-intro {
  display: none; text-align: center; pointer-events: none;
  position: absolute; inset: 0; z-index: 11;
  flex-direction: column; align-items: center; justify-content: center;
  background: var(--paper, #fafafa);
}
.gate-intro.on { display: flex; }
.gate-intro .gate-badge {
  font: 800 10px/1 var(--mono, monospace);
  letter-spacing: .28em; text-transform: uppercase;
  background: var(--blue, #0033ff); color: #fff;
  border: 2px solid var(--ink, #000); padding: 4px 10px; margin-bottom: 18px;
}
.gate-intro .punch {
  font-family: var(--disp, "Darker Grotesque", system-ui, sans-serif);
  font-weight: 900; font-size: clamp(64px, 14vw, 160px); line-height: .78;
  letter-spacing: -.02em; text-transform: uppercase;
  text-shadow: 10px 10px 0 var(--red, #ff3300);
  animation: punch .26s ease-out, blink .9s steps(2) infinite;
}
.gate-intro .dest {
  margin-top: 14px; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--dim, #222);
}
.gate-intro .barwrap { width: min(520px, 70vw); margin-top: 28px; }
.gate-intro .barlabel {
  display: flex; justify-content: space-between;
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim, #222); margin-bottom: 8px;
}
.gate-intro .barlabel b { color: var(--red, #ff3300); }
.gate-intro .bar {
  position: relative; height: 22px; border: 2px solid var(--ink, #000);
  background: repeating-linear-gradient(90deg, transparent 0 calc(5% - 2px), #000  calc(5% - 2px) 5%);
}
.gate-intro .fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: var(--red, #ff3300);
}
.gate-intro .pct {
  margin-top: 10px;
  font-family: var(--disp, "Darker Grotesque", system-ui, sans-serif);
  font-weight: 900; font-size: 54px; line-height: .8;
}
.gate-intro .pct i { font-style: normal; font-size: 16px; color: var(--red, #ff3300); font-family: var(--mono, monospace); }

#gate.flash .gate-intro { background: #fff; }
#gate.hit .gate-intro .punch { animation: punch .26s ease-out, blink .9s steps(2) infinite, shake .26s ease-out; }

@keyframes punch { 0%{transform:scale(1)} 28%{transform:scale(1.05)} 100%{transform:scale(1)} }
@keyframes shake {
  0%{transform:translate(0,0)} 20%{transform:translate(-8px,3px)}
  40%{transform:translate(7px,-3px)} 60%{transform:translate(-4px,2px)}
  80%{transform:translate(3px,-1px)} 100%{transform:translate(0,0)}
}
@keyframes blink { 50%{opacity:0} }
