:root {
  --tile: 46px;
  --board-font: 30px;
  --slot-font: 26px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  color: #2f3d21;
  background: radial-gradient(circle at 50% 0%, #c9f27a 0%, #8ed24e 45%, #5aa52f 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  user-select: none;
}

.topbar {
  width: 100%;
  max-width: 540px;
  padding: 12px 16px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 20px;
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(63, 107, 26, 0.55);
}

.brand .logo {
  font-size: 26px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.15));
}

.tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status {
  font-size: 13px;
  font-weight: 700;
  color: #3f6b1a;
  background: rgba(255, 255, 255, 0.82);
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.stage {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.board-wrap {
  position: relative;
  width: 280px;
  height: 280px;
}

.board {
  position: absolute;
  top: 0;
  left: 0;
  width: 280px;
  height: 280px;
  transform-origin: top left;
}

.tile {
  position: absolute;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--board-font);
  line-height: 1;
  background: linear-gradient(#fffef8, #f6edd4);
  border: 2px solid #e6d5a8;
  border-radius: 12px;
  box-shadow: 0 3px 0 #cbb98a, inset 0 2px 0 #ffffff, 0 4px 8px rgba(60, 70, 20, 0.18);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.12s ease;
}

.tile:active {
  transform: translateY(1px) scale(0.97);
}

.tile.covered {
  filter: brightness(0.72) saturate(0.65);
  cursor: default;
}

.tile.pop {
  animation: pop 0.22s ease;
}

@keyframes pop {
  0% { transform: scale(0.5); opacity: 0.2; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

.tile.shake {
  animation: shake 0.28s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.bottom {
  width: 100%;
  max-width: 540px;
  padding: 6px 12px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.slots {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(58, 92, 24, 0.28);
  border-radius: 16px;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.18);
}

.slot {
  width: var(--tile);
  height: var(--tile);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  border: 2px dashed rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--slot-font);
  line-height: 1;
}

.slot.filled {
  background: linear-gradient(#fffef8, #f6edd4);
  border: 2px solid #e6d5a8;
  box-shadow: 0 3px 0 #cbb98a, inset 0 2px 0 #ffffff;
  animation: drop 0.18s ease;
}

@keyframes drop {
  0% { transform: translateY(-10px) scale(0.85); opacity: 0.4; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.powerups {
  display: flex;
  gap: 14px;
}

.btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #3f6b1a;
  background: linear-gradient(#ffffff, #eaf7d6);
  border: none;
  border-radius: 999px;
  padding: 10px 24px;
  cursor: pointer;
  box-shadow: 0 4px 0 #b9d488, 0 6px 10px rgba(0, 0, 0, 0.12);
  transition: transform 0.08s ease, filter 0.12s ease;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #b9d488;
}

.btn:disabled {
  filter: grayscale(0.7) opacity(0.6);
  cursor: default;
  transform: none;
  box-shadow: 0 4px 0 #b9d488;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.82);
  padding: 8px 18px;
  font-size: 14px;
}

.btn.primary {
  background: linear-gradient(#ffe27a, #f5b73d);
  color: #6b4300;
  box-shadow: 0 4px 0 #c9891f, 0 6px 10px rgba(0, 0, 0, 0.15);
  padding: 12px 34px;
  font-size: 17px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 46, 10, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fade 0.2s ease;
}

.overlay.hidden {
  display: none;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.panel {
  width: min(80vw, 320px);
  background: linear-gradient(#ffffff, #f3fbe4);
  border-radius: 22px;
  padding: 26px 20px 24px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  animation: rise 0.25s ease;
}

@keyframes rise {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.overlay-emoji {
  font-size: 54px;
  line-height: 1;
}

.overlay-title {
  margin: 12px 0 6px;
  font-size: 22px;
  color: #3f6b1a;
}

.overlay-desc {
  margin: 0 0 20px;
  font-size: 14px;
  color: #7c8a66;
}
