/* ============ Duck Hunter game ============ */
.duckhunt { display: flex; flex-direction: column; min-height: 0; min-width: 0; flex: 1; overflow-x: clip; }

/* ── Stage ── */
.dh-stage {
  position: relative; margin: 12px 14px 0; border-radius: var(--r);
  border: 1px solid var(--line); overflow: hidden;
  height: clamp(340px, 52vh, 500px);
  background: linear-gradient(180deg, #2f7fb8 0%, #67b4dc 40%, #a9dcec 72%, #d7eef2 100%);
}
.dh-stage.kick { animation: dh-kick .16s ease; }
@keyframes dh-kick { 0%,100% { transform: translateY(0); } 40% { transform: translateY(3px); } }
.dh-stage.flash::after, .dh-stage.kick::after {
  content: ''; position: absolute; inset: 0; z-index: 8; pointer-events: none;
  background: radial-gradient(circle at 50% 78%, rgba(255,240,190,.6), rgba(255,240,190,0) 55%);
  animation: dh-flash .16s ease-out;
}
@keyframes dh-flash { from { opacity: 1; } to { opacity: 0; } }
.dh-stage.win  { box-shadow: inset 0 0 80px rgba(14,203,129,.32); }
.dh-stage.lose { box-shadow: inset 0 0 80px rgba(246,70,93,.26); }

/* ── Sky decor ── */
.dh-sky { position: absolute; inset: 0; pointer-events: none; }
.dh-sun {
  position: absolute; top: 8%; right: 11%; width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(circle at 42% 40%, #fffbe6, #ffe27a 58%, #ffc63e 100%);
  box-shadow: 0 0 40px rgba(255,224,122,.8), 0 0 100px rgba(255,205,70,.45);
}
.dh-hills {
  position: absolute; left: -5%; right: -5%; bottom: 56px; height: 120px;
  background:
    radial-gradient(60% 100% at 22% 100%, #6fae5a 0 60%, transparent 61%),
    radial-gradient(70% 100% at 60% 100%, #5fa24c 0 58%, transparent 59%),
    radial-gradient(60% 100% at 92% 100%, #6fae5a 0 60%, transparent 61%);
  opacity: .85;
}
.dh-trees {
  position: absolute; left: 0; right: 0; bottom: 56px; height: 46px;
  background:
    radial-gradient(7px 16px at 8% 100%, #2f6e36 60%, transparent 62%),
    radial-gradient(9px 22px at 18% 100%, #357c3d 60%, transparent 62%),
    radial-gradient(7px 14px at 30% 100%, #2f6e36 60%, transparent 62%),
    radial-gradient(8px 18px at 70% 100%, #357c3d 60%, transparent 62%),
    radial-gradient(7px 15px at 82% 100%, #2f6e36 60%, transparent 62%),
    radial-gradient(9px 20px at 93% 100%, #357c3d 60%, transparent 62%);
  background-repeat: no-repeat; opacity: .8;
}
.dh-cloud { position: absolute; height: 24px; border-radius: 20px; background: linear-gradient(180deg, #fff, #e3f1ff); opacity: .92; filter: blur(.4px); }
.dh-cloud::before, .dh-cloud::after { content: ''; position: absolute; bottom: 0; border-radius: 50%; background: #fff; }
.dh-cloud.a { width: 96px; top: 18%; left: -34%; animation: dh-drift 38s linear infinite; }
.dh-cloud.b { width: 66px; top: 34%; left: -28%; animation: dh-drift 52s linear infinite 6s; opacity: .8; }
.dh-cloud.c { width: 120px; top: 11%; left: -44%; animation: dh-drift 66s linear infinite 13s; opacity: .72; }
.dh-cloud.a::before { width: 42px; height: 42px; left: 10px; } .dh-cloud.a::after { width: 32px; height: 32px; right: 12px; }
.dh-cloud.b::before { width: 32px; height: 32px; left: 8px; }
.dh-cloud.c::before { width: 54px; height: 54px; left: 14px; } .dh-cloud.c::after { width: 38px; height: 38px; right: 16px; }
@keyframes dh-drift { from { transform: translateX(0); } to { transform: translateX(460%); } }

/* ── Reeds / grass foreground ── */
.dh-reeds {
  position: absolute; left: 0; right: 0; bottom: 0; height: 58px; z-index: 4; pointer-events: none;
  background: linear-gradient(180deg, rgba(31,122,60,0) 0%, #1f7a3c 36%, #115129 100%);
}
.dh-reeds::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: 30px; height: 64px;
  background-image:
    radial-gradient(6px 50px at 5% 100%, #1c6e34 60%, transparent 62%),
    radial-gradient(5px 40px at 12% 100%, #237d3d 60%, transparent 62%),
    radial-gradient(7px 56px at 20% 100%, #1c6e34 60%, transparent 62%),
    radial-gradient(5px 44px at 27% 100%, #2a8a47 60%, transparent 62%),
    radial-gradient(6px 48px at 74% 100%, #237d3d 60%, transparent 62%),
    radial-gradient(7px 56px at 83% 100%, #1c6e34 60%, transparent 62%),
    radial-gradient(5px 42px at 92% 100%, #2a8a47 60%, transparent 62%),
    radial-gradient(6px 50px at 97% 100%, #1c6e34 60%, transparent 62%);
  background-repeat: no-repeat;
}

/* ── Flight band + duck ── */
.dh-air { position: absolute; left: 0; right: 0; top: 0; bottom: 56px; z-index: 3; overflow: hidden; }
.dh-duck { position: absolute; left: 0; top: 0; width: 100px; height: 64px; will-change: transform; }
.dh-duck-fig { width: 100%; height: 100%; transform-origin: center; }
.dh-duck-fig svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 5px 6px rgba(0,0,0,.28)); }
.dh-wing { transform-origin: 42px 30px; animation: dh-flap .24s ease-in-out infinite alternate; }
@keyframes dh-flap { 0% { transform: rotate(-16deg); } 100% { transform: rotate(30deg); } }

/* HIT — flips and drops straight down on the same spot */
.dh-duck.hit .dh-duck-fig { animation: dh-fall .9s cubic-bezier(.45,.05,.85,.5) forwards; }
@keyframes dh-fall {
  0% { transform: translateY(0) rotate(0); }
  16% { transform: translateY(-12px) rotate(22deg); }
  100% { transform: translateY(330px) rotate(196deg); opacity: .12; }
}
.dh-duck.hit .dh-wing { animation: none; transform: rotate(66deg); }
/* MISS — flaps on in the same direction and escapes */
.dh-duck.miss .dh-duck-fig { animation: dh-escape .85s cubic-bezier(.3,.4,.2,1) forwards; }
@keyframes dh-escape {
  0% { transform: translate(0,0); }
  100% { transform: translate(250px,-46px); opacity: 0; }
}
.dh-duck.miss .dh-wing { animation-duration: .1s; }

/* scope reticle (tracks the duck) */
.dh-cross { position: absolute; left: 0; top: 0; width: 56px; height: 56px; opacity: 0; will-change: transform; }
.dh-cross.on { opacity: .85; }
.dh-cross i { position: absolute; inset: 0; border: 1.5px solid rgba(255,45,45,.85); border-radius: 50%; box-shadow: 0 0 8px rgba(255,45,45,.4); }
.dh-cross span { position: absolute; background: rgba(255,45,45,.9); }
.dh-cross span:nth-child(1) { left: 50%; top: -7px; width: 1.5px; height: 15px; transform: translateX(-50%); }
.dh-cross span:nth-child(2) { top: 50%; left: -7px; height: 1.5px; width: 15px; transform: translateY(-50%); }
.dh-cross.fire i { animation: dh-firepulse .22s ease-out; }
@keyframes dh-firepulse { 0% { transform: scale(.7); border-color: #fff; } 100% { transform: scale(1.6); opacity: 0; } }

/* feathers on a hit */
.dh-feather {
  position: absolute; width: 8px; height: 11px; border-radius: 50% 50% 50% 0;
  background: linear-gradient(180deg, #fff, #caa06a); box-shadow: 0 0 4px rgba(0,0,0,.2);
  will-change: transform, opacity; z-index: 6; animation: dh-feather .76s ease-out forwards;
}
@keyframes dh-feather {
  0% { transform: translate(-50%,-50%) rotate(var(--a)) translateX(2px); opacity: 1; }
  100% { transform: translate(-50%,-50%) rotate(var(--a)) translateX(var(--d)) translateY(40px) rotate(200deg); opacity: 0; }
}

/* impact / pellet puffs */
.dh-poof {
  position: absolute; width: 36px; height: 36px; border-radius: 50%; transform: translate(-50%,-50%);
  will-change: transform, opacity; z-index: 6; pointer-events: none;
  background: radial-gradient(circle, rgba(228,228,233,.82), rgba(228,228,233,0) 70%);
  animation: dh-poof .62s ease-out forwards;
}
.dh-poof.flash {
  width: 50px; height: 50px; animation-duration: .34s;
  background: radial-gradient(circle, rgba(255,251,224,.95), rgba(255,214,120,0) 68%);
}
@keyframes dh-poof {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.3); }
  28% { opacity: .9; }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.9); }
}

/* ── The rifle (aims at the duck, recoils on fire) ── */
.dh-gun-aim {
  position: absolute; left: 50%; bottom: -34px; width: 84px; height: 210px; margin-left: -42px;
  transform-origin: 50% 100%; z-index: 5; will-change: transform;
  transition: transform .09s linear;
  filter: drop-shadow(0 7px 9px rgba(0,0,0,.45));
}
.dh-gun { position: relative; width: 100%; height: 100%; }
.dh-gun svg { width: 100%; height: 100%; display: block; }
.dh-gun.recoil { animation: dh-recoil .32s cubic-bezier(.2,.8,.3,1); }
@keyframes dh-recoil { 0% { transform: translateY(0); } 22% { transform: translateY(14px) scaleY(.97); } 100% { transform: translateY(0); } }

.dh-muzzle {
  position: absolute; top: -10px; left: 50%; width: 46px; height: 46px; transform: translateX(-50%);
  background: radial-gradient(circle, #fffdf0 0%, #ffe27a 30%, #ff9a2e 55%, rgba(255,90,20,0) 72%);
  opacity: 0; pointer-events: none;
}
.dh-muzzle.on { animation: dh-flashburst .2s ease-out; }
@keyframes dh-flashburst { 0% { opacity: 0; transform: translateX(-50%) scale(.3); } 25% { opacity: 1; transform: translateX(-50%) scale(1.1); } 100% { opacity: 0; transform: translateX(-50%) scale(1.4); } }

.dh-smoke {
  position: absolute; top: -6px; left: 50%; width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle, rgba(220,220,225,.7), rgba(220,220,225,0) 70%);
  opacity: 0; pointer-events: none; transform: translateX(-50%);
}
.dh-smoke.on { animation: dh-smoke 1s ease-out; }
@keyframes dh-smoke {
  0% { opacity: 0; transform: translate(-50%,0) scale(.4); }
  25% { opacity: .8; }
  100% { opacity: 0; transform: translate(-50%,-46px) scale(2.2); }
}

/* odds line + history */
.dh-readout {
  position: absolute; top: 10px; left: 0; right: 0; z-index: 6; text-align: center;
  font-size: 12px; color: #06324a; text-shadow: 0 1px 2px rgba(255,255,255,.4);
}
.dh-readout b { color: #042536; font-weight: 800; }
.dh-stage .history-strip {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; border-top: none;
  padding: 7px 10px; justify-content: center; background: linear-gradient(0deg, rgba(10,50,30,.55), transparent);
}
.dh-pill { color: #fff; min-width: 22px; text-align: center; font-weight: 800; }
.dh-pill.win  { border-color: rgba(14,203,129,.6); color: #6effc0; box-shadow: 0 0 8px rgba(14,203,129,.45); }
.dh-pill.lose { border-color: rgba(246,70,93,.5); color: #ff8a98; opacity: .8; }

/* ── Controls ── */
.dh-controls {
  margin: 12px 14px calc(14px + env(safe-area-inset-bottom)); padding: 14px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--line); border-radius: var(--r);
  display: flex; flex-direction: column; gap: 12px;
}
.duckhunt .launch-btn {
  background: linear-gradient(180deg, #ff8a3d, #e2531f); color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: 0 6px 18px rgba(226,83,31,.34);
  transition: transform .07s ease, filter .15s ease, box-shadow .25s ease;
}
.duckhunt .launch-btn:not(:disabled) { animation: dh-glow 2.4s ease-in-out infinite; }
.duckhunt .launch-btn:disabled { background: var(--panel-2); color: var(--muted); box-shadow: none; animation: none; }
.duckhunt .launch-btn:active:not(:disabled) { transform: scale(.985); }
@keyframes dh-glow { 0%,100% { box-shadow: 0 6px 18px rgba(226,83,31,.3); } 50% { box-shadow: 0 8px 28px rgba(255,138,61,.55); } }

@media (prefers-reduced-motion: reduce) { .dh-cloud, .dh-wing { animation: none; } }

/* ── Mobile bottom nav ── */
@media (max-width: 879px) {
  .duckhunt { padding-bottom: 74px; }
  .duckhunt .mybets { display: none; }
  .duckhunt.view-plays .mybets { display: block; min-height: 60vh; }
  .duckhunt.view-plays .dh-stage,
  .duckhunt.view-plays .dh-controls { display: none; }
}
