:root {
  --ink: #181611;
  --line: #181611;
  --screen: #dfe8c8;
  --panel: #fff7df;
  --paper: #efe3be;
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  place-items: center;
  background: #746b5b;
  color: var(--ink);
  font-family: "MS Gothic", "Yu Gothic", monospace;
}

button,
select {
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fffdf4;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  line-height: 1;
  padding: 1px 4px;
}

.fp {
  width: 200px;
  height: 300px;
  overflow: hidden;
  border: 2px solid var(--line);
  background: var(--panel);
  box-shadow: 4px 4px 0 #2f2a20;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 24px;
  padding: 2px 5px;
  border-bottom: 2px solid var(--line);
  background: var(--paper);
  font-size: 11px;
}

.view {
  height: 272px;
  padding: 5px;
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 136px;
  border: 2px solid var(--line);
  background:
    linear-gradient(rgba(24, 22, 17, 0.08) 1px, transparent 1px),
    var(--screen);
  background-size: 100% 12px;
}

.pet {
  width: 120px;
  height: 120px;
  object-fit: contain;
  image-rendering: pixelated;
  user-select: none;
  -webkit-user-drag: none;
  animation: idle 1.2s steps(2, end) infinite;
}

.pet.hide {
  opacity: 0;
}

.pet.battle {
  animation: battle 0.18s steps(2, end) infinite;
}

.away {
  position: absolute;
  z-index: 1;
  padding: 2px 5px;
  border: 1px solid var(--line);
  background: #fffdf4;
  font-size: 12px;
}

.speech {
  height: 52px;
  margin: 4px 0;
  padding: 3px 5px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fffdf4;
  font-size: 12px;
  line-height: 1.25;
}

.speech a {
  color: #145f88;
  font-weight: bold;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
}

.creator {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 148px 76px 1fr;
  gap: 4px;
}

#editCanvas {
  width: 186px;
  height: 144px;
  border: 2px solid var(--line);
  background: var(--screen);
  touch-action: none;
}

.tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: start;
  gap: 4px;
}

.tools button:last-child {
  grid-column: auto;
}

.mini {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 11px;
  line-height: 1.25;
}

@keyframes idle {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes battle {
  0% {
    transform: translateX(-3px);
  }
  100% {
    transform: translateX(3px);
  }
}
