:root {
  --bg: #fff7f0;
  --text: #2b2b2b;
  --accent: #ff4fd8;
  --accent-2: #6ee7ff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-2) 0%, transparent 40%),
              radial-gradient(1000px 500px at 110% 10%, var(--accent) 0%, transparent 35%),
              var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  overflow-x: hidden;
}

.container {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 10px;
  flex-wrap: wrap;
}

.left { display:flex; flex-direction: column; gap: 4px; }
.center { position: absolute; left: 50%; transform: translateX(-50%); top: 8px; pointer-events: none; }
.right { display:flex; align-items:center; gap: 12px; }
.counter { font-weight: 900; letter-spacing: 1px; font-size: clamp(28px, 5vw, 56px); text-shadow: 0 3px 0 rgba(0,0,0,.08); }
.counter.bounce { animation: counterBounce .35s ease; }
.credit { opacity: .8; }

.volume { display: flex; align-items: center; gap: 8px; }
.vol-icon { width: 32px; height: 32px; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
#volume { width: 160px; accent-color: var(--accent); }

.swap {
  background: white;
  border: 2px solid #00000010;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.swap.ghost { background: transparent; border-style: dashed; }

.btn {
  background: transparent;
  border: none;
  place-self: center;
  cursor: pointer;
  outline: none;
}

#mainImg {
  display: block;
  width: min(80vw, 520px);
  height: auto;
  filter: drop-shadow(0 12px 30px rgba(0,0,0,.25));
  transition: transform .08s ease;
  transform: scale(var(--imgScale, 1));
}

.btn.bonk { animation: wiggle .35s cubic-bezier(.36,.07,.19,.97) both; }

@keyframes wiggle {
  0% { transform: translate3d(0,0,0) scale(1); }
  10% { transform: rotate(-6deg) scale(1.06); }
  20% { transform: rotate(6deg) scale(1.03); }
  30% { transform: rotate(-3deg) scale(1.05); }
  40% { transform: rotate(3deg) }
  50% { transform: rotate(-1deg) }
  60% { transform: rotate(1deg) }
  100% { transform: translate3d(0,0,0) scale(1); }
}

.spawn {
  position: fixed;
  width: 100px;
  pointer-events: none;
  will-change: transform, opacity;
  transform-origin: center;
  animation: fly 800ms ease-out forwards;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,.2));
}

@keyframes fly {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(.7) rotate(0deg); }
  60%  { transform: translate(calc(-50% - 20px), calc(-50% - 120px)) scale(1.15) rotate(10deg); }
  100% { opacity: 0; transform: translate(calc(-50% - 80px), calc(-50% - 260px)) scale(.9) rotate(-12deg); }
}

@keyframes counterBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes speechFly {
  0% { transform: translate(-50%, -120%) scale(.9); opacity: 0; }
  50% { transform: translate(-50%, -160%) scale(1.05); opacity: 1; }
  100% { transform: translate(-50%, -200%) scale(1); opacity: 0; }
}

/* Responsive tweaks */
@media (max-width: 640px) {
  .center { position: static; transform: none; order: 3; width: 100%; text-align: center; }
  .counter { font-size: clamp(24px, 8vw, 40px); }
  .right { width: 100%; justify-content: center; flex-wrap: wrap; }
  .left { width: 100%; text-align: center; order: 2; }
  .container { grid-template-rows: auto 1fr; }
}


