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

:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --surface2: #1e1e1e;
  --border: rgba(255,255,255,0.08);
  --border-mid: rgba(255,255,255,0.14);
  --text: #f0f0f0;
  --text-muted: #888;
  --text-dim: #555;
  --accent: #7c6ee0;
  --accent-soft: rgba(124,110,224,0.12);
  --mono: 'Courier New', monospace;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 100;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--accent-soft);
  border: 0.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.logo-text { font-size: 15px; font-weight: 600; letter-spacing: -0.3px; color: var(--text); }
.logo-text span { color: var(--accent); }
.header-meta { font-size: 12px; color: var(--text-dim); font-family: var(--mono); }

/* ── Config bar ── */
.config-bar {
  padding: 14px 32px;
  border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface);
}
.config-label { font-size: 12px; color: var(--text-muted); font-family: var(--mono); white-space: nowrap; }
.config-bar input[type="text"] {
  flex: 1; min-width: 240px;
  background: var(--surface2); color: var(--text);
  border: 0.5px solid var(--border-mid);
  border-radius: 6px; padding: 7px 12px; font-size: 13px;
  font-family: var(--mono); outline: none;
  transition: border-color 0.15s;
}
.config-bar input[type="text"]:focus { border-color: var(--accent); }
.config-bar input[type="number"] {
  width: 72px;
  background: var(--surface2); color: var(--text);
  border: 0.5px solid var(--border-mid);
  border-radius: 6px; padding: 7px 10px; font-size: 13px;
  font-family: var(--mono); outline: none; text-align: center;
  transition: border-color 0.15s;
}
.config-bar input[type="number"]:focus { border-color: var(--accent); }
.btn-load {
  padding: 7px 18px; font-size: 13px; font-weight: 500;
  background: var(--accent); color: #fff;
  border: none; border-radius: 6px; cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-load:hover { opacity: 0.88; }
.btn-load:active { transform: scale(0.97); }

/* ── Main layout ── */
main { flex: 1; display: flex; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: 200px; min-width: 200px;
  border-right: 0.5px solid var(--border);
  background: var(--surface);
  padding: 16px 0;
  overflow-y: auto;
}
.sidebar-title {
  font-size: 11px; color: var(--text-dim);
  font-family: var(--mono); letter-spacing: 0.08em;
  padding: 0 16px 10px;
  text-transform: uppercase;
}
.file-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; cursor: pointer; font-size: 13px;
  color: var(--text-muted); transition: background 0.1s, color 0.1s;
  border-left: 2px solid transparent;
}
.file-item:hover { background: var(--surface2); color: var(--text); }
.file-item.active {
  background: var(--accent-soft); color: var(--text);
  border-left-color: var(--accent);
}
.file-num { font-family: var(--mono); font-size: 11px; color: var(--text-dim); min-width: 16px; }
.file-item.active .file-num { color: var(--accent); }

/* ── Slide area ── */
.slide-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.slide-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface);
}
.slide-filename { font-family: var(--mono); font-size: 13px; color: var(--text-muted); }
.slide-counter { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

.slide-body {
  flex: 1; overflow-y: auto; padding: 36px 48px;
  background: var(--bg);
}
.slide-body::-webkit-scrollbar { width: 4px; }
.slide-body::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

/* ── Markdown ── */
.md h1 { font-size: 28px; font-weight: 700; margin-bottom: 24px; letter-spacing: -0.5px; line-height: 1.2; }
.md h2 { font-size: 20px; font-weight: 600; margin: 32px 0 12px; border-bottom: 0.5px solid var(--border); padding-bottom: 8px; }
.md h3 { font-size: 16px; font-weight: 600; margin: 20px 0 8px; color: var(--text-muted); }
.md p { font-size: 15px; line-height: 1.8; color: #ccc; margin-bottom: 14px; }
.md ul, .md ol { padding-left: 22px; margin-bottom: 14px; }
.md li { font-size: 15px; line-height: 1.8; color: #ccc; margin-bottom: 4px; }
.md code {
  font-family: var(--mono); font-size: 13px;
  background: var(--surface2); border: 0.5px solid var(--border-mid);
  border-radius: 4px; padding: 2px 6px; color: #a78bfa;
}
.md pre {
  background: var(--surface); border: 0.5px solid var(--border-mid);
  border-radius: 8px; padding: 18px 20px; overflow-x: auto; margin-bottom: 16px;
}
.md pre code { background: none; border: none; padding: 0; font-size: 13px; color: #c4b5fd; }
.md blockquote {
  border-left: 2px solid var(--accent);
  padding: 10px 14px; margin-bottom: 14px;
  color: var(--text-muted); font-size: 14px;
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
}
.md table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 14px; }
.md th, .md td { border: 0.5px solid var(--border-mid); padding: 8px 12px; text-align: left; }
.md th { background: var(--surface); font-weight: 600; color: var(--text-muted); }
.md tr:hover { background: var(--surface2); }
.md hr { border: none; border-top: 0.5px solid var(--border); margin: 24px 0; }
.md a { color: var(--accent); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md strong { font-weight: 600; color: var(--text); }

/* ── Nav bar ── */
.nav-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  border-top: 0.5px solid var(--border);
  background: var(--surface);
}
.nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 20px; font-size: 13px; font-weight: 500;
  background: var(--surface2); color: var(--text);
  border: 0.5px solid var(--border-mid); border-radius: 6px;
  cursor: pointer; transition: background 0.15s, opacity 0.15s;
}
.nav-btn:hover:not(:disabled) { background: var(--border); }
.nav-btn:disabled { opacity: 0.3; cursor: default; }

.dots { display: flex; gap: 8px; align-items: center; }
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border-mid); cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.dot:hover { background: var(--text-muted); }
.dot.active { background: var(--accent); transform: scale(1.3); }

/* ── States ── */
.state-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%; gap: 14px;
  color: var(--text-dim); font-size: 14px;
}
.state-empty .icon { font-size: 40px; opacity: 0.4; }
.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border-mid);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-bar {
  padding: 10px 28px; font-size: 13px;
  background: rgba(220,50,50,0.1); color: #f87171;
  border-top: 0.5px solid rgba(220,50,50,0.2);
  display: none;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .sidebar { display: none; }
  .slide-body { padding: 24px 20px; }
  header { padding: 14px 16px; }
  .config-bar { padding: 12px 16px; }
}
