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

:root {
  --bg: #0d0f1a;
  --surface: #131624;
  --surface2: #1a1e30;
  --border: #252a42;
  --text: #e8ecf4;
  --text2: #9ba3c0;
  --text3: #5c6480;
  --accent: #6c63ff;
  --accent2: #9d96ff;
  --good: #34d399;
  --ok: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
}

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

.bg-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(108,99,255,0.07) 1px, transparent 0);
  background-size: 40px 40px;
  pointer-events: none;
}

/* ── HERO ── */
.hero {
  position: relative; z-index: 1;
  background: linear-gradient(135deg, #0d0f1a 0%, #1a0533 50%, #0d1a33 100%);
  padding: 80px 24px 60px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.hero-inner { max-width: 700px; margin: 0 auto; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(108,99,255,0.15); border: 1px solid rgba(108,99,255,0.4);
  color: var(--accent2); padding: 6px 18px; border-radius: 50px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.5px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--accent2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1; margin-bottom: 16px;
}
.hero p {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: var(--text2); margin-bottom: 36px; line-height: 1.6;
}
.hero-stats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
}
.stat {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  padding: 8px 20px; border-radius: 50px;
  font-size: 13px; font-weight: 500; color: var(--text2);
}
.stat i { color: var(--accent2); font-size: 14px; }

/* ── MAIN ── */
.main {
  position: relative; z-index: 1;
  max-width: 1200px; margin: 0 auto; padding: 40px 16px 60px;
}

/* ── SEARCH ── */
.search-bar {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 50px; padding: 14px 24px;
  margin-bottom: 36px; transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar i { color: var(--text3); font-size: 15px; }
.search-bar input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: 'Inter', sans-serif; font-size: 15px;
}
.search-bar input::placeholder { color: var(--text3); }

/* ── TOPICS GRID ── */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px; margin-bottom: 48px;
}

.topic-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px 24px;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  opacity: 0; transform: translateY(20px);
  cursor: pointer;
}
.topic-card.visible { opacity: 1; transform: translateY(0); transition: opacity 0.4s, transform 0.4s, border-color 0.2s, box-shadow 0.2s; }
.topic-card:hover {
  border-color: var(--accent); transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(108,99,255,0.2);
}
.topic-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; margin-bottom: 4px;
}
.topic-num {
  font-family: 'Fira Code', monospace; font-size: 11px;
  color: var(--text3); font-weight: 600; letter-spacing: 1px;
}
.topic-card h2 {
  font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.3;
}
.topic-card p {
  font-size: 13px; color: var(--text2); line-height: 1.6; flex: 1;
}
.topic-tags {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
}
.topic-tags span {
  font-size: 11px; font-weight: 600;
  background: rgba(108,99,255,0.1); color: var(--accent2);
  border: 1px solid rgba(108,99,255,0.25);
  padding: 3px 10px; border-radius: 20px;
}
.topic-arrow {
  position: absolute; top: 24px; right: 24px;
  color: var(--text3); font-size: 13px;
  transition: transform 0.2s, color 0.2s;
}
.topic-card:hover .topic-arrow { transform: translateX(4px); color: var(--accent2); }

/* ── QUICK REF CARD ── */
.quick-ref-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
}
.qr-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
}
.qr-header i { color: var(--ok); font-size: 20px; }
.qr-header h2 { font-size: 18px; font-weight: 700; }
.qr-grid { display: flex; flex-direction: column; gap: 0; }
.qr-row {
  display: grid; grid-template-columns: 1fr 1fr auto;
  gap: 16px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.qr-row:last-child { border-bottom: none; }
.qr-cue { color: var(--text2); }
.qr-pattern { font-weight: 600; color: var(--text); }
.qr-time {
  font-family: 'Fira Code', monospace; font-size: 12px;
  font-weight: 600; padding: 3px 10px; border-radius: 20px;
  white-space: nowrap;
}
.qr-time.good { color: var(--good); background: rgba(52,211,153,0.1); }
.qr-time.ok { color: var(--ok); background: rgba(251,191,36,0.1); }
.qr-time.bad { color: var(--bad); background: rgba(248,113,113,0.1); }

/* ── FOOTER ── */
footer {
  text-align: center; padding: 32px 16px;
  color: var(--text3); font-size: 13px;
  border-top: 1px solid var(--border); position: relative; z-index: 1;
}
footer i { color: var(--accent2); margin-right: 6px; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .hero { padding: 60px 16px 40px; }
  .topics-grid { grid-template-columns: 1fr; }
  .qr-row { grid-template-columns: 1fr; gap: 4px; }
  .qr-time { align-self: flex-start; }
}
