:root {
  --ink: #172033;
  --muted: #5d687b;
  --paper: #fffdf7;
  --panel: #ffffff;
  --mint: #d9f5e7;
  --teal: #1f8a84;
  --sun: #f7c548;
  --orange: #ec7b45;
  --rose: #f6d6da;
  --blue: #cfe8ff;
  --line: #d7deea;
  --shadow: 0 18px 38px rgba(23, 32, 51, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(217, 245, 231, 0.92), rgba(207, 232, 255, 0.92)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.42) 0 18px, rgba(255, 255, 255, 0.18) 18px 36px);
}

button {
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 420px);
  grid-template-rows: auto 1fr;
  gap: 16px;
  align-items: stretch;
}

.hero-panel,
.shop-panel,
.log-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel {
  grid-row: 1 / span 2;
  min-height: 640px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: auto -12% -18% -12%;
  height: 34%;
  background:
    linear-gradient(160deg, transparent 24%, rgba(31, 138, 132, 0.18) 24% 30%, transparent 30%),
    linear-gradient(20deg, transparent 20%, rgba(236, 123, 69, 0.14) 20% 27%, transparent 27%);
  pointer-events: none;
}

.title-row,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.4rem, 8vw, 5rem);
  max-width: 8ch;
}

h2 {
  font-size: 1.45rem;
}

.icon-button,
.text-button,
.buy-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--blue);
  box-shadow: 0 4px 0 #9bc8f1;
}

.text-button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--rose);
  box-shadow: 0 4px 0 #dfa8b0;
  font-weight: 800;
}

.score-board {
  margin: 18px 0;
  padding: 20px;
  display: grid;
  gap: 4px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  text-align: center;
}

.score-label,
.score-board span:last-child,
.stats-grid span,
.upgrade-card p,
.badge-card span,
.status-line {
  color: var(--muted);
}

#seedCount {
  font-size: clamp(3rem, 12vw, 6rem);
  line-height: 0.95;
}

.sprout-button {
  width: min(420px, 92%);
  aspect-ratio: 1;
  margin: 10px auto;
  padding: 18px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: #fff2b8;
  box-shadow: 0 14px 0 #e9ad3f, 0 24px 36px rgba(236, 123, 69, 0.28);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 1;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.sprout-button svg {
  width: 82%;
  filter: drop-shadow(0 8px 12px rgba(236, 123, 69, 0.22));
}

.sprout-button span {
  position: absolute;
  bottom: 17%;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  font-weight: 900;
}

.sprout-button:active,
.sprout-button.clicked {
  transform: translateY(8px) scale(0.98);
  box-shadow: 0 6px 0 #e9ad3f, 0 14px 22px rgba(236, 123, 69, 0.24);
}

.icon-button:active,
.text-button:active,
.buy-button:active {
  transform: translateY(3px);
  box-shadow: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  position: relative;
  z-index: 1;
}

.stats-grid div {
  min-width: 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--mint);
  text-align: center;
}

.stats-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 1.35rem;
}

.shop-panel,
.log-panel {
  padding: 18px;
}

.upgrade-list,
.badge-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.upgrade-card,
.badge-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.upgrade-icon,
.badge-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  font-size: 1.55rem;
}

.upgrade-card h3 {
  margin: 0 0 3px;
  font-size: 1rem;
}

.upgrade-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.3;
}

.buy-button {
  min-width: 92px;
  min-height: 42px;
  padding: 0 12px;
  color: #12211f;
  background: var(--sun);
  box-shadow: 0 4px 0 #d79f29;
  font-weight: 900;
}

.buy-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.badge-card {
  grid-template-columns: 40px 1fr;
  background: #f8fbff;
}

.badge-icon {
  width: 40px;
  height: 40px;
  background: var(--rose);
  font-size: 1.2rem;
}

.badge-card.locked {
  opacity: 0.5;
}

.badge-card strong,
.badge-card span {
  display: block;
}

.status-line {
  min-height: 22px;
  margin: 14px 0 0;
  font-size: 0.92rem;
}

.float-score {
  position: fixed;
  z-index: 10;
  color: var(--orange);
  font-weight: 900;
  pointer-events: none;
  animation: float-away 800ms ease-out forwards;
}

@keyframes float-away {
  from {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -54px) scale(1.25);
  }
}

@media (max-width: 840px) {
  .game-shell {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 620px);
  }

  .hero-panel {
    grid-row: auto;
    min-height: auto;
  }
}

@media (max-width: 480px) {
  .game-shell {
    padding: 10px 0;
  }

  .hero-panel,
  .shop-panel,
  .log-panel {
    padding: 14px;
  }

  .title-row,
  .section-heading {
    align-items: center;
  }

  h1 {
    font-size: 2.35rem;
  }

  .score-board {
    margin: 12px 0;
    padding: 14px;
  }

  #seedCount {
    font-size: 3rem;
  }

  .icon-button {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
  }

  .sprout-button {
    width: min(330px, 88vw);
    min-width: 248px;
  }

  .sprout-button span {
    bottom: 13%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .upgrade-card {
    grid-template-columns: 42px 1fr;
  }

  .upgrade-icon {
    width: 42px;
    height: 42px;
  }

  .buy-button {
    grid-column: 1 / -1;
    min-height: 46px;
    width: 100%;
  }
}

@media (max-width: 380px) {
  .upgrade-card {
    gap: 9px;
  }

  .upgrade-card h3 {
    font-size: 0.95rem;
  }

  .upgrade-card p,
  .badge-card span,
  .status-line {
    font-size: 0.84rem;
  }
}

@media (max-height: 720px) and (orientation: landscape) {
  .game-shell {
    grid-template-columns: 0.95fr 1.05fr;
  }

  .hero-panel {
    min-height: 0;
  }

  .sprout-button {
    width: min(250px, 42vh);
  }

  h1 {
    font-size: 2.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
.site-footer {
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 12px;
  padding: 12px 8px 18px;
  opacity: 0.9;
}

.site-footer p {
  margin: 0;
}

.site-footer .made-in {
  margin-left: 6px;
  color: var(--teal);
  font-weight: 600;
}
