:root {
  color-scheme: light;
  --bg: #fff;
  --panel: #f8f8fa;
  --text: #25252b;
  --muted: #767680;
  --line: #e7e7ed;
  --accent: #7953c6;
  --hover: #eeebf7;
  --code: #f3f3f6;
  --shadow: 0 12px 40px #15102025;
  font-family:
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 16px;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #202024;
  --panel: #19191d;
  --text: #dedee4;
  --muted: #9999a5;
  --line: #34343c;
  --accent: #b294f1;
  --hover: #30283e;
  --code: #29292f;
  --shadow: 0 12px 40px #0006;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --bg: #202024;
    --panel: #19191d;
    --text: #dedee4;
    --muted: #9999a5;
    --line: #34343c;
    --accent: #b294f1;
    --hover: #30283e;
    --code: #29292f;
    --shadow: 0 12px 40px #0006;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
}
button:hover {
  background: var(--hover);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
input {
  min-width: 0;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 0.6rem;
  border-radius: 5px;
}
h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.025em;
}
h1 {
  font-size: 2rem;
}
h2 {
  margin-top: 2em;
  font-size: 1.45rem;
}
h3 {
  margin-top: 1.6em;
  font-size: 1.15rem;
}
.publish-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 250px;
  min-height: 100vh;
}
.left-panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 2.2rem 1.2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}
.site-name {
  font-size: 1.2rem;
  font-weight: 650;
  color: var(--text);
  overflow-wrap: anywhere;
  line-height: 1.4;
  padding: 0.2rem 0.4rem;
}
.site-logo {
  display: block;
  max-width: 100%;
  max-height: 120px;
  margin-bottom: 1rem;
}
.search-box {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 6px;
  gap: 0.5rem;
  padding: 0 0.5rem;
  color: var(--muted);
}
.search-box input {
  width: 100%;
  border: 0;
  background: none;
  font-size: 0.875rem;
  padding: 0.6rem 0;
}
.search-box kbd {
  font-size: 0.75rem;
  color: var(--muted);
}
#navigation {
  font-size: 0.875rem;
  line-height: 1.5;
}
.nav-note {
  display: block;
  color: var(--muted);
  padding: 0.4rem 0.6rem;
  margin: 0.12rem 0;
  border-radius: 5px;
  overflow-wrap: anywhere;
}
.nav-note:hover,
.nav-note.active {
  background: var(--hover);
  color: var(--accent);
  text-decoration: none;
}
.nav-folder {
  margin: 0.2rem 0;
}
.nav-folder summary {
  padding: 0.4rem;
  cursor: pointer;
  color: var(--text);
}
.nav-folder > .nav-folder,
.nav-folder > .nav-note {
  margin-left: 0.8rem;
}
footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: auto;
  padding: 0.75rem 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
}
footer button {
  background: none;
  font-size: 0.875rem;
}
.powered {
  display: block;
  width: 100%;
  font-size: 0.75rem;
  color: var(--muted);
  padding-top: 0.5rem;
}
#content {
  padding: 3.5rem 3rem 6rem;
  min-width: 0;
}
.note-content {
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
  margin: auto;
}
.readable .note-content {
  max-width: 720px;
}
.page-title {
  font-size: 2.3rem;
  line-height: 1.2;
  margin: 0 0 2rem;
  font-weight: 720;
  letter-spacing: -0.04em;
}
.note-content p {
  margin: 1em 0;
}
.note-content img,
.note-content video {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
}
.note-content audio {
  max-width: 100%;
}
.note-content iframe {
  max-width: 100%;
  border: 0;
}
.note-content pre {
  padding: 1.1rem 1.3rem;
  background: var(--code);
  border-radius: 7px;
  overflow: auto;
  line-height: 1.5;
}
.note-content code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.875em;
}
.note-content :not(pre) > code {
  background: var(--code);
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
}
.note-content blockquote {
  margin: 1.3em 0;
  padding: 0.1rem 1.2rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.note-content .callout {
  background: var(--hover);
  border-radius: 6px;
  border-left: 0;
  padding: 0.35rem 1rem;
  color: var(--text);
}
.callout-title {
  color: var(--accent);
  display: inline-block;
  padding-top: 0.25rem;
}
.note-content .callout-warning {
  background: #d89e1415;
}
.callout-warning .callout-title {
  color: #a5790b;
}
.note-content table {
  border-collapse: collapse;
  display: block;
  overflow: auto;
  max-width: 100%;
}
.note-content td,
.note-content th {
  border: 1px solid var(--line);
  padding: 0.45rem 0.8rem;
  text-align: left;
}
.note-content th {
  background: var(--panel);
}
.note-content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}
.note-content li {
  margin: 0.25rem 0;
}
.note-content input[type="checkbox"] {
  accent-color: var(--accent);
}
.note-embed {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 1.3rem;
  margin: 1.5rem 0;
}
.embed-source {
  font-size: 0.8rem;
  color: var(--muted);
  float: right;
  margin-left: 1rem;
}
.unpublished {
  color: var(--muted);
  text-decoration: underline dotted;
  cursor: default;
}
.right-panel {
  padding: 3.5rem 1.5rem 2rem 0.5rem;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow: auto;
  font-size: 0.875rem;
}
.right-panel section {
  margin-bottom: 2rem;
}
.right-panel h2 {
  font-size: 0.8rem;
  letter-spacing: 0;
  margin: 0 0 1rem;
  color: var(--muted);
  font-weight: 600;
}
.toc-link,
.backlink {
  display: block;
  padding: 0.3rem 0.6rem;
  border-left: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.45;
}
.toc-link:hover,
.backlink:hover {
  border-left-color: var(--accent);
  color: var(--accent);
}
.level-3 {
  padding-left: 1.3rem;
}
.level-4,
.level-5,
.level-6 {
  padding-left: 1.8rem;
}
#graph {
  width: 100%;
  height: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.graph-edge {
  stroke: var(--line);
  stroke-width: 1.4;
}
.graph-node {
  fill: var(--muted);
}
.graph-current {
  fill: var(--accent);
}
#graph text {
  font:
    10px ui-sans-serif,
    sans-serif;
  fill: var(--muted);
}
#graph a:hover circle {
  fill: var(--accent);
  r: 7;
}
.muted {
  color: var(--muted);
  font-size: 0.875rem;
}
.mobile-header {
  display: none;
}
.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  background: var(--bg);
  padding: 1rem;
  z-index: 100;
}
.skip-link:focus {
  top: 1rem;
}
.hover-preview {
  position: fixed;
  z-index: 50;
  width: 360px;
  max-height: 300px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow);
  padding: 1.4rem;
  pointer-events: none;
}
.hover-preview h3 {
  margin: 0 0 0.75rem;
}
.preview-body {
  font-size: 0.875rem;
  line-height: 1.6;
}
.preview-body img {
  max-width: 100%;
}
.preview-body pre {
  white-space: pre-wrap;
}
.search-result {
  display: block;
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 0.25rem;
  font-size: 0.9rem;
}
.search-result small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.3rem;
}
.search-excerpt {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 0.4rem 0;
}
.search-count {
  font-size: 0.8rem;
  color: var(--muted);
}
#reader-status {
  font-size: 0.875rem;
  color: var(--muted);
  padding-top: 1rem;
}
.stacked {
  display: flex;
  overflow-x: auto;
  gap: 2rem;
  scroll-snap-type: x mandatory;
  max-width: 100%;
}
.stacked .note-content {
  min-width: min(640px, 85vw);
  max-width: 640px;
  scroll-snap-align: start;
  margin: 0;
  border-right: 1px solid var(--line);
  padding-right: 2rem;
}
.login,
.welcome {
  max-width: 420px;
  margin: 14vh auto;
  padding: 2rem;
}
.login .brand-mark {
  color: var(--accent);
  font-size: 3rem;
}
.login h1 {
  font-size: 1.8rem;
}
.login p {
  color: var(--muted);
  line-height: 1.6;
}
.login label {
  display: block;
  margin: 1.5rem 0 0.5rem;
  font-size: 0.875rem;
}
.login input {
  width: 100%;
}
.login button {
  background: var(--accent);
  color: var(--bg);
  width: 100%;
  border: 0;
}
.hide-nav .publish-layout {
  grid-template-columns: minmax(0, 1fr) 250px;
}
.hide-nav .left-panel {
  display: none;
}
.hide-aside .publish-layout {
  grid-template-columns: 260px minmax(0, 1fr);
}
.hide-aside .right-panel {
  display: none;
}
.hide-nav.hide-aside .publish-layout {
  display: block;
}
.katex-display {
  overflow: auto;
  padding: 0.5rem 0;
}
@media (min-width: 1600px) {
  .publish-layout {
    grid-template-columns: 290px minmax(0, 1fr) 290px;
  }
  .left-panel {
    padding-left: 2rem;
  }
  .right-panel {
    padding-right: 2.5rem;
  }
}
@media (max-width: 1150px) {
  .publish-layout,
  .hide-aside .publish-layout {
    grid-template-columns: 230px minmax(0, 1fr);
  }
  .right-panel {
    display: none;
  }
  #content {
    padding: 3rem 2rem;
  }
  .hide-nav .publish-layout {
    display: block;
  }
}
@media (max-width: 760px) {
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
    height: 58px;
  }
  .mobile-header a {
    color: var(--text);
    font-weight: 600;
  }
  .mobile-header button {
    border: 0;
  }
  .publish-layout,
  .hide-aside .publish-layout {
    display: block;
  }
  .left-panel {
    position: fixed;
    z-index: 30;
    top: 58px;
    left: 0;
    width: min(300px, 85vw);
    height: calc(100dvh - 58px);
    transform: translateX(-100%);
    transition: transform 0.15s ease;
    box-shadow: var(--shadow);
  }
  .nav-open .left-panel {
    transform: translateX(0);
  }
  #content {
    padding: 2rem 1.35rem 4rem;
  }
  .page-title {
    font-size: 2rem;
  }
  .note-content {
    line-height: 1.75;
  }
  .right-panel {
    display: none;
  }
  .note-content pre {
    margin-inline: -0.35rem;
  }
  .login {
    margin: 8vh auto;
  }
  .hide-nav #menu {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
@media print {
  .left-panel,
  .right-panel,
  .mobile-header {
    display: none;
  }
  .publish-layout {
    display: block;
  }
  #content {
    padding: 0;
  }
  .note-content {
    max-width: none;
  }
  .note-content a {
    color: inherit;
  }
  .note-content pre {
    white-space: pre-wrap;
  }
}

.note-content .pdf-embed {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.note-content details.callout {
  padding: 0.75rem 1rem;
  margin: 1.25rem 0;
}
.callout summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}
.callout-title {
  font-weight: 600;
}
mark {
  background: #f7d65c66;
  color: inherit;
  padding: 0 0.15em;
}
