:root {
  color-scheme: dark;
  --bg: #0b090a;
  --fg: #d7d1d2;
  --muted: #8f8487;
  --line: #2a1a1e;
  --red: #b0646b;
  --red-soft: #b86a70;
  font: 14px/1.5 Consolas, 'Courier New', monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); }
a { color: var(--red); }
button, input { font: inherit; }
button, a, input { outline-offset: 3px; }
button { color: var(--red); background: transparent; border: 1px solid var(--line); padding: 5px 9px; cursor: pointer; }
button:hover { color: var(--red-soft); border-color: var(--red-soft); }
button:disabled { opacity: .5; cursor: wait; }
:focus-visible { outline: 1px solid var(--red); }
.quiet { color: var(--muted); border-color: transparent; }
.top { max-width: 1000px; margin: auto; padding: 18px 22px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { color: var(--red-soft); font-size: 19px; font-weight: normal; text-decoration: none; }
.top nav { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
main { max-width: 1000px; margin: 0 auto; padding: 0 22px 40px; }
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); border-top: 1px solid var(--line); min-height: 72vh; }
.sidebar { padding: 16px 16px 16px 0; border-right: 1px solid var(--line); min-width: 0; }
.panel-title { color: var(--red); margin-bottom: 12px; font-size: 13px; }
input { width: 100%; min-width: 0; border: 1px solid var(--line); background: transparent; color: var(--fg); padding: 7px 9px; border-radius: 0; }
input::placeholder { color: var(--muted); }
#search { font-size: 12px; margin-bottom: 12px; }
details { margin: 7px 0 10px; }
summary { cursor: pointer; color: var(--red); font-size: 12px; }
.tree-item { display: block; width: calc(100% - 9px); margin: 3px 0 0 9px; padding: 3px 6px; border: 0; border-left: 1px solid var(--line); text-align: left; color: var(--fg); overflow-wrap: anywhere; font-size: 12px; }
.tree-item:hover, .tree-item.active { color: var(--red-soft); border-left-color: var(--red-soft); }
.side-foot { margin-top: 16px; color: var(--muted); font-size: 11px; }
#more { margin-top: 8px; font-size: 12px; }
.workspace { min-width: 0; }
.pane { padding: 24px 0 30px 32px; }
.entry-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.entry-meta { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; max-width: 48%; margin-left: auto; padding-top: 5px; text-align: right; }
.entry-meta button { font-size: 12px; }
h1 { font-size: 21px; font-weight: normal; line-height: 1.4; margin: 0; overflow-wrap: anywhere; color: var(--red); }
.timestamp { display: block; color: var(--red-soft); font-size: 12px; line-height: 1.5; }
.body { line-height: 1.75; overflow-wrap: anywhere; font-family: system-ui, sans-serif; font-size: 15px; }
.body h2, .body h3 { font-weight: 500; color: var(--red); line-height: 1.4; }
.body p { margin: 0 0 1em; }
.body img, .body video { display: block; max-width: 100%; height: auto; margin: 12px 0; }
.body blockquote { margin-left: 0; padding-left: 14px; border-left: 1px solid var(--red-soft); color: var(--muted); }
.body pre { white-space: pre-wrap; border-left: 1px solid var(--line); padding-left: 12px; }
.body .attachment { display: inline-block; color: var(--red); font: 13px/1.5 Consolas, monospace; margin: 4px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.5; }
label { display: block; margin: 16px 0 6px; color: var(--muted); font-size: 12px; }
#login { max-width: 350px; }
#login button { margin-top: 12px; }
.toolbar { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-bottom: 0; }
.toolbar button { border: 0; border-right: 1px solid var(--line); padding: 5px 8px; font-size: 12px; }
.editor { min-height: 280px; padding: 12px; border: 1px solid var(--line); }
.editor:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
#notice { padding: 12px 0 0 32px; color: var(--red-soft); overflow-wrap: anywhere; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 650px) {
  .top { padding: 14px 16px 10px; }
  main { padding: 0 16px 24px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 0; }
  .side-content { max-height: 230px; overflow: auto; }
  .pane { padding: 22px 0; min-height: 260px; }
  .entry-head { flex-wrap: wrap; gap: 6px; }
  .entry-meta { margin-left: auto; max-width: 100%; padding-top: 0; }
  #notice { padding-left: 0; }
}
.entry-controls { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
#reader .body img, #admin .body img { cursor: zoom-in; }
#lightbox { max-width: 96vw; max-height: 96vh; width: max-content; background: var(--bg); color: var(--fg); border: 1px solid var(--line); padding: 12px; }
#lightbox::backdrop { background: rgba(0,0,0,.92); }
#lightbox img { display: block; width: auto; height: auto; max-width: none; max-height: none; margin-top: 8px; }
#lightbox { overflow: auto; }
.lightbox-controls { position: sticky; top: 0; left: 0; display: flex; justify-content: flex-end; align-items: center; gap: 12px; background: var(--bg); padding-bottom: 4px; }
#admin h3 { font-weight: normal; color: var(--red); margin: 20px 0 6px; }
#admin select { max-width: 100%; background: var(--bg); color: var(--fg); border: 1px solid var(--line); padding: 6px; font: inherit; }
.diff { white-space: pre-wrap; overflow-wrap: anywhere; font-family: system-ui,sans-serif; font-size: 14px; }
.diff-remove { color: #d18484; background: #35171a; text-decoration: line-through; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-add { color: #c9c4c4; background: #292525; text-decoration: underline; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.log-table { margin-bottom: 12px; overflow-x: auto; }
.log-table table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
.log-table th, .log-table td { vertical-align: top; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.log-table th { font-weight: normal; color: var(--red); white-space: nowrap; }
.log-table time { color: var(--muted); white-space: nowrap; }
.log-table td:nth-child(2) { min-width: 100px; }

#login .remember { display: flex; align-items: center; gap: 8px; cursor: pointer; }
#login .remember input { width: auto; accent-color: var(--red); }

/* The log is a wide table, not a reading pane. */
body:has(#admin:not([hidden]) .log-table) :is(.top, main) { max-width: 1440px; }
.shell:has(#admin:not([hidden]) .log-table) { grid-template-columns: minmax(0, 1fr); }
.shell:has(#admin:not([hidden]) .log-table) .sidebar { display: none; }
#admin:has(.log-table) { padding: 24px 0 30px; }
.log-table table { min-width: 1240px; font-size: 13px; }
.log-table th, .log-table td { padding: 12px 16px 12px 0; overflow-wrap: normal; }
.log-table td:nth-child(2) { min-width: 220px; white-space: nowrap; }
.log-table td:nth-child(5), .log-table td:last-child { overflow-wrap: anywhere; }
.log-table td:nth-child(6), .log-table td:nth-child(7) { white-space: nowrap; }
.log-table tbody tr:hover { background: #140e10; }
@media (max-width: 650px) { #admin:has(.log-table) { padding-top: 20px; } }

.log-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.log-controls button { margin-left: auto; }

.entry + .entry { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.entry .body > :first-child { margin-top: 0; }
.entry .body > :last-child { margin-bottom: 0; }
.entry > .entry-controls { margin-top: 6px; }
.entry > .entry-controls button { font-size: 11px; padding: 2px 6px; }
.body video { width: auto; max-width: 100%; max-height: 65vh; background: #000; }
.feed-more { margin-top: 16px; }
#admin .log-controls select { width: auto; flex: 0 0 auto; padding: 3px 5px; font-size: 12px; }
.log-controls button { padding: 3px 7px; font-size: 12px; }
