* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --card: #fffdf5;
  --ink: #4a3528;
  --accent: #ff8c42;
  --green: #58b54c;
}

html, body {
  height: 100%;
  font-family: 'Fredoka', 'Comic Sans MS', system-ui, sans-serif;
  background: linear-gradient(180deg, #8fd3ff 0%, #c9f0ff 45%, #b9e88a 100%);
  overflow: hidden;
  user-select: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-wrap {
  position: relative;
  width: min(96vw, calc(96vh * 1.6));
  aspect-ratio: 960 / 600;
}

canvas#game {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(40, 80, 20, .35), 0 0 0 6px rgba(255,255,255,.55);
  background: #7ec850;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 10px; left: 14px; right: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  pointer-events: none;
  z-index: 5;
}
#hud.hidden { display: none; }

/* ---------- Active power-ups ---------- */
#hud-powerups {
  flex-basis: 100%;
  display: flex;
  gap: 8px;
}
#hud-powerups:empty { display: none; }

.pu-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 253, 245, .92);
  color: var(--ink);
  font-weight: 700;
  font-size: clamp(11px, 1.5vw, 15px);
  padding: 4px 11px;
  border-radius: 999px;
  box-shadow: 0 3px 0 rgba(0,0,0,.15);
  white-space: nowrap;
}
.pu-badge .pu-icon { font-size: 1.2em; }
.pu-badge .pu-lv { color: var(--accent); }

.hud-pill {
  background: rgba(255, 253, 245, .92);
  color: var(--ink);
  font-weight: 700;
  font-size: clamp(12px, 1.8vw, 18px);
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 3px 0 rgba(0,0,0,.15);
  white-space: nowrap;
}

.hud-goal {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 253, 245, .92);
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: 0 3px 0 rgba(0,0,0,.15);
  color: var(--ink);
  font-weight: 700;
  font-size: clamp(12px, 1.8vw, 17px);
}
.hud-carrot { font-size: 1.2em; }

.goal-track {
  flex: 1;
  height: 14px;
  background: #e8dcc8;
  border-radius: 999px;
  overflow: hidden;
}
#goal-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffb347, #ff8c42);
  border-radius: 999px;
  transition: width .25s ease;
}

.hud-btn {
  pointer-events: auto;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.hud-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.15); }

/* ---------- Overlay screens ---------- */
#overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 18px;
  background: rgba(40, 70, 30, .45);
  backdrop-filter: blur(3px);
}
#overlay.show { display: flex; }

.card {
  background: var(--card);
  border-radius: 22px;
  padding: clamp(16px, 3vw, 34px);
  width: min(92%, 660px);
  max-height: 94%;
  overflow-y: auto;
  text-align: center;
  color: var(--ink);
  box-shadow: 0 16px 50px rgba(0,0,0,.35), inset 0 0 0 4px #ffe9c9;
}

.card h1 {
  font-size: clamp(26px, 5vw, 46px);
  letter-spacing: 1px;
  color: var(--accent);
  text-shadow: 2px 3px 0 #ffe1bb;
}
.card h2 { font-size: clamp(20px, 3.4vw, 30px); margin-bottom: 6px; }
.card p { font-size: clamp(13px, 1.9vw, 17px); line-height: 1.45; }
.subtitle { font-weight: 600; color: #8a6f52; margin-bottom: 14px; }

.bounce { display: inline-block; animation: bounce 1.1s ease-in-out infinite; font-size: clamp(34px, 6vw, 60px); }
.bounce:nth-child(2) { animation-delay: .15s; }
.bounce:nth-child(3) { animation-delay: .3s; }
@keyframes bounce {
  0%, 100% { transform: translateY(0) scaleY(1); }
  35% { transform: translateY(-16px) scaleY(1.05); }
  50% { transform: translateY(0) scaleY(.92); }
}

.howto {
  background: #fdf3df;
  border-radius: 14px;
  padding: 12px 16px;
  margin: 14px 0;
  text-align: left;
  font-size: clamp(12px, 1.8vw, 15px);
}
.howto li { margin: 5px 0 5px 18px; }

.btn {
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(15px, 2.4vw, 21px);
  color: #fff;
  background: linear-gradient(180deg, #ffa75c, #ff8c42);
  border: none;
  border-radius: 999px;
  padding: 12px 36px;
  margin: 6px;
  cursor: pointer;
  box-shadow: 0 5px 0 #d96a23;
  transition: transform .08s;
}
.btn:hover { transform: scale(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #d96a23; }
.btn.green { background: linear-gradient(180deg, #74cc66, #58b54c); box-shadow: 0 5px 0 #3c8f33; }
.btn.green:active { box-shadow: 0 1px 0 #3c8f33; }
.btn.small { font-size: clamp(12px, 1.7vw, 15px); padding: 8px 20px; }
.btn:disabled {
  background: #c9c2b4;
  box-shadow: 0 5px 0 #a39c8e;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Shop ---------- */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 14px 0;
}

.shop-item {
  background: #fdf3df;
  border-radius: 16px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.shop-item .icon { font-size: clamp(26px, 4vw, 40px); }
.shop-item .name { font-weight: 700; font-size: clamp(13px, 1.9vw, 17px); }
.shop-item .desc { font-size: clamp(10px, 1.5vw, 13px); color: #8a6f52; min-height: 2.4em; }
.pips { letter-spacing: 3px; font-size: clamp(10px, 1.5vw, 14px); color: var(--accent); }

.skin-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 4px;
}
.skin-dot {
  width: clamp(34px, 5vw, 46px);
  height: clamp(34px, 5vw, 46px);
  border-radius: 50%;
  border: 3px solid #e0d2b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  position: relative;
  transition: transform .1s;
}
.skin-dot:hover { transform: scale(1.12); }
.skin-dot.selected { border-color: var(--accent); box-shadow: 0 0 0 3px #ffd9b3; }
.skin-dot.locked { cursor: not-allowed; filter: grayscale(.7); opacity: .55; }
.skin-dot .lock-tip {
  position: absolute;
  bottom: -16px;
  font-size: 9px;
  font-weight: 700;
  color: #8a6f52;
  white-space: nowrap;
}

.wallet-big {
  font-size: clamp(18px, 3vw, 26px);
  font-weight: 700;
  margin: 6px 0 2px;
}

.divider { border: none; border-top: 2px dashed #e0d2b8; margin: 14px 0; }
