/* Strings wiki. Colours come from client/scripts/ui/ui_kit.gd (C_BG, C_BORDER,
   C_TEXT, C_ACCENT, C_FRAME_GOLD...) and item_slot.gd (rarity colours). */
:root {
  --bg: #120f17;          /* C_BG */
  --bg-light: #241f2b;    /* C_BG_LIGHT */
  --panel: #0f0d14;       /* C_PANEL */
  --slot: #1a171f;        /* C_SLOT */
  --slot-dark: #08050a;   /* C_SLOT_DARK */
  --border: #8c6b47;      /* C_BORDER */
  --gold: #a88045;        /* C_FRAME_GOLD */
  --gold-dk: #4d3620;     /* C_FRAME_GOLD_DK */
  --gold-lit: #d9a066;
  --text: #ede6d6;        /* C_TEXT */
  --muted: #c2baab;       /* C_MUTED */
  --accent: #f2b84d;      /* C_ACCENT */
  --good: #66e673;        /* C_GOOD */
  --bad: #ff665a;         /* C_BAD */
  --hp: #d92e2e;
  --mp: #386bf2;
  --r-common: #ccc7b8; --r-uncommon: #73e06b; --r-rare: #66a3ff; --r-epic: #cc7aff; --r-legendary: #ffc247;
  --el-physical: #c9c2b4; --el-fire: #ff7a2e; --el-ice: #7fd6ff; --el-energy: #c78bff;
  --el-earth: #7cc24a; --el-holy: #ffe27a; --el-death: #9a7ab0;
  --font-pixel: "Pixelify Sans", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Alegreya Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--slot-dark); }
body {
  margin: 0; color: var(--text); font: 16px/1.55 var(--font-body);
  background: radial-gradient(ellipse at top, #231b2a 0%, var(--bg) 55%, var(--slot-dark) 100%) fixed;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #ffd98a; text-decoration: underline; }
img.px, .px { image-rendering: pixelated; image-rendering: crisp-edges; }
h1, h2, h3, h4 { font-family: var(--font-pixel); font-weight: 600; color: var(--accent); line-height: 1.2; letter-spacing: .02em; }
h1 { font-size: 2rem; margin: .2em 0 .5em; text-shadow: 2px 2px 0 #000; }
h2 { font-size: 1.45rem; margin: 1.6em 0 .6em; border-bottom: 2px solid var(--gold-dk); padding-bottom: .2em; }
h3 { font-size: 1.15rem; margin: 1.2em 0 .5em; color: var(--gold-lit); }
p { margin: .6em 0; }
code, kbd { background: var(--slot-dark); border: 1px solid var(--gold-dk); padding: 0 .3em; border-radius: 2px; font-size: .92em; }
.words { font-family: var(--font-pixel); color: #fbf236; background: var(--slot-dark); padding: .05em .45em; border: 1px solid var(--gold-dk); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .88em; }
.nowrap { white-space: nowrap; }

/* ---- header / nav ---- */
.top {
  position: sticky; top: 0; z-index: 20; background: linear-gradient(#1b1621, #110e15);
  border-bottom: 3px solid var(--gold); box-shadow: 0 2px 0 #000, 0 6px 16px rgba(0,0,0,.5);
}
.top-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 8px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-pixel); font-size: 1.25rem; color: var(--accent); text-shadow: 2px 2px 0 #000; white-space: nowrap; }
.brand img { width: 32px; height: 32px; }
.brand small { color: var(--muted); font-size: .7em; }
.search { position: relative; flex: 1 1 220px; max-width: 420px; margin-left: auto; }
.search input {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--text); background: rgba(8,5,10,.8);
  border: 2px solid #8a6f30; border-radius: 3px; outline: none;
}
.search input:focus { border-color: var(--accent); }
.search-results {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--bg-light);
  border: 2px solid var(--gold); box-shadow: 0 8px 20px rgba(0,0,0,.6); max-height: 70vh; overflow: auto; display: none;
}
.search-results.open { display: block; }
.search-results a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; color: var(--text); border-bottom: 1px solid var(--gold-dk); }
.search-results a:hover, .search-results a.sel { background: #3a2d22; text-decoration: none; }
.search-results .k { color: var(--muted); font-size: .85em; white-space: nowrap; }
nav.sections { background: #0d0b10; border-bottom: 1px solid var(--gold-dk); }
nav.sections ul { list-style: none; margin: 0 auto; padding: 0 10px; max-width: 1180px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; }
nav.sections a { display: block; padding: 8px 11px; color: var(--muted); font-family: var(--font-pixel); white-space: nowrap; border-bottom: 3px solid transparent; }
nav.sections a:hover { color: var(--text); text-decoration: none; background: #1d1722; }
nav.sections a.cur { color: var(--accent); border-bottom-color: var(--accent); }

main { max-width: 1180px; margin: 0 auto; padding: 16px 16px 48px; }
.crumbs { font-size: .9em; color: var(--muted); margin-top: 4px; }
.crumbs a { color: var(--muted); }
footer { border-top: 2px solid var(--gold-dk); color: var(--muted); font-size: .85em; text-align: center; padding: 18px 16px 30px; }

/* ---- frames & panels (UiKit.draw_frame: dark fill, black outline, gold bevel) ---- */
.frame {
  background: linear-gradient(180deg, rgba(36,31,43,.95), rgba(18,15,23,.95));
  border: 2px solid var(--gold); outline: 2px solid #000;
  box-shadow: inset 0 0 0 2px var(--gold-dk), inset 0 0 18px rgba(0,0,0,.6);
  padding: 14px 16px; margin: 14px 2px; border-radius: 2px;
}
.frame > h2:first-child, .frame > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cols.side { grid-template-columns: 300px minmax(0, 1fr); }
@media (max-width: 820px) { .cols, .cols.side { grid-template-columns: minmax(0, 1fr); } }

.card { display: flex; gap: 12px; align-items: center; background: var(--slot); border: 1px solid var(--gold-dk); padding: 10px; color: var(--text); min-height: 76px; }
.card:hover { border-color: var(--accent); text-decoration: none; background: #221c26; }
.card .t { font-family: var(--font-pixel); color: var(--accent); font-size: 1.05em; }
.card .d { color: var(--muted); font-size: .88em; }
.slot {
  flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--slot-dark);
  border: 2px solid var(--gold-dk); box-shadow: inset 0 0 0 1px #000; padding: 4px;
}
.slot.r-uncommon { border-color: var(--r-uncommon); box-shadow: 0 0 8px rgba(115,224,107,.35), inset 0 0 0 1px #000; }
.slot.r-rare { border-color: var(--r-rare); box-shadow: 0 0 10px rgba(102,163,255,.45), inset 0 0 0 1px #000; }
.slot.r-epic { border-color: var(--r-epic); box-shadow: 0 0 12px rgba(204,122,255,.55), inset 0 0 0 1px #000; }
.slot.r-legendary { border-color: var(--r-legendary); box-shadow: 0 0 14px rgba(255,194,71,.6), inset 0 0 0 1px #000; }
.rn-common { color: var(--r-common); } .rn-uncommon { color: var(--r-uncommon); } .rn-rare { color: var(--r-rare); }
.rn-epic { color: var(--r-epic); } .rn-legendary { color: var(--r-legendary); }
a.rn-common, a.rn-uncommon, a.rn-rare, a.rn-epic, a.rn-legendary { font-weight: 600; }

.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: center; }
.hero img.shot { width: 100%; height: auto; border: 2px solid var(--gold); outline: 2px solid #000; }
@media (max-width: 820px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.lead { font-size: 1.12em; }
.tag { display: inline-block; font-size: .8em; padding: 1px 7px; border: 1px solid var(--gold-dk); background: var(--slot-dark); color: var(--muted); margin: 1px 2px; border-radius: 2px; white-space: nowrap; }
.tag.boss { color: #ffb0a0; border-color: #803020; }
.el { display: inline-block; padding: 0 7px; border-radius: 2px; font-size: .86em; font-weight: 600; color: #120f17; white-space: nowrap; }
.el-physical { background: var(--el-physical); } .el-fire { background: var(--el-fire); } .el-ice { background: var(--el-ice); }
.el-energy { background: var(--el-energy); } .el-earth { background: var(--el-earth); } .el-holy { background: var(--el-holy); } .el-death { background: var(--el-death); color: #fff; }

/* ---- stat tables ---- */
.table-wrap { overflow-x: auto; margin: 8px 0; }
table.data { border-collapse: collapse; width: 100%; font-size: .95em; }
table.data th, table.data td { padding: 6px 9px; border-bottom: 1px solid #2c2430; text-align: left; vertical-align: middle; }
table.data th { font-family: var(--font-pixel); font-weight: 500; color: var(--gold-lit); background: #19141d; border-bottom: 2px solid var(--gold-dk); white-space: nowrap; }
table.data th[data-sort] { cursor: pointer; }
table.data th[data-sort]::after { content: " \2195"; color: var(--gold-dk); }
table.data tr:hover td { background: rgba(242,184,77,.05); }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data img.px { vertical-align: middle; }
table.kv { border-collapse: collapse; width: 100%; }
table.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 5px 10px 5px 0; white-space: nowrap; vertical-align: top; width: 1%; }
table.kv td { padding: 5px 0; }
table.kv tr + tr th, table.kv tr + tr td { border-top: 1px solid #2c2430; }
.inl { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.inl img.px { width: 32px; height: 32px; }

/* ---- sprite showcase ---- */
.showcase { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: center; padding: 14px; background: repeating-conic-gradient(#1b1720 0 25%, #16121a 0 50%) 0 0 / 16px 16px; border: 2px solid var(--gold-dk); }
.showcase figure { margin: 0; text-align: center; }
.showcase figcaption { font-size: .8em; color: var(--muted); }

/* ---- elemental bars ---- */
.elbars { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; }
.elbars .lab { white-space: nowrap; }
.elbars .track { position: relative; height: 16px; background: var(--slot-dark); border: 1px solid #3a3040; }
.elbars .track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--gold-dk); }
.elbars .fill { position: absolute; top: 2px; bottom: 2px; }
.elbars .fill.weak { right: 50%; background: repeating-linear-gradient(90deg, #d9442e 0 6px, #b8331f 6px 8px); }
.elbars .fill.res { left: 50%; background: repeating-linear-gradient(90deg, #4f9ad9 0 6px, #3a7ab8 6px 8px); }
.elbars .fill.imm { left: 50%; right: 0; background: repeating-linear-gradient(90deg, #f2b84d 0 6px, #c8902c 6px 8px); }
.elbars .val { font-size: .9em; white-space: nowrap; text-align: right; min-width: 9em; }
.elbars .val.weak { color: #ff8a70; } .elbars .val.res { color: #8cc4ff; } .elbars .val.imm { color: var(--accent); } .elbars .val.neutral { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .85em; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 10px; margin-right: 4px; vertical-align: middle; }

/* ---- SQM area drawing ---- */
.area { display: inline-grid; gap: 2px; padding: 6px; background: #0b090d; border: 2px solid var(--gold-dk); }
.area span { width: 16px; height: 16px; background: #1e1a22; border: 1px solid #2a2430; }
.area span.hit { background: #d9442e; border-color: #ff8a5a; }
.area span.anchor { background: #ff9b3a; border-color: #ffe0a0; }
.area span.caster { background: #386bf2; border-color: #a0c0ff; border-radius: 50%; }
.area span.target { outline: 2px solid #fbf236; outline-offset: -3px; }
.area.el-ice span.hit { background: #3aa0d9; border-color: #a0e0ff; } .area.el-energy span.hit { background: #9a4ad0; border-color: #d8a8ff; }
.area.el-earth span.hit { background: #5a9a2a; border-color: #b0e080; } .area.el-holy span.hit { background: #d9c040; border-color: #fff0a0; }
.area.el-death span.hit { background: #6a4a80; border-color: #b090d0; } .area.el-physical span.hit { background: #9a9080; border-color: #e0d8c8; }
@media (max-width: 480px) { .area span { width: 11px; height: 11px; } }

/* ---- maps ---- */
.mapview { position: relative; display: inline-block; max-width: 100%; border: 2px solid var(--gold); outline: 2px solid #000; line-height: 0; }
.mapview img { max-width: 100%; height: auto; display: block; }
.mapview .mk { position: absolute; transform: translate(-50%, -50%); line-height: 1; }
.mapview .spawn { border: 2px solid rgba(255,90,70,.95); background: rgba(255,60,40,.18); border-radius: 50%; transform: none; }
.mapview .spawn.boss { border-color: #fbf236; background: rgba(251,242,54,.2); }
.mapview .pin { width: 14px; height: 14px; border: 2px solid #000; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.8); }
.mapview .pin.npc { background: #fbf236; } .mapview .pin.portal { background: #b060ff; } .mapview .pin.start { background: #6f6; }
.mapview .lbl { position: absolute; transform: translate(-50%, 6px); background: rgba(0,0,0,.78); color: #fff; font: 11px/1.2 var(--font-body); padding: 1px 4px; white-space: nowrap; pointer-events: none; }
.mapview.nomarks .mk, .mapview.nomarks .lbl { display: none; }
@media (max-width: 700px) { .mapview .lbl { display: none; } }
.crop { position: relative; overflow: hidden; background-repeat: no-repeat; border: 2px solid var(--gold); outline: 2px solid #000; max-width: 100%; image-rendering: pixelated; }
.crop .ring { position: absolute; border: 2px solid #ff5a46; border-radius: 50%; background: rgba(255,60,40,.15); box-shadow: 0 0 0 1px #000; }
.crop .dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; background: #fbf236; border: 2px solid #000; border-radius: 50%; }
.crops { display: flex; flex-wrap: wrap; gap: 14px; }
.crops figure { margin: 0; max-width: 100%; }
.crops figcaption { font-size: .88em; color: var(--muted); margin-top: 4px; }

/* ---- filters ---- */
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin: 10px 0; }
.filters label { display: flex; flex-direction: column; font-size: .82em; color: var(--muted); gap: 3px; }
.filters select, .filters input { font: inherit; font-size: .95rem; color: var(--text); background: var(--slot-dark); border: 1px solid #8a6f30; padding: 5px 6px; min-width: 120px; }
.filters input[type=number] { width: 90px; min-width: 0; }
.filters button { font: inherit; color: var(--text); background: #2a2119; border: 2px solid var(--gold); padding: 5px 12px; cursor: pointer; }
.count { color: var(--muted); font-size: .9em; }

/* ---- misc ---- */
details { margin: 10px 0; }
details > summary { cursor: pointer; color: var(--gold-lit); font-family: var(--font-pixel); }
details.spoiler { border: 2px dashed #803020; padding: 8px 12px; background: rgba(60,20,20,.25); }
details.spoiler > summary { color: #ffb0a0; }
blockquote.ingame { margin: 10px 0; padding: 8px 14px; border-left: 4px solid var(--gold); background: rgba(8,5,10,.6); font-style: italic; }
blockquote.ingame::before { content: attr(data-label); display: block; font-style: normal; font-size: .78em; color: var(--muted); margin-bottom: 2px; }
.lore { max-width: 760px; font-size: 1.08em; }
.lore p { margin: .9em 0; }
.lore h1, .lore h2 { text-align: center; }
.note { border-left: 4px solid var(--accent); background: rgba(242,184,77,.08); padding: 8px 12px; margin: 12px 0; }
.bar { height: 8px; background: var(--slot-dark); border: 1px solid #000; }
.bar i { display: block; height: 100%; }
.gallery { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.gallery figure { margin: 0; background: var(--slot-dark); border: 1px solid var(--gold-dk); }
.gallery img { width: 100%; height: 150px; object-fit: contain; display: block; background: #000; }
.gallery figcaption { font-size: .8em; color: var(--muted); padding: 4px 6px; word-break: break-all; }
.timeline > li { margin-bottom: 10px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 4px 0; border-bottom: 1px solid #2c2430; }
.calc { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.calc label { display: flex; flex-direction: column; font-size: .82em; color: var(--muted); }
.calc input { font: inherit; width: 90px; color: var(--text); background: var(--slot-dark); border: 1px solid #8a6f30; padding: 4px 6px; }
.calc output { font-family: var(--font-pixel); font-size: 1.2em; color: #fbf236; padding: 4px 0; }
h1 .tag { font-size: .42em; vertical-align: middle; font-family: var(--font-body); }
.cols.side > .showcase { align-items: center; align-content: center; }
@media (max-width: 700px) {
  .top { position: static; }
  h1 { font-size: 1.6rem; }
  .filters { gap: 6px 8px; }
  .filters select, .filters input { min-width: 0; max-width: 150px; }
}
.toc ol { columns: 3 200px; column-gap: 24px; }

/* History banner: the owner's Weaver art (it carries its own gold frame) */
.lore-banner { margin: 0 0 18px; }
.lore-banner img { display: block; width: 100%; height: auto; border-radius: 3px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, .6); image-rendering: auto; }

/* gallery viewer */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(5, 4, 8, .92); display: flex;
  align-items: center; justify-content: center; padding: 48px 56px 24px; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); border: 1px solid var(--gold-dk); background: #000; }
.lightbox figcaption { color: var(--muted); margin-top: 8px; font-size: .9em; text-align: center; }
.lightbox button { position: absolute; background: var(--slot-dark); color: var(--gold); border: 1px solid var(--gold-dk);
  cursor: pointer; font: inherit; border-radius: 3px; }
.lightbox button:hover { border-color: var(--gold); }
.lb-close { top: 10px; right: 12px; padding: 6px 12px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 2em; width: 40px; height: 64px; }
.lb-prev { left: 8px; } .lb-next { right: 8px; }
body.lb-open { overflow: hidden; }
@media (max-width: 600px) { .lightbox { padding: 52px 8px 16px; } .lb-prev, .lb-next { top: auto; bottom: 10px; transform: none; } }
