:root {
  --bg: #f4efe4; --paper: #fffdf8; --ink: #2a241c; --muted: #7a6f60; --line: #ddd2bf;
  --head: #3b2f22; --head-ink: #f7e9c8; --accent: #8a4b14; --link: #1f5d99; --red: #b3261e;
  --good: #2f7d32; --warn: #b26a00; --shade: #f1e8d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f; --paper: #211c16; --ink: #ece3d2; --muted: #a39682; --line: #3a3127;
    --head: #0f0c09; --head-ink: #f2d9a0; --accent: #e0a35a; --link: #8cc4ff; --red: #ff8a80;
    --good: #81c784; --warn: #ffb74d; --shade: #2a231b;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 "Segoe UI", system-ui, sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: Consolas, ui-monospace, monospace; font-size: .92em; background: var(--shade); padding: 0 .25em; border-radius: 3px; }
.top { display: flex; gap: 16px; align-items: center; justify-content: space-between; background: var(--head); color: var(--head-ink); padding: 10px 16px; flex-wrap: wrap; }
.brand { color: var(--head-ink); font-weight: 700; font-size: 1.25rem; letter-spacing: .02em; }
.brand span { font-weight: 400; opacity: .75; }
.search { position: relative; flex: 1 1 260px; max-width: 460px; }
.search input { width: 100%; padding: 7px 10px; border-radius: 6px; border: 1px solid #000; background: var(--paper); color: var(--ink); }
#results { position: absolute; z-index: 10; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px 0; list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-height: 60vh; overflow: auto; }
#results li a { display: flex; justify-content: space-between; gap: 8px; padding: 5px 10px; color: var(--ink); }
#results li a.sel, #results li a:hover { background: var(--shade); text-decoration: none; }
#results small { color: var(--muted); }
.menu { display: flex; flex-wrap: wrap; gap: 2px 18px; padding: 8px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.menu a { color: var(--accent); font-weight: 600; }
.menu a.staff { color: var(--muted); margin-left: auto; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; background: var(--paper); min-height: 70vh; overflow: hidden; }
footer { max-width: 1100px; margin: 0 auto; padding: 12px 16px 32px; color: var(--muted); font-size: .85em; }
h1 { margin: .2em 0 .4em; font-size: 1.8rem; color: var(--accent); }
h2 { border-bottom: 1px solid var(--line); padding-bottom: 2px; margin-top: 1.4em; font-size: 1.3rem; }
.crumb { color: var(--muted); font-size: .9em; margin: 0; }
.lead { font-size: 1.05em; }
.note, .src, .muted { color: var(--muted); }
.note { font-size: .9em; }
.src { font-size: .8em; margin-top: 2em; border-top: 1px dashed var(--line); padding-top: 6px; }
.missing { color: var(--muted); font-style: italic; }
.alert { background: #fdecea; color: #7a1c14; border: 1px solid #f5c2bd; padding: 8px 12px; border-radius: 6px; }
.redlink { color: var(--red); }
.unknown { color: #888; font-weight: bold; letter-spacing: .1em; cursor: help; }
.badge { display: inline-block; font-size: .7rem; font-weight: 600; padding: 1px 7px; border-radius: 10px; vertical-align: middle; background: var(--shade); color: var(--muted); border: 1px solid var(--line); }
.badge.boss { background: #6a1b9a; color: #fff; border-color: #6a1b9a; }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.novo { color: var(--good); border-color: var(--good); }
.badge.removido { color: var(--red); border-color: var(--red); }
.badge.alterado { color: var(--warn); border-color: var(--warn); }
.infobox { float: right; width: 300px; margin: 0 0 16px 20px; border: 1px solid var(--line); background: var(--shade); border-radius: 8px; padding: 10px; font-size: .9em; }
.infobox-img { text-align: center; padding: 6px 0 10px; }
.infobox table { width: 100%; border-collapse: collapse; }
.infobox th { text-align: left; font-weight: 600; padding: 3px 6px 3px 0; vertical-align: top; width: 48%; }
.infobox td { padding: 3px 0; }
.infobox tr + tr { border-top: 1px solid var(--line); }
.infobox h3 { font-size: 1em; margin: 12px 0 6px; }
img.big { image-rendering: pixelated; max-width: 100%; height: auto; }
img.ico, .ico.noimg { width: 32px; height: 32px; image-rendering: pixelated; object-fit: contain; vertical-align: middle; flex: none; }
.ico.noimg { display: inline-block; background: repeating-linear-gradient(45deg, var(--line) 0 4px, transparent 4px 8px); border-radius: 4px; }
.itemcell { display: inline-flex; align-items: center; gap: 6px; }
.elements { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.elements li { display: flex; justify-content: space-between; padding: 2px 6px; border-radius: 4px; background: var(--paper); }
.elements .immune b { color: var(--good); }
.elements .strong b { color: var(--good); opacity: .8; }
.elements .weak b { color: var(--red); }
table.grid { border-collapse: collapse; width: auto; min-width: 50%; margin: 8px 0 12px; font-size: .92em; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: middle; }
table.grid thead th { background: var(--shade); position: sticky; top: 0; }
table.sortable thead th { cursor: pointer; user-select: none; }
table.sortable thead th.asc::after { content: " ▲"; font-size: .7em; }
table.sortable thead th.desc::after { content: " ▼"; font-size: .7em; }
.filter { margin: 6px 0 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--ink); width: min(320px, 100%); }
.rar { font-weight: 600; font-size: .85em; }
.r-always { color: var(--good); } .r-common { color: #3a7d44; } .r-uncommon { color: #6b7f2a; }
.r-semirare { color: var(--warn); } .r-rare { color: #c0392b; } .r-veryrare { color: #8e24aa; }
.cols { display: flex; gap: 24px; flex-wrap: wrap; }
.cols > div { flex: 1 1 280px; }
.portals { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.portals section ul { margin: 0; padding-left: 18px; }
.portals.home .portal { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--shade); color: var(--ink); }
.portals.home .portal:hover { border-color: var(--accent); text-decoration: none; }
.portal b { color: var(--accent); font-size: 1.1em; }
.portal span { font-size: 1.6em; font-weight: 700; }
.portal small { color: var(--muted); }
.changes { list-style: none; padding: 0; }
.changes li { padding: 3px 0; border-bottom: 1px dotted var(--line); }
.changes .fields { margin: 4px 0; font-size: .85em; }
.voices q { font-style: italic; }
.cloud a { display: inline-block; margin: 0 8px 2px 0; }
details.raw { margin-top: 1.5em; }
@media (max-width: 720px) {
  .infobox { float: none; width: 100%; margin: 0 0 16px; }
  table.grid { display: block; overflow-x: auto; min-width: 0; }
  .menu a.staff { margin-left: 0; }
}
