/* Offgrid v0.8 — cyberpunk UI: neon on near-black, angular chrome. */
body {
  font-family: system-ui, sans-serif;
  background: #0a0a12;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  color: #d7d7e0;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* CRT scanlines: subtle, never blocks clicks. */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom, rgba(255, 255, 255, 0.025) 0px, rgba(255, 255, 255, 0.025) 1px,
    transparent 1px, transparent 4px);
}
header {
  width: 100%;
  max-width: 960px;
  padding: 1rem;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
h1 {
  letter-spacing: 0.22em; text-transform: uppercase; margin: 0;
  font-size: 1.5rem; color: #00f0ff;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.7), 0 0 32px rgba(0, 240, 255, 0.3);
}
h3 { color: #ff2a6d; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.85rem; }
#stats span { margin-right: 1rem; }
#stats strong { color: #00f0ff; }
main { width: 100%; max-width: 960px; padding: 0 1rem 2rem; box-sizing: border-box; }
.hidden { display: none !important; }
.error { color: #ff8080; }
#loginBox label { display: block; margin: 0.5rem 0; }
#loginBox input[type="text"],
#loginBox input:not([type]) { margin-left: 0.5rem; background: #12121e; border: 1px solid rgba(0, 240, 255, 0.4); color: #eee; padding: 0.3rem; }
#loginBox input[type="password"] { margin-left: 0.5rem; background: #12121e; border: 1px solid rgba(0, 240, 255, 0.4); color: #eee; padding: 0.3rem; }
button {
  background: #141428; color: #00f0ff; border: 1px solid #00f0ff;
  padding: 0.4rem 0.9rem; cursor: pointer; border-radius: 0;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.85rem;
}
button:hover { background: rgba(0, 240, 255, 0.15); box-shadow: 0 0 12px rgba(0, 240, 255, 0.4); }
button:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
button:disabled:hover { background: #141428; }
#starving.badge {
  color: #ff2a6d; border: 1px solid #ff2a6d; border-radius: 4px;
  padding: 0.1rem 0.4rem; font-size: 0.85rem;
}
#eventLog { color: #39ff88; font-size: 0.9rem; margin-top: 0.3rem; }
#eventLog li { margin-bottom: 0.2rem; }
#panel .event { font-style: italic; color: #39ff88; }
#jobButtons button { margin: 0 0.3rem 0.3rem 0; }
#message { min-height: 1.4em; color: #bbb; }
#gameWrap {
  display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap;
}
/* Gapless map: discovered tiles touch edge to edge. Only the frontier —
   where discovered land meets anything else — gets a border. */
#mapWrap { position: relative; width: fit-content; margin: 1rem 0; }
#nightOverlay {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
}
#grid {
  display: grid;
  gap: 0;
  justify-content: start;
  margin: 0;
  border: 1px solid rgba(0, 240, 255, 0.35);
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.12);
}
.cell {
  width: 64px; height: 64px; position: relative;
  box-sizing: border-box; overflow: hidden;
}
.cell img {
  width: 100%; height: 100%; display: block;
  image-rendering: pixelated;
}
.cell img.dim { filter: brightness(0.35) saturate(0.7); }
.cell .overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; text-shadow: 0 0 6px #000; pointer-events: none;
}
.cell .overlay.dim-mark { font-size: 1.4rem; color: #ccc; }
.cell .overlay.corner {
  align-items: flex-end; justify-content: flex-end;
  font-size: 1rem; padding: 3px;
}
.cell .overlay.corner-top {
  align-items: flex-start; justify-content: flex-end;
  font-size: 1rem; padding: 3px;
}
.cell img.strip {
  position: absolute; inset: 0; pointer-events: none;
}
.placed-row {
  position: absolute; left: 2px; bottom: 2px;
  display: flex; gap: 2px; pointer-events: none; z-index: 0;
}
.placed-item { width: 22px; height: 22px; image-rendering: pixelated; }
#campStats.camp { color: #f9c80e; }
#inventoryGrid {
  display: grid; gap: 2px; margin: 0.5rem 0;
}
.inv-cell {
  width: 20px; height: 20px; background: #14141f;
  border: 1px solid #2a2a3a; box-sizing: border-box;
}
.inv-cell.filled {
  cursor: pointer; overflow: hidden;
  background-origin: border-box;
  image-rendering: pixelated;
}
.hbar {
  width: 100%; height: 10px; background: #333;
  border-radius: 3px; margin: 0.2rem 0 0.6rem;
}
.hfill { height: 100%; background: #4caf50; border-radius: 3px; }
.item-graphic {
  width: 96px; height: 96px; image-rendering: pixelated;
  background: #222; border: 1px solid #444; border-radius: 4px;
}
.survivor-sprite {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px; cursor: pointer;
  image-rendering: pixelated; z-index: 1;
}
.status-dot {
  position: absolute; top: 3px; right: 3px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid #000; pointer-events: none; z-index: 2;
}
.cell.discovered, .cell.semi { cursor: pointer; }
.cell.semi { border: 1px dashed #555; }
.cell.empty { background: #000; }
#panel {
  width: 280px; background: #12121e; border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 0; padding: 1rem; position: relative; margin-top: 1rem;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
#panelClose {
  position: absolute; top: 0.4rem; right: 0.4rem;
  background: none; font-size: 1.2rem; padding: 0.1rem 0.5rem;
}
#panel h2 { margin-top: 0; font-size: 1.1rem; color: #00f0ff; }
#panel h3 { font-size: 0.95rem; margin-bottom: 0.3rem; }
#panel .feature { color: #f9c80e; margin-top: -0.5rem; }
#panel .flavor { font-style: italic; color: #bbb; }
#panel ul { margin: 0; padding-left: 1.2rem; color: #ccc; }
.legend { color: #999; font-size: 0.85rem; }
.swatch {
  display: inline-block; width: 14px; height: 14px;
  border-radius: 3px; vertical-align: middle; margin: 0 0.2rem 0 1rem;
}
.swatch.art { background: #6b4a2f; }
.swatch.semi { background: #1c1c22; border: 1px dashed #555; }
.swatch.black { background: #000; border: 1px solid #333; }
footer { margin-top: auto; padding: 1rem; color: #666; font-size: 0.8rem; }
