:root {
  --bg-primary: #05070c;
  --bg-secondary: #0d1117;
  --bg-tertiary: #161b22;
  --border-color: #30363d;
  --text-main: #c9d1d9;
  --text-muted: #8b949e;
  --accent-cyan: #00e5ff;
  --accent-blue: #58a6ff;
  --accent-green: #00e676;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
}

.header {
  background: var(--bg-secondary);
  padding: 0.85rem 2rem;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.logo-mark {
  display: block;
  border-radius: 6px;
}

.logo-accent {
  color: var(--accent-cyan);
}

.badge-tag {
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-family: monospace;
}

.content-container {
  display: flex;
  max-width: 1400px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  gap: 2rem;
}

.sidebar {
  width: 300px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  padding-right: 1rem;
  max-height: calc(100vh - 90px);
  position: sticky;
  top: 70px;
  overflow-y: auto;
}

.sidebar-home {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-home a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.15);
  transition: all 0.15s ease;
}

.sidebar-home a:hover, .sidebar-home a.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--accent-cyan);
}

.sidebar-group {
  margin-bottom: 0.85rem;
}

.sidebar-group summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 4px;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
}

.sidebar-group summary:hover {
  color: #fff;
  background: var(--bg-tertiary);
}

.sidebar-group summary .group-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-group summary .group-count {
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--accent-cyan);
  padding: 1px 6px;
  border-radius: 8px;
}

.sidebar-group ul {
  list-style: none;
  padding: 0 0 0 10px;
  margin: 0.4rem 0 0.6rem 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-group li {
  margin-bottom: 0.25rem;
}

.sidebar-group a {
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.86rem;
  display: block;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-group a:hover {
  background: var(--bg-tertiary);
  color: var(--accent-cyan);
}

.sidebar-group a.active {
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
  font-weight: 600;
  border-left: 2px solid var(--accent-cyan);
}

.doc-body {
  flex-grow: 1;
  min-width: 0;
}

.breadcrumb {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.breadcrumb-trail a {
  color: var(--accent-blue);
  text-decoration: none;
}

.breadcrumb .current {
  color: var(--text-main);
}

.raw-md-link {
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--accent-cyan);
  padding: 3px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-family: monospace;
  transition: all 0.15s ease;
}

.raw-md-link:hover {
  background: var(--border-color);
  color: #fff;
}

.hero-box {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.08), rgba(88, 166, 255, 0.04));
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.hero-box h1 {
  margin-top: 0;
  color: #fff;
}

.hero-desc {
  font-size: 1.1rem;
  color: #a5d6ff;
  max-width: 800px;
}

.portal-stat-badge {
  display: inline-block;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--accent-green);
  margin-top: 1rem;
}

.skill-spec-card {
  background: rgba(31, 111, 235, 0.07);
  border: 1px solid rgba(88, 166, 255, 0.22);
  border-left: 4px solid var(--accent-cyan);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0 1.75rem 0;
}

.skill-spec-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.skill-spec-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
}

.skill-spec-name {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.skill-seal-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-green);
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid rgba(0, 230, 118, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
}

.skill-spec-desc {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-main);
  margin: 0;
}

.quadrant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.quad-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
}

.quad-box h3 {
  margin-top: 0;
  color: #fff;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.quad-box ul {
  padding-left: 1.2rem;
  margin-bottom: 0;
}

.quad-box li {
  margin-bottom: 0.4rem;
}

.quad-box a {
  color: var(--accent-blue);
  text-decoration: none;
}

.quad-box a:hover {
  text-decoration: underline;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.cat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
}

.cat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.cat-card h4 {
  margin: 0;
  font-size: 0.95rem;
  color: #fff;
}

.cat-card h4 a {
  color: #fff;
  text-decoration: none;
}

.cat-card h4 a:hover {
  color: var(--accent-cyan);
}

.cat-card-count {
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  color: var(--accent-cyan);
  padding: 2px 6px;
  border-radius: 10px;
}

.cat-card p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cat-card-links {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.cat-card-links li {
  margin-bottom: 0.35rem;
}

.cat-card-links a {
  color: var(--accent-blue);
  text-decoration: none;
  font-size: 0.82rem;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-card-links a:hover {
  text-decoration: underline;
}

.cat-card-links .more-link a {
  color: var(--accent-cyan);
  font-weight: 500;
  margin-top: 4px;
}

.search-box {
  position: relative;
}

.search-box input {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  width: 280px;
  font-size: 0.9rem;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

#search-results {
  position: absolute;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  width: 380px;
  max-height: 400px;
  overflow-y: auto;
  display: none;
  margin-top: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
  z-index: 1000;
}

.search-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
}

.search-result-item a {
  color: var(--accent-blue);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
}

.search-result-category {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  margin-left: 6px;
}

.search-result-item p {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.markdown-body {
  color: var(--text-main);
  line-height: 1.6;
}

.markdown-body p, .markdown-body ul, .markdown-body ol {
  margin-top: 0;
  margin-bottom: 1rem;
}

.markdown-body ul, .markdown-body ol {
  padding-left: 2rem;
}

.markdown-body ol {
  list-style-type: decimal;
}

.markdown-body ul {
  list-style-type: disc;
}

.markdown-body li {
  margin-bottom: 0.35rem;
  line-height: 1.6;
}

.markdown-body li > p {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.markdown-body ul ul, .markdown-body ol ol, .markdown-body ul ol, .markdown-body ol ul {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 0.3em;
  margin-top: 1.5em;
}

.markdown-body a {
  color: var(--accent-blue);
  text-decoration: none;
}

.markdown-body a:hover {
  text-decoration: underline;
}

.markdown-body pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
}

.markdown-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 85%;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  -webkit-overflow-scrolling: touch;
}

.table-container table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  margin: 0;
  display: table;
}

.table-container th, .table-container td {
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
  line-height: 1.5;
}

.table-container th {
  background: var(--bg-tertiary);
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.table-container tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.table-container td code {
  white-space: nowrap;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  display: table;
}

.markdown-body th, .markdown-body td {
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: var(--bg-tertiary);
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.markdown-body td code {
  word-break: break-word;
}

sub, sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
sub { bottom: -0.25em; }
sup { top: -0.5em; }

.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin: 1.5rem 0;
  display: block;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Mermaid Architectural Diagram Styling */
.mermaid {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  padding: 1.75rem 1rem !important;
  margin: 1.75rem 0 !important;
  overflow-x: auto !important;
  white-space: pre !important;
}

.mermaid[data-processed="true"] {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  white-space: normal !important;
}

.mermaid svg {
  max-width: 100% !important;
  height: auto !important;
}

/* KaTeX Mathematical Formulas Styling */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.75rem 0;
  margin: 1.25rem 0;
  text-align: center;
}
.katex {
  font-size: 1.05em;
  color: var(--text-main);
}

/* GitHub Alert Callouts */
.alert {
  border-left: 4px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.alert-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.alert-title svg {
  flex-shrink: 0;
}

.alert-body {
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.6;
}

.alert-body p:last-child {
  margin-bottom: 0;
}

.alert-note {
  border-left-color: #2f81f7;
  background: rgba(56, 139, 253, 0.08);
}
.alert-note .alert-title {
  color: #58a6ff;
}

.alert-tip {
  border-left-color: #3fb950;
  background: rgba(63, 185, 80, 0.08);
}
.alert-tip .alert-title {
  color: #3fb950;
}

.alert-important {
  border-left-color: #a371f7;
  background: rgba(163, 113, 247, 0.08);
}
.alert-important .alert-title {
  color: #bc8cff;
}

.alert-warning {
  border-left-color: #d29922;
  background: rgba(210, 153, 34, 0.08);
}
.alert-warning .alert-title {
  color: #d29922;
}

.alert-caution {
  border-left-color: #f85149;
  background: rgba(248, 81, 73, 0.08);
}
.alert-caution .alert-title {
  color: #f85149;
}
"""
