:root {
  --tile: 32px;
  --bg: #141414;
  --panel: #1e1e1e;
  --text: #f0ece4;
  --muted: #9a958c;
  --line: #3d3d3d;
  --green: #4ec85a;
}

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

html,
body {
  min-height: 100%;
  background: #000;
}

body {
  font-family: "VT323", monospace;
  font-size: 24px;
  line-height: 1.45;
  color: var(--text);
}

.border {
  min-height: 100vh;
  padding: var(--tile);
  background-image: url("/sprites/brick.png");
  background-size: var(--tile) var(--tile);
  image-rendering: pixelated;
}

.map {
  position: relative;
  min-height: calc(100vh - 2 * var(--tile));
  overflow: visible;
  background-image: url("/sprites/stone.png");
  background-size: var(--tile) var(--tile);
  image-rendering: pixelated;
}

.map-deco {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  pointer-events: none;
}

.tile {
  width: var(--tile);
  height: var(--tile);
  image-rendering: pixelated;
  background-size: var(--tile) var(--tile);
}

.t-floor {
  background-image: url("/sprites/stone.png");
}

.t-hard {
  background-image: url("/sprites/floor.png");
}

.t-crate {
  background-image: url("/sprites/brick.png");
}

.content {
  position: relative;
  z-index: 1;
  padding: 20px 16px 36px;
}

.top {
  width: min(680px, 100%);
  margin: 0 auto 28px;
  padding: 6px;
  background-image: url("/sprites/brick.png");
  background-size: var(--tile) var(--tile);
  image-rendering: pixelated;
  overflow: visible;
}

.top-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--panel);
  overflow: visible;
}

.mascot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 48px;
  min-height: 48px;
  overflow: visible;
}

.spr {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  image-rendering: pixelated;
  background-repeat: no-repeat;
}

.spr-rat {
  border: 0;
  padding: 0;
  background-color: transparent;
  background-image: url("/sprites/BomberRat.png");
  background-size: 144px 48px;
  background-position: 0 0;
  cursor: pointer;
  animation: idle 0.55s steps(2) infinite;
}

.spr-rat:hover,
.spr-rat:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.spr-rat.is-burnt {
  animation: none;
  background-position: -96px 0;
  cursor: default;
}

.spr-bomb {
  background-image: url("/sprites/Bomb.png");
  background-size: 96px 48px;
  animation: fuse 0.4s steps(2) infinite;
}

.blast {
  position: absolute;
  left: 24px;
  top: 24px;
  z-index: 6;
  pointer-events: none;
}

.blast-core {
  position: absolute;
  left: -24px;
  top: -24px;
  width: 48px;
  height: 48px;
  background-image: url("/sprites/ExplosionCenter.png");
  background-size: 48px 48px;
  image-rendering: pixelated;
}

.blast-arm {
  position: absolute;
  left: 0;
  top: -24px;
  width: 144px;
  height: 48px;
  background-image: url("/sprites/Explosion.png");
  background-size: 144px 48px;
  image-rendering: pixelated;
  transform-origin: 0 24px;
}

.blast-w {
  transform: rotate(180deg);
}

.blast-n {
  transform: rotate(-90deg);
}

.blast-s {
  transform: rotate(90deg);
}

@keyframes idle {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -96px 0;
  }
}

@keyframes fuse {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -96px 0;
  }
}

.meta {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--green);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

h1 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(16px, 5vw, 22px);
  line-height: 1.4;
}

main {
  width: min(680px, 100%);
  margin: 0 auto;
}

h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 16px;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.entry {
  background: var(--panel);
  border: 2px solid var(--line);
  padding: 14px 16px 16px;
}

.entry-hud {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.avatar {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.author {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: var(--green);
}

.date {
  margin-left: auto;
  color: var(--muted);
  font-size: 18px;
}

.body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mention {
  display: inline;
  padding: 0 4px;
  background: rgb(18 64 18 / 70%);
  color: var(--green);
}

.shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.shot {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 6px;
  border: 2px solid var(--line);
  background: #0a0a0a;
  cursor: zoom-in;
}

.shot:only-child {
  grid-column: 1 / -1;
}

.shot img {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  object-position: center;
  background: transparent;
}

.shot:only-child img {
  max-height: 280px;
}

.clips {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

.clip {
  display: block;
  width: 100%;
  max-height: 320px;
  background: #0a0a0a;
  border: 2px solid var(--line);
}

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.react {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 2px solid var(--line);
  background: #0a0a0a;
  color: var(--text);
  font-size: 16px;
  line-height: 1;
}

.react img {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
}

.react-emoji {
  font-size: 16px;
  line-height: 1;
}

.react-count {
  color: var(--muted);
  font-size: 16px;
}

.lightbox {
  position: fixed;
  inset: 0;
  width: fit-content;
  height: fit-content;
  margin: auto;
  padding: 40px 20px 20px;
  border: 2px solid var(--line);
  background: #111;
  max-width: min(96vw, 1200px);
  max-height: 96vh;
}

.lightbox[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox::backdrop {
  background: rgb(0 0 0 / 82%);
}

.lightbox img {
  display: block;
  margin: 0 auto;
  max-width: min(92vw, 1160px);
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 6px;
  right: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.status {
  color: var(--muted);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 16px;
  background: var(--panel);
  border: 2px solid var(--line);
  text-align: center;
}

@media (max-width: 640px) {
  .border {
    padding: 16px;
  }

  .entry-hud {
    flex-wrap: wrap;
  }

  .date {
    margin-left: 0;
    width: 100%;
  }

  .shots {
    grid-template-columns: 1fr;
  }

  .shot img,
  .shot:only-child img {
    max-height: 200px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spr-rat,
  .spr-bomb {
    animation: none;
  }
}
