:root {
  --bg: #101114;
  --panel: #17191e;
  --panel-2: #1d2027;
  --line: #2a2e37;
  --text: #e7e9ee;
  --muted: #9aa1af;
  --accent: #ffc531;
  --green: #3ecf8e;
  --red: #ff6b6b;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); }
.topbar nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); font-size: .95rem; }
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar .cta {
  background: var(--accent); color: #17191e; font-weight: 700;
  padding: 6px 14px; border-radius: 999px;
}
.inline { display: inline; }
.linky {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font: inherit; font-size: .95rem; padding: 0;
}
.linky:hover { color: var(--text); }

main { max-width: 900px; margin: 0 auto; padding: 28px 20px 64px; }
main.wide { max-width: 1180px; }

h1 { font-size: 1.7rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
p.lede { color: var(--muted); margin-top: 0; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.card { display: block; color: inherit; }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.card .meta, .meta { color: var(--muted); font-size: .85rem; }

label { display: block; margin: 14px 0 6px; font-size: .9rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; color: var(--text);
  font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 90px; resize: vertical; }

button.primary, .btn {
  display: inline-block; background: var(--accent); color: #17191e;
  border: 0; border-radius: 8px; padding: 10px 18px;
  font: inherit; font-weight: 700; cursor: pointer;
}
button.primary:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }


table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }

.filelist { list-style: none; margin: 0; padding: 0; }
.filelist li { border-bottom: 1px solid var(--line); }
.filelist li:last-child { border-bottom: 0; }
.filelist a {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 4px; color: var(--text);
}
.filelist a:hover { background: var(--panel-2); text-decoration: none; }
.filelist .size { color: var(--muted); font-size: .85rem; }
.dir::before { content: "📁 "; }
.file::before { content: "📄 "; }

.crumbs { color: var(--muted); font-size: .9rem; margin-bottom: 10px; word-break: break-all; }

pre.code {
  margin: 0; padding: 0; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: auto; font-size: .87rem; line-height: 1.5;
}
pre.code table { border-collapse: collapse; width: auto; min-width: 100%; }
pre.code td { border: 0; padding: 0 12px; vertical-align: top; white-space: pre; }
pre.code td.ln {
  color: #5b6272; text-align: right; user-select: none;
  position: sticky; left: 0; background: var(--panel-2); padding-right: 14px;
}
code, pre, .mono { font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; }

.keyshow {
  background: var(--panel-2); border: 1px solid var(--green); border-radius: 8px;
  padding: 12px; word-break: break-all; font-size: .9rem;
}

/* Messages appear next to whatever caused them, never at the top of the page.
   They push the page open a little and are closed by hand. */
.note {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 10px 0 0; padding: 9px 12px;
  border: 1px solid var(--green); border-left-width: 3px; border-radius: 8px;
  background: rgba(62, 207, 142, .08); color: var(--text); font-size: .9rem;
}
.note.bad { border-color: var(--red); background: rgba(255, 107, 107, .08); }
.note .tick { color: var(--green); font-weight: 800; }
.note.bad .tick { color: var(--red); }
.note .shut {
  margin-left: auto; background: none; border: 0; color: var(--muted);
  cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px;
}
.note .shut:hover { color: var(--text); }

/* The quiet mark a self-saving field leaves behind. */
.saved {
  display: inline-flex; align-items: center; gap: 5px;
  margin: 6px 0 0; color: var(--green); font-size: .82rem;
}

.foot {
  border-top: 1px solid var(--line); color: var(--muted);
  display: flex; justify-content: space-between; gap: 12px;
  padding: 18px 20px; font-size: .85rem; flex-wrap: wrap;
}

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  main { padding: 20px 14px 48px; }
}

/* Syntax colours - quiet, readable, dark only. */
.hljs-comment, .hljs-quote { color: #6b7280; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type { color: #c792ea; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #9ece6a; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #ff9e64; }
.hljs-title, .hljs-section, .hljs-name { color: #7aa2f7; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: #ffc531; }
.hljs-built_in, .hljs-class .hljs-title { color: #2ac3de; }
.hljs-meta { color: #7dcfff; }
.hljs-deletion { color: #ff6b6b; }

.prose { white-space: normal; word-wrap: break-word; }
.prose:first-letter { text-transform: none; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }

.chat {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 60vh; overflow-y: auto; padding-right: 4px;
}
.msg { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; }
.msg .whom { color: var(--accent); font-weight: 700; font-size: .9rem; }
.msg .said { word-wrap: break-word; }
.msg .flag { background: none; border: 0; color: #5b6272; cursor: pointer; font-size: .8rem; }
.msg .flag:hover { color: var(--red); }
.msg.gone .said { color: var(--muted); font-style: italic; }

.banner {
  display: block; border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; color: var(--muted);
  text-align: center; font-size: .9rem;
}
.banner:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }

/* The tick beside a label whose value is already stored. */
.set-tick { color: var(--green); font-weight: 800; }
