/* Catppuccin Mocha palette */
:root {
  --base: #1e1e2e;
  --mantle: #181825;
  --surface0: #313244;
  --surface1: #45475a;
  --overlay0: #6c7086;
  --text: #cdd6f4;
  --subtext0: #a6adc8;
  --green: #a6e3a1;
  --mauve: #cba6f7;
  --blue: #89b4fa;
  --peach: #fab387;
  --red: #f38ba8;
  --teal: #94e2d5;
  --pink: #f5c2e7;
  --yellow: #f9e2af;
  --lavender: #b4befe;

  --sidebar-width: 16ch;
}

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

html, body {
  height: 100%;
  background: var(--mantle);
  font-family: 'Fira Code', 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
  color: var(--text);
  overflow: hidden;
  font-size: 16px;
  line-height: 1.5;
}

/* ── TUI Frame ─────────────────────────────────────── */
.tui-frame {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1000px;
  margin: 0 auto;
  background: var(--base);
}

/* ── Top border ────────────────────────────────────── */
.tui-top-border {
  display: flex;
  color: var(--overlay0);
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.tui-top-border .border-left {
  flex-shrink: 0;
}

.tui-top-border .border-title {
  flex-shrink: 0;
  color: var(--blue);
}

.tui-top-border .border-fill {
  flex: 1;
  overflow: hidden;
  color: var(--overlay0);
}

.tui-top-border .border-right {
  flex-shrink: 0;
}

/* ── Middle section (sidebar + divider + main) ───── */
.tui-middle {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ── Sidebar ───────────────────────────────────────── */
.tui-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--base);
  padding: 4px 0;
  overflow-y: auto;
  border-left: 1px solid var(--overlay0);
  border-right: 1px solid var(--overlay0);
}

.sidebar-header {
  padding: 2px 8px 4px 6px;
  color: var(--overlay0);
  font-size: 13px;
  letter-spacing: 1px;
  user-select: none;
  -webkit-user-select: none;
}

.sidebar-item {
  padding: 1px 8px 1px 6px;
  color: var(--teal);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}

.sidebar-item:hover {
  background: var(--surface0);
  color: var(--text);
}

.sidebar-item.active {
  background: var(--surface0);
  color: var(--mauve);
  font-weight: 700;
}

.sidebar-item.active::after {
  content: ' ◂';
  color: var(--mauve);
}

/* ── Main terminal panel ──────────────────────────── */
.tui-main {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px;
  min-width: 0;
  scroll-behavior: smooth;
  border-right: 1px solid var(--overlay0);
}

.tui-main::-webkit-scrollbar {
  width: 8px;
}

.tui-main::-webkit-scrollbar-track {
  background: var(--base);
}

.tui-main::-webkit-scrollbar-thumb {
  background: var(--surface1);
  border-radius: 4px;
}

/* ── Mid border (separator) ───────────────────────── */
.tui-mid-border {
  display: flex;
  color: var(--overlay0);
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.tui-mid-border .border-left {
  flex-shrink: 0;
}

.tui-mid-border .border-fill {
  flex: 1;
  overflow: hidden;
}

.tui-mid-border .border-right {
  flex-shrink: 0;
}

/* ── Status bar ───────────────────────────────────── */
.tui-statusbar {
  display: flex;
  justify-content: space-between;
  padding: 2px 8px;
  background: var(--surface0);
  color: var(--subtext0);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  border-left: 1px solid var(--overlay0);
  border-right: 1px solid var(--overlay0);
}

.status-left {
  color: var(--teal);
}

.status-right {
  color: var(--overlay0);
}

/* ── Bottom border ────────────────────────────────── */
.tui-bottom-border {
  display: flex;
  color: var(--overlay0);
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.tui-bottom-border .border-left {
  flex-shrink: 0;
}

.tui-bottom-border .border-fill {
  flex: 1;
  overflow: hidden;
}

.tui-bottom-border .border-right {
  flex-shrink: 0;
}

/* ── Output ───────────────────────────────────────── */
#output {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.output-line {
  margin-bottom: 1px;
}

.output-block {
  margin-bottom: 10px;
}

/* ── Prompt and input ─────────────────────────────── */
.input-line {
  display: flex;
  align-items: center;
  margin-top: 4px;
}

.prompt {
  color: var(--green);
  white-space: nowrap;
  font-weight: 700;
}

#command-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  caret-color: transparent;
}

/* Blinking block cursor */
.input-line::after {
  content: '▋';
  color: var(--green);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Color utility classes ────────────────────────── */
.color-green { color: var(--green); }
.color-purple { color: var(--mauve); }
.color-cyan { color: var(--teal); }
.color-orange { color: var(--peach); }
.color-red { color: var(--red); }
.color-comment { color: var(--overlay0); }
.color-pink { color: var(--pink); }
.color-fg { color: var(--text); }
.color-blue { color: var(--blue); }
.bold { font-weight: 700; }

/* ── Clickable inline commands ────────────────────── */
.clickable {
  color: var(--teal);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed var(--teal);
  transition: color 0.15s;
}

.clickable:hover {
  color: var(--text);
}

/* ── External links ───────────────────────────────── */
a.ext-link {
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px solid var(--blue);
  transition: color 0.15s;
}

a.ext-link:hover {
  color: var(--text);
}

/* ── Separator ────────────────────────────────────── */
.separator {
  color: var(--overlay0);
  margin: 6px 0;
}

/* ── Boot text ────────────────────────────────────── */
.boot-tag {
  color: var(--overlay0);
}

.boot-ok {
  color: var(--green);
  font-weight: 700;
}

/* ── History prompt echo ──────────────────────────── */
.history-prompt {
  color: var(--green);
  font-weight: 700;
}

.history-cmd {
  color: var(--text);
}

/* ── Help table ───────────────────────────────────── */
.help-table {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 16px;
}

.help-cmd {
  color: var(--teal);
}

.help-desc {
  color: var(--overlay0);
}

/* ── Hidden input line (during boot) ──────────────── */
.input-line.hidden {
  display: none;
}

/* ── Responsive: narrow screens ───────────────────── */
@media (max-width: 768px) {
  .tui-sidebar {
    width: 14ch;
  }
}

@media (max-width: 600px) {
  .tui-frame {
    height: 100%;
    min-height: 100vh;
    border: none;
  }

  .tui-sidebar {
    display: none;
  }

  .tui-top-border .border-left {
    display: none;
  }

  .tui-top-border .border-title::before {
    content: '┌─';
  }

  .tui-mid-border .border-left {
    font-size: 0;
  }

  .tui-mid-border .border-left::before {
    content: '├';
    font-size: 16px;
  }

  .tui-main {
    padding: 8px;
  }

  body {
    font-size: 14px;
    overflow-y: auto;
  }

  .tui-statusbar {
    font-size: 12px;
    flex-direction: column;
    gap: 4px;
    height: auto;
  }

  .status-right {
    text-align: right;
  }
}
nt-size: 16px;
  }

  body {
    font-size: 14px;
  }

  .tui-statusbar {
    font-size: 13px;
  }
}
