/* Shape Town – the shared geo layer (js/geo/*, foundation F0b). Every selector starts with `.st-` (geo names:
   st-geo*, st-p-*, st-ruler*, st-grid*, st-numtag*, st-key*, st-spot*, st-loupe*, st-lupa*, st-ghost-*, st-dbg*,
   st-rail*, st-trace*, st-lasso*, st-cursor, st-arm, st-snapc, st-glbl, st-tool-obj). Loaded by js/geo/board.js. */

/* ---------------------------------------------------------------- the board */
.st-geo-host { position: relative; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; outline: none; }
.st-geo-host:focus-visible { box-shadow: inset 0 0 0 3px rgba(255, 197, 61, .55); }
.st-geo { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; overflow: visible; pointer-events: none; }.st-geo text { font-family: var(--font, Nunito, system-ui, sans-serif); }
.st-cursor { fill: none; stroke: #FFC53D; stroke-width: 3.5; filter: none; }
.st-arm { fill: rgba(255, 197, 61, .28); stroke: #F5A300; stroke-width: 3; animation: st-arm 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.st-snapc { fill: rgba(23, 165, 101, .22); stroke: #17A565; stroke-width: 3; }
@keyframes st-arm { 50% { transform: scale(1.18); opacity: .7; } }
.st-glbl { font-weight: 900; font-size: 21px; fill: #24263B; paint-order: stroke; stroke: #FFFBF1; stroke-width: 5px; stroke-linejoin: round; }

/* ---------------------------------------------------------------- pencil styles */
.st-pen line, .st-pen path, .st-pen polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.st-p-seg { stroke: #2E3350; stroke-width: 4.5; }
.st-p-edge { stroke: #24263B; stroke-width: 3; }
.st-p-grid { stroke: #3B4A6B; stroke-width: 5; }
.st-p-band { stroke: #EC6A9C; stroke-width: 6; }
.st-p-rope { stroke: #B88A4E; stroke-width: 6; }
.st-p-rope-twist { stroke: #8A6232; stroke-width: 2.4; stroke-dasharray: 3 7; }
.st-p-knot { fill: #B88A4E; stroke: #24263B; stroke-width: 2.4; }
.st-p-beam { stroke-width: 5; }
.st-p-beam-cone { stroke: none; }
.st-p-sparks circle { fill: #FFE27A; stroke: #F5A300; stroke-width: 1.2; animation: st-spark 1.6s ease-in-out infinite; animation-delay: var(--d, 0s); transform-box: fill-box; transform-origin: center; }
@keyframes st-spark { 0%, 100% { opacity: .2; transform: scale(.6); } 50% { opacity: 1; transform: scale(1.3); } }
.st-p-rail { stroke: #5B6578; stroke-width: 3.2; }
.st-p-sleepers line { stroke: #9C6B3E; stroke-width: 4.5; stroke-linecap: butt; }
.st-p-fence-rope { stroke: #B88A4E; stroke-width: 4; }
.st-p-post { fill: #9C6B3E; stroke: #24263B; stroke-width: 2; }
.st-p-picket-rail { stroke: #C99A5B; stroke-width: 3; }
.st-p-picket { fill: #F4E3C1; stroke: #24263B; stroke-width: 1.6; }
.st-pen.is-faint { opacity: .42; }
.st-pen-preview { opacity: .72; }
.st-pen.is-in { animation: st-pen-in .45s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes st-pen-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------------- loupe (automatic) and lupa (the child's) */
/* positioned by transform (no layout per frame) on its own compositor layer; the pop-in runs on the inner svg */
.st-loupe { position: fixed; left: 0; top: 0; z-index: 950; width: 128px; height: 128px; border-radius: 50%; pointer-events: none; box-shadow: 0 5px 0 rgba(36, 38, 59, .9); will-change: transform; }
.st-loupe > svg { animation: st-pop-in .14s ease-out; }
.st-loupe.is-instant > svg { animation: none; }
.st-loupe svg { display: block; border-radius: 50%; }
.st-loupe-bg { fill: #FFFBF1; }
.st-loupe-rim { fill: none; stroke: #24263B; stroke-width: 4; }
.st-loupe-dot { fill: none; stroke: #EC4A3D; stroke-width: 2; }
.st-loupe-lbl { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); min-width: 26px; padding: 0 8px; border-radius: 12px; background: #24263B; color: #FFFBF1; font: 900 16px/24px var(--font, Nunito, sans-serif); text-align: center; }
@keyframes st-pop-in { from { transform: scale(.6); opacity: 0; } }
.st-lupa-bg { fill: #FFFBF1; }
.st-lupa-rim { fill: rgba(220, 232, 255, .18); stroke: #24263B; stroke-width: 5; }
.st-lupa-handle { stroke: #9C6B3E; stroke-width: 11; stroke-linecap: round; }
.st-lupa-layer.is-dragging .st-lupa-rim, .st-lupa-layer.is-selected .st-lupa-rim { stroke: #F5A300; }

/* ---------------------------------------------------------------- ruler */
.st-ruler-body { fill: #F2C46B; stroke: #24263B; stroke-width: 2.6; stroke-linejoin: round; }
.st-ruler-grain { stroke: #D9A04A; stroke-width: 1.4; stroke-dasharray: 18 9; opacity: .7; }
.st-ruler-dm { fill: rgba(25, 181, 200, .14); stroke: none; }
.st-ruler-tick { stroke: #24263B; stroke-width: 1.8; }
.st-ruler-tick.is-major { stroke-width: 2.4; }
.st-ruler-num, .st-ruler-unit { font-weight: 800; fill: #24263B; }
.st-ruler.is-flush .st-ruler-body { stroke: #17A565; }
.st-ruler.is-selected .st-ruler-body { stroke: #F5A300; stroke-width: 3.4; }
.st-ruler-turn { width: 56px; height: 56px; min-width: 48px; min-height: 48px; border-radius: 50%; border: 3px solid #24263B; background: #FFC53D; color: #24263B; box-shadow: 0 4px 0 #24263B; touch-action: manipulation; cursor: pointer; display: inline-grid; place-items: center; }
.st-ruler-turn svg { width: 30px; height: 30px; }
[data-layout="short"] .st-ruler-turn { width: 48px; height: 48px; }

/* ---------------------------------------------------------------- grid */
.st-grid-paper { fill: #FFFBF1; }
.st-grid-lines { fill: none; stroke: #C9D6E8; stroke-width: 1.6; }
.st-grid-peg { fill: #7C8AA5; }
.st-grid-count-bg { fill: #FFC53D; stroke: #24263B; stroke-width: 2; }
.st-grid-count-n { font-weight: 900; font-size: 16px; fill: #24263B; }

/* ---------------------------------------------------------------- rail, trace, lasso, tools */
.st-rail-num { font-weight: 800; font-size: 16px; fill: #24263B; }
.st-rail-tip { fill: #24263B; }
.st-rail-body { fill: #FFC53D; stroke: #24263B; stroke-width: 2.4; }
.st-trace-done { fill: none; stroke: #17A565; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.st-trace-head { fill: #FFC53D; stroke: #24263B; stroke-width: 2.4; }
.st-lasso-rope { fill: none; stroke: #B88A4E; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 10 4; }
.st-lasso-mark { fill: rgba(255, 197, 61, .2); stroke: #F5A300; stroke-width: 3; stroke-dasharray: 6 4; }
.st-tool-obj { cursor: grab; }
.st-tool-obj.is-selected { filter: none; outline: none; }
.st-tool-obj.is-selected > * { stroke: #F5A300; }
.st-tool-obj.is-dragging { opacity: .9; }

/* ---------------------------------------------------------------- number tag + keypad */
.st-numtags { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.st-numtags[hidden] { display: none; }
.st-numtag { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 8px; min-height: 52px; border-radius: 14px; background: #fff; border: 3px solid #24263B; box-shadow: 0 4px 0 #24263B; font: 900 26px/1 var(--font, Nunito, sans-serif); color: #24263B; touch-action: manipulation; }
.st-numtag::before { content: ''; width: 10px; height: 10px; border-radius: 50%; border: 2.5px solid #24263B; background: #FFFBF1; margin-right: 2px; }
.st-numtag.is-focus { border-color: #F5A300; box-shadow: 0 4px 0 #F5A300; }
.st-numtag-slots { display: flex; gap: 4px; }
.st-numtag-slot { display: inline-grid; place-items: center; width: 30px; height: 38px; border-radius: 8px; background: #FFF6DC; border: 2px dashed #B98200; font-weight: 900; }
.st-numtag-slot.is-full { border-style: solid; background: #FFE9A8; }
.st-numtag-slot.is-fall { animation: st-fall .5s ease-in forwards; }
.st-numtag-unit { font-size: 22px; font-weight: 900; padding-left: 2px; }
.st-numtag.is-wiggle { animation: st-wiggle .42s ease-in-out; }
@keyframes st-fall { to { transform: translateY(46px) rotate(24deg); opacity: 0; } }
@keyframes st-wiggle { 20% { transform: translate(-50%, -50%) rotate(-6deg); } 50% { transform: translate(-50%, -50%) rotate(5deg); } 80% { transform: translate(-50%, -50%) rotate(-3deg); } }
.st-keypad { display: grid; gap: 6px; justify-content: center; align-content: center; }
.st-keypad[hidden] { display: none; }
.st-keypad[data-lay="wide"] { grid-template-columns: repeat(3, 56px); grid-auto-rows: 56px; gap: 8px; }
.st-keypad[data-lay="short"] { grid-template-columns: repeat(4, 48px); grid-auto-rows: 48px; }
.st-keypad[data-lay="tall"] { grid-template-columns: repeat(6, 52px); grid-auto-rows: 52px; }
.st-key { min-width: 48px; min-height: 48px; border-radius: 14px; border: 3px solid #24263B; background: #fff; color: #24263B; font: 900 26px/1 var(--font, Nunito, sans-serif); box-shadow: 0 4px 0 #24263B; touch-action: manipulation; cursor: pointer; display: grid; place-items: center; padding: 0; }
.st-key:active { transform: translateY(3px); box-shadow: 0 1px 0 #24263B; }
.st-key svg { width: 28px; height: 28px; }
.st-key.is-ok { background: #17A565; color: #fff; }
.st-key.is-back { background: #FFE6CC; }

/* ---------------------------------------------------------------- spots (kit dnd zones over the board) */
.st-spots { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.st-spot { position: absolute; border-radius: 50%; pointer-events: none; display: grid; place-items: center; }
.st-spot::before { content: ''; position: absolute; inset: 22%; border-radius: 50%; border: 2.5px dashed rgba(36, 38, 59, .32); }
.st-spot.is-taken::before { display: none; }
.st-spot.is-slot::before { border: 3px solid #F5A300; background: rgba(255, 197, 61, .25); animation: st-arm 1.2s ease-in-out infinite; }
.tk-dnd-selecting .st-spot, .tk-dnd-active .st-spot { pointer-events: auto; }
/* parts.dnd zones laid over the board: give them .st-board-zone – inert for the board's own input, live while a kit
   dnd item is dragged or selected (the same trick the spots use) */
.st-board-zone { pointer-events: none; }
.tk-dnd-selecting .st-board-zone, .tk-dnd-active .st-board-zone { pointer-events: auto; }
.st-spot.tk-drop-ok::before { border-color: #17A565; border-style: solid; background: rgba(23, 165, 101, .12); }
.st-spot.tk-drop-over::before { border-color: #17A565; background: rgba(23, 165, 101, .3); inset: 12%; }
.st-spot > * { position: relative; }

/* ---------------------------------------------------------------- ghost wing (H3) */
.st-ghost-layer { position: fixed; inset: 0; pointer-events: none; z-index: 960; }
.st-ghost-trail { position: absolute; left: 0; top: 0; }
.st-ghost-wing { position: absolute; left: 0; top: 0; opacity: .62; transform-origin: 14px 6px; will-change: transform; }
.st-ghost-dot { fill: #A86A38; opacity: .5; animation: st-ghost-dot .9s linear forwards; }
.st-ghost-tap { fill: none; stroke: #A86A38; stroke-width: 4; animation: st-ghost-tap .7s ease-out forwards; transform-box: fill-box; transform-origin: center; }
.st-ghost-carry { position: absolute; left: 0; top: 0; width: 56px; height: 56px; opacity: .7; }
.st-ghost-carry > * { width: 100%; height: 100%; }
.st-ghost-keys { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); padding: 8px 16px; border-radius: 14px; background: rgba(36, 38, 59, .86); color: #FFFBF1; font: 900 22px/1.2 var(--font, Nunito, sans-serif); letter-spacing: 2px; }
.st-ghost-layer.is-out .st-ghost-wing { opacity: 0; transition: opacity .25s; }
@keyframes st-ghost-dot { to { opacity: 0; } }
@keyframes st-ghost-tap { from { transform: scale(.5); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }

/* ---------------------------------------------------------------- ?debug=geo */
.st-dbg { position: fixed; left: 0; top: 0; z-index: 990; pointer-events: none; }
.st-dbg-board { fill: none; stroke: #8650E6; stroke-width: 1.5; stroke-dasharray: 5 4; }
.st-dbg-canvas { fill: none; stroke: #2A6EE5; stroke-width: 1.2; }
.st-dbg-hit { fill: rgba(42, 110, 229, .08); stroke: rgba(42, 110, 229, .5); stroke-width: 1; }
.st-dbg-c { fill: #EC4A3D; }
.st-dbg-info { position: fixed; left: 8px; bottom: 8px; z-index: 991; pointer-events: none; padding: 4px 10px; border-radius: 10px; background: rgba(36, 38, 59, .85); color: #fff; font: 700 13px/1.4 system-ui, sans-serif; }
.st-dbg-info.is-bad { background: #EC4A3D; }

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  .st-arm, .st-p-sparks circle, .st-spot.is-slot::before, .st-loupe > svg { animation: none; }
}
[data-motion="reduce"] .st-arm, [data-motion="reduce"] .st-p-sparks circle, [data-motion="reduce"] .st-spot.is-slot::before, [data-motion="reduce"] .st-loupe > svg { animation: none; }

/* ---------------------------------------------------------------- dev routes (localhost + ?test=1 only, js/core/dev.js) */
.st-dev { padding: 12px 16px; overflow: auto; height: 100%; box-sizing: border-box; }
.st-dev h2 { margin: 8px 0; font-size: 1.1rem; }
.st-dev-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0; }
.st-dev-btn { min-height: 48px; min-width: 48px; }
.st-dev-plan { min-width: 90px; }
.st-dev-play { min-width: 48px; }
.st-dev-done { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 50; padding: 16px 20px; border-radius: 18px; background: #FFFBF1; border: 3px solid #24263B; box-shadow: 0 5px 0 #24263B; text-align: center; }
.st-dev-prev { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; }
.st-dev-frame { position: relative; overflow: hidden; border: 2px solid #24263B; border-radius: 8px; background: #fff; }
.st-dev-frame iframe { border: 0; transform-origin: 0 0; position: absolute; left: 0; top: 0; }
.st-dev-frame span { position: absolute; right: 4px; bottom: 2px; font: 700 11px system-ui; background: rgba(255, 255, 255, .8); }
.st-dev-json { font: 12px/1.35 ui-monospace, monospace; background: #fff; border: 2px solid #C9D6E8; border-radius: 8px; padding: 8px; max-height: 40vh; overflow: auto; white-space: pre-wrap; }
/* the #/dev/geo demos (js/geo/demo.js) */
.st-demo-dot { fill: #24263B; stroke: #FFFBF1; stroke-width: 3; }
.st-demo-target { fill: rgba(42, 110, 229, .25); stroke: #2A6EE5; stroke-width: 3; }
.st-demo-box rect { fill: #FFC53D; stroke: #24263B; stroke-width: 3; }
.st-demo-piece { fill: #19B5C8; stroke: #24263B; stroke-width: 3; stroke-linejoin: round; }
.st-demo-cell { fill: #FF9636; opacity: .8; }
.st-demo-log line { stroke: #A8743F; stroke-width: 12; }
.st-demo-faint line { stroke: #C9D6E8; stroke-width: 6; }
.st-demo-lbl { font: 800 14px var(--font, Nunito, sans-serif); fill: #5B6578; }
.st-demo-tray { display: flex; gap: 8px; justify-content: center; padding: 4px; }
.st-demo-item { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 12px; background: #FFF1C2; border: 3px solid #24263B; font: 900 24px var(--font, Nunito, sans-serif); touch-action: none; }
.st-demo-item.is-placed { position: absolute; inset: 4px; width: auto; height: auto; }
.st-dev-ctl { position: fixed; right: 6px; top: 64px; z-index: 970; display: flex; gap: 4px; padding: 4px; height: auto; overflow: visible; border-radius: 12px; background: rgba(255, 251, 241, .92); box-shadow: 0 2px 0 #24263B; }
.st-dev-ctl .tk-btn { min-height: 36px; min-width: 36px; padding: 2px 8px; font-size: .85rem; }
/* while a finger drags on the board, looping decorations hold still (the loupe re-renders the scene every frame) */
.st-geo-host.is-dragging .st-scene * { animation-play-state: paused !important; }
/* … and so do the idle loops of Tika and Šestarko beside the board (a drag is short; they resume on release) */
html.st-dragging .st-tslot *, html.st-dragging .st-buddy *, html.st-dragging .st-sest * { animation-play-state: paused !important; }
