:root {
  /* base */
  --bg:         #191d23;
  --bg-soft:    #222831;
  --bg-even:    #1f252d;

  /* text */
  --fg:         #d6dde2;
  --fg-dim:     #8a979f;
  --fg-strong:  #ffffff;
  --fg-on-accent: #0f1418;
  --fg-code:    #a8d4ff;
  --fg-link-hover: #a8d4ff;

  /* accent */
  --accent:     #80C3FF;
  --accent-dim: #4a90c2;

  /* borders */
  --border:     #2f383d;

  /* surfaces */
  --code-bg:    #202832;
  --note-bg:    #1f2620;

  /* special */
  --note-border:  #FFFE9C;
  --error-bg:     #2a1e21;
  --error-border: #f48771;

  /* gradient */
  --grad-from:  #4F595F;
  --grad-to:    #80C3FF;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* header */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  background-image: linear-gradient(90deg, var(--grad-from) 0%, var(--grad-to) 100%);
  background-size: 100% 2px;
  background-repeat: no-repeat;
  background-position: bottom;
}

header .logo-link {
  display: flex;
  align-items: center;
}

header .logo {
  height: 36px;
  width: auto;
  display: block;
}

header h1 {
  font-size: 16px;
  margin: 0;
}

header .langs {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

header .langs a {
  color: var(--accent);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  transition: color .15s, border-color .15s, background .15s;
}

header .langs a:hover {
  color: var(--fg-link-hover);
  border-color: var(--accent-dim);
}

header .langs a.active {
  background: var(--accent);
  color: var(--fg-on-accent);
  border-color: transparent;
}

/* layout */
.layout {
  display: flex;
}

aside {
  width: 260px;
  flex-shrink: 0;
  padding: 16px;
  border-right: 1px solid var(--border);
  min-height: calc(100vh - 57px);
}

aside .cat {
  margin-bottom: 18px;
}

aside .cat-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--fg-dim);
  margin-bottom: 6px;
}

aside a.page {
  display: block;
  color: var(--fg);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
  transition: background .15s, color .15s;
}

aside a.page:hover {
  background: var(--bg-soft);
}

aside a.page.active {
  background: var(--accent);
  color: var(--fg-on-accent);
}

main {
  flex: 1;
  max-width: 1400px;
  padding: 24px;
}

/* content */
h1.page-title {
  font-size: 26px;
  margin: 0 0 20px;
  color: var(--fg-strong);
}

p {
  margin: 0 0 14px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--fg-link-hover);
  text-decoration: underline;
}

code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  color: var(--fg-code);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

table td {
  white-space: nowrap;
}

th, td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: top;
}

th {
  background: var(--code-bg);
  color: var(--fg-strong);
  font-weight: 600;
}

td img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

tr:nth-child(even) td {
  background: var(--bg-even);
}

pre {
  background: var(--code-bg);
  padding: 14px 16px;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid var(--border);
  margin: 16px 0;
}

pre code {
  background: none;
  padding: 0;
  color: var(--fg);
  font-size: 13px;
  display: block;
  white-space: pre;
}

.note {
  background: var(--note-bg);
  border-left: 3px solid var(--note-border);
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  margin: 16px 0;
}

figure {
  margin: 16px 0;
  text-align: center;
}

figure img {
  max-width: 80%;
  border-radius: 6px;
  height: auto;
}

figcaption {
  font-size: 13px;
  color: var(--fg-dim);
  margin-top: 6px;
}

.error {
  background: var(--error-bg);
  border-left: 3px solid var(--error-border);
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
}

.table-wrap {
  overflow-x: auto;
  margin: 20px 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  max-width: 100%;
}

.table-wrap table {
  margin: 0;
  min-width: max-content;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: zoom-out;
  padding: 40px;
}
.lightbox.open {
  display: flex;
}
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  cursor: zoom-out;
}

td img, figure img {
  cursor: zoom-in;
}
