/* The wiki in the game's look (docs/66-wiki.md): the colours of the original tooltip (uitooltip.js TITLE_COLOR,
   NORMAL_COLOR, POSITIVE / NEGATIVE_COLOR, CONDITION_COLOR), and, with html.skin, the original UI images as border
   images (skin.js: the Board, ThinBoard, TitleBar, HorizontalBar, the buttons, the tabs, the item slot). */
:root {
  --bg: #050505; --panel: #1b1b1b; --line: #4a4a4a; --text: #c2c2c2; --dim: #8c8c8c;
  --title: #f2e7c1; --gold: #ffc800; --link: #f2e7c1; --cond: #beb47d;
  --green: #8ab98e; --blue: #8fb6e0; --orange: #e6a35a; --red: #e57976; --bonus: #b0dfb4;
  --hover: rgba(255, 255, 255, 0.07);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.5 Tahoma, Verdana, sans-serif; }
/* On the web: the character select's background (Legacy2's, assets/legacy2/screens/) behind the windows, a bit darker;
   in the game's frame (?embed=1) nothing: the game shows through. */
body { min-height: 100vh; padding: 8px; display: flex; align-items: center; justify-content: center; background: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), url(/assets/legacy2/screens/select.jpg) center / cover fixed, var(--bg); }
html.embed, html.embed body { background: transparent; }
html.embed body { padding: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { color: #fff; }

/* One window (a Board), as the game's: the title bar on top (the page's title; in the game's frame with the close
   button), the tabs and the search under it, the page under them; only the page scrolls, its scrollbar inside the window; a fixed size (a game window), at most the screen. */
.win {
  display: flex; flex-direction: column; width: min(1000px, 100%); height: min(700px, calc(100vh - 16px));
  height: min(700px, calc(100dvh - 16px)); margin: 0 auto; background: #111; border: 1px solid var(--line);
}
html.embed .win { width: 100%; height: 100vh; margin: 0; }
.top { flex: none; }
.titlebar {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 23px; padding: 0 34px;
  color: var(--title); font-size: 13px; font-weight: bold; text-shadow: 1px 1px 0 #000; background: #3a1410;
  border-radius: 3px; text-align: center;
}
.titlebar .close { position: absolute; right: 3px; top: 3px; }
/* The page's title is its h1 (the search engines), in the title bar's look. */
.titlebar h1 { margin: 0; font: inherit; }
.bar { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
nav { display: flex; flex-wrap: wrap; gap: 4px; }
nav a {
  display: inline-block; min-width: 78px; padding: 0 12px; height: 21px; line-height: 21px; text-align: center;
  border: 1px solid var(--line); border-radius: 3px; background: var(--panel); color: var(--text); font-size: 12px;
}
nav a:hover { color: #fff; }
nav a.on { border-color: var(--gold); color: var(--title); }
.tools { display: flex; gap: 6px; margin-left: auto; flex: 1 1 220px; max-width: 420px; align-items: center; }
#search, select, button {
  height: 22px; padding: 0 8px; border: 1px solid var(--line); border-radius: 3px; background: #0d0d0d; color: var(--text);
  font: 12px Tahoma, Verdana, sans-serif;
}
#search { flex: 1; min-width: 0; }
button { cursor: pointer; background: var(--panel); }
.close { font-weight: bold; min-width: 20px; padding: 0; height: 17px; line-height: 15px; }

main {
  flex: 1; min-height: 0; overflow: auto; padding: 4px 4px 4px 0; scrollbar-width: thin; scrollbar-color: #6a6a6a transparent;
}
h2 {
  margin: 12px 0 4px; min-height: 17px; line-height: 17px; padding: 0 14px; color: var(--title); font-size: 12px;
  font-weight: bold; text-shadow: 1px 1px 0 #000; background: #2a2a2a; border-radius: 3px;
}
.head { display: flex; gap: 12px; align-items: flex-start; margin: 4px 0 8px; }
.head .desc { margin: 2px 0 0; }
.sub { color: var(--dim); }
.desc { margin: 4px 0; color: var(--text); }
.card { background: rgba(0, 0, 0, 0.51); border: 1px solid var(--line); padding: 6px 10px; margin: 4px 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px 14px; }
.facts div { color: #fff; }
.facts div span { color: var(--cond); display: block; font-size: 11px; }
.scroll { overflow-x: auto; background: rgba(0, 0, 0, 0.51); border: 1px solid var(--line); padding: 2px 6px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 3px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); text-align: left; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--cond); font-weight: normal; font-size: 11px; }
tr:hover td { background: var(--hover); }
td b { color: var(--title); }
.icon { width: 32px; height: 32px; vertical-align: middle; object-fit: contain; flex: none; }
.big { width: auto; height: auto; min-width: 32px; min-height: 32px; }
.slot { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.it { display: inline-flex; align-items: center; gap: 6px; }
.mats .it { margin-right: 10px; }
.mats .icon { width: 24px; height: 24px; }
.icon.small { width: 16px; height: 16px; }
html.skin .it .icon.small { background: none; }
.tier { white-space: nowrap; font-size: 11px; padding: 0 6px; border-radius: 2px; border: 1px solid; }
.t0 { color: var(--green); border-color: var(--green); }
.t1 { color: var(--blue); border-color: var(--blue); }
.t2 { color: var(--orange); border-color: var(--orange); }
.t3 { color: var(--red); border-color: var(--red); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 10px; }
.grid a { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 2px; min-height: 26px; }
.grid a:hover { background: var(--hover); }
.bonus { color: var(--bonus); }
.neg { color: var(--red); }
.empty { color: var(--dim); font-style: italic; }
.guide p { margin: 4px 0; }
.guide ul { margin: 4px 0; padding-left: 20px; }
.guide li { margin: 4px 0; }
.guide b { color: var(--title); }
.guide .it .icon { width: 24px; height: 24px; }

/* ---- The original UI images (skin.js) ---- */
html.skin .win {
  border: 12px solid transparent; border-image: var(--board) 32 fill / 32px round; background: none;
}
html.skin .bar { border-bottom-color: rgba(255, 255, 255, 0.08); }
html.skin nav a, html.skin button {
  border: 0; border-radius: 0; background: none; border-image: var(--btn) 0 8 fill / 0 8px stretch; color: #fff;
}
html.skin nav a { height: 21px; border-image-source: var(--tab); border-image-slice: 0 10 fill; border-image-width: 0 10px; }
html.skin nav a:hover { border-image-source: var(--tab-over); }
html.skin nav a.on { border-image-source: var(--tab-on); color: var(--title); }
html.skin button:hover { border-image-source: var(--btn-over); }
html.skin button:active { border-image-source: var(--btn-down); }
html.skin .close {
  width: 15px; min-width: 15px; height: 15px; padding: 0; border-image: none; background: var(--close); font-size: 0;
}
html.skin .close:hover { background: var(--close-over); }
html.skin .close:active { background: var(--close-down); }
html.skin #search, html.skin select {
  border: 0; border-radius: 0; background: none; border-image: var(--field) 0 6 fill / 0 6px stretch; color: #fff;
}
html.skin select option { background: #111; }

/* The bars' middle is repeated, as the game does (ui.js TitleBar / HorizontalBar SetRenderingRect), not stretched. */
html.skin .titlebar { background: none; border-radius: 0; border-image: var(--title) 0 32 fill / 0 32px round stretch; }
/* In the game's frame the right end is the original one, with the close button's frame (titlebar_right.tga). */
html.skin.embed .titlebar { border-image-source: var(--title-x); }
html.skin h2 { background: none; border-radius: 0; border-image: var(--hbar) 0 32 fill / 0 32px round stretch; }
html.skin .card, html.skin .scroll {
  background: none; border: 6px solid transparent; border-image: var(--thin) 16 fill / 16px stretch;
}
html.skin .card { padding: 4px 8px; }
html.skin .scroll { padding: 0 2px; }
html.skin .slot { background: var(--slot) 0 0 / 32px 32px repeat-y; }
html.skin .grid .icon, html.skin td .it > .icon, html.skin .scroll td > .icon { background: var(--slot) center / 100% 100%; }

@media (max-width: 640px) {
  body { padding: 0; }
  .win { height: 100vh; height: 100dvh; }
  .tools { max-width: none; }
  th, td { padding: 4px 5px; }
  nav a { min-width: 0; }
}

/* The Items tab's filters, the bonus tables' kinds, the chance legend. */
.filters { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 2px 0 8px; align-items: center; }
.filters label { display: inline-flex; gap: 6px; align-items: center; color: var(--cond); font-size: 12px; }
.subtabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.subtabs a {
  padding: 0 10px; height: 21px; line-height: 21px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel);
  color: var(--text); font-size: 12px;
}
.subtabs a.on { border-color: var(--gold); color: var(--title); }
html.skin .subtabs a { border: 0; border-radius: 0; background: none; border-image: var(--tab) 0 10 fill / 0 10px stretch; color: #fff; }
html.skin .subtabs a:hover { border-image-source: var(--tab-over); }
html.skin .subtabs a.on { border-image-source: var(--tab-on); color: var(--title); }
.legend { margin: 8px 2px 2px; font-size: 11px; }
nav a { min-width: 64px; padding: 0 8px; }
.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; }

/* The loading sign over the page while a page loads (wiki.js loading). */
.win { position: relative; }
#loading {
  position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(0, 0, 0, 0.55); color: var(--title); font-weight: bold; text-shadow: 1px 1px 0 #000;
}
#loading[hidden] { display: none; }
.spin {
  width: 22px; height: 22px; border: 3px solid rgba(255, 255, 255, 0.2); border-top-color: var(--gold); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* The site's tabs (client/site/nav.js) over the wiki's own: the game, the wiki, the ranking, the registration; in the
   game's frame (?embed=1) not: the game is there already. */
.siterow { padding: 6px 0 4px; }
html.embed .siterow { display: none; }
