/* Shape Town – the hub (Oblikovo, §7.3) and the street (Četvrt): the valley in two compositions (wide/short: the
   river left → right through the middle band; tall: top → bottom between the columns), district plates ≥ 96 px,
   lots ≥ 72 px. Looping animations ≤ 12 on the hub, none with reduced motion. */

/* ================================================================ hub */
.st-hub { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 4px; padding: 8px 10px 4px; }
.st-valley { position: relative; min-width: 0; min-height: 0; border: 3px solid var(--ink); border-radius: 26px; box-shadow: 0 5px 0 var(--ink); overflow: hidden; background: #A5D86E; }
.st-valley-floor { position: absolute; inset: 0; }
.st-valley-floor svg { display: block; }
.st-valley-floor [data-tap] { cursor: pointer; }
.st-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.st-plates { position: absolute; inset: 0; pointer-events: none; }
.st-valley-fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; }

/* a district plate: a little diorama with its lots */
.st-plate { position: absolute; display: block; padding: 0; margin: 0; pointer-events: auto; border: 3px solid var(--ink); border-radius: 20px; background: #BFDD9A;
  box-shadow: 0 5px 0 rgba(36, 38, 59, .9); overflow: hidden; cursor: pointer; font: inherit; color: var(--ink); transition: transform .14s ease, box-shadow .14s ease; touch-action: manipulation; }
.st-plate:active, .st-plate.is-press { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.st-plate:focus-visible { outline: 4px solid var(--sky); outline-offset: 2px; }
.st-plate-art, .st-plate-art > svg { position: absolute; inset: 0; display: block; }
.st-plate-ico { position: absolute; left: 5px; top: 5px; width: 30px; height: 30px; padding: 2px; background: #fff; border: 2.5px solid var(--ink); border-radius: 10px; box-shadow: 0 2px 0 var(--ink); z-index: 2; }
.st-plate-ico svg { width: 100%; height: 100%; display: block; }
.st-plate-res { position: absolute; left: 0; top: -2px; width: 44px; height: 44px; z-index: 3; }
.st-plate-res svg { width: 100%; height: 100%; display: block; overflow: visible; }
.st-plate-res.is-wave { animation: st-wave .9s var(--ease-pop); }
@keyframes st-wave { 30% { transform: translateY(-8px) rotate(-10deg); } 60% { transform: translateY(-3px) rotate(8deg); } }
.st-plate-name { position: absolute; left: 42px; top: 6px; max-width: calc(100% - 100px); padding: 0 10px; background: var(--dc); color: #fff; border: 2.5px solid var(--ink); border-radius: 999px;
  font-weight: 1000; font-size: 16px; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 2px 0 var(--ink); z-index: 2; }
.st-plate-chip { position: absolute; right: 5px; top: 5px; padding: 0 8px; background: #fff; border: 2.5px solid var(--ink); border-radius: 999px; font-weight: 1000; font-size: 16px; line-height: 24px; box-shadow: 0 2px 0 var(--ink); z-index: 2; }
.st-plate.is-full .st-plate-chip { background: var(--sun); }
.st-plate.is-full .st-plate-name { left: 46px; }
.st-plate.is-banner .st-plate-name { left: 5px; right: 5px; top: auto; bottom: 4px; max-width: none; text-align: center; padding: 0 4px; }
.st-plate.is-sug { box-shadow: 0 5px 0 var(--ink), 0 0 0 4px var(--sun); animation: st-sugglow 1.6s ease-in-out infinite; }
@keyframes st-sugglow { 50% { box-shadow: 0 5px 0 var(--ink), 0 0 0 7px rgba(255, 197, 61, .75), 0 0 0 12px rgba(255, 197, 61, .25); } }
/* the blueprint overlay: a just-built lot's hole grows from the lot; a finished district peels it off */
.st-hole.is-new { animation: st-hole 1.3s var(--ease-pop) .5s both; }
@keyframes st-hole { from { r: 0; } }
.st-bp.is-peel { transform-box: view-box; transform-origin: 100% 0%; animation: st-peel 2s cubic-bezier(.55, 0, .75, .9) .7s forwards; }
@keyframes st-peel { 0% { transform: none; opacity: 1; } 22% { transform: rotate(5deg) translate(1%, -3%); opacity: 1; } 100% { transform: translate(-70%, 75%) rotate(-50deg) scale(.08); opacity: 0; } }
.st-plate.is-peeling { animation: st-peelpop .6s ease 2.4s; }
@keyframes st-peelpop { 50% { transform: scale(1.03); } }

/* the band: fountain on its plaza, the festive ribbon, Čarobno ogledalo on the lakeshore */
.st-hub-fountain { position: absolute; padding: 0; border: 0; background: none; cursor: pointer; z-index: 2; touch-action: manipulation; }
.st-hub-fountain .st-plaza { position: absolute; left: 0; right: 0; bottom: 0; height: 52%; border-radius: 50%; background: #E9E2D2; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  background-image: radial-gradient(circle, transparent 54%, #D8D2C4 55% 62%, transparent 63%); }
.st-hub-fountain > svg { position: absolute; left: 8%; right: 8%; bottom: 8%; width: 84%; height: 92%; display: block; }
.st-hub-fountain .st-jets { animation: st-jets 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes st-jets { 50% { transform: scaleY(1.07) scaleX(.97); } }
.st-hub-fountain.is-splash > svg { animation: st-bob .5s var(--ease-pop); }
@keyframes st-bob { 40% { transform: translateY(-6px) scale(1.04); } }
.st-drops { position: absolute; width: 0; height: 0; }
.st-drops i { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: #BDEBFA; border: 2px solid var(--ink); animation: st-drop 1s ease-out forwards; transform: rotate(var(--a)); }
@keyframes st-drop { to { transform: rotate(var(--a)) translateY(-70px) scale(.5); opacity: 0; } }
.st-hub-fin { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 3px 8px 5px; z-index: 2;
  background: #FFFBF1; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 var(--ink); font: inherit; color: var(--ink); cursor: pointer; touch-action: manipulation; }
.st-hub-fin:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.st-fin-art { display: block; width: min(100%, 150px); flex: 0 1 auto; min-height: 0; }
.st-fin-art svg { width: 100%; height: auto; max-height: 100%; display: block; }
.st-fin-lbl { font-weight: 1000; font-size: 16px; line-height: 1.15; text-align: center; }
.st-fin-count { display: grid; grid-template-columns: repeat(3, auto); gap: 3px; justify-content: center; }
.st-fin-count i { font-style: normal; font-size: 16px; line-height: 19px; font-weight: 1000; padding: 0 4px; border-radius: 8px; border: 2px solid var(--ink); background: #fff; text-align: center; }
.st-fin-count i.is-ok { background: var(--dc); color: #fff; }
.st-hub-fin.is-locked { background: #F4F1EA; }
.st-hub-fin.is-open { background: var(--sun-soft); animation: st-sugglow 1.6s ease-in-out infinite; }
.st-hub-fin.is-done { background: #FFF4C9; }
.st-hub-fin.is-compact .st-fin-lbl { display: none; }
.st-hub-fin.is-compact .st-fin-art { width: min(100%, 104px); }
.st-hub-fin.is-tiny { gap: 1px; padding: 2px 6px 4px; }
.st-hub-fin.is-tiny .st-fin-art { width: min(100%, 80px); }
.st-fin-art { flex: 0 0 auto; }
.st-hub-mirror { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; padding: 0; border: 0; background: none; z-index: 2; cursor: pointer; font: inherit; color: var(--ink); touch-action: manipulation; }
.st-hub-mirror > svg { flex: 1 1 auto; min-height: 0; width: 100%; display: block; }
.st-mirror-lbl { font-weight: 1000; font-size: 16px; line-height: 20px; background: #fff; border: 2.5px solid var(--ink); border-radius: 999px; padding: 0 8px; white-space: nowrap; box-shadow: 0 2px 0 var(--ink); }
.st-hub-mirror.is-compact .st-mirror-lbl { display: none; }
.st-hub-mirror:active > svg { transform: translateY(3px); }
.st-plane { position: absolute; width: 40px; height: 28px; margin: -14px 0 0 -20px; z-index: 6; pointer-events: none; animation: st-orbit 5s linear infinite; }
.st-plane svg { width: 100%; height: 100%; display: block; }
@keyframes st-orbit { 0% { transform: rotate(0deg) translateX(26px) rotate(0deg); } 100% { transform: rotate(-360deg) translateX(26px) rotate(360deg); } }

/* the valley floor's tap-to-animate props */
.st-ripple { animation: st-flow 3s linear infinite; }
@keyframes st-flow { to { stroke-dashoffset: -72; } }
.st-sparkles { animation: st-twinkle 1.4s ease-in-out infinite alternate; }
@keyframes st-twinkle { from { opacity: .25; } }
.st-cloud-a, .st-cloud-b { transform-box: fill-box; transform-origin: 50% 50%; transition: opacity .35s, transform .45s var(--ease-pop); }
.st-cloud-b { opacity: 0; transform: scale(.3); }
.st-cloud.is-morph .st-cloud-a { opacity: 0; transform: scale(1.3); }
.st-cloud.is-morph .st-cloud-b { opacity: 1; transform: none; }
.st-flock.is-hop .st-hop { animation: st-sheephop .9s ease-in-out; }
@keyframes st-sheephop { 45% { transform: translate(14px, -18px); } 100% { transform: translate(28px, 0); } }
.st-wheel { transform-box: fill-box; transform-origin: 50% 50%; }
.st-sawmill.is-cut .st-wheel { animation: st-spin360 1s ease-in-out 2; }
@keyframes st-spin360 { to { transform: rotate(360deg); } }
.st-sawmill.is-cut .st-log-a { animation: st-loga 2s ease forwards; }
.st-sawmill.is-cut .st-log-b { animation: st-logb 2s ease forwards; }
@keyframes st-loga { 30%, 80% { transform: translateX(-3px) rotate(-6deg); } }
@keyframes st-logb { 30%, 80% { transform: translateX(5px) rotate(8deg); } }

/* Tika, her bubble, Šestarko and the grown-ups' corner under the valley */
.st-hub-say { display: flex; align-items: flex-end; gap: 10px; min-height: 86px; min-width: 0; }
.st-hub-tika { width: clamp(76px, 9vw, 100px); flex: 0 0 auto; margin-top: -10px; }
.st-hub-bubble { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; padding-bottom: 8px; }
.st-hub-sidecol { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 12px; padding-bottom: 4px; }
.st-hub-sest { width: clamp(54px, 6vw, 72px); flex: 0 0 auto; }
.st-hub-sest .st-sest { width: 100%; height: auto; display: block; }

html[data-layout="short"] .st-hub { grid-template-columns: minmax(0, 1fr) 206px; grid-template-rows: minmax(0, 1fr); gap: 8px; padding: 6px 8px; }
html[data-layout="short"] .st-valley { border-radius: 20px; }
html[data-layout="short"] .st-hub-say { flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 4px; min-height: 0; }
html[data-layout="short"] .st-hub-bubble { order: 1; flex: 1 1 auto; align-items: flex-end; padding: 0; }
html[data-layout="short"] .st-hub-tika { order: 2; width: 72px; margin: 0; align-self: flex-start; }
html[data-layout="short"] .st-hub-sidecol { order: 3; justify-content: space-between; padding: 0; }
html[data-layout="short"] .st-hub-tika { position: relative; }
html[data-layout="short"] .st-hub-sidecol { position: absolute; right: 4px; bottom: 4px; flex-direction: row; align-items: flex-end; gap: 8px; }
html[data-layout="short"] .st-hub-sest { width: 46px; }
html[data-layout="short"] .st-hub .st-parents-btn { width: 48px; min-width: 48px; min-height: 48px; padding: 0; justify-content: center; }
html[data-layout="short"] .st-hub .st-parents-btn > span { position: absolute; width: 1px; height: 1px; overflow: hidden; overflow: clip; clip-path: inset(50%); white-space: nowrap; }
html[data-layout="short"] .st-plate { border-radius: 16px; }
html[data-layout="short"] .st-plate-ico { width: 26px; height: 26px; border-radius: 8px; }
html[data-layout="short"] .st-plate-res { width: 38px; height: 38px; }

html[data-layout="tall"] .st-hub { gap: 4px; padding: 6px 6px 4px; }
html[data-layout="tall"] .st-valley { border-radius: 20px; }
html[data-layout="tall"] .st-hub-say { min-height: 96px; gap: 6px; }
html[data-layout="tall"] .st-hub-tika { width: clamp(70px, 16vw, 104px); margin-top: -6px; }
html[data-layout="tall"] .st-hub-sidecol { flex-direction: column; align-items: center; gap: 6px; }
html[data-layout="tall"] .st-hub-sest { width: clamp(50px, 9vw, 70px); }
html[data-layout="tall"] .st-hub .st-parents-btn { width: 48px; min-width: 48px; min-height: 48px; padding: 0; justify-content: center; }
html[data-layout="tall"] .st-hub .st-parents-btn > span { position: absolute; width: 1px; height: 1px; overflow: hidden; overflow: clip; clip-path: inset(50%); white-space: nowrap; }
html[data-layout="tall"] .st-plate { border-radius: 16px; }
@media (min-width: 700px) { html[data-layout="tall"] .st-hub .st-parents-btn { width: auto; padding: 0 .9em; } html[data-layout="tall"] .st-hub .st-parents-btn > span { position: static; width: auto; height: auto; clip-path: none; } html[data-layout="tall"] .st-hub-sidecol { flex-direction: row; align-items: flex-end; } }

html[data-motion="reduce"] :is(.st-plate.is-sug, .st-hub-fin.is-open, .st-jets, .st-ripple, .st-sparkles, .st-hole.is-new, .st-bp.is-peel, .st-plate.is-peeling) { animation: none !important; }
html[data-motion="reduce"] .st-plane { animation: none; transform: translateX(26px); }
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) :is(.st-plate.is-sug, .st-hub-fin.is-open, .st-jets, .st-ripple, .st-sparkles, .st-hole.is-new, .st-bp.is-peel, .st-plate.is-peeling) { animation: none !important; }
  html:not([data-motion="full"]) .st-plane { animation: none; transform: translateX(26px); }
}
/* ================================================================ street */
.st-street { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 4px; padding: 8px 10px 4px; }
.st-road { position: relative; min-width: 0; min-height: 0; border-radius: 26px; border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink); overflow: hidden; background: #BFDD9A; }
.st-road-svg { position: absolute; inset: 0; }
.st-road-svg svg { display: block; }
.st-road-svg [data-tap] { cursor: pointer; }
.st-road-fx { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.st-lot { position: absolute; display: block; padding: 0; border: 0; border-radius: 18px; background: transparent; cursor: pointer; touch-action: manipulation; z-index: 2; }
.st-lot:focus-visible { outline: 4px solid var(--sky); outline-offset: 2px; }
.st-lot:active, .st-lot.is-press { transform: translateY(3px); }
.st-lot-art { position: absolute; inset: 0; display: block; }
.st-lot-art svg { width: 100%; height: 100%; display: block; overflow: visible; }
.st-lot:is(.is-next, .is-open, .is-locked)::before { content: ''; position: absolute; left: 4%; right: 4%; bottom: 0; height: 74%; border-radius: 16px; background: rgba(230, 240, 255, .78); border: 2px dashed var(--bp-line);
  background-image: linear-gradient(rgba(47, 111, 214, .16) 1.4px, transparent 1.4px), linear-gradient(90deg, rgba(47, 111, 214, .16) 1.4px, transparent 1.4px); background-size: 14px 14px; }
.st-lot.is-landmark:is(.is-next, .is-open, .is-locked)::before { height: 90%; }
.st-lot.is-next::before { animation: st-glowk 1.3s ease-in-out infinite; border-style: solid; border-color: var(--sun); }
.st-lot.is-locked { opacity: .62; }
.st-lot.is-locked .st-lot-art { opacity: .6; }
.st-lot.is-shimmer .st-lot-art { animation: st-shimmer .8s ease; }
@keyframes st-shimmer { 30% { opacity: 1; transform: translateY(-3px); filter: none; } 60% { opacity: .4; } }
.st-lot-flag { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); padding: 1px 10px; background: var(--sun); border: 3px solid var(--ink); border-radius: 999px; font-weight: 1000; font-size: 16px; white-space: nowrap; box-shadow: 0 3px 0 var(--ink); z-index: 3; animation: st-flagbob 1.4s ease-in-out infinite; }
@keyframes st-flagbob { 50% { transform: translateX(-50%) translateY(-3px); } }
.st-lot-lock { position: absolute; right: 4%; top: 30%; width: 30px; height: 30px; z-index: 3; }
.st-lot-n { position: absolute; left: 0; bottom: 2px; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 13px; background: #fff; border: 2px solid var(--ink); font-weight: 1000; font-size: 16px; line-height: 22px; text-align: center; z-index: 3; }
.st-lot.is-built .st-lot-n { background: var(--dc); color: #fff; }
.st-lot.is-landmark .st-lot-n { background: var(--sun); color: var(--ink); }
/* a tapped house comes alive: the door opens, a window lights, the flag and the beam move */
.st-bld.is-alive .b-door-leaf { transform-box: fill-box; transform-origin: 0% 50%; animation: st-door 2.2s ease; }
@keyframes st-door { 15%, 75% { transform: scaleX(.25); } }
.st-bld.is-alive .b-windows :is(rect, circle, path[fill="#BCE4FF"]) { animation: st-light 2.2s ease; }
@keyframes st-light { 15%, 80% { fill: #FFE45C; } }
.st-bld.is-alive .b-flag { transform-box: fill-box; transform-origin: 0% 50%; animation: st-flap .5s ease-in-out 4 alternate; }
@keyframes st-flap { to { transform: scaleX(.7) skewY(8deg); } }
.st-bld.is-alive .b-mill, .st-bld.is-alive .b-wheel { transform-box: fill-box; transform-origin: 50% 50%; animation: st-spin360 1.4s ease-in-out; }
.st-bld.is-alive .b-lit { animation: st-light 2.2s ease; }
.st-smoke { position: absolute; width: 0; height: 0; }
.st-smoke i { position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; background: #fff; border: 2px solid var(--ink); opacity: 0; animation: st-puffup 1.8s ease-out forwards; }
.st-smoke i.is-c { border-radius: 50%; }
.st-smoke i.is-s { border-radius: 2px; animation-delay: .3s; }
.st-smoke i.is-t { width: 0; height: 0; border: 0; background: none; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 13px solid #fff; animation-delay: .6s; }
.st-smoke i:nth-child(4) { animation-delay: .9s; }
@keyframes st-puffup { 0% { opacity: 0; transform: translate(0, 0) scale(.4); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(18px, -64px) scale(1.4) rotate(40deg); } }
.st-again { position: absolute; transform: translate(-50%, -100%); display: inline-flex; align-items: center; gap: 4px; min-height: 48px; min-width: 48px; padding: 2px 12px 2px 6px; z-index: 9;
  background: var(--sun); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 3px 0 var(--ink); font: inherit; font-weight: 1000; font-size: 16px; color: var(--ink); cursor: pointer; animation: st-stamp .4s var(--ease-pop); }
.st-again svg { width: 30px; height: 30px; display: block; }
.st-street-res { position: absolute; padding: 0; border: 0; background: none; cursor: pointer; z-index: 4; min-width: 48px; min-height: 48px; }
.st-street-res svg { width: 100%; height: 100%; display: block; overflow: visible; }
.st-street-res.is-wave { animation: st-wave .9s var(--ease-pop); }
.st-train { will-change: transform; }
.st-street-say { display: flex; align-items: flex-end; gap: 10px; min-height: 86px; min-width: 0; }
.st-master-btn { flex: 0 0 auto; margin-left: auto; align-self: center; }
html[data-layout="short"] .st-street { grid-template-columns: minmax(0, 1fr) 210px; grid-template-rows: minmax(0, 1fr); gap: 8px; padding: 6px 8px; }
html[data-layout="short"] .st-road { border-radius: 20px; }
html[data-layout="short"] .st-street-say { flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 4px; min-height: 0; }
html[data-layout="short"] .st-street-say .st-hub-bubble { order: 1; flex: 1 1 auto; align-items: flex-end; padding: 0; }
html[data-layout="short"] .st-street-say .st-hub-tika { order: 2; width: 72px; margin: 0; }
html[data-layout="short"] .st-master-btn { order: 3; margin: 0; font-size: 16px; }
html[data-layout="short"] .st-lot-flag { padding: 0 8px; }
html[data-layout="tall"] .st-street { padding: 6px 6px 4px; }
html[data-layout="tall"] .st-road { border-radius: 20px; }
html[data-layout="tall"] .st-street-say { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; column-gap: 8px; row-gap: 6px; min-height: 96px; }
html[data-layout="tall"] .st-street-say .st-hub-tika { width: clamp(70px, 16vw, 104px); margin-top: -6px; }
html[data-layout="tall"] .st-master-btn { grid-column: 1 / -1; margin: 0; justify-self: center; }
html[data-motion="reduce"] :is(.st-lot.is-next, .st-lot-flag, .st-smoke i) { animation: none !important; }
@media (prefers-reduced-motion: reduce) { html:not([data-motion="full"]) :is(.st-lot.is-next, .st-lot-flag, .st-smoke i) { animation: none !important; } }
