/* Engine `mirror` (Jezero ogledalo, DESIGN §13.1): every selector starts with `.mi-` (state classes `.is-*` allowed).
   Owned by package E. The lake shore, Lepojka's frames, the silver mirror bar, mosaics, the butterfly on p, the fold,
   payoffs and gags. Motion is transform/opacity only; no filters, no blend modes. */

/* ---------------------------------------------------------------- the board scene */
.mi-board { fill: #EAF7FA; stroke: #C6E6EE; stroke-width: 2; }
.mi-cloud { fill: #fff; stroke: #D6F5F8; stroke-width: 2; }
.mi-reeds path { fill: none; stroke: #A5D8C0; stroke-width: 3; stroke-linecap: round; }
.mi-paper { fill: #FFFBF1; stroke: #E8DDC4; stroke-width: 2; }
.mi-grid { fill: none; stroke: #C9D6E8; stroke-width: 1.4; }
.mi-grid-water { stroke: rgba(36, 38, 59, .14); stroke-dasharray: 3 4; }
.mi-axis { stroke: #2A6EE5; stroke-width: 4.5; stroke-dasharray: 11 7; stroke-linecap: round; }
.mi-axis.is-shore { stroke: #0E8C9C; stroke-width: 3.5; stroke-dasharray: 9 7; }
.mi-axis.is-found { stroke: #2A6EE5; stroke-width: 5; }
.mi-axis.is-in { animation: mi-dash-in .6s ease-out; }
@keyframes mi-dash-in { from { opacity: 0; stroke-dashoffset: 60; } }
.mi-axis-name { fill: #1D52B3; font-style: italic; font-size: 24px; }
.mi-tile-hi { fill: none; stroke: #fff; stroke-opacity: .45; stroke-linecap: round; }
.mi-pop { fill: none; stroke: #FFE27A; stroke-width: 4; animation: mi-pop .45s ease-out forwards; transform-box: fill-box; transform-origin: center; }
@keyframes mi-pop { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
.mi-twinkle { animation: mi-twinkle .7s ease-out forwards; transform-box: fill-box; transform-origin: center; }
@keyframes mi-twinkle { 0% { transform: scale(.2) rotate(0); opacity: 0; } 40% { opacity: 1; } 100% { transform: scale(1.4) rotate(90deg); opacity: 0; } }
.mi-wet rect { fill: #9ED8EC; fill-opacity: .3; }
.mi-wet path { fill: none; stroke: #fff; stroke-opacity: .7; stroke-width: 2; stroke-linecap: round; }
.mi-painted.is-water { opacity: .9; }

/* ---------------------------------------------------------------- marks, hints */
.mi-miss { fill: rgba(255, 150, 54, .2); stroke: #FF9636; stroke-width: 3.5; }
.mi-lost { fill: none; stroke: #FF9636; stroke-width: 3; stroke-dasharray: 5 4; }
.mi-miss-seg { stroke: #FF9636; stroke-width: 5; stroke-dasharray: 8 5; stroke-linecap: round; }
.mi-diff.is-in .mi-miss, .mi-diff.is-in .mi-lost, .mi-diff.is-in .mi-miss-seg { animation: mi-pop-in .35s cubic-bezier(.3, 1.5, .5, 1); transform-box: fill-box; transform-origin: center; }
@keyframes mi-pop-in { from { transform: scale(.3); opacity: 0; } }
.mi-hide-marks .mi-diff { opacity: 0; }
.mi-hint-ring { fill: rgba(255, 197, 61, .28); stroke: #F5A300; stroke-width: 4; animation: mi-breathe .9s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes mi-breathe { 50% { transform: scale(1.15); opacity: .65; } }
.mi-hint-seg, .mi-hint-axis { stroke: #F5A300; stroke-width: 6; stroke-dasharray: 2 9; stroke-linecap: round; animation: mi-march 1s linear infinite; }
@keyframes mi-march { to { stroke-dashoffset: -22; } }
.mi-hint-frame { fill: none; stroke: #F5A300; stroke-width: 5; stroke-dasharray: 10 6; animation: mi-march 1s linear infinite; }
.mi-count { font: 900 20px var(--font, Nunito, sans-serif); fill: #B98200; paint-order: stroke; stroke: #FFFBF1; stroke-width: 4px; }
.mi-hint-btn { animation: mi-btn-pulse .9s ease-in-out infinite; }
@keyframes mi-btn-pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 197, 61, .55); } }

/* ---------------------------------------------------------------- the mirror bar and the live reflection */
.mi-bar { cursor: grab; }
.mi-bar-hit { fill: transparent; }
.mi-bar.is-selected .mi-bar-art > rect:nth-child(2) { stroke: #F5A300; stroke-width: 4; }
.mi-bar.is-dragging { cursor: grabbing; }
.mi-bar.is-match .mi-bar-art > rect:nth-child(3) { fill: #FFF3C4; }
.mi-bar.is-match .mi-bar-art { animation: mi-ting .5s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes mi-ting { 30% { transform: scale(1.06); } }
.mi-veil { fill: #FFFBF1; fill-opacity: .82; }
.mi-refl-use { opacity: .95; }

/* ---------------------------------------------------------------- find: easel, picture, frames, queue */
.mi-canvas { fill: #FFFBF1; stroke: #24263B; stroke-width: 3; }
.mi-pic-node { cursor: grab; }
.mi-pic-node.is-in { animation: mi-slide-in .45s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes mi-slide-in { from { transform: translateY(-30px); opacity: 0; } }
.mi-pic-node.is-dragging .mi-canvas { stroke: #F5A300; stroke-width: 4; }
.mi-pic-node.is-selected .mi-canvas { stroke: #F5A300; stroke-width: 4; }
.mi-card { fill: #fff; stroke: #24263B; stroke-width: 2; }
.mi-plaque { font: 900 20px var(--font, Nunito, sans-serif); fill: #24263B; }
.mi-frame-g.is-shine .mi-frame-in { animation: mi-shine .9s ease-out; }
@keyframes mi-shine { 30% { fill: #FFF8D6; } }
.mi-frame-g.is-refuse { animation: mi-shake .4s ease-in-out 2; }
@keyframes mi-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.mi-in-frame.is-new { animation: mi-pop-in .5s cubic-bezier(.3, 1.5, .5, 1); transform-box: fill-box; transform-origin: center; }
.mi-in-frame.is-bounce { animation: mi-bounce .6s ease-in-out 2; transform-box: fill-box; transform-origin: center bottom; }
@keyframes mi-bounce { 50% { transform: translateY(-8px) scale(1.06); } }
.mi-fly-path { animation: mi-fly 2.4s ease-in forwards; }
.mi-fly-path.is-circle { animation: mi-fly-circle 1.2s ease-in-out forwards; }
@keyframes mi-fly { 0% { transform: translate(0, 0); } 30% { transform: translate(-20px, -40px); } 60% { transform: translate(30px, -110px); } 100% { transform: translate(-10px, -420px); opacity: 0; } }
@keyframes mi-fly-circle { 25% { transform: translate(30px, -20px) rotate(40deg); } 50% { transform: translate(0, -40px) rotate(180deg); } 75% { transform: translate(-30px, -20px) rotate(300deg); } 100% { transform: translate(0, 0) rotate(360deg); } }
.mi-mini-fly .mi-wing-l, .mi-mini-fly .mi-wing-r { animation: mi-flap .18s ease-in-out infinite alternate; transform-box: fill-box; }
.mi-mini-fly .mi-wing-l { transform-origin: right center; }
.mi-mini-fly .mi-wing-r { transform-origin: left center; }
@keyframes mi-flap { to { transform: scaleX(.35); } }

/* ---------------------------------------------------------------- axes */
.mi-axfig.is-dance { animation: mi-dance .9s ease-in-out; transform-box: fill-box; transform-origin: center; }
@keyframes mi-dance { 25% { transform: scaleX(-1); } 50% { transform: scaleX(1); } 75% { transform: scaleY(-1); } }
.mi-circle { fill: none; stroke: #8650E6; stroke-width: 4; stroke-dasharray: 8 6; animation: mi-dash-in 1s ease-out; }
.mi-circle-ax { stroke: #2A6EE5; stroke-width: 2.5; stroke-dasharray: 6 6; opacity: 0; animation: mi-fade-in .4s ease-out forwards; }
@keyframes mi-fade-in { to { opacity: .8; } }

/* ---------------------------------------------------------------- paint: the butterfly, the fold, gags */
.mi-body-g { pointer-events: none; }
.mi-drip { animation: mi-drip 1s ease-in forwards; }
.mi-drip.is-short { animation-duration: .42s; }
@keyframes mi-drip { 30% { transform: translateY(0); opacity: 1; } to { transform: translateY(26px); opacity: 0; } }
.mi-fold-paper { fill: #FFFBF1; fill-opacity: .6; stroke: #24263B; stroke-width: 2; stroke-dasharray: 6 4; }
.mi-fold-paper.is-water { fill: #9ED8EC; }
.mi-fold .mi-mosaic { opacity: .85; }
.mi-wobble { animation: mi-wobble .48s ease-in-out; transform-box: view-box; transform-origin: 50% 50%; }
@keyframes mi-wobble { 25% { transform: rotate(-9deg) translate(-6px, -10px); } 50% { transform: rotate(8deg) translate(8px, -14px); } 75% { transform: rotate(-4deg) translate(-3px, -4px); } }
.mi-flyoff.is-v { animation: mi-flyoff 1.5s ease-in forwards; transform-box: view-box; transform-origin: var(--ax, 50%) 50%; }
.mi-flyoff.is-h { animation: mi-flyoff-h 1.5s ease-in forwards; transform-box: view-box; transform-origin: 50% var(--ax, 50%); }
@keyframes mi-flyoff { 0% { transform: scaleX(1); } 10% { transform: scaleX(.4); } 20% { transform: scaleX(1); } 30% { transform: scaleX(.4) translateY(-20px); } 40% { transform: scaleX(1) translateY(-40px); } 55% { transform: scaleX(.4) translateY(-90px); } 70% { transform: scaleX(1) translateY(-160px); } 100% { transform: scaleX(.5) translateY(-520px); opacity: 0; } }
@keyframes mi-flyoff-h { 0% { transform: scaleY(1); } 10% { transform: scaleY(.4); } 20% { transform: scaleY(1); } 35% { transform: scaleY(.4) translateX(40px); } 55% { transform: scaleY(1) translateX(120px); } 100% { transform: scaleY(.5) translateX(900px); opacity: 0; } }
.mi-launch { animation: mi-launch 1.2s ease-in forwards; }
@keyframes mi-launch { 20% { transform: translateY(6px); } 100% { transform: translateY(-600px); opacity: 0; } }
.mi-spark { animation: mi-spark 1.4s ease-out forwards; }
@keyframes mi-spark { from { transform: translate(0, 0) scale(.3); opacity: 1; } 70% { opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1.2); opacity: 0; } }

/* ---------------------------------------------------------------- water */
.mi-ripples { fill: none; stroke: #fff; stroke-opacity: .6; stroke-width: 2.2; stroke-linecap: round; }
.mi-ripple { animation: mi-ripple 1.4s ease-in-out; transform-box: fill-box; transform-origin: center top; }
@keyframes mi-ripple { 25% { transform: skewX(6deg) scaleY(.96); } 50% { transform: skewX(-5deg); } 75% { transform: skewX(3deg) scaleY(1.02); } }
.mi-jump { animation: mi-jump 1.3s ease-in-out forwards; }
@keyframes mi-jump { 0% { transform: translate(0, 20px) rotate(-30deg); opacity: 0; } 15% { opacity: 1; } 50% { transform: translate(40px, -70px) rotate(10deg); } 100% { transform: translate(80px, 20px) rotate(60deg); opacity: 0; } }
.mi-paddle { animation: mi-paddle 1.5s linear forwards; }
@keyframes mi-paddle { to { transform: translateX(-260px); } }

/* ---------------------------------------------------------------- lines */
.mi-given-seg { fill: none; stroke: #24263B; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.mi-child-seg { fill: none; stroke: #0E8C9C; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.mi-child-seg.is-water { stroke: #2A6EE5; stroke-dasharray: 14 4; }
.mi-child-seg.is-done { stroke: #24263B; transition: stroke .6s; }
.mi-seg-pop { stroke: #FFE27A; stroke-width: 12; stroke-linecap: round; opacity: .8; animation: mi-fade-out .6s ease-out forwards; }
@keyframes mi-fade-out { to { opacity: 0; } }
.mi-wrong-seg { stroke: #FF9636; stroke-width: 6; stroke-linecap: round; animation: mi-fall .95s ease-in forwards; }
.mi-wrong-seg.is-short { animation-duration: .4s; }
@keyframes mi-fall { 40% { transform: translateY(0); opacity: 1; } to { transform: translateY(24px); opacity: 0; } }
.mi-pegs circle { fill: #7C8AA5; }
.mi-fill { fill: #D6F5F8; stroke: none; animation: mi-fill-in .7s ease-out; }
@keyframes mi-fill-in { from { opacity: 0; } }

/* ---------------------------------------------------------------- Lepojka, sparkles */
.mi-lep-in { animation: mi-lep .5s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes mi-lep { from { transform: translateY(60px); opacity: 0; } }
.mi-star { stroke-linejoin: round; }

@media (prefers-reduced-motion: reduce) {
  .mi-hint-ring, .mi-hint-seg, .mi-hint-axis, .mi-hint-frame, .mi-hint-btn, .mi-mini-fly .mi-wing-l, .mi-mini-fly .mi-wing-r { animation: none !important; }
}
[data-motion="reduce"] .mi-hint-ring, [data-motion="reduce"] .mi-hint-seg, [data-motion="reduce"] .mi-hint-axis, [data-motion="reduce"] .mi-mini-fly .mi-wing-l, [data-motion="reduce"] .mi-mini-fly .mi-wing-r { animation: none !important; }

/* ---------------------------------------------------------------- the sandbox painter (js/eng/mirror/sandbox.js) */
.mi-sand { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 8px; box-sizing: border-box; }
.mi-sand.is-side { flex-direction: row; gap: 16px; }
.mi-sand-stage { position: relative; flex: 0 0 auto; border-radius: 10px; box-shadow: 0 5px 0 #24263B; }
.mi-sand-grid, .mi-sand-fx { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.mi-sand-grid { touch-action: none; border-radius: 10px; outline: none; cursor: crosshair; }
.mi-sand-grid:focus-visible { box-shadow: 0 0 0 4px #FFC53D; }
.mi-sand-fx { pointer-events: none; }
.mi-sand-paper { fill: #FFFBF1; stroke: #24263B; stroke-width: 1.2; }
.mi-sand-lines { fill: none; stroke: #C9D6E8; stroke-width: .35; }
.mi-sand-axis { fill: none; stroke: #2A6EE5; stroke-width: 1.1; stroke-dasharray: 2.6 1.6; stroke-linecap: round; }
.mi-sand-fresh { fill: #fff; opacity: 0; animation: mi-sand-shimmer .65s ease-out; }
@keyframes mi-sand-shimmer { 0% { opacity: .85; } 100% { opacity: 0; } }
.mi-sand-cursor { fill: none; stroke: #FFC53D; stroke-width: 1.4; }
.mi-sand-fold-paper { fill: #FFFBF1; fill-opacity: .55; stroke: #24263B; stroke-width: .5; stroke-dasharray: 1.6 1; }
.mi-sand-miss { fill: rgba(255, 150, 54, .25); stroke: #FF9636; stroke-width: 1; }
.mi-sand-twinkle { animation: mi-twinkle .8s ease-out forwards; transform-box: fill-box; transform-origin: center; }
.mi-sand-pal { display: grid; gap: 8px; justify-content: center; align-content: center; }
.mi-sand-brush { width: 100%; height: 100%; min-width: 44px; min-height: 44px; display: grid; place-items: center; padding: 2px; border-radius: 14px; border: 3px solid #24263B; background: #fff; box-shadow: 0 3px 0 #24263B; cursor: pointer; touch-action: manipulation; }
.mi-sand-brush svg { width: 88%; height: 88%; display: block; pointer-events: none; }
.mi-sand-brush.is-on { background: #FFC53D; box-shadow: 0 0 0 3px #fff, 0 0 0 6px #FFC53D; }
.mi-sand-brush:active { transform: translateY(2px); box-shadow: none; }
