/* Engine `trace` (Jezero ogledalo: podudarnost, DESIGN §13.1): every selector starts with `.tr-` (state classes `.is-*`
   allowed). Owned by package E. Lepojka's workshop table, shapes, the paus-papir, the paper clip, the facade, the
   pavement and its holes, payoffs and gags. Motion is transform/opacity only; no filters. */

/* ---------------------------------------------------------------- the table */
.tr-board { fill: #FFF8EA; stroke: #E8DDC4; stroke-width: 2; }
.tr-grid { fill: none; stroke: #EADFC8; stroke-width: 1.2; }
.tr-stand-board { fill: #DFF4F7; stroke: #24263B; stroke-width: 3; }
.tr-plaque-top { pointer-events: none; }
.tr-cloud { fill: #fff; stroke: #F1E6CF; stroke-width: 2; }
.tr-lake { fill: #BDEBFA; }
.tr-ripples { fill: none; stroke: #fff; stroke-opacity: .65; stroke-width: 2.2; stroke-linecap: round; }
.tr-reeds { fill: none; stroke: #8FCFAE; stroke-width: 3; stroke-linecap: round; }
.tr-plaque { font: 900 20px var(--font, Nunito, sans-serif); fill: #24263B; }

/* ---------------------------------------------------------------- shapes */
.tr-shape-shadow { fill: #24263B; opacity: .18; }
.tr-shape-body { stroke: none; }
.tr-shape-line { fill: none; stroke: #24263B; stroke-linejoin: round; }
.tr-cells rect { fill: none; stroke: #24263B; stroke-opacity: .22; stroke-width: 1.4; }
.tr-shape.is-window .tr-shape-body { fill: #BDEBFA; }
.tr-shape.is-window .tr-cells rect { stroke: #fff; stroke-opacity: .9; stroke-width: 2.4; }
.tr-shape.is-lit .tr-shape-body { fill: #FFE27A; }
.tr-shape.is-hole .tr-shape-body { fill: #6E5B49; }
.tr-shape.is-hole .tr-shape-shadow { opacity: 0; }
.tr-shape.is-hole .tr-cells rect { stroke: #fff; stroke-opacity: .25; }
.tr-shape.is-set .tr-shape-shadow { opacity: 0; }
.tr-pair-top .tr-shape-body { opacity: .5; }
.tr-pair-top .tr-shape-shadow { opacity: 0; }
.tr-cand.is-new, .tr-paired.is-new { animation: tr-pop .5s cubic-bezier(.3, 1.5, .5, 1); transform-box: fill-box; transform-origin: center; }
@keyframes tr-pop { 40% { transform: scale(1.12); } }
.tr-cand.is-wrong { animation: tr-shake .4s ease-in-out 2; }
@keyframes tr-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.tr-cand.is-size .tr-shape-line { stroke: #FF9636; stroke-width: 5; }
.tr-set.is-sink { animation: tr-sink .5s ease-in; transform-box: fill-box; transform-origin: center; }
@keyframes tr-sink { from { transform: scale(1.18); opacity: .6; } }
.tr-paired.is-glow, .tr-model-g.is-dance, .tr-cand.is-dance { animation: tr-dance .7s ease-in-out 2; transform-box: fill-box; transform-origin: center bottom; }
@keyframes tr-dance { 30% { transform: translateY(-10px) rotate(-4deg); } 60% { transform: translateY(0) rotate(4deg); } }
.tr-shape.is-glow .tr-shape-body { animation: tr-glow .6s ease-in-out 3; }
@keyframes tr-glow { 50% { fill: #FFF6B8; } }

/* ---------------------------------------------------------------- the paus-papir and the clip */
.tr-paper { cursor: grab; }
.tr-paper-hit, .tr-clip-hit, .tr-piece-hit { fill: transparent; }
.tr-paper-sheet { fill: #F4F9FF; fill-opacity: .55; stroke: #7C8AA5; stroke-width: 2.4; }
.tr-paper-fold { fill: #DCE8FF; stroke: #7C8AA5; stroke-width: 2; stroke-linejoin: round; }
.tr-paper.is-selected .tr-paper-sheet { stroke: #F5A300; stroke-width: 4; }
.tr-trace-line { fill: none; stroke: #2E3350; stroke-width: 3.5; stroke-linejoin: round; stroke-dasharray: 1 0; }
.tr-trace-line.is-drawing { stroke-dasharray: 900; stroke-dashoffset: 900; animation: tr-draw .9s ease-out forwards; }
@keyframes tr-draw { to { stroke-dashoffset: 0; } }
.tr-paper.is-match .tr-trace-line { stroke: #17A565; stroke-width: 5; }
.tr-paper.is-match .tr-paper-sheet { stroke: #17A565; }
.tr-paper.is-miss .tr-trace-line { stroke: #FF9636; stroke-width: 4.5; }
.tr-clip { cursor: grab; }
.tr-clip.is-selected .tr-clip-hit { fill: rgba(255, 197, 61, .3); stroke: #F5A300; stroke-width: 3; }
.tr-clip-on.is-in { animation: tr-pop .45s cubic-bezier(.3, 1.5, .5, 1); transform-box: fill-box; transform-origin: center; }
.tr-stick { fill: rgba(255, 150, 54, .35); stroke: #FF9636; stroke-width: 3.5; }
.tr-gap { fill: none; stroke: #FF9636; stroke-width: 3; stroke-dasharray: 5 4; }
.tr-overlap.is-hidden { opacity: 0; }
.tr-blink .is-blink { animation: tr-blink .45s steps(2) 4; }
@keyframes tr-blink { 50% { opacity: .2; } }

/* ---------------------------------------------------------------- pieces (pairs, tiles) */
.tr-piece { cursor: grab; }
.tr-piece.is-selected .tr-shape-line { stroke: #F5A300; stroke-width: 5; }
.tr-piece.is-dragging .tr-shape-shadow { transform: translate(4px, 8px); }
.tr-piece.tr-hover .tr-shape { animation: tr-hover 1s ease-in-out infinite; }
@keyframes tr-hover { 50% { transform: translateY(-5px); } }
.tr-piece.tr-refuse .tr-shape { animation: tr-shake .35s ease-in-out 2; }
.tr-hint-piece .tr-shape-line { stroke: #F5A300; stroke-width: 5; }

/* ---------------------------------------------------------------- facade, pavement, pallet */
.tr-wall { fill: #FFE6CC; stroke: #24263B; stroke-width: 3; }
.tr-planks { fill: none; stroke: #E8C9A4; stroke-width: 2; }
.tr-roof { fill: #19B5C8; stroke: #24263B; stroke-width: 3; stroke-linejoin: round; }
.tr-roof-win { fill: #FFE27A; stroke: #24263B; stroke-width: 2.4; }
.tr-door { fill: #A8743F; stroke: #24263B; stroke-width: 3; }
.tr-sand { fill: #F2DDB0; stroke: #24263B; stroke-width: 2.4; }
.tr-stones rect { fill: #D8D2C4; stroke: #B5AC98; stroke-width: 1.6; }
.tr-pave.is-reveal .tr-stones rect { animation: tr-reveal .8s ease-out backwards; }
@keyframes tr-reveal { from { opacity: .3; } }
.tr-pallet-top { fill: #E9C891; stroke: #24263B; stroke-width: 3; }

/* ---------------------------------------------------------------- hints, sparkles */
.tr-hint-ring { fill: rgba(255, 197, 61, .2); stroke: #F5A300; stroke-width: 4; stroke-dasharray: 10 6; animation: tr-march 1s linear infinite; }
@keyframes tr-march { to { stroke-dashoffset: -32; } }
.tr-hint-btn { animation: tr-btn-pulse .9s ease-in-out infinite; }
@keyframes tr-btn-pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 197, 61, .55); } }
.tr-twinkle { animation: tr-twinkle .9s ease-out forwards; transform-box: fill-box; transform-origin: center; }
@keyframes tr-twinkle { 0% { transform: scale(.2); opacity: 0; } 40% { opacity: 1; } 100% { transform: scale(1.3) rotate(90deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .tr-hint-ring, .tr-hint-btn, .tr-piece.tr-hover .tr-shape { animation: none !important; }
}
[data-motion="reduce"] .tr-hint-ring, [data-motion="reduce"] .tr-hint-btn, [data-motion="reduce"] .tr-piece.tr-hover .tr-shape { animation: none !important; }
