/* ── Kouna fun layer: pig, drums, emoji, sound toggle ───────────────── */

/* Sound toggle in the floating tools column */
.kf-sound-btn { background: #2b2b2b; }
.kf-muted .kf-sound-btn { background: #6c757d; }

/* Drum button + emoji bar inside the countdown strip */
.kf-drum-btn {
  position: relative; z-index: 2;
  display: inline-flex; align-items: center; gap: .45rem;
  margin: .9rem auto 0; padding: .45rem 1rem;
  border: 1px solid rgba(245,166,35,.55); border-radius: 999px;
  background: rgba(0,0,0,.25); color: #fff; font-weight: 700; font-size: .85rem;
  cursor: pointer; transition: background .2s, transform .2s;
}
.kf-drum-btn:hover { background: rgba(245,166,35,.25); }
.kf-drum-btn.on { background: var(--color-gold, #f5a623); color: #1a1a1a; }
.kf-drum-btn.on .kf-drum-ico { animation: kfDrumHit .5s ease-in-out infinite alternate; }
.kf-drum-ico { display: inline-block; font-size: 1.15rem; }
@keyframes kfDrumHit { from { transform: rotate(-12deg) scale(1); } to { transform: rotate(10deg) scale(1.15); } }

.countdown-strip .container { text-align: center; }
.countdown-strip .container > .row { text-align: initial; }
.kf-emoji-bar {
  position: relative; z-index: 2;
  display: flex; justify-content: center; flex-wrap: wrap; gap: .35rem;
  margin-top: .6rem;
}
.kf-emoji {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.08);
  font-size: 1.35rem; line-height: 1; cursor: pointer;
  transition: transform .15s ease, background .15s;
}
.kf-emoji:hover { transform: translateY(-3px) scale(1.12); background: rgba(255,255,255,.18); }
.kf-emoji:active { transform: scale(.9); }

/* Countdown pulses on every drum beat */
#festival-countdown.kf-beat .countdown-number { animation: kfBeat .32s ease-out; }
#festival-countdown.kf-beat-big .countdown-number { animation: kfBeatBig .5s ease-out; }
@keyframes kfBeat { 0% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes kfBeatBig { 0% { transform: scale(1.28); text-shadow: 0 0 30px rgba(245,166,35,.9); } 100% { transform: scale(1); } }

/* Emoji burst */
.kf-burst {
  position: fixed; z-index: 2000; pointer-events: none;
  font-size: 1.6rem; line-height: 1;
  transform: translate(-50%, -50%);
  animation: kfBurst 1.05s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes kfBurst {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(1.15); }
}

/* ── The pig ───────────────────────────────────────────────────────── */
.kf-pig {
  position: fixed !important; left: 0; bottom: max(6px, env(safe-area-inset-bottom, 0px));
  z-index: 1035; width: 84px; height: 63px;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  will-change: transform;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.18));
}
.kf-pig-body { width: 100%; height: 100%; transition: transform .25s; }
.kf-pig.kf-left .kf-pig-body { transform: scaleX(-1); }
.kf-pig svg { width: 100%; height: 100%; display: block; overflow: visible; }
.kf-pig:focus-visible { outline: 3px solid var(--color-gold, #f5a623); outline-offset: 4px; border-radius: 12px; }

.kf-pig .kf-leg { transform-box: fill-box; transform-origin: 50% 0; }
.kf-pig:not(.kf-idle) .kf-leg-a { animation: kfLeg .36s ease-in-out infinite alternate; }
.kf-pig:not(.kf-idle) .kf-leg-b { animation: kfLeg .36s ease-in-out infinite alternate-reverse; }
.kf-pig:not(.kf-idle) svg { animation: kfBob .36s ease-in-out infinite alternate; }
@keyframes kfLeg { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
@keyframes kfBob { from { transform: translateY(0); } to { transform: translateY(-2px); } }

.kf-pig .kf-tail { transform-box: fill-box; transform-origin: 100% 60%; animation: kfTail 1.2s ease-in-out infinite; }
@keyframes kfTail { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-18deg); } }

.kf-pig .kf-head { transform-box: fill-box; transform-origin: 30% 80%; }
.kf-pig.kf-idle .kf-head { animation: kfSniff 1.4s ease-in-out infinite; }
@keyframes kfSniff { 0%,100% { transform: rotate(0); } 30% { transform: rotate(8deg) translateY(2px); } 60% { transform: rotate(4deg) translateY(1px); } }

.kf-pig .kf-eye { transform-box: fill-box; transform-origin: center; animation: kfBlink 4s infinite; }
@keyframes kfBlink { 0%,46%,50%,100% { transform: scaleY(1); } 48% { transform: scaleY(.1); } }

.kf-pig.kf-jump .kf-pig-body { animation: kfJump .5s cubic-bezier(.3,1.6,.5,1); }
.kf-pig.kf-left.kf-jump .kf-pig-body { animation: kfJumpL .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes kfJump  { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-26px) rotate(-6deg); } }
@keyframes kfJumpL { 0%,100% { transform: scaleX(-1) translateY(0); } 40% { transform: scaleX(-1) translateY(-26px) rotate(-6deg); } }

.kf-pig-bubble {
  position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, 6px) scale(.8);
  white-space: nowrap; background: #fff; color: #333; font-size: .78rem; font-weight: 700;
  padding: .3rem .6rem; border-radius: 12px; box-shadow: 0 6px 16px rgba(0,0,0,.18);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.kf-pig-bubble::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; }
.kf-pig.kf-talk .kf-pig-bubble { opacity: 1; transform: translate(-50%, -4px) scale(1); }

.kf-pig-close {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff;
  font-size: 14px; line-height: 22px; padding: 0; text-align: center;
  opacity: 0; transition: opacity .2s; cursor: pointer;
}
.kf-pig:hover .kf-pig-close, .kf-pig:focus-within .kf-pig-close { opacity: 1; }
@media (hover: none) { .kf-pig-close { opacity: .75; width: 20px; height: 20px; line-height: 20px; } }

@media (max-width: 767px) {
  .kf-pig { width: 64px; height: 48px; }
  .kf-emoji { width: 40px; height: 40px; font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .kf-pig *, .kf-drum-ico, #festival-countdown .countdown-number { animation: none !important; }
}

/* Drums notice ("playing – turn off" / "tap to start") */
.kf-toast {
  position: fixed !important; z-index: 1045;
  left: 50%; bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: .6rem; flex-wrap: nowrap;
  max-width: calc(100vw - 32px); padding: .5rem .55rem .5rem .9rem;
  background: rgba(20,20,20,.92); color: #fff; border-radius: 999px;
  font-size: .82rem; font-weight: 600; box-shadow: 0 10px 26px rgba(0,0,0,.3);
  transition: opacity .25s, transform .25s;
}
.kf-toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.kf-toast-off {
  flex: 0 0 auto; border: 0; border-radius: 999px; padding: .35rem .8rem; min-height: 32px;
  background: var(--color-gold, #f5a623); color: #1a1a1a; font-weight: 800; font-size: .78rem; cursor: pointer;
}
@media (max-width: 480px) {
  .kf-toast { font-size: .76rem; left: 12px; right: 72px; transform: translateY(20px); max-width: none; justify-content: space-between; }
  .kf-toast.show { transform: translateY(0); }
}
