:root {
  --bg: #0a0a0a;
  --panel: #111111;
  --border: #330000;
  --red: #ff2a2a;
  --dim-red: #881111;
  --green: #2ecc71;
  --yellow: #f1c40f;
  --orange: #e67e22;
  --text: #cccccc;
  --dim: #666666;
  --cell: 14px;
}

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

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Courier New", Courier, monospace;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 960px;
  margin: 0 auto;
  padding: 8px;
  gap: 8px;
}

#top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
}

#room-name {
  color: var(--red);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 2px;
  flex: 1;
}

#hp-label {
  color: var(--dim);
  font-size: 12px;
}

#hp-bar {
  width: 200px;
  height: 14px;
  background: #1a0000;
  border: 1px solid var(--border);
  position: relative;
}

#hp-fill {
  height: 100%;
  width: 100%;
  background: var(--green);
  transition: width 0.3s, background 0.3s;
}

#hp-text {
  font-size: 12px;
  color: var(--dim);
  min-width: 60px;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

#map-wrap {
  flex: 1;
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

#map {
  display: grid;
  grid-template-columns: repeat(33, var(--cell));
  grid-template-rows: repeat(17, var(--cell));
  gap: 0;
}

.cell {
  width: var(--cell);
  height: var(--cell);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  color: var(--dim);
  user-select: none;
}

.cell.floor {
  color: #555555;
}

.cell.wall {
  color: var(--red);
  font-weight: bold;
}

.cell.exit {
  color: var(--yellow);
  font-weight: bold;
}

.cell.player {
  color: #ffffff;
  font-weight: bold;
}

.cell.npc {
  color: var(--red);
  font-weight: bold;
}

.cell.item {
  color: var(--yellow);
}

.cell.other {
  color: #66ccff;
  font-weight: bold;
}

#minimap {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  gap: 2px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
}

.mini-room {
  width: 12px;
  height: 12px;
  background: #333333;
}

.mini-room.current {
  background: var(--red);
}

.mini-room.explored {
  background: #662222;
}

#log {
  height: 120px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.5;
}

.log-line {
  white-space: pre-wrap;
}

.log-line.error {
  color: var(--red);
}

.log-line.say {
  color: #66ccff;
}

.log-line.system {
  color: var(--dim);
}

#prompt-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
}

#callsign {
  color: #ffffff;
  font-weight: bold;
  min-width: 100px;
}

#cmd-form {
  flex: 1;
}

#cmd-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

#cmd-input::placeholder {
  color: #444444;
}

#map-wrap::after {
  content: "";
  display: block;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15) 0px,
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
}
