/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #050a0e;
  --bg2: #090f14;
  --bg3: #0d161e;
  --surface: #0f1c26;
  --surface2: #152432;
  --border: #1a3044;
  --border-bright: #1e4060;
  --green: #00ff41;
  --green-dim: #00c830;
  --green-dark: #003d10;
  --accent: #00d4ff;
  --accent-dim: #0099bb;
  --text: #c8d8e8;
  --text-dim: #6a8898;
  --text-bright: #e8f4ff;
  --red: #ff3c3c;
  --yellow: #f0c040;
  --font-mono: 'Courier New', Courier, monospace;
  --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --radius: 4px;
  --radius-lg: 8px;
  --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ===== MATRIX CANVAS ===== */
#matrix-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ===== INTRO OVERLAY ===== */
#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

#intro-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#intro-logo {
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 4vw, 2.6rem);
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 0.12em;
  text-shadow: 0 0 20px var(--green);
  animation: glitch 3s infinite;
}

#intro-logo .accent { color: var(--green); }
#intro-logo .bracket { color: var(--text-dim); }

#intro-tagline {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--green-dim);
  letter-spacing: 0.08em;
}

#intro-bar {
  width: 260px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

#intro-fill {
  height: 100%;
  width: 0%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  transition: width 0.05s linear;
}

/* ===== SITE WRAPPER ===== */
#site {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#site.visible {
  opacity: 1;
  transform: none;
}

#site.hidden { display: none; }

/* ===== NAV ===== */
#navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 40px;
  height: 60px;
  background: rgba(5, 10, 14, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.nav-brand {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 0.08em;
  white-space: nowrap;
  margin-right: 8px;
}

.nav-brand .accent { color: var(--green); }
.nav-brand .bracket { color: var(--text-dim); }

.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
  flex: 1;
}

.nav-link {
  display: block;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
  cursor: pointer;
}

.nav-link:hover, .nav-link.active {
  color: var(--green);
  background: var(--green-dark);
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.auth-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.auth-badge.offline {
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
}

.auth-badge.online {
  color: var(--green);
  background: var(--green-dark);
  border: 1px solid var(--green-dim);
}

/* ===== BUTTONS ===== */
.btn-primary {
  padding: 9px 20px;
  background: var(--green);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
}

.btn-primary:hover {
  background: var(--green-dim);
  box-shadow: 0 0 12px var(--green);
}

.btn-primary.large { padding: 13px 28px; font-size: 0.9rem; }
.btn-primary.small { padding: 5px 12px; font-size: 0.74rem; }

.btn-ghost {
  padding: 9px 20px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost.large { padding: 13px 28px; font-size: 0.9rem; }
.btn-ghost.small { padding: 5px 12px; font-size: 0.74rem; }

/* ===== MAIN / PAGES ===== */
#main-content { flex: 1; }

.page { display: none; }
.page.active { display: block; }

/* ===== HOME PAGE ===== */
.hero {
  max-width: 860px;
  margin: 80px auto 60px;
  padding: 0 40px;
  text-align: center;
}

.hero-eyebrow { margin-bottom: 16px; }

.hero-title {
  font-family: var(--font-sans);
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  color: var(--text-bright);
  line-height: 1.15;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.hero-title .accent { color: var(--green); }

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 580px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.hero-badges {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.stats-bar {
  display: flex;
  justify-content: center;
  gap: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 60px;
}

.stat {
  flex: 1;
  max-width: 200px;
  text-align: center;
  padding: 28px 20px;
  border-right: 1px solid var(--border);
}

.stat:last-child { border-right: none; }

.stat-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--green);
  text-shadow: 0 0 10px var(--green);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 4px;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.card {
  background: var(--bg2);
  padding: 36px 28px;
  transition: background var(--transition);
}

.card:hover { background: var(--surface); }

.card-icon {
  font-size: 1.4rem;
  color: var(--green);
  margin-bottom: 14px;
  text-shadow: 0 0 8px var(--green);
}

.card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.card p {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.65;
}

/* ===== PAGE HEADER ===== */
.page-header {
  max-width: 780px;
  margin: 70px auto 50px;
  padding: 0 40px;
}

.page-header h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  color: var(--text-bright);
  margin: 10px 0 12px;
}

.page-header .sub {
  font-size: 0.95rem;
  color: var(--text-dim);
}

/* ===== FEATURES PAGE ===== */
.feature-list {
  max-width: 780px;
  margin: 0 auto 80px;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.feature-row {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
}

.feature-num {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--border-bright);
  min-width: 52px;
  line-height: 1;
  padding-top: 4px;
}

.feature-body h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.feature-body p {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.65;
}

.feature-body code {
  background: var(--surface2);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ===== DOWNLOAD PAGE ===== */
.download-warning {
  max-width: 780px;
  margin: 0 auto 24px;
  padding: 14px 20px;
  background: rgba(240, 192, 64, 0.08);
  border: 1px solid rgba(240, 192, 64, 0.3);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--yellow);
  padding-left: 40px;
}

.download-warning a { color: var(--green); text-decoration: underline; cursor: pointer; }
.warn-icon { font-size: 1rem; }

.release-table {
  max-width: 780px;
  margin: 0 auto 80px;
  padding: 0 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.release-header, .release-row {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr 2fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 20px;
}

.release-header {
  background: var(--surface2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.release-row {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text);
  transition: background var(--transition);
}

.release-row:last-child { border-bottom: none; }
.release-row:hover { background: var(--surface); }
.release-row.latest { background: rgba(0, 255, 65, 0.03); }

.hash {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ===== CHANGELOG PAGE ===== */
.changelog-list {
  max-width: 780px;
  margin: 0 auto 80px;
  padding: 0 40px;
}

.cl-entry {
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
}

.cl-ver { margin-bottom: 6px; }

.cl-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 16px;
  letter-spacing: 0.05em;
}

.cl-notes {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cl-notes li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text);
}

.cl-notes code {
  background: var(--surface2);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ===== UPLOAD PAGE ===== */
.locked-panel {
  max-width: 420px;
  margin: 0 auto 80px;
  padding: 60px 40px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.lock-icon { font-size: 2.4rem; margin-bottom: 16px; }

.locked-panel h3 {
  font-size: 1.1rem;
  color: var(--text-bright);
  margin-bottom: 10px;
}

.locked-panel p {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.6;
}

.upload-form {
  max-width: 600px;
  margin: 0 auto 80px;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.file-drop {
  border: 2px dashed var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.file-drop:hover {
  border-color: var(--green);
  background: var(--green-dark);
}

.file-drop u { color: var(--green); }

/* ===== SHARED FORM ===== */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-row label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.input-field {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}

.input-field:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(0, 255, 65, 0.12);
}

.input-field::placeholder { color: var(--text-dim); }

.btn-primary.full { width: 100%; text-align: center; padding: 12px; }

/* ===== TAGS & BADGES ===== */
.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--green-dim);
  letter-spacing: 0.08em;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--surface2);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.badge.green {
  background: var(--green-dark);
  border-color: var(--green-dim);
  color: var(--green);
}

/* Changelog tag colors */
.cl-notes .tag { display: inline-block; padding: 1px 6px; border-radius: 3px; min-width: 38px; text-align: center; font-size: 0.68rem; }
.tag.add { background: rgba(0,255,65,0.1); color: var(--green); border: 1px solid var(--green-dim); }
.tag.fix { background: rgba(0,212,255,0.1); color: var(--accent); border: 1px solid var(--accent-dim); }
.tag.chg { background: rgba(240,192,64,0.1); color: var(--yellow); border: 1px solid rgba(240,192,64,0.4); }
.tag.rem { background: rgba(255,60,60,0.1); color: var(--red); border: 1px solid rgba(255,60,60,0.4); }

/* ===== FOOTER ===== */
#footer {
  border-top: 1px solid var(--border);
  background: var(--bg2);
  padding: 40px;
  text-align: center;
}

.footer-brand {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-bright);
  margin-bottom: 10px;
}

.footer-brand .accent { color: var(--green); }
.footer-brand .bracket { color: var(--text-dim); }

.footer-sub { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 6px; }
.footer-copy { font-size: 0.78rem; color: var(--border-bright); }

/* ===== AUTH MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 5, 10, 0.85);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.modal-box {
  position: relative;
  z-index: 1;
  background: var(--bg3);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(0,255,65,0.04);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: color var(--transition);
}

.modal-close:hover { color: var(--red); }

.modal-header { margin-bottom: 24px; }
.modal-header h3 { font-size: 1.2rem; color: var(--text-bright); margin-top: 6px; }

.auth-step { display: none; flex-direction: column; gap: 16px; }
.auth-step.active { display: flex; }

.modal-info {
  font-size: 0.87rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.modal-switch {
  font-size: 0.82rem;
  color: var(--text-dim);
  text-align: center;
}

.modal-switch a { color: var(--green); text-decoration: none; }
.modal-switch a:hover { text-decoration: underline; }

/* OTP Inputs */
.code-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.code-box {
  width: 48px;
  height: 56px;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.code-box:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(0,255,65,0.15);
}

.otp-timer {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
}

#otp-countdown { color: var(--yellow); }

/* Security Challenge */
.security-challenge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.challenge-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.challenge-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
}

/* Auth Success */
#auth-success {
  text-align: center;
  align-items: center;
}

.success-icon {
  width: 64px;
  height: 64px;
  background: var(--green-dark);
  border: 2px solid var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--green);
  text-shadow: 0 0 12px var(--green);
  margin: 0 auto;
  animation: pulse-green 1.5s ease infinite;
}

#auth-success h3 { color: var(--green); }

.session-info {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--surface);
  padding: 8px 14px;
  border-radius: var(--radius);
}

.session-info code { color: var(--accent); }

/* ===== ANIMATIONS ===== */
@keyframes glitch {
  0%, 90%, 100% { text-shadow: 0 0 20px var(--green); transform: none; }
  92% { text-shadow: -2px 0 var(--red), 2px 0 var(--accent); transform: translateX(2px); }
  94% { text-shadow: 2px 0 var(--red), -2px 0 var(--accent); transform: translateX(-2px); }
  96% { text-shadow: 0 0 20px var(--green); transform: none; }
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,255,65,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(0,255,65,0); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--green-dim); }

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
  #navbar { padding: 0 16px; gap: 12px; }
  .nav-links { display: none; }
  .hero { padding: 0 20px; margin: 50px auto 40px; }
  .stats-bar { flex-wrap: wrap; }
  .stat { min-width: 50%; }
  .release-table { padding: 0 16px; }
  .release-header, .release-row { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .release-header span:nth-child(4),
  .release-row .hash { display: none; }
  .feature-row { flex-direction: column; gap: 8px; }
  .feature-num { font-size: 1rem; }
  .changelog-list, .page-header, .upload-form { padding: 0 20px; }
  .modal-box { padding: 24px 20px; }
}
