:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --ink: #19333a;
  --soft: #f6fbf8;
  --mint: #65d39a;
  --teal: #39acc4;
  --coral: #ff7f74;
  --gold: #ffc84f;
  --violet: #8b76e9;
  --shadow: 0 12px 30px rgba(31, 76, 64, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #b8ecdf 0%, #7fcf8e 50%, #447f2a 100%);
  color: var(--ink);
  display: grid;
  place-items: center;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.app-shell {
  width: min(100vw, 430px);
  min-height: 100vh;
  padding: max(14px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  gap: 12px;
}

.topbar,
.actions,
.target-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar {
  justify-content: space-between;
}

.pill,
.sound-button {
  min-height: 44px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 6px 16px rgba(34, 86, 92, 0.14);
}

.pill {
  min-width: 116px;
  padding: 7px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #7b4310;
  font-weight: 900;
}

.icon.gem {
  background: var(--teal);
  color: white;
}

.sound-button {
  width: 44px;
  color: var(--teal);
  font-weight: 900;
}

.garden {
  min-height: 300px;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(180deg, #90dce0 0%, #c9f0d6 48%, #5e9f34 100%);
  box-shadow: var(--shadow);
}

.sun,
.cloud,
.house,
.progress-panel {
  position: absolute;
}

.sun {
  width: 72px;
  height: 72px;
  right: 24px;
  top: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff8b8 0 35%, #ffd86c 36% 100%);
}

.cloud {
  height: 38px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.8);
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}

.cloud::before {
  width: 42px;
  height: 42px;
  left: 22px;
  top: -18px;
}

.cloud::after {
  width: 58px;
  height: 58px;
  right: 18px;
  top: -28px;
}

.cloud-one {
  width: 128px;
  left: -28px;
  top: 78px;
}

.cloud-two {
  width: 112px;
  right: -35px;
  top: 128px;
}

.house {
  width: 230px;
  height: 190px;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
}

.roof {
  width: 206px;
  height: 48px;
  margin: 0 auto;
  transform: skewX(-16deg);
  border-radius: 8px 8px 3px 3px;
  background: repeating-linear-gradient(0deg, #89b5c9 0 8px, #d5e8f0 9px 12px);
  box-shadow: 0 8px 0 rgba(56, 85, 103, 0.12);
}

.wall {
  height: 154px;
  margin-top: -6px;
  border-radius: 8px;
  background: linear-gradient(90deg, #fbf6ef 0 50%, #a56c45 51% 100%);
  border: 5px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  position: relative;
}

.window,
.door {
  position: absolute;
  bottom: 28px;
  border: 5px solid #edf7f0;
  background: linear-gradient(135deg, rgba(100, 211, 154, 0.55), rgba(255, 255, 255, 0.8));
}

.window {
  width: 52px;
  height: 74px;
  left: 33px;
  border-radius: 26px 26px 6px 6px;
}

.door {
  width: 60px;
  height: 102px;
  right: 48px;
  border-radius: 30px 30px 6px 6px;
}

.progress-panel {
  left: 20px;
  right: 20px;
  bottom: 18px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.progress-track {
  height: 12px;
  border-radius: 30px;
  background: #dce8dd;
  overflow: hidden;
}

.progress-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--gold));
  transition: width 220ms ease;
}

.ad-slot,
.board-wrap {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 22px rgba(25, 51, 58, 0.14);
}

.ad-slot {
  min-height: 70px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ad-slot span {
  display: block;
  margin-top: 4px;
  color: #5f7b7f;
  font-size: 12px;
}

.ad-slot button,
.actions button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  color: white;
  font-weight: 900;
  box-shadow: 0 8px 0 rgba(23, 83, 69, 0.18);
}

.ad-slot button {
  background: var(--violet);
  white-space: nowrap;
}

.board-wrap {
  padding: 12px;
}

.target-row {
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
}

.target-row strong {
  font-size: 16px;
}

.board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  aspect-ratio: 1;
}

.tile {
  aspect-ratio: 1;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: clamp(22px, 8vw, 34px);
  background: #ffffff;
  box-shadow: inset 0 -5px 0 rgba(42, 85, 70, 0.12), 0 4px 10px rgba(22, 58, 48, 0.1);
  transition: transform 120ms ease, filter 120ms ease;
}

.tile.selected {
  transform: translateY(-4px) scale(1.04);
  filter: drop-shadow(0 8px 9px rgba(67, 150, 126, 0.28));
}

.tile.cleared {
  animation: pop 220ms ease forwards;
}

.actions {
  justify-content: stretch;
}

.actions button {
  flex: 1;
}

#shuffleButton {
  background: var(--teal);
}

#startButton {
  background: linear-gradient(135deg, #25d978, #17b9a8);
}

@keyframes pop {
  to {
    transform: scale(0);
    opacity: 0;
  }
}

@media (max-height: 760px) {
  .garden {
    min-height: 240px;
  }

  .house {
    transform: translateX(-50%) scale(0.86);
    transform-origin: bottom center;
  }
}
