:root {
  --accent: #2a6496;
  --accent-dark: #1e4a70;
  --border: #ccc;
  --bg-soft: #fafafa;
  --text: #222;
  --muted: #666;
  --code-bg: #1e1e1e;
  --code-fg: #e0e0e0;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1em 3em;
  color: var(--text);
  background: #fff;
}

header { padding: 1em 0; border-bottom: 1px solid #eee; margin-bottom: 1.5em; }
nav { display: flex; align-items: center; gap: 1em; }
nav a { color: var(--accent); text-decoration: none; font-weight: 500; }
nav a:hover { text-decoration: underline; }
nav .brand { font-weight: 700; font-size: 1.1em; }
nav .spacer { flex: 1; }

main { min-height: 60vh; }

h2 { border-bottom: 2px solid #555; padding-bottom: 0.3em; }
h3 { color: #444; margin-top: 1.8em; }
.lead { color: var(--muted); }

footer {
  margin-top: 3em;
  padding-top: 1em;
  border-top: 1px solid #eee;
  color: #888;
  font-size: 0.85em;
  text-align: center;
}

/* Forms */
form.tool-form {
  border: 1px solid var(--border);
  padding: 1em 1.5em 1.5em;
  border-radius: 8px;
  background: var(--bg-soft);
}
label { display: block; margin-top: 0.8em; font-weight: 600; }
input[type=text], input[type=number], select, textarea {
  width: 100%;
  padding: 0.45em;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 0.95em;
  background: white;
}
textarea { height: 14em; resize: vertical; }
input[type=checkbox] { width: auto; margin-right: 0.4em; }

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.4em 1em;
  margin-top: 0.5em;
}
.field { display: flex; flex-direction: column; }

button {
  margin-top: 1.2em;
  padding: 0.6em 1.5em;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
}
button:hover { background: var(--accent-dark); }

/* Output */
pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 1em;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 0.85em;
  line-height: 1.4;
}
pre.ascii { white-space: pre; word-break: normal; }
pre.newick { font-size: 0.8em; }

code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  background: #f2f2f2;
  padding: 0.05em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
}

.err {
  background: #fff4f4;
  border-left: 4px solid #c33;
  padding: 0.7em 1em;
  margin: 1em 0;
  border-radius: 4px;
}
.note { color: var(--muted); font-size: 0.88em; margin-top: 0.2em; }
.sample-link { color: var(--accent); text-decoration: none; margin-left: 0.4em; cursor: pointer; }
.sample-link:hover { text-decoration: underline; }

hr { border: none; border-top: 1px solid #eee; margin: 2em 0; }

/* Tree SVG */
.svg-wrap {
  background: white;
  border: 1px solid #ddd;
  padding: 1em;
  border-radius: 6px;
  overflow: auto;
  max-height: 800px;
}
.svg-wrap svg { max-width: 100%; height: auto; display: block; }

/* Tool list */
.tool-list { list-style: none; padding: 0; }
.tool-list li {
  border: 1px solid #ddd;
  padding: 1em 1.4em;
  margin: 1em 0;
  border-radius: 8px;
  transition: border-color 0.15s;
}
.tool-list li:hover { border-color: var(--accent); }
.tool-list h2 { margin: 0 0 0.3em; border: none; }
.tool-list h2 a { text-decoration: none; color: var(--accent); }
.tool-list p { margin: 0; color: var(--muted); }
