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

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 800px at 80% -10%, #0c1f4a 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
kbd {
  font: inherit; font-size: 0.85em;
  padding: 1px 7px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--surface-2);
}

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 6px; }

#neural-bg {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; opacity: 0.55;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 var(--gutter);
  background: linear-gradient(to bottom, rgba(4, 10, 25, 0.92), rgba(4, 10, 25, 0.6));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: transform 0.4s var(--ease), opacity 0.4s var(--ease);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; font-weight: 600; font-size: 15px; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: conic-gradient(from 210deg, var(--accent), var(--accent-2), var(--accent));
  box-shadow: 0 0 18px var(--accent-glow);
}
.brand-sep { color: var(--muted); margin: 0 2px; }
#client-name { color: var(--text-2); font-weight: 500; }

.section-nav {
  flex: 1; min-width: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  justify-content: safe center;
  mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  padding: 0 10px;
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a {
  font-size: 13px; text-decoration: none; color: var(--text-2);
  padding: 6px 9px; border-radius: 999px; white-space: nowrap; flex: none;
  transition: background 0.25s, color 0.25s;
}
.section-nav a:hover { color: var(--text); background: var(--surface-2); }
.section-nav a.is-active { color: #fff; background: var(--accent); box-shadow: 0 0 20px var(--accent-glow); }

.topbar-actions { display: flex; gap: 8px; }
.btn-ghost, .btn-primary {
  font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); color: var(--text); background: transparent;
  transition: background 0.25s, box-shadow 0.25s;
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: transparent; }
.btn-primary:hover { box-shadow: 0 0 24px var(--accent-glow); }

.progress { position: fixed; top: var(--topbar-h); left: 0; right: 0; height: 2px; z-index: 50; background: transparent; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 12px var(--accent-glow); transition: width 0.5s var(--ease); }

.topbar { padding: 0 clamp(16px, 2.5vw, 48px); gap: 12px; }
@media (max-width: 1440px) {
  .brand-sep, #client-name { display: none; }
}
@media (max-width: 900px) {
  .brand-text { display: none; }
  #btn-overview { display: none; }
}

/* ---------- Overview ---------- */
.overview {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(3, 8, 20, 0.94); backdrop-filter: blur(10px);
  overflow-y: auto; padding: 40px var(--gutter);
}
.overview-inner { max-width: var(--max-w); margin: 0 auto; }
.overview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.overview-head h2 { font-size: var(--fs-h2); }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.overview-card {
  text-align: left; padding: 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  min-height: 110px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.2s, transform 0.2s;
}
.overview-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.overview-card.is-current { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2); }
.overview-card small { color: var(--accent-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.overview-card span { font-weight: 600; font-size: 15px; line-height: 1.3; }

.present-hint {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60;
  font-size: 13px; color: var(--text-2); padding: 8px 16px; border-radius: 999px;
  background: rgba(8, 19, 41, 0.85); border: 1px solid var(--border);
}

.load-error { max-width: 640px; margin: 20vh auto; padding: 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.load-error h1 { font-size: var(--fs-h2); margin-bottom: 12px; }
.load-error code { color: var(--accent-2); }
.noscript { padding: 40px; text-align: center; }
