:root {
  --bg: #11171a;
  --panel: #1d2f26;
  --forest: #1f3d2f;
  --accent: #ffda72;
  --text: #f3f8dd;
}

* {
  box-sizing: border-box;
  image-rendering: pixelated;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Press Start 2P", "Courier New", monospace;
  color: var(--text);
  background:
    repeating-linear-gradient(
      45deg,
      #121d22 0 8px,
      #0d1518 8px 16px
    );
}

.game-shell {
  width: min(95vw, 760px);
  background: var(--panel);
  border: 4px solid #8ab17d;
  box-shadow: 0 0 0 4px #2b4737, 8px 8px 0 0 #09100e;
  padding: 20px;
}

.title {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 3px 3px 0 #6b4f2b;
}

.subtitle {
  font-size: 0.7rem;
  line-height: 1.6;
  margin: 12px 0 18px;
}

.hud {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 10px;
}

.board-wrap {
  position: relative;
}

#game {
  width: 100%;
  max-height: 70vh;
  border: 4px solid #f8f4c6;
  background: var(--forest);
  touch-action: none;
}

.biao-popup {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  pointer-events: none;
  color: #ffd34e;
  text-shadow: 3px 3px 0 #4b2f10;
  font-size: clamp(1.2rem, 3vw, 2.2rem);
  letter-spacing: 2px;
}

.biao-popup.show {
  animation: biaoFade 3s ease forwards;
}

.biao-popup.game-over {
  opacity: 1;
  animation: none;
  color: #ff8fb1;
  text-shadow: 3px 3px 0 #4b102a;
}

.biao-popup.win {
  opacity: 1;
  animation: none;
  color: #afff8f;
  text-shadow: 3px 3px 0 #1d4b10;
}

@keyframes biaoFade {
  0%, 60% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -58%) scale(1.06);
  }
}

.message {
  margin: 12px 0 0;
  font-size: 0.7rem;
  min-height: 1.3em;
  color: #fff4ab;
}

.controls {
  margin: 10px 0 0;
  font-size: 0.62rem;
  line-height: 1.5;
  color: #d7ebc9;
  border-top: 2px dashed #5f8c70;
  padding-top: 10px;
}

.mobile-actions {
  position: fixed;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
  z-index: 30;
}

.mobile-actions button {
  min-width: 88px;
  min-height: 52px;
  border: 3px solid #f8f4c6;
  background: #2b4737;
  color: #f3f8dd;
  font-family: inherit;
  font-size: 0.62rem;
  padding: 8px;
  touch-action: manipulation;
}

.mobile-actions button:active {
  transform: translateY(1px);
}

@media (min-width: 900px) {
  .mobile-actions {
    opacity: 0.9;
  }
}
