/* ── 1. Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }

/* ── 2. Variablen ── */
:root {
  --bg:      #0f1117;
  --bg2:     #161b27;
  --bg3:     #1e2535;
  --bg-code: #0a0e1a;
  --border:  rgba(255,255,255,0.2);
  --border2: rgba(255,255,255,0.13);
  --text:    #e8eaf0;
  --text2:   #8b92a8;
  --text3:   #4a5177;
  --accent:  #677e9a;
  --accent-bg:     rgba(79,158,255,0.07);
  --accent-border: rgba(79,158,255,0.2);
  --accent-subtle: rgba(79,158,255,0.05);
  --green:   #34d399;
  --amber:   #fbbf24;
  --amber-border: rgba(251,191,36,0.25);
  --amber-subtle: rgba(251,191,36,0.06);
  --red:     #f87171;
  --font-sans: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --sidebar-w: 272px;
  --header-h:  80px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 10px;
}

/* ── 3. Light Mode ── */
body.light {
  --bg:      #ffffff;
  --bg2:     #f5f6f8;
  --bg3:     #ebedf0;
  --bg-code: #f0f2f5;
  --border:  rgba(0,0,0,0.2);
  --border2: rgba(0,0,0,0.15);
  --text:    #3f4148;
  --text2:   #4a5068;
  --text3:   #9098b0;
  --accent:  #3d4e71;
  --accent-bg:     rgba(37,99,235,0.07);
  --accent-border: rgba(37,99,235,0.2);
  --accent-subtle: rgba(37,99,235,0.05);
  --green:   #059669;
  --amber:   #d97706;
  --amber-border: rgba(217,119,6,0.25);
  --amber-subtle: rgba(217,119,6,0.06);
  --red:     #dc2626;
}

/* ── 4. Body ── */
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: 15px; line-height: 1.7;
}

/* ── 5. Navbar ── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h); background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1.5rem; gap: 2rem; z-index: 100;
}
.navbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.logo-text { font-family: var(--font-mono); font-size: 30px; font-weight: 500; color: var(--accent); }
.logo { display: flex; position: relative; padding-top: 1em;}
.nav-links { display: flex; list-style: none; gap: 1.5rem; margin: 0; padding: 0; }
.nav-links a { font-size: 18px; color: var(--text2); transition: color 0.15s; }
.nav-links a:hover  { color: var(--text); }
.nav-links a.active { color: var(--accent); font-weight: 900; }

/* ── 6. Theme Toggle ── */
.theme-btn {
  background: none; border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 4px 8px;
  cursor: pointer; font-size: 14px; transition: border-color 0.15s;
}
.theme-btn:hover { border-color: var(--accent); }

/* ── 7. Hamburger & Mobile ── */
.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text2); border-radius: 2px; transition: all 0.2s; }
.mobile-menu { display: none; position: fixed; top: var(--header-h); left: 0; right: 0; background: var(--bg2); border-bottom: 1px solid var(--border); z-index: 99; padding: 1rem 1.5rem; }
.mobile-menu.open { display: block; }
.mobile-menu ul { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.mobile-menu a { font-size: 15px; color: var(--text2); transition: color 0.15s; }
.mobile-menu a.active, .mobile-menu a:hover { color: var(--accent); }

/* ── 8. Layout ── */
.site-main { padding-top: var(--header-h); }
.tutorial-layout { display: flex; min-height: calc(100vh - var(--header-h)); }

/* ── 9. Sidebar ── */
.sidebar { width: var(--sidebar-w); flex-shrink: 0; position: fixed; top: var(--header-h); bottom: 0; overflow-y: auto; border-right: 1px solid var(--border); background: var(--bg); }
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.sidebar-inner { padding: 1.5rem 0; }
.sidebar-chapter-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 1.25rem; font-size: 11px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text3); background: none; border: none; cursor: pointer; text-align: left; transition: color 0.15s; }
.sidebar-chapter-btn:hover { color: var(--text2); }
.ch-num { font-family: var(--font-mono); font-size: 10px; background: var(--bg3); border-radius: var(--radius-sm); padding: 1px 5px; }
.ch-arrow { margin-left: auto; transition: transform 0.2s; }
.sidebar-chapter-btn.open .ch-arrow { transform: rotate(90deg); }
.sidebar-sub { list-style: none; overflow: hidden; max-height: 0; transition: max-height 0.25s ease; }
.sidebar-sub.open { max-height: 800px; }
.sidebar-sub li a { display: flex; align-items: center; gap: 8px; padding: 5px 1.25rem 5px 2rem; font-size: 13px; color: var(--text2); border-left: 2px solid transparent; transition: all 0.15s; }
.sidebar-sub li a:hover { color: var(--text); background: var(--bg2); }
.sidebar-sub li a.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-bg); }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border2); flex-shrink: 0; }
.sidebar-sub li a.active .dot { background: var(--accent); }

/* ── 10. Tutorial Content ── */
.tutorial-content { margin-left: var(--sidebar-w); flex: 1; max-width: 760px; padding: 3rem 3rem 6rem; }
@keyframes fadein { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.content-fade { animation: fadein 0.3s ease both; }

/* ── 11. Typografie ── */
.chapter-label { font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.5rem; }
h1 { font-size: 2rem; font-weight: 500; line-height: 1.3; margin-bottom: 0.75rem; }
h2 { font-size: 1.3rem; font-weight: 500; margin: 0.5rem 0 0.75rem; }
.lead { font-size: 16px; color: var(--text2); margin-bottom: 2rem; }
.text-block { margin-bottom: 0.5rem; overflow: hidden; }
.text-block p { color: var(--text2); margin-bottom: 0.85rem; }
.text-block a { color: var(--accent); }
.text-block a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font-size: 1.05em; font-weight: 500; }
.text-block a:hover { opacity: 0.8; }
.text-block ul { padding-left: 1.5rem; margin: 0.5rem 0; }
.text-block ul ul { padding-left: 1.5rem; margin: 0; }
.text-block li { margin: 0.25rem 0; color: var(--text2); }
code { font-family: var(--font-mono); font-size: 12.5px; background: var(--bg3); color: var(--green); padding: 2px 6px; border-radius: var(--radius-sm); }

/* ── 12. Code Block (normaler Python/Code) ── */
.code-block { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); margin: 1.5rem 0; overflow: hidden; }
.code-header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg3); }
.code-dots { display: flex; gap: 5px; }
.code-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--border2); }
.code-filename { font-family: var(--font-mono); font-size: 11px; color: var(--text3); margin-left: 4px; }
.code-lang { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px 6px; }
.copy-btn { font-family: var(--font-mono); font-size: 11px; color: var(--text3); background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px 8px; cursor: pointer; transition: all 0.15s; margin-left: 6px; }
.copy-btn:hover { color: var(--text); border-color: var(--border2); }
pre { padding: 1.25rem 1.5rem; font-family: var(--font-mono); font-size: 13px; line-height: 1.8; overflow-x: auto; color: var(--text); }
pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

/* ── 12b. Marimo Code Block (CodeMirror readonly) ── */
.marimo-code-block { border: 1px solid #e2e4ea; border-radius: var(--radius-lg); margin: 1.5rem 0; overflow: hidden; background: #ffffff; }
body:not(.light) .marimo-code-block { border-color: var(--border2); background: var(--bg2); }
.code-footer { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-top: 1px solid #e2e4ea; background: #ffffff; }
body:not(.light) .code-footer { border-top-color: var(--border); background: var(--bg2); }
.code-badge { margin-left: auto; display: flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 11px; color: var(--text3); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 2px 7px; }
.code-badge-icon { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border: 1px solid var(--border2); border-radius: 3px; font-size: 9px; font-family: var(--font-mono); color: var(--text3); }

/* CodeMirror Marimo-Light Theme */
.cm-s-marimo-light.CodeMirror { font-family: var(--font-mono); font-size: 13px; line-height: 1.8; background: #ffffff; color: #1a1d27; border: none; height: auto; }
body:not(.light) .cm-s-marimo-light.CodeMirror { background: var(--bg2); color: var(--text); }
.cm-s-marimo-light .CodeMirror-linenumber { color: #c0c4d0; font-size: 12px; }
.cm-s-marimo-light .CodeMirror-gutters { background: #ffffff; border-right: 1px solid #f0f0f5; }
body:not(.light) .cm-s-marimo-light .CodeMirror-gutters { background: var(--bg2); border-right-color: var(--border); }
body:not(.light) .cm-s-marimo-light .CodeMirror-linenumber { color: var(--text3); }
.cm-s-marimo-light .cm-keyword  { color: #7c3aed; font-weight: 500; }
.cm-s-marimo-light .cm-def     { color: #2563eb; }
.cm-s-marimo-light .cm-string  { color: #059669; }
.cm-s-marimo-light .cm-number  { color: #d97706; }
.cm-s-marimo-light .cm-comment { color: #9ca3af; font-style: italic; }
.cm-s-marimo-light .cm-builtin { color: #7c3aed; }
.cm-s-marimo-light .cm-operator { color: #4b5563; }
.cm-s-marimo-light .cm-variable { color: var(--text); }
.cm-s-marimo-light .cm-property { color: #2563eb; }
.cm-s-marimo-light .CodeMirror-cursor { display: none; }
.cm-s-marimo-light .CodeMirror-scroll { min-height: 0; }
body:not(.light) .cm-s-marimo-light .cm-keyword  { color: #c084fc; }
body:not(.light) .cm-s-marimo-light .cm-def     { color: #7dd3fc; }
body:not(.light) .cm-s-marimo-light .cm-string  { color: #86efac; }
body:not(.light) .cm-s-marimo-light .cm-number  { color: var(--amber); }
body:not(.light) .cm-s-marimo-light .cm-comment { color: var(--text3); }
body:not(.light) .cm-s-marimo-light .cm-builtin { color: #c084fc; }
body:not(.light) .cm-s-marimo-light .cm-property { color: #7dd3fc; }

/* ── 13. Output Block ── */
.output-block { background: var(--bg-code); border: 1px solid var(--border); border-radius: var(--radius-md); margin: -0.75rem 0 1.5rem; overflow: hidden; }
.output-header { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-bottom: 1px solid var(--border); }
.output-header span { font-family: var(--font-mono); font-size: 10px; color: var(--text3); }
.output-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.output-pre { padding: 0.75rem 1.5rem; font-family: var(--font-mono); font-size: 13px; color: var(--green); line-height: 1.7; }

/* ── 14. Tip / Warning ── */
.tip-box { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--accent-border); background: var(--accent-subtle); border-radius: var(--radius-md); padding: 1rem 1.25rem; margin: 1.5rem 0; }
.tip-box.warn { border-color: var(--amber-border); background: var(--amber-subtle); }
.tip-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.tip-box p { color: var(--text2); margin: 0; font-size: 14px; }
.tip-box a { color: var(--accent); }
.tip-box a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font-size: 1.05em; font-weight: 500; }
.tip-box a:hover { opacity: 0.8; }

/* ── 15. Divider ── */
.divider { height: 1px; background: var(--border); margin: 2.5rem 0; border: none; }

/* ── 16. Page Navigation ── */
.page-nav { display: flex; gap: 1rem; margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.page-btn { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 1rem 1.25rem; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); text-decoration: none; transition: all 0.15s; }
.page-btn:hover { border-color: var(--border2); background: var(--bg3); }
.page-btn.next { text-align: right; }
.page-btn-label { font-size: 11px; color: var(--text3); font-family: var(--font-mono); }
.page-btn-title { font-size: 14px; color: var(--text); font-weight: 500; }

/* ── 17. Pyodide Editor ── */
.pyodide-island { border: 1px solid var(--border2); border-radius: var(--radius-lg); margin: 1.5rem 0; overflow: hidden; }
.pyodide-island .marimo-header { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--accent-border); background: var(--accent-subtle); font-size: 11px; color: var(--accent); font-family: var(--font-mono); }
.pyodide-island-header { display: flex; justify-content: flex-end; padding: 4px 0 8px; }
.run-all-btn { font-family: var(--font-mono); font-size: 11px; color: var(--accent); background: var(--accent-bg); border: 1px solid var(--accent-border); border-radius: var(--radius-sm); padding: 4px 12px; cursor: pointer; transition: all 0.15s; }
.run-all-btn:hover { background: var(--accent-border); }
.pyodide-cell { border-bottom: 1px solid var(--border); }
.pyodide-cell:last-child { border-bottom: none; }
.pyodide-cell .CodeMirror { font-family: var(--font-mono); font-size: 13px; line-height: 1.7; height: auto; border-radius: 0; }
.pyodide-cell .CodeMirror-scroll { min-height: 60px; }
.cell-toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--bg3); border-top: 1px solid var(--border); }
.run-btn { font-family: var(--font-mono); font-size: 11px; color: var(--green); background: var(--accent-bg); border: 1px solid var(--accent-border); border-radius: var(--radius-sm); padding: 3px 10px; cursor: pointer; transition: all 0.15s; }
.run-btn:hover { background: var(--accent-border); }
.run-btn:disabled { opacity: 0.5; cursor: wait; }
.cell-num { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-left: auto; }
.cell-output { padding: 0.75rem 1.25rem; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; background: var(--bg-code); }
.cell-output:empty { display: none; }
.cell-print  { color: var(--green); margin: 0; white-space: pre-wrap; }
.cell-result { color: var(--amber); margin: 0; white-space: pre-wrap; }
.cell-ok     { color: var(--text3); font-size: 12px; }
.cell-error  { color: var(--red); white-space: pre-wrap; }
.marimo-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── 18. Mobile ── */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
}

/* ── 19. Seiten ohne Sidebar (Home, About, Apps) ── */
.page-content { max-width: 1000px; margin: 0 auto; padding: 0.5rem clamp(2rem, 6vw, 5rem) 6rem; }
.page-hero { margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border); }
.page-hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.page-hero .lead { font-size: 18px; margin-bottom: 0.5rem; }
.btn-primary { display: inline-block; background: var(--accent); color: #fff; padding: 0.6rem 1.5rem; border-radius: var(--radius-md); font-size: 15px; font-weight: 500; transition: opacity 0.15s; }
.btn-primary:hover { opacity: 0.85; }

/* ── 20. Apps ── */
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-top: 0rem; }
.apps-card { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-top: 1rem; padding: 0; }
.apps-card li { list-style: none; }
.apps-card li a { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); font-size: 14px; font-weight: 500; transition: all 0.15s; }
.apps-card li a:hover { border-color: var(--accent); background: var(--bg3); transform: translateY(-2px); }
.apps-card li a::after { content: "➜"; font-size: 25px; color: var(--text3); margin-left: auto; padding-left: 1rem; transition: transform 0.15s; }
.apps-card li a:hover::after { transform: translateX(4px); }
@media (max-width: 640px) { .apps-grid, .apps-card { grid-template-columns: 1fr; } }

/* ── 21. Terminal Block ── */
.terminal-block { background: #1c1c1e; border: 1px solid #3a3a3c; border-radius: var(--radius-lg); margin: 1.5rem 0; overflow: hidden; }
.terminal-header { display: flex; align-items: center; gap: 6px; padding: 9px 14px; background: #2c2c2e; border-bottom: 1px solid #3a3a3c; }
.terminal-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.terminal-dot.red    { background: #ff5f57; }
.terminal-dot.yellow { background: #febc2e; }
.terminal-dot.green  { background: #28c840; }
.terminal-title { font-family: var(--font-mono); font-size: 11px; color: #cecccc; margin-left: 4px; flex: 1; }
.terminal-copy { color: #b5bba1; border-color: #bcb2b2; }
.terminal-copy:hover { color: #fcfcfc; border-color: #666; }
.terminal-pre { padding: 1rem 1.25rem; font-family: var(--font-mono); font-size: 13px; line-height: 1.8; color: #28c840; background: #1c1c1e; margin: 0; overflow-x: auto; }
.terminal-pre code { background: none; padding: 0; color: #d2dfd4; font-size: inherit; }

/* ── 22. Marimo Plus Buttons ── */
.marimo-cell-wrapper { display: flex; gap: 0; margin: 1.5rem 0; }
.marimo-plus-col { display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 6px 0; width: 28px; flex-shrink: 0; }
.marimo-plus-spacer { flex: 1; }
.marimo-cell-inner { flex: 1; min-width: 0; }
.marimo-cell-inner .marimo-code-block { margin: 0; }
.marimo-plus-bottom { display: flex; justify-content: flex-start; margin-top: 2px; }
.marimo-plus { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 1px solid var(--border2); border-radius: 50%; font-size: 14px; line-height: 1; color: var(--text3); cursor: default; user-select: none; flex-shrink: 0; }
body.light .marimo-plus { border-color: #d0d4e0; color: #9098b0; }

/* ── 23. Interaktive Zellen (Pyodide) ── */
.pyodide-island { margin: 1.5rem 0; }
.pyodide-cell-wrapper { display: flex; align-items: stretch; gap: 8px; margin-bottom: 8px; }
.pyodide-cell-wrapper .marimo-plus-col { justify-content: space-between; padding: 4px 0; }
.pyodide-cell { flex: 1; min-width: 0; border: 1px solid var(--border2); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg2); }
body.light .pyodide-cell { border-color: #e2e4ea; background: #ffffff; }
.pyodide-cell .CodeMirror { font-family: var(--font-mono); font-size: 13px; line-height: 1.7; height: auto; border-radius: 0; background: #ffffff; color: #1a1d27;}
.pyodide-cell .CodeMirror-scroll { min-height: 40px; }
.pyodide-cell .CodeMirror-cursor { display: block !important; border-left: 2px solid var(--text) !important; }
.cell-output { padding: 0.75rem 1.25rem; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; background: var(--bg-code); }
.cell-output:empty { display: none; }
.cell-print  { color: var(--green); margin: 0; white-space: pre-wrap; }
.cell-result { color: var(--amber); margin: 0; white-space: pre-wrap; }
.cell-ok     { color: var(--text3); font-size: 12px; }
.cell-error  { color: var(--red); white-space: pre-wrap; }
.cell-right-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 4px; gap: 6px; width: 32px; flex-shrink: 0; }
.run-circle-btn { width: 28px; height: 25px; border-radius: 50%; background: #fbf7d1; border: 1px solid #9098b0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.3s; flex-shrink: 0; outline: none; }
.run-circle-btn:hover { background: #f1f0df; border-color: #4b5563; }
.run-circle-btn.done { background: #ffffff; border-color: #9098b0; }
.run-circle-btn:disabled { opacity: 0.6; cursor: wait; }

/* ── Logo Hintergrund ── */
.logo-bg {
  position: fixed;
  inset: 0;
  background-image: url("/static/images/logo_background.svg");
  background-repeat: no-repeat;
  background-position: right bottom;
  background-size: 30%;
  pointer-events: none;
  z-index: -1;
}

/* ── Formatierung Tabellen ── */
table {border-collapse: collapse; width: 100%; margin-bottom: 1.5rem;}
table th {text-align: left;}
th, td {border: 1px solid #ddd;padding: 8px;}

/* ── Farbe Trennstrich ── */
hr {color: var(--border)}

