
:root {
  color-scheme: light dark;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1c1e1d;
  --muted: #68706c;
  --line: #e2e0d8;
  --accent: #0b6e5f;
  --accent-soft: #e2f1ed;
  --mark: #fdeeb5;
  --warn: #9a6400;
  --warn-soft: #fbf0d6;
  --bad: #b3261e;
  --bad-soft: #fbe6e3;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121514;
    --surface: #1b1f1e;
    --text: #e8ebe9;
    --muted: #98a19d;
    --line: #2c3230;
    --accent: #5fc9b4;
    --accent-soft: #1d3530;
    --mark: #4a3d10;
    --warn: #e7b24a;
    --warn-soft: #33290f;
    --bad: #ff8a80;
    --bad-soft: #3a1b18;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
code, kbd, pre { font-family: var(--mono); font-size: 0.87em; }
kbd {
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  padding: 0 5px; background: var(--surface); white-space: nowrap;
}
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; letter-spacing: -0.015em; overflow-wrap: anywhere; }
h2.label {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 28px 0 8px; font-weight: 600;
}
.muted { color: var(--muted); }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }

.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 920px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.top form.search { flex: 1 1 200px; display: flex; min-width: 150px; }
.nav { display: flex; gap: 2px; }
.nav a { padding: 5px 10px; border-radius: 7px; color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.top form.signout { margin: 0; }

input[type="search"], input[type="password"], input[type="text"] {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 11px;
}
input::placeholder { color: var(--muted); }
button, .button {
  display: inline-block; font: inherit; font-weight: 550; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text); padding: 6px 12px;
}
button:hover, .button:hover { border-color: var(--muted); text-decoration: none; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
button.quiet { border-color: transparent; background: none; color: var(--muted); padding: 5px 8px; }
button.quiet:hover { color: var(--text); }
button.danger { color: var(--bad); }

main { max-width: 920px; margin: 0 auto; padding: 22px 16px 64px; }
main.reading { max-width: 760px; }

.crumbs { display: flex; flex-wrap: wrap; gap: 2px 6px; color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs span[aria-hidden] { opacity: 0.6; }

.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.head .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.head .actions form { margin: 0; }
.sub { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
a.row { display: block; padding: 10px 16px; color: var(--text); }
a.row + a.row { border-top: 1px solid var(--line); }
a.row:hover, a.row:focus-visible { background: var(--accent-soft); text-decoration: none; }
a.row:focus-visible { outline-offset: -2px; }
.row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title .kind { display: inline-block; width: 1.4em; color: var(--muted); font-weight: 400; }
.row-meta { flex: none; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.row-text { color: var(--muted); font-size: 0.92rem; overflow-wrap: anywhere; }
.row-text.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 14px; vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr + tr td { border-top: 1px solid var(--line); }
tbody tr:hover, tbody tr:focus-within { background: var(--accent-soft); }
td a.row-link { font-weight: 600; color: var(--text); display: block; min-width: 9em; }
td.prop { white-space: nowrap; max-width: 16em; overflow: hidden; text-overflow: ellipsis; }
td a.row-link:focus-visible { outline: none; text-decoration: underline; }
td.num { white-space: nowrap; color: var(--muted); font-size: 0.85rem; text-align: right; }
th.num { text-align: right; }

.roots { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
a.root {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; color: var(--text);
}
a.root:hover, a.root:focus-visible { border-color: var(--accent); text-decoration: none; }
a.root b { display: block; font-size: 1.1rem; }
a.root span { color: var(--muted); }

.pager { display: flex; justify-content: space-between; gap: 12px; margin: 14px 0; }

/* A page's properties, between its title and its text. */
dl.props {
  display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px;
  margin: 0 0 22px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; overflow-wrap: anywhere; }

/* Rendered markdown. */
.prose { font-size: 16px; line-height: 1.65; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: 1.5rem; margin: 1.6em 0 0.5em; }
.prose h2 { font-size: 1.25rem; line-height: 1.3; margin: 1.7em 0 0.5em; letter-spacing: -0.01em; }
.prose h3 { font-size: 1.05rem; margin: 1.5em 0 0.4em; }
.prose h4, .prose h5, .prose h6 { font-size: 1rem; margin: 1.4em 0 0.4em; }
.prose p, .prose ul, .prose ol, .prose pre, .prose table, .prose blockquote { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li + li { margin-top: 0.2em; }
.prose li > ul, .prose li > ol { margin: 0.2em 0 0; }
.prose li:has(> input[type="checkbox"]) { list-style: none; margin-left: -1.4em; }
.prose input[type="checkbox"] { margin-right: 0.5em; accent-color: var(--accent); }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 2px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose .missing { color: var(--muted); border-bottom: 1px dashed var(--muted); }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose blockquote { border-left: 3px solid var(--line); padding-left: 14px; color: var(--muted); }
.prose code { background: color-mix(in srgb, var(--line) 55%, transparent); border-radius: 4px; padding: 1px 5px; }
.prose pre { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; line-height: 1.5; }
.prose pre code { background: none; padding: 0; }
.prose table { display: block; overflow-x: auto; width: auto; max-width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 12px; }
.prose th { text-transform: none; letter-spacing: 0; font-size: inherit; color: inherit; background: var(--surface); }
pre.source {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; margin: 0;
}

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; }
.panel.shared { border-color: var(--accent); scroll-margin-top: 76px; }
.panel p { margin: 0 0 8px; }
.panel .linkline { display: flex; gap: 8px; }
.panel .linkline input { font-family: var(--mono); font-size: 0.85rem; }
.panel .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.panel form { margin: 0; }
.notice { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.note { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }

/* Upload. */
.drop {
  display: block; border: 2px dashed var(--line); border-radius: 14px; padding: 34px 16px;
  text-align: center; color: var(--muted); cursor: pointer; margin: 14px 0;
}
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); color: var(--text); }
.drop b { color: var(--text); display: block; font-size: 1.05rem; margin-bottom: 2px; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.field { display: block; font-weight: 550; margin: 0 0 6px; }
ul.uploads { list-style: none; margin: 0; padding: 0; }
ul.uploads li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
ul.uploads .ok { color: var(--accent); }
ul.uploads .bad { color: var(--bad); }

/* Sign-in and the app approval page. */
.login { max-width: 400px; margin: 12vh auto 0; padding: 0 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.login h1 { font-size: 1.35rem; }
.login label { display: block; font-weight: 550; margin: 14px 0 6px; }
.login button { width: 100%; margin-top: 14px; padding: 8px 12px; }
.login p { color: var(--muted); margin: 6px 0 0; }
.login .notice { margin: 14px 0 0; }
.consent { max-width: 460px; }
.consent h1 { overflow-wrap: anywhere; }
.consent fieldset { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.consent legend { font-weight: 550; padding: 0; margin-bottom: 6px; }
.consent .choice {
  display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 0;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.consent .choice + .choice { margin-top: 6px; }
.consent .choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.consent .choice input { margin-top: 4px; accent-color: var(--accent); }
.consent .choice b { display: block; font-weight: 550; }
.consent .choice small { display: block; color: var(--muted); font-size: 0.88rem; }
.consent .caution { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 14px; margin-top: 14px; }
.consent button.quiet { margin-top: 6px; }

/* A shared page, as the public sees it. */
.public { max-width: 760px; margin: 0 auto; padding: 40px 16px 64px; }
.public .sub { margin: 6px 0 26px; }
.public .prose .missing { color: inherit; border: 0; }
.public footer { margin-top: 48px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); padding: 20px 24px; max-width: 420px; width: calc(100% - 32px); }
dialog::backdrop { background: rgb(0 0 0 / 0.45); }
dialog h2 { margin: 0 0 12px; font-size: 1.1rem; }
dialog dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 16px; }
dialog dd { margin: 0; }

@media (max-width: 560px) {
  th, td { padding: 8px 10px; }
  .top form.search { order: 3; flex-basis: 100%; }
  .top .nav { margin-left: auto; }
  dl.props { grid-template-columns: 1fr; gap: 0 0; }
  dl.props dd { margin-bottom: 8px; }
}
