:root {
  --bg: #22272e;
  --bg-inset: #1c2128;
  --bg-subtle: #2d333b;
  --bg-muted: #373e47;
  --border: #444c56;
  --border-muted: #373e47;
  --fg: #adbac7;
  --fg-strong: #cdd9e5;
  --muted: #768390;
  --blue: #539bf5;
  --accent: #e0823d;
  --yellow: #c69026;
  --cyan: #96d0ff;
  --red: #e5534b;

  --syn-keyword: #f47067;
  --syn-string: #96d0ff;
  --syn-func: #dcbdfb;
  --syn-const: #6cb6ff;
  --syn-type: #f69d50;
  --syn-tag: #8ddb8c;
  --syn-comment: #768390;

  --font: "JetBrains Mono", "Noto Sans TC", ui-monospace, monospace;

  --status-h: 26px;
  --gap: 6px;
  --tree-w: 360px;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
html,
#tree {
  scrollbar-width: none;
}
html::-webkit-scrollbar,
#tree::-webkit-scrollbar {
  display: none;
}
body {
  background: var(--bg-inset);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}
::selection {
  background: rgba(83, 155, 245, 0.35);
}
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin-left: 0.1em;
  vertical-align: text-bottom;
  background: var(--fg-strong);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

.tm {
  padding: var(--gap) var(--gap) calc(var(--status-h) + var(--gap));
}
.tm::before,
.tm::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  z-index: 10;
  height: var(--gap);
  background: var(--bg-inset);
}
.tm::before {
  top: 0;
}
.tm::after {
  bottom: var(--status-h);
}
.tm-panes {
  display: grid;
  --tree-col: clamp(216px, var(--tree-w), min(432px, 50vw));
  grid-template-columns: var(--tree-col) minmax(0, 1fr);
  align-items: start;
  gap: var(--gap);
}
.split {
  position: fixed;
  top: var(--gap);
  bottom: calc(var(--status-h) + var(--gap));
  left: calc(var(--gap) + var(--tree-col) - 3px);
  z-index: 20;
  width: calc(var(--gap) + 6px);
  cursor: col-resize;
  touch-action: none;
}
[data-resizing] {
  cursor: col-resize;
  user-select: none;
}
.tm-pane {
  position: relative;
  border: 1px solid var(--accent);
  background: var(--bg);
}
.tm-pane > .tm-pane-title {
  color: var(--accent);
}
#tree {
  position: sticky;
  top: var(--gap);
  z-index: 5;
  height: calc(100dvh - var(--status-h) - 2 * var(--gap));
  overflow: auto;
}
#main {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--status-h) - 2 * var(--gap));
  border-top: 0;
  border-bottom: 0;
}
#main > .tm-pane-title {
  top: var(--gap);
  border-top: 1px solid var(--accent);
}
#main::after {
  content: "";
  position: sticky;
  bottom: calc(var(--status-h) + var(--gap));
  z-index: 1;
  height: 1px;
  margin: 0 -1px;
  background: var(--accent);
}
.tm-pane-title {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  padding: 2px 10px;
  font-size: 12px;
  border-bottom: 1px dashed var(--border-muted);
}

.tm-pane-title .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tm-pane-title .pct {
  margin-left: auto;
  padding-left: 2ch;
}
.fold {
  display: none;
  margin: -2px -10px -2px auto;
  padding: 2px 10px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.fold:hover {
  color: var(--fg-strong);
}

.tm-tree {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  font-size: 14px;
}
.tm-tree a {
  display: block;
  padding: 2px 12px 2px calc(12px + var(--ind, 0ch) + 2ch);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tm-tree .indent {
  --ind: 2ch;
}
.tm-tree .dir a {
  color: var(--blue);
  font-weight: 600;
}
.tm-tree .link a {
  color: var(--cyan);
}
.tm-tree .sel a {
  background: var(--bg-muted);
  color: var(--fg-strong);
}
.tm-tree .sel a::before {
  content: "▸";
  color: var(--accent);
  margin-left: -2ch;
  width: 2ch;
  display: inline-block;
}
.tm-tree a:hover {
  color: var(--fg-strong);
}

.tm-main {
  flex: 1;
  padding: 28px 40px 64px;
}
.fetch {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 32px;
}
.fetch .logo {
  display: block;
  flex: 1 1 0;
  min-width: 96px;
  max-width: 210px;
  height: auto;
  image-rendering: pixelated;
}
.fetch .who {
  margin: 0;
  color: var(--fg-strong);
  font-weight: 800;
}
.fetch .rule {
  border-bottom: 1px dashed var(--border-muted);
  margin: 8px 0 6px;
}
.fetch dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 2ch;
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
}
.fetch dt {
  color: var(--blue);
  font-weight: 600;
}
.fetch dd {
  margin: 0;
}
.fetch dd a,
.log .title a {
  color: var(--fg-strong);
}
.log .tags a {
  color: inherit;
}
.fetch dd a {
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}
.fetch dd a:hover,
.log .title a:hover,
.log .tags a:hover,
.meta a:hover {
  color: var(--blue);
}
.prompt {
  margin: 36px 0 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  overflow-wrap: anywhere;
}
.prompt .cwd {
  color: var(--accent);
  font-weight: 600;
}
.prompt.top {
  margin-top: 0;
}
.prompt.end {
  margin-top: 14px;
}
.prompt .home {
  color: var(--fg-strong);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}
.prompt .home:hover {
  color: var(--blue);
}
.err {
  margin: 0;
  color: var(--red);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.ls {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 3ch;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}
.ls a.dir {
  color: var(--blue);
  font-weight: 600;
}
.ls a.link {
  color: var(--cyan);
}
.ls a:hover {
  color: var(--fg-strong);
}
.log {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}
.log li {
  display: grid;
  grid-template-columns: 10ch 1fr;
  column-gap: 1.5ch;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-muted);
}
.log time,
.log .tags,
.log .desc,
.log-empty {
  color: var(--muted);
}
.log time {
  white-space: nowrap;
}
.log .draft {
  color: var(--yellow);
}
.log.tag-list li {
  grid-template-columns: 4ch 1fr;
}
.log .count {
  color: var(--muted);
  text-align: right;
}
.tag-desc {
  margin: 0;
  font-size: 14px;
}
.log .tags,
.log .desc {
  font-size: 13px;
}
.log .desc {
  grid-column: 2;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.meta {
  color: var(--muted);
  font-size: 13px;
}
.post-head h1 {
  color: var(--fg-strong);
  font-size: 26px;
  line-height: 1.4;
  margin: 0 0 6px;
}
.post-head .meta {
  margin-bottom: 36px;
}

.tm-status {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  height: var(--status-h);
  font-size: 13px;
  line-height: var(--status-h);
  padding: 0 12px;
  background: var(--accent);
  color: var(--bg-inset);
}
.tm-status > * {
  white-space: nowrap;
}
.tm-status a {
  color: inherit;
  text-decoration: none;
}
.tm-status a:hover {
  text-decoration: underline;
}
.tm-status .sess {
  font-weight: 800;
}
.tm-status .nav {
  display: flex;
  gap: 2ch;
  margin-left: auto;
  padding-left: 2ch;
}
.tm-status .off {
  opacity: 0.45;
}

.prose {
  overflow-wrap: anywhere;
  max-width: 68ch;
  font-size: 16px;
  line-height: 1.9;
}
.prose h1,
.prose h2,
.prose h3 {
  color: var(--fg-strong);
  line-height: 1.4;
}
.prose h1 {
  font-size: 1.5em;
  margin: 0 0 1em;
}
.prose h2 {
  font-size: 1.15em;
  margin: 2.2em 0 0.6em;
}
.prose h3 {
  font-size: 1em;
  margin: 1.8em 0 0.5em;
}
.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table {
  margin: 0 0 1.2em;
}
.prose strong {
  color: var(--fg-strong);
}
.prose a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.prose code {
  font-size: 0.88em;
  background: var(--bg-muted);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}
.prose pre {
  tab-size: 4;
  background: var(--bg-inset);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
}
.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}
.prose blockquote {
  padding-left: 1em;
  border-left: 3px solid var(--border);
  color: var(--muted);
}
.prose ul,
.prose ol {
  padding-left: 1.4em;
}
.prose li::marker {
  color: var(--muted);
}
.prose iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  margin: 0 0 1.2em;
}
.prose hr {
  border: 0;
  border-top: 1px dashed var(--border);
  margin: 2em 0;
}
.prose img {
  max-width: 100%;
}
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 14px;
}
.prose th,
.prose td {
  border: 1px solid var(--border-muted);
  padding: 4px 10px;
}

.chroma .k,
.chroma .kd,
.chroma .kn,
.chroma .kp,
.chroma .kr {
  color: var(--syn-keyword);
}
.chroma .kt,
.chroma .nb,
.chroma .bp {
  color: var(--syn-type);
}
.chroma .s,
.chroma .s1,
.chroma .s2,
.chroma .sb,
.chroma .sc,
.chroma .sd,
.chroma .se,
.chroma .sh,
.chroma .si,
.chroma .sx,
.chroma .sr,
.chroma .ss {
  color: var(--syn-string);
}
.chroma .nf,
.chroma .fm,
.chroma .nc {
  color: var(--syn-func);
}
.chroma .m,
.chroma .mi,
.chroma .mf,
.chroma .mh,
.chroma .mo,
.chroma .il,
.chroma .kc,
.chroma .na,
.chroma .no {
  color: var(--syn-const);
}
.chroma .nt {
  color: var(--syn-tag);
}
.chroma .c,
.chroma .c1,
.chroma .cm,
.chroma .cs,
.chroma .ch,
.chroma .cp {
  color: var(--syn-comment);
  font-style: italic;
}
.chroma .gd {
  color: #ffd8d3;
  background: rgba(229, 83, 75, 0.15);
}
.chroma .gi {
  color: #b4f1b4;
  background: rgba(87, 171, 90, 0.15);
}

@media (max-width: 760px) {
  .tm {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
  }
  .tm-panes {
    flex: 1;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    align-items: stretch;
  }
  #tree {
    height: auto;
    box-shadow:
      0 var(--gap) 0 0 var(--bg-inset),
      0 calc(var(--gap) + 1px) 0 0 var(--accent);
  }
  #main {
    min-height: 0;
  }
  #main > .tm-pane-title {
    top: calc(2 * var(--gap) + var(--tree-h));
  }
  .split {
    display: none;
  }
  .fold:not([hidden]) {
    display: block;
  }
  [data-tree="folded"] #tree-list {
    display: none;
  }
  [data-tree="folded"] #tree .tm-pane-title {
    border-bottom: 0;
  }
  .tm-main {
    padding: 20px 16px 48px;
  }
  .fetch {
    gap: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
