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

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

body {
  background: #fff;
  font-family: monospace;
  font-size: clamp(12px, 2vw, 24px);
  padding: 8px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-sizing: border-box;
}

#mini-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  min-height: 0;
  justify-content: center;
}

#mini-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 1px solid #000;
  width: 100%;
  max-width: min(324px, 100%);
  aspect-ratio: 1;
  user-select: none;
}

.mini-square {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: min(8vw, 32px);
  line-height: 1;
}

.mini-square.light {
  background: #f0f0f0;
}

.mini-square.dark {
  background: #c0c0c0;
}

.mini-square.selected {
  background: #999 !important;
}

.mini-square.legal-move::after {
  content: "";
  position: absolute;
  width: 50%;
  height: 50%;
  max-width: 16px;
  max-height: 16px;
  border-radius: 50%;
  background: #666;
}

.mini-square.legal-capture {
  outline: 1px solid #000;
}

.mini-square.last-move-from,
.mini-square.last-move-to {
  background: #bbb !important;
}

.mini-square.in-check {
  background: #c00 !important;
}

.mini-piece {
  pointer-events: none;
}

.mini-piece.white {
  color: #000;
  text-shadow: 0 0 1px #fff;
}

.mini-piece.black {
  color: #000;
  -webkit-text-fill-color: #000;
  text-shadow: none;
}

#mini-status {
  text-align: center;
  font-size: inherit;
  min-height: 1.2em;
}

#mini-new {
  font-size: inherit;
  padding: 0.3em 1em;
  cursor: pointer;
  background: #fff;
  border: 1px solid #000;
}

#mini-new:hover {
  background: #eee;
}

#mini-promo {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#mini-promo.hidden {
  display: none;
}

#mini-promo-choices {
  display: flex;
  gap: 8px;
  background: #fff;
  padding: 8px;
  border: 1px solid #000;
}

.mini-promo-piece {
  width: 2.5em;
  height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  cursor: pointer;
  border: 1px solid #ccc;
}

.mini-promo-piece:hover {
  background: #eee;
}
