:root {
  --bg: #0b1a20;
  --bg-2: #10252d;
  --panel: #132c35;
  --panel-2: #183842;
  --line: #24505c;
  --text: #ece4d4;
  --muted: #9fb2b4;
  --gold: #d8b77a;
  --gold-2: #b8955a;
  --good: #5fd08a;
  --bad: #e5675d;
  --warn: #e6b450;
  --radius: 10px;
  /* item quality */
  --q-poor: #9d9d9d;
  --q-common: #ffffff;
  --q-uncommon: #1eff00;
  --q-rare: #2f8ff0;
  --q-epic: #b257f5;
  --q-legendary: #ff8000;
  --q-artifact: #e6cc80;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #1b4450 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", system-ui, sans-serif;
  min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, .display { font-family: "Cinzel", Georgia, serif; font-weight: 600; letter-spacing: 0.02em; }
h2 { font-size: 22px; margin: 0 0 4px; }
h3 { font-size: 16px; margin: 0 0 12px; color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.label {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

/* layout */
header.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 26, 32, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { font-family: "Cinzel", serif; font-size: 20px; color: var(--gold); white-space: nowrap; }
.brand span { color: var(--text); }
nav.tabs { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
nav.tabs a {
  padding: 6px 12px; border-radius: 6px; color: var(--muted); font-size: 14px; white-space: nowrap;
}
nav.tabs a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
nav.tabs a.active { color: var(--bg); background: var(--gold); }
.top-tools { display: flex; gap: 8px; align-items: center; }
main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 60px; }

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.stack { display: grid; gap: 16px; }
.stack > * { min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.grid-2 > * { min-width: 0; }

/* form controls */
input, select, button {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 10px;
}
input:focus, select:focus { outline: 2px solid var(--gold-2); outline-offset: -1px; }
button { cursor: pointer; background: var(--panel-2); }
button:hover { border-color: var(--gold-2); }
button.primary { background: var(--gold); color: var(--bg); border-color: var(--gold); font-weight: 600; }
button.primary:hover { background: #e6c88f; }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
button:disabled { opacity: 0.5; cursor: wait; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline input { min-width: 0; flex: 1 1 140px; }

/* journey */
.hero {
  display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  padding: 24px; text-align: left;
  background:
    linear-gradient(135deg, rgba(216, 183, 122, 0.10), transparent 60%),
    linear-gradient(180deg, #164452 0%, #0f2a33 100%);
  border: 1px solid var(--gold-2);
  border-radius: var(--radius);
}
.hero > div { min-width: 0; flex: 1 1 220px; overflow-wrap: anywhere; }
.hero img { width: 96px; height: 96px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; }
.hero .display { font-size: 30px; line-height: 1.1; margin: 4px 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 14px; }
.card {
  position: relative;
  background: #f6f0e3;
  color: #5b4a33;
  border: 1px solid #e3d5bb;
  border-radius: 6px;
  padding: 14px 16px 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.card .label { color: #9a7f55; }
.card .value {
  font-family: "Oswald", "Cinzel", sans-serif;
  font-size: 40px; line-height: 1.1; color: #9b8a72; margin: 8px 0 6px;
  overflow-wrap: anywhere;
}
.card .value.long { font-size: 26px; }
.card .caption { font-size: 14px; color: #6a5a43; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card .badge {
  flex: none;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #a8875a;
}

/* characters */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.char-card > div { min-width: 0; }
.char-card { display: flex; gap: 12px; align-items: center; color: var(--text); }
.char-card:hover { border-color: var(--gold-2); text-decoration: none; }
.char-card img, .avatar { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--bg); flex: none; }
.char-card .name { font-weight: 600; font-size: 16px; }
.tag {
  display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--muted); vertical-align: middle;
}
.tag.mine { border-color: var(--gold-2); color: var(--gold); }
.tag.good { border-color: var(--good); color: var(--good); }
.tag.bad { border-color: var(--bad); color: var(--bad); }
.tag.warn { border-color: var(--warn); color: var(--warn); }
.error { color: var(--bad); }

.gear { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 6px 14px; }
.gear-item { display: flex; gap: 10px; align-items: center; min-height: 40px; }
.gear-item img, .icon { width: 36px; height: 36px; border-radius: 6px; border: 1px solid #000; flex: none; background: var(--bg); }
.icon.sm { width: 24px; height: 24px; border-radius: 4px; }
.gear-item .slot { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.enchant { font-size: 12px; color: var(--good); }

.tree { margin-bottom: 8px; }
.bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.stat { background: var(--bg); border-radius: 6px; padding: 8px 10px; }
.stat b { display: block; font-size: 18px; }
.chart-box { position: relative; height: 240px; }

/* tables & feeds */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
td.num, th.num { text-align: right; }
tr.left td { opacity: 0.5; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--muted); font-size: 12px; white-space: nowrap; min-width: 92px; }
.feed-day { margin: 16px 0 4px; }

.coin-g { color: #ffd100; }
.coin-s { color: #c7c7cf; }
.coin-c { color: #d08b52; }
.q-POOR { color: var(--q-poor); }
.q-COMMON { color: var(--q-common); }
.q-UNCOMMON { color: var(--q-uncommon); }
.q-RARE { color: var(--q-rare); }
.q-EPIC { color: var(--q-epic); }
.q-LEGENDARY { color: var(--q-legendary); }
.q-ARTIFACT, .q-HEIRLOOM { color: var(--q-artifact); }

details > summary { cursor: pointer; color: var(--gold); font-size: 14px; margin-bottom: 8px; }
.panel p { margin: 8px 0; }
td.price { white-space: nowrap; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--gold-2); padding: 10px 16px; border-radius: 8px; z-index: 20;
  max-width: calc(100% - 32px);
}

@media (max-width: 640px) {
  .brand { font-size: 17px; }
  .top-inner { gap: 8px 12px; }
  nav.tabs { order: 3; flex-basis: 100%; }
  .top-tools { margin-left: auto; min-width: 0; }
  #version { max-width: 48vw; }
  .hero > .row { flex-basis: 100%; }
  .hero { padding: 16px; }
  .hero .display { font-size: 24px; }
  .card .value { font-size: 32px; }
}
