:root {
  --bg: #0c0e12;
  --panel: #141820;
  --panel-border: #2a3344;
  --ink: #c8d0dc;
  --dim: #6a7385;
  --accent: #e8a84a;
  --accent-dim: #9a6b28;
  --danger: #e05a5a;
  --heal: #5ecf8a;
  --part: #7ec8ff;
  --neon: #c77dff;
  --street: #1a1e28;
  --wall: #3d4658;
  --floor: #12161e;
  --font-ui: "IBM Plex Mono", ui-monospace, monospace;
  --font-title: "Special Elite", "IBM Plex Mono", serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100%;
  padding: 16px;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(199, 125, 255, 0.08), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(232, 168, 74, 0.06), transparent 45%),
    linear-gradient(180deg, #0a0c10 0%, #0c0e12 100%);
}

#app {
  width: min(1200px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#title-bar {
  text-align: center;
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--panel-border);
}

#title-bar h1 {
  font-family: var(--font-title);
  font-size: 1.85rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 400;
  text-shadow: 0 0 24px rgba(232, 168, 74, 0.35);
}

.tagline {
  color: var(--dim);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  margin-top: 4px;
  text-transform: uppercase;
}

#game-shell {
  display: grid;
  grid-template-columns: 200px 1fr 240px;
  gap: 12px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 540px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.stat-block h2 {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  color: var(--ink);
}

.stat-row span:first-child {
  color: var(--dim);
}

.hp-bar {
  height: 8px;
  background: #0a0c10;
  border: 1px solid var(--panel-border);
  margin: 4px 0 8px;
  border-radius: 2px;
  overflow: hidden;
}

#hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #8b2e2e, var(--danger));
  transition: width 0.15s ease;
}

#parts-list,
#inv-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#parts-list li {
  font-size: 0.72rem;
  padding: 3px 4px;
  border-left: 2px solid var(--dim);
  color: var(--dim);
}

#parts-list li.found {
  border-left-color: var(--part);
  color: var(--part);
}

#parts-list li.found::before {
  content: "✓ ";
  color: var(--heal);
}

#inv-list li {
  font-size: 0.78rem;
  color: var(--ink);
}

#inv-list li.empty {
  color: var(--dim);
  font-style: italic;
}

#stage {
  position: relative;
  background: #080a0e;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

#map {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  cursor: crosshair;
  outline: none;
}

#map:focus {
  box-shadow: inset 0 0 0 1px var(--accent-dim);
}

#overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 14, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#overlay.hidden {
  display: none;
}

#overlay-card {
  max-width: 420px;
  padding: 28px 32px;
  background: var(--panel);
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  text-align: center;
  box-shadow: 0 0 40px rgba(232, 168, 74, 0.15);
}

#overlay-card h2 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 0.06em;
}

#overlay-card p {
  color: var(--ink);
  line-height: 1.55;
  margin-bottom: 20px;
  white-space: pre-wrap;
}

#overlay-btn {
  font-family: var(--font-ui);
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 8px 20px;
  cursor: pointer;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.75rem;
  transition: background 0.15s, color 0.15s;
}

#overlay-btn:hover {
  background: var(--accent);
  color: #0c0e12;
}

#message-log {
  height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
  font-size: 0.72rem;
  line-height: 1.35;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-border) transparent;
}

#message-log .msg {
  color: var(--ink);
  border-left: 2px solid transparent;
  padding-left: 6px;
}

#message-log .msg.important {
  color: var(--accent);
  border-left-color: var(--accent);
}

#message-log .msg.danger {
  color: var(--danger);
  border-left-color: var(--danger);
}

#message-log .msg.heal {
  color: var(--heal);
  border-left-color: var(--heal);
}

#message-log .msg.part {
  color: var(--part);
  border-left-color: var(--part);
}

#message-log .msg.dim {
  color: var(--dim);
}

.key-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--dim);
}

kbd {
  display: inline-block;
  background: #0a0c10;
  border: 1px solid var(--panel-border);
  border-radius: 2px;
  padding: 1px 5px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.68rem;
}

#district-name {
  text-align: center;
  color: var(--dim);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 0 8px;
}

@media (max-width: 980px) {
  #game-shell {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }

  #message-log {
    height: 140px;
  }
}
