:root {
  --border: rgba(255,255,255,0.12);
  --bg: #0f1115;
  --bg2: #151a22;
  --bg3: #1b2230;
  --text: #f1f3f5;
  --muted: rgba(255,255,255,0.65);
  --accent: #8ab4f8;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #151a22, #0f1115);
  position: sticky;
  top: 0;
  z-index: 50;
}

.burger {
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.burger:hover {
  background: rgba(255,255,255,0.08);
}

.topbarTitleLink {
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 10px;
}

.topbarTitleLink:hover {
  background: rgba(255,255,255,0.08);
}

.topbarTitleLink:visited {
  color: var(--text);
}

/* ---------- Layout ---------- */

.layout {
  display: flex;
  min-height: calc(100vh - 52px);
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: 320px;
  background: linear-gradient(180deg, #151a22, #0f1115);
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  overflow-y: auto;
}

/* ---------- Tree ---------- */

.tree {
  padding-left: 14px;
  margin: 4px 0 8px 0;
}

.node {
  list-style: none;
  margin: 2px 0;
}

/* ---------- Details Summary and Arrow ---------- */

.topFolder > summary,
.tree details > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.topFolder > summary::-webkit-details-marker,
.tree details > summary::-webkit-details-marker {
  display: none;
}

/* custom arrow */
.topFolder > summary::before,
.tree details > summary::before {
  content: "▸";
  width: 18px;
  display: inline-flex;
  justify-content: center;
  opacity: 0.85;
  transform: translateY(1px);
}

/* Pfeil auf offen umstellen */
.topFolder[open] > summary::before,
.topFolder details[open] > summary::before,
.tree details[open] > summary::before {
  content: "▾";
}

/* ---------- Folder ---------- */

.folderLink {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  font: inherit;
  width: 100%;
  text-align: left;
}

.folderLink:hover {
  background: rgba(255,255,255,0.08);
}

/* Folder button fills remaining space next to arrow */
.topFolder > summary > .folderLink,
.tree details > summary > .folderLink {
  flex: 1;
}

/* ---------- Files ---------- */

.fileLink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  width: 100%;
}

.fileLink:hover {
  background: rgba(255,255,255,0.08);
}

.fileLink.active {
  background: rgba(138,180,248,0.18);
  outline: 1px solid rgba(138,180,248,0.35);
}

/* ---------- Icons and Labels ---------- */

.icon {
  width: 18px;
  display: inline-flex;
  justify-content: center;
  opacity: 0.9;
}

.label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Content ---------- */

.content {
  flex: 1;
  padding: 22px;
  max-width: 1100px;
}

.content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.content a {
  color: var(--accent);
}

.content a:hover {
  text-decoration: underline;
}

.content pre {
  overflow: auto;
  padding: 14px;
  border-radius: 12px;
  background: rgba(0,0,0,0.4);
}

.content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Mobile ---------- */

.backdrop {
  display: none;
}

@media (max-width: 900px) {

  .layout {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 0;
    width: min(360px, 92vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 60;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  }

  body.menuOpen .sidebar {
    transform: translateX(0);
  }

  .content {
    padding: 16px;
  }

  .backdrop {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 55;
  }

  body.menuOpen .backdrop {
    display: block;
  }
}
