/* Smocza Matematyka — module 'koraliki' (Złote koraliki). Every selector starts with .mod-koraliki. */

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

.mod-koraliki .kor-band {
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-width: 0;
  white-space: nowrap;
}
.mod-koraliki .kor-band-tag {
  font-family: var(--font);
  font-size: 24px;
  font-weight: 700;
  color: var(--gold-deep);
  background: var(--gold-soft);
  border: 3px solid var(--gold);
  border-radius: 999px;
  padding: 6px 16px;
  line-height: 1.1;
}
.mod-koraliki .kor-band-label {
  font-family: var(--font);
  font-size: 32px;
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1;
}
.mod-koraliki .kor-part {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.mod-koraliki .kor-dg {
  font-family: var(--font-num);
  font-size: 58px;
  font-weight: 700;
  line-height: 1;
}
.mod-koraliki .kor-word {
  font-family: var(--font);
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.mod-koraliki .kor-and {
  color: var(--ink-soft);
}
.mod-koraliki .kor-part-exp {
  gap: 6px;
}
.mod-koraliki .kor-band-label-exp {
  font-size: 28px;
  margin-right: -4px;
}
.mod-koraliki .kor-part-exp .kor-dg {
  font-size: 48px;
}
.mod-koraliki .kor-part-exp .kor-word {
  font-size: 27px;
}

/* ---------- helpers drawn over the mat ---------- */

.mod-koraliki .kor-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3; /* above the beads (z 2), below the mat's chips (z 5) */
}

/* L5: a quiet "0" in a column that stays empty — under the beads (z 2), above the mat board */
.mod-koraliki .kor-zeros {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.mod-koraliki .kor-zero {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 120px;
  line-height: 1;
}
.mod-koraliki .kor-zero-d {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  color: color-mix(in srgb, currentColor 22%, transparent);
  transition: color 0.25s, box-shadow 0.25s, background-color 0.25s;
}
@supports not (color: color-mix(in srgb, red 50%, transparent)) {
  .mod-koraliki .kor-zero-d {
    opacity: 0.22;
  }
}
.mod-koraliki .kor-zero.is-amber .kor-zero-d {
  color: color-mix(in srgb, currentColor 55%, transparent);
  box-shadow: 0 0 0 5px var(--err);
  background: rgba(255, 233, 212, 0.75);
}

/* rung 2: "jest · ma być" side by side */
.mod-koraliki .kor-compare {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: inset 0 0 0 3px var(--err), 0 4px 10px rgba(42, 34, 56, 0.16);
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  animation: kor-pop 0.25s ease both;
}
.mod-koraliki .kor-compare b {
  font-family: var(--font-num);
  font-size: 34px;
  line-height: 1;
}
.mod-koraliki .kor-cmp-sep {
  color: var(--line);
  font-size: 30px;
}

/* success: the card rail covers the drawers, cards appear above their columns and slide together */
.mod-koraliki .kor-rail {
  position: absolute;
  display: none;
  z-index: 6;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--panel-2), var(--bg-2));
  box-shadow: inset 0 0 0 3px var(--line), 0 4px 12px rgba(42, 34, 56, 0.12);
  overflow: hidden;
}
.mod-koraliki .kor-rail.is-on {
  display: block;
  animation: fade-in 0.2s ease both;
}
.mod-koraliki .kor-card {
  position: absolute;
  line-height: 0;
  transition: transform 0.62s cubic-bezier(0.34, 1.2, 0.5, 1);
  animation: kor-card-in 0.32s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.mod-koraliki .kor-stack {
  position: absolute;
  line-height: 0;
  border-radius: 9px;
  box-shadow: 0 0 0 4px var(--gold), 0 0 18px rgba(242, 183, 5, 0.6);
  animation: kor-glow-in 0.35s ease both;
}
.mod-koraliki .kor-cardrow {
  position: absolute;
  pointer-events: none;
  z-index: 6;
}

/* success flash of the columns (left to right) */
.mod-koraliki .mata-col.hl-gold {
  background: rgba(242, 183, 5, 0.12);
  animation: kor-col-flash 0.9s ease-out both;
}

.mod-koraliki .kor-sparks {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 7;
}
.mod-koraliki .kor-sparks i {
  position: absolute;
  left: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffbe0 0%, var(--gold) 60%, rgba(242, 183, 5, 0) 100%);
  transform: rotate(var(--a)) translateY(0);
  animation: kor-spark 0.8s ease-out forwards;
}

/* "Wymień" (10 -> 1) in the middle of the action bar, only while a column holds ten */
.mod-koraliki .kor-exbtn {
  height: 96px;
  min-width: 210px;
  font-size: 30px;
  visibility: hidden;
}
.mod-koraliki .kor-exbtn.is-on {
  visibility: visible;
  animation: kor-pop 0.25s ease both;
}

/* ---------- L6 "Ile to?" ---------- */

.mod-koraliki .kor-field {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 250px;
  height: 84px;
  padding: 0 22px;
  border-radius: 20px;
  background: var(--panel);
  border: 4px solid var(--ink);
  font-family: var(--font-num);
  font-size: 60px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.mod-koraliki .kor-field.is-empty .kor-fd-ph {
  color: #c4b9a4;
}
.mod-koraliki .kor-field.is-amber {
  border-color: var(--err);
  box-shadow: 0 0 0 5px rgba(240, 140, 46, 0.3);
}
.mod-koraliki .kor-field.is-ok {
  border-color: var(--gold);
  box-shadow: 0 0 0 5px rgba(242, 183, 5, 0.45);
}
.mod-koraliki .kor-fd {
  display: inline-block;
  min-width: 0.6em;
  text-align: center;
  border-radius: 10px;
}
.mod-koraliki .kor-fd.is-amber {
  background: var(--err-soft);
  box-shadow: 0 0 0 3px var(--err);
}
.mod-koraliki .kor-fgap {
  display: inline-block;
  width: 16px;
}

.mod-koraliki .kor-slot {
  position: absolute;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.9);
  box-shadow: inset 0 0 0 3px var(--line);
  pointer-events: none;
  z-index: 4;
}
.mod-koraliki .kor-slot.is-on {
  display: flex;
}
.mod-koraliki .kor-slot-digit {
  font-family: var(--font-num);
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  color: var(--cat);
}
.mod-koraliki .kor-slot.is-pulse {
  box-shadow: inset 0 0 0 3px var(--err);
  animation: kor-slot-pulse 0.9s ease-in-out infinite;
}
.mod-koraliki .kor-slot.is-drop .kor-slot-digit {
  animation: kor-drop 0.45s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}
.mod-koraliki .kor-slot.is-ghost {
  background: transparent;
  box-shadow: inset 0 0 0 3px var(--line);
  border: 0;
  opacity: 0.6;
}
.mod-koraliki .kor-slot.is-count {
  box-shadow: inset 0 0 0 4px var(--err);
}
.mod-koraliki .kor-slot.is-demo,
.mod-koraliki .kor-slot.is-ok {
  background: var(--gold-soft);
  box-shadow: inset 0 0 0 4px var(--gold);
}

.mod-koraliki .kor-pad {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 26px;
  background: var(--panel);
  box-shadow: inset 0 0 0 3px var(--line), 0 6px 0 rgba(42, 34, 56, 0.08), 0 10px 24px rgba(42, 34, 56, 0.12);
}
.mod-koraliki .kor-pad .keypad-phone {
  grid-auto-rows: 96px;
  gap: 14px;
}

.mod-koraliki .kor-fly {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-size: 60px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  z-index: 20;
}

/* ---------- L1: the cube is built from ten plates ---------- */

.mod-koraliki .kor-cube-host {
  position: relative;
  overflow: visible;
}
.mod-koraliki .kor-plate {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}

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

@keyframes kor-glow-in {
  from { box-shadow: 0 0 0 0 var(--gold), 0 0 0 rgba(242, 183, 5, 0); }
  to { box-shadow: 0 0 0 4px var(--gold), 0 0 18px rgba(242, 183, 5, 0.6); }
}
@keyframes kor-pop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes kor-card-in {
  from { opacity: 0; translate: 0 -24px; }
  to { opacity: 1; translate: 0 0; }
}
@keyframes kor-col-flash {
  0% { box-shadow: inset 0 0 0 5px var(--gold), 0 0 0 0 rgba(242, 183, 5, 0.8); }
  45% { box-shadow: inset 0 0 0 5px var(--gold), 0 0 22px 6px rgba(242, 183, 5, 0.65); }
  100% { box-shadow: inset 0 0 0 5px var(--gold), 0 0 0 0 rgba(242, 183, 5, 0); }
}
@keyframes kor-spark {
  0% { transform: rotate(var(--a)) translateY(0) scale(0.6); opacity: 1; }
  100% { transform: rotate(var(--a)) translateY(-48px) scale(1.1); opacity: 0; }
}
@keyframes kor-slot-pulse {
  50% { background: rgba(255, 233, 212, 0.95); }
}
@keyframes kor-drop {
  from { transform: translateY(-46px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
