:root {
  --bg: #0a0a0a;
  --surface: rgba(17, 17, 17, 0.82);
  --border: rgba(0, 230, 118, 0.18);
  --accent: #00e676;
  --accent-dim: #00b057;
  --accent-glow: rgba(0, 230, 118, 0.35);
  --text: #f0f0f0;
  --text2: #888;
  --danger: #ff3d3d;
  --font: 'Space Grotesk', -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', 'Fira Code', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

.login-scene {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#matrixCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.42;
}

#particleCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image:
    linear-gradient(rgba(0, 230, 118, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 230, 118, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 20%, transparent 100%);
  animation: gridDrift 20s linear infinite;
}

@keyframes gridDrift {
  0% { transform: perspective(500px) rotateX(60deg) translateY(0); }
  100% { transform: perspective(500px) rotateX(60deg) translateY(48px); }
}

.scanline {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  opacity: 0.35;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: orbFloat 8s ease-in-out infinite;
  z-index: 2;
}

.glow-orb.a {
  width: 420px;
  height: 420px;
  background: #00e676;
  top: -120px;
  left: -100px;
  animation-delay: 0s;
}

.glow-orb.b {
  width: 320px;
  height: 320px;
  background: #006633;
  bottom: -80px;
  right: -60px;
  animation-delay: -3s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.08); }
}

.login-card {
  position: relative;
  z-index: 10;
  width: min(420px, calc(100vw - 32px));
  padding: 36px 32px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(24px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 24px 80px rgba(0, 0, 0, 0.55),
    0 0 60px rgba(0, 230, 118, 0.06);
  animation: cardIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.login-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 13px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(0, 230, 118, 0.5), transparent 40%, transparent 60%, rgba(0, 230, 118, 0.2));
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  animation: borderPulse 3s ease-in-out infinite;
}

@keyframes borderPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-brand img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  animation: logoPulse 2.5s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.3); }
  50% { box-shadow: 0 0 20px 4px rgba(0, 230, 118, 0.15); }
}

.brand-text h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.brand-text p {
  font-size: 12px;
  color: var(--accent);
  font-family: var(--mono);
  margin-top: 2px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 24px;
  line-height: 1.5;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text2);
  margin-bottom: 7px;
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.12), 0 0 20px rgba(0, 230, 118, 0.08);
  background: rgba(0, 0, 0, 0.6);
}

.input-wrap .ico {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text2);
  transition: color 0.2s;
  pointer-events: none;
}

.input-wrap input:focus + .ico,
.input-wrap:focus-within .ico {
  color: var(--accent);
}

.toggle-pass {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 4px;
  display: flex;
  transition: color 0.2s;
}

.toggle-pass:hover { color: var(--accent); }

.login-error {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: rgba(255, 61, 61, 0.1);
  border: 1px solid rgba(255, 61, 61, 0.25);
  border-radius: 8px;
  font-size: 13px;
  color: #ff7070;
  animation: shake 0.4s ease;
}

.login-error.visible { display: flex; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.login-btn {
  width: 100%;
  margin-top: 8px;
  padding: 13px 20px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  border: none;
  border-radius: 8px;
  color: #0a0a0a;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 24px rgba(0, 230, 118, 0.25);
}

.login-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s;
}

.login-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(0, 230, 118, 0.35);
}

.login-btn:hover:not(:disabled)::after {
  transform: translateX(100%);
}

.login-btn:active:not(:disabled) { transform: translateY(0); }

.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-btn .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #0a0a0a;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

.login-btn.loading .btn-text { display: none; }
.login-btn.loading .spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

.login-foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text2);
  font-family: var(--mono);
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hex-deco {
  position: absolute;
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(0, 230, 118, 0.15);
  pointer-events: none;
  z-index: 3;
  user-select: none;
}

.hex-deco.tl { top: 24px; left: 24px; }
.hex-deco.br { bottom: 24px; right: 24px; text-align: right; }

@media (max-width: 480px) {
  .login-card { padding: 28px 20px 22px; }
  .hex-deco { display: none; }
}
