:root {
  --black:   #030303;
  --dark:    #0c0f12;
  --panel:   #12161b;
  --panel2:  #171c22;
  --border:  rgba(255,255,255,0.08);
  --yellow:  #fcee0a;
  --cyan:    #00f0ff;
  --magenta: #ff003c;
  --green:   #2bff88;
  --white:   #ffffff;
  --muted:   rgba(255,255,255,0.55);
  --muted2:  rgba(255,255,255,0.35);
  --ft: 'Orbitron', sans-serif;
  --fm: 'Share Tech Mono', monospace;
  --fb: 'Inter', sans-serif;
  --maxw: 1040px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--dark);
  color: var(--white);
  font-family: var(--fb);
  line-height: 1.6;
  min-height: 100%;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--yellow); color: #000; }
ul { list-style: none; }
button { font-family: inherit; }

/* subtle static vignette + scanline, no motion */
body::before {
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(ellipse 90% 60% at 50% 0%, rgba(0,240,255,0.05), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(rgba(0,0,0,0.08) 50%, rgba(255,255,255,0.02) 50%);
  background-size: 4px 4px;
  pointer-events: none;
  z-index: 9500;
  opacity: 0.5;
}

/* ── NAV ── */
.nav {
  position: sticky; top: 0; z-index: 500;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: rgba(3,3,3,0.85);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(252,238,10,0.18);
  flex-wrap: wrap; gap: 0.5rem;
}
.nav::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--yellow), transparent);
  box-shadow: 0 0 8px var(--yellow);
}
.nav-left { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nav-hub {
  font-family: var(--fm); font-size: 0.62rem; letter-spacing: 0.08em;
  color: var(--muted); border: 1px solid var(--border); border-radius: 3px;
  padding: 0.3rem 0.6rem; transition: color 0.2s, border-color 0.2s;
}
.nav-hub:hover { color: var(--cyan); border-color: rgba(0,240,255,0.4); }
.nav-logo {
  font-family: var(--ft); font-size: 0.85rem; font-weight: 700; letter-spacing: 0.25em;
  color: var(--yellow); text-shadow: 0 0 10px rgba(252,238,10,0.6);
}
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-progress { font-family: var(--fm); font-size: 0.62rem; color: var(--cyan); letter-spacing: 0.05em; }
.sidebar-toggle {
  display: none; background: transparent; border: 1px solid var(--border); color: var(--muted);
  font-family: var(--fm); font-size: 0.65rem; letter-spacing: 0.08em; padding: 0.4rem 0.7rem;
  border-radius: 3px; cursor: pointer;
}

/* ── SIDEBAR LAYOUT ── */
.layout { display: flex; align-items: flex-start; max-width: 1400px; margin: 0 auto; }
.sidebar {
  width: 280px; flex-shrink: 0; position: sticky; top: 57px;
  height: calc(100vh - 57px); overflow-y: auto;
  border-right: 1px solid var(--border); padding: 1.25rem 0.5rem 2rem;
  z-index: 50;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.sd-domain { margin-bottom: 0.25rem; }
.sd-domain-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  width: 100%; background: none; border: none; color: var(--white); text-align: left;
  padding: 0.65rem 0.75rem; cursor: pointer; border-radius: 3px; font-family: var(--fb); font-size: 0.85rem; font-weight: 600;
}
.sd-domain-btn:hover { background: var(--panel2); }
.sd-domain-btn .sd-caret { font-family: var(--fm); color: var(--cyan); transition: transform 0.15s; font-size: 0.7rem; }
.sd-domain.open .sd-caret { transform: rotate(90deg); }
.sd-domain-tag { font-family: var(--fm); font-size: 0.58rem; color: var(--muted2); letter-spacing: 0.06em; display: block; }
.sd-sections { display: none; padding-left: 0.5rem; border-left: 1px solid var(--border); margin-left: 0.9rem; }
.sd-domain.open .sd-sections { display: block; }
.sd-section-link {
  display: block; padding: 0.5rem 0.75rem; font-family: var(--fm); font-size: 0.7rem; color: var(--muted);
  border-radius: 3px; letter-spacing: 0.02em; line-height: 1.4;
}
.sd-section-link:hover { color: var(--cyan); background: var(--panel2); }
.sd-section-link.active { color: var(--yellow); background: rgba(252,238,10,0.06); }
.sd-domain-quiz-link { display: block; padding: 0.5rem 0.75rem; font-family: var(--fm); font-size: 0.65rem; color: var(--muted2); }
.sd-domain-quiz-link:hover { color: var(--yellow); }

@media (max-width: 860px) {
  .sidebar-toggle { display: inline-block; }
  .sidebar {
    position: fixed; top: 57px; left: 0; bottom: 0; width: 82vw; max-width: 320px;
    background: var(--dark); transform: translateX(-100%); transition: transform 0.2s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .layout { position: relative; }
}

/* ── LAYOUT ── */
main { max-width: var(--maxw); margin: 0 auto; padding: 2.5rem 1.5rem 6rem; position: relative; z-index: 1; min-width: 0; flex: 1; }
.crumbs { font-family: var(--fm); font-size: 0.7rem; color: var(--muted2); margin-bottom: 1.5rem; }
.crumbs a:hover { color: var(--cyan); }

h1.page-title {
  font-family: var(--ft); font-weight: 900; letter-spacing: 0.04em;
  font-size: clamp(1.6rem, 4vw, 2.6rem); margin-bottom: 0.5rem;
  text-shadow: 0 0 20px rgba(252,238,10,0.25);
}
.page-sub {
  font-family: var(--fm); font-size: 0.78rem; color: var(--cyan);
  letter-spacing: 0.08em; margin-bottom: 2rem; opacity: 0.8;
}

/* ── HOME HERO ── */
.hero {
  text-align: center; padding: 3rem 1rem 2.5rem; border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}
.hero h1 {
  font-family: var(--ft); font-weight: 900; letter-spacing: 0.08em;
  font-size: clamp(2rem, 7vw, 4rem);
  text-shadow: 2px 0 #00ffff, -2px 0 #ff00ff, 0 0 30px rgba(252,238,10,0.4);
  margin-bottom: 0.75rem;
}
.hero p { font-family: var(--fm); font-size: 0.85rem; color: var(--muted); max-width: 520px; margin: 0 auto; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 1.75rem; flex-wrap: wrap; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--fm); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.8rem 1.4rem; border-radius: 2px; cursor: pointer; border: none;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: scale(0.98); }
.btn-yellow { color: var(--yellow); background: rgba(252,238,10,0.06);
  box-shadow: 0 0 0 1px rgba(252,238,10,0.5), 0 0 14px rgba(252,238,10,0.2); }
.btn-yellow:hover { filter: brightness(1.2); }
.btn-cyan { color: var(--cyan); background: rgba(0,240,255,0.05);
  box-shadow: 0 0 0 1px rgba(0,240,255,0.4), 0 0 14px rgba(0,240,255,0.15); }
.btn-cyan:hover { filter: brightness(1.2); }
.btn-ghost { color: var(--white); background: var(--panel); box-shadow: 0 0 0 1px var(--border); }
.btn-ghost:hover { box-shadow: 0 0 0 1px var(--muted2); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── CARDS / GRID ── */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 4px;
  padding: 1.25rem; position: relative; transition: border-color 0.2s, transform 0.15s;
  display: block;
}
.card:hover { border-color: rgba(0,240,255,0.35); transform: translateY(-2px); }
.card-tag { font-family: var(--fm); font-size: 0.6rem; color: var(--cyan); letter-spacing: 0.1em; opacity: 0.75; }
.card-title { font-family: var(--ft); font-size: 1rem; font-weight: 700; margin: 0.4rem 0 0.5rem; letter-spacing: 0.02em; }
.card-meta { font-family: var(--fm); font-size: 0.68rem; color: var(--muted); }
.progress-bar { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; margin-top: 0.75rem; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--yellow)); }

/* ── LESSON CONTENT ── */
.lesson { border: 1px solid var(--border); background: var(--panel); border-radius: 4px; padding: 1.75rem; margin-bottom: 1.5rem; }
.lesson h3 {
  font-family: var(--ft); font-size: 1.05rem; color: var(--yellow); letter-spacing: 0.02em;
  margin-bottom: 1rem; text-shadow: 0 0 12px rgba(252,238,10,0.3);
}
.video-embed { position: relative; width: 100%; padding-top: 56.25%; margin-bottom: 1.25rem; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px var(--border); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.no-video { font-family: var(--fm); font-size: 0.68rem; color: var(--muted2); margin-bottom: 1rem; }
.block { margin-bottom: 1.1rem; }
.block h4 { font-family: var(--fb); font-weight: 600; color: var(--cyan); font-size: 0.95rem; margin-bottom: 0.5rem; }
.block ul { padding-left: 1.1rem; }
.block > ul > li { margin-bottom: 0.45rem; position: relative; padding-left: 0.9rem; }
.block > ul > li::before { content: '›'; position: absolute; left: 0; color: var(--yellow); }
.block ul ul { margin-top: 0.35rem; padding-left: 1rem; }
.block ul ul li { font-size: 0.92rem; color: var(--muted); margin-bottom: 0.3rem; padding-left: 0.8rem; position: relative; }
.block ul ul li::before { content: '·'; position: absolute; left: 0; color: var(--muted2); }

/* ── QUIZ ── */
.quiz-cta { text-align: center; padding: 1.5rem; border: 1px dashed var(--border); border-radius: 4px; margin-top: 1rem; }
.quiz-q { margin-bottom: 1.75rem; }
.quiz-q-text { font-weight: 600; margin-bottom: 0.75rem; }
.quiz-choice {
  display: block; width: 100%; text-align: left; background: var(--panel2);
  border: 1px solid var(--border); color: var(--white); padding: 0.7rem 1rem;
  border-radius: 3px; margin-bottom: 0.5rem; cursor: pointer; font-family: var(--fb); font-size: 0.92rem;
  transition: border-color 0.15s, background 0.15s;
}
.quiz-choice:hover { border-color: rgba(0,240,255,0.4); }
.quiz-choice.selected { border-color: var(--cyan); background: rgba(0,240,255,0.08); }
.quiz-choice.correct { border-color: var(--green); background: rgba(43,255,136,0.1); }
.quiz-choice.incorrect { border-color: var(--magenta); background: rgba(255,0,60,0.1); }
.quiz-explain { font-family: var(--fm); font-size: 0.72rem; color: var(--muted); margin-top: 0.6rem; padding-left: 0.2rem; }
.quiz-score { text-align: center; padding: 2rem; }
.quiz-score .num { font-family: var(--ft); font-size: 3rem; color: var(--yellow); text-shadow: 0 0 20px rgba(252,238,10,0.4); }

/* ── EXAM ── */
.exam-meta { display: flex; gap: 1.5rem; flex-wrap: wrap; font-family: var(--fm); font-size: 0.72rem; color: var(--muted); margin-bottom: 1.5rem; }
.exam-progress-track { position: sticky; top: 60px; z-index: 100; background: var(--dark); padding: 0.75rem 0; }
.pb-instructions { font-size: 0.92rem; color: var(--muted); margin-bottom: 1.25rem; padding: 1rem; background: var(--panel2); border-radius: 3px; border: 1px solid var(--border); }
.pb-tiles { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.5rem; padding: 1rem; background: var(--panel2); border-radius: 3px; min-height: 3rem; }
.pb-tile {
  font-family: var(--fm); font-size: 0.78rem; padding: 0.5rem 0.9rem; border-radius: 3px;
  background: rgba(0,240,255,0.08); border: 1px solid rgba(0,240,255,0.35); color: var(--cyan);
  cursor: grab; user-select: none; transition: transform 0.1s, opacity 0.1s;
}
.pb-tile:hover { filter: brightness(1.2); }
.pb-tile.placed { opacity: 0.25; cursor: default; }
.pb-tile.selected { outline: 2px solid var(--yellow); }
.pb-target { border: 1px solid var(--border); border-radius: 4px; padding: 1rem; margin-bottom: 0.85rem; background: var(--panel); }
.pb-target-label { font-size: 0.92rem; margin-bottom: 0.6rem; font-weight: 600; }
.pb-slots { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pb-slot {
  min-width: 110px; min-height: 2.4rem; border: 1.5px dashed var(--muted2); border-radius: 3px;
  display: flex; align-items: center; justify-content: center; font-family: var(--fm); font-size: 0.76rem;
  color: var(--muted2); padding: 0.3rem 0.6rem; cursor: pointer; text-align: center;
}
.pb-slot.filled { border-style: solid; border-color: var(--cyan); color: var(--white); background: rgba(0,240,255,0.06); }
.pb-slot.correct { border-color: var(--green); background: rgba(43,255,136,0.12); color: var(--white); }
.pb-slot.incorrect { border-color: var(--magenta); background: rgba(255,0,60,0.12); color: var(--white); }
.pb-explain { font-family: var(--fm); font-size: 0.7rem; color: var(--muted); margin-top: 0.6rem; }
.pb-order-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.exam-mc-nav { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1.5rem; }
.exam-mc-nav button {
  width: 2.1rem; height: 2.1rem; font-family: var(--fm); font-size: 0.68rem;
  background: var(--panel2); border: 1px solid var(--border); color: var(--muted); border-radius: 3px; cursor: pointer;
}
.exam-mc-nav button.answered { border-color: rgba(0,240,255,0.4); color: var(--cyan); }
.exam-mc-nav button.current { border-color: var(--yellow); color: var(--yellow); }

/* ── FOOTER ── */
footer {
  padding: 1.5rem; text-align: center; border-top: 1px solid rgba(252,238,10,0.08);
  font-family: var(--fm); font-size: 0.6rem; color: rgba(255,255,255,0.25); letter-spacing: 0.08em;
}

/* ── RESPONSIVE ── */
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .pb-slot { min-width: 90px; }
}
