:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --surface-soft: #f3f4f6;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --muted: #6b7280;
  --muted-strong: #4b5563;
  --accent: #111827;
  --accent-soft: #f3f4f6;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

code,
pre {
  font-family: var(--mono);
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.site-nav-inner {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  min-height: 72px;
  display: grid;
  gap: 18px;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
}

.site-brand-logo {
  width: 28px;
  height: 28px;
  display: block;
}

.site-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--muted);
}

.site-search input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  outline: 0;
}

.site-links {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted-strong);
  font-size: 0.96rem;
}

.page-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.repo-header {
  padding-top: 10px;
}

.repo-heading-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.repo-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: #94a3b8;
  font-size: 1.05rem;
  font-weight: 600;
}

.repo-heading-copy h1 {
  margin: 0;
  font-size: 2.4rem;
  line-height: 1.02;
  letter-spacing: 0;
}

.repo-summary {
  max-width: 72ch;
  margin: 14px 0 0;
  color: var(--muted-strong);
  line-height: 1.65;
}

.repo-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.secondary-button,
.copy-button,
.selection-pill,
.icon-button {
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    transform 120ms ease;
}

.primary-button {
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.18);
}

.secondary-button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border-color: var(--border);
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 600;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.5;
  box-shadow: none;
}

.primary-button:not(:disabled):hover,
.secondary-button:hover,
.copy-button:hover,
.selection-pill:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.modal-meta {
  display: grid;
  gap: 10px;
}

.repo-tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 22px;
  border-bottom: 1px solid var(--border);
}

.repo-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 600;
}

.repo-tab.is-active {
  color: var(--text);
}

.repo-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--text);
}

.page-grid {
  display: grid;
  gap: 32px;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  align-items: start;
  margin-top: 0;
}

.content-column {
  min-width: 0;
}

.content-card,
.sidebar-card,
.snippet-card,
.note-card,
.modal-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.content-card {
  border-top: 0;
  border-radius: 0 0 18px 18px;
  padding: 24px 28px 30px;
}

.content-card-header,
.sidebar-card-header,
.modal-header,
.snippet-card-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.content-kicker,
.sidebar-kicker,
.modal-kicker,
.snippet-kicker,
.selection-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.content-card-header h2,
.sidebar-card h2,
.modal-header h2,
.snippet-title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.15;
}

.subtle-path {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.82rem;
}

.sidebar-column {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 92px;
}

.sidebar-card {
  border-radius: 18px;
  padding: 18px;
}

.meta-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.meta-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  font-size: 0.93rem;
}

.meta-row dt {
  color: var(--muted);
  font-weight: 600;
}

.meta-row dd {
  margin: 0;
  color: var(--text);
}

.meta-row code {
  font-size: 0.9em;
}

.entity-card-stack {
  display: grid;
  gap: 18px;
}

.skills-table-wrap {
  max-height: 640px;
  margin-top: 14px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.skills-table {
  width: 100%;
  border-collapse: collapse;
}

.skills-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.skills-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.94rem;
}

.skills-table tbody td code {
  padding: 0;
  background: transparent;
  color: var(--muted-strong);
  font-size: 0.86rem;
}

.skills-table tbody tr {
  cursor: pointer;
  outline: none;
  transition: background 120ms ease;
}

.skills-table tbody tr:hover,
.skills-table tbody tr:focus-visible {
  background: var(--surface-muted);
}

.skills-table tbody tr.is-saved {
  background: #fff8eb;
}

.skills-table tbody tr:last-child td {
  border-bottom: 0;
}

.entity-table-wrap {
  max-height: none;
}

.entity-table tbody tr {
  cursor: default;
}

.entity-table tbody tr:hover,
.entity-table tbody tr:focus-visible {
  background: transparent;
}

.markdown-body {
  margin-top: 22px;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.74;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 1.7em 0 0.7em;
  font-size: 1.35rem;
  line-height: 1.18;
}

.markdown-body h1 {
  font-size: 1.6rem;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote {
  margin: 0 0 1.05em;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.4em;
}

.markdown-body code {
  padding: 0.12em 0.35em;
  border-radius: 6px;
  background: var(--surface-soft);
  font-size: 0.92em;
}

.markdown-body pre,
.snippet-card pre {
  position: relative;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border-radius: 14px;
  background: #0f172a;
  color: #e5edf8;
  font-size: 0.88rem;
  line-height: 1.65;
}

.markdown-body pre {
  margin: 0 0 1.2em;
}

.markdown-body pre code,
.snippet-card pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.markdown-body blockquote {
  padding-left: 16px;
  border-left: 3px solid var(--border-strong);
  color: var(--muted-strong);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(10px);
}

.modal-overlay.is-hidden {
  display: none;
}

.modal-shell {
  width: min(1120px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 20px;
  padding: 22px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--text);
}

.selection-toolbar {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  padding: 16px 0 18px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.selection-group {
  display: grid;
  gap: 10px;
}

.selection-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.runtime-example-group {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.runtime-example-group[hidden] {
  display: none;
}

.selection-pill {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 0.92rem;
}

.selection-pill.is-active {
  border-color: #111827;
  background: #111827;
  color: #ffffff;
}

.selection-pill.is-disabled,
.selection-pill:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.modal-meta {
  margin-top: 16px;
}

.inline-link {
  display: inline-flex;
  align-items: center;
  color: var(--muted-strong);
  font-weight: 600;
}

.inline-link:hover {
  color: var(--text);
}

.modal-summary {
  margin: 0;
  color: var(--muted-strong);
  line-height: 1.6;
}

.modal-meta .inline-link {
  width: fit-content;
  margin-top: -2px;
}

.skill-meta-grid {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.skill-file-section {
  margin-top: 18px;
}

.skills-picker {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.skill-picker-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
}

.skill-picker-row input {
  margin-top: 2px;
}

.skill-picker-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.skill-picker-copy strong {
  font-size: 0.96rem;
}

.skill-picker-description,
.modal-status {
  margin: 0;
  color: var(--muted-strong);
  line-height: 1.55;
}

.skill-picker-path {
  display: inline-block;
  width: fit-content;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
}

.skill-markdown {
  margin-top: 18px;
}

.modal-shell-skill .content-card-header h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.modal-shell-skill .subtle-path {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-shell-skill .meta-row {
  grid-template-columns: 110px 1fr;
}

.modal-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted-strong);
}

.runtime-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.snippet-card,
.note-card {
  border-radius: 16px;
  padding: 16px;
}

.snippet-target {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.copy-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border-color: var(--border);
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 600;
}

.copy-button.is-copied {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
}

.pre-copy-button {
  position: absolute;
  top: 12px;
  right: 12px;
}

.warning-list {
  margin: 0;
  padding-left: 1.2em;
  color: var(--muted-strong);
  line-height: 1.6;
}

.empty-state,
.modal-footnote {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--muted-strong);
  line-height: 1.6;
}

.modal-footnote {
  font-size: 0.92rem;
}

@media (max-width: 1100px) {
  .page-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-column {
    position: static;
  }
}

@media (max-width: 920px) {
  .site-nav-inner {
    grid-template-columns: 1fr;
    padding: 14px 0;
  }

  .site-links {
    flex-wrap: wrap;
    gap: 14px;
  }

  .repo-heading-row {
    flex-direction: column;
  }

  .repo-actions {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .page-shell,
  .site-nav-inner {
    width: min(100vw - 20px, 1440px);
  }

  .content-card,
  .sidebar-card,
  .modal-shell {
    padding: 16px;
  }

  .content-card {
    padding-top: 18px;
  }

  .repo-tabs,
  .content-card-header,
  .sidebar-card-header,
  .modal-header,
  .snippet-card-header,
  .modal-actions {
    flex-direction: column;
  }

  .meta-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .repo-heading-copy h1 {
    font-size: 2rem;
  }

  .modal-overlay {
    padding: 12px;
  }
}
