/* Module 'znaczki-dzielenie' — stamp game division with baby dragons (L1–L5) and packets of money (L6).
 * Every selector starts with .mod-znaczki-dzielenie (the module root).
 */

/* ---------- task band ---------- */

.mod-znaczki-dzielenie .zd-op {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  white-space: nowrap;
}
.mod-znaczki-dzielenie .zd-sign {
  font-family: var(--font-num);
  font-size: 52px;
  font-weight: 700;
  color: var(--ink-soft);
}
.mod-znaczki-dzielenie .zd-rsign {
  font-family: var(--font);
  font-size: 40px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-left: 4px;
}
.mod-znaczki-dzielenie .zd-rem {
  font-family: var(--font-num);
  font-size: 56px;
  font-weight: 700;
  color: var(--accent);
}
.mod-znaczki-dzielenie .zd-result {
  padding: 0 10px;
  border-radius: 14px;
  background: var(--gold-soft);
  box-shadow: 0 0 0 4px var(--gold);
  animation: zd-pop 0.45s ease;
}
.mod-znaczki-dzielenie .zd-money .zd-mval {
  font-family: var(--font-num);
  font-size: 50px;
  font-weight: 700;
  color: var(--ink);
}
.mod-znaczki-dzielenie .zd-money .zd-mval.zd-result {
  padding: 0 12px;
}
.mod-znaczki-dzielenie .zd-money .zd-unit {
  margin-left: -6px;
}
/* "zł" inside a --font-num amount (band, packet tag, count badge): Arial Rounded has no "ł" (§1.4 Fonty) */
.mod-znaczki-dzielenie .zd-zl {
  font-family: var(--font);
}
/* L6 answer boxes in the band: the typed number appears here */
.mod-znaczki-dzielenie .zd-ans {
  min-width: 84px;
  height: 76px;
  padding: 0 10px;
  border-radius: 16px;
  border: 4px dashed #cdbf9f;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-size: 50px;
  font-weight: 700;
  color: var(--ink);
}
.mod-znaczki-dzielenie .zd-ans.is-active {
  border: 4px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(242, 183, 5, 0.3), 0 0 16px rgba(242, 183, 5, 0.45);
  animation: zd-win 1.4s ease-in-out infinite;
}
.mod-znaczki-dzielenie .zd-ans.is-filled {
  border-style: solid;
  border-color: var(--gold-deep);
}
.mod-znaczki-dzielenie .zd-ans.is-result {
  background: var(--gold-soft);
  border: 4px solid var(--gold);
  animation: none;
}
.mod-znaczki-dzielenie .zd-ans-r {
  color: var(--accent);
}

/* ---------- baby dragons: the category being written, skipped windows, help marks ---------- */

/* (the engine's share glow is switched by the module: share({glow: false}) + sh.setGlow; the amber marks of a wrong
 * digit on the quotient window and the tray columns are the engine's help outlines: sh.highlight(…, 'amber')) */
.mod-znaczki-dzielenie .mata-col.zd-col-write {
  background: rgba(242, 183, 5, 0.07);
}
.mod-znaczki-dzielenie .mata-baby-col.zd-stripe-on {
  box-shadow: inset 0 0 0 3px var(--gold), 0 0 10px rgba(242, 183, 5, 0.45);
  background: rgba(255, 241, 191, 0.85);
}
/* the window she writes next pulses (an amber mark of a wrong digit replaces the pulse) */
.mod-znaczki-dzielenie .mata-qwin.zd-qwin-on:not(.is-editing):not(.hl-amber),
.mod-znaczki-dzielenie .zd-remwin.zd-qwin-on:not(.is-editing):not(.zd-amber) {
  animation: zd-win 1.4s ease-in-out infinite;
}
.mod-znaczki-dzielenie .mata-qwin.zd-qskip {
  opacity: 0.32;
  border-style: dashed;
  box-shadow: none;
}
/* the remainder window is the module's own: its amber mark looks like the engine's (.mata-window.hl-amber) */
.mod-znaczki-dzielenie .zd-remwin.zd-amber {
  outline: 5px solid var(--err);
  outline-offset: 3px;
}
.mod-znaczki-dzielenie .mata.zd-done .mata-qwin.is-filled,
.mod-znaczki-dzielenie .mata.zd-done ~ .zd-remwin.is-filled {
  background: var(--gold-soft);
  box-shadow: 0 0 0 4px var(--gold), 0 0 14px rgba(242, 183, 5, 0.55);
}
/* ZERO_PLACEHOLDER rung 2: a pale "0" has fallen into the empty window (until she types) */
.mod-znaczki-dzielenie .mata-qwin.zd-ghost0:not(.is-editing) .mata-window-digit:empty::after {
  content: '0';
  opacity: 0.3;
  display: inline-block;
  animation: zd-fall 0.6s ease;
}
.mod-znaczki-dzielenie .zd-nudge {
  animation: zd-nudge 1.2s ease-in-out;
}

/* ---------- remainder: the cauldron is a target, its window sits under it ---------- */

.mod-znaczki-dzielenie .zd-cauldron {
  position: absolute;
  /* above the stamps (.mata-layer, 2), BELOW the engine's chips and keypad (.mata-ui, 5) */
  z-index: 4;
  border: 0;
  border-radius: 22px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mod-znaczki-dzielenie .zd-cauldron:active {
  background: rgba(123, 92, 214, 0.08);
}
/* the together task dims inactive targets; the cauldron button is transparent, so its picture follows it
 * (zd-rem-dim mirrors the button's demo-dim — set by the module, no :has() for Safari 14 – 15.3) */
.mod-znaczki-dzielenie.demo-together .mata-rem.zd-rem-dim {
  opacity: 0.35;
  filter: grayscale(0.6);
  transition: opacity 0.25s ease, filter 0.25s ease;
}
.mod-znaczki-dzielenie .zd-cauldron.zd-amber {
  box-shadow: inset 0 0 0 5px var(--err), 0 0 14px rgba(240, 140, 46, 0.45);
}
.mod-znaczki-dzielenie .zd-remwin {
  z-index: 4;
}
.mod-znaczki-dzielenie .zd-ghost {
  position: absolute;
  z-index: 7;
  padding: 3px;
  border-radius: 10px;
  border: 3px dashed var(--err);
  background: rgba(255, 233, 212, 0.75);
  opacity: 0.85;
  pointer-events: none;
  animation: zd-ghost 1.4s ease-in-out infinite;
}
.mod-znaczki-dzielenie .zd-ghost .mat-stamp {
  opacity: 0.55;
}

/* UNFAIR_SHARE: the refusing baby dragon says it itself (a small bubble at its head) */
.mod-znaczki-dzielenie .zd-babysay {
  position: absolute;
  /* above the stamps, below the engine's chips and keypad (.mata-ui, 5): the keypad keys stay visible */
  z-index: 4;
  box-sizing: border-box;
  padding: 10px 14px;
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 0 0 0 3px var(--accent), 0 6px 14px rgba(42, 34, 56, 0.22);
  font-family: var(--font);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  color: var(--ink);
  pointer-events: none;
  animation: pop-in 0.18s ease;
}
.mod-znaczki-dzielenie .zd-babysay::before {
  /* the tail points up to the baby's head */
  content: '';
  position: absolute;
  left: calc(var(--tail, 50%) - 11px);
  top: -11px;
  width: 22px;
  height: 22px;
  background: #fff;
  box-shadow: inset 3px 3px 0 var(--accent);
  transform: rotate(45deg);
  border-radius: 4px 0 0 0;
}

/* ---------- module keypad (remainder window, L6 answers) ---------- */

.mod-znaczki-dzielenie .zd-keypad {
  position: absolute;
  width: 340px;
  height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 26px;
  background: var(--panel);
  box-shadow: inset 0 0 0 3px var(--line), 0 10px 0 rgba(42, 34, 56, 0.1), 0 16px 34px rgba(42, 34, 56, 0.28);
  z-index: 10;
  animation: pop-in 0.16s ease;
}

/* ---------- counting badge, sparkle, shield ---------- */

.mod-znaczki-dzielenie .zd-badge {
  position: absolute;
  box-sizing: border-box;
  min-width: 52px;
  padding: 0 8px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 26px;
  white-space: nowrap;
  box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(42, 34, 56, 0.3);
  pointer-events: none;
  z-index: 12;
}
.mod-znaczki-dzielenie .zd-pack.is-counted,
.mod-znaczki-dzielenie .zd-pack.is-pulse {
  filter: drop-shadow(0 0 10px rgba(242, 183, 5, 0.95));
}
.mod-znaczki-dzielenie .zd-pack.is-pulse {
  animation: zd-packpulse 0.42s ease;
}
.mod-znaczki-dzielenie .zd-shield {
  position: absolute;
  inset: 0;
  z-index: 65;
}
.mod-znaczki-dzielenie .zd-sparkle {
  position: absolute;
  width: 180px;
  height: 120px;
  pointer-events: none;
  z-index: 30;
}
.mod-znaczki-dzielenie .zd-sparkle i {
  position: absolute;
  left: 82px;
  top: 52px;
  width: 16px;
  height: 16px;
  background: var(--gold);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: zd-spark 0.9s ease-out forwards;
}

/* ---------- action bar: "Sprawdź mnożeniem", "Rozdaj rundę" ---------- */

.mod-znaczki-dzielenie .zd-prove {
  min-height: 80px;
  font-size: 26px;
  gap: 10px;
}
.mod-znaczki-dzielenie .zd-prove .btn-icon {
  width: 34px;
  height: 34px;
}
.mod-znaczki-dzielenie .action-bar .btn-main .zd-dealico {
  width: 40px;
  height: 40px;
}

/* ---------- L6: packets on the right, the next free place is "Nowa paczka" ---------- */

.mod-znaczki-dzielenie .zd-packs {
  position: absolute;
  left: 420px;
  top: 114px;
  width: 612px;
  height: 474px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.7), rgba(251, 243, 224, 0.7));
  box-shadow: inset 0 0 0 3px #e7d8b4;
  z-index: 3;
}
.mod-znaczki-dzielenie .zd-packs.zd-amber {
  box-shadow: inset 0 0 0 5px var(--err), 0 0 14px rgba(240, 140, 46, 0.4);
}
.mod-znaczki-dzielenie .zd-newpack {
  position: absolute;
  width: 108px;
  height: 216px;
  padding: 10px 4px;
  border: 4px dashed var(--gold-deep);
  border-radius: 18px;
  background: rgba(255, 246, 214, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}
.mod-znaczki-dzielenie .zd-newpack:active {
  transform: translateY(3px);
}
.mod-znaczki-dzielenie .zd-newpack-label {
  text-align: center;
}
.mod-znaczki-dzielenie .zd-pack {
  position: absolute;
  width: 108px;
  height: 216px;
  border-radius: 10px 10px 16px 16px;
  background: linear-gradient(180deg, #ecd3a4 0%, #e2bf86 60%, #d6ae70 100%);
  box-shadow: inset 0 0 0 3px #b98d4f, 0 4px 0 rgba(120, 85, 30, 0.25), 0 8px 14px rgba(42, 34, 56, 0.12);
  animation: zd-pop 0.35s ease;
}
.mod-znaczki-dzielenie .zd-pack-flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 22px;
  border-radius: 10px 10px 0 0;
  background: repeating-linear-gradient(90deg, #c99d5e 0 9px, #d9b57c 9px 18px);
  box-shadow: inset 0 -3px 0 rgba(120, 85, 30, 0.3);
}
.mod-znaczki-dzielenie .zd-pack-tag {
  position: absolute;
  left: 50%;
  top: 30px;
  transform: translateX(-50%);
  padding: 2px 10px;
  border-radius: 10px;
  background: #fffaf0;
  box-shadow: inset 0 0 0 2px #b98d4f;
  font-family: var(--font-num);
  font-size: 24px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink);
}
.mod-znaczki-dzielenie .zd-pack-in {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 70px;
  bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: center;
  gap: 3px;
}
.mod-znaczki-dzielenie .zd-pack-in > * {
  animation: zd-drop 0.3s ease 0.15s both;
}
.mod-znaczki-dzielenie .zd-pk-note {
  flex: none;
}
.mod-znaczki-dzielenie .zd-pk-coin {
  flex: none;
}
.mod-znaczki-dzielenie .zd-pack.is-current {
  box-shadow: inset 0 0 0 3px #b98d4f, 0 0 0 5px var(--gold), 0 0 16px rgba(242, 183, 5, 0.55);
}
.mod-znaczki-dzielenie .zd-pack.is-full .zd-pack-flap {
  height: 30px;
  background: repeating-linear-gradient(90deg, #b88a4a 0 9px, #c99d5e 9px 18px);
}
.mod-znaczki-dzielenie .zd-pack.is-full::after {
  /* the gold string tied round a full packet */
  content: '';
  position: absolute;
  left: -3px;
  right: -3px;
  top: 58px;
  height: 7px;
  border-radius: 4px;
  background: var(--gold);
  box-shadow: 0 1px 0 var(--gold-deep);
}
.mod-znaczki-dzielenie .zd-pack-ghost {
  background: rgba(255, 233, 212, 0.55);
  box-shadow: none;
  border: 4px dashed var(--err);
  animation: zd-ghost 1.4s ease-in-out infinite;
  /* it shows the "one more packet" on the place of "Nowa paczka": taps must still reach that button */
  pointer-events: none;
}

/* ---------- animations ---------- */

@keyframes zd-win {
  0%, 100% { box-shadow: 0 0 0 4px rgba(242, 183, 5, 0.35); }
  50% { box-shadow: 0 0 0 7px var(--gold), 0 0 18px rgba(242, 183, 5, 0.6); }
}
@keyframes zd-nudge {
  0%, 100% { filter: none; }
  25%, 75% { filter: drop-shadow(0 0 12px rgba(242, 183, 5, 1)); }
}
@keyframes zd-fall {
  from { opacity: 0; transform: translateY(-40px); }
  to { opacity: 0.3; transform: none; }
}
@keyframes zd-ghost {
  50% { opacity: 0.45; }
}
@keyframes zd-pop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes zd-drop {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: none; }
}
@keyframes zd-packpulse {
  40% { translate: 0 -10px; }
}
@keyframes zd-spark-fade {
  0% { opacity: 1; transform: rotate(var(--a)) translateY(calc(-0.6 * var(--d))); }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(-0.6 * var(--d))); }
}
@keyframes zd-spark {
  0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(0.6); }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(-1 * var(--d))) scale(1.1); }
}

/* parent setting "less motion" / prefers-reduced-motion: static glows instead of pulsing, fades instead of moves */
.mod-znaczki-dzielenie.zd-calm .zd-qwin-on,
.mod-znaczki-dzielenie.zd-calm .zd-ans.is-active,
.mod-znaczki-dzielenie.zd-calm .zd-ghost,
.mod-znaczki-dzielenie.zd-calm .zd-pack-ghost,
.mod-znaczki-dzielenie.zd-calm .zd-babysay {
  animation: none;
}
.mod-znaczki-dzielenie.zd-calm .zd-sparkle i {
  animation-name: zd-spark-fade;
}
.mod-znaczki-dzielenie.zd-calm .mata-qwin.zd-qwin-on:not(.hl-amber),
.mod-znaczki-dzielenie.zd-calm .zd-remwin.zd-qwin-on:not(.zd-amber) {
  box-shadow: 0 0 0 6px var(--gold), 0 0 16px rgba(242, 183, 5, 0.55);
}
/* (the pulse rule above has :not() parts: the same selectors here, later, to stop it) */
.mod-znaczki-dzielenie.zd-calm .mata-qwin.zd-qwin-on:not(.is-editing):not(.hl-amber),
.mod-znaczki-dzielenie.zd-calm .zd-remwin.zd-qwin-on:not(.is-editing):not(.zd-amber) {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .mod-znaczki-dzielenie .zd-qwin-on,
  .mod-znaczki-dzielenie .zd-ans.is-active,
  .mod-znaczki-dzielenie .zd-ghost,
  .mod-znaczki-dzielenie .zd-pack-ghost,
  .mod-znaczki-dzielenie .zd-pack,
  .mod-znaczki-dzielenie .zd-pack-in > *,
  .mod-znaczki-dzielenie .zd-babysay {
    animation: none;
  }
  .mod-znaczki-dzielenie .zd-sparkle i {
    animation-name: zd-spark-fade;
  }
  .mod-znaczki-dzielenie .mata-qwin.zd-qwin-on:not(.hl-amber),
  .mod-znaczki-dzielenie .zd-remwin.zd-qwin-on:not(.zd-amber) {
    box-shadow: 0 0 0 6px var(--gold), 0 0 16px rgba(242, 183, 5, 0.55);
  }
  .mod-znaczki-dzielenie .mata-qwin.zd-qwin-on:not(.is-editing):not(.hl-amber),
  .mod-znaczki-dzielenie .zd-remwin.zd-qwin-on:not(.is-editing):not(.zd-amber) {
    animation: none;
  }
}
