/* Module 'zaplac' (Sklepik smoka) — every selector starts with .mod-zaplac.
 * Layout (module area 1040 x 712): task band 0–110 (awning, item + price tag, one line, Pani Sowa, ear),
 * lada with the price strip 118–458, kasetka 464–588, action bar 592–712. */

/* soft shop wallpaper behind the material zone */
.mod-zaplac::before {
  content: '';
  position: absolute;
  left: 0;
  top: 110px;
  width: 1040px;
  height: 482px;
  background: repeating-linear-gradient(90deg, rgba(232, 144, 42, 0.05) 0 44px, rgba(232, 144, 42, 0) 44px 88px);
  pointer-events: none;
}

/* ---------- task band = the shop window ---------- */

.mod-zaplac .task-band {
  padding-top: 16px;
  gap: 12px;
  background: linear-gradient(180deg, #fff7e6 0%, var(--panel-2) 100%);
}
.mod-zaplac .task-band::before {
  /* striped awning with a scalloped edge */
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 1040px;
  height: 20px;
  background:
    radial-gradient(circle at 17px 0, #e8902a 0 11px, rgba(232, 144, 42, 0) 11.5px) 0 8px / 68px 12px repeat-x,
    radial-gradient(circle at 17px 0, #fff3d6 0 11px, rgba(255, 243, 214, 0) 11.5px) 34px 8px / 68px 12px repeat-x,
    repeating-linear-gradient(90deg, #e8902a 0 34px, #fff3d6 34px 68px) 0 0 / 100% 8px no-repeat;
  filter: drop-shadow(0 2px 0 rgba(154, 84, 16, 0.25));
  pointer-events: none;
}
.mod-zaplac .task-band .task-content {
  gap: 14px;
  font-family: var(--font);
  font-size: 30px;
  height: 100%;
}
.mod-zaplac .task-band .task-ear {
  margin-top: 4px;
}
.mod-zaplac .zp-win {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
}
.mod-zaplac .zp-item {
  width: 84px;
  height: 84px;
  flex: none;
  border-radius: 22px;
  background: radial-gradient(circle at 50% 42%, #fffdf7 0 52%, #f6e7c8 100%);
  box-shadow: inset 0 0 0 3px #ecd7ae, 0 3px 0 rgba(42, 34, 56, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.3s ease;
}
.mod-zaplac .zp-item .zp-art {
  width: 72px;
  height: 72px;
}
.mod-zaplac .zp-item.is-sold {
  box-shadow: inset 0 0 0 4px var(--gold), 0 0 0 6px rgba(242, 183, 5, 0.28), 0 3px 0 rgba(42, 34, 56, 0.12);
  animation: zp-sold 0.6s ease;
}
@keyframes zp-sold {
  0% { transform: scale(1); }
  40% { transform: scale(1.12) rotate(-3deg); }
  100% { transform: scale(1); }
}
.mod-zaplac .zp-tag {
  position: relative;
  z-index: 1;
  margin-left: -12px;
  transform: rotate(-5deg);
  transform-origin: 0 50%;
}
.mod-zaplac.zp-L5 .zp-tag .money-tag-body {
  min-height: 66px;
}
.mod-zaplac .zp-line {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.12;
  color: var(--ink);
  white-space: nowrap;
}
/* Pani Sowa's speech bubble (tail points right, to the owl) */
.mod-zaplac .zp-line.is-owl {
  flex: 0 1 auto;
  margin-left: auto;
  padding: 8px 20px;
  border-radius: 22px;
  border: 3px solid #e8c79a;
  background: #fffdf7;
  color: #6d4429;
  font-size: 27px;
  white-space: normal;
  box-shadow: var(--shadow-sm);
}
.mod-zaplac .zp-line.is-owl::after {
  content: '';
  position: absolute;
  right: -15px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  background: #fffdf7;
  border-right: 3px solid #e8c79a;
  border-top: 3px solid #e8c79a;
  transform: rotate(45deg);
}
.mod-zaplac .zp-line.is-hint .money-gsq {
  flex: none;
}
.mod-zaplac .zp-eq {
  white-space: nowrap;
}

/* ---------- Pani Sowa ---------- */

.mod-zaplac .zp-owl {
  flex: none;
  width: 84px;
  height: 94px;
  align-self: flex-end;
  margin-left: auto;
  margin-bottom: -2px;
}
.mod-zaplac .zp-line.is-owl + .zp-owl {
  margin-left: 6px;
}
.mod-zaplac .zp-owl-svg {
  width: 84px;
  height: 94px;
  display: block;
  transform-origin: 50% 100%;
}
.mod-zaplac .zp-owl.is-hop {
  animation: zp-hop 0.6s ease;
}
.mod-zaplac .zp-owl.is-talking .zp-owl-svg {
  animation: zp-talk 0.9s ease-in-out infinite;
}
.mod-zaplac .zp-lid {
  transform-box: fill-box;
  transform-origin: 50% 0;
  transform: scaleY(0);
  animation: zp-blink 6.5s infinite;
}
@keyframes zp-hop {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-12px); }
  60% { transform: translateY(0); }
  78% { transform: translateY(-4px); }
}
@keyframes zp-talk {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}
@keyframes zp-blink {
  0%, 93%, 100% { transform: scaleY(0); }
  96% { transform: scaleY(1); }
}

/* ---------- lada, kasetka ---------- */

.mod-zaplac .zp-counter {
  position: absolute;
  left: 20px;
  top: 118px;
}
.mod-zaplac .zp-drawer {
  position: absolute;
  left: 20px;
  top: 464px;
  transition: opacity 0.3s ease;
}
.mod-zaplac .zp-drawer.zp-under {
  opacity: 0;
  pointer-events: none;
}
/* rung 2 on L1: the empty contours are what is missing */
.mod-zaplac .zp-counter.zp-r2 .money-outline:not(.is-filled) .money-outline-shape {
  border-color: var(--err);
  color: var(--err);
  background: rgba(255, 233, 212, 0.6);
  animation: zp-ghost 1.4s ease-in-out infinite;
}
@keyframes zp-ghost {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* label on the lada: "Twój sposób: 4" (L4), badge 1 / 2 (L6) */
.mod-zaplac .zp-chip {
  position: absolute;
  left: 40px;
  top: 268px;
  z-index: 3;
  display: none;
  align-items: center;
  height: 42px;
  padding: 0 18px;
  border-radius: 21px;
  border: 3px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
}
.mod-zaplac.zp-L5 .zp-chip {
  top: 290px;
}
.mod-zaplac .zp-chip.is-on {
  display: flex;
}
.mod-zaplac .zp-chip.is-yours {
  border-color: var(--gold);
  background: #fff7e0;
}
.mod-zaplac .zp-chip.is-badge,
.mod-zaplac .zp-badge {
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 3px solid #5b3fb8;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-num);
  font-size: 26px;
}

/* ---------- L6: the first way ---------- */

.mod-zaplac .zp-ways {
  position: absolute;
  left: 660px;
  top: 118px;
  width: 360px;
  height: 340px;
  box-sizing: border-box;
  padding-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  border-radius: 26px;
  border: 3px dashed var(--line);
  background: rgba(255, 253, 247, 0.65);
  transition: border-color 0.3s ease;
}
.mod-zaplac .zp-ways.is-done {
  border-style: solid;
  border-color: var(--gold);
}
.mod-zaplac .zp-ways-head {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink-soft);
}
.mod-zaplac .zp-badge {
  display: flex;
  align-items: center;
  box-sizing: border-box;
}
.mod-zaplac .zp-way1 {
  gap: 6px 8px;
}
.mod-zaplac .zp-hidden {
  visibility: hidden;
}

/* ---------- L4: the dragon's way ---------- */

.mod-zaplac .zp-mine {
  position: absolute;
  left: 20px;
  top: 464px;
  width: 1000px;
  height: 124px;
  box-sizing: border-box;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px 0 14px;
  border-radius: 24px;
  background: linear-gradient(180deg, #3a2f5c 0%, #2b2540 100%);
  box-shadow: inset 0 0 0 4px #5b4a8c, 0 6px 0 rgba(20, 14, 40, 0.35), 0 12px 22px rgba(42, 34, 56, 0.25);
  animation: zp-rise 0.45s ease;
}
.mod-zaplac .zp-mine.is-equal {
  box-shadow: inset 0 0 0 4px var(--gold), 0 0 0 6px rgba(242, 183, 5, 0.3), 0 6px 0 rgba(20, 14, 40, 0.35);
}
.mod-zaplac .zp-mine-who {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mod-zaplac .zp-mine-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #f3eaff;
}
.mod-zaplac .zp-mine-lab {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
}
.mod-zaplac .zp-mine-num {
  font-family: var(--font-num);
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  color: var(--gold);
}
.mod-zaplac .zp-mine-row {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
}
.mod-zaplac .zp-mine-row .mat {
  flex: none;
}
.mod-zaplac .zp-drop {
  animation: zp-drop 0.35s ease;
}
.mod-zaplac .zp-try {
  flex: none;
  min-width: 210px;
  height: 96px;
}
@keyframes zp-rise {
  0% { transform: translateY(30px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes zp-drop {
  0% { transform: translateY(-26px) scale(0.7); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------- success sparkle ---------- */

.mod-zaplac .zp-sparks {
  position: absolute;
  z-index: 6;
  pointer-events: none;
}
.mod-zaplac .zp-spark {
  position: absolute;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  background: var(--gold);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: zp-spark 1.1s ease-out both;
}
@keyframes zp-spark {
  0% { transform: scale(0) rotate(0deg); opacity: 0; }
  30% { transform: scale(1.15) rotate(30deg); opacity: 1; }
  100% { transform: scale(0.2) rotate(90deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .mod-zaplac .zp-lid,
  .mod-zaplac .zp-owl.is-hop,
  .mod-zaplac .zp-owl.is-talking .zp-owl-svg,
  .mod-zaplac .zp-item.is-sold,
  .mod-zaplac .zp-drop,
  .mod-zaplac .zp-mine {
    animation: none;
  }
  .mod-zaplac .zp-spark {
    animation: zp-fade 0.6s ease both;
  }
}
@keyframes zp-fade {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* presentations: "Dalej / Pomiń" stands in the middle of the action bar (skipPos), so Płacę stays visible and the
   dragon can show pressing it (App.demo hides the main button while its button is shown) */
.mod-zaplac.demo-has-skip .action-bar .btn-main {
  visibility: visible;
}
/* ... and it looks secondary, so the yellow Płacę is the one the dragon presses */
.mod-zaplac .demo-skip {
  background: var(--panel);
  border: 3px solid var(--line);
}
