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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --slide-bg: #1c2128;
  --header-h: 48px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; }

#app { display: flex; flex-direction: column; height: 100vh; }

header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}
header h1 { font-size: 16px; font-weight: 600; white-space: nowrap; }
.toolbar { display: flex; align-items: center; gap: 8px; }
.toolbar button {
  background: var(--border);
  color: var(--text);
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background .15s;
}
.toolbar button:hover { background: var(--accent); color: #fff; }
#slide-counter { font-size: 13px; color: var(--text-muted); min-width: 80px; text-align: center; }

main { flex: 1; display: flex; min-height: 0; }

#editor-pane { width: 50%; border-right: 1px solid var(--border); display: flex; }
#editor {
  width: 100%; height: 100%; resize: none; border: none; outline: none;
  background: var(--bg); color: var(--text);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 14px; line-height: 1.6; padding: 20px; tab-size: 2;
}

#preview-pane { width: 50%; display: flex; align-items: center; justify-content: center; padding: 24px; background: #0a0e13; overflow: hidden; }
#slide-container {
  width: 100%; max-width: 800px; aspect-ratio: 16/9;
  background: var(--slide-bg); border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  overflow: auto; padding: 40px 48px;
  display: flex; align-items: flex-start;
}
#slide-content { width: 100%; }

/* Slide typography */
#slide-content h1, #present-slide h1 { font-size: 2em; margin-bottom: .5em; color: var(--accent); }
#slide-content h2, #present-slide h2 { font-size: 1.6em; margin-bottom: .4em; color: var(--accent); }
#slide-content h3, #present-slide h3 { font-size: 1.3em; margin-bottom: .3em; }
#slide-content p, #present-slide p { margin-bottom: .6em; line-height: 1.7; }
#slide-content ul, #slide-content ol, #present-slide ul, #present-slide ol { margin: .4em 0 .8em 1.5em; }
#slide-content li, #present-slide li { margin-bottom: .3em; line-height: 1.6; }
#slide-content code, #present-slide code { background: rgba(110,118,129,.2); padding: 2px 6px; border-radius: 4px; font-size: .9em; }
#slide-content pre, #present-slide pre { background: #0d1117; padding: 16px; border-radius: 8px; overflow-x: auto; margin: .8em 0; }
#slide-content pre code, #present-slide pre code { background: none; padding: 0; }
#slide-content img, #present-slide img { max-width: 100%; border-radius: 6px; }
#slide-content blockquote, #present-slide blockquote { border-left: 3px solid var(--accent); padding-left: 16px; color: var(--text-muted); margin: .6em 0; }
#slide-content a, #present-slide a { color: var(--accent); }
#slide-content table, #present-slide table { border-collapse: collapse; width: 100%; margin: .8em 0; }
#slide-content th, #slide-content td, #present-slide th, #present-slide td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
#slide-content th, #present-slide th { background: rgba(110,118,129,.15); }

/* Presentation overlay */
#present-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: #0d1117; display: flex; align-items: center; justify-content: center;
}
#present-overlay.hidden { display: none; }
#present-slide {
  width: 90vw; max-width: 1200px; aspect-ratio: 16/9;
  background: var(--slide-bg); border-radius: 12px;
  padding: 60px 72px; overflow: auto;
  font-size: 1.4em; line-height: 1.6;
  box-shadow: 0 12px 48px rgba(0,0,0,.5);
}
#present-counter { position: fixed; bottom: 20px; right: 24px; color: var(--text-muted); font-size: 14px; }
#present-exit {
  position: fixed; top: 16px; right: 20px;
  background: rgba(255,255,255,.1); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 50%; font-size: 18px;
  cursor: pointer; transition: background .15s;
}
#present-exit:hover { background: rgba(255,255,255,.2); }

/* Responsive */
@media (max-width: 768px) {
  main { flex-direction: column; }
  #editor-pane, #preview-pane { width: 100%; height: 50%; }
  #editor-pane { border-right: none; border-bottom: 1px solid var(--border); }
}
