/* The 1.0 UI: deep navy glass panels, thin gold rules, parchment text. */
:root {
  /* sampled from the 1.23b client's own windows */
  --bg: #07071a;
  --bg-2: #0e0d25;
  --panel: rgba(14, 13, 37, 0.92);
  --panel-2: #181846;
  --panel-edge: #33436d;
  --edge-dark: #121839;
  --gold: #b89d49;
  --gold-dim: #7d6a33;
  --cream: #cfc69c;
  --text: #e9e7dc;
  --muted: #9a9cb6;
  --link: #8fc3e6;
  --good: #87dc9c;
  --unique: #dac837;
  --untradable: #68bf94;
  --warn: #e7a85a;
  --select: #2a658c;
  --row: rgba(24, 24, 70, 0.45);
  --row-hover: rgba(42, 101, 140, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #181846 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.5 "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header */
.top { background: linear-gradient(#11103a, #07071a); border-bottom: 1px solid var(--gold-dim); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding-block: 14px 10px; }
.brand { display: flex; gap: 12px; align-items: center; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--gold); font-size: 26px; line-height: 1; }
.brand-name { display: block; font-family: Cinzel, Georgia, serif; font-weight: 700; font-size: 20px; letter-spacing: 0.04em; color: var(--cream); }
.brand-sub { display: block; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.search { flex: 1 1 280px; max-width: 460px; }
.search input { width: 100%; padding: 9px 12px; border-radius: 6px; border: 1px solid var(--panel-edge); background: var(--bg-2); color: var(--text); font: inherit; }
.search input:focus { outline: 2px solid var(--gold-dim); border-color: var(--gold-dim); }
.tabs { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 0; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; font-size: 14px; letter-spacing: 0.02em; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--cream); border-bottom-color: var(--select); background: linear-gradient(transparent, rgba(42, 101, 140, 0.35)); }
.tabs .n { color: var(--gold-dim); font-weight: 400; font-size: 12px; margin-left: 4px; }

main { padding-block: 22px 40px; outline: none; }
.loading { color: var(--muted); }
h1, h2, h3 { font-family: Cinzel, Georgia, serif; color: var(--cream); font-weight: 500; text-wrap: balance; }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 26px 0 8px; letter-spacing: 0.03em; }
.lede { color: var(--muted); margin: 0 0 16px; max-width: 70ch; }

/* filters + tables */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; align-items: center; }
.filters select, .filters input { padding: 6px 8px; border-radius: 5px; border: 1px solid var(--panel-edge); background: var(--bg-2); color: var(--text); font: inherit; font-size: 14px; }
.filters label { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.count { color: var(--muted); font-size: 13px; margin-left: auto; }
.table-box { overflow-x: auto; border: 1px solid var(--panel-edge); border-radius: 8px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 7px 12px; text-align: left; border-bottom: 1px solid rgba(45, 69, 112, 0.5); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--cream); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; cursor: pointer; user-select: none; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) { background: var(--row); }
tbody tr:hover { background: var(--row-hover); }
.more { display: block; margin: 12px auto 0; padding: 8px 18px; background: transparent; color: var(--gold); border: 1px solid var(--gold-dim); border-radius: 6px; font: inherit; cursor: pointer; }
.more:hover { background: var(--row-hover); }

/* detail pages */
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.card { background: linear-gradient(var(--panel-2), var(--bg-2) 60%); border: 1px solid var(--panel-edge); box-shadow: inset 0 0 0 2px var(--edge-dark); border-radius: 10px; padding: 18px 20px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 22px; margin: 14px 0 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--panel-edge); color: var(--muted); margin-right: 6px; }
.tag.good { color: var(--good); border-color: rgba(127, 207, 143, 0.4); }
.tag.warn { color: var(--warn); border-color: rgba(231, 168, 90, 0.4); }
.tag.gold { color: var(--gold); border-color: var(--gold-dim); }
.tag.unique { background: var(--unique); color: #1a1600; border-color: var(--unique); }
.tag.untradable { background: var(--untradable); color: #04170e; border-color: var(--untradable); }
.src { font-size: 13px; color: var(--muted); margin-top: 14px; }
.empty { color: var(--muted); font-style: italic; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 4px 0; border-bottom: 1px solid rgba(45, 69, 112, 0.4); }

/* home */
.hero { padding: 6px 0 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 18px; }
.tile { background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 10px; padding: 14px 16px; color: var(--text); }
.tile:hover { border-color: var(--gold-dim); text-decoration: none; }
.tile b { display: block; font-family: Cinzel, Georgia, serif; color: var(--cream); font-weight: 500; font-size: 16px; }
.tile span { font-size: 26px; font-variant-numeric: tabular-nums; }
.tile small { display: block; color: var(--muted); font-size: 13px; }

.foot { color: var(--muted); font-size: 13px; padding-block: 18px 30px; border-top: 1px solid rgba(143, 119, 64, 0.35); }
.foot p { max-width: 90ch; margin: 6px 0; }

@media (max-width: 560px) {
  h1 { font-size: 22px; }
  th, td { padding: 6px 8px; }
  .hide-sm { display: none; }
}

/* --- item card: the in-game tooltip, as ZAM showed it --------------------- */
.crumb-path { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.item-layout { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 860px) { .item-layout { grid-template-columns: minmax(0, 1fr); } }
.tt { background: linear-gradient(180deg, #1b1a4e 0%, #0e0d25 38%, #0b0b26 100%); border: 1px solid var(--panel-edge); box-shadow: inset 0 0 0 2px var(--edge-dark), 0 6px 24px rgba(0, 0, 0, 0.45); border-radius: 8px; padding: 14px 16px; font-size: 14px; }
.tt hr { border: 0; border-top: 1px solid #2a2a52; margin: 10px 0; }
.tt-head { display: flex; gap: 12px; align-items: flex-start; }
.tt-head h1 { font-family: "Source Sans 3", system-ui, sans-serif; font-size: 19px; font-weight: 600; color: var(--text); margin: 0; }
.icon { width: 40px; height: 40px; flex: none; border-radius: 4px; background: #05051d; box-shadow: inset 0 0 0 1px #33436d; object-fit: contain; display: inline-block; vertical-align: middle; }
.name-cell { display: inline-flex; align-items: center; gap: 8px; }
.name-cell .icon { width: 24px; height: 24px; }
.tt-type { color: var(--cream); font-size: 13px; }
.tt-flags { margin-top: 4px; }
.tt-flags .tag { font-size: 11px; padding: 0 7px; }
.tt-base { color: var(--muted); margin-top: 10px; }
.tt-desc { margin-top: 8px; }
.tt-req { color: var(--good); }
.tt-res { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.res { min-width: 34px; text-align: center; padding: 1px 6px; border-radius: 4px; background: #05051d; border: 1px solid #2a2a52; font-variant-numeric: tabular-nums; }
.res-fire { color: #f08a6a; } .res-ice { color: #9ad8f0; } .res-air { color: #8fe0a0; } .res-earth { color: #e0c070; } .res-lightning { color: #c9a0f0; } .res-water { color: #7fb0f0; }
.tt-stats { width: 100%; font-size: 13px; }
.tt-stats th { background: transparent; position: static; color: var(--cream); font-size: 11px; }
.tt-stats td, .tt-stats th { padding: 3px 6px; border-bottom: 1px solid #1d1d44; }
.tt-own { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; margin: 0; }
.tt-own dt { color: var(--muted); font-size: 12px; }
.tt-own dd { margin: 0; font-variant-numeric: tabular-nums; }
.tt-own div { display: flex; justify-content: space-between; gap: 8px; }
.tt-misc { color: var(--text); font-size: 13px; }
.tt-foot { width: 100%; margin-top: 10px; font-size: 12px; }
.tt-foot th { background: transparent; position: static; color: var(--cream); font-size: 11px; padding: 2px 6px; }
.tt-foot td { padding: 2px 6px; border: 0; }
.tt-price { margin-top: 10px; color: var(--muted); font-size: 12px; text-align: right; }

/* ZAM's tab strip */
.tablist { list-style: none; display: flex; flex-wrap: wrap; gap: 2px; padding: 0; margin: 0 0 10px; border-bottom: 1px solid var(--panel-edge); }
.tablist button { background: var(--bg-2); color: var(--muted); border: 1px solid var(--panel-edge); border-bottom: 0; border-radius: 6px 6px 0 0; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.tablist button[aria-selected="true"] { background: var(--select); color: var(--text); }
@media (max-width: 700px) { .top { position: static; } }
.infobox { width: 100%; margin-top: 10px; font-size: 14px; }
.infobox th { position: static; background: transparent; width: 40%; color: var(--cream); font-size: 12px; cursor: default; }
.infobox td, .infobox th { border-bottom: 1px solid #1d1d44; padding: 6px 8px; }
.journal p { margin: 0 0 10px; line-height: 1.6; }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 10px; }
.step-journal { color: var(--muted); font-size: 13px; margin-top: 4px; border-left: 2px solid var(--panel-edge); padding-left: 10px; }
.tt-stats th { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 400; color: var(--muted); width: 60%; }
.tt-bonus { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 18px; font-size: 13px; }
.tt-bonus li { display: flex; justify-content: space-between; gap: 8px; }
.tt-bonus b { color: var(--good); font-weight: 600; font-variant-numeric: tabular-nums; }
td.small { font-size: 12px; color: var(--muted); max-width: 320px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; text-align: center; background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 6px; padding: 8px 4px; }
.gallery .icon { width: 48px; height: 48px; }
.gallery figcaption { font-size: 10px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.discord { flex: none; font-size: 13px; font-weight: 600; color: #fff; background: #5865f2; padding: 6px 14px; border-radius: 99px; }
.discord:hover { text-decoration: none; background: #4752c4; }
.leve-text { margin-top: 14px; }
.leve-text p { margin: 8px 0 0; line-height: 1.6; }

/* research findings */
.findings .finding { padding: 10px 0; border-bottom: 1px solid var(--panel-edge); }
.findings .finding p { margin: 6px 0; max-width: 72ch; }
.findings .finding .src { margin-top: 4px; }
