* {
  box-sizing: border-box;
}

:root {
  --bg: #f9fafb;
  --text: #1f2937;
  --muted: #6b7280;
  --separator: #9ca3af;
  --surface: #ffffff;
  --border: #e5e7eb;
  --link: #2563eb;
  --code-bg: #f3f4f6;
  --toggle-track: #e5e7eb;
  --toggle-knob: #ffffff;
  --toggle-icon: #4b5563;
}

:root[data-theme="dark"] {
  --bg: #0f172a;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --separator: #64748b;
  --surface: #111827;
  --border: #334155;
  --link: #60a5fa;
  --code-bg: #1f2937;
  --toggle-track: #334155;
  --toggle-knob: #0f172a;
  --toggle-icon: #cbd5e1;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: background-color 280ms ease, color 280ms ease;
}

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

.layout {
  min-height: 100vh;
}

.content {
  padding: 1rem 1.5rem 2rem;
}

.content-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  padding: 0.75rem 1.5rem;
  margin-bottom: 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background-color 280ms ease, border-color 280ms ease;
}

.breadcrumbs {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
}

.breadcrumb-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
}

.breadcrumb-home-icon {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

.breadcrumb-sep {
  display: inline-flex;
  align-items: center;
  color: var(--separator);
}

#markdown-viewer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  max-width: 900px;
  transition: background-color 280ms ease, border-color 280ms ease, color 280ms ease;
}

#markdown-viewer h1,
#markdown-viewer h2,
#markdown-viewer h3 {
  color: var(--text);
  transition: color 280ms ease;
}

#markdown-viewer a {
  color: var(--link);
  transition: color 280ms ease;
}

#markdown-viewer code {
  background: var(--code-bg);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  transition: background-color 280ms ease;
}

.markdown-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 0.75rem 0;
}

#markdown-viewer table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  min-width: 420px;
}

#markdown-viewer th,
#markdown-viewer td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

#markdown-viewer th {
  background: var(--code-bg);
  font-weight: 600;
}

.theme-toggle {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.theme-toggle-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 64px;
  height: 32px;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--toggle-track);
  border: 1px solid var(--border);
  transition: background-color 280ms ease, border-color 280ms ease;
}

.theme-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  color: var(--toggle-icon);
  z-index: 1;
  transition: color 280ms ease, opacity 280ms ease;
}

.theme-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon.moon svg {
  fill: currentColor;
  stroke: none;
}

.theme-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--toggle-knob);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transform: translateX(0);
  transition: transform 280ms ease, background-color 280ms ease;
}

:root[data-theme="dark"] .theme-knob {
  transform: translateX(32px);
}

:root[data-theme="dark"] .theme-icon.sun,
:root:not([data-theme="dark"]) .theme-icon.moon {
  opacity: 0.55;
}
