.error {
  background: #eeeeee;
  padding: 0.8em;
}

pre.error {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

a {
  text-decoration: none;
}

/* highlight links that have title starting or ending with a space. */
body:has(footer span[style='']) a.spaced {
  text-decoration: wavy underline crimson;
}

a img {
  border: 0;
}

body {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  position: absolute;
  background: #eeeeee url('/images/crosses.png');
  overflow: hidden;
  padding: 0;
  margin: 0;
  font-family: 'Helvetica Neue', Verdana, helvetica, Arial, Sans;
  line-height: 1.3;
  color: #333333;
}

/* Better align sortable items. */
.ui-sortable-helper > p {
  margin: 0px;
}


/* Fallback helper: Sortable locks height from getRect / placeholder styles.
   .image img { height:100% } then fills the box and captions get clipped.
   Keep width from JS; let height follow content like stock jQuery UI. */
body > .ui-sortable-helper.item {
  overflow: visible;
  height: auto !important;
  max-height: none;
}
body > .ui-sortable-helper.item :is(img.thumbnail, img.wide) {
  height: auto;
}

.main {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /*  position: absolute;*/
  bottom: 60px;
  margin: 0;
  /*  width: 10000%; */
  display: flex;
  overflow-x: auto;
  height: calc(100vh - 40px);
}

footer {
  border-top: 1px solid #3d3c43;
  box-shadow: inset 0px 0px 7px rgba(0, 0, 0, 0.8);
  background: #eeeeee url('/images/noise.png');
  position: fixed;
  left: 0;
  right: 0;
  height: 20px;
  padding: 10px;
  /* Floor site-footer type at 14px (was 80% ≈12.8px) so owner/security/labels
     match search + edit toggle readability. Slice owns this alone — stock stays 80%. */
  font-size: 14px;
  z-index: 1000;
  color: #ccdcd2;
}

footer form,
.footer-item {
  display: inline;
}

.item-placeholder {
  border: 2px dotted #bbb;
  background: #eee;
  box-sizing: border-box;
  overflow: hidden;
}
.item-placeholder > * {
  display: none;
}

.footer-item {
  margin-left: 8px;
}

.no-results {
  font-style: italic;
}

.omitted-results {
  font-style: italic;
}

.incremental-search {
  position: absolute;
  background-color: white;
  color: black;
  display: inline-block;
  max-height: 300px;
  max-width: 430px;
  padding-top: 5px;
  padding-bottom: 5px;
  padding-right: 10px;
  padding-left: 10px;
  box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.4);
  outline: none;
  overflow-y: auto;
  overflow-x: hidden;
}

.search-term {
  background-color: yellow;
}

.neighbor {
  float: right;
  padding-left: 8px;
  width: 16px;
}

img.remote,
.neighbor img {
  width: 16px;
  height: 16px;
  background-color: #cccccc;
}

.neighbor .wait {
  -webkit-animation: rotatecw 2s linear infinite;
  -moz-animation: rotatecw 2s linear infinite;
  animation: rotatecw 2s linear infinite;
}
.neighbor .fetch {
  -webkit-animation: rotatecw 0.5s linear infinite;
  -moz-animation: rotatecw 0.5s linear infinite;
  animation: rotatecw 0.5s linear infinite;
}
.neighbor .fail {
  -webkit-transform: rotate(15deg);
  -moz-transform: rotate(15deg);
  transform: rotate(15deg);
}

@-webkit-keyframes rotatecw {
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}
@-moz-keyframes rotatecw {
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}
@keyframes rotatecw {
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

header {
  top: 0;
}

.page-handle {
  cursor: grab;
}

.page.ui-sortable-placeholder {
  visibility: hidden;
}

footer {
  bottom: 0;
}

.twins,
.journal,
.footer {
  min-height: 1em;
  opacity: 1;
}
.twins:hover,
.journal:hover,
.footer:hover {
  opacity: 1;
}

.story {
  padding-bottom: 5px;
}

.story .item {
  min-width: 40px;
}

/* jQuery UI sortable prevented text selection on item mousedown; SortableJS does not.
   Without this, double-click to edit briefly highlights a word before the textarea opens. */
.story .item:not(.textEditing) {
  -webkit-user-select: none;
  user-select: none;
}
.story .item.textEditing textarea {
  -webkit-user-select: text;
  user-select: text;
}

.story blockquote {
  margin-left: 0;
  padding: 0 10px;
  color: #777;
  border-left: 4px solid #ddd;
}

.data,
.chart,
.image {
  overflow: auto; /* clearfix hack */
  float: right;
  margin-left: 1.4px;
  margin-bottom: 0.4em;
  background: #eeeeee;
  padding: 11.2px;
  width: 183px;
}

.image.wide {
  width: 100%;
  margin-left: 0em;
  padding: 0em;
  padding-bottom: 0.8em;
  float: none;
}

.image.left {
  float: left;
  margin-left: 0em;
  margin-right: 2.8px;
}

.image :is(.thumbnail, .wide) {
  width: 100%;
  height: 100%;
}

/* image overlay */

div.image {
  position: relative;
}

.image img.overlay {
  width: 16px;
  height: 16px;
  position: relative;
  bottom: 22px;
  right: 2px; /* or -2px without float */
  float: right;
  opacity: 0;
  transition: 0.7s ease;
}

.image:hover img.overlay {
  opacity: 1;
}

/* image plugin editor */

.imageEditing #image-options {
  margin-left: 4px;
}

/* end image plugin editor */

.backlinks {
  /*width: 420px;*/
  margin-top: 2px;
  clear: both;
  background-color: #eeeeee;
  padding: 1px;
  color: grey;
  font-size: 80%;
}

.backlinks summary {
  margin-top: 5px;
  margin-left: 5px;
  margin-bottom: 3px;
}

.backlinks div {
  margin-left: 5px;
  margin-right: 2px;
}

.backlinks a {
  color: steelblue;
}

.journal {
  /*width: 420px;*/
  overflow-x: hidden;
  /*  margin-top: 2px; */
  clear: both;
  background-color: #eeeeee;
  padding: 1px;
}

.journal.ui-draggable {
  /*width: 420px;*/
}


.journal.ui-draggable,
.journal.ui-draggable * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  user-drag: none;
  touch-action: none;
}
.journal.ui-state-hover {
  /* Inset shadow avoids border layout shift on journal merge hover. */
  background: #ededed;
  box-shadow: inset 0 0 0 1px #ccc;
}
.main > .journal.ui-draggable-dragging,
.main > .journal.ui-draggable-dragging * {
  pointer-events: none;
}

.action.fork {
  color: black;
}

.action {
  font-size: 0.9em;
  background-color: #cccccc;
  background-size: 24px 24px;
  color: #666666;
  text-align: center;
  text-decoration: none;
  padding: 0.2em;
  margin: 3px;
  float: left;
  width: 18px;
}

.action.separator {
  background-color: #eeeeee;
}

.control-buttons {
  float: right;
  position: relative;
  right: 5px;
  overflow-x: visible;
  white-space: nowrap;
}

.button {
  /*from bootstrap*/
  background-color: #f5f5f5;
  background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
  background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
  background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
  background-image: linear-gradient(top, #ffffff, #e6e6e6);
  background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
  background-repeat: repeat-x;
  border: 1px solid #cccccc;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-bottom-color: #b3b3b3;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4px;
  -webkit-box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.05);
  -moz-box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.05);

  /*custom*/
  display: inline-block;
  white-space: normal;
  position: relative;
  top: 2px;
  left: 3px;
  font-size: 0.9em;
  text-align: center;
  text-decoration: none;
  padding: 0.2em;
  margin-bottom: 2px;
  color: #2c3f39;
  width: 18px;
}

.button:hover {
  color: #d9a513;
  text-shadow: 0 0 1px #2c3f39;
  box-shadow: 0 0 7px #3d3c43;
}

.button:active {
  box-shadow: inset 0 0 7px #3d3c43;
}

.output-item {
  background-color: #eee;
  padding: 15px;
  margin-block-start: 1em;
  margin-block-end: 1em;
}

.target {
  background-color: #ffffcc !important;
}

.consumed {
  outline: solid 2px orange !important;
}

.highlight {
  outline: solid 2px red;
}

.report p,
.factory p,
.data p,
.chart p,
.footer a,
.image p,
p.caption {
  text-align: center;
  margin-bottom: 0;
  color: gray;
  font-size: 70%;
}

.twins p {
  color: gray;
}

image.remote {
  width: 16px;
  height: 16px;
}

p.readout {
  text-align: center;
  font-size: 300%;
  color: black;
  font-weight: bold;
  margin: 0;
}

.footer {
  clear: both;
  margin-bottom: 1em;
  padding-bottom: 500px;
}

.page {
  float: left; /* inline-block preferred? */
  margin: 8px;
  /* padding: 0 31px; */
  width: 490px;
  flex: 0 0 490px;
  background-color: white;
  /*  height: 100%;  */
  overflow: auto;
  box-shadow: 2px 1px 4px rgba(0, 0, 0, 0.2);
  outline: none;
}
.page.active {
  box-shadow: 2px 1px 24px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.page.plugin > .paper {
  box-shadow: inset 0px 0px 40px 0px rgba(0, 220, 0, 0.5);
}

.page.local > .paper {
  box-shadow: inset 0px 0px 40px 0px rgba(220, 180, 0, 0.7);
}

.page.remote > .paper {
  box-shadow: inset 0px 0px 40px 0px rgba(0, 180, 220, 0.5);
}

.page.recycler > .paper {
  box-shadow: inset 0px 0px 40px 0px rgba(220, 0, 0, 0.5);
}

.paper {
  /*width: 430px;*/
  padding: 30px;
  min-height: 100%;
}

.handle-parent {
  z-index: 0;
  position: relative;
}

.page-handle {
  z-index: 1;
  width: 100%;
  position: absolute;
  left: 0px;
  top: 0px;
}

/* Twin flags / title stay tappable; empty title-bar grab strip remains
   (classic intent: exceptions are the spans only). */
.header,
.header h1,
.header h2,
.twins,
.twins p {
  pointer-events: none;
}

/* make more specific than ghost style. */
div.pending-remove.page {
  opacity: 0.2;
  transition-property: opacity;
  transition-duration: 300ms;
}

.twins span {
  z-index: 2;
  position: relative;
  pointer-events: auto;
}

.header span {
  z-index: 2;
  position: relative;
  pointer-events: auto;
}

.factory {
  font-size: inherit;
  width: 100%;
  min-height: 150px;
}

textarea {
  font-size: inherit;
  margin-left: 2px;
  resize: vertical;
  width: calc(100% - 12px);
  min-height: 150px;
}

.clickable:hover {
  cursor: pointer;
}

@media all and (max-width: 490px) {
  .page {
    width: 1%;
    margin: 8px;
    padding: 0;
    flex: 0 0 100vw;
    font-size: 0.87rem;
    overflow-x: unset;
  }
}

* {
  scrollbar-width: thin;
  scrollbar-color: #ccc #eee;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  margin-right: 10px;
}

::-webkit-scrollbar-button:start:decrement,
::-webkit-scrollbar-button:end:increment {
  height: 30px;
  display: block;
  background-color: transparent;
}

::-webkit-scrollbar-track-piece {
  background-color: #eeeeee;
  -webkit-border-radius: 6px;
}

::-webkit-scrollbar-thumb:vertical {
  height: 50px;
  background-color: #cccccc;
  border: 1px solid #eeeeee;
  -webkit-border-radius: 6px;
}

.factory {
  clear: both;
  margin-top: 5px;
  margin-bottom: 5px;
  background-color: #eeeeee;
}
.factory p {
  padding: 10px;
}

.bytebeat .play {
  display: inline-block;
  height: 14px;
  width: 11px;
  padding-left: 3px;
  font-size: 70%;
  color: #999999;
  border: 1px solid #999999;
  border-radius: 8px;
}
.bytebeat .symbol {
  color: #990000;
}

.video {
  margin-top: 16px;
  margin-bottom: 5px;
}

.revision {
  position: relative;
  font-size: 24px;
  color: rgba(128, 32, 16, 0.7); /* #7b2106 */
  font-weight: bold;
}

.revision span {
  background: rgba(255, 255, 255, 0.8);
  padding: 10px;
  position: absolute;
  display: block;
  text-align: center;
  top: -40px;
  right: 10px;
  transform: rotate(-15deg);
  -webkit-transform: rotate(-15deg);
  -moz-transform: rotate(-15deg);
}

.favicon {
  position: relative;
  margin-bottom: -6px;
}

.ghost {
  opacity: 0.6;
  border-color: #eef2fe;
}

/* === Parity mobile / SortableJS item+page controls (append-only; stock above untouched) === */

.wiki-item-drag > p,
.sortable-drag > p,
.item-placeholder > p {
  margin: 0px;
}

/* Mobile item helpers keep a grabbing hand; desktop items use body move/copy/no-drop. */
/* Insert slot: item-sized (JS locks width/height on touch + desktop). */
.item-placeholder {
  border: none !important;
  background: #eee !important;
  box-shadow: none !important;
  outline: 1px dotted #bbb !important;
  outline-offset: -1px;
  opacity: 1 !important;
  box-sizing: border-box;
  overflow: hidden !important;
}
.item-placeholder .item-toolbar,
.item-placeholder .item-drag-handle,
.item-placeholder .item-edit-button,
.item.wiki-item-chosen .item-toolbar,
.item.wiki-item-chosen .item-drag-handle,
.item.wiki-item-chosen .item-edit-button,
.item.wiki-item-drag-sizing .item-toolbar,
.item.wiki-item-drag-sizing .item-drag-handle,
.item.wiki-item-drag-sizing .item-edit-button {
  display: none !important;
}

/* Hide all content in the insert slot — only the dotted box should show.
   visibility:hidden is not enough: nested `visibility:visible` (plugin imgs,
   etc.) paints the original item in place during a move. display:none on
   children + a JS-locked height keeps the grey slot without showing the item.
   Origin item content is the .shadow-copy, visible only while Shift-copying. */
.item-placeholder,
.item-placeholder * {
  color: transparent !important;
  caret-color: transparent !important;
}
.item-placeholder > * {
  display: none !important;
}
.item-placeholder::before,
.item-placeholder::after {
  content: none !important;
  display: none !important;
}

.wiki-item-chosen {
  cursor: auto;
}

/* Chosen (mousedown) is still the real item until drag distance is met.
   Do not clip captions the way the grey insert slot does. */
.wiki-item-chosen:not(.item-placeholder) {
  overflow: visible;
}

/* Helper inherits body cursor (move / copy / no-drop) — classic FedWiki.
   Desktop: full item clone, transparent page background showing through. */
.wiki-item-drag.sortable-fallback,
.sortable-fallback.wiki-item-drag,
.wiki-item-drag {
  opacity: 1 !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  border: none !important;
  z-index: 10000;
}

.wiki-item-drag.sortable-fallback,
.sortable-fallback.wiki-item-drag {
  cursor: inherit !important;
  /* Slot lock is cloneNode'd onto the helper; unlock so captions match stock. */
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

/* Desktop item drag: header/journal/handle controls must not override move/copy/no-drop. */
body.wiki-item-story-dragging .page,
body.wiki-item-story-dragging .page * {
  cursor: inherit !important;
}

.wiki-item-drag.sortable-fallback :is(img.thumbnail, img.wide),
.sortable-fallback.wiki-item-drag :is(img.thumbnail, img.wide),
.wiki-item-lineup-helper :is(img.thumbnail, img.wide) {
  max-width: 100% !important;
  height: auto !important;
}


/* Mobile handle-reorder: full-size clone, faded so the item-sized insert slot
   (where the item will land) stays readable underneath. */
body.wiki-item-handle-drag .sortable-fallback.item,
body.wiki-item-handle-drag .wiki-item-drag.sortable-fallback {
  opacity: 0.4 !important;
  visibility: visible !important;
  pointer-events: none !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Handle / long-press helpers are on body — match mobile .page text size
   (clone loses .page ancestor; without this the finger preview reflows taller). */
body.wiki-item-lineup-dragging .wiki-item-lineup-helper {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media all and (max-width: 490px) {
  body.wiki-item-handle-drag .sortable-fallback.item,
  body.wiki-item-handle-drag .wiki-item-drag.sortable-fallback,
  body.wiki-item-lineup-dragging .wiki-item-lineup-helper {
    font-size: 0.87rem;
  }
}


.sortable-fallback.item .item-toolbar,
.sortable-fallback.item .item-drag-handle,
.sortable-fallback.item .item-edit-button {
  display: none !important;
}

/* Source preview while Shift-copying only — never visible during a normal move.
   Visibility is driven by jQuery hide/show (inline display) like classic FedWiki;
   these rules are a backup if inline styles are cleared. */
.shadow-copy {
  pointer-events: none !important;
}

.shadow-copy:not(.is-copy-preview) {
  display: none !important;
}

.shadow-copy.is-copy-preview {
  display: block !important;
}

/* Desktop classic page drag:
   - Drag helper = the page under the cursor
   - Ghost = empty reserved column (invisible slot, same as .ui-sortable-placeholder) */
.wiki-page-ghost {
  opacity: 0.45;
}

body:not(.wiki-page-lineup-shrunk) .main > .page.wiki-page-ghost {
  /* visibility:hidden keeps layout space without painting a grey placeholder box.
     Pointer capture lives on body during drag, not the ghost handle. */
  visibility: hidden !important;
}

.wiki-page-drag,
.sortable-fallback.page {
  cursor: grabbing !important;
  z-index: 10000;
  pointer-events: none;
}

/* Desktop helper is a 1:1 copy of the lineup page — full opacity, same page controls.
   SortableJS sets inline opacity: 0.8 on fallback clones; beat that until remove. */
body:not(.wiki-page-lineup-shrunk) .sortable-fallback.page,
body:not(.wiki-page-lineup-shrunk) .wiki-page-drag.page {
  overflow: visible !important;
  visibility: visible !important;
  opacity: 1 !important;
  background: #fff !important;
  box-shadow: 2px 1px 24px rgba(0, 0, 0, 0.4);
}

body:not(.wiki-page-lineup-shrunk) .sortable-fallback.page > *,
body:not(.wiki-page-lineup-shrunk) .wiki-page-drag.page > * {
  visibility: visible !important;
  opacity: 1 !important;
}

/* Classic desktop: fade to 20% when the page will be removed (drag above the window).
   SortableJS fallback clones set inline opacity: 0.8, so this must beat that. */
div.pending-remove.page,
.wiki-page-drag.pending-remove,
.sortable-fallback.page.pending-remove {
  opacity: 0.2 !important;
  transition-property: opacity;
  transition-duration: 300ms;
  box-shadow: none !important;
}

/* Mobile page drag: half-size lineup, dashed insert slot, mini chip under finger.
   Kill overscroll while shrunk so a flick through the page header stays a dismiss,
   not an iOS pointer-cancel. */
body.wiki-page-lineup-shrunk {
  overscroll-behavior: none;
  touch-action: none;
}

body.wiki-page-lineup-shrunk .main {
  scroll-snap-type: none;
  scroll-padding-inline: 55vw;
}

body.wiki-page-lineup-shrunk .main > .page:not(.wiki-page-ghost) {
  zoom: 0.5;
  transition: none;
  /* Beat mobile overflow-x:hidden / min-width:0 which otherwise clip zoomed pages. */
  overflow: visible !important;
  min-width: 100vw !important;
  max-width: none !important;
  /* zoom halves painted margins — keep ~16px visual gutter between pages. */
  margin-left: 16px !important;
  margin-right: 16px !important;
}

@supports not (zoom: 1) {
  body.wiki-page-lineup-shrunk .main > .page:not(.wiki-page-ghost) {
    transform: scale(0.5);
    transform-origin: top left;
    margin-right: -50%;
    margin-bottom: -50%;
    overflow: visible !important;
    min-width: 100vw !important;
    max-width: none !important;
  }
}

body.wiki-page-lineup-shrunk .wiki-page-ghost,
body.wiki-page-lineup-shrunk .main > .page.wiki-page-ghost {
  zoom: 1 !important;
  transform: none !important;
  margin: 8px 4px !important;
  margin-right: 4px !important;
  margin-bottom: 8px !important;
  flex: 0 0 13px !important;
  width: 13px !important;
  min-width: 13px !important;
  max-width: 13px !important;
  align-self: stretch !important;
  height: auto !important;
  min-height: 0 !important;
  opacity: 1 !important;
  background-color: var(--wiki-ghost-bg, #e8e8e8) !important;
  border: 2px dashed #666 !important;
  box-shadow: none !important;
  overflow: hidden !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

body.wiki-page-lineup-shrunk .wiki-page-ghost > * {
  display: none !important;
}

/* Pending remove-from-lineup: soft dismiss, not delete-red. */
body.wiki-page-lineup-shrunk .main > .page.pending-remove.wiki-page-ghost {
  border-color: #666 !important;
  background: #ddd !important;
}

/* Mobile remove-from-lineup: 20px full-width top strip. Keep next to chip styles
   so partial client deploys ship JS + page header strip together (sortablePages.js). */
.page-drag-targets {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: auto;
  z-index: 100000;
  pointer-events: none;
  justify-content: stretch;
  align-items: stretch;
  gap: 0;
  box-sizing: border-box;
}

.page-drag-targets.is-active {
  display: flex;
}

.page-drag-targets-trash-only .page-drag-target-trash {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
}

.page-drag-target {
  pointer-events: none;
  height: 20px;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  border: 2px dashed #8a8a8a;
  background: rgba(255, 255, 255, 0.28);
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}

.page-drag-target.is-unavailable {
  visibility: hidden;
}

.page-drag-target-icon {
  font-size: 14px;
  line-height: 1;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-drag-target-icon svg {
  width: 16px;
  height: 16px;
}

.page-drag-target-trash .page-drag-target-icon {
  color: #555;
}

.page-drag-target.is-hot {
  border-style: solid;
  border-color: #333;
  background: rgba(255, 255, 255, 0.45);
}

.page-drag-target-trash.is-hot {
  border-color: #c62828;
  background: rgba(255, 235, 238, 0.4);
  color: #c62828;
  box-shadow: 0 2px 10px rgba(198, 40, 40, 0.2);
}

.page-drag-target-trash.is-hot .page-drag-target-icon {
  color: #c62828;
}

/* Invisible pin at original lineup slot — only anchors the red origin string. */
.wiki-page-drag-origin-pin {
  flex: 0 0 0;
  width: 0;
  min-width: 0;
  max-width: 0;
  margin: 0;
  padding: 0;
  border: none;
  align-self: stretch;
  height: auto;
  min-height: 0;
  pointer-events: none;
  opacity: 0;
  overflow: visible;
  position: relative;
}

/* Red “string” from original slot center to the drag chip. */
.wiki-page-drag-string {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100000;
  pointer-events: none;
  overflow: visible;
}

.wiki-page-drag-string.is-active {
  display: block;
}

.wiki-page-drag-string-line {
  stroke: #c62828;
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
  opacity: 0.9;
}

/* Extra inline room so first/last pages can center while dragging. */
.wiki-page-drag-spacer {
  flex: 0 0 auto;
  align-self: stretch;
  height: 1px;
  pointer-events: none;
  opacity: 0;
}

/* Mobile: hide Sortable's full-page fallback — chip follows the finger instead. */
body.wiki-page-lineup-shrunk .wiki-page-drag,
body.wiki-page-lineup-shrunk .sortable-fallback.page {
  opacity: 0 !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: none !important;
  box-shadow: none !important;
  pointer-events: none !important;
  z-index: 10000;
}

.wiki-page-drag-label {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100001;
  pointer-events: none;
  will-change: transform;
}

.wiki-page-drag-label.is-active {
  display: block;
}

.wiki-page-drag-label-page {
  width: 84px;
  height: 117px;
  box-sizing: border-box;
  padding: 8px 9px;
  background: #fff;
  border: 1px solid #888;
  border-radius: 5px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.wiki-page-drag-label-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: #222;
  word-break: break-word;
  overflow: hidden;
  max-height: 100%;
}

.wiki-page-drag-label.is-pending-remove .wiki-page-drag-label-page {
  background: #ececec;
  border-color: #666;
  opacity: 0.85;
}

/* Mobile: selected item — suppress native text long-press; body long-press = cross-page;
   ⋮⋮ handle = same-page Sortable reorder. Allow pan-y so the first scroll
   gesture on the selected item still moves the page (touch-action:none ate it). */
.item.handle-selected {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-y;
  /* Plugin boards may set overflow; keep the pinned overlay paintable. */
  overflow: visible;
}

/* While a long-press hold is armed, lock pan so the browser cannot steal the
   gesture as scroll (pan-y on .handle-selected otherwise cancels the hold). */
.item.handle-selected.wiki-longpress-pending {
  touch-action: none;
}

.item.handle-selected .item-drag-handle {
  cursor: grab;
  touch-action: none;
}

body.wiki-item-lineup-dragging {
  /* Do not set overflow:hidden here — toggling it mid-touch cancels the pointer on Android. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

body.wiki-item-lineup-dragging .main {
  touch-action: none;
}

/* Item/journal long-press: restore Y scroll on shrunk pages (page drag uses
   overflow:visible). Match shrunk-page specificity so overflow-y beats that
   shorthand — otherwise tall pages stay unscrolled and off-screen journals
   are unreachable (R-027 mobile). */
body.wiki-item-lineup-dragging.wiki-page-lineup-shrunk .main > .page:not(.wiki-page-ghost),
body.wiki-journal-merging.wiki-page-lineup-shrunk .main > .page:not(.wiki-page-ghost) {
  overflow-y: auto !important;
}

.wiki-item-lineup-origin {
  /* Keep layout for insert math until hidden for move. */
  outline: none;
}

/* Move: hide origin (desktop shadow-copy stays hidden). Copy: show it. */
.wiki-item-lineup-origin-hidden {
  display: none !important;
}

.wiki-item-lineup-origin-copy {
  display: block !important;
  opacity: 1 !important;
  outline: 2px dashed #888;
}

/* Floating drag preview — full-size like desktop; JS scales to 0.5 with lineup shrink. */
.wiki-item-lineup-helper {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100060;
  pointer-events: none;
  box-sizing: border-box;
  transform-origin: top left;
  will-change: transform;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  border: none !important;
  opacity: 1 !important;
  margin: 0 !important;
  overflow: visible;
}

.wiki-item-lineup-helper.is-active {
  display: block;
  overflow: visible !important;
}

.wiki-item-lineup-helper.is-active > .item,
.wiki-item-lineup-helper.is-active > .item.wiki-item-lineup-drag-sizing {
  box-sizing: border-box !important;
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

.wiki-item-lineup-helper .item-toolbar,
.wiki-item-lineup-helper .item-drag-handle,
.wiki-item-lineup-helper .item-edit-button {
  display: none !important;
}

/* Insert slot — JS sets item-sized dimensions during long-press drag. */
.wiki-item-lineup-placeholder.item-placeholder {
  display: block;
  width: auto;
  margin: 2px 0;
  pointer-events: none;
  position: relative;
  z-index: 5;
  box-sizing: border-box;
  border: 1px dotted rgba(140, 140, 140, 0.7) !important;
  background: rgba(238, 238, 238, 0.55) !important;
  outline: none !important;
}

.wiki-item-lineup-overlay {
  display: none;
  position: fixed;
  z-index: 100040;
  pointer-events: none;
  box-sizing: border-box;
  overflow: visible;
}

.wiki-item-lineup-overlay.is-active {
  display: flex;
  /* Halves abut — no gap. Hot half draws a thin per-edge inset frame; only the
     active half owns the center divider so the split stays a single hairline. */
  gap: 0;
  padding: 0;
}

.wiki-item-lineup-half {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  /* No border/margin: dashed borders + margin/gap left a blank gray center. */
  border: 0;
  margin: 0;
  background: transparent;
  color: #333;
  opacity: 0.45;
  transition: opacity 100ms, background 100ms, box-shadow 100ms, color 80ms;
  padding: 10px 4px;
}

/* Source page: move only (no same-page copy) — full width. */
.wiki-item-lineup-overlay.move-only .wiki-item-lineup-half-copy {
  display: none;
}

.wiki-item-lineup-overlay.move-only .wiki-item-lineup-half-move {
  flex: 1 1 100%;
}

.wiki-item-lineup-overlay.labels-above .wiki-item-lineup-half {
  justify-content: flex-start;
  padding-top: 14px;
  padding-bottom: 48px;
}

.wiki-item-lineup-overlay.labels-below .wiki-item-lineup-half {
  justify-content: flex-end;
  padding-top: 48px;
  padding-bottom: 14px;
}

.wiki-item-lineup-half-move.is-hot {
  opacity: 1;
  background: rgba(70, 150, 230, 0.18);
  color: #063a75;
  /* Outer left + top/bottom; center/right edge only on the active half. */
  box-shadow:
    inset 1.5px 0 0 rgba(26, 111, 208, 0.9),
    inset 0 1.5px 0 rgba(26, 111, 208, 0.9),
    inset 0 -1.5px 0 rgba(26, 111, 208, 0.9),
    inset -1.5px 0 0 rgba(26, 111, 208, 0.9);
}

.wiki-item-lineup-half-copy.is-hot {
  opacity: 1;
  background: rgba(50, 190, 100, 0.18);
  color: #0a4a24;
  box-shadow:
    inset -1.5px 0 0 rgba(20, 150, 74, 0.9),
    inset 0 1.5px 0 rgba(20, 150, 74, 0.9),
    inset 0 -1.5px 0 rgba(20, 150, 74, 0.9),
    inset 1.5px 0 0 rgba(20, 150, 74, 0.9);
}

/* Long-press drag: illegal drop — red frame only; mirrors desktop cursor:no-drop / cancel.
   Hide floating Move/Copy icons — a hot move button on a red box reads as allowed. */
.wiki-item-lineup-overlay.is-no-drop {
  box-shadow: inset 0 0 0 2px rgba(200, 45, 45, 0.92);
}

.wiki-item-lineup-overlay.is-no-drop .wiki-item-lineup-half-icon,
.wiki-item-lineup-overlay.is-no-drop .wiki-item-lineup-half-label {
  display: none;
}

.wiki-item-lineup-overlay.is-no-drop .wiki-item-lineup-half {
  opacity: 0;
  background: transparent;
  box-shadow: none;
}

.wiki-item-lineup-placeholder.item-placeholder.is-no-drop {
  border: 1px dotted rgba(190, 45, 45, 0.9) !important;
  background: rgba(255, 220, 220, 0.55) !important;
}

.wiki-item-lineup-half-icon {
  display: flex;
  line-height: 0;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.wiki-item-lineup-half-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.88);
  padding: 2px 8px;
  border-radius: 6px;
}

/* Mobile cross-page item drag: Move | Copy strip on the destination page. */
.wiki-item-drop-chooser {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10050;
  display: none;
  box-sizing: border-box;
  pointer-events: none;
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.wiki-item-drop-chooser.is-active {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.wiki-item-drop-choice {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 6px 8px;
  border-radius: 8px;
  color: #444;
  background: #f3f3f3;
  border: 2px solid transparent;
  opacity: 0.72;
  transition: opacity 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.wiki-item-drop-choice.is-hot {
  opacity: 1;
  background: #fff;
  border-color: #3d6ea5;
  color: #1a3a5c;
  box-shadow: inset 0 0 0 1px rgba(61, 110, 165, 0.25);
}

.wiki-item-drop-choice.is-unavailable {
  opacity: 0.28;
  filter: grayscale(1);
}

.wiki-item-drop-choice-icon {
  display: flex;
  line-height: 0;
}

.wiki-item-drop-choice-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.wiki-item-drop-choice-move.is-hot {
  border-color: #2a7a4b;
  color: #1a4d2e;
  box-shadow: inset 0 0 0 1px rgba(42, 122, 75, 0.25);
}

.wiki-item-drop-choice-copy.is-hot {
  border-color: #3d6ea5;
  color: #1a3a5c;
}

/* Parity: keep vertical scroll on .page; lineup pans horizontally only. */
.main {
  overflow-y: hidden;
}


.main {
  margin: 0;
  display: flex;
  overflow-x: auto;
  /* Hidden, not visible: overflow-x:auto otherwise computes overflow-y to auto
     (CSS overflow pairing), so one gesture pans the lineup and the page at once
     and a column can be thrown completely off-screen. Vertical scroll belongs
     on .page (desktop overflow:auto; mobile sets it in the 490px block). */
  overflow-y: hidden;
  height: calc(100vh - 40px);
}

.item-placeholder {
  outline: 1px dotted #bbb;
  outline-offset: -1px;
  background: #eee;
}

body:not(.fedwiki-edit-mode) .item-toolbar,
body:not(.fedwiki-edit-mode) .item-drag-handle {
  display: none !important;
}

/* Overlay wrapper: JS pins `top` to the visible slice of tall items so handle
   + pencil stay on screen after the item's own top has scrolled away (tap the
   bottom of chess/activity and the buttons must still be in the viewport).
   Height 0 so it never reflows story text. */

.item-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  z-index: 6;
  pointer-events: none;
}

.item-toolbar .item-drag-handle,
.item-toolbar .item-edit-button {
  pointer-events: auto;
}

/* Desktop: no handles — whole-item drag. Touch/coarse: overlay grab targets (no reflow). */

.item-drag-handle {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 6;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  color: #555;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -1px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.item.textEditing .item-toolbar,
.item.textEditing .item-drag-handle,
.item.textEditing .item-edit-button,
.item.textEditing .item-action-toolbar {
  display: none !important;
}

.item-edit-button {
  display: none;
  position: absolute;
  top: 48px;
  right: 2px;
  z-index: 6;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  color: #555;
  font-size: 22px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.item-action-toolbar {
  display: none;
}

.item.handle-selected {
  outline: 1px dashed #999;
}

.item.toolbar-active {
  outline: 1px solid #666;
}

/* Mobile: tap-selected journal (no handle/pencil — long-press to merge-drag). */

.journal.journal-selected {
  outline: 1px dashed #999;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.journal-merge-source {
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.journal-merge-source .action,
.journal-merge-clone,
.journal-merge-clone .action {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.journal-merge-source.is-dragging {
  touch-action: none;
  cursor: grabbing;
}

.journal .action {
  cursor: pointer;
  position: relative;
  z-index: 1;
  -webkit-user-select: none;
  user-select: none;
}

.journal.wiki-merge-hover,
.journal.ui-state-hover {
  /* Match stock jQuery UI hover look; inset shadow avoids border layout shift
     that reflows floated .action icons onto the next row. */
  background: #ededed;
  outline: none;
  box-shadow: inset 0 0 0 1px #ccc;
}

.journal-merge-clone {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.wiki-journal-merging,
body.wiki-journal-merging * {
  -webkit-user-select: none !important;
  user-select: none !important;
  caret-color: transparent;
}

/* Stock FedWiki rules restored (accidentally dropped in parity CSS rewrite). */

/* Stock page column sizing restored — required for lineup flex + mobile 100vw. */

@media (hover: none), (pointer: coarse) {
  /* Overlay the item corner — never change paper/item width (that reflows text). */
  body.fedwiki-edit-mode .item-drag-handle {
    display: flex;
    top: 2px;
    right: 2px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    font-size: 26px;
    touch-action: none;
  }

  body.fedwiki-edit-mode .item-edit-button {
    display: flex;
    top: 50px;
    right: 2px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    font-size: 22px;
    touch-action: manipulation;
  }

  .item-action-toolbar button {
    min-width: 44px;
    min-height: 44px;
  }

  .desktop-only-controls {
    display: none !important;
  }
}

/* === mobile-footer overrides (ported onto append-only parity CSS) === */

@media all and (max-width: 490px) {
  body.wiki-item-handle-drag .sortable-fallback.item,
  body.wiki-item-handle-drag .wiki-item-drag.sortable-fallback,
  body.wiki-item-lineup-dragging .wiki-item-lineup-helper {
    font-size: 0.875rem;
  }
}

footer {
  border-top: 1px solid #3d3c43;
  box-shadow: inset 0px 0px 7px rgba(0, 0, 0, 0.8);
  background: #eeeeee url('/images/noise.png');
  position: fixed;
  left: 0;
  right: 0;
  height: 20px;
  padding: 10px;
  font-size: 80%;
  z-index: 1000;
  color: #ccdcd2;
  bottom: 0;
}

.story .item {
  position: relative;
  min-width: 40px;
}

.control-buttons {
  float: right;
  position: relative;
  right: 5px;
  overflow-x: visible;
  white-space: nowrap;
  z-index: 2;
}

.footer {
  clear: both;
  margin-bottom: 1em;
  /* Stock used 500px so last content could scroll above the site footer.
     .main is now sized above that bar, so only a small pad is needed. */
  padding-bottom: 50px;
}

.paper {
  /*width: 430px;*/
  padding: 30px;
  /* content-box + min-height:100% adds this padding on top of the page
     height, so short pages always get a vertical scrollbar. */
  box-sizing: border-box;
  min-height: 100%;
}

.handle-parent {
  z-index: 0;
  /* Static so the absolute .page-handle pins to .page, not this empty wrapper. */
  position: static;
}

.page-handle {
  /* Invisible title-bar grab: top 40px of the page, including paper padding.
     Height used to be unset (0px), so there was no discoverable drag target. */
  z-index: 3;
  width: 100%;
  height: 40px;
  position: absolute;
  left: 0;
  top: 0;
  cursor: grab;
  touch-action: none;
}

.twins span {
  /* Above .page-handle (z-index 3) so neighborhood flags stay tappable. */
  z-index: 4;
  position: relative;
}

.factory {
  clear: both;
  margin-top: 5px;
  margin-bottom: 5px;
  background-color: #eeeeee;
  /* Helper copy + plugin menu were 70% (~11px). */
  font-size: 14px;
  width: 100%;
  min-height: 150px;
}

.factory p {
  padding: 10px;
  text-align: center;
  margin-bottom: 0;
  color: gray;
}

textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  margin-left: 2px;
  resize: vertical;
  width: calc(100% - 12px);
  min-height: 150px;
}

.incremental-search {
  /* Desktop matches stock FedWiki: compact panel, soft shadow, no card styling.
     Mobile overrides below keep the full-bleed keyboard-friendly panel. */
  position: absolute;
  background-color: white;
  color: black;
  display: inline-block;
  box-sizing: border-box;
  max-height: 300px;
  max-width: 450px;
  width: 450px;
  padding-top: 5px;
  padding-bottom: 5px;
  padding-right: 10px;
  padding-left: 10px;
  box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.4);
  outline: none;
  overflow-y: auto;
  overflow-x: hidden;
  /* Above footer (z-index 1000); panel is position:fixed on body on desktop. */
  z-index: 1001;
  /* Explicit 14px — panel is on body now, so it no longer inherits footer 80%. */
  font-size: 14px;
  /* Footer .footer-controls sets nowrap; results must wrap like stock. */
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.search-term {
  background-color: #ffe566;
  border-radius: 2px;
  padding: 0 0.15em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.incremental-search > div,
.incremental-search p {
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  max-width: 100%;
}

.incremental-search img.remote {
  width: 16px;
  height: 16px;
}

.incremental-search .no-results,
.incremental-search .omitted-results {
  font-style: italic;
}

@media (max-width: 490px) {
  .incremental-search {
    display: block;
    position: fixed;
    max-width: none;
    width: 100%;
    left: 0;
    right: 0;
    box-sizing: border-box;
    z-index: 1100;
    /* JS sets top+bottom to fill above the footer; keep a sane fallback. */
    max-height: 70vh;
    border-radius: 0;
    border: none;
    border-top: 1px solid #bbb;
    border-bottom: 1px solid #bbb;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.22);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #888 #e8e8e8;
    white-space: normal;
    font-size: inherit;
    line-height: 1.45;
    padding: 10px 14px;
  }

  .incremental-search::-webkit-scrollbar {
    width: 8px;
  }

  .incremental-search::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
  }

  .incremental-search::-webkit-scrollbar-track {
    background: #e8e8e8;
  }

  /* Dormant: search.js no longer toggles wiki-mobile-search-keyboard — static.html
     uses interactive-widget=resizes-content so footer re-pin / overflow:hidden
     dismisses the IME. Rules kept for review context; do not re-enable without testing. */
  body.wiki-mobile-searching.wiki-mobile-search-keyboard {
    overflow: hidden;
  }

  body.wiki-mobile-searching.wiki-mobile-search-keyboard .main {
    overflow: hidden !important;
    touch-action: none;
  }

  /* Keep neighborhood visible while searching — results overlay pins above the
     controls row (not over the flag band). Do not display:none the hood on focus:
     that moves the focused input and dismisses Android IME. Currently dormant
     keyboard rules below stay off under interactive-widget=resizes-content. */
  body.wiki-mobile-searching.wiki-mobile-search-keyboard footer .neighborhood,
  body.wiki-mobile-searching.wiki-mobile-search-keyboard footer .neighborhood-chevron,
  body.wiki-mobile-searching.wiki-mobile-search-keyboard .wiki-flag-tip {
    display: none !important;
  }

  body.wiki-mobile-searching.wiki-mobile-search-keyboard footer.neighborhood-above {
    flex-wrap: nowrap;
    row-gap: 0;
  }

  body.wiki-mobile-searching.wiki-mobile-search-keyboard footer.neighborhood-above .footer-controls {
    flex: 1 1 auto;
    width: 100%;
  }
}

/* Search open (mobile + desktop): collapse the stacked flag band so the search
   field / results sit on the standard single-row controls height. Flag row is
   above the controls in the grid — collapsing it shortens the footer upward and
   does not move the focused input (IME-safe). */
body.wiki-searching footer.neighborhood-above,
body.wiki-mobile-searching footer.neighborhood-above {
  grid-template-rows: 0 auto;
  row-gap: 0;
  padding-top: 0;
  --footer-stack-gap: 0px;
  --footer-flag-band: 0px;
}

body.wiki-searching footer.neighborhood-above .neighborhood,
body.wiki-mobile-searching footer.neighborhood-above .neighborhood,
body.wiki-searching footer .neighborhood-chevron,
body.wiki-mobile-searching footer .neighborhood-chevron,
body.wiki-searching .wiki-flag-tip,
body.wiki-mobile-searching .wiki-flag-tip {
  visibility: hidden;
  height: 0 !important;
  max-height: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  pointer-events: none !important;
}

/* Flag slot: flex (not float) so .neighborhood-track can pan with translateX
   while keeping a fixed 16×16 layout box for chevron alignment.
   Horizontal pad is half of stock 8px so flags pack tighter next to controls. */
.neighbor {
  float: none;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding-left: 4px;
  width: 16px;
  height: 16px;
  line-height: 0;
  /* S Pen shows a hover cursor here the same way it does on the padlock/edit control. */
  cursor: pointer;
}

footer input.search {
  /* Width is owned by .search-field; flex shares space with the clear square. */
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  /* 18px + 1px field borders = stock 20px content box. 1.5em at 14px (~21px)
     grew one-row footers past upstream's 40px band when height was auto. */
  height: 18px;
  box-sizing: border-box;
  padding: 0 0.5em;
  font-size: 14px;
  line-height: 18px;
  /* Paint lives on .search-field — painting bg+radius on the <input> leaves
     white AA flecks at the corners on Android against the dark footer. */
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #222222;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  resize: none;
}

/* Desktop default: original "wiki ✔︎" control. Mobile swaps to pill+edit via media query. */
footer .editEnableSlot {
  display: inline-block;
  width: 1.25em;
  text-align: center;
  vertical-align: baseline;
  flex-shrink: 0;
}

footer .wiki-edit-toggle {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
  white-space: nowrap;
}

/* Non-input footer controls: keep pen/stylus/touch on the control. Fixed footers
   sit next to mobile browser toolbars/omnibox — selection, callouts, and
   accidental text cursors are a common way those taps get stolen. */
footer #security a,
footer .wiki-edit-toggle,
footer .footer-menu,
footer .pages {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

footer .wiki-edit-mobile {
  display: none;
}

/* Mobile replaces "wiki ✔︎" with a compact on/off pill + "edit" label (see media query).
   Track size is a finger-friendly control that still fits the stock ~40px footer. */
footer .edit-toggle-track {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: #c5c5c5;
  border: 1px solid #9a9a9a;
  box-sizing: border-box;
}

footer .edit-toggle-knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}

footer .wiki-edit-toggle.is-on .edit-toggle-track {
  background: #30d158;
  border-color: #1faa44;
}

footer .wiki-edit-toggle.is-on .edit-toggle-knob {
  transform: translateX(16px);
}

footer .edit-toggle-label {
  font-size: 14px;
  color: #3d3c43;
  text-transform: lowercase;
}

/* Search/menu/wiki share one flex item; owner + security stay direct footer children
   so security plugins can use footer > #security. Do not grow — keeps ☰ with pages/wiki. */
.footer-controls {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  position: relative;
  /* Above .neighborhood so desktop incremental-search is not covered by flags. */
  z-index: 5;
}

.footer-controls .searchbox {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
  /* Do not flex-grow: leftover row width belongs to the flag strip (margin-left:auto).
     Width is fixed on .search-field (10em) or --footer-search-width when shrunk. */
  flex: 0 0 auto;
  /* Classic markup used &nbsp; before/after the input. */
  gap: 0.55em;
  position: relative;
  z-index: 6;
}

.footer-controls .searchbox .search-field {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  /* One-row desktop: fixed 10em. Stacking may shrink — see neighborhood-above. */
  flex: 0 0 10em;
  width: 10em;
  max-width: 10em;
  /* Match stock footer content height (mobile media query overrides to 40px). */
  height: 20px;
  touch-action: manipulation;
  /* Single rounded surface: clips clear + avoids input white-corner flecks. */
  box-sizing: border-box;
  border: 1px solid #7a7a7a;
  border-radius: 3px;
  background: #ffffff;
  overflow: hidden;
}

.footer-controls .searchbox .search-field input.search {
  flex: 1 1 auto;
  min-width: 0;
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
}

.footer-controls .searchbox .search-clear {
  /* In-flow trailing square (not overlaid on the <input>) — input padding steals
     clicks from absolute clears. Visual stays the old red circle on the glyph.
     Sizes are px (not em): font-size:0 below would make 1.5em → 0 and crush the
     hit target; overflow:hidden on .search-field then clips the red circle. */
  position: relative;
  flex: 0 0 22px;
  align-self: stretch;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: auto;
  min-width: 22px;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
  overflow: visible;
}

/* Red circle + X (visual only). Mobile browsers often skip ::before/::after on <button>. */
.footer-controls .searchbox .search-clear-glyph {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d32f2f;
  pointer-events: none;
}

.footer-controls .searchbox .search-clear-glyph::before,
.footer-controls .searchbox .search-clear-glyph::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58%;
  height: 1.75px;
  background: #fff;
  border-radius: 1px;
}

.footer-controls .searchbox .search-clear-glyph::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.footer-controls .searchbox .search-clear-glyph::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.footer-controls .searchbox .search-clear[hidden] {
  display: none !important;
}

.footer-controls .searchbox .pages {
  margin-left: 0;
  flex-shrink: 0;
}

.footer-controls .footer-menu {
  flex: 0 0 auto;
  /* Classic markup was "&nbsp; ☰ " — keep a clear gutter after "N pages". */
  margin-left: 1.1em;
  margin-right: 0.5em;
  /* ☰ strokes thicken badly under bold; keep regular weight like classic. */
  font-weight: 400;
}

.footer-controls .wiki-edit-toggle {
  flex: 0 0 auto;
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: 0.15em;
}

footer > #site-owner,
footer > #security {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Desktop: security padlock is Font Awesome (1em). Keep it at stock footer controls
   size (~80% of root) even though footer labels are 14px. */
@media (min-width: 491px) {
  /* One-row desktop: flex row so owner/security/controls/neighborhood share one line
     (.neighborhood margin-left:auto only works in a flex footer). Without this,
     block-level .footer-controls drops under inline owner while flags stay on row 1.
     Keep height:20px (stock) — height:auto grew the band with the search field.
     When the row is too tight, neighbors.js adds .neighborhood-above instead. */
  footer:not(.neighborhood-above) {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    height: 20px;
    min-width: 0;
    box-sizing: content-box;
  }

  footer #security {
    font-size: 14px;
    line-height: 1;
  }

  footer #security img {
    width: 16px;
    height: 16px;
  }

  /* One-row: never ellipsis owner — stack flags instead. Stacked rules may ellipsis. */
  footer > #site-owner {
    flex: 0 0 auto;
    min-width: auto;
    max-width: none;
    overflow: visible;
  }
}

.neighborhood {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  flex: 0 0 auto;
  /* Keep a classic gutter between controls and the flag strip; auto still packs right. */
  margin-left: auto;
  padding-left: 4px;
  overflow: visible; /* spinning flags; clip only while .overflowing / .scrollable */
  position: relative;
  z-index: 1;
}

.neighborhood-track {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
  /* Pan via transform (neighbors.js), not overflow scroll — keeps origin packing stable. */
  will-change: transform;
}

/* Shared stacked mode: flags take a full row above footer controls. Desktop/mobile media
   queries then specialize (grid vs flex) so controls never wraps to a 3rd row. */
footer.neighborhood-above {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 6px;
  column-gap: 0;
  height: auto;
  box-sizing: content-box;
}

footer.neighborhood-above .neighborhood {
  flex: 1 0 100%;
  order: -1;
  margin-left: 0;
  min-width: 0;
}

/* Legacy .footer-content-row wrappers are unwrapped in JS so #security stays
   a direct footer child for security plugins. Keep the rule harmless if present. */
footer.neighborhood-above > .footer-content-row {
  display: contents;
}

footer.neighborhood-above .footer-controls {
  flex: 0 0 auto;
  min-width: 0;
}

/* Desktop stacked: exactly two rows via grid — flags, then one controls line.
   Flex-wrap allowed a long display name to push search onto a 3rd row. */
@media (min-width: 491px) {
  footer.neighborhood-above {
    display: grid;
    /* Owner stays max-content until search is at the icon floor (.footer-controls-tight).
       Spacer 1fr keeps controls left-packed when flags move up. */
    grid-template-columns: max-content auto max-content 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    justify-content: stretch;
    column-gap: 0;
    --footer-flag-band: 8px;
    padding-top: var(--footer-flag-band);
    row-gap: var(--footer-flag-band);
    padding-bottom: 10px;
    min-width: 0;
  }

  footer.neighborhood-above.footer-controls-tight {
    grid-template-columns: minmax(0, max-content) auto max-content 1fr;
  }

  footer.neighborhood-above .neighborhood {
    grid-column: 1 / -1;
    grid-row: 1;
    order: unset;
    flex: unset;
    width: auto;
    max-width: 100%;
    margin-left: 0;
    min-width: 0;
    align-items: center;
    /* Non-overflow: pack flags right. .overflowing/.scrollable override to flex-start. */
    justify-content: flex-end;
  }

  footer.neighborhood-above .neighborhood.overflowing,
  footer.neighborhood-above .neighborhood.scrollable {
    justify-content: flex-start;
  }

  footer.neighborhood-above .neighborhood-track {
    margin-left: auto;
    margin-right: 0;
  }

  footer.neighborhood-above > #site-owner {
    grid-column: 1;
    grid-row: 2;
    flex: unset;
    min-width: auto;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }

  footer.neighborhood-above.footer-controls-tight > #site-owner {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  footer.neighborhood-above > #security {
    grid-column: 2;
    grid-row: 2;
    flex: 0 0 auto;
  }

  footer.neighborhood-above > .footer-controls {
    grid-column: 3;
    grid-row: 2;
    flex: 0 0 auto;
    min-width: min-content;
    max-width: none;
    margin-right: 0;
    justify-self: start;
  }

  footer.neighborhood-above .footer-controls .searchbox {
    flex: 0 0 auto;
    min-width: 0;
  }

  /* Default: same as one-row (input stays 10em). Shrunk: JS --footer-search-width. */
  footer.neighborhood-above.footer-search-shrunk .footer-controls .searchbox .search-field {
    flex: 0 0 var(--footer-search-width, 2.75em);
    width: var(--footer-search-width, 2.75em);
    min-width: 2.75em;
    max-width: 10em;
    overflow: hidden;
    box-sizing: border-box;
  }

  footer.neighborhood-above .footer-controls .searchbox .pages,
  footer.neighborhood-above .footer-controls .footer-menu,
  footer.neighborhood-above .footer-controls .wiki-edit-toggle,
  footer.neighborhood-above .footer-controls .editEnableSlot {
    flex: 0 0 auto;
    flex-shrink: 0;
  }

  footer.neighborhood-above .footer-controls .searchbox .pages {
    position: relative;
    z-index: 2;
  }

  footer.neighborhood-above.footer-search-shrunk input.search {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    max-width: none;
  }
}

.neighborhood.overflowing,
.neighborhood.scrollable {
  overflow: hidden;
  padding-top: 6px;
  padding-bottom: 6px;
  margin-top: -6px;
  margin-bottom: -6px;
  box-sizing: border-box;
  /* Track must start at the left so translateX(-max) can put origin flush-right.
     flex-end + translateX(-max) double-shifts and leaves a gap that grows as
     the window shrinks (gap ≈ maxScroll). */
  justify-content: flex-start;
}

.neighborhood.overflowing .neighborhood-track,
.neighborhood.scrollable .neighborhood-track {
  margin-left: 0;
}

/* Desktop stacked overflow only — mobile pans the track with a finger instead.
   Gradient fades over the flag edge so the affordance reads without a hard box. */
.neighborhood-chevron {
  display: none;
  position: absolute;
  z-index: 6;
  box-sizing: border-box;
  width: 18px;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  appearance: none;
  -webkit-appearance: none;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  color: #2a2a2a;
  background: linear-gradient(to right, rgba(238, 238, 238, 0.97) 40%, rgba(238, 238, 238, 0));
  cursor: pointer;
}

.neighborhood-chevron-right {
  background: linear-gradient(to left, rgba(238, 238, 238, 0.97) 40%, rgba(238, 238, 238, 0));
}

.neighborhood-chevron:hover {
  color: #000;
}

@media (min-width: 491px) {
  footer.neighborhood-above .neighborhood-chevron:not([hidden]) {
    display: grid;
    place-items: center;
    line-height: 1;
    padding: 0;
  }
}

footer .neighbor[draggable='true'] {
  touch-action: none;
  user-select: none;
}

footer .neighbor.lifting {
  position: relative;
  z-index: 5;
  opacity: 0.75;
}

/* Mid-lift past remove threshold: free horizontal slot so footer can re-fit. */
footer .neighbor.neighbor-slot-release {
  width: 0 !important;
  padding-left: 0 !important;
  margin: 0 !important;
  min-width: 0 !important;
  overflow: visible;
  pointer-events: none;
}

footer .neighbor.neighbor-slot-release::after {
  display: none;
}

footer .neighbor.neighbor-slot-release > div {
  position: absolute;
  left: 0;
  top: 0;
}

/* Journal / backlinks / page-footer sit below the story. Rebuild (edit toggle)
   emits empty story stubs first, so these are on-screen; scroll anchoring would
   then pin to them and drag the page to the bottom as plugins fill the story. */
.backlinks,
.journal,
.paper > .footer {
  overflow-anchor: none;
}

.story {
  padding-bottom: 5px;
}

.data,
.chart,
.image {
  overflow: auto; /* clearfix hack */
  float: right;
  margin-left: 1.4px;
  margin-bottom: 0.4em;
  background: #eeeeee;
  padding: 11.2px;
  width: 183px;
}

/* image overlay */

/* image plugin editor */

/* end image plugin editor */

.control-buttons .button {
  cursor: pointer;
  position: relative;
  z-index: 2;
  touch-action: manipulation;
  pointer-events: auto;
}

.report p,
.data p,
.chart p,
.image p,
p.caption {
  text-align: center;
  margin-bottom: 0;
  color: gray;
  font-size: 70%;
}

/* Same gray/small type as captions, but left-aligned. Grouping these with
   `text-align: center` was a no-op on desktop (inline <a> shrink-wraps) and
   centered the CC/JSON/host/search line on mobile once the chevron insets
   made each link wide enough for the alignment to show. */
.footer a {
  margin-bottom: 0;
  color: gray;
  font-size: 70%;
}

.page {
  float: left; /* inline-block preferred? */
  margin: 8px;
  /* padding: 0 31px; */
  width: 490px;
  flex: 0 0 490px;
  background-color: white;
  /*  height: 100%;  */
  overflow: auto;
  box-shadow: 2px 1px 4px rgba(0, 0, 0, 0.2);
  outline: none;
  /* Containing block for .page-handle so the 40px grab strip pins to the
     page card (including paper padding), not an empty handle-parent. */
  position: relative;
}

/* Twin flags/links stay tappable; empty space in that band starts a page drag. */
.twins {
  pointer-events: none;
}

.twins a,
.twins img,
.twins span {
  pointer-events: auto;
  /* Above the 40px page-handle so fork flags stay tappable. */
  position: relative;
  z-index: 4;
}

/* Mobile remove-from-lineup: 20px full-width top strip. Translucent so the
   page behind stays visible; same dashed/hot colours, just shorter. */
.page-drag-targets {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: auto;
  z-index: 100000;
  pointer-events: none;
  justify-content: stretch;
  align-items: stretch;
  gap: 0;
  box-sizing: border-box;
}

.header {
  z-index: 2;
  position: relative;
}

/* Desktop: no page-nav controls (removed). */

/* Mobile layout — breakpoint must match lib/viewport.js MOBILE_MAX_WIDTH_PX (490). */
@media all and (max-width: 490px) {
  .page {
    flex: 0 0 100vw;
    /* width:1% + flex-basis:100vw matches aolc: columns stay full-width while
       8px margin paints a gutter between pages (idle pan and long-press shrink).
       Do not use margin:0 here — that butts pages flush on chess. */
    width: 1%;
    max-width: none;
    /* min-width:auto (flex default) lets wide plugin content (activity » chevrons
       with negative margin) grow the column past the viewport and break snap. */
    min-width: 0;
    margin: 8px;
    padding: 0;
    /* Same split as desktop: this column is the Y scroller, .main is X-only.
       clip (not hidden) on X so wide plugin content cannot grow the column past
       snap; auto on Y so you stop at the story end instead of panning the card
       off-screen. Item-toolbar pin already listens to scroll on overflow ancestors. */
    overflow-x: clip;
    overflow-y: auto;
    /* start, not center: the last 100vw column often cannot center (subpixel /
       100vw vs clientWidth), so mandatory snap yanked back to the previous page
       and the right chevron disappeared. */
    scroll-snap-align: start;
    position: relative;
    box-sizing: border-box;
  }

  /* Page-drag shrink uses zoom:0.5 — overflow-x:hidden + min-width:0 clip the
     scaled neighbors into an empty gray strip and hide the trash/chip context.
     Restore predictable half-size columns for the duration of the drag. */
  body.wiki-page-lineup-shrunk .main > .page:not(.wiki-page-ghost) {
    overflow: visible;
    min-width: 100vw;
    max-width: none;
  }

  /* Keep stock .paper padding (30px). A tighter inset made story text look
     larger and left/right item margins feel cramped vs aolc / upstream. */

  /* Align CC/JSON/host/search with the story. Equal 48px side insets cleared
     the chevrons but made the line look centered in the page. Sit above the
     44×44 lineup chevrons (pinned 8px above the live footer top) instead. */
  .page .footer {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 100px;
    text-align: left;
  }


  /* Long-press jump hides the chevron under the finger — without this, the
     still-down press selects page text. Lifted after pointerup. */

  /* Sits under the chevron (z-index 1005) and a bit larger, so a retargeted
     ghost click still hits the control instead of the story item. Below the
     chevron so a quick second tap still reaches the button. */


  .main {
    scroll-snap-type: x mandatory;
  }


  /* Lineup paging: hit target = stock .paper side padding (30px) so the control
     stays in the page margin and does not cover story text. Height stays 44 for
     a usable finger target. Visible strip fills that margin band.
     z-index 1005 (was 900): .page overflow-y:auto is a compositor layer
     that paints over position:fixed siblings on mobile, so both chevrons
     vanished after the X/Y overflow split. Stay above footer (1000) and
     the page scroller, below search (1100). translateZ keeps our own
     layer so iOS cannot bury the buttons under the column scroller. */
  .wiki-lineup-nav {
    display: flex;
    position: fixed;
    z-index: 1005;
    transform: translateZ(0);
    box-sizing: border-box;
    align-items: center;
    width: 30px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
    color: #333;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
  }

  .wiki-lineup-nav[hidden] {
    display: none;
  }

  .wiki-lineup-nav-left {
    left: 0;
    justify-content: flex-start;
    padding-left: 1px;
  }

  .wiki-lineup-nav-right {
    right: 0;
    justify-content: flex-end;
    padding-right: 1px;
  }

  .wiki-lineup-nav-left::before,
  .wiki-lineup-nav-right::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30px;
    background: rgba(255, 255, 255, 0.18);
    pointer-events: none;
  }

  .wiki-lineup-nav-left::before {
    left: 0;
  }

  .wiki-lineup-nav-right::before {
    right: 0;
  }

  .wiki-lineup-nav.is-held::before {
    background: rgba(255, 255, 255, 0.4);
  }

  .wiki-lineup-nav svg {
    position: relative;
    z-index: 1;
    display: block;
    width: 14px;
    height: 22px;
  }

  .wiki-lineup-nav.is-jump-hidden {
    opacity: 0;
  }

  body.wiki-lineup-nav-holding,
  body.wiki-lineup-nav-holding * {
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
  }

  /* Sits under the chevron (z-index 1005) and a bit larger, so a retargeted
     ghost click still hits the control instead of the story item. Below the
     chevron so a quick second tap still reaches the button. */
  .wiki-lineup-nav-click-shield {
    position: fixed;
    z-index: 1004;
    pointer-events: auto;
    touch-action: none;
    background: transparent;
  }

  body.wiki-mobile-searching .wiki-lineup-nav,
  body.wiki-mobile-editing .wiki-lineup-nav,
  body:has(.item.textEditing) .wiki-lineup-nav,
  body:has(.item.imageEditing) .wiki-lineup-nav,
  body.wiki-page-lineup-shrunk .wiki-lineup-nav,
  body.wiki-item-lineup-dragging .wiki-lineup-nav,
  body.wiki-journal-merging .wiki-lineup-nav {
    display: none !important;
  }


  /* Mobile: name stays natural width; padlock/edit follow it; search fills leftover.
     Modest gap so 40×40 hit squares are not butted edge-to-edge.
     One-row vertical pad 5px (was stock 10px) — shorter chrome before flags stack;
     .neighborhood-above still overrides to --footer-stack-gap. */
  footer,
  footer.neighborhood-above {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    --footer-controls-gap: 4px;
    column-gap: var(--footer-controls-gap);
    height: auto;
    min-height: 0;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-left: 2px;
    padding-right: 4px;
  }

  footer.neighborhood-above {
    /* Exactly two rows: flags, then footer controls. Grid keeps menu/owner/lock/edit/search/pages
       on one line — name stays max-content (never ellipsized on mobile). */
    display: grid;
    /* menu | owner | 1fr gap | security | controls.
       Leftover sits after the display name and before the padlock — not after pages.
       Search keeps a comfortable JS width; controls stay max-content. */
    grid-template-columns: auto max-content minmax(0, 1fr) auto max-content;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: var(--footer-controls-gap);
    /* One gap for: footer-top→flags→controls→footer-bottom. */
    --footer-stack-gap: 4px;
    row-gap: var(--footer-stack-gap);
    padding-top: var(--footer-stack-gap);
    padding-bottom: var(--footer-stack-gap);
    /* Let flag spin corners paint into the stack gaps. */
    overflow: visible;
  }

  /* Mobile never applies .footer-controls-tight — display name must stay fully visible. */

  footer .neighborhood {
    flex: 0 0 auto;
    margin-left: 0;
    min-width: 0;
    background: transparent;
    background-image: none;
    /* Spin clearance for .wait/.fetch rotate; negative margins keep external gaps. */
    padding-top: 6px;
    padding-bottom: 6px;
    margin-top: -6px;
    margin-bottom: -6px;
    overflow: visible;
  }

  footer.neighborhood-above .neighborhood {
    grid-column: 1 / -1;
    grid-row: 1;
    flex: unset;
    order: unset;
    width: auto;
    max-width: 100%;
    min-width: 0;
    justify-content: flex-end;
    overflow: hidden;
  }

  footer.neighborhood-above .neighborhood.overflowing,
  footer.neighborhood-above .neighborhood.scrollable {
    justify-content: flex-start;
  }

  footer.neighborhood-above .neighborhood-track {
    flex: 0 0 auto;
    width: max-content;
    max-width: none;
    margin-left: auto;
    margin-right: 0;
  }

  footer.neighborhood-above .neighborhood.overflowing .neighborhood-track,
  footer.neighborhood-above .neighborhood.scrollable .neighborhood-track {
    margin-left: 0;
  }

  /* Keep origin in the pack — never isolate it with an auto margin. */
  footer.neighborhood-above .neighborhood-track > .neighbor {
    margin-left: 0;
  }

  footer.neighborhood-above > .footer-content-row {
    display: contents;
  }

  /* Direct footer child on mobile (neighbors.placeMenuIn) so grid column 1 is the
     ☰ tap target outside the search flex item — 40×40 for a usable finger hit.
     Extra margin-right when owner/security collapse so ☰ never sits on edit. */
  footer .footer-menu {
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    margin: 0;
    padding: 0;
    font-size: 22px;
    line-height: 1;
    /* ☰ sits high in most fonts — nudge for optical vertical center vs Wiki-by. */
    transform: translateY(1px);
  }

  footer.neighborhood-above > .footer-menu {
    grid-column: 1;
    grid-row: 2;
  }

  /* Two-line "Wiki by:" / name — child combinator only. Legacy
     <span id="site-owner"> also matched `footer #site-owner`, picked up
     align-self:center, and centered the display name under the label. */
  footer > #site-owner {
    /* Full natural width until search hits the 🔍 floor (.footer-controls-tight).
       min-width:0 + overflow:hidden here used to let the grid crush the name while
       search kept --footer-search-width — opposite of the intended priority. */
    flex: 0 0 auto;
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    width: auto;
    min-width: max-content;
    max-width: none;
    margin: 0;
    padding: 0;
    line-height: 1.15;
    font-size: 14px;
    font-weight: 400;
    color: #c8c8c8;
    white-space: nowrap;
    overflow: visible;
    box-sizing: border-box;
  }

  footer.neighborhood-above > #site-owner {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    width: auto;
    min-width: max-content;
    max-width: none;
    overflow: visible;
  }

  footer > #site-owner .site-owner-label {
    display: block;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    text-align: left;
    text-indent: 0;
    font-size: 14px;
    font-weight: 400;
    color: #c8c8c8;
    line-height: 1.15;
    overflow: visible;
    text-overflow: clip;
  }

  footer > #site-owner .site-owner-name {
    display: block;
    width: auto;
    min-width: max-content;
    max-width: none;
    margin: 0;
    padding: 0;
    text-align: left;
    text-indent: 0;
    /* Inherit .page 0.875rem (~14px) — do not bump owner name to 16px. */
    font-size: inherit;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.15;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
  }

  /* Legacy "Wiki by: <span id=site-owner>" from security plugins — bold/white the name
     even before neighbors.normalizeSiteOwnerMarkup restores .site-owner-name.
     Do not bold .site-owner-label. */
  footer > #site-owner > span {
    align-self: flex-start;
    text-align: left;
  }

  footer > #site-owner > span#site-owner {
    font-weight: 700;
    color: #ffffff;
  }

  footer #security {
    flex: 0 0 auto;
    margin-left: 0;
    margin-right: 0;
  }

  footer.neighborhood-above > #security {
    grid-column: 4;
    grid-row: 2;
  }

  footer > #site-owner.footer-item,
  footer #security.footer-item,
  footer .footer-item {
    margin-left: 0;
  }

  footer > #site-owner.footer-item {
    display: flex;
  }

  footer .footer-controls,
  footer.neighborhood-above .footer-controls {
    flex: 0 0 auto;
    width: auto;
    /* Search width is JS-driven; keep pages/edit from being crushed to zero. */
    min-width: min-content;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    /* Match footer column-gap — was larger and stole name space. */
    gap: var(--footer-controls-gap, 4px);
  }

  footer.neighborhood-above > .footer-controls {
    grid-column: 5;
    grid-row: 2;
    margin-right: 0;
    margin-left: 0;
    /* Pack edit+search+pages; leftover is the 1fr track before #security. */
    flex: 0 0 auto;
    width: auto;
    min-width: min-content;
    max-width: none;
  }

  /* Edit before search: keep the toggle next to the padlock; search+pages trail right.
     Hit square stays 40×40; pill+label below are visually smaller so edit doesn't
     dominate next to the padlock / 32px search field. */
  footer .wiki-edit-toggle {
    order: 1;
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    margin: 0;
    gap: 1px;
    background: transparent;
  }

  /* Beat desktop .footer-controls .wiki-edit-toggle { margin-left: 0.15em } —
     padlock and edit sit in adjacent 40×40 hit squares with --footer-controls-gap. */
  footer .footer-controls .wiki-edit-toggle {
    margin-left: 0;
  }

  footer .wiki-edit-desktop-label {
    display: none;
  }

  /* Keep .editEnable in the DOM for plugins that still gate on
     $('.editEnable').is(':visible'). Use opacity + 1×1 layout — not
     clip:rect(0,0,0,0) — so jQuery treats it as visible on mobile. */
  footer .editEnableSlot {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }

  footer .wiki-edit-mobile {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
  }

  /* Compact pill (was 34×18 / 14px knob) — tap target remains the 40×40 parent. */
  footer .edit-toggle-track {
    width: 28px;
    height: 14px;
  }

  footer .edit-toggle-knob {
    width: 10px;
    height: 10px;
  }

  footer .wiki-edit-toggle.is-on .edit-toggle-knob {
    transform: translateX(14px);
  }

  footer .wiki-edit-toggle.is-on .edit-toggle-track {
    background: #30d158;
    border-color: #12a836;
  }

  /* High contrast on the footer (footer text color is light). */
  footer .edit-toggle-label {
    font-size: 12px;
    color: #f2f2f2;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.55);
  }

  /* Beat desktop `.footer-controls .searchbox { flex: 0 1 auto }` (0,2,0).
     Width comes from --footer-search-width (neighbors.js) — leftover after the full name.
     Do not flex-grow: growth + a crushable owner let search steal name space. */
  footer .footer-controls .searchbox,
  footer .searchbox {
    order: 2;
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: var(--footer-controls-gap, 4px);
    width: auto;
  }

  footer .footer-controls .searchbox .pages,
  footer .searchbox .pages {
    /* Do not use margin-left:auto — it can inflate the searchbox and steal name space.
       min 40×40 tap square; width grows for "N pages" (do not crush the count). */
    margin-left: 0;
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    box-sizing: border-box;
    min-width: 40px;
    min-height: 40px;
    gap: 0;
    white-space: normal;
    font-size: 14px;
    line-height: 1.1;
    text-align: right;
    padding: 0;
  }

  footer .neighbor {
    /* 34×34 tap square (was 40, then 32) — 3px pad around the 28px flag. */
    position: relative;
    flex: 0 0 auto;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    touch-action: manipulation;
  }

  footer .neighbor::after {
    display: none;
  }

  footer .neighbor > div {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
  }

  footer .neighbor img {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    pointer-events: none;
  }

  footer #security a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    /* Keep tap size; drop side padding that ate room before the edit toggle. */
    padding: 0;
    background: transparent;
  }

  footer #security img {
    width: 22px;
    height: 22px;
  }

  /* Idle/active: width from --footer-search-width (neighbors.js fills leftover after name).
     Height 32px (was 28) — a bit taller in the 40px control band; menu/lock stay 40px.
     Prefer the JS width, but allow shrink toward the floor if the controls column is
     squeezed — never steal that pressure from the display name. */
  footer .footer-controls .searchbox .search-field,
  footer .searchbox .search-field {
    flex: 0 1 auto;
    width: var(--footer-search-width, 32px);
    min-width: 32px;
    max-width: var(--footer-search-width, none);
    height: 32px;
    overflow: hidden;
    box-sizing: border-box;
    justify-content: flex-start;
  }

  footer .footer-controls .searchbox .pages,
  footer .searchbox .pages {
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
  }

  footer input.search {
    flex: 1 1 auto;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 32px;
    height: 32px;
    padding: 0 6px;
    text-align: left;
    touch-action: manipulation;
  }

  /* Classic 🔍 / "🔍 Search" placeholder — no SVG ::before overlay (user preference;
     Android may strip emoji on some builds, but the text fallback still reads as search). */
  footer .search-field input.search::placeholder {
    color: #666;
    opacity: 1;
  }

  body.wiki-mobile-searching footer .search-field input.search,
  footer .search-field:focus-within input.search {
    text-align: left;
    padding: 0 8px;
    /* Do not inherit footer chrome color — typed text sits on the white field. */
    color: #000;
  }

  /* Active search: same JS width as idle (leftover after full name). Do not
     force min 9em — that crushed #site-owner while the field looked "expanded". */
  body.wiki-mobile-searching footer .footer-controls .searchbox .search-field,
  body.wiki-mobile-searching footer .searchbox .search-field {
    flex: 0 1 auto;
    width: var(--footer-search-width, 32px);
    min-width: 32px;
    max-width: var(--footer-search-width, none);
    justify-content: flex-start;
  }

  /* Clear: in-flow square hit target matching the 32px field; circle centered.
     Keep min-width in px — em would collapse under font-size:0 on the button. */
  footer .footer-controls .searchbox.has-search-clear .search-clear,
  footer .searchbox.has-search-clear .search-clear {
    flex: 0 0 32px;
    width: 32px;
    height: auto;
    align-self: stretch;
    min-width: 32px;
    min-height: 32px;
    max-height: none;
    background: transparent;
    justify-content: center;
    padding: 0;
  }

  footer .footer-controls .searchbox.has-search-clear .search-clear-glyph,
  footer .searchbox.has-search-clear .search-clear-glyph {
    width: 16px;
    height: 16px;
  }

  footer .searchbox.has-search-clear .search-clear-glyph::before,
  footer .searchbox.has-search-clear .search-clear-glyph::after {
    height: 2px;
    width: 58%;
  }

  /* Item edit on mobile: in-story like desktop. Natural size so neighbors stay
     visible; cap only when the editor exceeds the space above the IME.
     Hide footer/flags for keyboard room. Do not use position:fixed / overlays /
     scrollIntoView — those produced a blank screen on mobile. */
  body.wiki-mobile-editing,
  body:has(.item.textEditing),
  body:has(.item.imageEditing) {
    --footer-height: 0px;
  }

  body.wiki-mobile-editing footer,
  body:has(.item.textEditing) footer,
  body:has(.item.imageEditing) footer,
  body.wiki-mobile-editing .wiki-flag-tip,
  body:has(.item.textEditing) .wiki-flag-tip,
  body:has(.item.imageEditing) .wiki-flag-tip {
    display: none !important;
  }

  body.wiki-mobile-editing .item.textEditing textarea,
  body.wiki-mobile-editing .item.imageEditing textarea,
  body:has(.item.textEditing) .item.textEditing textarea,
  body:has(.item.imageEditing) .item.imageEditing textarea {
    display: block;
    width: calc(100% - 12px);
    /* min() so a 150px floor cannot stick out under the IME when
       --wiki-editor-max-height is the visual viewport. */
    min-height: min(150px, var(--wiki-editor-max-height, 150px));
    max-height: var(--wiki-editor-max-height, 70vh);
    margin-left: 2px;
    resize: vertical;
    line-height: inherit;
    box-sizing: border-box;
    /* hidden until content exceeds max-height (editor.js). overflow:auto or
       touch-action:pan-y on a short field lets the browser eat the first pan.
       none + JS in editor.js send that swipe to .page / .main. */
    overflow-x: hidden;
    overflow-y: hidden;
    touch-action: none;
    -webkit-user-select: text;
    user-select: text;
  }

  body.wiki-mobile-editing .item.imageEditing img,
  body:has(.item.imageEditing) .item.imageEditing img {
    max-width: 100%;
    max-height: 28vh;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  /* Backlink rows: flex (not float) so 40×40 flag hit boxes stay centered on the glyph. */
  .backlinks .backlink-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    clear: both;
  }

  .backlinks .backlink-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .backlinks .backlink-flags {
    display: inline-flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
    line-height: 0;
  }

  .backlinks .backlink-flags img.remote {
    display: block;
    width: 16px;
    height: 16px;
    padding: 12px;
    box-sizing: content-box;
    margin: 0;
    touch-action: manipulation;
  }
}

.factory p,
.factory li,
.factory a {
  font-size: 14px;
}

/* Mobile long-press replacement for desktop title tooltips on flags. */
.wiki-flag-tip {
  position: fixed;
  z-index: 10050;
  max-width: min(280px, calc(100vw - 24px));
  padding: 8px 10px;
  background: rgba(28, 28, 28, 0.94);
  color: #f5f5f5;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-line;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

img.remote,
img.favicon,
.neighbor {
  -webkit-touch-callout: none;
}

/* from Replace SortableJS CSS */

.page.ui-sortable-placeholder {
  visibility: hidden;
}

.journal.ui-draggable,
.journal.ui-draggable * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  user-drag: none;
  touch-action: none;
}

.main > .journal.ui-draggable-dragging,
.main > .journal.ui-draggable-dragging * {
  pointer-events: none !important;
}

