*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #030311;
  --cyan: #00d4ff;
  --purple: #7c3aed;
  --green: #00ff88;
  --amber: #f59e0b;
  --red: #ff4488;
  --text: #e2e8f0;
  --muted: #9ca3af;
  --glass: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --mono: 'Courier New', Courier, monospace;
}

html, body {
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ─── LOADER ───────────────────────────────── */
#loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease;
}
#loader.fade-out { opacity: 0; pointer-events: none; }
.loader-text {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: bold;
  letter-spacing: 0.4em;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: pulse-text 1.2s ease-in-out infinite;
}
@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── LANDING ──────────────────────────────── */
#landing {
  position: relative;
  width: 100%;
}

#landing-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
}

#hud {
  position: relative;
  z-index: 10;
}
#hud a, #hud button { pointer-events: auto; }

/* Nav */
#hud-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 3rem;
  background: linear-gradient(to bottom, rgba(3,3,17,0.95) 0%, transparent 100%);
  z-index: 20;
  pointer-events: auto;
}

.logo {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 0.25em;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-decoration: none;
}

.hud-nav { display: flex; gap: 2.5rem; }
.hud-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}
.hud-nav a:hover { color: var(--cyan); }

/* Hero */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 7rem 2rem 4rem;
  pointer-events: none;
}

#hero h1 {
  font-size: clamp(2.8rem, 9vw, 6.5rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.05;
  background: linear-gradient(135deg, #ffffff 0%, var(--cyan) 45%, var(--purple) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.5rem;
}

#hero h2 {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.tagline {
  font-size: clamp(0.85rem, 2vw, 1.1rem);
  color: rgba(156, 163, 175, 0.8);
  letter-spacing: 0.06em;
  margin-bottom: 3rem;
}

/* ACCESS button */
.access-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 3.5rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #000;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--purple) 100%);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 40px rgba(0, 212, 255, 0.4), 0 0 80px rgba(124, 58, 237, 0.2);
}
.access-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.access-btn:hover { transform: translateY(-2px); box-shadow: 0 0 60px rgba(0,212,255,0.6), 0 0 100px rgba(124,58,237,0.35); }
.access-btn:hover::before { opacity: 1; }
.access-btn:active { transform: translateY(0); }

/* HUD sections */
.hud-section {
  padding: 8rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hud-section > h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 2.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Glass cards */
.glass-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.glass-card:hover {
  border-color: rgba(0,212,255,0.25);
  box-shadow: 0 0 30px rgba(0,212,255,0.08);
}
.glass-card h2 { color: var(--cyan); font-size: 1.5rem; margin-bottom: 1rem; }
.glass-card h3 { color: var(--text); font-size: 1.1rem; margin-bottom: 0.75rem; font-weight: 600; }
.glass-card p { color: var(--muted); font-size: 0.95rem; line-height: 1.75; }
.glass-card.wide { max-width: 740px; margin: 0 auto; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.card-icon {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  display: block;
}

/* Credentials */
.credentials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.badge {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border: 1px solid rgba(0,212,255,0.3);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--cyan);
  background: rgba(0,212,255,0.06);
}

/* Footer */
#hud-footer {
  padding: 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(to top, rgba(3,3,17,0.95), transparent);
}

/* ─── LOGIN MODAL ──────────────────────────── */
#login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3,3,17,0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: overlay-in 0.25s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

#login-box {
  background: rgba(8,8,28,0.97);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 20px;
  padding: 2.5rem 3rem;
  width: 100%;
  max-width: 420px;
  position: relative;
  box-shadow: 0 0 80px rgba(0,212,255,0.12), 0 25px 80px rgba(0,0,0,0.6);
  animation: box-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes box-in { from { opacity: 0; transform: scale(0.92) translateY(8px); } to { opacity: 1; transform: none; } }

#close-login {
  position: absolute;
  top: 1rem; right: 1.25rem;
  background: none; border: none;
  color: var(--muted);
  font-size: 1.6rem;
  cursor: pointer; line-height: 1;
  transition: color 0.2s;
}
#close-login:hover { color: var(--text); }

.login-logo {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: bold;
  letter-spacing: 0.35em;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-align: center;
  margin-bottom: 1.5rem;
}

#login-box h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 0.25rem;
}
.login-subtitle {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 2rem;
  letter-spacing: 0.05em;
}

.field { margin-bottom: 1.25rem; }
.field label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.field input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.field input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.12);
}

#login-btn {
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  border: none;
  border-radius: 10px;
  color: #000;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: opacity 0.2s, transform 0.15s;
}
#login-btn:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
#login-btn:disabled { opacity: 0.45; cursor: not-allowed; }

#login-error {
  min-height: 1.4rem;
  margin-top: 1rem;
  text-align: center;
  color: var(--red);
  font-size: 0.88rem;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px); }
  30% { transform: translateX(8px); }
  45% { transform: translateX(-5px); }
  60% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}
#login-box.shake { animation: shake 0.45s ease; }

/* ─── APP SHELL ─────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2rem;
  background: rgba(3,3,17,0.97);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.header-sub {
  font-size: 0.6em;
  opacity: 0.55;
  letter-spacing: 0.08em;
  margin-left: 0.5rem;
  font-family: inherit;
}

#app-controls { display: flex; align-items: center; gap: 1.5rem; }

#last-updated {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: border-color 0.2s, color 0.2s;
}
.icon-btn:hover { border-color: var(--cyan); color: var(--cyan); }

/* Dashboard */
#dashboard-container {
  position: relative;
  flex: 1;
  overflow: hidden;
}
#dashboard-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#dashboard-hint {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.22);
  text-align: center;
  pointer-events: none;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Phase detail panel */
#phase-panel {
  position: absolute;
  top: 1.5rem; right: 1.5rem;
  width: 360px;
  max-height: calc(100% - 3rem);
  overflow-y: auto;
  background: rgba(8,8,28,0.97);
  border: 1px solid rgba(0,212,255,0.18);
  border-radius: 14px;
  padding: 1.75rem;
  z-index: 20;
  box-shadow: 0 0 50px rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: panel-in 0.2s ease;
}
@keyframes panel-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

#close-panel {
  position: absolute;
  top: 1rem; right: 1.25rem;
  background: none; border: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer; line-height: 1;
  transition: color 0.2s;
}
#close-panel:hover { color: var(--text); }

.panel-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  padding-right: 1.5rem;
}
.panel-id {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}
.panel-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  border: 1px solid currentColor;
  opacity: 0.85;
}

#phase-content h3 {
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}
#phase-content h4 {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.25rem 0 0.6rem;
}

.steps-list { list-style: none; display: flex; flex-direction: column; gap: 0.45rem; }
.steps-list li {
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  line-height: 1.5;
}
.step-done { color: var(--green); }
.step-pending { color: var(--muted); }
.step-icon { font-family: var(--mono); flex-shrink: 0; margin-top: 0.1rem; }

.acceptance {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.7;
}
.no-steps { font-size: 0.85rem; color: var(--muted); font-style: italic; }

/* Legend */
#dashboard-legend {
  position: absolute;
  bottom: 3rem;
  left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── SCROLLBAR ─────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* ─── RESPONSIVE ────────────────────────────── */
@media (max-width: 768px) {
  #hud-header { padding: 1rem 1.5rem; }
  .hud-nav { display: none; }
  .hud-section { padding: 5rem 1.5rem; }
  #phase-panel { width: calc(100% - 2rem); left: 1rem; right: 1rem; top: auto; bottom: 1rem; max-height: 55vh; }
  #app-header { padding: 0.75rem 1rem; }
  #last-updated { display: none; }
  #dashboard-legend { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .access-btn, #login-btn, .glass-card { transition: none; }
  #login-box.shake { animation: none; }
  #login-box, #login-overlay, #phase-panel { animation: none; }
  .loader-text { animation: none; opacity: 1; }
}
