:root {
  color-scheme: light;
  --canvas: #f8f9fa;
  --paper: #fff;
  --ink: #202122;
  --muted: #54595d;
  --line: #a2a9b1;
  --link: #0645ad;
  --new: #ba0000;
  --visited: #0b0080;
  --tab: #eaecf0;
  --note: #f8f9fa;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif;
  line-height: 1.6;
}
a { color: var(--link); text-decoration: none; }
a:visited { color: var(--visited); }
a:hover { text-decoration: underline; }
a.new, a.wiki.new { color: var(--new); }
a.wiki.new:visited { color: var(--new); }
code, pre, textarea, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
code { background: #f8f9fa; border: 1px solid #eaecf0; padding: 0 0.2em; }
pre { background: #f8f9fa; border: 1px solid var(--line); padding: 0.8em; overflow: auto; }
.mw-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.mw-header-inner, .mw-personal, .mw-workspace, .mw-footer { width: min(1120px, calc(100% - 1.5rem)); margin: 0 auto; }
.mw-header-inner { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: 0.7rem 0 0.2rem; }
.mw-logo { color: var(--ink); font-size: 1.35rem; font-weight: 500; text-decoration: none; }
.mw-logo:visited { color: var(--ink); }
.mw-search { display: flex; gap: 0.35rem; }
.mw-search input { width: min(22rem, 60vw); }
.mw-personal { display: flex; flex-wrap: wrap; gap: 0.9rem; padding: 0.35rem 0 0.55rem; font-size: 0.86rem; }
.mw-workspace { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr); gap: 0.8rem; padding: 0.8rem 0 2rem; }
.mw-panel { font-size: 0.84rem; }
.mw-panel h2 { font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 0.8rem 0 0.3rem; }
.mw-panel ul { list-style: none; margin: 0; padding: 0; }
.mw-panel li { margin: 0.2rem 0; }
.mw-body {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 0.6rem 1.4rem 1.6rem;
  min-height: 70vh;
}
.mw-tabs { display: flex; gap: 0.2rem; list-style: none; margin: 0 0 0.6rem; padding: 0.4rem 0 0; border-bottom: 1px solid var(--line); }
.mw-tabs li a, .mw-tabs li { display: inline-block; padding: 0.25rem 0.7rem; background: var(--tab); border: 1px solid var(--line); border-bottom: 0; color: var(--link); }
.mw-tabs li.selected a, .mw-tabs li.selected { background: var(--paper); font-weight: 600; position: relative; top: 1px; }
h1 { font-family: "Linux Libertine", Georgia, "Times New Roman", serif; font-weight: 400; font-size: 1.8rem; border-bottom: 1px solid var(--line); padding-bottom: 0.2rem; margin: 0.2rem 0 0.6rem; }
h2 { font-family: "Linux Libertine", Georgia, serif; font-weight: 400; font-size: 1.4rem; border-bottom: 1px solid var(--line); margin: 1.4rem 0 0.4rem; }
h3 { font-family: "Linux Libertine", Georgia, serif; font-weight: 400; font-size: 1.15rem; }
.mw-meta { color: var(--muted); font-size: 0.82rem; }
.mw-help, .note { background: var(--note); border: 1px solid var(--line); padding: 0.6rem 0.8rem; }
.toc { display: table; background: var(--note); border: 1px solid var(--line); padding: 0.5rem 0.9rem 0.7rem; margin: 0.6rem 0 1rem; }
.toctitle { text-align: center; font-weight: 600; margin-bottom: 0.3rem; }
.toc ol { margin: 0; padding-left: 1.2rem; }
.toclevel-3 { margin-left: 1rem; }
.katex-display, .tex[data-display="block"] { display: block; margin: 0.8rem 0; overflow-x: auto; text-align: center; }
.katex { font-size: 1.05em; }
math { font-family: "Linux Libertine", Georgia, "Times New Roman", serif; }
table { border-collapse: collapse; margin: 0.8rem 0; }
th, td { border: 1px solid var(--line); padding: 0.35rem 0.5rem; vertical-align: top; }
th { background: #eaecf0; }
label { display: block; margin: 0.7rem 0 0.2rem; font-size: 0.85rem; }
input, textarea, select { width: 100%; max-width: 100%; padding: 0.4rem 0.5rem; border: 1px solid var(--line); font: inherit; background: #fff; color: var(--ink); }
textarea { min-height: 22rem; }
button, .button { background: #f8f9fa; color: var(--link); border: 1px solid var(--line); padding: 0.35rem 0.7rem; font: inherit; cursor: pointer; text-decoration: none; }
button:hover, .button:hover { background: #fff; }
.row { display: flex; gap: 0.4rem; margin-top: 0.6rem; }
.error { color: var(--new); }
.history { list-style: none; padding: 0; }
.history li { margin: 0.45rem 0; }
.history form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.history button { width: auto; }
.mw-footer { color: var(--muted); font-size: 0.8rem; padding: 0 0 2rem; }
.preview { border-top: 1px dashed var(--line); margin-top: 0.6rem; }
.local-tools { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; }
.local-tools button, .local-tools a.button, #local-pages button { width: auto; }
#local-pages button { margin-left: 0.4rem; }
.ok { color: #14866d; }
.mw-sync { width: min(1120px, calc(100% - 1.5rem)); margin: 0.6rem auto 0; padding: 0.4rem 0.7rem; background: #eaf3ff; border: 1px solid var(--line); }
.mw-sync.offline { background: #fff6e8; }
.mw-sync-button { background: none; border: 0; color: var(--link); padding: 0; width: auto; font: inherit; cursor: pointer; }
.mw-sync-button:hover { text-decoration: underline; }
img, video, audio { max-width: 100%; height: auto; }
figure.media { margin: 0.8rem 0; }
figure.media figcaption { color: var(--muted); font-size: 0.9rem; }
@media (max-width: 760px) {
  .mw-workspace { grid-template-columns: 1fr; }
  .mw-header-inner { flex-direction: column; align-items: stretch; }
  .mw-search input { width: 100%; }
}
