/* Engine `pencil` (DESIGN §13.1): every selector starts with `.pe-` (state classes `.is-*` allowed). Owned by the
   foundation (the reference engine). The world of Ulica linija: posts and laundry, lamps and fireflies, stations
   and the toy train, birds on the wire, Šestarko's postcards. Motion is transform/opacity only; no filters. */

/* ---------------------------------------------------------------- the board scene */
.pe-paper { fill: #FFFBF1; stroke: #E8DDC4; stroke-width: 2; }
.pe-dusk { fill: #2A3A6E; opacity: .22; }
.pe-star { fill: #FFE45C; }
.pe-tuft { fill: none; stroke: #8CC56A; stroke-width: 2.4; stroke-linecap: round; }
.pe-scene-in { animation: pe-scene-in .35s ease-out; }
@keyframes pe-scene-in { from { opacity: .2; } }
.pe-ptname, .pe-linename { font-size: 22px; }
.pe-linename { fill: #1D52B3; font-style: italic; }
.pe-pt.is-tapped circle:first-child { fill: #17A565; }
.pe-miss circle:first-child { fill: #FF9636; }
.pe-miss { animation: pe-shake .38s ease-in-out 2; transform-box: fill-box; transform-origin: center; }
@keyframes pe-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.pe-glow { fill: #FFE27A; opacity: .55; animation: pe-breathe 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pe-breathe { 50% { transform: scale(1.18); opacity: .3; } }
.pe-wire line, .pe-wire path { stroke: #3C3F5C; stroke-width: 3; }
.pe-given-seg line { stroke-width: 6; stroke: #1D52B3; }
.pe-figdot circle:first-child { fill: #FFFBF1; }

/* ---------------------------------------------------------------- props */
.pe-lamp .pe-glass { fill: #E9EEF5; }
.pe-lamp.is-lit .pe-glass { fill: #FFE27A; }
.pe-halo { fill: #FFE27A; opacity: .45; animation: pe-breathe 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.pe-fly-glow { fill: #FFE27A; opacity: 0; }
.pe-fly-tail { fill: #C9D2DE; }
.pe-fly.is-glow .pe-fly-tail, .pe-fly.is-lit .pe-fly-tail { fill: #FFE27A; }
.pe-fly.is-lit .pe-fly-glow { opacity: .6; animation: pe-breathe 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.pe-fly.is-glow .pe-fly-glow { opacity: .4; animation: pe-breathe 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.pe-fly.is-lit .pe-fly-body { animation: pe-bob 1.6s ease-in-out infinite; }
@keyframes pe-bob { 50% { transform: translateY(-3px); } }
.pe-station .pe-sign { fill: #DCE8FF; }
.pe-station.is-hit .pe-sign { fill: #17A565; }
.pe-house .pe-window { fill: #5B6578; }
.pe-house.is-lit .pe-window { fill: #FFE27A; }
.pe-hedgehog { opacity: 0; transition: opacity .4s; }
.pe-house.is-lit .pe-hedgehog { opacity: 1; }

/* ---------------------------------------------------------------- payoffs: laundry, banner, train, postcards */
.pe-laundry .pe-cloth { animation: pe-swing 2.6s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -0.7s); transform-box: fill-box; transform-origin: 50% 0; }
.pe-laundry.is-in .pe-cloth { animation: pe-drop .5s cubic-bezier(.3, 1.5, .5, 1) backwards, pe-swing 2.6s ease-in-out .5s infinite; animation-delay: calc(var(--i, 0) * .12s), calc(var(--i, 0) * -0.7s); }
.pe-laundry.is-wind .pe-cloth { animation: pe-flap .35s ease-in-out infinite; }
@keyframes pe-swing { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes pe-drop { from { transform: translateY(-30px); opacity: 0; } }
@keyframes pe-flap { 0%, 100% { transform: rotate(-14deg) skewX(-6deg); } 50% { transform: rotate(10deg) skewX(6deg); } }
.pe-train-body { animation: pe-chug .22s linear infinite; }
@keyframes pe-chug { 50% { transform: translateY(-1.5px); } }
.pe-smoke { animation: pe-smoke .9s ease-out infinite; transform-box: fill-box; transform-origin: center bottom; }
@keyframes pe-smoke { from { opacity: .9; transform: translateY(4px) scale(.7); } to { opacity: 0; transform: translateY(-10px) scale(1.2); } }
.pe-postcard-t { font-weight: 900; fill: #24263B; }
.pe-postcard-in { animation: pe-pop .45s cubic-bezier(.3, 1.5, .5, 1); transform-box: fill-box; transform-origin: center; }
.pe-postcard-in.is-out { opacity: 0; transition: opacity .35s; }
@keyframes pe-pop { from { transform: scale(.3); opacity: 0; } }

/* ---------------------------------------------------------------- the eraser, hints, gags */
.pe-erase-h circle { fill: #FF9DB8; stroke: #24263B; stroke-width: 2.4; }
.pe-erase-h path { stroke: #24263B; stroke-width: 3; stroke-linecap: round; }
.pe-hint-ring { fill: rgba(255, 197, 61, .3); stroke: #F5A300; stroke-width: 4; animation: pe-breathe .9s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.pe-hint { animation: pe-btn-pulse .9s ease-in-out infinite; }
@keyframes pe-btn-pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 197, 61, .55); } }
.pe-wrong { opacity: .9; }
.pe-wrong-seg { animation: pe-fall .9s ease-in forwards; }
.pe-wrong-ray { animation: pe-flicker .9s steps(2) forwards; }
.pe-wrong-line { animation: pe-crumble .9s ease-in forwards; }
@keyframes pe-fall { 40% { transform: translateY(0); opacity: 1; } to { transform: translateY(26px); opacity: 0; } }
@keyframes pe-flicker { 0%, 30%, 60% { opacity: 1; } 15%, 45%, 80% { opacity: .2; } to { opacity: 0; } }
@keyframes pe-crumble { 30% { transform: translateX(-3px); } 50% { transform: translateX(3px); } to { opacity: 0; } }
.pe-same { opacity: .55; }
.pe-landing { animation: pe-land .6s cubic-bezier(.3, 1.5, .5, 1) backwards; }
@keyframes pe-land { from { transform: translateY(-40px); opacity: 0; } }
.pe-swarm { fill: #FFE27A; stroke: #F5A300; stroke-width: 1.4; animation: pe-swarm 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pe-swarm { 0%, 100% { transform: translate(0, 0) scale(.6); opacity: .3; } 50% { transform: translate(8px, -10px) scale(1.4); opacity: 1; } }

/* ---------------------------------------------------------------- the dock tray (birds, letter tags) */
.pe-tray { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-content: center; padding: 2px; min-height: 52px; }
.pe-item { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: #fff; border: 2.5px solid #C9D6E8; touch-action: none; cursor: grab; box-sizing: border-box; }
.pe-item svg { width: 44px; height: 44px; pointer-events: none; }
.pe-item.is-kbd { outline: 4px solid #FFC53D; outline-offset: 2px; }
.pe-item.is-placed { position: absolute; inset: 0; width: 100%; height: 100%; background: transparent; border-color: transparent; }
.pe-item.is-placed svg { width: 86%; height: 86%; }
.pe-tagch { font: 900 22px var(--font, Nunito, sans-serif); fill: #24263B; }
.pe-flap { animation: pe-shake .3s ease-in-out 3; }

@media (prefers-reduced-motion: reduce) {
  .pe-glow, .pe-halo, .pe-fly-glow, .pe-laundry .pe-cloth, .pe-train-body, .pe-smoke, .pe-hint-ring, .pe-hint, .pe-swarm { animation: none !important; }
}
.pe-cloud { fill: #EEF4FF; stroke: #DCE8FF; stroke-width: 2; }
.pe-skyline rect, .pe-skyline path { fill: none; stroke: #CFDDF5; stroke-width: 2; stroke-dasharray: 6 4; }
