:root {
  --bg-top: #65b7f6;
  --bg-bottom: #0e4c92;
  --panel: #ffffffee;
  --text: #0b1c3f;
  --card: #f5fbff;
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.35), transparent 30%),
              radial-gradient(circle at 80% 0%, rgba(255,255,255,0.28), transparent 25%),
              linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 10px;
}

body.shop-open {
  overflow: hidden;
}

body.credits-page {
  align-items: stretch;
}

.shell {
  width: min(1200px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: calc(100dvh - 20px);
}

header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.18);
  padding: 8px 10px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 22px rgba(0,0,0,0.12);
}

.header-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

h1 {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: clamp(20px, 4.5vw, 30px);
  margin: 0;
  letter-spacing: 0.02em;
  line-height: 1.05;
}

.stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  background: var(--panel);
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.pill[hidden] {
  display: none !important;
}

#coins {
  min-width: 150px;
}

.taco-timer-pill {
  background: linear-gradient(180deg, #fff2ca, #ffd88d);
  color: #72400d;
}

.crab-timer-pill {
  background: linear-gradient(180deg, #ffd8b5, #ff9f45);
  color: #6c2b00;
}

.shop-toggle {
  border: 1px solid rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.92);
  color: #08305f;
  border-radius: 12px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(0,0,0,0.16);
}

.shop-toggle:active {
  transform: translateY(1px);
}

.shop-toggle-icon {
  font-size: 18px;
  line-height: 1;
}

.shop-bag-icon {
  display: block;
  width: 24px;
  height: 24px;
}

.main {
  position: relative;
  background: url('https://cdn.pixabay.com/photo/2017/01/31/22/06/underwater-2025965_1280.png') center/cover no-repeat;
  border-radius: 20px;
  flex: 1;
  min-height: 280px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 14px 40px rgba(0,0,0,0.2);
}

.main,
.main * {
  -webkit-user-select: none;
  user-select: none;
}

.main img {
  -webkit-user-drag: none;
}

.main.taco-time {
  background: #d5aa75;
}

.main.crab-rave {
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 225, 160, 0.45), transparent 28%),
    radial-gradient(circle at 82% 24%, rgba(255, 174, 92, 0.4), transparent 24%),
    radial-gradient(circle at 48% 78%, rgba(255, 241, 196, 0.24), transparent 30%),
    linear-gradient(180deg, #ffbe63 0%, #ff8b2b 46%, #d95f00 100%);
}

.tank-entities {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.overlay-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, rgba(255,255,255,0.25), transparent 35%),
              radial-gradient(circle at 20% 70%, rgba(255,255,255,0.18), transparent 40%);
  pointer-events: none;
  z-index: 3;
}

.click-fish {
  position: absolute;
  width: clamp(120px, 18vw, 220px);
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
  filter: drop-shadow(0 10px 12px rgba(0,0,0,0.25));
  user-select: none;
  z-index: 2;
}

.click-fish:active { transform: translate(-50%, -50%) scale(0.95); }

.taco-target {
  position: absolute;
  width: 78px;
  height: 78px;
  border: none;
  background: rgba(255, 238, 204, 0.94);
  border-radius: 50%;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24);
  padding: 10px;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.72) rotate(-8deg);
  transition: opacity 130ms ease, transform 130ms ease, filter 100ms ease;
  pointer-events: none;
  z-index: 5;
}

.taco-target img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.taco-target.visible {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  pointer-events: auto;
}

.taco-target:active {
  transform: scale(0.9) rotate(-4deg);
  filter: brightness(0.96);
}

.taco-target:disabled {
  cursor: default;
}

.taco-truck {
  position: absolute;
  width: 240px;
  height: 108px;
  left: -260px;
  top: 58%;
  transform: translateY(-50%);
  z-index: 6;
  pointer-events: none;
  transition: left 1.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.taco-truck.in {
  left: calc(50% - 120px);
}

.taco-truck.out {
  left: calc(100% + 260px);
  transition-duration: 0.9s;
  transition-timing-function: cubic-bezier(0.4, 0, 0.85, 0.5);
}

.truck-box {
  position: absolute;
  left: 18px;
  top: 16px;
  width: 148px;
  height: 58px;
  background: linear-gradient(180deg, #ffcb66, #f8a42f);
  border: 3px solid #9d5514;
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.truck-label {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #6e3400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.truck-cab {
  position: absolute;
  right: 28px;
  top: 24px;
  width: 64px;
  height: 50px;
  border-radius: 10px 14px 10px 8px;
  background: linear-gradient(180deg, #ffd488, #f6a130);
  border: 3px solid #9d5514;
}

.truck-window {
  position: absolute;
  right: 39px;
  top: 34px;
  width: 32px;
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(180deg, #d6f2ff, #9fd3ee);
  border: 2px solid #2b5978;
}

.truck-bumper {
  position: absolute;
  right: 16px;
  top: 64px;
  width: 18px;
  height: 7px;
  border-radius: 3px;
  background: #6f5a4a;
}

.truck-wheel {
  position: absolute;
  bottom: 6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #2c2f35;
  border: 4px solid #171a1f;
}

.truck-wheel::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #8f95a1;
}

.truck-wheel-back {
  left: 38px;
}

.truck-wheel-front {
  right: 46px;
}

.taco-launch {
  position: absolute;
  width: 58px;
  height: 58px;
  z-index: 7;
  pointer-events: none;
  transform: translate(0, 0) rotate(-20deg) scale(0.9);
}

.taco-launch img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.taco-launch.fly {
  animation: taco-launch-flight 0.72s cubic-bezier(0.15, 0.85, 0.2, 1) forwards;
}

@keyframes taco-launch-flight {
  0% {
    transform: translate(0, 0) rotate(-20deg) scale(0.9);
  }
  100% {
    transform: translate(var(--fly-x), var(--fly-y)) rotate(380deg) scale(1);
  }
}

.crab-dancer {
  position: absolute;
  width: var(--crab-size);
  height: var(--crab-size);
  z-index: 6;
  pointer-events: none;
  filter: drop-shadow(0 10px 16px rgba(120, 38, 0, 0.3));
  animation: crab-dance var(--dance-duration) ease-in-out infinite;
  animation-delay: var(--dance-delay);
}

.crab-dancer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.crab-rave-audio {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: -9999px;
  top: -9999px;
}

@keyframes crab-dance {
  0% {
    transform: translate3d(0, 0, 0) rotate(calc(var(--dance-tilt) * -1));
  }
  25% {
    transform: translate3d(-8px, -10px, 0) rotate(var(--dance-tilt)) scale(1.04);
  }
  50% {
    transform: translate3d(0, -2px, 0) rotate(calc(var(--dance-tilt) * -0.6)) scale(0.98);
  }
  75% {
    transform: translate3d(8px, -12px, 0) rotate(var(--dance-tilt)) scale(1.05);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(calc(var(--dance-tilt) * -1));
  }
}

.bubble {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 6px rgba(255,255,255,0.9);
  animation: rise 1.4s ease-out forwards;
  pointer-events: none;
}

@keyframes rise {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-120px) scale(0.4); opacity: 0; }
}

.swimmer {
  position: absolute;
  will-change: transform;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,0.18));
  transition-property: transform, filter;
  transition-timing-function: linear, ease;
  transition-duration: 0s, 120ms;
  pointer-events: none;
}

.swimmer.fast { filter: drop-shadow(0 10px 14px rgba(0,0,0,0.22)); }

.gum-bubble {
  position: absolute;
  width: 90px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe4f7, #ff8dd7 60%);
  box-shadow: 0 0 12px rgba(255, 133, 211, 0.8);
  animation: gum-drift 6s linear forwards;
  z-index: 4;
  pointer-events: none;
}

.gum-bubble.pop {
  animation: gum-pop 0.5s ease-out forwards;
}

@keyframes gum-drift {
  0% { transform: translate(-120px, 40%); opacity: 0.2; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(120%, 30%); opacity: 0; }
}

@keyframes gum-pop {
  0% { transform: scale(1); opacity: 1; }
  70% { transform: scale(1.8); opacity: 0.8; box-shadow: 0 0 30px rgba(255,133,211,0.8); }
  100% { transform: scale(0.4); opacity: 0; }
}

.lucky-egg-unlock {
  position: absolute;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(255, 250, 214, 0.95), rgba(255, 229, 163, 0.95));
  border: 1px solid rgba(155, 95, 18, 0.3);
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 800;
  color: #57380a;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  z-index: 6;
  pointer-events: none;
  animation: lucky-unlock-pop 2.3s ease-out forwards;
}

@keyframes lucky-unlock-pop {
  0% { opacity: 0; transform: translate(-50%, -8px) scale(0.85); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  85% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(0.94); }
}

.lucky-egg-scene {
  position: absolute;
  left: 50%;
  bottom: -120px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 6;
  pointer-events: none;
  animation: lucky-egg-rise 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.lucky-egg-shell {
  font-size: clamp(74px, 11vw, 110px);
  line-height: 1;
  filter: drop-shadow(0 12px 20px rgba(0,0,0,0.32));
  transform-origin: center bottom;
}

.lucky-egg-prize {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: clamp(16px, 2.4vw, 22px);
  font-weight: 700;
  color: #0f2144;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  border: 1px solid rgba(11, 28, 63, 0.14);
  padding: 8px 14px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.16);
  opacity: 0;
  transform: translateY(12px) scale(0.96);
}

.lucky-egg-scene.crack .lucky-egg-shell {
  animation: lucky-egg-crack 0.5s ease-out forwards;
}

.lucky-egg-scene.crack .lucky-egg-prize {
  animation: lucky-prize-pop 0.7s ease-out 0.16s forwards;
}

.lucky-egg-scene.fade {
  animation: lucky-egg-fade 0.5s ease-in forwards;
}

@keyframes lucky-egg-rise {
  0% { bottom: -120px; opacity: 0; }
  100% { bottom: 24%; opacity: 1; }
}

@keyframes lucky-egg-crack {
  0% { transform: scale(1) rotate(0deg); opacity: 1; }
  35% { transform: scale(1.08) rotate(-8deg); opacity: 1; }
  100% { transform: scale(0.44) rotate(16deg); opacity: 0; }
}

@keyframes lucky-prize-pop {
  0% { opacity: 0; transform: translateY(12px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes lucky-egg-fade {
  0% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(18px) scale(0.96); }
}

.shop {
  position: fixed;
  top: 0;
  right: 0;
  width: min(90vw, 360px);
  height: 100dvh;
  background: rgba(234, 247, 255, 0.97);
  border-left: 1px solid rgba(0,0,0,0.08);
  box-shadow: -16px 0 34px rgba(0,0,0,0.24);
  backdrop-filter: blur(6px);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: translateX(104%);
  transition: transform 220ms ease;
  z-index: 30;
}

.shop.open {
  transform: translateX(0);
}

.shop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.shop-title {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #08305f;
  font-size: 20px;
}

.shop-close {
  border: none;
  background: #dbeeff;
  color: #0b1c3f;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.shop-close:active {
  transform: scale(0.96);
}

.shop-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
  scrollbar-color: #9cd7ff rgba(255,255,255,0.7);
}

.shop-row::-webkit-scrollbar { width: 10px; }
.shop-row::-webkit-scrollbar-track { background: rgba(255,255,255,0.55); border-radius: 999px; }
.shop-row::-webkit-scrollbar-thumb { background: linear-gradient(135deg, #7dd3fc, #2563eb); border-radius: 999px; }

.shop-actions {
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid rgba(11, 28, 63, 0.12);
  display: grid;
  gap: 8px;
}

.shop-attribution {
  margin: 2px 2px 0;
  font-size: 12px;
  line-height: 1.45;
  color: #4b5f82;
  text-align: center;
}

.shop-attribution a {
  color: #0c5db3;
  font-weight: 700;
}

.credits-shell {
  width: min(900px, 100%);
  margin: 0 auto;
  display: grid;
  align-items: start;
  padding: 18px 10px;
}

.credits-card {
  background: rgba(245, 251, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16);
  padding: 20px 18px;
}

.credits-card h1,
.credits-card h2 {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  color: #08305f;
}

.credits-card h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 4vw, 34px);
}

.credits-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.credits-intro {
  margin: 0 0 16px;
  color: #28446f;
}

.credits-section {
  padding: 14px 0;
  border-top: 1px solid rgba(11, 28, 63, 0.1);
}

.credits-section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.credits-section p {
  margin: 0 0 8px;
  color: #1f3558;
  line-height: 1.55;
}

.credits-section a {
  color: #0c5db3;
  font-weight: 700;
}

.credits-actions {
  margin-top: 18px;
}

.reset-btn {
  width: 100%;
  border: 1px solid rgba(10, 74, 141, 0.25);
  background: linear-gradient(180deg, #fff6f6, #ffe5e5);
  color: #7b1f1f;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.reset-btn:active {
  transform: translateY(1px);
}

.test-btn {
  width: 100%;
  border: 1px solid rgba(136, 68, 0, 0.24);
  background: linear-gradient(180deg, #ffe6c4, #ffb25e);
  color: #6d2e00;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.test-btn:active {
  transform: translateY(1px);
}

.home-btn {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(10, 74, 141, 0.25);
  background: linear-gradient(180deg, #f2faff, #dcefff);
  color: #0c3f78;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
}

.home-btn:active {
  transform: translateY(1px);
}

.card {
  flex: 0 0 auto;
  width: 100%;
  background: var(--card);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(0,0,0,0.04);
  box-shadow: 0 10px 16px rgba(0,0,0,0.08);
}

.card img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
}

.card h3 {
  margin: 0;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 18px;
  letter-spacing: 0.01em;
}

.lucky-egg-card {
  background: linear-gradient(160deg, #fff6d9, #ffeab1 55%, #ffe3a5);
}

.meta { font-size: 13px; color: #1f3558; margin: 2px 0 6px; }
.owned { font-size: 12px; color: #1f3558; font-weight: 700; }

.buy-btn {
  border: none;
  background: linear-gradient(135deg, #34d399, #0ea5e9);
  color: #0b1220;
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 8px 16px rgba(14, 165, 233, 0.35);
}

.buy-btn:active { transform: translateY(2px); }
.buy-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.shop-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 17, 47, 0.45);
  border: none;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 25;
}

.shop-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 640px) {
  body {
    padding: 6px;
  }

  .shell {
    gap: 6px;
    min-height: calc(100dvh - 12px);
  }

  header {
    padding: 6px 8px;
    border-radius: 10px;
  }

  h1 {
    font-size: 22px;
  }

  .stats {
    gap: 5px;
  }

  .pill {
    font-size: 13px;
    padding: 5px 8px;
  }

  .shop-toggle {
    padding: 7px 9px;
    min-width: 46px;
    justify-content: center;
  }

  .shop-bag-icon {
    width: 22px;
    height: 22px;
  }

  .shop-toggle-text {
    display: none;
  }

  .main {
    border-radius: 16px;
    min-height: 250px;
  }

  .click-fish {
    width: clamp(100px, 34vw, 170px);
  }

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

  .card img { width: 64px; height: 64px; }
}
