/* Banana Pepper — cute iPhone-first cricket hunt */
:root {
  --sand: #f6e6c8;
  --sand-deep: #e8c992;
  --leaf: #7cb518;
  --leaf-d: #4f7c12;
  --pepper: #f4d35e;
  --pepper-d: #e0b21a;
  --pink: #ff6b9d;
  --ink: #3a2a12;
  --muted: #7a6240;
  --panel: rgba(255, 250, 236, 0.94);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  min-height: 100dvh;
  font-family: Nunito, system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at top, #fff6d8 0%, #f3dca0 45%, #d9b56a 100%);
}

img { max-width: 100%; display: block; }
button { font: inherit; }

.app {
  height: 100dvh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  padding: calc(8px + var(--safe-t)) 12px calc(8px + var(--safe-b));
  max-width: 480px;
  margin: 0 auto;
}

.top { text-align: center; flex: 0 0 auto; }
.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}
h1 {
  margin: 2px 0 0;
  font-family: Fredoka, Nunito, sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #c98910;
  text-shadow: 0 2px 0 #fff3, 0 3px 0 #e8c04a;
}
.subtitle {
  margin: 0 0 8px;
  font-family: Fredoka, sans-serif;
  font-size: 0.95rem;
  color: var(--leaf-d);
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.chip {
  background: #fffdf6;
  border: 2px solid #e8c992;
  border-radius: 12px;
  padding: 4px 2px 5px;
  box-shadow: 0 2px 0 #d4b078;
}
.chip .k {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}
.chip span:last-child {
  font-family: Fredoka, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
}
.chip.combo.hot { background: #fff0f6; border-color: var(--pink); color: #c43a6e; }
.chip.time.warn { background: #fff4e8; border-color: #f0a04a; }

.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}

.playfield {
  position: relative;
  flex: 1 1 auto;
  min-height: 220px;
  border-radius: 22px;
  overflow: hidden;
  border: 3px solid #5c4324;
  box-shadow:
    0 0 0 3px #f4d35e,
    0 10px 24px rgba(80, 50, 10, 0.28),
    inset 0 0 40px rgba(40, 20, 0, 0.12);
  background:
    url("art/terrarium-play.jpg") center / cover no-repeat,
    #c9a56a;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.pops { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: Fredoka, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #ff4f88;
  text-shadow: 0 1px 0 #fff, 0 2px 6px rgba(255, 80, 130, 0.35);
  animation: popUp 0.75s ease-out forwards;
  white-space: nowrap;
}
.pop.heart { font-size: 1.25rem; }
@keyframes popUp {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.7); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -130%) scale(1.15); }
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 246, 216, 0.28), rgba(60, 40, 10, 0.28));
  z-index: 3;
}
.overlay.hidden { display: none; }

.panel {
  width: min(100%, 340px);
  text-align: center;
  background: var(--panel);
  border-radius: 20px;
  padding: 16px 16px 18px;
  border: 3px solid #e0b21a;
  box-shadow: 0 8px 0 #c98910, 0 14px 28px rgba(0,0,0,0.18);
}
.hero-pepper {
  width: 140px;
  height: auto;
  margin: 0 auto 6px;
  filter: drop-shadow(0 6px 0 rgba(90, 60, 20, 0.18));
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.panel-kicker {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--leaf-d);
  font-weight: 800;
}
.panel h2 {
  margin: 4px 0 8px;
  font-family: Fredoka, sans-serif;
  font-size: 1.45rem;
}
.panel-copy {
  margin: 0 0 14px;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--muted);
}

.play {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-family: Fredoka, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #b6e05a 0%, var(--leaf) 42%, var(--leaf-d) 100%);
  box-shadow: inset 0 2px 0 #e8ffb0, 0 4px 0 #3d6410;
  -webkit-tap-highlight-color: transparent;
}
.play:active { transform: translateY(2px); box-shadow: inset 0 2px 0 #e8ffb0, 0 2px 0 #3d6410; }

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 0;
  flex: 0 0 auto;
}
.stick { flex: 0 0 auto; text-align: center; }
.stick-base {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(255, 250, 236, 0.75);
  border: 3px solid #d4b078;
  box-shadow: inset 0 4px 10px rgba(90, 60, 20, 0.12);
  position: relative;
  touch-action: none;
}
.stick-knob {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe98a, var(--pepper-d));
  border: 2px solid #fff;
  box-shadow: 0 3px 0 #c98910;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.stick-label {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hint {
  margin: 0;
  flex: 1;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.3;
}

.footer {
  flex: 0 0 auto;
  text-align: center;
  margin-top: 6px;
  font-family: Fredoka, sans-serif;
  font-size: 0.92rem;
  color: #8a5a18;
}

@media (min-height: 780px) {
  h1 { font-size: 2.1rem; }
  .hero-pepper { width: 168px; }
}
