:root {
  --wood: #6b3a14;
  --wood-dark: #3a1e0a;
  --wood-light: #c47a32;
  --screen: #10160c;
  --ink: #fff6c8;
  --lime: #c8f542;
  --amber: #ffe14d;
  --hot: #ff3d7f;
  --dim: #7d8460;
  --tile: #182214;
  --tile-2: #1f2a18;
  --shadow: #070805;
  --grid: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #0a0704;
  color: var(--ink);
  font-family: "VT323", monospace;
  font-size: 22px;
}

body {
  background-image:
    repeating-linear-gradient(90deg, #140c06 0 8px, #0e0904 8px 16px),
    repeating-linear-gradient(#140c06 0 8px, #0e0904 8px 16px);
}

h1,
h2,
.lbl,
.tag,
.chip,
button,
select,
.search span,
label > span,
.go,
footer {
  font-family: "Press Start 2P", monospace;
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: var(--amber);
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgb(0 0 0 / 18%) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: multiply;
}

.bezel {
  margin: 12px auto;
  max-width: 1280px;
  background: linear-gradient(#8a4d1c, var(--wood) 18%, var(--wood-dark));
  border: 8px solid var(--shadow);
  box-shadow:
    inset 0 0 0 4px var(--wood-light),
    12px 12px 0 var(--shadow);
  padding: 14px 14px 10px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--screen);
  border: 4px solid #000;
  padding: 12px;
  box-shadow: inset 0 0 0 2px #3d5a24;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand img {
  image-rendering: pixelated;
  width: 40px;
  height: 40px;
}

h1 {
  font-size: 18px;
  color: var(--amber);
  letter-spacing: 1px;
  text-shadow: 3px 3px 0 #000;
}

.tag {
  margin-top: 8px;
  font-size: 8px;
  color: var(--lime);
  line-height: 1.6;
}

.hud {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat {
  min-width: 120px;
  background: #0a1208;
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
  padding: 8px 10px;
}

.stat.king {
  border-color: var(--amber);
}

.stat.burn {
  border-color: var(--hot);
}

.stat.burn span:last-child {
  color: var(--hot);
}

.lbl {
  display: block;
  font-size: 8px;
  color: var(--dim);
  margin-bottom: 6px;
}

.stat span:last-child {
  font-size: 28px;
  color: var(--lime);
  line-height: 1;
}

.ticker {
  overflow: hidden;
  background: #081008;
  border: 4px solid #000;
  border-top: 0;
  color: var(--lime);
  height: 36px;
}

.ticker-track {
  display: inline-block;
  white-space: nowrap;
  padding: 6px 0;
  animation: marquee 48s linear infinite;
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.furnace {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  background: #1a080c;
  border: 4px solid #000;
  border-top: 0;
  padding: 10px 12px;
  box-shadow: inset 0 0 0 2px var(--hot);
}

.flames {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: var(--hot);
  animation: flicker 0.35s steps(2) infinite;
  text-shadow: 2px 2px 0 #4a0018;
}

@keyframes flicker {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0.55;
    transform: translateY(-2px);
  }
}

.furnace-readout .lbl {
  color: var(--hot);
}

.furnace-readout #burn-count {
  display: block;
  font-size: 36px;
  color: var(--amber);
  line-height: 1.1;
  text-shadow: 3px 3px 0 #000;
}

#burn-note {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  line-height: 1.7;
  color: #ffb3c8;
  flex: 1 1 220px;
}

.furnace-link {
  font-size: 8px;
  padding: 8px 10px;
}

.leaders {
  background: #14100a;
  border: 4px solid #000;
  border-top: 0;
  padding: 12px 10px 14px;
  box-shadow: inset 0 0 0 2px var(--amber);
}

.leaders h2 {
  font-size: 10px;
  color: var(--amber);
  letter-spacing: 2px;
  margin-bottom: 12px;
  text-align: center;
  text-shadow: 2px 2px 0 #000;
}

.podium {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 8px;
  align-items: end;
  max-width: 720px;
  margin: 0 auto 12px;
}

.leader {
  appearance: none;
  margin: 0;
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 10px 6px 8px;
  background: var(--tile);
  color: var(--ink);
  border: 3px solid #000;
  box-shadow:
    inset 2px 2px 0 #4a6a32,
    3px 3px 0 #000;
  font-family: "VT323", monospace;
}

.leader:hover,
.leader:focus-visible {
  background: #2c3f20;
  outline: none;
}

.leader .rank {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--dim);
}

.leader .glyph {
  font-size: 42px;
}

.leader.gold {
  background: #3a2a08;
  box-shadow:
    inset 2px 2px 0 var(--amber),
    4px 4px 0 #000;
  padding-top: 16px;
  padding-bottom: 14px;
}

.leader.gold .glyph {
  font-size: 64px;
}

.leader.gold .rank,
.leader.gold .cap {
  color: var(--amber);
}

.leader.silver .rank {
  color: #d0d6de;
}

.leader.bronze .rank {
  color: #e0924a;
}

.leader-rest {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.leader-rest .glyph {
  font-size: 32px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  padding: 10px 0;
}

label {
  display: grid;
  gap: 6px;
}

label > span,
.search span {
  font-size: 8px;
  color: var(--amber);
}

input,
select,
.chip,
.go,
.close {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: var(--ink);
  background: #1a140c;
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
  padding: 8px;
}

input,
select {
  min-width: 160px;
}

.search input {
  min-width: 240px;
}

.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
}

.check input {
  width: 18px;
  height: 18px;
  min-width: 0;
  accent-color: var(--lime);
}

.chip {
  cursor: pointer;
  background: var(--hot);
  color: #fff;
}

.chip[aria-pressed="true"] {
  background: var(--lime);
  color: #111;
}

main {
  background: var(--screen);
  border: 4px solid #000;
  min-height: 60vh;
  padding: 10px;
  box-shadow: inset 0 0 40px #000;
}

.status {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--dim);
  margin-bottom: 10px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.tile {
  appearance: none;
  margin: 0;
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  background: var(--tile);
  color: var(--ink);
  border: 3px solid #000;
  box-shadow:
    inset 2px 2px 0 #4a6a32,
    3px 3px 0 #000;
  font-family: "VT323", monospace;
}

.tile:hover,
.tile:focus-visible {
  background: #2c3f20;
  outline: none;
  transform: translate(-1px, -1px);
}

.tile.listed {
  background: var(--tile-2);
  box-shadow:
    inset 2px 2px 0 #8cff4a,
    3px 3px 0 #000;
}

.tile.king-tile {
  background: #3a2a08;
  box-shadow:
    inset 2px 2px 0 var(--amber),
    3px 3px 0 #000;
}

.glyph {
  font-size: 32px;
  line-height: 1;
  filter: contrast(1.1);
}

.cap {
  font-size: 16px;
  color: var(--dim);
}

.tile.listed .cap {
  color: var(--lime);
}

.tile.king-tile .cap {
  color: var(--amber);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 4px 4px;
  font-size: 8px;
  line-height: 1.6;
  color: #ffd9a0;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgb(0 0 0 / 72%);
}

.modal-pixel {
  width: min(420px, 92vw);
  background: var(--screen);
  border: 6px solid #000;
  box-shadow:
    inset 0 0 0 4px var(--wood-light),
    8px 8px 0 #000;
  padding: 18px 16px 16px;
  text-align: center;
  position: relative;
}

.close {
  position: absolute;
  top: 8px;
  right: 8px;
  cursor: pointer;
  background: var(--hot);
}

.modal-glyph {
  font-size: 84px;
  line-height: 1;
  image-rendering: pixelated;
}

.modal-pixel h2 {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--amber);
}

.modal-ticker {
  margin: 8px 0 8px;
  font-size: 42px;
}

.fee-blurb {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  line-height: 1.6;
  color: var(--hot);
  margin: 0 0 14px;
}

dl {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  text-align: left;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: #0a1208;
  border: 3px solid #000;
  padding: 8px;
}

dt {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--dim);
}

dd.ca {
  font-size: 14px;
  word-break: break-all;
  text-align: right;
  max-width: 240px;
}

.go {
  display: inline-block;
  text-decoration: none;
  background: var(--lime);
  color: #111;
  padding: 10px 12px;
}

.go[hidden] {
  display: none;
}

@media (max-width: 720px) {
  h1 {
    font-size: 13px;
  }
  .search input,
  input,
  select {
    min-width: 0;
    width: 100%;
  }
  .controls,
  .hud {
    width: 100%;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  }
}
