:root {
  --pitch: #120d08;
  --pitch-2: #1b140c;
  --plank: #241a10;
  --plank-edge: #3a2a18;
  --bone: #e9dcc0;
  --bone-dim: #a8987c;
  --ember: #e0812e;
  --ember-hot: #ffb45e;
  --blood: #c04a31;
  --moss: #7d9c6a;
  --display: "Grenze Gotisch", serif;
  --body: "Vollkorn", serif;
}

* { box-sizing: border-box; margin: 0; }

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #2a1c0e 0%, transparent 60%),
    radial-gradient(900px 500px at 85% 110%, #1f1408 0%, transparent 55%),
    var(--pitch);
  color: var(--bone);
  font-family: var(--body);
  line-height: 1.55;
  min-height: 100vh;
  padding: 0 1.25rem 4rem;
}

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.masthead { text-align: center; padding: 3.5rem 0 2rem; }

.rune-row {
  color: var(--ember);
  letter-spacing: .5em;
  font-size: .8rem;
  opacity: .8;
  animation: emberflicker 4s infinite;
}

h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.5rem, 12vw, 7rem);
  line-height: 1;
  letter-spacing: .02em;
  margin: .5rem 0 .25rem;
  background: linear-gradient(180deg, var(--ember-hot) 0%, var(--ember) 45%, #8a4a16 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(224, 129, 46, .25);
}

.sub { font-size: 1.2rem; color: var(--bone-dim); }
.sub em { color: var(--bone); font-style: normal; border-bottom: 1px solid var(--ember); }
.carved { margin-top: .8rem; font-size: .85rem; color: var(--bone-dim); font-style: italic; }

main { max-width: 68rem; margin: 0 auto; }

h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.9rem;
  color: var(--bone);
  margin: 2.5rem 0 1rem;
  display: flex; align-items: center; gap: .6rem;
}
h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--plank-edge), transparent); }
.h-rune { color: var(--ember); font-size: 1.3rem; }

.hall {
  border: 1px solid var(--plank-edge);
  background: linear-gradient(180deg, var(--plank), var(--pitch-2));
  padding: 1rem 1.4rem;
  font-size: 1.15rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 1px 0 rgba(233,220,192,.06);
}
.hall .online-name { color: var(--ember-hot); font-weight: 600; }

.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }

.card {
  position: relative;
  border: 1px solid var(--plank-edge);
  background: linear-gradient(160deg, var(--plank) 0%, var(--pitch-2) 80%);
  padding: 1.1rem 1.2rem 1rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.45), inset 0 1px 0 rgba(233,220,192,.05);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(0,0,0,.55), inset 0 1px 0 rgba(233,220,192,.08); }
.card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--plank-edge);
}
.card.online::before { background: var(--ember); box-shadow: 0 0 12px var(--ember); animation: emberflicker 2.5s infinite; }

.card .name {
  font-family: var(--display); font-weight: 600; font-size: 1.5rem; line-height: 1.1;
  display: flex; align-items: center; gap: .5rem;
}
.dot { width: .55rem; height: .55rem; border-radius: 50%; background: #5a4a35; flex: none; }
.online .dot { background: var(--ember-hot); box-shadow: 0 0 8px var(--ember-hot); animation: emberflicker 2.5s infinite; }

.card .laststand { font-size: .82rem; color: var(--bone-dim); margin-bottom: .7rem; }
.card dl { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .2rem; text-align: center; }
.card dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--bone-dim); order: 2; }
.card dd { font-size: 1.05rem; font-weight: 600; order: 1; }
.card dd.deaths { color: var(--blood); }

.twocol { display: grid; grid-template-columns: 3fr 2fr; gap: 2rem; align-items: start; }
@media (max-width: 46rem) { .twocol { grid-template-columns: 1fr; } }

.scrollbox { overflow-x: auto; border: 1px solid var(--plank-edge); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th {
  font-family: var(--display); font-weight: 600; font-size: 1rem; text-align: left;
  color: var(--ember); padding: .55rem .8rem; border-bottom: 1px solid var(--plank-edge);
  background: var(--pitch-2);
}
td { padding: .45rem .8rem; border-bottom: 1px solid #201709; color: var(--bone-dim); white-space: nowrap; }
td:first-child { color: var(--bone); font-weight: 600; }
tr.live td { background: rgba(224,129,46,.06); }

.fallen { list-style: none; padding: 0; border: 1px solid var(--plank-edge); }
.fallen li {
  padding: .5rem .9rem; border-bottom: 1px solid #201709; font-size: .92rem;
}
.death-row { display: flex; justify-content: space-between; gap: 1rem; }
.death-row::before { content: "☠"; color: var(--blood); margin-right: .5rem; }
.autopsy {
  font-size: .78rem; color: var(--bone-dim); margin: .3rem 0 0 1.6rem; line-height: 1.8;
}
.a-item { white-space: nowrap; }
.a-item img { width: 1.1em; height: 1.1em; vertical-align: -.2em; margin-right: .2em; }
.stars { color: var(--ember-hot); font-weight: 600; margin-left: .15em; }
.fallen .when { color: var(--bone-dim); font-size: .82rem; white-space: nowrap; }
.fallen .who { flex: 1; }

#gear { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 1rem; }

.slot-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(4.2rem, 1fr));
  gap: .5rem; margin-top: .7rem;
}
.slot { text-align: center; }
.slot-frame {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--plank-edge); background: rgba(0,0,0,.35);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.6);
}
.slot-frame img { width: 78%; height: 78%; object-fit: contain; image-rendering: auto; filter: drop-shadow(0 2px 3px rgba(0,0,0,.7)); }
.empty-slot .slot-frame { border-style: dashed; opacity: .45; }
.empty-slot .slot-label { opacity: .45; }
.slot-label {
  font-size: .6rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ember); margin-top: .3rem;
}
.slot-item { font-size: .68rem; color: var(--bone-dim); line-height: 1.25; margin-top: .1rem; }
.hoard-meta { font-size: .85rem; color: var(--bone-dim); font-style: italic; margin-bottom: .8rem; }
.hoard-totals { grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); }
.slot-frame { position: relative; }
.slot-count {
  position: absolute; right: .15rem; bottom: .1rem;
  font-size: .72rem; font-weight: 700; color: var(--ember-hot);
  text-shadow: 0 1px 2px #000, 0 0 4px #000;
}
.hoard-base { margin-top: 1rem; }

.chart { margin-top: 1.4rem; border: 1px solid var(--plank-edge); background: var(--pitch-2); padding: 1rem; }
.chart-title { font-family: var(--display); font-weight: 600; font-size: 1.15rem; margin-bottom: .5rem; }
.chart-plot { position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #2b2013; stroke-width: 1; }
.chart .axis { fill: var(--bone-dim); font-size: 10px; font-family: var(--body); }
.chart .end-label { font-size: 11px; font-family: var(--body); font-weight: 600; }
.chart .crosshair { stroke: var(--bone-dim); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-bottom: .5rem; }
.chip { font-size: .78rem; color: var(--bone-dim); display: inline-flex; align-items: center; gap: .35rem; }
.swatch { width: .65rem; height: .65rem; border-radius: 2px; display: inline-block; flex: none; }
.chart-tip {
  position: absolute; top: .5rem; pointer-events: none; min-width: 9rem;
  background: rgba(18, 13, 8, .95); border: 1px solid var(--plank-edge);
  padding: .5rem .7rem; font-size: .78rem; z-index: 3;
}
.chart-tip strong { display: block; margin-bottom: .3rem; color: var(--bone); }
.chart-tip div { display: flex; align-items: center; gap: .35rem; color: var(--bone-dim); }
.chart-tip b { margin-left: auto; color: var(--bone); }
.econ-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .7rem; align-items: center; }
.econ-controls input, .econ-controls select {
  background: rgba(0,0,0,.35); border: 1px solid var(--plank-edge); color: var(--bone);
  font-family: var(--body); font-size: .82rem; padding: .35rem .6rem;
}
.econ-controls input:focus, .econ-controls select:focus { outline: 1px solid var(--ember); }
.range-btns { display: flex; gap: .25rem; margin-left: auto; }
.range-btns button {
  background: rgba(0,0,0,.35); border: 1px solid var(--plank-edge); color: var(--bone-dim);
  font-family: var(--body); font-size: .78rem; padding: .3rem .6rem; cursor: pointer;
}
.range-btns button.active { color: var(--ember-hot); border-color: var(--ember); }
.econ-hint { font-size: .72rem; color: var(--bone-dim); font-style: italic; margin: .5rem 0 .3rem; }
.econ-rows { max-height: 22rem; overflow-y: auto; border: 1px solid var(--plank-edge); }
.econ-row {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  background: none; border: 0; border-bottom: 1px solid #201709; cursor: pointer;
  padding: .35rem .7rem; color: var(--bone); font-family: var(--body); font-size: .85rem;
  text-align: left;
}
.econ-row:hover { background: rgba(224,129,46,.06); }
.econ-row.on { background: rgba(224,129,46,.09); }
.econ-row img { width: 1.4em; height: 1.4em; object-fit: contain; }
.econ-name { flex: 1; }
.econ-delta { font-size: .78rem; min-width: 4.5rem; text-align: right; }
.econ-delta.up { color: var(--moss); }
.econ-delta.down { color: var(--blood); }
.econ-delta.flat { color: var(--bone-dim); }
.econ-cur { min-width: 3.5rem; text-align: right; font-weight: 600; }

.armory-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .15em;
  color: var(--bone-dim); margin-top: 1rem;
  border-top: 1px solid var(--plank-edge); padding-top: .6rem;
}
.slot-grid.armory .slot-label { color: var(--moss); }

.empty { color: var(--bone-dim); font-style: italic; padding: .8rem 0; }

footer { text-align: center; margin-top: 4rem; color: var(--bone-dim); font-size: .8rem; }
footer .rune-row { margin-bottom: .5rem; }

@keyframes emberflicker {
  0%, 100% { opacity: 1; }
  45% { opacity: .75; }
  55% { opacity: .95; }
  70% { opacity: .65; }
}
