:root {
  --bg: #050505;
  --panel: #0b0b0b;
  --green: #ffa64c;
  --green-dim: #a37a2f;
  --border: #5f3d1f;
  --accent: #ffc77d;
  --selection: rgba(255, 166, 76, 0.15);
  --scrollbar-track: rgba(0, 0, 0, 0.2);
  --scrollbar-thumb: #a37a2f;
  --scrollbar-hover: #ffc77d;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: #000;
  height: 100%;
}


::selection {
  background: var(--green);
  color: #000;
}

body {
  background: radial-gradient(circle at center, #0b0b0b 0%, #000 70%);
  color: var(--green);
  font-family: "JetBrains Mono", "Courier New", monospace;
  overflow: hidden;
}

/* scanline and vignette overlay */
.content::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.22),
      rgba(0, 0, 0, 0.22) 1px,
      transparent 1px,
      transparent 3px
    ),
    radial-gradient(
      circle at center,
      transparent 60%,
      rgba(0, 0, 0, 0.55) 100%
    );
  z-index: 1;
}

/* window container */
.window {
  position: relative;
  width: 92vw;
  height: 88vh;
  margin: 6vh auto;
  border: 2px solid var(--border);
  background: var(--panel);
  box-shadow: 0 0 40px rgba(255, 166, 76, 0.15);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

/* title bar */
.titlebar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--green-dim);
  font-size: 14px;
  background: var(--panel);
  position: relative;
  z-index: 2;
}

/* main content wrapper */
.content {
  position: relative;
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100%;
  z-index: 2;
  overflow: hidden;
}

/* sidebar panel */
.sidebar {
  width: 320px;
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  background: var(--panel);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.sidebar h3 {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--green-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* tree navigation */
.tree-item {
  cursor: pointer;
  padding: 6px 8px;
  margin: 2px 0;
  border-radius: 3px;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
}

.tree-item:hover {
  background: var(--selection);
  border-left: 2px solid var(--green);
}

.tree-item.active {
  background: var(--selection);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}

.folder-arrow {
  font-size: 10px;
  color: var(--green-dim);
  margin-right: 6px;
  transition: transform 0.2s ease;
}

.tree-item:hover .folder-arrow {
  color: var(--accent);
}

.tree-text {
  color: var(--green);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}

.tree-item:hover .tree-text,
.tree-item.active .tree-text {
  color: var(--accent);
}

.tree-children {
  margin-left: 24px;
  padding-left: 12px;
  border-left: 1px dashed rgba(255, 166, 76, 0.15);
}

/* main content area */
.main-content {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.content-header {
  margin-bottom: 20px;
}

.prompt {
  color: var(--green-dim);
  font-size: 14px;
  margin-bottom: 8px;
}

.name {
  font-size: 42px;
  color: var(--accent);
  margin: 0;
  text-shadow: 0 0 10px rgba(255, 199, 125, 0.3);
}

/* cursor animation */
.cursor::after {
  content: "▮";
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* markdown styling */
.markdown-container {
  flex: 1;
  overflow-y: auto;
  padding-right: 10px;
  margin: 0;
}

.markdown-container h1,
.markdown-container h2,
.markdown-container h3,
.markdown-container h4 {
  color: var(--accent);
  margin: 1em 0 0.5em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.markdown-container h1 {
  font-size: 1.8em;
  margin-top: 0;
}

.markdown-container h2 {
  font-size: 1.5em;
}

.markdown-container h3 {
  font-size: 1.3em;
  border-bottom: 1px solid rgba(95, 61, 31, 0.5);
}

.markdown-container h4 {
  font-size: 1.1em;
  border: none;
}

.markdown-container p {
  margin: 0.8em 0;
  line-height: 1.6;
}

.markdown-container code {
  font-family: "JetBrains Mono", monospace;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--green);
  font-size: 0.9em;
  border: 1px solid rgba(95, 61, 31, 0.5);
}

.markdown-container pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1em 0;
}

.markdown-container pre code {
  background: none;
  padding: 0;
  color: #ffffff;
  font-size: 0.95em;
  border: none;
}

.markdown-container a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--green-dim);
  transition: all 0.2s ease;
}

.markdown-container a:hover {
  color: var(--green);
  border-bottom: 1px solid var(--green);
  text-shadow: 0 0 8px rgba(255, 199, 125, 0.4);
}

.markdown-container ul,
.markdown-container ol {
  margin: 0.8em 0;
  padding-left: 2em;
}

.markdown-container li {
  margin: 0.4em 0;
  position: relative;
}

.markdown-container ul li::before {
  content: "▸";
  color: var(--green-dim);
  position: absolute;
  left: -1em;
}

.markdown-container blockquote {
  border-left: 3px solid var(--green-dim);
  padding-left: 1em;
  margin: 1em 0;
  color: var(--green-dim);
  font-style: italic;
  background: rgba(95, 61, 31, 0.1);
  padding: 10px 15px;
  border-radius: 0 5px 5px 0;
}

.markdown-container table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  border: 1px solid var(--border);
}

.markdown-container th,
.markdown-container td {
  padding: 8px;
  text-align: left;
  border: 1px solid var(--border);
}

.markdown-container th {
  background: rgba(255, 166, 76, 0.1);
  color: var(--accent);
}

.markdown-container img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1em 0;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.markdown-container hr {
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--border),
    transparent
  );
  margin: 2em 0;
}

.loading {
  color: var(--green-dim);
  font-style: italic;
  padding: 20px 0;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 5px;
  margin: 10px 0;
}

.error {
  color: #ff4c4c;
  padding: 20px 0;
  text-align: center;
  border: 1px dashed #ff4c4c;
  border-radius: 5px;
  margin: 10px 0;
  background: rgba(255, 76, 76, 0.1);
}

.hint {
  color: var(--green-dim);
  font-size: 14px;
  margin-top: 20px;
  padding: 10px;
  border-left: 3px solid var(--green-dim);
  background: rgba(163, 122, 47, 0.05);
}

/* scrollbars */
.sidebar::-webkit-scrollbar,
.markdown-container::-webkit-scrollbar {
  width: 10px;
}

.sidebar::-webkit-scrollbar-track,
.markdown-container::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 5px;
  margin: 2px;
}

.sidebar::-webkit-scrollbar-thumb,
.markdown-container::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.sidebar::-webkit-scrollbar-thumb:hover,
.markdown-container::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
  border: 1px solid rgba(0, 0, 0, 0.3);
}

/* for firefox */
.sidebar,
.markdown-container {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scroll-behavior: smooth;
}

@media (max-width: 900px) {
  .window {
    width: 96vw;
    height: 92vh;
    margin: 4vh auto;
  }

  .content {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 30vh;
    min-height: 200px;
  }

  .main-content {
    padding: 20px;
  }

  .name {
    font-size: 28px;
  }

  .sidebar::-webkit-scrollbar,
  .markdown-container::-webkit-scrollbar {
    width: 6px;
  }

  .sidebar h3 {
    margin: 0 0 12px;
  }

  .tree-item {
    padding: 4px 6px;
  }
}