/* Smocza Matematyka — module 'lancuchy' (Smocze łańcuchy). All selectors start with .mod-lancuchy.
 * Layers inside the 1040 x 712 module area: scene (rug, cabinet, chain, tickets) < side (arrow box / keypad)
 * < task band, action bar < flights (dragon, flying tickets) < demo shield (lesson3.css).
 */

.mod-lancuchy .lc-scene,
.mod-lancuchy .lc-side,
.mod-lancuchy .lc-fly {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.mod-lancuchy .lc-scene {
  z-index: 1;
}
.mod-lancuchy .lc-side {
  z-index: 2;
}
.mod-lancuchy .task-band,
.mod-lancuchy .action-bar {
  z-index: 3;
}
.mod-lancuchy .lc-fly {
  z-index: 40;
}
.mod-lancuchy .lc-scene > *,
.mod-lancuchy .lc-side > *,
.mod-lancuchy .lc-fly > * {
  position: absolute;
}

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

.mod-lancuchy .lc-band {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}
.mod-lancuchy .lc-band-bar {
  flex: none;
}
.mod-lancuchy .lc-band-text {
  font-family: var(--font);
  font-size: 34px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

/* ---------- the work rug and the cabinet ---------- */

.mod-lancuchy .lc-rug {
  border-radius: 30px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, var(--panel-2) 0%, var(--bg-2) 100%);
  border: 3px solid var(--line);
  box-shadow: inset 0 2px 12px rgba(120, 90, 30, 0.08), 0 2px 0 rgba(255, 255, 255, 0.6);
}
.mod-lancuchy .lc-cab {
  border-radius: 24px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 0 34px, rgba(120, 76, 24, 0.06) 34px 36px),
    linear-gradient(180deg, #e9cd98 0%, #dcb676 100%);
  border: 4px solid #c39557;
  box-shadow: inset 0 0 0 4px rgba(255, 240, 210, 0.35), inset 0 6px 14px rgba(90, 55, 10, 0.18), var(--shadow-sm);
}
.mod-lancuchy .lc-square {
  transition: filter 0.4s ease;
}
.mod-lancuchy .lc-square.is-fit,
.mod-lancuchy .lc-cube.is-fit {
  filter: drop-shadow(0 0 10px rgba(242, 183, 5, 0.95)) drop-shadow(0 0 3px rgba(242, 183, 5, 1));
}
.mod-lancuchy .lc-bar.is-folded {
  filter: drop-shadow(0 0 6px rgba(242, 183, 5, 0.8));
}

/* ---------- chain bars and beads ---------- */

.mod-lancuchy .lc-bar {
  border-radius: 12px;
  transition: outline-color 0.2s ease;
}
.mod-lancuchy .lc-bar circle {
  transform-box: fill-box;
  transform-origin: center;
}
/* rung 1: the place of the discrepancy (the segment) in amber */
.mod-lancuchy .lc-bar.is-err {
  outline: 5px solid var(--err);
  outline-offset: 6px;
  background: var(--err-soft);
}
/* rung 0: "count this segment now" */
.mod-lancuchy .lc-bar.is-hint {
  animation: lc-glow 0.6s ease-in-out 2;
}
/* counted by touch / together: a white ring around the bead */
.mod-lancuchy .lc-bar circle.is-counted {
  stroke: var(--lc-mark, #ffffff);
  stroke-width: 3.5px;
  stroke-opacity: 1;
  filter: drop-shadow(0 0 1.5px var(--lc-halo, rgba(42, 34, 56, 0.9)));
}
/* counting back: the bead is taken away */
.mod-lancuchy .lc-bar circle.is-taken {
  opacity: 0.22;
}
/* rung 2: the last bead is hers to count */
/* (a gold ring — clearly different from the dark / white ring of the beads already counted) */
.mod-lancuchy .lc-bar circle.is-ask {
  stroke: var(--gold-deep);
  filter: drop-shadow(0 0 4px var(--gold)) drop-shadow(0 0 2px var(--gold));
  stroke-width: 4.5px;
  stroke-opacity: 1;
  animation: lc-ask 1s ease-in-out infinite;
}

/* ---------- arrow tickets ---------- */

.mod-lancuchy .lc-ticket {
  pointer-events: none;
}
.mod-lancuchy .lc-ticket > svg {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  filter: drop-shadow(0 2px 1px rgba(42, 34, 56, 0.22));
}
.mod-lancuchy .lc-ticket-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0.01em;
}
.mod-lancuchy .lc-slot .lc-ticket-body {
  fill: rgba(255, 255, 255, 0.5);
  stroke: #bcae8c;
  stroke-width: 2.5px;
  stroke-dasharray: 6 5;
}
.mod-lancuchy .lc-slot > svg {
  filter: none;
}
.mod-lancuchy .lc-slot.is-filled {
  visibility: hidden;
}
/* the place of the next arrow glows */
.mod-lancuchy .lc-slot.is-current .lc-ticket-body {
  fill: var(--gold-soft);
  stroke: var(--gold-deep);
  stroke-dasharray: none;
  stroke-width: 3px;
}
.mod-lancuchy .lc-slot.is-current {
  animation: lc-glow 1.3s ease-in-out infinite;
}
/* rung 1: the neighbour arrow to count from */
.mod-lancuchy .lc-tag.is-pulse {
  animation: lc-beat 0.9s ease-in-out infinite;
}
.mod-lancuchy .lc-tag.is-new > svg {
  filter: drop-shadow(0 0 7px rgba(242, 183, 5, 0.95));
}
.mod-lancuchy .lc-tag.fx-ok {
  outline: none !important;
  background: transparent;
}
.mod-lancuchy .lc-tag.fx-ok > svg {
  filter: drop-shadow(0 0 8px rgba(242, 183, 5, 1));
}

/* ---------- leaves (L5) ---------- */

.mod-lancuchy .lc-leaf {
  pointer-events: none;
  transform: rotate(-6deg);
  filter: drop-shadow(0 3px 2px rgba(30, 60, 20, 0.3));
}
.mod-lancuchy .lc-leaf > svg {
  position: absolute;
  inset: 0;
}
.mod-lancuchy .lc-leaf-q {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(30, 70, 25, 0.6);
}
.mod-lancuchy .lc-leaf.is-current {
  animation: lc-leaf 1.3s ease-in-out infinite;
}

/* ---------- tap cells over the chain (bar + its ticket, >= 88 px) ---------- */

.mod-lancuchy .lc-cell {
  pointer-events: auto;
  background: transparent;
  border-radius: 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- L6: squares column and the cube ---------- */

.mod-lancuchy .lc-ghost {
  border-radius: 10px;
  border: 3px dashed #c9b88f;
  background: rgba(255, 255, 255, 0.35);
}
.mod-lancuchy .lc-ghost.is-current {
  border: 4px solid var(--gold-deep);
  background: var(--gold-soft);
  animation: lc-glow 1.3s ease-in-out infinite;
}
.mod-lancuchy .lc-ghost.is-filled {
  visibility: hidden;
}
.mod-lancuchy .lc-ghost-hit {
  pointer-events: auto;
  border-radius: 18px;
  cursor: pointer;
}
.mod-lancuchy .lc-cube > svg {
  display: block;
  overflow: visible;
}

/* ---------- arrow box (L1–L2) ---------- */

.mod-lancuchy .lc-tray {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  border-radius: 28px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 0 40px, rgba(120, 76, 24, 0.06) 40px 42px),
    linear-gradient(180deg, #ecd3a2 0%, #dbb575 100%);
  border: 4px solid #c39557;
  box-shadow: inset 0 0 0 4px rgba(255, 240, 210, 0.35), inset 0 8px 16px rgba(90, 55, 10, 0.2), var(--shadow-sm);
}
.mod-lancuchy .lc-pick {
  position: relative;
  width: 240px;
  height: 116px;
  border: 0;
  padding: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  transition: transform 0.08s ease, opacity 0.25s ease, filter 0.25s ease;
}
.mod-lancuchy .lc-pick:active {
  transform: translateY(4px);
}
.mod-lancuchy .lc-pick .lc-ticket {
  position: relative;
}
.mod-lancuchy .lc-pick .lc-ticket > svg {
  filter: drop-shadow(0 5px 0 rgba(42, 34, 56, 0.18)) drop-shadow(0 8px 10px rgba(42, 34, 56, 0.15));
}
.mod-lancuchy .lc-pick .lc-ticket-num {
  font-size: 46px;
}
.mod-lancuchy .lc-pick.is-dim,
.mod-lancuchy .lc-pick.lc-tdim {
  opacity: 0.32;
  filter: grayscale(0.7);
}
.mod-lancuchy .lc-pick.is-glow .lc-ticket,
.mod-lancuchy .lc-pick.lc-target .lc-ticket {
  animation: lc-glow 1.2s ease-in-out infinite;
}
.mod-lancuchy .lc-tray.is-locked .lc-pick {
  pointer-events: none;
}
.mod-lancuchy .lc-tray {
  transition: opacity 0.35s ease, visibility 0.35s;
}
.mod-lancuchy .lc-tray.is-hidden {
  opacity: 0;
  visibility: hidden;
}

/* ---------- keypad (L3+) ---------- */

.mod-lancuchy .lc-keys {
  pointer-events: auto;
  transition: opacity 0.25s ease, visibility 0.25s;
}
.mod-lancuchy .lc-keys.is-hidden {
  opacity: 0;
  visibility: hidden;
}
.mod-lancuchy .lc-keys .key {
  transition: opacity 0.2s ease, transform 0.08s ease, background 0.15s ease;
}
.mod-lancuchy .lc-keys .key.is-dim {
  opacity: 0.28;
}
.mod-lancuchy .lc-keys .key.is-press {
  transform: translateY(3px);
  background: var(--gold-soft);
  box-shadow: 0 0 0 4px var(--gold);
}
.mod-lancuchy .lc-keys .key.lc-target {
  box-shadow: 0 0 0 5px var(--gold), var(--shadow-sm);
  animation: lc-ring 1.2s ease-in-out infinite;
}

/* ---------- flights ---------- */

.mod-lancuchy .lc-mini {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 6px 6px rgba(36, 29, 59, 0.35));
}
.mod-lancuchy .lc-flying {
  z-index: 2;
}

/* ---------- keyframes ---------- */

@keyframes lc-glow {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(242, 183, 5, 0.5)); }
  50% { filter: drop-shadow(0 0 12px rgba(242, 183, 5, 1)); }
}
@keyframes lc-leaf {
  0%, 100% { filter: drop-shadow(0 3px 2px rgba(30, 60, 20, 0.3)) drop-shadow(0 0 2px rgba(242, 183, 5, 0.5)); transform: rotate(-6deg); }
  50% { filter: drop-shadow(0 3px 2px rgba(30, 60, 20, 0.3)) drop-shadow(0 0 12px rgba(242, 183, 5, 1)); transform: rotate(-2deg) scale(1.05); }
}
@keyframes lc-beat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}
@keyframes lc-ask {
  0%, 100% { stroke-opacity: 1; }
  50% { stroke-opacity: 0.35; }
}
@keyframes lc-ring {
  0%, 100% { box-shadow: 0 0 0 3px var(--gold), var(--shadow-sm); }
  50% { box-shadow: 0 0 0 8px rgba(242, 183, 5, 0.55), var(--shadow-sm); }
}

/* the place where the chain lay before folding */
.mod-lancuchy .lc-trace {
  opacity: 0.22;
  filter: grayscale(0.5);
  pointer-events: none;
}
.mod-lancuchy .lc-trace circle {
  stroke: none;
}
