:root {
  --bg-1: #0f0f23;
  --bg-2: #1a1a3e;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-elev: rgba(0, 0, 0, 0.3);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.7);
  --text-mute: rgba(255, 255, 255, 0.5);
  --accent-1: #667eea;
  --accent-2: #764ba2;
  --accent-3: #f093fb;
  --accent-soft: rgba(102, 126, 234, 0.15);
  --accent-border: rgba(102, 126, 234, 0.4);
  --success: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 20px;
  --radius-sm: 12px;
  --font: 'Prompt', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  font-family: var(--font);
  background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-1) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  transition: opacity 0.2s;
}
body.loaded { opacity: 1; }

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-elev);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.site-header .brand::before {
  content: 'Z';
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
.site-header .brand span {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-header .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn {
  background: var(--accent-soft);
  color: var(--accent-1);
  border: 1px solid var(--accent-border);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}
.btn:hover {
  background: rgba(102, 126, 234, 0.25);
  transform: translateY(-1px);
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
  color: white;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 110px 24px 80px;
}

/* Sidebar TOC */
.toc {
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}
.toc::-webkit-scrollbar { width: 4px; }
.toc::-webkit-scrollbar-track { background: transparent; }
.toc::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.toc-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-mute);
  margin-bottom: 14px;
  font-weight: 600;
}
.toc ul { list-style: none; }
.toc li { margin: 3px 0; }
.toc a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 2px solid transparent;
  transition: all 0.2s;
}
.toc a:hover {
  color: var(--text);
  background: var(--bg-card-hover);
}
.toc a.active {
  color: var(--accent-1);
  border-left-color: var(--accent-1);
  background: var(--accent-soft);
  font-weight: 600;
}

/* Content */
.content { min-width: 0; }

.hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.15) 0%, transparent 60%);
  animation: pulse 15s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
.hero > * { position: relative; z-index: 1; }

.hero .tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-1);
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.hero h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
}
.hero p {
  color: var(--text-dim);
  font-size: 1.05rem;
  line-height: 1.7;
}
.hero .meta {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-mute);
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Sections */
section {
  margin-bottom: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.3s;
}
section:hover { border-color: var(--border-strong); }

.section-header {
  padding: 1.25rem 1.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background 0.2s;
}
.section-header:hover { background: var(--bg-card-hover); }

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.section-header .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: white;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}
.section-header .chevron {
  transition: transform 0.25s;
  color: var(--text-mute);
  font-size: 0.7rem;
}
section.collapsed .chevron { transform: rotate(-90deg); }
section.collapsed .section-body { display: none; }

.section-body {
  padding: 0.5rem 1.75rem 1.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.section-body p { margin-bottom: 0.9rem; color: var(--text); }
.section-body p.lead { color: var(--text-dim); font-size: 1rem; margin-bottom: 1.1rem; }

.section-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.4rem 0 0.7rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-body h3::before {
  content: '';
  width: 3px;
  height: 16px;
  background: linear-gradient(180deg, var(--accent-1), var(--accent-2));
  border-radius: 2px;
}

.section-body ul, .section-body ol {
  padding-left: 1.3rem;
  margin-bottom: 0.9rem;
}
.section-body li { margin-bottom: 0.35rem; color: var(--text-dim); }
.section-body li strong { color: var(--text); }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
  background: var(--bg-elev);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
th {
  background: rgba(102, 126, 234, 0.08);
  font-weight: 600;
  color: var(--accent-1);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
tr:last-child td { border-bottom: none; }
td { color: var(--text-dim); }
td strong { color: var(--text); }
td code, .section-body p code, .section-body li code, .callout code, .hero code {
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.82em;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  color: var(--accent-1);
  border: 1px solid var(--accent-border);
}

/* Risk Alert (top-of-page warning) */
.risk-alert {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.18), rgba(251, 146, 60, 0.12));
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 0 30px rgba(248, 113, 113, 0.15);
}
.risk-alert-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  line-height: 1.3;
}
.risk-alert-title::before {
  content: '!';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  border: 2px solid var(--danger);
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 900;
}
.risk-alert ul {
  margin: 0;
  padding-left: 1.3rem;
  list-style: disc;
}
.risk-alert li {
  color: var(--text);
  margin-bottom: 0.55rem;
  font-size: 0.95rem;
  line-height: 1.6;
}
.risk-alert li:last-child { margin-bottom: 0; }
.risk-alert li strong { color: var(--danger); }
.risk-alert .cta {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px dashed rgba(248, 113, 113, 0.4);
  font-size: 0.9rem;
  color: var(--text-dim);
}
.risk-alert .cta strong { color: var(--warn); }

/* Callouts */
.callout {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  border-left: 3px solid;
  font-size: 0.92rem;
  color: var(--text-dim);
}
.callout-info {
  background: var(--accent-soft);
  border-color: var(--accent-1);
}
.callout-warn {
  background: rgba(251, 191, 36, 0.1);
  border-color: var(--warn);
}
.callout-danger {
  background: rgba(248, 113, 113, 0.1);
  border-color: var(--danger);
}
.callout strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text);
}

/* Checklist */
.checklist {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
}
.checklist label {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.5rem 0;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.checklist label:last-child { border-bottom: none; }
.checklist input[type=checkbox] {
  margin-top: 4px;
  accent-color: var(--accent-1);
  cursor: pointer;
  width: 16px;
  height: 16px;
}
.checklist label.done {
  color: var(--text-mute);
  text-decoration: line-through;
}

/* Rules */
.rule-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: var(--bg-elev);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  border-left: 3px solid var(--danger);
  transition: transform 0.2s;
}
.rule-item:hover { transform: translateX(4px); }
.rule-item .rule-num {
  color: var(--danger);
  font-weight: 700;
  font-size: 1.3rem;
  min-width: 28px;
  line-height: 1.2;
}
.rule-item > div:last-child { font-size: 0.92rem; color: var(--text-dim); }
.rule-item strong { color: var(--text); display: block; margin-bottom: 0.2rem; }

/* Footer */
.site-footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 2rem 24px;
  border-top: 1px solid var(--border);
  color: var(--text-mute);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.site-footer a {
  color: var(--accent-1);
  text-decoration: none;
  font-weight: 600;
}
.site-footer a:hover { color: var(--accent-3); }

/* Landing page */
.landing-hero {
  text-align: center;
  padding: 8rem 1.5rem 3rem;
  position: relative;
  overflow: hidden;
}
.landing-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(circle at 30% 40%, rgba(102, 126, 234, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(118, 75, 162, 0.12) 0%, transparent 50%);
  animation: pulse 18s ease-in-out infinite;
  z-index: 0;
}
.landing-hero > * { position: relative; z-index: 1; }

.landing-hero h1 {
  font-size: 2.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.landing-hero p {
  color: var(--text-dim);
  font-size: 1.1rem;
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.7;
}

.ea-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}
.ea-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: block;
  position: relative;
  overflow: hidden;
}
.ea-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  opacity: 0;
  transition: opacity 0.4s;
}
.ea-card:hover {
  transform: translateY(-8px);
  border-color: var(--accent-border);
  box-shadow: 0 20px 50px rgba(102, 126, 234, 0.2);
}
.ea-card:hover::before { opacity: 1; }
.ea-card > * { position: relative; z-index: 1; }

.ea-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.ea-card p {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 0.9rem;
  line-height: 1.6;
}
.ea-card .ea-meta {
  font-size: 0.78rem;
  color: var(--text-mute);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.ea-card.coming-soon {
  opacity: 0.45;
  pointer-events: none;
}

/* Mobile */
@media (max-width: 900px) {
  .site-header { padding: 0.85rem 1rem; }
  .site-header .brand { font-size: 1.05rem; }
  .site-header .brand::before { width: 34px; height: 34px; font-size: 0.95rem; }
  .btn { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

  .layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 90px 16px 60px;
  }
  .toc {
    position: static;
    max-height: none;
    order: 2;
    margin-top: 1rem;
  }
  .content { order: 1; }
  .hero { padding: 1.5rem; }
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 0.95rem; }

  .section-header { padding: 1rem 1.1rem; }
  .section-header h2 { font-size: 1rem; gap: 0.7rem; }
  .section-header .num { width: 28px; height: 28px; font-size: 0.78rem; }
  .section-body { padding: 0.5rem 1.1rem 1.25rem; padding-top: 1rem; }

  table { font-size: 0.82rem; display: block; overflow-x: auto; }
  th, td { padding: 0.6rem 0.75rem; white-space: nowrap; }

  .landing-hero { padding: 6rem 1rem 2rem; }
  .landing-hero h1 { font-size: 2rem; }
  .landing-hero p { font-size: 0.95rem; }
}
