:root {
  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --bg-inset: #f6f8fa;
  --border: #d0d7de;
  --border-muted: #d8dee4;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --accent: #0969da;
  --btn-bg: #f6f8fa;
  --btn-hover: #eff2f5;
  --btn-border: #d1d9e0;
  --primary: #1f883d;
  --primary-hover: #1c8139;
  --primary-fg: #ffffff;
  --tag-bg: #ddf4ff;
  --tag-fg: #0969da;
  --tab-active: #fd8c73;
  --red: #e5534b;
  --green: #2da44e;
  --blue: #3178c6;
  --purple: #8250df;
  --orange: #bc4c00;
  --gray: #6e7781;
  --jr-red: #bc002d;
  --shadow: 0 1px 0 rgba(31, 35, 40, 0.04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --bg-subtle: #151b23;
    --bg-inset: #010409;
    --border: #3d444d;
    --border-muted: #2f353d;
    --fg: #f0f6fc;
    --fg-muted: #9198a1;
    --accent: #4493f8;
    --btn-bg: #212830;
    --btn-hover: #262c36;
    --btn-border: #3d444d;
    --primary: #238636;
    --primary-hover: #29903b;
    --tag-bg: rgba(56, 139, 253, 0.15);
    --tag-fg: #4493f8;
    --jr-red: #d70037;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --bg-subtle: #151b23;
  --bg-inset: #010409;
  --border: #3d444d;
  --border-muted: #2f353d;
  --fg: #f0f6fc;
  --fg-muted: #9198a1;
  --accent: #4493f8;
  --btn-bg: #212830;
  --btn-hover: #262c36;
  --btn-border: #3d444d;
  --primary: #238636;
  --primary-hover: #29903b;
  --tag-bg: rgba(56, 139, 253, 0.15);
  --tag-fg: #4493f8;
  --jr-red: #d70037;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 16px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { margin: 0; line-height: 1.25; }

svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--fg-muted); }
.small { font-size: 12px; }

.topbar { background: var(--bg-inset); border-bottom: 1px solid var(--border); }
.topbar-inner, .tabs-inner, .layout { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); font-weight: 600; font-size: 14px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; }
.brand-mark rect { fill: var(--fg); stroke: none; }
.brand-mark path { stroke: var(--bg); stroke-width: 3; }

.tabs { background: var(--bg-inset); }
.tabs-inner { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 12px;
  color: var(--fg);
  white-space: nowrap;
}
.tab:hover { text-decoration: none; }
.tab::before { content: ""; position: absolute; inset: 4px 0 8px; border-radius: 6px; z-index: -1; }
.tab:hover::before { background: var(--btn-hover); }
.tab { z-index: 0; }
.tab.is-active { font-weight: 600; }
.tab.is-active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 6px;
  background: var(--tab-active);
}
.counter {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 2em;
  background: var(--border-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--btn-border);
  border-radius: 6px;
  background: var(--btn-bg);
  color: var(--fg);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background-color 80ms;
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn:focus-visible, .tab:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { border-color: rgba(31, 35, 40, 0.15); background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 32px; padding: 0; }

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

.layout { display: grid; grid-template-columns: 296px minmax(0, 1fr); gap: 24px; padding-top: 24px; padding-bottom: 40px; }

.sidebar { display: flex; flex-direction: column; gap: 16px; }
.avatar { position: relative; margin: 0; }
.avatar img { display: block; width: 100%; height: auto; aspect-ratio: 1; border: 1px solid var(--border); border-radius: 50%; }
.avatar figcaption { margin-top: 6px; color: var(--fg-muted); font-size: 12px; text-align: center; }
.name { font-size: 24px; font-weight: 600; }
.handle { margin: 0; color: var(--fg-muted); font-size: 20px; font-weight: 300; }
.bio { margin: 0; font-size: 16px; }
.details { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.details li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.details svg { color: var(--fg-muted); }
.details a, .details span { overflow: hidden; color: var(--fg); text-overflow: ellipsis; white-space: nowrap; }
.details a:hover { color: var(--accent); }

.main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.main > section { scroll-margin-top: 16px; }
.section-title { margin-bottom: 8px; font-size: 16px; font-weight: 400; }

.box { border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.box-header { padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--bg-subtle); border-radius: 6px 6px 0 0; }
.box-body { padding: 24px; }

.markdown { font-size: 16px; line-height: 1.5; }
.markdown h2 { padding-bottom: 0.3em; border-bottom: 1px solid var(--border-muted); font-size: 1.5em; font-weight: 600; }
.markdown h3 { margin-top: 24px; font-size: 1.25em; font-weight: 600; }
.markdown p, .markdown ul { margin: 12px 0 0; }
.markdown ul { padding-left: 2em; }
.markdown li + li { margin-top: 4px; }
.topics { columns: 2; column-gap: 32px; }
.topics li { break-inside: avoid; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.pinned { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 8px; }
.pin { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.pin-featured { border-color: var(--jr-red); }
.pin-clarity { border-color: transparent; background: linear-gradient(var(--bg), var(--bg)) padding-box, linear-gradient(135deg, #4caf50, #ff9800, #f44336, #9c27b0, #2196f3) border-box; }
.pin-head { display: flex; align-items: center; gap: 8px; color: var(--fg-muted); }
.pin-name { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.5; }
.label { margin-left: auto; padding: 0 7px; border: 1px solid var(--border); border-radius: 2em; color: var(--fg-muted); font-size: 12px; font-weight: 500; line-height: 18px; }
.pin-desc { flex: 1; margin: 0; color: var(--fg-muted); font-size: 12px; }
.pin-links { margin: 0; font-size: 12px; }
.pin-meta { display: flex; flex-wrap: wrap; gap: 16px; color: var(--fg-muted); font-size: 12px; }
.pin-meta > span { display: inline-flex; align-items: center; gap: 4px; }

.dot { display: inline-block; width: 12px; height: 12px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 50%; }
.dot-red { background: var(--red); }
.dot-green { background: var(--green); }
.dot-blue { background: var(--blue); }
.dot-purple { background: var(--purple); }
.dot-orange { background: var(--orange); }
.dot-gray { background: var(--gray); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; list-style: none; }
.stats li { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-right: 1px solid var(--border-muted); border-bottom: 1px solid var(--border-muted); }
.stats li:nth-child(4n) { border-right: 0; }
.stats li:nth-last-child(-n + 4) { border-bottom: 0; }
.stats strong { font-size: 24px; font-weight: 600; }
.stats span { color: var(--fg-muted); font-size: 12px; }

.accordion details + details { border-top: 1px solid var(--border-muted); }
.accordion summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-right: 1.5px solid var(--fg-muted);
  border-bottom: 1.5px solid var(--fg-muted);
  transform: rotate(-45deg);
  transition: transform 120ms;
}
.accordion details[open] > summary::after { transform: rotate(45deg); }
.accordion summary:hover { background: var(--bg-subtle); }
.accordion ul { margin: 0; padding: 0 16px 16px 48px; color: var(--fg); }
.accordion li + li { margin-top: 6px; }

.skills { display: flex; flex-direction: column; gap: 16px; }
.skill-group h3 { margin-bottom: 8px; color: var(--fg-muted); font-size: 12px; font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tags li { padding: 0 10px; border-radius: 2em; background: var(--tag-bg); color: var(--tag-fg); font-size: 12px; font-weight: 500; line-height: 22px; }

.contact h2 { font-size: 20px; font-weight: 600; }
.contact p { margin: 8px 0 0; }

.footer { max-width: 1280px; margin: 0 auto; padding: 24px 32px 40px; border-top: 1px solid var(--border-muted); color: var(--fg-muted); font-size: 12px; text-align: center; }
.footer p { margin: 0; }

@media (max-width: 1011px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr); }
}

@media (max-width: 767px) {
  .topbar-inner, .tabs-inner, .layout, .footer { padding-right: 16px; padding-left: 16px; }
  .layout { grid-template-columns: minmax(0, 1fr); padding-top: 16px; }
  .sidebar { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 16px; row-gap: 12px; align-items: center; }
  .avatar { grid-row: span 1; }
  .sidebar > :not(.avatar):not(.identity) { grid-column: 1 / -1; }
  .name { font-size: 22px; }
  .handle { font-size: 18px; }
  .pinned, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats li:nth-child(4n) { border-right: 1px solid var(--border-muted); }
  .stats li:nth-child(2n) { border-right: 0; }
  .stats li:nth-last-child(-n + 4) { border-bottom: 1px solid var(--border-muted); }
  .stats li:nth-last-child(-n + 2) { border-bottom: 0; }
  .box-body { padding: 16px; }
  .topics { columns: 1; }
}

@media (max-width: 543px) {
  .pinned { grid-template-columns: minmax(0, 1fr); }
  .markdown { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
