@font-face { font-family: "Silkscreen"; src: url("fonts/silkscreen-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Silkscreen"; src: url("fonts/silkscreen-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "VT323"; src: url("fonts/vt323-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --block: 48px;            /* on-screen size of one world block; set from JS */
  --ink: #f3efe2;           /* torchlit parchment */
  --ink-dim: #b9b4a3;
  --pit: #0d0e14;           /* carved-out darkness behind text */
  --diamond: #63e8e0;
  --gold: #f5c542;
  --iron: #d9d4cc;
  --copper: #d98352;
  --lava: #ff7a1a;
  --grass: #6aa84a;
  --display: "Silkscreen", "Courier New", monospace;
  --body: "VT323", "Courier New", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: #14182b;
  color: var(--ink);
  font: 400 1.5rem/1.3 var(--body);
  -webkit-font-smoothing: none;
}
a { color: var(--diamond); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
code { font: inherit; color: var(--diamond); }

/* ---------------------------------------------------------------- hero */
.hero { position: relative; height: 100svh; min-height: 560px; overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.hero-copy {
  position: relative;
  padding: clamp(3rem, 12vh, 7rem) 6vw 0;
  max-width: 62rem;
}
h1 {
  margin: 0;
  font: 700 clamp(2.4rem, 9.5vw, 7.5rem)/0.95 var(--display);
  letter-spacing: -0.04em;
  color: #fff;
  /* extruded block lettering: each shadow step is one "pixel" */
  text-shadow:
    0.035em 0.035em 0 #2b2f45, 0.07em 0.07em 0 #2b2f45,
    0.105em 0.105em 0 #14182b, 0.14em 0.14em 0 #14182b;
}
.tagline { margin: 1.6rem 0 0; font-size: clamp(1.4rem, 2.4vw, 1.9rem); max-width: 30em; text-shadow: 2px 2px 0 #14182b; }

.address {
  margin-top: 1.8rem;
  display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1.2rem;
  padding: 0.7rem 1.1rem 0.8rem;
  font: 700 clamp(0.95rem, 2.6vw, 1.5rem)/1.2 var(--display);
  color: #14182b; background: var(--diamond);
  border: 0; cursor: pointer;
  box-shadow: inset -4px -4px 0 #2a9d97, inset 4px 4px 0 #b8fbf6, 6px 6px 0 #14182b;
  text-align: left;
}
.address:hover { background: #8df3ec; }
.address:active { transform: translate(3px, 3px); box-shadow: inset -4px -4px 0 #2a9d97, inset 4px 4px 0 #b8fbf6, 3px 3px 0 #14182b; }
.address-hint { font: 400 1.3rem/1 var(--body); }

.status { margin: 1.6rem 0 0; display: flex; align-items: center; gap: 0.7rem; text-shadow: 2px 2px 0 #14182b; }
.lamp { width: 14px; height: 14px; background: #777; box-shadow: 0 0 0 3px #14182b; flex: none; }
.status.up .lamp { background: #7dff6b; box-shadow: 0 0 0 3px #14182b, 0 0 14px 3px #7dff6b; }
.status.down .lamp { background: #e2553f; }
.online { list-style: none; margin: 0.7rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.online li { display: flex; align-items: center; gap: 0.5rem; padding: 0.15rem 0.6rem 0.15rem 0.2rem; background: rgba(13, 14, 20, 0.78); }

/* ---------------------------------------------------- underground layers */
.layer {
  background-size: calc(var(--block) * 8) auto;
  image-rendering: pixelated;
  padding: calc(var(--block) * 1.5) 5vw;
}
.dirt    { background-color: #7a5433; background-image: var(--tile-dirt); }
.stone   { background-color: #74777e; background-image: var(--tile-stone); }
.deep    { background-color: #34353d; background-image: var(--tile-deep); }
.bedrock { background-color: #1c1c20; background-image: var(--tile-bedrock); text-align: center; padding-bottom: calc(var(--block) * 2); }
.bedrock p { margin: 0 auto 0.6rem; display: table; padding: 0.2rem 0.8rem; background: rgba(13, 14, 20, 0.85); }

.slab {
  max-width: 44rem; margin: 0 auto;
  padding: clamp(1.2rem, 4vw, 2.5rem);
  background: var(--pit);
  /* chiselled edge: light from the top-left, like a hollow cut into the rock */
  box-shadow: inset 4px 4px 0 #000, inset -4px -4px 0 #2a2c38, 0 0 0 4px rgba(0, 0, 0, 0.35);
  image-rendering: auto;
}
.slab.wide { max-width: 64rem; }
h2 { margin: 0 0 1.2rem; font: 700 clamp(1.3rem, 3.4vw, 2.1rem)/1.1 var(--display); letter-spacing: -0.03em; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 0.9rem; }
.steps li { counter-increment: step; position: relative; padding: 0.35rem 0 0 3.5rem; min-height: 2.6rem; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0; width: 2.6rem;
  font: 700 1.1rem/2.4rem var(--display); text-align: center; height: 2.6rem;
  color: #14182b; background: var(--grass);
  box-shadow: inset -3px -3px 0 #3f7a2a, inset 3px 3px 0 #9bd67c;
}

/* ---------------------------------------------------------- leaderboard */
.tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.6rem; }
.tabs button {
  font: 400 1.35rem/1 var(--body); color: var(--ink);
  padding: 0.45rem 0.8rem 0.5rem; background: #2a2c38; border: 0; cursor: pointer;
  box-shadow: inset -3px -3px 0 #17181f, inset 3px 3px 0 #43465a;
}
.tabs button:hover { background: #363949; }
.tabs button[aria-selected="true"] { background: var(--gold); color: #14182b; box-shadow: inset -3px -3px 0 #b8891a, inset 3px 3px 0 #ffe9a3; }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: clamp(0.4rem, 2vw, 1.2rem); margin-bottom: 1.6rem; }
.podium .place { text-align: center; min-width: 0; }
.podium .who { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 0.4rem; font-size: clamp(1.2rem, 3vw, 1.7rem); }
.podium .val { display: block; color: var(--ink-dim); }
.podium .plinth {
  margin-top: 0.6rem; display: grid; place-items: center;
  font: 700 clamp(1.4rem, 4vw, 2.4rem)/1 var(--display); color: #14182b;
}
.place.p1 { order: 2; } .place.p2 { order: 1; } .place.p3 { order: 3; }
.p1 .plinth { height: 9rem; background: var(--gold);   box-shadow: inset -6px -6px 0 #b8891a, inset 6px 6px 0 #ffe9a3; }
.p2 .plinth { height: 6.5rem; background: var(--iron); box-shadow: inset -6px -6px 0 #9a958c, inset 6px 6px 0 #fff; }
.p3 .plinth { height: 4.5rem; background: var(--copper); box-shadow: inset -6px -6px 0 #9c5530, inset 6px 6px 0 #f5b48f; }

.head { width: 2rem; height: 2rem; image-rendering: pixelated; background: #3b3e4e; display: inline-grid; place-items: center; font: 700 0.9rem/1 var(--display); color: var(--ink); flex: none; vertical-align: middle; object-fit: cover; }
.podium .head { width: clamp(3rem, 9vw, 5rem); height: clamp(3rem, 9vw, 5rem); font-size: 1.6rem; box-shadow: 4px 4px 0 #000; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  display: grid; grid-template-columns: 2.2rem 2rem minmax(0, 1fr) auto; align-items: center; gap: 0.8rem;
  padding: 0.45rem 0.6rem; position: relative;
  border-top: 2px solid #23252f;
}
.rows .rank { color: var(--ink-dim); text-align: right; }
.rows .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .val { font-variant-numeric: tabular-nums; }
.rows .bar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--diamond); opacity: 0.55; }

.empty { padding: 1.5rem 0 0.5rem; max-width: 32em; }
.fine { color: var(--ink-dim); font-size: 1.2rem; margin: 1.2rem 0 0; }

.records { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }
.record { padding: 0.9rem 1rem; background: #1a1b24; box-shadow: inset 3px 3px 0 #000, inset -3px -3px 0 #2a2c38; }
.record .label { color: var(--ink-dim); display: block; }
.record .big { font: 700 clamp(1.1rem, 2.6vw, 1.5rem)/1.2 var(--display); display: block; margin: 0.3rem 0; color: var(--diamond); overflow-wrap: anywhere; }
.record .by { display: flex; align-items: center; gap: 0.5rem; }

/* ----------------------------------------------------------- depth gauge */
.depth {
  position: fixed; right: 0; bottom: 1.2rem; padding: 0.2rem 0.7rem;
  background: rgba(13, 14, 20, 0.85); color: var(--ink-dim); font-size: 1.3rem;
  font-variant-numeric: tabular-nums; pointer-events: none;
}

@media (max-width: 600px) {
  body { font-size: 1.35rem; }
  .rows li { grid-template-columns: 1.6rem 2rem minmax(0, 1fr) auto; gap: 0.5rem; padding-inline: 0.2rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
