* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: #111;
  color: #eee;
  font: 15px/1.5 Consolas, "Cascadia Mono", monospace;
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.command {
  background: #1b1b1b;
  border-color: #333;
  padding: 12px 16px;
}

.play-area {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.map-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  max-width: calc(100% - 32px);
  padding: 10px;
  border: 1px solid #333;
  background: rgba(22, 22, 22, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.map-panel.is-hidden {
  display: none;
}

.mini-map {
  --map-size: 7;
  display: grid;
  grid-template-columns: repeat(var(--map-size), 20px);
  grid-auto-rows: 20px;
  gap: 2px;
}

.map-tile {
  display: grid;
  place-items: center;
  min-width: 0;
  border: 1px solid #303030;
  background: #202020;
  color: #bbb;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.map-tile[data-terrain="sand"] {
  background: #5b5439;
  color: #ead58f;
}

.map-tile[data-terrain="scrub"] {
  background: #33462d;
  color: #bdd99b;
}

.map-tile[data-terrain="stone"] {
  background: #42474a;
  color: #d1d6d7;
}

.map-tile[data-terrain="unknown"] {
  background: #141414;
  color: #444;
}

.map-tile.is-current {
  border-color: #f2cc60;
  box-shadow: inset 0 0 0 2px #f2cc60;
  color: #fff;
}

.log {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding: 16px;
  padding-right: 240px;
  white-space: pre-wrap;
}

.block {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.block-art {
  margin-top: 0;
  white-space: pre;
}

.style-system {
  color: #d7b56d;
}

.style-muted {
  color: #999;
}

.style-error,
.style-danger,
.style-red {
  color: #ff6b6b;
}

.style-success,
.style-green {
  color: #91d18b;
}

.style-yellow {
  color: #f2cc60;
}

.style-blue {
  color: #75b7ff;
}

.style-bold {
  font-weight: 700;
}

.style-italic {
  font-style: italic;
}

.style-item {
  color: #e8c274;
}

.style-character {
  color: #75b7ff;
}

.style-place {
  color: #d7b56d;
}

.style-terrain,
.style-exit {
  color: #999;
}

.style-room {
  color: #91d18b;
  font-weight: 700;
}

.style-art {
  color: #cfc7b0;
}

.command {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  border-top: 1px solid #333;
  position: relative;
  z-index: 1;
}

.command span {
  color: #d7b56d;
}

textarea {
  width: 100%;
  max-height: 180px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: #eee;
  font: inherit;
  overflow-y: auto;
}

@media (max-width: 720px) {
  .map-panel {
    top: 10px;
    right: 10px;
    padding: 8px;
  }

  .mini-map {
    grid-template-columns: repeat(var(--map-size), 16px);
    grid-auto-rows: 16px;
  }

  .map-tile {
    font-size: 11px;
  }

  .log {
    padding-right: 16px;
    padding-top: 190px;
  }
}
