
:root {
  --bg: #fff;
  --text: #111;
  --muted: #666;
  --border: #eee;
  --code-bg: #f4f4f4;
  --pre-bg: #f7f7f7;
  --header-bg: #fafafa;
  --link: #0645ad;
  --link-hover: #053087;
  --accent: #0645ad;
  --accent-fg: #fff;
  --badge-bg: #eef;
  --badge-fg: #336;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { overflow-x: hidden; }
body {
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: clip;
  overflow-wrap: break-word;
}
a { color: var(--link); text-decoration: underline; }
a:hover { text-decoration: none; color: var(--link-hover); }
img { max-width: 100%; height: auto; }
code, pre { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; }
code { background: var(--code-bg); padding: 1px 4px; border-radius: 2px; font-size: 0.9em; overflow-wrap: anywhere; }
pre { background: var(--pre-bg); padding: 12px; border: 1px solid var(--border); overflow-x: auto; max-width: 100%; }
pre code { overflow-wrap: normal; background: transparent; padding: 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

.sheet { max-width: 800px; margin: 0 auto 60px; padding: 14px 20px 0; }
@media(max-width: 560px) { .sheet { padding: 10px 14px 0; } }

.topbar { border-bottom: 1px solid var(--border); background: var(--header-bg); }
.topbar-inner {
  max-width: 800px; margin: 0 auto;
  display: flex; gap: 16px; align-items: baseline; padding: 10px 20px; flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05em; }
.brand:hover { text-decoration: underline; }
.topbar nav { margin-left: auto; display: flex; gap: 12px; flex-wrap: wrap; }
.topbar nav .user { color: var(--muted); }

footer.sitefoot {
  margin-top: 40px; border-top: 1px solid var(--border); padding: 12px 0; color: var(--muted);
  font-size: 0.85em; text-align: center;
}

h1, h2, h3 { color: var(--text); margin-top: 1.5em; overflow-wrap: break-word; }
h1 { font-size: 1.8em; margin-bottom: 0.4em; }
h2 { font-size: 1.4em; margin-bottom: 0.3em; }
h3 { font-size: 1.15em; margin-bottom: 0.2em; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }

.btn {
  display: inline-block; padding: 6px 14px; background: var(--accent); color: var(--accent-fg);
  border: 0; border-radius: 3px; cursor: pointer; font-size: 0.95em;
  text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn-secondary { background: var(--muted); }
.btn-link {
  background: none; border: 0; color: var(--link); cursor: pointer;
  padding: 4px 0; font-size: 0.95em; text-decoration: underline;
}

.card {
  background: var(--header-bg); padding: 18px; border: 1px solid var(--border); border-radius: 3px;
  max-width: 420px; margin: 24px auto;
}
.card h1 { margin-top: 0; }

.flash { padding: 8px 12px; border: 1px solid #ccc; background: var(--header-bg); margin: 10px 0; font-size: 0.95em; }
.flash-error { border-color: #c33; background: #fee; color: #900; }
.flash-success { border-color: #393; background: #efe; color: #060; }
.flash-info { border-color: #36c; background: #eef; color: #036; }

.stacked { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; }
input[type="text"], input[type="email"], input[type="search"], input[type="password"], textarea {
  padding: 6px 10px; border: 1px solid #bbb; background: var(--bg); border-radius: 2px;
  font: inherit; color: inherit;
}
.editor label { display: block; margin: 10px 0; }
.editor label span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 0.85em; }
.editor input, .editor textarea { width: 100%; }
.editor textarea { font-family: ui-monospace, Menlo, monospace; font-size: 0.95em; line-height: 1.5; }
.editor-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }

.page-list { list-style: none; padding: 0; }
.page-list li { padding: 6px 0; border-bottom: 1px solid #f0f0f0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.page-list li:last-child { border-bottom: none; }

.markdown { overflow-wrap: break-word; max-width: 100%; }
.markdown img { max-width: 100%; height: auto; }
.markdown blockquote { border-left: 3px solid #ccc; padding-left: 10px; color: var(--muted); margin: 12px 0; }
.markdown table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.markdown table th, .markdown table td { border: 1px solid var(--border); padding: 5px 9px; }
a.wiki-link-new, a.dead { color: #b00; }
a.wiki-link-new::after { content: "?"; font-size: 0.8em; vertical-align: super; }

.backlinks { margin-top: 24px; padding: 12px; background: var(--header-bg); border: 1px solid var(--border); }
.backlinks h3 { margin: 0 0 6px; font-size: 0.95em; color: var(--muted); }
.backlinks ul { margin: 0; padding-left: 18px; }

.preview { min-height: 100px; padding: 10px; background: var(--header-bg); border: 1px solid var(--border); }

.data { width: 100%; border-collapse: collapse; margin: 12px 0; display: block; overflow-x: auto; max-width: 100%; }
.data thead, .data tbody, .data tr { display: table; width: 100%; table-layout: fixed; }
.data th, .data td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.data th { color: var(--muted); font-weight: 600; font-size: 0.85em; }
.invite-link { word-break: break-all; font-size: 0.85em; font-family: ui-monospace, Menlo, monospace; max-width: 100%; display: inline-block; }

.search-results { list-style: none; padding: 0; }
.search-results li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.search-results .snippet { color: var(--muted); margin: 3px 0 0; font-size: 0.9em; }

.diff { background: var(--header-bg); border: 1px solid var(--border); padding: 0; overflow-x: auto; max-width: 100%; }
.diff > div { padding: 0 10px; white-space: pre; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.diff-add { background: #e6ffec; color: #1a7f37; }
.diff-remove { background: #ffeef0; color: #cf222e; }
.diff .marker { display: inline-block; width: 1em; user-select: none; }

.badge {
  display: inline-block; padding: 1px 6px; background: var(--badge-bg); color: var(--badge-fg);
  font-size: 0.75em; border-radius: 2px; vertical-align: middle; margin-left: 4px;
}

.hero-image { display: block; width: 100%; max-height: 360px; object-fit: cover; border: 1px solid var(--border); margin-bottom: 14px; }

/* user overrides from wiki_settings.ui_colors */
:root {
  --accent: #008E97;
  --link: #FC4C02;
  --bg: #fff9f3;
  --text: #0a223a;
  --header-bg: #d6f1f3;
}

/* user overrides from wiki_settings.custom_css */
body {
  font-family: Georgia, serif;
  font-size: 17px;
  line-height: 1.5;
}

.brand {
  font-weight: bold;
  font-style: italic;
  font-size: 1.3em;
}

.topbar {
  border-bottom: 3px solid var(--accent);
}
