:root {
  --bg: #0b0b10;
  --bg-soft: #14141b;
  --text: #f2f3f6;
  --muted: #9ba1ad;
  --border: #262630;
  --accent: #4d8cff;
  --accent-soft: #15233d;
  --max: 1120px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent); color: #fff; }
input, select, textarea { color-scheme: dark; }
code { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 4px; padding: 0.1em 0.35em; font-size: 0.9em; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* Header */
.brand-mark { display: block; width: 28px; height: 28px; border-radius: 6px; object-fit: contain; }
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); }
.header-row { display: flex; align-items: center; gap: 22px; height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; color: var(--text); }
.brand:hover { text-decoration: none; color: var(--accent); }
.brand-mark { color: var(--accent); }
.main-nav { display: flex; gap: 18px; font-size: 14.5px; }
.main-nav a { color: var(--muted); }
.main-nav a:hover { color: var(--text); text-decoration: none; }
/* Header search: single clean pill, icon submit */
.header-search { margin-left: auto; display: flex; align-items: center; position: relative; }
.header-search input {
  border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 38px 8px 15px; font-size: 14px; width: 220px; outline: none;
  background: var(--bg-soft); color: var(--text);
  -webkit-appearance: none; appearance: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, width 160ms ease;
}
.header-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.header-search input::placeholder { color: #9aa0ae; }
.header-search input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(77, 140, 255, 0.25); width: 270px;
}
.header-search button {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; padding: 0; border: none; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.header-search button:hover { background: var(--accent-soft); color: var(--accent); }
.header-search button svg { display: block; width: 16px; height: 16px; }

/* Hero */
.hero { background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 100%); padding: 64px 0 56px; text-align: center; }
.hero h1 { font-size: clamp(28px, 4.5vw, 42px); margin: 0 0 12px; letter-spacing: -0.02em; }
.hero p { color: var(--muted); max-width: 620px; margin: 0 auto 28px; font-size: 17px; }
.hero-search { display: flex; max-width: 560px; margin: 0 auto 18px; }
.hero-search input {
  flex: 1; border: 1px solid var(--border); border-right: none; border-radius: 10px 0 0 10px;
  padding: 13px 18px; font-size: 16px; outline: none;
  background: var(--bg-soft); color: var(--text);
}
.hero-search input:focus { border-color: var(--accent); }
.hero-search button {
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 0 10px 10px 0; padding: 13px 24px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.hero-search button:hover { filter: brightness(0.94); }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.hero-tags a {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 14px; font-size: 13.5px; color: var(--muted); max-width: 260px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hero-tags a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* Portal homepage */
.portal { max-width: 720px; margin: 0 auto; padding: 48px 20px 64px; text-align: center; }
.portal-logo { margin-bottom: 28px; }
.portal-logo img { width: 180px; height: 180px; display: block; margin: 0 auto 18px; border-radius: 32px; border: 1px solid var(--border); }
.portal-logo h1 { font-size: clamp(42px, 7vw, 64px); margin: 0; letter-spacing: -0.03em; font-weight: 700; }
.portal-tagline { margin: 6px 0 0; font-size: 18px; color: var(--muted); }
.portal-search { display: flex; max-width: 560px; margin: 0 auto 36px; border: 1px solid #3b3d44; border-radius: 999px; overflow: hidden; background: #313338; box-shadow: 0 10px 28px rgba(0,0,0,0.45); transition: border-color .15s ease, box-shadow .15s ease; }
.portal-search:focus-within { border-color: #965cff; box-shadow: 0 10px 28px rgba(0,0,0,0.45), 0 0 0 3px rgba(150,92,255,0.28); }
.portal-search input { flex: 1; min-width: 0; border: none; padding: 16px 24px; font-size: 17px; outline: none; background: transparent; color: var(--text); }
.portal-search input::placeholder { color: #a4a7ae; }
.portal-search button { border: none; margin: 6px; padding: 0 26px; border-radius: 999px; background: #965cff; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; }
.portal-search button:hover { background: #a76fff; }
html[data-theme="light"] .portal-search { background: #ececf1; border-color: #d6d8de; box-shadow: 0 10px 28px rgba(0,0,0,0.12); }
html[data-theme="light"] .portal-search input::placeholder { color: #6b6f76; }
.portal-langs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 560px; margin: 0 auto 32px; text-align: center; }
.lang-link { display: flex; flex-direction: column; align-items: center; padding: 10px 12px; border-radius: 8px; color: var(--text); }
.lang-link:hover { background: var(--bg-soft); text-decoration: none; }
.lang-link strong { font-size: 15px; color: var(--accent); }
.lang-link span { font-size: 12.5px; color: var(--muted); }
.portal-stats { color: var(--muted); font-size: 14px; }
.portal-stats strong { color: var(--text); font-weight: 700; }
.portal-stats .dot { margin: 0 8px; color: #3f4451; }
.portal-stats a { font-weight: 600; }

/* Search page */
.search-hero { padding: 62px 20px 8px; text-align: center; }
.search-eyebrow { margin: 0 0 10px; font-size: 12.5px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: #965cff; }
.search-hero h1 { margin: 0 0 28px; font-size: clamp(36px, 5vw, 52px); letter-spacing: -0.03em; font-weight: 700; }
.search-hero .portal-search { margin-bottom: 18px; }
.search-meta { margin: 0; color: var(--muted); font-size: 14.5px; }
.search-suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 24px 0 0; }
.search-suggest a { padding: 7px 15px; border: 1px solid var(--border); border-radius: 999px; font-size: 13.5px; color: var(--muted); background: rgba(255, 255, 255, 0.02); }
.search-suggest a:hover { color: var(--text); border-color: #965cff; text-decoration: none; }
.search-results { padding: 32px 20px 56px; }
.search-results .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.search-results .card { flex-direction: row; align-items: stretch; }
.search-results .card-thumb { flex: 0 0 168px; aspect-ratio: auto; align-self: stretch; }
.search-results .card-thumb img { height: 100%; }
.search-results .card-body { flex: 1; min-width: 0; justify-content: center; }
.search-empty { border: 1px solid var(--border); border-radius: 16px; background: var(--bg-soft); padding: 36px 28px; text-align: center; }
.search-empty h2 { margin: 0 0 8px; font-size: 20px; color: var(--text); }
.search-empty p { margin: 0 auto 16px; max-width: 540px; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
html[data-theme="light"] .search-eyebrow { color: #6d3dff; }
html[data-theme="light"] .search-suggest a { background: #ffffff; }
@media (max-width: 820px) {
  .search-results .grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .search-hero { padding: 42px 20px 6px; }
  .search-hero h1 { margin-bottom: 22px; }
  .search-results .card-thumb { flex-basis: 116px; }
}

/* Search suggestions */
.portal-search.has-suggest { position: relative; overflow: visible; }
.suggest-box { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 70; background: #1e1f22; border: 1px solid #3b3d44; border-radius: 16px; padding: 6px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55); text-align: left; }
.header-search .suggest-box { left: auto; right: 0; width: 340px; }
.suggest-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text); }
.suggest-item:hover, .suggest-item.active { background: #313338; text-decoration: none; }
.suggest-kind { flex: 0 0 auto; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; }
.suggest-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
html[data-theme="light"] .suggest-box { background: #ffffff; border-color: #d6d8de; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16); }
html[data-theme="light"] .suggest-item:hover,
html[data-theme="light"] .suggest-item.active { background: #ececf1; }
@media (max-width: 560px) {
  .header-search .suggest-box { width: min(320px, calc(100vw - 40px)); }
}

/* Sections and cards */
.section { padding: 30px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
.see-all { font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  border: 1px solid var(--border); border-radius: 12px; padding: 0; overflow: hidden;
  display: flex; flex-direction: column; color: var(--text); background: var(--bg-soft);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; }
.card-thumb { display: block; aspect-ratio: 16 / 9; background: var(--bg-soft); }
.card-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
.card:hover { text-decoration: none; border-color: var(--accent); box-shadow: 0 2px 10px rgba(77, 140, 255, 0.12); }
.card h3 { margin: 0; font-size: 16.5px; line-height: 1.35; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-cat {
  color: var(--accent); background: var(--accent-soft); border-radius: 6px;
  padding: 2px 9px; font-size: 12px; font-weight: 600; align-self: flex-start;
}
.card-meta { color: #9aa0ae; font-size: 12.5px; }

.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cat-grid-wide { grid-template-columns: repeat(3, 1fr); }
.cat-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; color: var(--text); background: var(--bg-soft);
}
.cat-card:hover { text-decoration: none; border-color: var(--accent); }
.cat-card h3 { margin: 4px 0 6px; font-size: 16.5px; }
.cat-card p { margin: 0; color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-count { font-size: 12px; color: var(--muted); }
.discover-more { background: var(--bg-soft); border-radius: 14px; padding: 26px 28px !important; }
.discover-more h2 { margin-top: 0; }
.discover-more p { color: var(--muted); max-width: 640px; }
.btn {
  display: inline-block; background: var(--accent); color: #fff; border-radius: 9px;
  padding: 9px 20px; font-weight: 600; font-size: 14.5px;
}
.btn:hover { text-decoration: none; filter: brightness(0.94); }
.btn.ghost { background: var(--bg); color: var(--accent); border: 1px solid var(--accent); }

/* Explore / index pages: clean two-column, text-forward list */
.explore-layout {
  display: grid; grid-template-columns: 232px minmax(0, 1fr);
  gap: 40px; align-items: start; padding: 8px 0 46px;
}
.side-nav { position: sticky; top: 18px; min-width: 0; }
.side-nav h2 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); font-weight: 700; margin: 0 0 7px;
}
.side-nav ul { list-style: none; margin: 0 0 24px; padding: 0; }
.side-nav li { margin: 0; }
.side-nav a {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 6px 10px; border-radius: 7px; font-size: 14px; color: var(--text);
  line-height: 1.4;
}
.side-nav a:hover { background: var(--bg-soft); text-decoration: none; }
.side-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-nav .n {
  color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums;
  flex: none;
}
.side-nav a.active .n { color: var(--accent); opacity: 0.75; }

.list-main { min-width: 0; }
.list-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding-bottom: 9px;
  border-bottom: 1px solid var(--border); margin-bottom: 2px;
}
.list-count { color: var(--muted); font-size: 13.5px; }
.list-count strong { color: var(--text); font-weight: 600; }
.sort-links { display: flex; gap: 16px; font-size: 13.5px; }
.sort-links a { color: var(--muted); }
.sort-links a:hover { color: var(--text); text-decoration: none; }
.sort-links a.active { color: var(--accent); font-weight: 600; }

.article-list { list-style: none; margin: 0; padding: 0; }
.article-list li { padding: 17px 0; border-bottom: 1px solid var(--border); }
.article-list li:last-child { border-bottom: none; }
.list-title { margin: 0 0 5px; font-size: 18.5px; font-weight: 600; line-height: 1.32; letter-spacing: -0.01em; }
.list-title a { color: var(--text); }
.list-title a:hover { color: var(--accent); text-decoration: none; }
.list-desc { margin: 0 0 7px; color: #b7bcc7; font-size: 14.5px; line-height: 1.62; }
.list-meta {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  color: #9aa0ae; font-size: 12.5px;
}
.list-meta .cat { color: var(--accent); font-weight: 600; }
.list-meta .sep { color: #3f4451; }

/* Page heads and pagination */
.page-head { padding: 40px 0 8px; }
.page-head h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: -0.02em; }
.page-head p { margin: 0 0 10px; color: var(--muted); }
.pagination { display: flex; gap: 6px; margin: 26px 0; flex-wrap: wrap; }
.page-link {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 13px; font-size: 14px; color: var(--muted);
}
.page-link:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.page-link.current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Article page */
.breadcrumbs { padding: 18px 0 0; font-size: 13.5px; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
/* ---- Wikipedia-style article ---- */
.article-layout { padding-bottom: 44px; }
.article-layout.wiki-article {
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr) 152px;
  grid-template-areas: ". head head" "toc body side";
  column-gap: 28px;
  align-items: start;
}
.article-header { grid-area: head; padding: 16px 0 18px; }
.article-header h1 { font-size: clamp(26px, 3.4vw, 33px); line-height: 1.25; margin: 4px 0 3px; letter-spacing: -0.01em; font-weight: 700; }
.wiki-tagline { font-size: 13px; font-style: italic; color: var(--muted); margin: 0 0 10px; }
.article-meta { display: flex; gap: 6px 16px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; align-items: center; }
.article-body { grid-area: body; min-width: 0; max-width: 720px; }
.article-body h2 { font-size: 24px; font-weight: 700; margin: 1.9em 0 0.35em; padding-top: 0.3em; border-top: 1px solid rgba(162, 169, 177, 0.3); letter-spacing: normal; scroll-margin-top: 20px; }
.article-body h3 { font-size: 18.5px; font-weight: 700; margin: 1.4em 0 0.3em; padding-top: 0.3em; border-top: 1px solid rgba(162, 169, 177, 0.2); letter-spacing: normal; scroll-margin-top: 20px; }
.article-body p { margin: 0.55em 0; font-size: 16px; line-height: 1.62; }
.article-standfirst { color: var(--text); }
.article-body .article-standfirst { margin-top: 0; }
.article-body ul { padding-left: 1.4em; }
.article-body li { margin: 0.3em 0; font-size: 16px; line-height: 1.6; }
.article-body blockquote {
  margin: 1em 0; padding: 0.1em 0 0.1em 1.1em; border-left: 2px solid var(--border);
  background: none; border-radius: 0; color: var(--muted);
}
.table-wrap { overflow-x: auto; margin: 16px 0; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.table-wrap th, .table-wrap td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.table-wrap th { background: var(--bg-soft); }
sup.cite { line-height: 0; }
.cite a { color: var(--accent); font-size: 0.75em; text-decoration: none; }
.cite a:hover { text-decoration: underline; }

/* Contents (left sidebar, Wikipedia-style) */
.wiki-toc { grid-area: toc; position: sticky; top: 14px; font-size: 13.5px; line-height: 1.5; max-height: calc(100vh - 28px); overflow-y: auto; }
.wiki-toc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 7px; }
.toc-toggle { border: 1px solid var(--border); background: var(--bg-soft); color: var(--muted); font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 9px; cursor: pointer; line-height: 1.5; }
.toc-toggle:hover { color: var(--accent); border-color: var(--accent); }
.toc-tree, .toc-tree ol { list-style: none; counter-reset: toc; margin: 0; padding: 0; }
.toc-tree > li { counter-increment: toc; margin: 3px 0; }
.toc-tree > li > a::before { content: counter(toc) " "; color: var(--muted); }
.toc-tree > li.toc-top { counter-increment: none; }
.toc-tree > li.toc-top > a::before { content: none; }
.toc-tree ol { counter-reset: tocs; padding-left: 15px; }
.toc-tree ol li { counter-increment: tocs; margin: 2px 0; }
.toc-tree ol li > a::before { content: counter(tocs, lower-alpha) " "; color: var(--muted); }
.wiki-toc a { color: var(--text); }
.wiki-toc a:hover { color: var(--accent); text-decoration: none; }
.wiki-toc .toc-tree { display: none; }
.wiki-toc.open .toc-tree { display: block; }

/* Right panel (Appearance / status) */
.wiki-side { grid-area: side; position: sticky; top: 14px; }
.side-sec { margin-bottom: 8px; }
.side-head { font-weight: 700; font-size: 12.5px; letter-spacing: 0.02em; padding-bottom: 5px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.side-group { margin-bottom: 9px; }
.side-label { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.wiki-side p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }

/* Segmented reader controls */
.seg { display: flex; gap: 4px; }
.seg button {
  flex: 1; min-width: 0; border: 1px solid var(--border); background: transparent; color: var(--muted);
  font-family: inherit; font-size: 11.5px; line-height: 1.4; padding: 3px 2px; border-radius: 6px; cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.seg button:hover { color: var(--text); border-color: var(--muted); }
.seg button.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Article status (collapsed) */
.status-details { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.status-details summary { cursor: pointer; list-style: none; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.status-details summary::-webkit-details-marker { display: none; }
.status-details summary::before { content: "\25B8 "; }
.status-details[open] summary::before { content: "\25BE "; }
.status-details summary:hover { color: var(--accent); }
.status-details p { font-size: 11.5px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }

/* FAQ — plain, no cards */
.faq { margin-top: 1.6em; }
.faq-item { margin: 1em 0; }
.faq-item h3 { margin: 1em 0 0.2em; }
.faq-item p { margin: 0; }

/* References */
.refs { margin-top: 2em; }
.refs ol { padding-left: 1.6em; color: var(--muted); font-size: 14px; line-height: 1.55; }
.refs li { margin: 0.35em 0; }
.ref-domain { color: #b7bcc7; font-weight: 600; }
.refs a { word-break: break-word; }

/* See also */
.related { margin-top: 1.6em; }
.see-also { margin: 0.4em 0 0; font-size: 16px; line-height: 1.75; }
.see-also .sep { color: var(--muted); }
.see-also .pending { color: #9aa0ae; }

/* Infobox (right-floated, Wikipedia-style) */
.infobox {
  float: left; clear: left; width: 300px; max-width: 46%;
  margin: 0 1.6em 1.2em 0; padding: 0;
  border: 1px solid rgba(162, 169, 177, 0.4); border-radius: 3px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 13.5px; line-height: 1.5;
}
.infobox img { display: block; width: 100%; height: auto; }
.infobox .ib-caption { padding: 0.45em 0.75em; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.45; }
.infobox .ib-caption a { color: var(--accent); text-decoration: underline; }
.infobox .ib-list { list-style: disc; margin: 0; padding: 0.55em 0.75em 0.6em 1.7em; }
.infobox .ib-list li { font-size: 12.5px; margin: 0.3em 0; line-height: 1.5; }

.article-translate { position: relative; display: inline-block; }
.article-translate summary { list-style: none; cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; }
.article-translate summary::-webkit-details-marker { display: none; }
.article-translate summary span { border-bottom: 1px dashed var(--accent); }
.article-translate[open] summary span { border-bottom-style: solid; }
.lang-list { position: absolute; z-index: 10; right: 0; top: calc(100% + 6px); width: 220px; max-height: 320px; overflow-y: auto; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,0.65); display: flex; flex-direction: column; padding: 6px 0; }
.lang-list a { padding: 5px 14px; font-size: 13px; color: var(--text); }
.lang-list a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
html[data-fs="small"] .article-body p { font-size: 14.5px; line-height: 1.65; }
html[data-fs="small"] .article-body li { font-size: 14px; line-height: 1.55; }
html[data-fs="large"] .article-body p { font-size: 18.5px; line-height: 1.85; }
html[data-fs="large"] .article-body li { font-size: 18px; line-height: 1.75; }
html[data-fs="large"] .article-body h2 { font-size: 27px; }
html[data-fs="large"] .article-body h3 { font-size: 21px; }
.infobox h2 { font-size: 15px; font-weight: 700; text-align: center; margin: 0; padding: 0.5em 0.75em; background: rgba(255, 255, 255, 0.05); border-top: none; border-bottom: 1px solid rgba(162, 169, 177, 0.25); color: var(--text); letter-spacing: normal; text-transform: none; }
.infobox dl { margin: 0; display: grid; grid-template-columns: 38% 62%; gap: 0; }
.infobox dt { font-size: 12.5px; font-weight: 700; color: #d6dae1; margin: 0; padding: 0.42em 0.2em 0.42em 0.75em; text-transform: none; letter-spacing: normal; }
.infobox dd { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text); padding: 0.42em 0.75em 0.42em 0.2em; }

/* Static prose pages */
.prose { max-width: 720px; padding-bottom: 50px; }
.prose h2 { font-size: 21px; margin: 26px 0 8px; }
.prose p, .prose li { font-size: 15.5px; line-height: 1.7; color: #b7bcc7; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; background: var(--bg-soft); }
.footer-cols { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 44px; padding: 44px 20px 34px; }
.footer-brandcol { max-width: 380px; display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.footer-brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; margin: 0; color: var(--text); }
.footer-brand:hover { color: var(--accent); }
.footer-mark { display: block; width: 22px; height: 22px; border-radius: 6px; }
.footer-brandcol p { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin: 5px 0 0; }
.footer-nav { display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.footer-nav h3 { margin: 0 0 3px; font-size: 11.5px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--text); }
.footer-nav a { color: var(--muted); }
.footer-nav a:hover { color: var(--accent); }
.footer-legal { border-top: 1px solid var(--border); padding: 18px 20px 26px; }
.footer-legal p { color: #9aa0ae; font-size: 12.5px; margin: 0; }
.footer-legal a { color: var(--muted); }
.footer-legal a:hover { color: var(--accent); }
@media (max-width: 820px) {
  .footer-cols { grid-template-columns: 1fr 1fr; gap: 30px 24px; padding: 34px 20px 26px; }
  .footer-brandcol { grid-column: 1 / -1; max-width: none; }
}

/* Responsive */
@media (max-width: 1180px) {
  .article-layout.wiki-article { grid-template-columns: 164px minmax(0, 1fr); grid-template-areas: "head head" "toc body"; }
  .wiki-side { display: none; }
}
@media (max-width: 940px) {
  .grid, .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .explore-layout { grid-template-columns: 1fr; gap: 26px; }
  .side-nav { position: static; }
  .side-nav ul { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 18px; }
  .side-nav li { flex: 0 0 auto; }
  .side-nav a { padding: 5px 11px; background: var(--bg-soft); border-radius: 999px; font-size: 13px; }
  .side-nav a.active { background: var(--accent-soft); }
  .side-nav .n { margin-left: 4px; }
  .article-layout.wiki-article { grid-template-columns: 1fr; grid-template-areas: "head" "toc" "body" "side"; row-gap: 4px; }
  .wiki-toc { position: static; max-height: none; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); padding: 10px 14px 12px; margin: 4px 0 10px; }
  .infobox { float: none; width: 100%; max-width: 100%; margin: 0 0 1.2em; }
  .wiki-side { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 22px; padding-top: 6px; margin-top: 8px; border-top: 1px solid var(--border); }
  .main-nav { display: none; }
  .portal-langs { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .grid, .cat-grid, .cat-grid-wide { grid-template-columns: 1fr; }
  .header-search input { width: 140px; }
  .header-search input:focus { width: 170px; }
  .hero { padding: 44px 0 36px; }
  .footer-cols { grid-template-columns: 1fr; }
  .article-body p { font-size: 15.5px; }
  .wiki-side { grid-template-columns: 1fr; }
}

/* ---- Wikipedia-style portal ---- */
.wiki-pyramid { position: relative; display: flex; flex-direction: column; gap: 18px; max-width: 1020px; margin: 44px auto; }
.wiki-row { display: flex; align-items: flex-start; }
.wiki-row-side { display: flex; gap: 26px; flex: 1; min-width: 0; }
.wiki-row-side:first-child { justify-content: flex-end; }
.wiki-row-side:last-child { justify-content: flex-start; }
.wiki-row-gap { width: 230px; flex: none; }
.wiki-lang { display: block; padding: 4px 6px; border-radius: 8px; text-align: center; }
.wiki-lang:hover { background: var(--bg-soft); text-decoration: none; }
.wiki-lang strong { display: block; font-size: 17px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.wiki-lang span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.wiki-lang:hover strong { text-decoration: underline; }
.wiki-globe { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 170px; height: 170px; border-radius: 50%; border: 1px solid var(--border); box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45); object-fit: cover; }
.wiki-sister { display: flex; flex-wrap: nowrap; gap: 4px; width: min(1080px, calc(100vw - 32px)); max-width: none; margin: 46px 0 0 50%; transform: translateX(-50%); text-align: left; }
.wiki-sister a { flex: 1 1 0; min-width: 0; display: flex; align-items: flex-start; gap: 10px; padding: 12px 10px; border-radius: 10px; color: var(--text); }
.wiki-sister a:hover { background: var(--bg-soft); text-decoration: none; }
.ws-icon { font-size: 24px; line-height: 1; flex: none; }
.ws-text strong { display: block; color: var(--accent); font-size: 14.5px; font-weight: 600; }
.ws-text small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
@media (max-width: 700px) {
  .wiki-pyramid { gap: 14px; }
  .wiki-row { flex-wrap: wrap; justify-content: center; gap: 8px 16px; }
  .wiki-row-side { flex: none; flex-wrap: wrap; justify-content: center; gap: 8px 16px; }
  .wiki-row-side:first-child, .wiki-row-side:last-child { justify-content: center; }
  .wiki-row-gap { display: none; }
  .wiki-globe { position: static; transform: none; width: 130px; height: 130px; margin: 0 auto 4px; order: -1; }
  .wiki-sister { flex-wrap: wrap; }
  .wiki-sister a { flex: 1 1 30%; }
}

/* ---- Reader options: width + serif ---- */
html[data-width="wide"] .article-layout.wiki-article { max-width: 1340px; }
html[data-width="wide"] .article-body { max-width: 920px; }
html[data-font="serif"] .article-body { font-family: Georgia, "Times New Roman", Times, serif; }

/* ---- Light theme ---- */
html[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f6f7f8;
  --text: #202122;
  --muted: #54595d;
  --border: #c8ccd1;
  --accent: #3366cc;
  --accent-soft: #eaf3ff;
  color-scheme: light;
}
html[data-theme="light"] .site-footer { background: #f6f7f8; }
html[data-theme="light"] .article-body h2,
html[data-theme="light"] .article-body h3 { border-top-color: #c8ccd1; }
html[data-theme="light"] .infobox { background: rgba(0, 0, 0, 0.03); border-color: #a2a9b1; }
html[data-theme="light"] .infobox h2 { background: rgba(0, 0, 0, 0.045); border-bottom-color: #c8ccd1; color: #202122; }
html[data-theme="light"] .infobox dt { color: #202122; }
html[data-theme="light"] .ref-domain,
html[data-theme="light"] .list-desc,
html[data-theme="light"] .prose p,
html[data-theme="light"] .prose li { color: #54595d; }
html[data-theme="light"] .card-meta,
html[data-theme="light"] .list-meta,
html[data-theme="light"] .see-also .pending,
html[data-theme="light"] .footer-legal p,
html[data-theme="light"] .header-search input::placeholder { color: #72777d; }
html[data-theme="light"] .toc-toggle,
html[data-theme="light"] .seg button { background: #ffffff; }
html[data-theme="light"] .lang-list { background: #ffffff; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); }
html[data-theme="light"] code { background: #f6f7f8; border-color: #c8ccd1; }
html[data-theme="light"] ::selection { background: #3366cc; color: #fff; }

/* ---- Interactive language globe (home) ---- */
.globe-wrap { max-width: 660px; margin: 30px auto 6px; }
.globe-stage { position: relative; width: min(100%, 520px); margin: 0 auto; aspect-ratio: 1 / 1; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.globe-stage.is-dragging { cursor: grabbing; }
.globe-canvas { display: none; position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 24px 38px rgba(0, 0, 0, 0.55)); }
.globe-stage.globe-on .globe-canvas { display: block; }
.globe-tiles { position: relative; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.globe-stage.globe-on .globe-tiles { position: absolute; inset: 0; display: block; }
.g-lang { display: inline-block; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(11, 11, 16, 0.78); color: var(--text); font-size: 13px; line-height: 1.5; font-weight: 600; text-decoration: none; white-space: nowrap; transition: opacity 120ms linear, background 120ms ease, border-color 120ms ease, color 120ms ease; }
.globe-stage.globe-on .g-lang { position: absolute; left: 0; top: 0; opacity: 0; will-change: transform, opacity; }
.g-lang:hover, .g-lang:focus-visible { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; outline: none; }
html[data-theme="light"] .g-lang { background: rgba(255, 255, 255, 0.82); border-color: rgba(0, 0, 0, 0.12); }
.globe-hint { margin: 6px auto 30px; text-align: center; font-size: 13px; color: var(--muted); }
@media (max-width: 560px) {
  .globe-wrap { margin-top: 20px; }
  .g-lang { font-size: 12px; padding: 3px 8px; }
  .portal-search input { padding: 14px 18px; font-size: 16px; }
  .portal-search button { padding: 0 18px; font-size: 15px; }
}

/* Home space backdrop: pure black + drifting stars, down to the footer */
.space-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 44% at 50% 30%, rgba(103,52,214,0.16), rgba(0,0,0,0) 70%),
    radial-gradient(80% 34% at 50% 102%, rgba(74,44,140,0.10), rgba(0,0,0,0) 70%),
    #000;
}
.space-bg::before, .space-bg::after { content: ""; position: absolute; inset: 0; background-repeat: repeat;  }
.space-bg::before { background-image: url(/assets/stars-far.png); background-size: 640px 640px; opacity: .55;  }
.space-bg::after { background-image: url(/assets/stars-near.png); background-size: 1080px 1080px; opacity: .9; animation: spaceTwinkle 7s ease-in-out infinite alternate; }
@keyframes spaceTwinkle { from { opacity: .82; } to { opacity: 1; } }
html[data-theme="dark"] body:has(.space-bg) { background: #000; }
html[data-theme="light"] .space-bg { display: none; }
@media (prefers-reduced-motion: reduce) {
  .space-bg::before, .space-bg::after { animation: none; }
}


/* ===== HUNT: full-screen shorts-style knowledge feed ===== */
body:has(.hunt-feed) { margin: 0; background: #000; }
body:has(.hunt-feed) .site-header,
body:has(.hunt-feed) .site-footer { display: none; }
body:has(.hunt-feed) main { margin: 0; padding: 0; max-width: none; }

.hunt-feed {
  height: 100vh;
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  background: #000;
}
.hunt-feed::-webkit-scrollbar { display: none; }

.hunt-card {
  position: relative;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #0b0b10;
}
.hunt-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hunt-noimg {
  background: radial-gradient(circle at 50% 40%, #2a2350, #0b0b10 70%);
}
.hunt-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    rgba(0,0,0,.45) 0%,
    rgba(0,0,0,.05) 30%,
    rgba(0,0,0,.35) 55%,
    rgba(0,0,0,.88) 85%,
    #000 100%);
  pointer-events: none;
}
.hunt-wordmark {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 2px;
  text-shadow: 0 2px 12px rgba(0,0,0,.7);
  z-index: 3;
}
.hunt-flame { font-size: 22px; filter: drop-shadow(0 2px 8px rgba(123,63,242,.9)); }
.hunt-content {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0 26px max(30px, env(safe-area-inset-bottom));
  color: #fff;
  text-decoration: none;
  z-index: 2;
}
.hunt-cat {
  display: inline-block;
  color: #c9b8ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.hunt-content h2 {
  margin: 0 0 10px;
  font-size: clamp(26px, 6vw, 40px);
  line-height: 1.12;
  font-weight: 800;
  max-width: 720px;
  text-shadow: 0 2px 16px rgba(0,0,0,.75);
}
.hunt-content p {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255,255,255,.9);
  max-width: 640px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hunt-btn {
  display: inline-block;
  background: #fff;
  color: #0b0b10;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 999px;
  text-decoration: none;
}
.hunt-more {
  position: fixed;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 10;
  background: rgba(123,63,242,.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(0,0,0,.5);
}
@media (max-width: 600px) {
  .hunt-content h2 { font-size: 26px; }
  .hunt-content { padding: 0 20px max(24px, env(safe-area-inset-bottom)); }
}

/* Wider article reading area */
.article-layout.wiki-article { max-width: 1480px; }
.article-body { max-width: 980px; }
.article-body p, .article-body li { font-size: 17px; line-height: 1.75; }
