/* Namuwiki-inspired theme stylesheet for Qpocalypse 1.8 Wiki (qpclps.xyz) */

:root {
  --brand: #00a495;
  --brand-dark: #008275;
  --brand-soft: #e6f6f4;
  --bg-page: #efefef;
  --bg-card: #ffffff;
  --bg-sub: #f7f8f9;
  --bg-quote: #f4f6f5;
  --bg-hover: #f1f5f4;
  --text-main: #212529;
  --text-sub: #555e67;
  --text-muted: #76808a;
  --border: #d5d9dd;
  --border-light: #e7eaed;
  --link: #0275d8;
  --link-hover: #014c8c;
  --link-missing: #c9302c;
  --del-text: #8c959f;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-pop: 0 6px 22px rgba(0, 0, 0, 0.16);
  --radius: 4px;
  --font-sans: "Pretendard", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
  --brand: #00a495;
  --brand-dark: #00c4b2;
  --brand-soft: #1a2d2b;
  --bg-page: #18191b;
  --bg-card: #212327;
  --bg-sub: #282b30;
  --bg-quote: #252a29;
  --bg-hover: #2d3138;
  --text-main: #e4e6eb;
  --text-sub: #b0b6be;
  --text-muted: #8a929c;
  --border: #3a3e45;
  --border-light: #2e3238;
  --link: #58a6ff;
  --link-hover: #8ac0ff;
  --link-missing: #f27474;
  --del-text: #7b838d;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 8px 28px rgba(0, 0, 0, 0.55);
}

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

html {
  scroll-behavior: smooth;
  font-size: 15px;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
}

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

/* Header */
.nw-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
}

[data-theme="dark"] .nw-header {
  background: #23272c;
  border-bottom: 2px solid var(--brand);
}

.nw-header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 16px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.nw-brand-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nw-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nw-logo:hover {
  color: #ffffff;
  text-decoration: none;
  opacity: 0.92;
}

.nw-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  font-size: 1rem;
  font-weight: 900;
}

[data-theme="dark"] .nw-logo-mark {
  background: var(--brand);
  border-color: var(--brand);
}

.nw-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nw-nav-link {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.nw-nav-link:hover,
.nw-nav-link.active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  text-decoration: none;
}

.nw-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.nw-header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 390px;
  justify-content: flex-end;
}

.nw-search-form {
  position: relative;
  display: flex;
  flex: 1;
  max-width: 340px;
}

.nw-search-input {
  width: 100%;
  height: 34px;
  padding: 0 38px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  background: #ffffff;
  color: #212529;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}

[data-theme="dark"] .nw-search-input {
  background: #181a1e;
  color: var(--text-main);
  border-color: var(--border);
}

.nw-search-input:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.nw-search-btn {
  position: absolute;
  right: 0;
  top: 0;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: #495057;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .nw-search-btn {
  color: var(--text-sub);
}

.nw-search-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  max-height: 360px;
  overflow-y: auto;
  z-index: 200;
}

.nw-suggest-item {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  text-decoration: none;
}

.nw-suggest-item:last-child {
  border-bottom: none;
}

.nw-suggest-item:hover,
.nw-suggest-item.active {
  background: var(--bg-hover);
  text-decoration: none;
}

.nw-suggest-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
}

.nw-suggest-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.nw-theme-btn {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nw-theme-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Main two-column shell */
.nw-shell {
  max-width: 1320px;
  margin: 16px auto 40px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 275px;
  gap: 16px;
  align-items: start;
}

.nw-main {
  min-width: 0;
}

.nw-article {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px 36px;
  box-shadow: var(--shadow);
}

/* Document header */
.nw-doc-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.nw-doc-title {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--text-main);
}

.nw-doc-title-sub {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}

.nw-doc-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nw-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sub);
  color: var(--text-sub);
  cursor: pointer;
  font-family: inherit;
}

.nw-pill-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

/* Namuwiki category bar */
.nw-cat-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sub);
  font-size: 0.86rem;
}

.nw-cat-label {
  color: var(--text-sub);
  font-weight: 700;
  margin-right: 4px;
}

.nw-cat-chip {
  color: var(--link);
  font-weight: 500;
}

.nw-cat-sep {
  color: var(--border);
  user-select: none;
}

/* Redirect notice */
.nw-redirect-note {
  padding: 8px 12px;
  margin-bottom: 14px;
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  font-size: 0.88rem;
  color: var(--text-sub);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Hero banner on main page */
.nw-hero {
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-soft) 0%, var(--bg-sub) 100%);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.nw-hero-kicker {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-dark);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.nw-hero-title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

.nw-hero-desc {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-sub);
}

/* Top layout: TOC + Infobox */
.nw-top-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
}

/* Namuwiki Table of Contents */
.nw-toc {
  display: inline-block;
  min-width: 240px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sub);
  padding: 12px 18px 14px;
  font-size: 0.9rem;
}

.nw-toc-title {
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--text-main);
}

.nw-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nw-toc-item {
  margin: 3px 0;
}

.nw-toc-item.lvl-3 {
  padding-left: 16px;
  font-size: 0.87rem;
}

.nw-toc-num {
  color: var(--link);
  font-weight: 700;
  margin-right: 4px;
}

/* Namuwiki Infobox */
.nw-infobox {
  width: 310px;
  max-width: 100%;
  margin-left: auto;
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
}

.nw-infobox-head {
  background: var(--brand);
  color: #ffffff;
  padding: 10px 12px;
  text-align: center;
}

.nw-infobox-title {
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.3;
}

.nw-infobox-sub {
  font-size: 0.78rem;
  opacity: 0.9;
  margin-top: 2px;
}

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

.nw-infobox-table th,
.nw-infobox-table td {
  padding: 7px 10px;
  border-top: 1px solid var(--border-light);
  vertical-align: top;
  text-align: left;
  line-height: 1.5;
}

.nw-infobox-table th {
  width: 34%;
  background: var(--brand-soft);
  color: var(--text-main);
  font-weight: 700;
  border-right: 1px solid var(--border-light);
}

.nw-infobox-media {
  padding: 8px;
  background: var(--bg-sub);
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.nw-infobox-media img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 3px;
  background: #14171a;
  cursor: zoom-in;
}

.nw-infobox-media.light-bg img {
  background: var(--bg-card);
}

.nw-infobox-caption {
  margin-top: 5px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Figures & Screenshot Galleries */
.nw-figure {
  margin: 14px 0 18px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sub);
  text-align: center;
}

.nw-figure img {
  display: block;
  max-width: 100%;
  max-height: 440px;
  width: auto;
  margin: 0 auto;
  border-radius: 3px;
  cursor: zoom-in;
  box-shadow: var(--shadow);
}

.nw-figure figcaption {
  margin-top: 7px;
  font-size: 0.84rem;
  color: var(--text-sub);
  line-height: 1.45;
}

.nw-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.nw-gallery .nw-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.nw-gallery .nw-figure img {
  width: 100%;
  height: 195px;
  object-fit: cover;
  background: #14171a;
}

.nw-gallery.contain .nw-figure img {
  object-fit: contain;
  background: #14171a;
}

/* Image Lightbox */
.nw-lightbox[hidden] {
  display: none;
}

.nw-lightbox {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.nw-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
}

.nw-lightbox-content {
  position: relative;
  z-index: 1;
  max-width: min(94vw, 1140px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

.nw-lightbox-content img {
  max-width: 100%;
  max-height: calc(88vh - 54px);
  object-fit: contain;
  border-radius: 3px;
  background: #101214;
}

.nw-lightbox-caption {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text-main);
  text-align: center;
}

.nw-lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  background: var(--brand);
  color: #ffffff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.nw-lightbox-close:hover {
  background: var(--brand-dark);
}

/* Headings with Namuwiki folding */
.nw-sec-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 26px 0 12px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.nw-sec-head.lvl-2 {
  font-size: 1.38rem;
  font-weight: 800;
}

.nw-sec-head.lvl-3 {
  font-size: 1.14rem;
  font-weight: 700;
  margin-top: 18px;
  border-bottom-style: dashed;
}

.nw-sec-toggle {
  font-size: 0.72rem;
  color: var(--text-muted);
  width: 16px;
  display: inline-flex;
  justify-content: center;
  transition: transform 0.15s;
}

.nw-sec-head.collapsed .nw-sec-toggle {
  transform: rotate(-90deg);
}

.nw-sec-num {
  color: var(--link);
  font-weight: 800;
}

.nw-sec-body.collapsed {
  display: none;
}

/* Prose elements */
.nw-p {
  margin: 0 0 12px;
  word-break: keep-all;
}

.nw-ul {
  margin: 6px 0 14px;
  padding-left: 22px;
}

.nw-ul li {
  margin: 5px 0;
  word-break: keep-all;
}

.nw-ul .nw-ul {
  margin: 4px 0 6px;
}

.nw-quote {
  margin: 12px 0 14px;
  padding: 11px 16px;
  border: 1px dashed var(--border);
  border-left: 5px solid var(--brand);
  background: var(--bg-quote);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-main);
  font-size: 0.94rem;
}

.nw-quote p {
  margin: 0;
}

.nw-quote p + p {
  margin-top: 6px;
}

.nw-del {
  color: var(--del-text);
  text-decoration: line-through;
}

.nw-code {
  display: inline-block;
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.86em;
  background: var(--bg-sub);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-main);
}

/* Wiki link styles */
.nw-wlink {
  color: var(--link);
  font-weight: 500;
}

.nw-wlink.missing {
  color: var(--link-missing);
}

/* Footnotes */
.nw-fn-ref {
  font-size: 0.76em;
  vertical-align: super;
  margin-left: 1px;
  cursor: pointer;
  color: var(--link);
  font-weight: 700;
}

.nw-fn-section {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-sub);
}

.nw-fn-item {
  margin: 4px 0;
}

.nw-fn-back {
  color: var(--link);
  font-weight: 700;
  margin-right: 6px;
  cursor: pointer;
}

/* Namuwiki collapsible Navbox */
.nw-navbox {
  margin: 22px 0 8px;
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  font-size: 0.88rem;
}

.nw-navbox-head {
  background: var(--brand);
  color: #ffffff;
  padding: 8px 14px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.nw-navbox-toggle {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
}

.nw-navbox-body.collapsed {
  display: none;
}

.nw-navbox-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  border-top: 1px solid var(--border-light);
}

.nw-navbox-group {
  background: var(--brand-soft);
  padding: 8px 10px;
  font-weight: 700;
  color: var(--text-main);
  border-right: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.nw-navbox-items {
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
}

.nw-navbox-items .nw-wlink.current {
  color: var(--text-main);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: var(--brand);
}

.nw-dot-sep {
  color: var(--border);
  font-size: 0.75rem;
  user-select: none;
}

/* Portal quick grid on main page */
.nw-portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 12px;
  margin: 14px 0 8px;
}

.nw-portal-card {
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand);
  border-radius: var(--radius);
  background: var(--bg-sub);
  padding: 12px 14px;
}

.nw-portal-card-title {
  margin: 0 0 6px;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
}

.nw-portal-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 0.87rem;
}

/* Category & Index pages */
.nw-cat-summary {
  margin-bottom: 16px;
  color: var(--text-sub);
  font-size: 0.92rem;
}

.nw-alpha-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.nw-alpha-group {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--bg-sub);
}

.nw-alpha-letter {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--brand-dark);
  border-bottom: 2px solid var(--brand);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.nw-alpha-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nw-alpha-list li {
  margin: 4px 0;
  font-size: 0.92rem;
}

.nw-cat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.nw-cat-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  background: var(--bg-sub);
  color: var(--text-main);
  font-weight: 700;
}

.nw-cat-card:hover {
  background: var(--bg-hover);
  text-decoration: none;
}

.nw-cat-count {
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

/* Search results */
.nw-search-result {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.nw-search-result-title {
  font-size: 1.06rem;
  font-weight: 700;
}

.nw-search-result-snippet {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--text-sub);
}

.nw-mark {
  background: #fff3b0;
  color: #111;
  padding: 0 2px;
  border-radius: 2px;
}

[data-theme="dark"] .nw-mark {
  background: #665200;
  color: #fff;
}

/* Sidebar */
.nw-sidebar {
  position: sticky;
  top: 68px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.nw-side-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.nw-side-head {
  padding: 8px 12px;
  background: var(--bg-sub);
  border-bottom: 1px solid var(--border);
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--text-main);
}

.nw-side-body {
  padding: 10px 12px;
  font-size: 0.86rem;
}

.nw-side-toc {
  max-height: 290px;
  overflow-y: auto;
}

.nw-side-toc a {
  display: block;
  padding: 3px 4px;
  color: var(--text-sub);
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nw-side-toc a:hover {
  background: var(--bg-hover);
  color: var(--link);
  text-decoration: none;
}

.nw-side-toc a.lvl-3 {
  padding-left: 16px;
  font-size: 0.82rem;
}

.nw-side-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nw-side-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-sub);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
}

.nw-side-cat-pill:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  text-decoration: none;
}

.nw-side-links a {
  display: block;
  padding: 4px 2px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nw-side-links a:last-child {
  border-bottom: none;
}

.nw-side-links a:hover {
  color: var(--link);
}

/* Popover for footnotes & link previews */
.nw-popover {
  position: fixed;
  z-index: 500;
  max-width: 360px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-main);
}

.nw-popover-head {
  font-weight: 800;
  color: var(--brand-dark);
  margin-bottom: 4px;
  font-size: 0.88rem;
}

/* Floating up/down buttons */
.nw-float-btns {
  position: fixed;
  right: 18px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 90;
}

.nw-float-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-sub);
  cursor: pointer;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
}

.nw-float-btn:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

/* Footer */
.nw-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  padding: 20px 16px;
  margin-top: 24px;
}

.nw-footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.nw-footer-brand {
  margin: 0 0 4px;
  color: var(--text-sub);
}

.nw-footer-note {
  margin: 0;
}

/* Responsive layout */
@media (max-width: 980px) {
  .nw-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .nw-sidebar {
    position: static;
  }
}

@media (max-width: 680px) {
  .nw-header-inner {
    padding: 8px 12px;
  }
  .nw-header-tools {
    max-width: 100%;
    width: 100%;
  }
  .nw-search-form {
    max-width: 100%;
  }
  .nw-article {
    padding: 16px 14px 28px;
  }
  .nw-doc-title {
    font-size: 1.5rem;
  }
  .nw-infobox {
    width: 100%;
    margin-left: 0;
  }
  .nw-navbox-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .nw-navbox-group {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    justify-content: flex-start;
  }
}
