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

html, body {
  height: 100%;
}

body {
  background: #0d1117;
  color: #e6edf3;
  font-family: 'Menlo', 'Monaco', 'Lucida Console', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── banner ── */
.banner {
  background: #161b22;
  border-bottom: 1px solid #30363d;
  color: #8b949e;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 5px 16px;
  text-align: center;
  text-transform: lowercase;
  flex-shrink: 0;
}

/* ── layout ── */
.wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 16px 12px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* ── terminal ── */
.terminal {
  background: #010409;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 14px 16px 12px;
  cursor: text;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 120px);
}

/* ── title bar dots ── */
.terminal::before {
  content: '● ● ●';
  display: block;
  font-size: 9px;
  letter-spacing: 4px;
  color: #30363d;
  margin-bottom: 12px;
  margin-top: -2px;
}

/* ── output area ── */
.output {
  flex: 1;
}

.line {
  display: block;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 1.55em;
}

/* ls short-format items */
.ls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 0;
}

.ls-item {
  display: inline-block;
  min-width: 160px;
  padding-right: 8px;
}

/* color classes */
.dir     { color: #58a6ff; font-weight: bold; }
.dotfile { color: #6e7681; }
.exec    { color: #3fb950; font-weight: bold; }
.err     { color: #f85149; }
.dim     { color: #6e7681; }
.ok      { color: #3fb950; }

/* prompt lines */
.prompt-line { display: flex; align-items: baseline; gap: 0; }
.prompt-line .ps1   { color: #58a6ff; flex-shrink: 0; white-space: nowrap; }
.prompt-line .typed { color: #e6edf3; }

/* ── input row ── */
.input-row {
  display: flex;
  align-items: baseline;
  margin-top: 2px;
  gap: 0;
}

.ps1-live {
  color: #58a6ff;
  white-space: nowrap;
  flex-shrink: 0;
}

#cmd {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e6edf3;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  caret-color: #58a6ff;
  padding: 0;
}

/* ── footer ── */
.footer {
  text-align: center;
  padding: 10px 0 14px;
  font-size: 12px;
  color: #6e7681;
  flex-shrink: 0;
}

.footer a {
  color: #6e7681;
  text-decoration: none;
}

.footer a:hover {
  color: #e6edf3;
}

/* ── diff output ── */
.diff-add { color: #3fb950; }
.diff-del { color: #f85149; }

/* ── vim / nano view ── */
.vim-view {
  background: #010409;
  border: 1px solid #30363d;
  border-radius: 3px;
  margin: 4px 0 6px;
  padding: 6px 0 0;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.55;
  overflow: hidden;
}

.vim-line {
  display: block;
  padding: 0 10px;
  white-space: pre;
  min-height: 1.55em;
  color: #e6edf3;
}

.vim-tilde {
  color: #30363d;
}

.vim-status {
  display: block;
  background: #161b22;
  border-top: 1px solid #30363d;
  color: #8b949e;
  padding: 2px 10px;
  margin-top: 4px;
  font-size: 12px;
  white-space: pre;
}

/* ── focus ring workaround ── */
#cmd:focus-visible {
  outline: none;
}

/* ── mobile ── */
@media (max-width: 600px) {
  .wrap {
    padding: 10px 8px 8px;
  }
  body {
    font-size: 13px;
  }
  .terminal {
    padding: 10px 10px 8px;
    min-height: calc(100vh - 90px);
  }
  .ls-item {
    min-width: 120px;
  }
}
