:root {
  --night: #0e1230;
  --night-2: #161c46;
  --win-top: #2b3c95;
  --win-bot: #141b52;
  --frame: #efe6d2;
  --frame-shadow: #7e7896;
  --ink: #f4efe2;
  --muted: #aeb3d8;
  --gold: #f2cf5b;
  --red: #c2413b;
  --green: #8fbf4f;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --body: "VT323", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #24306e 0%, transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,.08) 3px 4px),
    var(--night);
  color: var(--ink);
  font-family: var(--body);
  font-size: 22px;
  line-height: 1.15;
  min-height: 100vh;
  padding: 0 16px 24px;
}

a { color: var(--gold); }
a:focus-visible, button:focus-visible, canvas:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

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

.top { max-width: 1200px; margin: 0 auto; padding: 28px 0 18px; }
.top h1 {
  font-family: var(--pixel);
  font-size: clamp(22px, 4vw, 36px);
  margin: 0 0 12px;
  color: var(--gold);
  text-shadow: 3px 3px 0 #6b3a1c, 6px 6px 0 rgba(0,0,0,.35);
  letter-spacing: 1px;
}
.tag { margin: 0; max-width: 60ch; color: var(--ink); }

.layout {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.window {
  position: relative;
  background: linear-gradient(180deg, var(--win-top), var(--win-bot));
  border: 3px solid var(--frame);
  border-radius: 8px;
  box-shadow: 0 0 0 3px #0a0d24, inset 0 0 0 2px var(--frame-shadow), 0 10px 0 rgba(0,0,0,.25);
  padding: 14px 16px;
}

.label {
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--gold);
  margin: 0 0 10px;
  letter-spacing: 1px;
}

.map-window { padding: 10px; }
.map-wrap {
  background: #22401f;
  border-radius: 4px;
  overflow: hidden;
  line-height: 0;
}
#map {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: pointer;
  display: block;
}
.map-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 4px 2px; flex-wrap: wrap; }

.btn {
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--night);
  background: var(--frame);
  border: 0;
  border-radius: 4px;
  padding: 10px 12px;
  box-shadow: 0 3px 0 var(--frame-shadow);
  cursor: pointer;
}
.btn:hover { background: #fff8e6; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--frame-shadow); }

.side { display: grid; gap: 20px; }

.card { min-height: 190px; }
.card p { margin: 0 0 8px; }
.card-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
#cardTile {
  width: 64px; height: 64px;
  image-rendering: pixelated;
  background: #4f8a3c;
  border: 2px solid var(--frame);
  border-radius: 4px;
  flex: none;
}
.card-name { font-family: var(--pixel); font-size: 14px; line-height: 1.4; margin: 0 0 6px; word-break: break-word; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.chip { font-family: var(--pixel); font-size: 8px; padding: 4px 6px; border-radius: 3px; background: #0a0d24; color: var(--ink); }
.chip.bot { background: var(--red); }
.chip.team { background: #2f5233; }
.card-about { min-height: 2.4em; }
.card-about.typing::after { content: "\25BC"; color: var(--gold); font-size: 14px; margin-left: 4px; animation: blink 0.8s steps(1) infinite; }
.card-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.feed ol { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; }
.feed li { padding: 6px 0; border-top: 1px dashed rgba(239,230,210,.18); }
.feed li:first-child { border-top: 0; }
.feed button {
  all: unset;
  cursor: pointer;
  display: block;
  width: 100%;
}
.feed button:hover .who, .feed button:focus-visible .who { color: var(--gold); }
.feed .who { font-weight: normal; color: var(--ink); }
.feed .when { color: var(--muted); font-size: 18px; display: block; }
.feed .empty { color: var(--muted); }

.agents p:last-child { margin: 0; }

.foot { max-width: 1200px; margin: 22px auto 0; font-size: 18px; }

@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .card { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .card-about.typing::after { animation: none; }
}

/* Never let long agent text or the map widen the page on phones. */
html, body { overflow-x: hidden; }
.window, .tag, .card-about, .feed li { overflow-wrap: anywhere; min-width: 0; }
