/* Toddscape Grand Exchange. Same warm-brown tone as the hiscores and the launcher. */
:root {
  --bg: #221c16;
  --panel: #2e261e;
  --panel-2: #372e24;
  --row-alt: #322a21;
  --line: #4a3f32;
  --line-strong: #5e503f;
  --text: #ece4d6;
  --muted: #c4bcae;
  --faint: #9d9384;
  --gold: #e3b955;
  --gold-soft: #f0d89a;
  --hl: #4a4128;
  --player-bg: #2f4a2c; --player-fg: #bfe3b6;
  --bot-bg: #2d3a55;    --bot-fg: #c3d2f2;
  --radius: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--gold-soft); }
a:hover { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header */
.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line-strong);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 20px; }
.brand b { color: var(--gold); font-weight: 700; }
.brand img { border-radius: 9px; display: block; }
.lookup { margin-left: auto; display: flex; gap: 6px; }
.lookup input {
  width: 240px; max-width: 52vw; padding: 7px 10px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); font: inherit;
}
.lookup input::placeholder { color: var(--faint); }
button {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: 6px 12px; cursor: pointer;
}
button:hover:not(:disabled) { background: var(--line); }
button:disabled { opacity: .45; cursor: default; }
.lookup button { background: #5a4a26; border-color: #7a6532; color: var(--gold-soft); }
.lookup button:hover { background: #6b5730; }

/* ---------- filter bar */
.bar {
  width: 100%; max-width: 1060px; margin: 0 auto; padding: 16px 20px 0;
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--panel); padding: 7px 14px; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--hl); color: var(--gold-soft); font-weight: 600; }

main {
  flex: 1; width: calc(100% - 40px); max-width: 1020px; margin: 12px auto 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 20px; min-height: 420px; outline: none;
}
main h1 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.sub { color: var(--muted); margin: 2px 0 14px; font-size: 13px; }
.loading, .empty { color: var(--muted); }
.note { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; color: var(--muted); }

/* ---------- tables */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  padding: 7px 10px; border-bottom: 1px solid var(--line-strong); font-weight: 600; white-space: nowrap;
}
.tbl th button {
  all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center;
  text-transform: inherit; letter-spacing: inherit; color: inherit; font: inherit;
}
.tbl th button:hover { color: var(--gold-soft); }
.tbl th button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.tbl th[aria-sort] button { color: var(--gold-soft); }
.tbl td { padding: 5px 10px; border-bottom: 1px solid var(--line); }
.tbl tbody tr:nth-child(even) { background: var(--row-alt); }
.tbl .num { text-align: right; }
.tbl th.num button { flex-direction: row-reverse; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--line); }
.item { display: flex; align-items: center; gap: 9px; min-width: 0; }
.item a { color: var(--text); text-decoration: none; }
.item a:hover { color: var(--gold); text-decoration: underline; }
.ico { width: 36px; height: 32px; flex: none; image-rendering: pixelated; }
.ico.ph { display: inline-block; }
.dim { color: var(--faint); }
.stack span { display: block; line-height: 1.25; }
.stack .q { font-size: 12px; color: var(--muted); }
.gp { color: var(--gold-soft); }

.tag {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .03em; padding: 1px 7px; border-radius: 10px;
  white-space: nowrap;
}
.tag.p { background: var(--player-bg); color: var(--player-fg); }
.tag.o { background: var(--bot-bg); color: var(--bot-fg); }

.pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.pager .info { color: var(--muted); margin-right: auto; }

/* ---------- item page */
.back { display: inline-block; margin-bottom: 12px; }
.item-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.item-head .ico { width: 54px; height: 48px; }
.facts { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 18px; }
.fact { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; min-width: 150px; }
.fact b { display: block; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.fact span { font-size: 16px; font-variant-numeric: tabular-nums; }
h2 { font-size: 16px; margin: 18px 0 8px; }
.more { margin-top: 10px; }

/* ---------- footer */
.foot {
  text-align: center; color: var(--muted); font-size: 12px; padding: 14px 16px 22px;
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.foot .sep { color: var(--faint); }

/* ---------- phones */
@media (max-width: 760px) {
  .top { padding: 10px 16px; }
  .brand { font-size: 18px; }
  .lookup { margin-left: 0; width: 100%; }
  .lookup input { flex: 1; width: auto; max-width: none; }
  .bar { padding: 12px 16px 0; }
  main { width: calc(100% - 32px); padding: 14px 10px 16px; }
  .tbl th, .tbl td { padding: 5px 5px; }
  .tbl th { font-size: 11px; }
  .ico { width: 27px; height: 24px; }
  .item { gap: 6px; }
  .item a { word-break: break-word; }
  .hide-sm { display: none; }
  .fact { min-width: 0; flex: 1 1 40%; }
}
