/* =========================================================
   Authentic Namuwiki (Senkawa Skin) Stylesheet
   ========================================================= */

:root {
  --brand: #00a495;
  --brand-dark: #008275;
  --header-bg: #00a495;
  --brand-soft: #eef8f7;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-sub: #f9f9f9;
  --border: #cccccc;
  --border-light: #e5e5e5;
  --text: #212529;
  --text-muted: #666666;
  --link: #0275d8;
  --link-hover: #014c8c;
  --link-red: #ff0000;
  --link-ext: #009900;
  --strike: #888888;
  --code-bg: #f4f4f4;
  --quote-bg: #eeeeee;
  --quote-border: #71bc6d;
  --table-head: #f5f5f5;
  --table-head-text: #212529;
  --diff-add-bg: #e6ffec;
  --diff-add-text: #1a7f37;
  --diff-del-bg: #ffebe9;
  --diff-del-text: #cf222e;
  --shadow-pop: 0 3px 12px rgba(0, 0, 0, 0.16);
  --font-sans: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "D2Coding", Consolas, monospace;
}

[data-theme="dark"] {
  --brand: #00a495;
  --brand-dark: #008275;
  --header-bg: #2d2f34;
  --brand-soft: #1f2b2a;
  --bg: #000000;
  --surface: #1c1d1f;
  --surface-sub: #232528;
  --border: #383b40;
  --border-light: #2c2e33;
  --text: #dddddd;
  --text-muted: #999999;
  --link: #ec9f19;
  --link-hover: #f5b94c;
  --link-red: #e05252;
  --link-ext: #4cd964;
  --strike: #777777;
  --code-bg: #2a2c30;
  --quote-bg: #26282c;
  --quote-border: #00a495;
  --table-head: #2a2c30;
  --table-head-text: #dddddd;
  --diff-add-bg: rgba(46, 160, 67, 0.2);
  --diff-add-text: #7ee787;
  --diff-del-bg: rgba(248, 81, 73, 0.2);
  --diff-del-text: #ffa198;
  --shadow-pop: 0 4px 16px rgba(0, 0, 0, 0.6);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14.4px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.nw-svg {
  width: 15px;
  height: 15px;
  display: inline-block;
  vertical-align: -2px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ---------------- Top Navbar (Senkawa 44px flat bar) ---------------- */

.nw-header {
  background: var(--header-bg);
  color: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.nw-header-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 14px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nw-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  padding: 6px 6px 6px 0;
  white-space: nowrap;
}

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

.nw-brand-leaf {
  width: 22px;
  height: 22px;
  fill: #ffffff;
}

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

.nw-nav-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.nw-nav-btn:hover { background: rgba(0, 0, 0, 0.1); }

.nw-dropdown { position: relative; }

.nw-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 175px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  padding: 4px 0;
  display: none;
  z-index: 300;
}

.nw-dropdown.open .nw-dropdown-menu { display: block; }

.nw-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--text);
}

.nw-dropdown-item:hover { background: var(--surface-sub); color: var(--brand); }
.nw-dropdown-sep { height: 1px; background: var(--border-light); margin: 4px 0; }

/* Search Bar (Namuwiki sharp style) */
.nw-search-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.nw-search-box {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.16);
  width: 270px;
  height: 30px;
}

.nw-search-rand {
  background: var(--surface-sub);
  border: none;
  border-right: 1px solid var(--border-light);
  color: var(--text-muted);
  height: 100%;
  padding: 0 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.nw-search-rand:hover { color: var(--brand); background: var(--bg); }

.nw-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding: 0 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.86rem;
}

.nw-search-input::placeholder { color: var(--text-muted); }

.nw-search-btn {
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-light);
  height: 100%;
  padding: 0 8px;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
}

.nw-search-btn:hover { color: var(--brand); background: var(--surface-sub); }

.nw-user-avatar {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  height: 30px;
  padding: 0 9px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.nw-user-avatar:hover { background: rgba(255, 255, 255, 0.26); }

.nw-autocomplete {
  position: absolute;
  top: 32px;
  left: 0;
  width: 270px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  max-height: 320px;
  overflow-y: auto;
  display: none;
  z-index: 350;
}

.nw-autocomplete.open { display: block; }

.nw-ac-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 7px 11px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.86rem;
  color: var(--text);
}

.nw-ac-item:last-child { border-bottom: none; }
.nw-ac-item:hover { background: var(--surface-sub); color: var(--brand); }

/* Notice Bar */
.nw-notice-bar {
  background: var(--brand-soft);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.86rem;
}

.nw-notice-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 7px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------------- Main 2-Column Container ---------------- */

.nw-container {
  max-width: 1300px;
  margin: 14px auto 40px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 275px;
  gap: 14px;
  align-items: start;
}

.nw-main {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 20px 24px 32px;
  min-width: 0;
}

/* ---------------- Document Header (Classic Namuwiki) ---------------- */

.nw-doc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.nw-doc-title {
  margin: 0;
  font-size: 2.05rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  word-break: break-word;
}

.nw-doc-title-ns { color: var(--text-muted); font-weight: 600; }

.nw-doc-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.nw-doc-meta-right { margin-left: auto; }

.nw-action-group {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  background: var(--surface);
}

.nw-action-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nw-action-btn:last-child { border-right: none; }
.nw-action-btn:hover { background: var(--surface-sub); }
.nw-action-btn.active { background: var(--brand); color: #ffffff; }
.nw-action-btn.starred { color: #e6a100; font-weight: 700; }
.nw-action-btn.danger:hover { background: var(--diff-del-bg); color: var(--link-red); }

.nw-acl-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border: 1px solid var(--brand);
  color: var(--brand);
  vertical-align: middle;
  margin-left: 8px;
}

/* Redirect / Rev Banner */
.nw-redirect-banner {
  background: var(--surface-sub);
  border: 1px solid var(--border);
  padding: 7px 12px;
  margin-bottom: 10px;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Categories Bar: exact Namuwiki "분류: A | B" box */
.nw-categories {
  border: 1px solid var(--border);
  padding: 5px 10px;
  margin: 8px 0 16px;
  background: var(--surface);
  font-size: 0.86rem;
  line-height: 1.5;
}

.nw-categories-label {
  color: var(--text);
  margin-right: 6px;
}

.nw-cat-sep {
  color: var(--border);
  margin: 0 5px;
}

/* ---------------- Namuwiki Welcome Box (for 대문) ---------------- */

.nw-welcome {
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand);
  background: var(--surface);
  text-align: center;
  padding: 20px 16px;
  margin: 4px 0 16px;
}

.nw-welcome-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--brand);
  margin: 0 0 4px;
}

.nw-welcome-sub {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
}

.nw-welcome-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: 0;
}

/* ---------------- Table of Contents (Authentic Namuwiki) ---------------- */

.nw-toc {
  display: inline-block;
  min-width: 220px;
  max-width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 20px 14px;
  margin: 6px 0 18px;
}

.nw-toc-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.nw-toc-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
}

.nw-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

.nw-toc-list.collapsed { display: none; }
.nw-toc-item { margin: 2px 0; }
.nw-toc-item.lvl-2 { padding-left: 0; }
.nw-toc-item.lvl-3 { padding-left: 16px; }
.nw-toc-item.lvl-4 { padding-left: 32px; }
.nw-toc-item a { color: var(--text); }
.nw-toc-item a:hover { color: var(--link); }
.nw-toc-num { color: var(--link); margin-right: 4px; }

/* ---------------- Wiki Content ---------------- */

.nw-content {
  word-break: keep-all;
  overflow-wrap: break-word;
}

.nw-content p { margin: 0 0 10px; }

.nw-heading {
  display: flex;
  align-items: baseline;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin: 24px 0 12px;
  cursor: pointer;
  user-select: none;
}

.nw-heading.lvl-2 { font-size: 1.45rem; font-weight: 700; }
.nw-heading.lvl-3 { font-size: 1.22rem; font-weight: 700; }
.nw-heading.lvl-4 { font-size: 1.05rem; font-weight: 700; }

.nw-heading-chevron {
  font-size: 0.72em;
  color: var(--text-muted);
  transition: transform 0.15s;
  display: inline-block;
  width: 14px;
}

.nw-heading.folded .nw-heading-chevron { transform: rotate(-90deg); }
.nw-heading-num { color: var(--link); font-weight: 700; }

.nw-heading-edit {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
}

.nw-heading-edit:hover { color: var(--link); }
.nw-section-body.folded { display: none; }

/* Links */
.nw-link-red { color: var(--link-red); }
.nw-link-red:hover { color: var(--link-red); }
.nw-link-ext { color: var(--link-ext); }
.nw-link-ext::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 3px;
  background: var(--link-ext);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M9 2h5v5h-1.5V4.56L7.28 9.78 6.22 8.72 11.44 3.5H9V2zM3 4h4v1.5H4.5v6h6V9H12v4H3V4z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M9 2h5v5h-1.5V4.56L7.28 9.78 6.22 8.72 11.44 3.5H9V2zM3 4h4v1.5H4.5v6h6V9H12v4H3V4z'/%3E%3C/svg%3E") center/contain no-repeat;
  vertical-align: -1px;
}

/* Text decorations */
.nw-strike { color: var(--strike); text-decoration: line-through; }

.nw-code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 1px 5px;
  border: 1px solid var(--border-light);
}

.nw-pre {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 10px 14px;
  overflow-x: auto;
  margin: 10px 0 14px;
  line-height: 1.5;
}

.nw-quote {
  border: 2px dashed var(--border);
  border-left: 5px solid var(--quote-border);
  background: var(--quote-bg);
  padding: 10px 14px;
  margin: 12px 0;
  color: var(--text);
}

.nw-hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.nw-content ul, .nw-content ol { margin: 6px 0 12px; padding-left: 24px; }
.nw-content li { margin: 3px 0; }

/* Tables */
.nw-table-wrap { overflow-x: auto; margin: 10px 0 14px; }

.nw-table {
  border-collapse: collapse;
  font-size: 0.9rem;
  border: 2px solid var(--border);
  max-width: 100%;
}

.nw-table th, .nw-table td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  vertical-align: middle;
}

.nw-table th {
  background: var(--table-head);
  color: var(--table-head-text);
  font-weight: 700;
}

/* Infobox */
.nw-infobox {
  float: right;
  width: 310px;
  max-width: 100%;
  margin: 0 0 16px 18px;
  border: 2px solid var(--brand);
  background: var(--surface);
  font-size: 0.88rem;
}

.nw-infobox-title {
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
  font-size: 1.04rem;
  text-align: center;
  padding: 9px 10px;
}

.nw-infobox-sub { font-size: 0.78rem; font-weight: 500; opacity: 0.92; margin-top: 2px; }
.nw-infobox table { width: 100%; border-collapse: collapse; }
.nw-infobox th, .nw-infobox td { border-top: 1px solid var(--border-light); padding: 6px 10px; text-align: left; }
.nw-infobox th { width: 34%; background: var(--brand-soft); color: var(--text); font-weight: 700; }

/* Folding */
.nw-folding { border: 1px solid var(--border); margin: 8px 0 12px; }
.nw-folding summary {
  padding: 7px 12px;
  background: var(--surface-sub);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--link);
  user-select: none;
}
.nw-folding-body { padding: 10px 14px; border-top: 1px solid var(--border-light); }

/* Uploaded image */
.nw-wiki-figure {
  display: inline-block;
  margin: 6px 0 10px;
  max-width: 100%;
  border: 1px solid var(--border-light);
  background: var(--surface-sub);
  padding: 4px;
}
.nw-wiki-img { display: block; max-width: 100%; height: auto; }
.nw-wiki-figcaption { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; text-align: center; }

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

.nw-footnotes {
  margin-top: 28px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}

.nw-footnote-item { margin: 4px 0; display: flex; gap: 6px; }
.nw-footnote-back { color: var(--link); white-space: nowrap; }

.nw-fn-popover {
  position: fixed;
  z-index: 500;
  max-width: 360px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-top: 2px solid var(--brand);
  box-shadow: var(--shadow-pop);
  padding: 9px 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  display: none;
}

.nw-fn-popover.open { display: block; }
.nw-fn-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 4px;
  font-size: 0.8rem;
}
.nw-fn-popover-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; line-height: 1; }

/* ---------------- Sidebar (Trending + Recent Changes) ---------------- */

.nw-sidebar { display: flex; flex-direction: column; gap: 12px; }

.nw-side-card {
  background: var(--surface);
  border: 1px solid var(--border);
}

.nw-side-head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}

.nw-side-list { list-style: none; margin: 0; padding: 0; }
.nw-side-list li { border-bottom: 1px solid var(--border-light); }
.nw-side-list li:last-child { border-bottom: none; }

.nw-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  color: var(--text);
  font-size: 0.84rem;
}

.nw-recent-item:hover { background: var(--surface-sub); text-decoration: none; color: var(--link); }
.nw-recent-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nw-recent-time { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

.nw-rank-num {
  display: inline-block;
  width: 18px;
  font-weight: 700;
  color: var(--brand);
  font-size: 0.82rem;
  flex-shrink: 0;
}

.nw-side-foot {
  padding: 6px 12px;
  border-top: 1px solid var(--border-light);
  text-align: right;
  font-size: 0.8rem;
}

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

/* ---------------- Editor ---------------- */

.nw-editor-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.nw-editor-tab {
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 6px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.nw-editor-tab.active {
  background: var(--surface);
  color: var(--text);
  margin-bottom: -1px;
  border-bottom: 1px solid var(--surface);
}

.nw-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-bottom: none;
}

.nw-tool-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text);
}

.nw-tool-btn:hover { border-color: var(--brand); color: var(--brand); }

.nw-textarea {
  width: 100%;
  min-height: 420px;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.nw-textarea:focus { border-color: var(--brand); }

.nw-editor-footer {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 170px 1fr auto;
  gap: 8px;
  align-items: center;
}

.nw-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.nw-input:focus { border-color: var(--brand); }

.nw-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.nw-btn:hover { background: var(--surface-sub); text-decoration: none; }
.nw-btn-primary { background: var(--brand); border-color: var(--brand); color: #ffffff; }
.nw-btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #ffffff; }
.nw-btn-danger { background: var(--link-red); border-color: var(--link-red); color: #ffffff; }
.nw-btn-danger:hover { opacity: 0.9; color: #ffffff; }
.nw-btn-sm { padding: 3px 8px; font-size: 0.8rem; }

/* ---------------- History, Diff, Discussion, Index, Gallery ---------------- */

.nw-history-list { list-style: none; margin: 10px 0 0; padding: 0; border: 1px solid var(--border); }
.nw-history-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
}
.nw-history-item:last-child { border-bottom: none; }

.nw-rev-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--brand);
  font-size: 0.82rem;
}

.nw-delta-pos { color: var(--diff-add-text); font-weight: 700; font-size: 0.82rem; }
.nw-delta-neg { color: var(--diff-del-text); font-weight: 700; font-size: 0.82rem; }
.nw-delta-zero { color: var(--text-muted); font-size: 0.82rem; }

.nw-diff-box {
  margin-top: 12px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.83rem;
  overflow-x: auto;
}
.nw-diff-line { padding: 2px 10px; white-space: pre-wrap; word-break: break-all; }
.nw-diff-add { background: var(--diff-add-bg); color: var(--diff-add-text); }
.nw-diff-del { background: var(--diff-del-bg); color: var(--diff-del-text); }
.nw-diff-same { color: var(--text-muted); }

.nw-thread-card { border: 1px solid var(--border); margin-bottom: 12px; }
.nw-thread-head {
  background: var(--surface-sub);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.nw-thread-title { font-weight: 700; font-size: 0.94rem; }
.nw-status-pill { font-size: 0.74rem; font-weight: 700; padding: 1px 6px; border: 1px solid var(--border); }
.nw-status-open { border-color: var(--brand); color: var(--brand); }
.nw-status-closed { color: var(--text-muted); }
.nw-comment { padding: 9px 12px; border-bottom: 1px solid var(--border-light); }
.nw-comment-meta { font-size: 0.79rem; color: var(--text-muted); margin-bottom: 4px; display: flex; gap: 8px; }
.nw-comment-num { font-weight: 700; color: var(--brand); }
.nw-comment-body { white-space: pre-wrap; font-size: 0.88rem; }
.nw-comment-form { padding: 10px 12px; background: var(--surface-sub); display: flex; flex-direction: column; gap: 8px; }

.nw-missing-box {
  border: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
  background: var(--surface-sub);
  margin-top: 12px;
}

.nw-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.nw-index-card {
  display: flex;
  flex-direction: column;
  padding: 8px 11px;
  border: 1px solid var(--border-light);
  background: var(--surface-sub);
  color: var(--text);
}
.nw-index-card:hover { border-color: var(--brand); text-decoration: none; }

.nw-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 10px; margin-top: 12px; }
.nw-gallery-card { border: 1px solid var(--border); background: var(--surface-sub); display: flex; flex-direction: column; }
.nw-gallery-thumb { height: 135px; background: var(--bg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.nw-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.nw-gallery-info { padding: 8px 10px; font-size: 0.8rem; display: flex; flex-direction: column; gap: 4px; }
.nw-gallery-name { font-weight: 700; word-break: break-all; }

/* ---------------- Modal, Floating Nav, Footer, Toast ---------------- */

.nw-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.nw-modal {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
}

.nw-modal-head {
  padding: 10px 14px;
  background: var(--header-bg);
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nw-modal-close { background: none; border: none; color: #ffffff; font-size: 1.2rem; cursor: pointer; }
.nw-modal-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.nw-form-group { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.nw-form-group label { font-weight: 600; }
.nw-alert-error { background: var(--diff-del-bg); color: var(--diff-del-text); padding: 7px 10px; font-size: 0.83rem; }

/* Floating Quick Scroll (Classic Namuwiki Bottom-Right) */
.nw-float-nav {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 400;
}

.nw-float-btn {
  width: 36px;
  height: 36px;
  background: var(--brand);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.86;
}

.nw-float-btn:hover { opacity: 1; background: var(--brand-dark); }

.nw-footer {
  max-width: 1300px;
  margin: 0 auto 32px;
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

.nw-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #212529;
  color: #ffffff;
  padding: 8px 16px;
  font-size: 0.85rem;
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.nw-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 960px) {
  .nw-container { grid-template-columns: 1fr; }
  .nw-search-wrap { margin-left: 0; width: 100%; padding-bottom: 6px; }
  .nw-search-box { flex: 1; width: auto; }
  .nw-autocomplete { width: 100%; }
  .nw-infobox { float: none; width: 100%; margin: 0 0 14px 0; }
  .nw-editor-footer { grid-template-columns: 1fr; }
}

/* ---------------- Member Gate, Conflict Merge, Edit Requests, A/B Diff ---------------- */

.nw-gate-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}

.nw-gate-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand);
  padding: 26px 24px 24px;
}

.nw-gate-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--brand);
  margin: 0 0 6px;
}

.nw-gate-title svg {
  width: 24px;
  height: 24px;
  fill: var(--brand);
}

.nw-gate-desc {
  margin: 0 0 18px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.nw-conflict-box {
  border: 2px solid var(--link-red);
  background: var(--diff-del-bg);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.nw-conflict-title {
  font-weight: 700;
  color: var(--diff-del-text);
  margin-bottom: 6px;
}

.nw-req-banner {
  border: 1px solid var(--brand);
  background: var(--brand-soft);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.86rem;
}

.nw-history-compare-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.nw-rev-radio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
}

.nw-badge-count {
  display: inline-block;
  background: #e03131;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 9px;
  margin-left: 4px;
}

/* ---------------- YouTube Responsive Embed ---------------- */

.nw-video-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
  margin: 10px 0 14px;
  background: #000000;
  border: 1px solid var(--border);
}

.nw-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.nw-wiki-video {
  display: block;
  width: 100%;
  max-width: 640px;
  background: #000000;
  border: 1px solid var(--border);
  margin: 8px 0 12px;
}
