.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;
}

.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 - var(--footer-height, 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;
  bottom: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  height: 20px;
  padding: 10px;
  font-size: 80%;
  z-index: 1000;
  color: #ccdcd2;
  box-sizing: content-box;
}

footer form,
.footer-item {
  display: inline;
}

.item-placeholder {
  border: 2px dotted #bbb;
  background: #eee;
}

.footer-item {
  margin-left: 6px;
}

.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;
}

@media (max-width: 490px) {
  .incremental-search {
    display: block;
    max-width: none;
    width: 100%;
    left: 0;
    right: 0;
    box-sizing: border-box;
    z-index: 1000;
  }
}

.search-term {
  background-color: yellow;
}

.neighbor {
  float: none;
  flex: 0 0 auto;
  padding-left: 6px;
  width: 16px;
}

footer input.search {
  width: 10em;
  flex: 0 1 10em;
  min-width: 3em;
  max-width: 10em;
  box-sizing: border-box;
}

/* 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;
}

footer .wiki-edit-toggle {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
  white-space: nowrap;
}

footer .wiki-edit-mobile {
  display: none;
}

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: 0.65rem;
  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;
}

.footer-controls .searchbox {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
  /* Classic markup used &nbsp; before/after the input — keep a modest gap. */
  gap: 0.3em;
}

.footer-controls .searchbox .pages {
  margin-left: 0;
}

.footer-controls .footer-menu {
  flex: 0 0 auto;
  /* Classic markup used "&nbsp; ☰ " — keep that breathing room via margin. */
  margin-left: 0.4em;
  margin-right: 0.25em;
}

.footer-controls .wiki-edit-toggle {
  flex: 0 0 auto;
  white-space: nowrap;
}

footer > #site-owner,
footer > #security {
  flex: 0 0 auto;
  white-space: nowrap;
}

.neighborhood {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
  overflow: visible; /* spinning flags; clip only while .overflowing / .scrollable */
}

.neighborhood-track {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
  will-change: transform;
}

/* Stacked: flags on their own row; JS wraps chrome in .footer-chrome (unwraps when not stacked). */
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;
}

footer.neighborhood-above > .footer-chrome {
  display: flex;
  flex: 1 0 100%;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
  column-gap: 0;
}

footer.neighborhood-above .footer-controls {
  flex: 0 1 auto;
  min-width: 0;
}

footer.neighborhood-above input.search {
  flex: 0 1 10em;
  min-width: 3em;
}

.neighborhood.overflowing,
.neighborhood.scrollable {
  overflow: hidden;
  padding-top: 6px;
  padding-bottom: 6px;
  margin-top: -6px;
  margin-bottom: -6px;
  box-sizing: border-box;
}

.neighborhood.overflowing .neighborhood-track {
  margin-left: 0;
}

.neighborhood-chevron {
  display: none;
  position: absolute;
  z-index: 6;
  box-sizing: border-box;
  width: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  appearance: none;
  -webkit-appearance: none;
  font-size: 16px;
  font-weight: 700;
  line-height: 0;
  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;
    padding-top: 1px; /* optical center for ‹ › */
  }
}

footer .neighbor[draggable='true'] {
  touch-action: none;
  user-select: none;
}

footer .neighbor.lifting {
  position: relative;
  z-index: 5;
  opacity: 0.75;
}

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;
}

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;
}

.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;*/
}

.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;
}

/* 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;
}

.header span {
  z-index: 2;
  position: relative;
}

.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) {
  /* Readable mobile floor — footer chrome text ≥16px. */
  body,
  footer,
  .page {
    font-size: 16px;
  }

  .page {
    width: 1%;
    margin: 8px;
    padding: 0;
    flex: 0 0 100vw;
    overflow-x: unset;
    scroll-snap-align: center;
  }

  .main {
    scroll-snap-type: x mandatory;
  }

  /* Mobile footer: one row, or flags above + .footer-chrome. */
  footer,
  footer.neighborhood-above {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    column-gap: 2px;
    height: auto;
    min-height: 0;
    padding-left: 4px;
    padding-right: 8px;
  }

  footer.neighborhood-above {
    flex-wrap: wrap;
    row-gap: 2px;
  }

  footer .neighborhood {
    flex: 0 0 auto;
    margin-left: 0;
    min-width: 0;
    background: transparent;
    background-image: none;
    padding-top: 6px;
    padding-bottom: 6px;
    margin-top: -6px;
    margin-bottom: -6px;
  }

  footer.neighborhood-above .neighborhood {
    flex: 1 0 100%;
    order: -1;
  }

  footer.neighborhood-above > .footer-chrome {
    column-gap: 2px;
  }

  footer .footer-menu {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    font-size: 18px;
    line-height: 1;
  }

  footer #site-owner {
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    width: max-content;
    max-width: 7.5rem;
    margin: 0;
    line-height: 1.15;
    font-size: 14px;
    font-weight: 400;
    color: #c8c8c8;
    white-space: nowrap;
  }

  footer #site-owner > span,
  footer #site-owner > #site-owner {
    display: block;
    width: max-content;
    max-width: 7.5rem;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  footer #security {
    flex: 0 0 auto;
    margin-left: 0;
  }

  footer #site-owner.footer-item,
  footer #security.footer-item {
    margin-left: 0;
  }

  footer .footer-controls,
  footer.neighborhood-above .footer-controls {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
  }

  footer .wiki-edit-toggle {
    order: 1;
    flex: 0 0 auto;
    flex-direction: column;
    min-width: 40px;
    min-height: 40px;
    padding: 0 4px;
    gap: 2px;
    background: transparent;
  }

  footer .wiki-edit-desktop-label {
    display: none;
  }

  /* Keep .editEnable mounted for :visible checks; hide the ✔︎ glyph on mobile. */
  footer .editEnableSlot {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
  }

  footer .wiki-edit-mobile {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }

  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: 14px;
    color: #f2f2f2;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.55);
  }

  footer .searchbox {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
  }

  footer .searchbox .pages {
    margin-left: auto;
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    white-space: normal;
    font-size: 14px;
    line-height: 1.1;
    text-align: right;
  }

  footer .neighbor {
    width: 28px;
    padding-left: 8px;
  }

  footer .neighbor img {
    width: 28px;
    height: 28px;
  }

  footer #security a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 40px;
    box-sizing: border-box;
    /* Pull the glyph toward Wiki-by; keep a usable tap target. */
    padding: 0 4px 0 2px;
    background: transparent;
  }

  footer #security img {
    width: 22px;
    height: 22px;
  }

  footer input.search {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    min-width: 2.25em;
    min-height: 32px;
    height: 32px;
    font-size: 16px;
    padding: 0 8px;
  }
}

* {
  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;
}
