/* ============================================================
   Login intro — "Test by 365" boot sequence
   ============================================================ */

.intro {
  --g: #22e000;
  --g-soft: #4ade80;
  --g-dim: rgba(34, 224, 0, 0.18);
  --cyan: #22d3ee;
  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, 'Courier New', monospace;
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  overflow: hidden;
  color: #e2fbe0;
  font-family: var(--mono);
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(18, 167, 0, 0.14) 0%, transparent 70%),
    radial-gradient(ellipse at center, rgba(2, 6, 23, 0.82) 0%, rgba(2, 6, 23, 0.97) 75%);
  transform-origin: center;
}

.intro-play .intro { display: block; }
.intro-play .login-wrap { opacity: 0; pointer-events: none; }

/* ---------- ambient layers ---------- */

.intro-floor {
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: -10%;
  height: 60%;
  background-image:
    linear-gradient(rgba(34, 224, 0, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 224, 0, 0.35) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(420px) rotateX(62deg);
  transform-origin: top center;
  mask-image: linear-gradient(to bottom, transparent 0%, #000 35%, #000 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 35%, #000 70%, transparent 100%);
  opacity: 0.35;
  animation: intro-floor 1.6s linear infinite;
}

@keyframes intro-floor {
  to { background-position: 0 60px, 0 0; }
}

.intro-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
  z-index: 5;
}

.intro-scanbeam {
  position: absolute;
  left: 0;
  right: 0;
  height: 120px;
  top: -120px;
  background: linear-gradient(to bottom, transparent, rgba(34, 224, 0, 0.07), transparent);
  animation: intro-beam 3.2s linear infinite;
  pointer-events: none;
  z-index: 5;
}

@keyframes intro-beam {
  to { transform: translateY(calc(100vh + 240px)); }
}

.intro-corner {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 2px solid var(--g);
  opacity: 0.55;
  z-index: 6;
}
.intro-corner.tl { top: 22px; left: 22px; border-right: 0; border-bottom: 0; }
.intro-corner.tr { top: 22px; right: 22px; border-left: 0; border-bottom: 0; }
.intro-corner.bl { bottom: 22px; left: 22px; border-right: 0; border-top: 0; }
.intro-corner.br { bottom: 22px; right: 22px; border-left: 0; border-top: 0; }

.intro-hud {
  position: absolute;
  top: 28px;
  left: 70px;
  right: 70px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(74, 222, 128, 0.55);
  text-transform: uppercase;
  z-index: 6;
}
.intro-hud .rec::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
  animation: pulse-dot 1s steps(2) infinite;
}

/* ---------- scenes ---------- */

.intro-scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.04);
  filter: blur(8px);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.5s ease, visibility 0s linear 0.6s;
  z-index: 4;
}

.intro[data-scene="boot"] .scene-boot,
.intro[data-scene="map"] .scene-map,
.intro[data-scene="brand"] .scene-brand {
  opacity: 1;
  visibility: visible;
  transform: none;
  filter: none;
  transition-delay: 0s;
}

/* ---------- scene 1 : boot terminal ---------- */

.intro-term {
  width: min(620px, 100%);
  border-radius: 14px;
  background: rgba(3, 10, 6, 0.78);
  border: 1px solid rgba(34, 224, 0, 0.25);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03) inset, 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(34, 224, 0, 0.12);
  overflow: hidden;
}

.intro-term-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(34, 224, 0, 0.12);
  background: rgba(255, 255, 255, 0.02);
  font-size: 11px;
  color: rgba(148, 163, 184, 0.7);
}
.intro-term-bar i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.intro-term-bar i:nth-child(1) { background: #ff5f57; }
.intro-term-bar i:nth-child(2) { background: #febc2e; }
.intro-term-bar i:nth-child(3) { background: #28c840; }
.intro-term-bar span { margin-left: 10px; }

.intro-term-body {
  padding: 18px 20px 14px;
  min-height: 136px;
  font-size: 13px;
  line-height: 1.85;
}

.t-line { display: flex; gap: 10px; white-space: pre; overflow: hidden; }
.t-pfx { color: var(--g); font-weight: 700; }
.t-txt { color: #d1fadf; }
.t-txt .k { color: var(--cyan); }
.t-ok {
  margin-left: auto;
  color: var(--g);
  font-weight: 700;
  opacity: 0;
  transform: translateX(8px);
  transition: all 0.25s;
}
.t-line.done .t-ok { opacity: 1; transform: none; }

.t-caret {
  display: inline-block;
  width: 8px;
  height: 15px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--g);
  box-shadow: 0 0 10px var(--g);
  animation: pulse-dot 0.8s steps(2) infinite;
}

.t-progress {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: rgba(74, 222, 128, 0.85);
  opacity: 0;
  transition: opacity 0.3s;
}
.t-progress.show { opacity: 1; }
.t-progress-track {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: rgba(34, 224, 0, 0.1);
  overflow: hidden;
}
.t-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #0d8a00, var(--g), #b6ff9e);
  box-shadow: 0 0 14px var(--g);
}

/* ---------- scene 2 : infographic ---------- */

.map-head {
  text-align: center;
  margin-bottom: 8px;
}
.map-kicker {
  font-size: 11px;
  letter-spacing: 0.32em;
  color: rgba(74, 222, 128, 0.7);
}
.map-title {
  margin-top: 6px;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #f0fdf4;
}
.map-title b { color: var(--g); text-shadow: 0 0 22px rgba(34, 224, 0, 0.6); }

.map-svg {
  width: min(760px, 100%);
  height: auto;
  overflow: visible;
}

.map-svg .wire {
  fill: none;
  stroke: url(#wireGrad);
  stroke-width: 2;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
}
.intro[data-scene="map"] .map-svg .wire { animation: wire-draw 0.9s cubic-bezier(0.65, 0, 0.35, 1) forwards; }
.intro[data-scene="map"] .map-svg .wire:nth-of-type(2) { animation-delay: 0.1s; }
.intro[data-scene="map"] .map-svg .wire:nth-of-type(3) { animation-delay: 0.2s; }
.intro[data-scene="map"] .map-svg .wire:nth-of-type(4) { animation-delay: 0.3s; }

@keyframes wire-draw { to { stroke-dashoffset: 0; } }

.map-svg .packet { fill: #b6ff9e; filter: url(#glow); opacity: 0; }
.intro[data-scene="map"] .map-svg .packet { animation: fade-in 0.3s 0.9s forwards; }

.map-svg .node { opacity: 0; transform-box: fill-box; transform-origin: center; }
.intro[data-scene="map"] .map-svg .node { animation: node-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.intro[data-scene="map"] .map-svg .node.n1 { animation-delay: 0.55s; }
.intro[data-scene="map"] .map-svg .node.n2 { animation-delay: 0.65s; }
.intro[data-scene="map"] .map-svg .node.n3 { animation-delay: 0.75s; }
.intro[data-scene="map"] .map-svg .node.n4 { animation-delay: 0.85s; }

@keyframes node-pop {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes fade-in { to { opacity: 1; } }

.map-svg .node rect {
  fill: rgba(3, 14, 6, 0.9);
  stroke: rgba(34, 224, 0, 0.55);
  stroke-width: 1.2;
}
.map-svg .node .lbl {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  fill: #eafff0;
  letter-spacing: 0.08em;
}
.map-svg .node .sub {
  font-family: var(--mono);
  font-size: 10px;
  fill: rgba(74, 222, 128, 0.8);
}

.map-svg .hub-ring {
  fill: none;
  stroke: var(--g);
  stroke-width: 1.5;
  stroke-dasharray: 6 8;
  transform-box: fill-box;
  transform-origin: center;
  animation: spin 9s linear infinite;
  opacity: 0.8;
}
.map-svg .hub-ring.r2 {
  stroke: var(--cyan);
  stroke-dasharray: 2 12;
  animation-duration: 6s;
  animation-direction: reverse;
  opacity: 0.6;
}
.map-svg .hub-core { fill: url(#hubGrad); filter: url(#glow); }
.map-svg .hub-txt {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-weight: 900;
  font-size: 30px;
  fill: #021006;
}
.map-svg .hub-pulse {
  fill: none;
  stroke: var(--g);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: hub-pulse 1.8s ease-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes hub-pulse {
  from { transform: scale(1); opacity: 0.7; }
  to { transform: scale(2.1); opacity: 0; }
}

.map-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: min(760px, 100%);
  margin-top: 10px;
}
.map-stat {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(3, 14, 6, 0.7);
  border: 1px solid rgba(34, 224, 0, 0.18);
  opacity: 0;
  transform: translateY(14px);
}
.intro[data-scene="map"] .map-stat { animation: stat-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.intro[data-scene="map"] .map-stat:nth-child(1) { animation-delay: 1.0s; }
.intro[data-scene="map"] .map-stat:nth-child(2) { animation-delay: 1.1s; }
.intro[data-scene="map"] .map-stat:nth-child(3) { animation-delay: 1.2s; }
.intro[data-scene="map"] .map-stat:nth-child(4) { animation-delay: 1.3s; }

@keyframes stat-in { to { opacity: 1; transform: none; } }

.map-stat .v {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 800;
  color: var(--g);
  text-shadow: 0 0 18px rgba(34, 224, 0, 0.45);
  font-variant-numeric: tabular-nums;
}
.map-stat .k {
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(148, 163, 184, 0.8);
  text-transform: uppercase;
}
.map-stat .bar {
  margin-top: 8px;
  height: 3px;
  border-radius: 9px;
  background: rgba(34, 224, 0, 0.12);
  overflow: hidden;
}
.map-stat .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #0d8a00, var(--g));
  transition: width 1.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- scene 3 : brand reveal ---------- */

.brand-code {
  font-size: clamp(12px, 1.6vw, 15px);
  color: rgba(209, 250, 223, 0.85);
  margin-bottom: 26px;
  min-height: 1.4em;
  white-space: pre;
}
.brand-code .kw { color: #c084fc; }
.brand-code .fn { color: var(--cyan); }
.brand-code .str { color: #fde68a; }

.brand-title {
  position: relative;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(52px, 11vw, 140px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #f8fafc;
  white-space: nowrap;
  text-shadow: 0 0 40px rgba(34, 224, 0, 0.25);
}
.brand-title .w { display: inline-block; }
.brand-title .w + .w { margin-left: 0.22em; }
.brand-title .accent {
  background: linear-gradient(135deg, #b6ff9e 0%, var(--g) 45%, #0d8a00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(34, 224, 0, 0.55));
}
.brand-title .scr { color: var(--g); opacity: 0.75; }

.brand-title.glitch::before,
.brand-title.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.brand-title.glitch::before {
  color: var(--cyan);
  transform: translate(-3px, 0);
  mix-blend-mode: screen;
  animation: glitch-a 0.6s steps(2) 2;
}
.brand-title.glitch::after {
  color: #ff2bd6;
  transform: translate(3px, 0);
  mix-blend-mode: screen;
  animation: glitch-b 0.6s steps(2) 2;
}
@keyframes glitch-a {
  0% { clip-path: inset(0 0 70% 0); }
  25% { clip-path: inset(40% 0 30% 0); transform: translate(-6px, 0); }
  50% { clip-path: inset(75% 0 5% 0); }
  75% { clip-path: inset(15% 0 60% 0); transform: translate(4px, 0); }
  100% { clip-path: inset(100% 0 0 0); }
}
@keyframes glitch-b {
  0% { clip-path: inset(60% 0 10% 0); }
  25% { clip-path: inset(10% 0 75% 0); transform: translate(6px, 0); }
  50% { clip-path: inset(35% 0 40% 0); }
  75% { clip-path: inset(80% 0 2% 0); transform: translate(-4px, 0); }
  100% { clip-path: inset(100% 0 0 0); }
}

.brand-line {
  width: 0;
  height: 2px;
  margin: 26px auto 18px;
  background: linear-gradient(90deg, transparent, var(--g), transparent);
  box-shadow: 0 0 18px var(--g);
  transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.brand-tag {
  font-size: clamp(10px, 1.3vw, 13px);
  letter-spacing: 0.42em;
  color: rgba(74, 222, 128, 0.85);
  text-transform: uppercase;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.6s ease;
}
.brand-done .brand-line { width: min(520px, 80vw); }
.brand-done .brand-tag { opacity: 1; transform: none; }

.brand-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--g);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
}
.brand-done .brand-burst { animation: burst 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.brand-done .brand-burst.b2 { animation-delay: 0.15s; border-color: var(--cyan); }
.brand-done .brand-burst.b3 { animation-delay: 0.3s; }

@keyframes burst {
  0% { opacity: 0.9; width: 10px; height: 10px; }
  100% { opacity: 0; width: 140vmax; height: 140vmax; border-width: 1px; }
}

/* ---------- controls ---------- */

.intro-skip {
  position: absolute;
  right: 28px;
  bottom: 30px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: rgba(209, 250, 223, 0.85);
  background: rgba(3, 14, 6, 0.6);
  border: 1px solid rgba(34, 224, 0, 0.3);
  cursor: pointer;
  transition: all 0.2s;
}
.intro-skip:hover {
  color: #fff;
  border-color: var(--g);
  box-shadow: 0 0 18px rgba(34, 224, 0, 0.35);
}

.intro-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  z-index: 8;
  background: linear-gradient(90deg, #0d8a00, var(--g));
  box-shadow: 0 0 12px var(--g);
}
.intro.running .intro-progress { animation: intro-progress var(--intro-dur, 8s) linear forwards; }
@keyframes intro-progress { to { width: 100%; } }

/* ---------- exit : CRT power-off ---------- */

.intro.intro-out { animation: crt-off 0.75s cubic-bezier(0.7, 0, 0.3, 1) forwards; }
@keyframes crt-off {
  0% { transform: scale(1, 1); filter: brightness(1); opacity: 1; }
  45% { transform: scale(1, 0.004); filter: brightness(3); opacity: 1; }
  100% { transform: scale(0, 0.004); filter: brightness(6); opacity: 0; }
}

/* ---------- login card entrance ---------- */

.intro-reveal .login-card { animation: card-in 1s cubic-bezier(0.16, 1, 0.3, 1) both; }
.intro-reveal .login-brand-logo { animation: logo-in 1.1s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both; }
.intro-reveal .login-brand-badge,
.intro-reveal .login-brand-sub,
.intro-reveal .login-form > * { animation: rise-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }
.intro-reveal .login-brand-badge { animation-delay: 0.3s; }
.intro-reveal .login-brand-sub { animation-delay: 0.38s; }
.intro-reveal .login-form > :nth-child(1) { animation-delay: 0.46s; }
.intro-reveal .login-form > :nth-child(2) { animation-delay: 0.54s; }
.intro-reveal .login-form > :nth-child(3) { animation-delay: 0.62s; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(28px) scale(0.94); filter: blur(12px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes logo-in {
  from { opacity: 0; transform: scale(1.25); filter: blur(10px) brightness(2); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.login-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  overflow: hidden;
}
.login-shine::before {
  content: '';
  position: absolute;
  top: -50%;
  bottom: -50%;
  left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(182, 255, 158, 0.16), transparent);
  transform: skewX(-18deg) translateX(-120%);
}
.intro-reveal .login-shine::before { animation: shine 1.3s 0.6s ease-in-out both; }
@keyframes shine { to { transform: skewX(-18deg) translateX(520%); } }

.login-replay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(148, 163, 184, 0.7);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.2s;
}
.login-replay:hover {
  color: #4ade80;
  border-color: rgba(18, 167, 0, 0.35);
  box-shadow: 0 0 12px rgba(18, 167, 0, 0.15);
}

/* ---------- responsive / a11y ---------- */

@media (max-width: 640px) {
  .intro-hud { left: 24px; right: 24px; top: 64px; font-size: 9px; }
  .intro-hud .hide-sm { display: none; }
  .intro-corner { width: 22px; height: 22px; }
  .intro-term-body { font-size: 11px; min-height: 112px; padding: 14px; }
  .t-ok { display: none; }
  .map-stats { grid-template-columns: repeat(2, 1fr); }
  .intro-skip { right: 16px; bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .intro { display: none !important; }
  .intro-play .login-wrap { opacity: 1; pointer-events: auto; }
}
