:root {
  --wiki-bg: #fbfaf8;
  --wiki-surface: #ffffff;
  --wiki-sidebar-bg: #f4f2ee;
  --wiki-text: #27241f;
  --wiki-muted: #716b62;
  --wiki-border: #ddd8cf;
  --wiki-border-strong: #c8c1b6;
  --wiki-primary: #555a3d;
  --wiki-primary-hover: #42462f;
  --wiki-primary-soft: #e8e9df;
  --wiki-primary-text: #ffffff;
  --wiki-danger: #a23c32;
  --wiki-link: #4d5534;
  --wiki-link-hover: #343921;
  --wiki-nav-text: #45413b;
  --wiki-nav-hover: #ebe8e2;
  --wiki-nav-active: #dedfd3;
  --wiki-nav-active-text: #333623;
  --wiki-control-text: #514d46;
  --wiki-control-hover: #eeece8;
  --wiki-control-hover-border: #aaa297;
  --wiki-placeholder: #918b82;
  --wiki-row-hover: #f7f5f1;
  --wiki-subtle-surface: #f8f7f4;
  --wiki-heading-border: #e6e2dc;
  --wiki-code-bg: #25241f;
  --wiki-code-border: #383630;
  --wiki-code-text: #f4f1e9;
  --wiki-inline-code-bg: #eeece7;
  --wiki-inline-code-text: #7b382f;
  --wiki-quote-border: #aaa98e;
  --wiki-quote-text: #555149;
  --wiki-table-head: #575149;
  --wiki-danger-panel: #fffafa;
  --wiki-danger-border: #d3a49e;
  --wiki-danger-heading: #7e3029;
  --wiki-danger-outline: #ce9d97;
  --wiki-warning-bg: #ded4b7;
  --wiki-warning-border: #c5b78f;
  --wiki-warning-text: #403820;
  --wiki-warning-hover: #d1c39e;
  --wiki-success-bg: #edf1e8;
  --wiki-success-border: #cbd4be;
  --wiki-success-text: #39432f;
  --wiki-alert-bg: #f8f1df;
  --wiki-alert-border: #e0cfa4;
  --wiki-alert-text: #655123;
  --wiki-error-bg: #f8ecea;
  --wiki-error-border: #dfbbb6;
  --wiki-error-text: #722f28;
  --wiki-content-width: 1320px;
  --bs-body-color: var(--wiki-text);
  --bs-body-bg: var(--wiki-bg);
  --bs-border-color: var(--wiki-border);
  --bs-link-color: var(--wiki-link);
  --bs-link-hover-color: var(--wiki-link-hover);
}

html[data-theme='dark'] {
  --wiki-bg: #242528;
  --wiki-surface: #2e3034;
  --wiki-sidebar-bg: #292b2f;
  --wiki-text: #f0f1f2;
  --wiki-muted: #b4b7bc;
  --wiki-border: #46494f;
  --wiki-border-strong: #5b5f67;
  --wiki-primary: #c3c7cc;
  --wiki-primary-hover: #d7dade;
  --wiki-primary-soft: #3d4045;
  --wiki-primary-text: #222428;
  --wiki-danger: #d77c72;
  --wiki-link: #cbd0d6;
  --wiki-link-hover: #f0f2f4;
  --wiki-nav-text: #d0d3d7;
  --wiki-nav-hover: #35373c;
  --wiki-nav-active: #41444a;
  --wiki-nav-active-text: #f1f2f3;
  --wiki-control-text: #dcdee1;
  --wiki-control-hover: #3a3d42;
  --wiki-control-hover-border: #6d7178;
  --wiki-placeholder: #94989e;
  --wiki-row-hover: #2b2d31;
  --wiki-subtle-surface: #2b2d31;
  --wiki-heading-border: #42454a;
  --wiki-code-bg: #1c1d20;
  --wiki-code-border: #484b50;
  --wiki-code-text: #eceef0;
  --wiki-inline-code-bg: #3a3c41;
  --wiki-inline-code-text: #e5a69d;
  --wiki-quote-border: #74787e;
  --wiki-quote-text: #cdd0d4;
  --wiki-table-head: #d0d3d7;
  --wiki-danger-panel: #382827;
  --wiki-danger-border: #754943;
  --wiki-danger-heading: #ed9a90;
  --wiki-danger-outline: #8c5852;
  --wiki-warning-bg: #4a422e;
  --wiki-warning-border: #6e6347;
  --wiki-warning-text: #eee3bf;
  --wiki-warning-hover: #5a5037;
  --wiki-success-bg: #303236;
  --wiki-success-border: #5d6167;
  --wiki-success-text: #d7dade;
  --wiki-alert-bg: #302b20;
  --wiki-alert-border: #5b5037;
  --wiki-alert-text: #e4d6ae;
  --wiki-error-bg: #30211f;
  --wiki-error-border: #68413c;
  --wiki-error-text: #edb2aa;
  --bs-secondary-color: var(--wiki-muted);
  --bs-tertiary-bg: #37393e;
}

* {
  box-sizing: border-box;
}

/* Background on the canvas element itself, so the brief gap between documents
   during navigation shows the theme color instead of the browser default. */
html {
  background: var(--wiki-bg);
}

/* Cross-document view transitions: the old page is held until the new one is
   ready, removing the blank frame between navigations (no-op where
   unsupported). Header and sidebar get their own names so identical chrome
   stays visually static instead of participating in the root crossfade. */
@view-transition {
  navigation: auto;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 90ms;
}
.site-header {
  view-transition-name: site-header;
}
.wiki-sidebar {
  view-transition-name: wiki-sidebar;
}
/* Suppress the default group transform/scale morph: without this, any
   subpixel size difference between the old and new snapshots (e.g. switching
   between menu sections) reads as the header/sidebar sliding a couple of
   pixels instead of staying static. */
::view-transition-group(site-header),
::view-transition-group(wiki-sidebar) {
  animation: none;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--wiki-bg);
  color: var(--wiki-text);
  font-size: 15px;
  line-height: 1.55;
}

a {
  color: var(--wiki-link);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--wiki-link-hover);
}
.text-secondary {
  color: var(--wiki-muted) !important;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--wiki-primary) 32%, transparent);
  outline-offset: 2px;
}

.site-header {
  min-height: 56px;
  background: var(--wiki-surface);
  border-bottom: 1px solid var(--wiki-border);
}

.navbar {
  min-height: 56px;
  padding: 8px 20px;
}
.navbar .container-fluid {
  padding: 0;
}
.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 32px;
  color: var(--wiki-text);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.site-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
}
.navbar-brand:hover {
  color: var(--wiki-primary);
}
.navbar-toggler {
  padding: 5px 9px;
  border: 1px solid var(--wiki-border-strong);
  border-radius: 6px;
  color: var(--wiki-text);
  font-size: 14px;
}
.navbar-collapse {
  gap: 24px;
}
.nav-search {
  display: flex;
  width: min(440px, 42vw);
  margin-left: auto;
  gap: 8px;
}
.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.account-actions form {
  margin: 0;
}
.theme-toggle {
  min-width: 92px;
}
.dropdown-menu {
  border-color: var(--wiki-border);
  background: var(--wiki-surface);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.dropdown-item {
  color: var(--wiki-text);
}
.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--wiki-control-hover);
  color: var(--wiki-text);
}
.account-name {
  max-width: 180px;
  margin-right: 4px;
  overflow: hidden;
  color: var(--wiki-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wiki-shell {
  min-height: calc(100vh - 56px);
  padding: 0;
}
.wiki-shell > .row {
  min-height: calc(100vh - 56px);
}
.wiki-sidebar {
  flex: 0 0 256px;
  width: 256px;
  background: var(--wiki-sidebar-bg);
  border-right: 1px solid var(--wiki-border);
}
.sidebar-inner {
  padding: 22px 16px;
}
.sidebar-inner h2 {
  margin: 0 8px 10px;
  color: var(--wiki-muted);
  font-size: 13px;
  font-weight: 600;
}
.sidebar-navigation {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-menu summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 5px;
  color: var(--wiki-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  list-style: none;
  text-transform: uppercase;
}
.sidebar-menu summary::-webkit-details-marker {
  display: none;
}
.sidebar-menu summary::after {
  content: '›';
  font-size: 17px;
  line-height: 1;
  transition: transform 0.15s ease;
}
.sidebar-menu[open] summary::after {
  transform: rotate(90deg);
}
.sidebar-menu summary:hover {
  background: var(--wiki-nav-hover);
  color: var(--wiki-text);
}
.sidebar-menu .list-group {
  margin: 3px 0 0 7px;
  padding-left: 7px;
  border-left: 1px solid var(--wiki-border);
}
.wiki-sidebar .list-group {
  gap: 2px;
}
.wiki-sidebar .list-group-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--wiki-nav-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.submenu-item-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
}
.wiki-sidebar .list-group-item:hover {
  background: var(--wiki-nav-hover);
  color: var(--wiki-text);
}
.wiki-sidebar .list-group-item.active {
  margin-top: 0;
  background: var(--wiki-nav-active);
  color: var(--wiki-nav-active-text);
}
.empty-navigation {
  padding: 6px 8px;
  color: var(--wiki-muted);
  font-size: 14px;
}
.wiki-main {
  flex: 1 1 auto;
  width: calc(100% - 256px);
  min-width: 0;
  padding: 36px 40px 64px;
}
.content-container {
  width: 100%;
  max-width: var(--wiki-content-width);
  margin: 0 auto;
}

h1,
h2,
h3,
h4 {
  color: var(--wiki-text);
  font-weight: 650;
  letter-spacing: -0.018em;
}
h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.2;
}
.page-heading {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--wiki-border);
}
.page-heading p,
.article-header p {
  margin: 7px 0 0;
  color: var(--wiki-muted);
}

.article-header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--wiki-border);
}
.article-header h1 {
  overflow-wrap: anywhere;
}
.article-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.page-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.page-index {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--wiki-border);
  list-style: none;
}
.page-index-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--wiki-border);
}
.page-index-item a {
  color: var(--wiki-text);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}
.page-index-item a:hover {
  color: var(--wiki-primary);
  text-decoration: underline;
}
.page-index-item time,
.search-result time {
  flex: 0 0 auto;
  color: var(--wiki-muted);
  font-size: 13px;
}

.btn {
  --bs-btn-border-radius: 6px;
  --bs-btn-padding-x: 12px;
  --bs-btn-padding-y: 6px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: none !important;
}
.btn-primary {
  --bs-btn-bg: var(--wiki-primary);
  --bs-btn-border-color: var(--wiki-primary);
  --bs-btn-hover-bg: var(--wiki-primary-hover);
  --bs-btn-hover-border-color: var(--wiki-primary-hover);
  --bs-btn-active-bg: var(--wiki-primary-hover);
  --bs-btn-active-border-color: var(--wiki-primary-hover);
  --bs-btn-color: var(--wiki-primary-text);
  --bs-btn-hover-color: var(--wiki-primary-text);
  --bs-btn-active-color: var(--wiki-primary-text);
}
.btn-outline-primary {
  --bs-btn-color: var(--wiki-primary);
  --bs-btn-border-color: var(--wiki-border-strong);
  --bs-btn-hover-bg: var(--wiki-primary-soft);
  --bs-btn-hover-border-color: var(--wiki-primary);
  --bs-btn-hover-color: var(--wiki-text);
  --bs-btn-active-bg: var(--wiki-primary-soft);
  --bs-btn-active-color: var(--wiki-text);
}
.btn-outline-secondary {
  --bs-btn-color: var(--wiki-control-text);
  --bs-btn-border-color: var(--wiki-border-strong);
  --bs-btn-hover-bg: var(--wiki-control-hover);
  --bs-btn-hover-border-color: var(--wiki-control-hover-border);
  --bs-btn-hover-color: var(--wiki-text);
}
.btn-outline-danger {
  --bs-btn-color: var(--wiki-danger);
  --bs-btn-border-color: var(--wiki-danger-outline);
}
.btn-danger {
  --bs-btn-bg: var(--wiki-danger);
  --bs-btn-border-color: var(--wiki-danger);
}
.btn-warning {
  --bs-btn-bg: var(--wiki-warning-bg);
  --bs-btn-border-color: var(--wiki-warning-border);
  --bs-btn-color: var(--wiki-warning-text);
  --bs-btn-hover-bg: var(--wiki-warning-hover);
  --bs-btn-hover-border-color: var(--wiki-warning-border);
  --bs-btn-hover-color: var(--wiki-warning-text);
}
.btn-link {
  color: var(--wiki-control-text);
}

.form-label {
  margin-bottom: 6px;
  font-weight: 600;
}
.form-control,
.form-select {
  min-height: 38px;
  border-color: var(--wiki-border-strong);
  border-radius: 6px;
  background: var(--wiki-surface);
  color: var(--wiki-text);
  font-size: 15px;
  box-shadow: none;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--wiki-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--wiki-primary) 18%, transparent);
}
.form-control::placeholder {
  color: var(--wiki-placeholder);
}
.form-text {
  color: var(--wiki-muted);
}
.markdown-editor {
  min-height: 24rem;
  resize: vertical;
  line-height: 1.55;
}

.alert {
  position: static;
  border-width: 1px;
  border-radius: 6px;
}
.alert-success {
  --bs-alert-bg: var(--wiki-success-bg);
  --bs-alert-border-color: var(--wiki-success-border);
  --bs-alert-color: var(--wiki-success-text);
}
.alert-warning {
  --bs-alert-bg: var(--wiki-alert-bg);
  --bs-alert-border-color: var(--wiki-alert-border);
  --bs-alert-color: var(--wiki-alert-text);
}
.alert-danger {
  --bs-alert-bg: var(--wiki-error-bg);
  --bs-alert-border-color: var(--wiki-error-border);
  --bs-alert-color: var(--wiki-error-text);
}

.auth-form,
.delete-confirmation {
  max-width: 560px;
  margin: 0 auto;
}
.danger-panel {
  padding: 24px;
  border: 1px solid var(--wiki-danger-border);
  border-radius: 8px;
  background: var(--wiki-danger-panel);
}
.danger-panel h1 {
  color: var(--wiki-danger-heading);
  font-size: 26px;
}
.danger-panel p {
  margin: 12px 0 22px;
}

.editor-tool {
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--wiki-border);
  border-radius: 7px;
  background: var(--wiki-subtle-surface);
}
.editor-tool-popup {
  position: fixed;
  z-index: 1050;
  width: 320px;
  max-width: calc(100vw - 24px);
  max-height: 360px;
  overflow: auto;
  margin-bottom: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.wiki-editor-extra-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--wiki-border);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  background: var(--wiki-subtle-surface);
}
.toastui-editor-defaultUI.wiki-has-extra-toolbar {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.wiki-toolbar-picker-button {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--wiki-border-strong);
  border-radius: 4px;
  background: var(--wiki-surface);
  color: var(--wiki-control-text);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.wiki-toolbar-picker-button:hover {
  background: var(--wiki-control-hover);
  border-color: var(--wiki-control-hover-border);
  color: var(--wiki-text);
}
.toastui-editor-ww-container {
  position: relative;
}
.wiki-table-add,
.wiki-table-grip {
  position: fixed;
  z-index: 1050;
  transform: translate(-50%, -50%);
  border: 1px solid var(--wiki-border-strong);
  background: var(--wiki-surface);
  color: var(--wiki-control-text);
  cursor: pointer;
  padding: 0;
}
.wiki-table-add {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  font-weight: 650;
}
.wiki-table-grip {
  border-radius: 3px;
}
.wiki-table-grip-column {
  width: 22px;
  height: 8px;
}
.wiki-table-grip-row {
  width: 8px;
  height: 22px;
}
.wiki-table-add:hover,
.wiki-table-grip:hover {
  background: var(--wiki-control-hover);
  border-color: var(--wiki-control-hover-border);
  color: var(--wiki-text);
}
.wiki-table-menu {
  position: fixed;
  z-index: 1051;
  min-width: 160px;
  padding: 4px;
  border: 1px solid var(--wiki-border);
  border-radius: 4px;
  background: var(--wiki-surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.wiki-table-menu-item {
  display: block;
  width: 100%;
  padding: 5px 10px;
  border: none;
  border-radius: 3px;
  background: none;
  color: var(--wiki-control-text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.wiki-table-menu-item:hover:not(:disabled) {
  background: var(--wiki-control-hover);
  color: var(--wiki-text);
}
.wiki-table-menu-item:disabled {
  color: var(--wiki-placeholder);
  cursor: default;
}
.wiki-table-menu-danger {
  color: var(--wiki-danger);
}
.wiki-table-menu-danger:hover:not(:disabled) {
  color: var(--wiki-danger);
}
.wiki-editor-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 25px 0;
  color: var(--wiki-placeholder);
  font-size: 13px;
  line-height: 1.6;
  pointer-events: none;
  user-select: none;
}
.editor-tool h2,
.preview > h2 {
  margin: 0 0 12px;
  font-size: 16px;
}
.editor-tool .list-group {
  border-radius: 6px;
}
.editor-tool .list-group-item {
  border-color: var(--wiki-border);
  background: var(--wiki-surface);
  color: var(--wiki-text);
}
.editor-tool .list-group-item:hover {
  background: var(--wiki-control-hover);
  color: var(--wiki-text);
}
.preview {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--wiki-border-strong);
}
.preview > .markdown-body {
  padding-top: 8px;
}

.editor-quick-actions {
  margin-bottom: 16px;
}
.draft-recovery {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.draft-status {
  min-height: 1.2em;
}

.editor-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.preview-pane {
  border: 1px solid var(--wiki-border);
  border-radius: 7px;
  padding: 14px 16px;
  background: var(--wiki-subtle-surface);
}
.preview-pane-heading {
  margin-bottom: 10px;
  font-weight: 650;
  color: var(--wiki-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.editor-tabs {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}
@media (min-width: 768px) {
  .editor-layout {
    grid-template-columns: 1fr 1fr;
  }
  .editor-tabs {
    display: none;
  }
}
@media (max-width: 767.98px) {
  .editor-layout[data-active-pane='preview'] [data-editor-pane='write'] {
    display: none;
  }
  .editor-layout:not([data-active-pane='preview']) [data-editor-pane='preview'] {
    display: none;
  }
}

/* The Toast UI editor bundle (public/vendor/toastui-editor) ships one light-only stylesheet with no
   dark variant, so the WYSIWYG surface needs its own theme overrides to match the rest of the page. */
html[data-theme='dark'] .toastui-editor-defaultUI {
  border-color: var(--wiki-border);
  background: var(--wiki-surface);
}
html[data-theme='dark'] .toastui-editor-defaultUI-toolbar {
  background: var(--wiki-subtle-surface);
  border-bottom-color: var(--wiki-border);
}
html[data-theme='dark'] .toastui-editor-defaultUI-toolbar button {
  border-color: var(--wiki-subtle-surface);
}
html[data-theme='dark'] .toastui-editor-defaultUI-toolbar button:not(:disabled):hover {
  background-color: var(--wiki-control-hover);
  border-color: var(--wiki-control-hover-border);
}
html[data-theme='dark'] .toastui-editor-toolbar-icons {
  filter: invert(0.88) hue-rotate(180deg);
}
html[data-theme='dark'] .toastui-editor-toolbar-divider {
  background-color: var(--wiki-border);
}
html[data-theme='dark'] .toastui-editor-md-tab-container,
html[data-theme='dark'] .toastui-editor-mode-switch {
  background: var(--wiki-subtle-surface);
  border-color: var(--wiki-border);
}
html[data-theme='dark'] .toastui-editor-tabs .tab-item {
  color: var(--wiki-text);
  border-color: var(--wiki-border);
}
html[data-theme='dark'] .toastui-editor-md-splitter {
  background-color: var(--wiki-border);
}
html[data-theme='dark'] .toastui-editor-ww-container,
html[data-theme='dark'] .toastui-editor-md-preview,
html[data-theme='dark'] .toastui-editor-contents {
  background: var(--wiki-surface);
  color: var(--wiki-text);
}
html[data-theme='dark'] .toastui-editor-contents p,
html[data-theme='dark'] .toastui-editor-contents h1,
html[data-theme='dark'] .toastui-editor-contents h2,
html[data-theme='dark'] .toastui-editor-contents h3,
html[data-theme='dark'] .toastui-editor-contents h4,
html[data-theme='dark'] .toastui-editor-contents h5,
html[data-theme='dark'] .toastui-editor-contents h6,
html[data-theme='dark'] .toastui-editor-contents table,
html[data-theme='dark'] .toastui-editor-contents dir,
html[data-theme='dark'] .toastui-editor-contents menu,
html[data-theme='dark'] .toastui-editor-contents ol,
html[data-theme='dark'] .toastui-editor-contents ul {
  color: var(--wiki-text);
}
html[data-theme='dark'] .toastui-editor-contents h1 {
  border-bottom-color: var(--wiki-border-strong);
}
html[data-theme='dark'] .toastui-editor-contents h2 {
  border-bottom-color: var(--wiki-border);
}
html[data-theme='dark'] .toastui-editor-contents blockquote,
html[data-theme='dark'] .toastui-editor-contents blockquote ol,
html[data-theme='dark'] .toastui-editor-contents blockquote p,
html[data-theme='dark'] .toastui-editor-contents blockquote ul,
html[data-theme='dark'] .toastui-editor-contents del {
  color: var(--wiki-muted);
  border-left-color: var(--wiki-border);
}
html[data-theme='dark'] .toastui-editor-contents pre {
  background-color: var(--wiki-code-bg);
  color: var(--wiki-code-text);
}
html[data-theme='dark'] .toastui-editor-contents code {
  background-color: var(--wiki-inline-code-bg);
  color: var(--wiki-inline-code-text);
}
html[data-theme='dark'] .toastui-editor-contents pre code {
  background-color: transparent;
  color: inherit;
}
html[data-theme='dark'] .toastui-editor-contents table td,
html[data-theme='dark'] .toastui-editor-contents table th {
  border-color: var(--wiki-border);
}
html[data-theme='dark'] .toastui-editor-contents-placeholder:before {
  color: var(--wiki-placeholder);
}
html[data-theme='dark'] .toastui-editor-popup,
html[data-theme='dark'] .toastui-editor-dropdown-toolbar,
html[data-theme='dark'] .toastui-editor-context-menu {
  background: var(--wiki-surface);
  border-color: var(--wiki-border);
  color: var(--wiki-text);
}
html[data-theme='dark'] .toastui-editor-popup-body label {
  color: var(--wiki-text);
}
html[data-theme='dark'] .toastui-editor-popup-add-heading h1,
html[data-theme='dark'] .toastui-editor-popup-add-heading h2,
html[data-theme='dark'] .toastui-editor-popup-add-heading h3,
html[data-theme='dark'] .toastui-editor-popup-add-heading h4,
html[data-theme='dark'] .toastui-editor-popup-add-heading h5,
html[data-theme='dark'] .toastui-editor-popup-add-heading h6,
html[data-theme='dark'] .toastui-editor-table-description {
  color: var(--wiki-text);
}
html[data-theme='dark'] .toastui-editor-popup-body input[type='text'] {
  background: var(--wiki-surface);
  border-color: var(--wiki-border-strong);
  color: var(--wiki-text);
}
html[data-theme='dark'] .toastui-editor-popup-body input[type='text'].disabled {
  background: var(--wiki-subtle-surface);
  border-color: var(--wiki-border);
  color: var(--wiki-muted);
}
html[data-theme='dark'] .toastui-editor-file-name {
  border-color: var(--wiki-border);
  color: var(--wiki-muted);
}
html[data-theme='dark'] .toastui-editor-file-name.has-file {
  color: var(--wiki-text);
}
html[data-theme='dark'] .toastui-editor-file-select-button,
html[data-theme='dark'] .toastui-editor-close-button {
  background: var(--wiki-subtle-surface);
  border-color: var(--wiki-border);
  color: var(--wiki-control-text);
}
html[data-theme='dark'] .toastui-editor-close-button:hover {
  border-color: var(--wiki-control-hover-border);
}
html[data-theme='dark'] .toastui-editor-context-menu li:not(.disabled):hover {
  background-color: var(--wiki-control-hover);
}
html[data-theme='dark'] .toastui-editor-context-menu li.disabled {
  color: var(--wiki-muted);
}
html[data-theme='dark'] .toastui-editor-table-cell {
  background: var(--wiki-surface);
  border-color: var(--wiki-border);
}
html[data-theme='dark'] .toastui-editor-table-cell.header {
  background: var(--wiki-subtle-surface);
}

.diff-view {
  margin-top: 24px;
}
.diff-lines {
  border: 1px solid var(--wiki-border);
  border-radius: 7px;
  overflow: auto;
  font-size: 13px;
}
.diff-lines > div {
  padding: 2px 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.diff-marker {
  display: inline-block;
  width: 1.4em;
  color: var(--wiki-muted);
}
.diff-add {
  background: var(--wiki-success-bg);
  color: var(--wiki-success-text);
}
.diff-remove {
  background: var(--wiki-error-bg);
  color: var(--wiki-error-text);
}
.diff-same {
  color: var(--wiki-text);
}

.history-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}
@media (max-width: 767.98px) {
  .history-filter {
    grid-template-columns: 1fr;
  }
}

.menu-entry-row,
tr[draggable='true'] {
  cursor: grab;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 20px;
}
.result-count {
  margin: 0 0 10px;
  color: var(--wiki-muted);
}
.search-results {
  border-top: 1px solid var(--wiki-border);
}
.search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--wiki-border);
  color: var(--wiki-text);
  text-decoration: none;
}
.search-result:hover {
  background: var(--wiki-row-hover);
  color: var(--wiki-text);
}
.search-result span {
  display: grid;
  gap: 2px;
}
.search-result code {
  color: var(--wiki-muted);
  font-size: 13px;
}
.empty-state {
  margin: 0;
  padding: 18px 0;
  color: var(--wiki-muted);
}

.breadcrumb {
  margin-bottom: 18px;
  font-size: 14px;
}
.breadcrumb-item + .breadcrumb-item::before {
  color: var(--wiki-muted);
  content: '/';
}
.breadcrumb-item.active {
  color: var(--wiki-muted);
}
.current-revision {
  margin-left: 8px;
  color: var(--wiki-primary);
  font-size: 12px;
  font-weight: 650;
}
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--wiki-text);
  --bs-table-hover-bg: var(--wiki-row-hover);
}
.table > :not(caption) > * > * {
  padding: 12px 10px;
  border-bottom-color: var(--wiki-border);
}
.table thead th {
  color: var(--wiki-table-head);
  font-size: 13px;
  font-weight: 650;
}
.table-sort-button {
  width: 100%;
  padding: 2px 18px 2px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.table-sort-button::after {
  margin-left: 5px;
  color: var(--wiki-muted);
  content: '↕';
  font-weight: 400;
}
th[aria-sort='ascending'] .table-sort-button::after {
  color: var(--wiki-primary);
  content: '↑';
}
th[aria-sort='descending'] .table-sort-button::after {
  color: var(--wiki-primary);
  content: '↓';
}
.table-sort-button:hover {
  color: var(--wiki-link);
}
.account-requests-table {
  min-width: 760px;
}
.request-status {
  font-size: 13px;
  font-weight: 650;
}
.request-status-pending {
  color: var(--wiki-alert-text);
}
.request-status-accepted {
  color: var(--wiki-success-text);
}
.request-status-revoked {
  color: var(--wiki-error-text);
}
.account-request-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.account-request-actions form {
  margin: 0;
}
.admin-form-section {
  padding-top: 16px;
  padding-bottom: 24px;
  border-top: 1px solid var(--wiki-border);
}
.admin-form-section h2 {
  margin: 0 0 16px;
  font-size: 18px;
}
.compact-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.submenu-form-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.menu-management-table {
  min-width: 700px;
}
.menu-management-table form {
  margin: 0;
}
.menu-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
}
.menu-entry-row td {
  border-top: 1px solid var(--wiki-border-strong);
}
.menu-child-label {
  padding-left: 28px !important;
}
.menu-table-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
}
.menu-icon-picker {
  margin: 4px 0 16px;
}
.menu-icon-selection {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
}
.menu-icon-results {
  max-height: 240px;
  margin: 2px 0 8px;
  overflow-y: auto;
  border-radius: 6px;
}
.menu-icon-results .list-group-item {
  border-color: var(--wiki-border);
  background: var(--wiki-surface);
  color: var(--wiki-text);
}
.menu-icon-results .list-group-item:hover {
  background: var(--wiki-control-hover);
  color: var(--wiki-text);
}
.account-number-panel {
  margin: 1.5rem 0;
  padding: 1.25rem;
  border: 1px solid var(--wiki-border);
  border-radius: 0.5rem;
  background: var(--wiki-surface);
}
.account-number {
  display: block;
  margin-top: 0.35rem;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  letter-spacing: 0.08em;
  color: inherit;
  white-space: nowrap;
}

.markdown-body {
  max-width: 780px;
  font-size: 16px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}
.markdown-body > :first-child {
  margin-top: 0;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin-top: 1.65em;
  margin-bottom: 0.6em;
}
.markdown-body h1 {
  font-size: 28px;
}
.markdown-body h2 {
  padding-bottom: 7px;
  border-bottom: 1px solid var(--wiki-heading-border);
  font-size: 23px;
}
.markdown-body h3 {
  font-size: 19px;
}
.markdown-body p,
.markdown-body ul,
.markdown-body ol {
  margin-bottom: 1.1em;
}
.markdown-body pre {
  padding: 14px 16px;
  border: 1px solid var(--wiki-code-border);
  border-radius: 6px;
  background: var(--wiki-code-bg);
  color: var(--wiki-code-text);
  overflow-x: auto;
}
.markdown-body code:not(pre code) {
  padding: 0.12em 0.3em;
  border-radius: 3px;
  background: var(--wiki-inline-code-bg);
  color: var(--wiki-inline-code-text);
}
.markdown-body blockquote {
  margin-left: 0;
  padding: 2px 16px;
  border-left: 3px solid var(--wiki-quote-border);
  color: var(--wiki-quote-text);
}
.markdown-body table {
  width: 100%;
  margin-bottom: 18px;
  border-collapse: collapse;
  overflow-x: auto;
}
.markdown-body th,
.markdown-body td {
  padding: 8px 10px;
  border: 1px solid var(--wiki-border);
  text-align: left;
}
.markdown-body td:has(> img) {
  width: 1%;
  white-space: nowrap;
}
.markdown-body th {
  background: var(--wiki-sidebar-bg);
}
.markdown-body img:not([src^='/media/items/']):not([src^='/media/outfits/']):not([src^='/media/static/']):not([src^='/media/monsters/']) {
  max-width: 100%;
  height: auto;
}

.not-found {
  max-width: 560px;
  padding: 40px 0;
}
.error-code {
  margin: 0 0 8px;
  color: var(--wiki-muted);
  font-weight: 650;
}
.not-found h1 {
  font-size: 30px;
}

.item-pixel-art,
.markdown-body img[src^='/media/items/'],
.markdown-body img[src^='/media/outfits/'],
.markdown-body img[src^='/media/static/'],
.markdown-body img[src^='/media/monsters/'] {
  image-rendering: pixelated;
  object-fit: contain;
}
[data-page-slug='monsters'] .markdown-body img.native-outfit-32 {
  width: 32px;
  height: 32px;
  margin-top: 16px;
  margin-left: 16px;
}

@media (min-width: 768px) {
  .wiki-sidebar {
    position: sticky;
    top: 0;
    height: calc(100vh - 56px);
    overflow-y: auto;
  }
}

@media (max-width: 991.98px) {
  .navbar-collapse {
    padding-top: 10px;
  }
  .nav-search {
    width: 100%;
    margin: 0;
  }
  .account-actions {
    margin-top: 10px;
  }
}

@media (max-width: 767.98px) {
  .navbar {
    padding-inline: 16px;
  }
  .wiki-shell > .row {
    min-height: auto;
  }
  .wiki-sidebar {
    flex: 0 0 100%;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--wiki-border);
  }
  .sidebar-inner {
    padding: 10px 16px;
  }
  .sidebar-inner h2 {
    display: none;
  }
  .sidebar-navigation {
    flex-flow: row nowrap;
    align-items: flex-start;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .sidebar-menu {
    flex: 0 0 auto;
  }
  .sidebar-menu .list-group {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }
  .wiki-sidebar .list-group-item {
    flex: 0 0 auto;
    max-width: 220px;
    padding: 7px 10px;
  }
  .wiki-main {
    width: 100%;
    padding: 26px 16px 48px;
  }
  .article-heading-row {
    display: block;
  }
  .page-actions {
    margin-top: 16px;
    overflow-x: auto;
  }
  .page-index-item {
    align-items: flex-start;
  }
  .page-index-item time {
    max-width: 130px;
    text-align: right;
  }
}

@media (max-width: 480px) {
  .nav-search {
    grid-template-columns: 1fr;
  }
  .account-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .account-name {
    max-width: none;
  }
  .search-result {
    align-items: flex-start;
  }
  .search-result time {
    max-width: 110px;
    text-align: right;
  }
}

/* ===== Community features (TOC, talk, uploads, wanted links) ===== */

.sidebar-utility {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--wiki-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-utility a {
  color: var(--wiki-nav-text);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 2px 0;
}
.sidebar-utility a:hover {
  color: var(--wiki-nav-active-text);
  text-decoration: underline;
}

.page-toc {
  border: 1px solid var(--wiki-border);
  background: var(--wiki-subtle-surface);
  border-radius: 4px;
  padding: 12px 16px;
  margin-bottom: 20px;
  max-width: 420px;
  font-size: 0.9rem;
}
.page-toc ul {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}
.page-toc li {
  padding: 2px 0;
}
.page-toc li.toc-level-3 {
  padding-left: 18px;
}

a.wanted-page {
  color: var(--wiki-danger);
  text-decoration-style: dashed;
}

.talk-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.talk-comment {
  border: 1px solid var(--wiki-border);
  border-radius: 4px;
  background: var(--wiki-surface);
  padding: 10px 14px;
}
.talk-comment header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.talk-comment header .talk-delete {
  margin-left: auto;
}
.talk-comment p {
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.talk-form textarea {
  max-width: 640px;
}

.upload-thumbnail {
  max-width: 96px;
  max-height: 64px;
  border: 1px solid var(--wiki-border);
  border-radius: 3px;
  background: var(--wiki-surface);
}
.markdown-body img.upload-image {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--wiki-border);
  border-radius: 3px;
}

@media print {
  .site-header,
  .wiki-sidebar,
  .page-actions,
  .page-toc,
  .alert,
  .talk-form,
  .theme-toggle {
    display: none !important;
  }
  .wiki-main {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  .content-container {
    max-width: none;
    padding: 0;
  }
  body {
    background: #fff;
    color: #000;
  }
  a {
    color: #000;
    text-decoration: underline;
  }
}

/* ===== Experience levels and highscores ===== */

.account-level {
  border: 1px solid var(--wiki-border-strong);
  border-radius: 4px;
  background: var(--wiki-primary-soft);
  color: var(--wiki-nav-active-text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 8px;
  text-decoration: none;
  white-space: nowrap;
}
.account-level:hover {
  background: var(--wiki-nav-active);
  color: var(--wiki-nav-active-text);
}

.level-progress {
  height: 8px;
  max-width: 320px;
  border: 1px solid var(--wiki-border-strong);
  border-radius: 4px;
  background: var(--wiki-subtle-surface);
  overflow: hidden;
  margin: 6px 0 10px;
}
.level-progress-fill {
  height: 100%;
  background: var(--wiki-primary);
}
