/* RUNEBROKERS — OSRS Wiki (MediaWiki) homage. Tan parchment theme, serif
   headings, rust links, classic sortable wikitables. */

:root {
  --bg-page: #e2dbc8;
  --bg-content: #eae3d3;
  --bg-table: #ece5d4;
  --bg-table-alt: #e7dfcc;
  --bg-th: #d5c7a9;
  --border: #94866d;
  --border-soft: #b4a785;
  --text: #1a1712;
  --link: #936039;
  --link-hover: #b3714a;
  --note: #5d5646;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg-page);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

img { image-rendering: pixelated; }
img.brand { image-rendering: auto; }
.brand-top { height: 58px; width: auto; display: block; }
.brand-h1 { height: 92px; width: auto; vertical-align: middle; }
.brand-ib { width: 92%; height: auto; margin: 2px 0; }
.titlelogo { display: flex; align-items: flex-end; gap: 10px; }

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

code {
  background: #ddd5bf;
  border: 1px solid var(--border-soft);
  padding: 0 4px;
  font-size: 13px;
}

/* ===== top bar ===== */
.wiki-topbar {
  background: url("/img/topbar.png") repeat-x center / auto 100%, #241d12;
  border-bottom: 3px solid #94866d;
}
.wt-inner {
  max-width: 1680px; margin: 0 auto; padding: 8px 16px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.wt-logo {
  color: #e9dfc8; font-weight: bold; font-size: 21px;
  font-family: Georgia, 'Times New Roman', serif;
  display: flex; align-items: center; gap: 8px;
}
.wt-logo em { color: #cbb87f; font-style: italic; font-weight: normal; }
.wt-search { flex: 1; min-width: 200px; color: #cbb87f; text-align: center; }
.wt-search input {
  width: min(420px, 90%); padding: 7px 12px;
  border: 1px solid var(--border); background: #efe9da;
  font-family: inherit; font-size: 14px;
}
.wt-mint {
  background: url("img/button.png") no-repeat center / 100% 100%;
  color: #fff !important; text-shadow: 0 2px 3px #000d;
  padding: 12px 26px;
  border: none; font-weight: bold;
}
.wt-mint:hover { filter: brightness(1.22); text-decoration: none; }
.wt-mint:active { transform: translateY(1px); filter: brightness(0.95); }
button.wt-mint { font-family: inherit; font-size: 15px; cursor: pointer; }

/* ===== the vault: official stone button art on parchment ===== */
.vault-panel { padding: 4px 0 6px; }
.vault-playing { font-weight: bold; font-size: 17px; margin-bottom: 12px; }
.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  max-width: 1200px;
}
.stone-btn {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bold; font-size: 24px; line-height: 1.25;
  color: #fff; text-shadow: 0 2px 3px #000d;
  cursor: pointer;
  border: none; outline: none;
  background: url("img/button.png") no-repeat center / 100% 100%;
  aspect-ratio: 2076 / 610;
  width: 100%;
  padding: 10px 16px;
}
.stone-btn:hover { filter: brightness(1.22); }
.stone-btn:active { transform: translateY(2px); filter: brightness(0.95); }
.vault-link, .dapp-status {
  font-size: 15.5px; margin-top: 12px;
  color: #4c7a1e; font-weight: bold;
  max-width: 1200px; text-align: center;
}
.dapp-status.ok { color: #4c7a1e; }
.dapp-status.err { color: #8f1a1a; }

/* ===== wallet picker ===== */
.wmodal {
  position: fixed; inset: 0; z-index: 95;
  background: #2b2416cc;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.wmodal[hidden] { display: none; }
.wmodal-card {
  background: var(--bg-content);
  border: 1px solid var(--border);
  box-shadow: 0 8px 40px #0009;
  width: 340px; max-width: 100%;
}
.wmodal-head {
  background: var(--bg-th); border-bottom: 1px solid var(--border);
  font-weight: bold; padding: 9px 12px; position: relative;
  font-family: Georgia, serif; font-size: 17px;
}
.wmodal-x {
  position: absolute; top: 7px; right: 8px;
  background: #936039; color: #f4edda; border: 1px solid #5d3b20;
  font-family: inherit; font-size: 13px; width: 24px; height: 24px; cursor: pointer;
}
.wmodal-list { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.wmodal-row {
  display: flex; align-items: center; gap: 10px;
  font-family: inherit; font-size: 16px; text-align: left;
  background: #efe9da; color: var(--text);
  border: 1px solid var(--border-soft); padding: 9px 12px; cursor: pointer;
}
.wmodal-row:hover { border-color: var(--border); background: #f4efe2; }
.wmodal-row img { width: 26px; height: 26px; image-rendering: auto; }
.wmodal-fine { font-size: 12.5px; color: var(--note); padding: 0 12px 10px; text-align: center; }

/* ===== broker item page ===== */
.crumbs { font-size: 13.5px; color: var(--note); margin: 2px 0 6px; }
.crumb-nav { float: right; }
.ib-sub {
  text-align: center !important; background: var(--bg-th) !important;
  font-family: Georgia, serif; font-size: 16px;
}

/* ===== page frame ===== */
.page { max-width: 1680px; margin: 0 auto; padding: 0 16px 40px; }

.pagetabs {
  display: flex; justify-content: space-between; align-items: flex-end;
  border-bottom: 1px solid var(--border);
  margin-top: 14px; flex-wrap: wrap;
}
.pt {
  display: inline-block; padding: 6px 16px; font-size: 14.5px;
  background: #ddd5c0; border: 1px solid var(--border); border-bottom: none;
  margin-right: 3px; color: var(--link); cursor: default;
}
.pt.on { background: var(--bg-content); color: var(--text); position: relative; top: 1px; }
a.pt { cursor: pointer; text-decoration: none; }
a.pt:hover { background: #e5ddc6; text-decoration: none; }

.article {
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-top: none;
  padding: 10px 18px 22px;
  display: flow-root; /* contain floated infoboxes on short pages */
}
.article[hidden] { display: none; } /* flow-root must not defeat the hidden attribute */

/* ===== headings, wiki chrome ===== */
h1, h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: normal;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 2px;
  margin: 4px 0 7px;
  overflow: hidden;
}

h3 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: bold;
  font-size: 19px;
  margin: 14px 0 5px;
}
h1 { font-size: 32px; }
h2 { font-size: 25px; margin-top: 24px; }

.editsection { font-size: 14px; font-family: Arial, sans-serif; color: var(--note); white-space: nowrap; }
.editsection a { color: var(--link); }

.sitesub { font-size: 13.5px; color: var(--note); margin-bottom: 8px; }

.article > p { margin: 7px 0; max-width: 96ch; }
.wiki-note { font-size: 14px; color: var(--note); font-style: italic; }

/* ===== infobox ===== */
.infobox {
  float: right; width: 400px; margin: 0 0 16px 26px;
  background: #e4dbc4;
  border: 1px solid var(--border);
  border-collapse: collapse;
  font-size: 14.5px;
}
.infobox th, .infobox td { border: 1px solid var(--border-soft); padding: 3px 7px; }
.infobox th { text-align: left; background: #dbd0b4; width: 42%; }
.ib-title {
  text-align: center !important; font-size: 21px;
  font-family: Georgia, serif; background: var(--bg-th) !important;
}
.ib-img { text-align: center; background: #efe9da; }
.ib-img img { display: block; margin: 0 auto; width: min(336px, 100%); height: auto; aspect-ratio: 1; }
.ib-caption { font-size: 13px; color: var(--note); }
.star { color: #c9a227; }
.member-icon { height: 15px; width: auto; vertical-align: text-top; image-rendering: auto; }
.osrs-ic img {
  height: 21px; width: auto; max-width: 26px; object-fit: contain;
  vertical-align: middle; margin-right: 4px; image-rendering: auto;
}
.osrs-ic:hover img { filter: brightness(1.25) drop-shadow(0 0 3px #ffb83f88); }

/* ===== TOC ===== */
.toc {
  display: inline-block;
  background: #e7e0cd;
  border: 1px solid var(--border);
  padding: 8px 18px 8px 14px;
  margin: 8px 0 12px;
  font-size: 15px;
}
.toc-title { font-weight: bold; text-align: center; margin-bottom: 4px; }
.toc-toggle { font-weight: normal; font-size: 12px; color: var(--link); }
.toc ol { list-style: none; padding-left: 4px; }
.toc li { margin: 2px 0; }
.toc ol ol { padding-left: 18px; }

/* ===== wikitable ===== */
.wikitable {
  border-collapse: collapse;
  background: var(--bg-table);
  border: 1px solid var(--border);
  font-size: 15px;
  margin: 8px 0 14px;
}
.wikitable th, .wikitable td {
  border: 1px solid var(--border);
  padding: 4px 10px;
  text-align: left;
  vertical-align: middle;
}
.wikitable th { background: var(--bg-th); }
.wikitable tbody tr:nth-child(even) { background: var(--bg-table-alt); }
.wikitable tbody tr:hover { background: #dfd6bf; }
.wikitable img.icon { width: 48px; height: 48px; display: block; }

.sortable th { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable th::after { content: " ⇅"; font-size: 11px; color: #7c7050; }
.sortable th.asc::after { content: " ▲"; color: var(--text); }
.sortable th.desc::after { content: " ▼"; color: var(--text); }

.tier-mythic { color: #8f1a1a; font-weight: bold; text-shadow: 0 0 6px #8f1a1a33; }
.tier-legendary { color: #b57700; font-weight: bold; }
.tier-epic { color: #7c3fbf; font-weight: bold; }
.tier-rare { color: #2456a6; }
.tier-uncommon { color: #1e7d32; }
.tier-common { color: #6e6a5e; }

.loot-tables { columns: 3 420px; column-gap: 22px; }
.loot-tables table {
  width: 100%;
  break-inside: avoid;
  margin: 0 0 16px;
}
.loot-tables caption { text-align: left; padding: 2px 0 4px; font-size: 16px; }

/* ===== wiki gallery ===== */
.wiki-gallery {
  display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0;
}
.gallerybox {
  background: #efe9da;
  border: 1px solid var(--border-soft);
  padding: 6px; text-align: center;
  width: 150px; cursor: pointer;
}
.gallerybox:hover { border-color: var(--border); background: #f4efe2; }
.gallerybox img { width: 132px; height: 132px; aspect-ratio: 1; }
.gallerybox .caption { font-size: 12.5px; margin-top: 3px; line-height: 1.3; color: var(--text); }
.gallerybox .caption b { color: var(--link); }

.wiki-gallery.ex .gallerybox { width: 128px; }
.wiki-gallery.ex .gallerybox img { width: 112px; height: 112px; }

/* ===== explorer controls ===== */
.ex-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.ex-controls input, .ex-controls select, .ex-controls button {
  font-family: inherit; font-size: 15px;
  background: #efe9da; color: var(--text);
  border: 1px solid var(--border); padding: 6px 9px;
}
.ex-controls input { width: 120px; }
.ex-controls button { cursor: pointer; background: #ddd3ba; }
.ex-controls button:hover { background: #d5cab0; }
.ex-count { font-size: 14px; color: var(--note); }
#ex-sentinel { height: 2px; }

/* ===== footer ===== */
.wiki-footer {
  margin-top: 40px; border-top: 1px solid var(--border-soft);
  padding-top: 12px; font-size: 14px; color: var(--note);
}
.wiki-footer .fine { font-size: 12px; margin-top: 6px; }

/* ===== modal ===== */
.modal {
  position: fixed; inset: 0; z-index: 90;
  background: #2b2416cc;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--bg-content);
  border: 1px solid var(--border);
  box-shadow: 0 8px 40px #0009;
  padding: 20px; display: flex; gap: 20px; max-width: 560px; width: 100%;
  position: relative; flex-wrap: wrap;
}
.modal-card img { width: 264px; height: 264px; background: #efe9da; border: 1px solid var(--border-soft); flex-shrink: 0; }
.m-info { flex: 1; min-width: 200px; }
.m-info h3 { font-family: Georgia, serif; font-weight: normal; font-size: 22px; border-bottom: 1px solid var(--border-soft); }
.m-rank { font-size: 13px; color: var(--note); margin: 4px 0 10px; }
.m-table { width: 100%; font-size: 15px; }
.m-table td:first-child { background: #dbd0b4; font-weight: bold; width: 40%; }
.modal-x {
  position: absolute; top: 8px; right: 8px;
  background: #936039; color: #f4edda; border: 1px solid #5d3b20;
  font-family: inherit; font-size: 14px; width: 26px; height: 26px; cursor: pointer;
}

@media (max-width: 720px) {
  .infobox { float: none; width: 100%; margin: 12px 0; }
  .article { padding: 14px 14px 24px; }

  /* wide tables scroll sideways instead of breaking the layout */
  .wikitable { display: block; overflow-x: auto; max-width: 100%; }

  /* galleries lock to 3 tiles per row */
  .wiki-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .gallerybox { width: auto; }
  .gallerybox img { width: 100%; height: auto; }
  .wiki-gallery.ex .gallerybox { width: auto; }
  .wiki-gallery.ex .gallerybox img { width: 100%; height: auto; }
}

/* ===== legal dialog ===== */
.legal-dialog {
  border: 1px solid var(--border);
  background: var(--bg-content);
  color: var(--text);
  padding: 0;
  margin: auto; /* dead centre of the viewport */
  width: min(900px, 94vw);
  height: min(86vh, 1000px);
  display: flex; flex-direction: column;
  box-shadow: 0 10px 50px #000b;
}
.legal-dialog:not([open]) { display: none; }
@media (max-width: 720px) {
  .legal-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border: none; }
}
.legal-dialog::backdrop { background: #2b2416cc; }
.legal-head {
  background: var(--bg-th); border-bottom: 1px solid var(--border);
  font-family: Georgia, serif; font-size: 19px; font-weight: bold;
  padding: 10px 14px; position: sticky; top: 0;
}
.legal-body { padding: 6px 18px 18px; overflow-y: auto; flex: 1; }
.legal-body h4 { font-family: Georgia, serif; font-size: 16.5px; margin: 14px 0 4px; }
.legal-body p { font-size: 14px; line-height: 1.55; color: #2c2820; }
.legal-updated { font-style: italic; color: var(--note) !important; margin-top: 8px; }
.vault-legal { text-align: center; font-size: 13px; margin-top: 6px; max-width: 1200px; }
.vault-legal a { color: var(--note); text-decoration: underline dotted; }

.clue-ic { height: 26px; width: auto; vertical-align: middle; margin-right: 2px; image-rendering: auto; }

.inline-ic { height: 17px; width: auto; vertical-align: text-bottom; image-rendering: auto; }

.rh-logo { border-radius: 50%; }

/* icon tabs */
.pt-ic img { height: 15px; width: auto; vertical-align: -2px; opacity: .8; }
.pt-ic:hover img { opacity: 1; }

@media (max-width: 720px) {
  .wt-search { display: none; }
  .wt-inner { justify-content: space-between; }
}

@media (max-width: 720px) {
  h1 .editsection, h2 .editsection {
    display: block;
    font-size: 12px;
    margin: 1px 0 2px;
  }
}

@media (max-width: 720px) {
  .pagetabs { flex-wrap: nowrap; }
  .pt-left, .pt-right { display: flex; flex-wrap: nowrap; }
  .pt { padding: 5px 9px; font-size: 13px; margin-right: 2px; white-space: nowrap; }
}

/* hover preview */
.hover-preview {
  position: fixed; z-index: 80; pointer-events: none;
  background: var(--bg-content);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px #000a;
  padding: 7px;
}
.hover-preview[hidden] { display: none; }
.hover-preview img { display: block; width: 384px; height: 384px; image-rendering: pixelated; }
.hp-cap { text-align: center; font-size: 13.5px; color: var(--note); padding-top: 5px; }

/* launch section figure */
.launch-figure {
  float: right; margin: 4px 0 12px 22px; text-align: center;
  background: #efe9da; border: 1px solid var(--border-soft); padding: 10px 14px;
}
.launch-figure img { display: block; margin: 0 auto 4px; width: 168px; height: 168px; }
.launch-figure p { font-size: 12.5px; color: var(--note); max-width: 180px; }
@media (max-width: 720px) { .launch-figure { float: none; margin: 10px auto; width: fit-content; } }

.commit-hash { font-size: 11.5px; word-break: break-all; }

/* contract address bar */
.ca-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  background: #efe9da; border: 1px solid var(--border);
  padding: 7px 12px; margin: 6px auto 12px; width: fit-content; max-width: 100%;
}
.ca-logo { width: 22px; height: 22px; image-rendering: auto; flex-shrink: 0; }
.ca-label { font-weight: bold; font-size: 14px; color: var(--note); }
.ca-addr { background: none; border: none; font-size: 14.5px; word-break: break-all; }
.ca-copy {
  font-family: inherit; font-size: 15px; font-weight: bold; cursor: pointer;
  background: #936039; color: #f4edda; border: 1px solid #5d3b20;
  width: 30px; height: 30px; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .1s;
}
.ca-copy:hover { background: #a56f45; }
.ca-copy.copied { background: #1e7d32; border-color: #14501f; animation: copy-pop .3s; }
@keyframes copy-pop { 0% { transform: scale(1); } 50% { transform: scale(1.15); } 100% { transform: scale(1); } }
@media (max-width: 720px) { .ca-addr { font-size: 12px; } }

/* action dialogs */
.act-dialog {
  border: 1px solid var(--border); background: var(--bg-content);
  color: var(--text); padding: 0; margin: auto;
  width: min(440px, 92vw); box-shadow: 0 10px 50px #000b;
}
.act-dialog::backdrop { background: #2b2416cc; }
.act-head {
  background: url("/img/button.png") no-repeat center / 100% 100%;
  color: #fff; text-shadow: 0 2px 3px #000d;
  font-weight: bold; font-size: 22px; text-align: center;
  padding: 22px 16px;
}
.act-body { padding: 14px 18px 18px; }
.act-text { font-size: 15px; margin-bottom: 12px; }
.act-idrow input {
  width: 100%; font-family: inherit; font-size: 17px; text-align: center;
  background: #efe9da; color: var(--text);
  border: 1px solid var(--border); padding: 9px 10px; margin-bottom: 10px;
}
.act-idrow input:focus { outline: none; border-color: #936039; }
.act-preview {
  display: flex; align-items: center; gap: 12px;
  background: #efe9da; border: 1px solid var(--border-soft);
  padding: 8px 12px; margin-bottom: 10px; font-size: 14px;
}
.act-preview img { image-rendering: pixelated; border: 1px solid var(--border-soft); }
.act-btns { display: flex; gap: 10px; justify-content: center; margin-top: 6px; }
.act-go, .act-cancel {
  font-family: inherit; font-size: 15px; font-weight: bold; cursor: pointer;
  padding: 9px 22px; border: 1px solid #5d3b20;
}
.act-go { background: #936039; color: #f4edda; }
.act-go:hover:not(:disabled) { background: #a56f45; }
.act-go:disabled { opacity: .45; cursor: not-allowed; }
.act-cancel { background: #ddd3ba; color: var(--text); border-color: var(--border); }
.act-cancel:hover { background: #d5cab0; }

/* vault browser inside the buy dialog */
.act-vault { margin-bottom: 10px; }
.act-vault-head { font-weight: bold; font-size: 13.5px; color: var(--note); margin-bottom: 6px; }
.act-vault-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px;
  max-height: 220px; overflow-y: auto;
  background: #efe9da; border: 1px solid var(--border-soft); padding: 6px;
}
.act-vitem {
  background: none; border: 1px solid transparent; cursor: pointer; padding: 2px;
  font-family: inherit; font-size: 10.5px; color: var(--note);
}
.act-vitem:hover { border-color: #936039; background: #f4efe2; }
.act-vitem img { width: 100%; height: auto; image-rendering: pixelated; display: block; }
.act-vault-empty { font-size: 13px; color: var(--note); padding: 10px; text-align: center; }

.ca-stack { display: flex; flex-direction: column; gap: 6px; margin: 6px auto 12px; width: fit-content; max-width: 100%; }
.ca-stack .ca-bar { margin: 0; }

.gallerybox img, .wiki-gallery.ex .gallerybox img { aspect-ratio: 1; }

/* vault meter */
.vault-meter { max-width: 1200px; margin-bottom: 14px; }
.vm-track {
  position: relative; height: 30px;
  background: #2a2116;
  border: 2px solid #171208;
  box-shadow: inset 0 2px 8px #000c;
}
.vm-fill {
  height: 100%; width: 0%;
  background: linear-gradient(#ffd76e, #d99a1e 55%, #a86e08);
  transition: width 1.2s ease;
}
.vm-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 14.5px; color: #f2ecd9;
  text-shadow: 0 1px 3px #000;
}

/* CA pills inside the infobox */
.ib-cas { background: #efe9da; padding: 6px !important; }
.ib-cas .ca-bar { width: 100%; margin: 3px 0; padding: 5px 8px; gap: 7px; border-color: var(--border-soft); }
.ib-cas .ca-addr { font-size: 12.5px; }
.ib-cas .ca-label { font-size: 12.5px; }
.ib-cas .ca-logo { width: 18px; height: 18px; }
.ib-cas .ca-copy { width: 26px; height: 26px; font-size: 13px; margin-left: auto; }
.ib-cas .ca-addr { flex: 1; overflow: hidden; white-space: nowrap; }
