#procedural-level{margin:0;color:#536558;font-size:.875rem;font-weight:700}
#procedural-title{font-size:clamp(1.75rem,5vw,2.6rem);margin:3px 0 12px}
#procedural-help,#procedural-status{font-size:1rem;color:#41564c}
.procedural-board{margin:14px 0;border-radius:14px}
.procedural-buttons{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.procedural-buttons button{min-height:44px;padding:7px 12px;border-radius:9px;background:#e7dfca;font-size:.875rem;font-weight:700}
#procedural-next,#marble-launch{background:#213f34;color:#fff9ed}
[data-clay="1"]{--clay:#a94938;--tint:135deg}
[data-clay="2"]{--clay:#375e85;--tint:110deg}
[data-clay="3"]{--clay:#436b47;--tint:0deg}
[data-clay="4"]{--clay:#8e601a;--tint:-65deg}
[data-clay="5"]{--clay:#735581;--tint:180deg}
[data-clay="6"]{--clay:#216d6b;--tint:55deg}
[data-clay="7"]{--clay:#a14e70;--tint:175deg}
[data-clay="8"]{--clay:#5e621f;--tint:-38deg}
[data-sprite=pedra]{background-image:url('/sprites/pedra.webp')}
[data-sprite=parafuso]{background-image:url('/sprites/parafuso.webp')}
[data-sprite=cano-reto]{background-image:url('/sprites/cano-reto.webp')}
[data-sprite=cano-curva]{background-image:url('/sprites/cano-curva.webp')}
.procedural-board.canais{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));padding:7px;gap:1px;background:#dbcca9}
.pipe-terminal{grid-column:1/-1;grid-row:1;text-align:center;font-size:clamp(.56rem,2.6vw,.78rem);font-weight:700;padding:5px 0;white-space:nowrap}
.pipe-terminal:last-child{grid-row:auto}
.procedural-board.cascata{padding:12px 4px;background:linear-gradient(120deg,#e6cba0,#f9eecd);border:1px solid #c5a275}


.procedural-board.atelier,.procedural-board.mosaico{display:grid;grid-template-columns:repeat(var(--cols),1fr);gap:2px;padding:5px;max-width:min(100%,300px);margin-inline:auto;background:#d2bd97}
.procedural-board.mosaico{background:#4c424b}
.procedural-board.atelier span,.procedural-board.mosaico span{position:relative;isolation:isolate;display:grid;place-items:center;aspect-ratio:1;border-radius:4px;background:#f0e4c7;color:white;font-size:.78rem;text-shadow:0 1px 3px #000}
.procedural-board.mosaico span{background:#382e36}
.procedural-board span.moving{outline:1px dashed #f5eee0;outline-offset:-1px}
.procedural-board.atelier span:not([data-clay="0"])::before,.procedural-board.mosaico span:not([data-clay="0"])::before{content:'';position:absolute;z-index:-1;inset:0;border-radius:5px;background:var(--clay) url('/sprites/terracota.webp') center/100% 100%;background-blend-mode:multiply}
.procedural-board.mosaico span:not([data-clay="0"])::before{background:transparent url('/sprites/esfera-musgo.webp') center/contain no-repeat;filter:hue-rotate(var(--tint));border-radius:50%}

#puzzle-grid button{background-image:linear-gradient(#435b5225,#1f34262e),url('/sprites/azulejo.webp');background-size:cover;color:#fff9ea;text-shadow:0 1px 3px #2a392e}
body[data-puzzle=pares] #puzzle-grid button:not(.lit){background:#d7c39f url('/sprites/carta.webp') center/78% 91% no-repeat;color:#603c26;text-shadow:0 1px 4px #fff}
body[data-puzzle=pares] #puzzle-grid button.lit{background:#354f69 url('/sprites/azulejo.webp') center/cover}
body[data-puzzle=luzes] #puzzle-grid button:not(.lit){background-image:linear-gradient(#19213b88,#19213b99),url('/sprites/azulejo.webp');background-size:cover}
body[data-puzzle=luzes] #puzzle-grid button.lit{background:#a6753f url('/sprites/lanterna.webp') center/contain no-repeat;color:#fff}
#river-beads button,.river-projectile{isolation:isolate;background:none;box-shadow:none;color:#fff;text-shadow:0 1px 3px #151b14}
#river-beads button::before,.river-projectile::before{content:'';position:absolute;z-index:-1;inset:0;background:url('/sprites/esfera-musgo.webp') center/contain no-repeat}
#river-board::after{background:transparent url('/sprites/pedra.webp') center/contain no-repeat;box-shadow:none}
[data-bead="0"]::before{filter:hue-rotate(108deg)}
[data-bead="1"]::before{background-image:url('/sprites/esfera-mel.webp')!important}
[data-bead="3"]::before{filter:hue-rotate(265deg) saturate(1.45)}

.procedural-board.cascata{position:relative}
.marble-flight{position:absolute;z-index:4;pointer-events:none;width:8%;aspect-ratio:1;border-radius:50%;transform:translate(-50%,-50%);background:url('/sprites/esfera-mel.webp') center/contain no-repeat;filter:drop-shadow(0 2px 2px #65492780)}

.game-feedback{position:fixed;z-index:12;pointer-events:none;transform:translate(-50%,-50%);display:grid;place-items:center;width:35px;height:35px;border-radius:50%;background:#f3d989;color:#284833;box-shadow:0 2px 8px #213e3760;font-weight:900;animation:feedback-lift .55s ease-out both}
.game-feedback.complete{width:78px;height:78px;font-size:2rem;border:4px solid #fff2c2;background:#2e5945;color:#fff7d5;animation:feedback-win 1.15s ease-out both}
@keyframes feedback-lift{from{opacity:1;transform:translate(-50%,-50%) scale(.7)}to{opacity:0;transform:translate(-50%,-145%) scale(1.1)}}
@keyframes feedback-win{0%{opacity:0;transform:translate(-50%,-50%) scale(.7)}20%,68%{opacity:1;transform:translate(-50%,-50%) scale(1)}100%{opacity:0;transform:translate(-50%,-65%)}}
@media(prefers-reduced-motion:reduce){.game-feedback,.game-feedback.complete{animation:none}}
@media(max-width:550px){
 main{padding-inline:12px}
 .game{padding-inline:10px}
 .procedural-buttons button,#new-round,#river-pause,#puzzle-new,.toolbar button{min-height:44px}
 #orchard-grid,#puzzle-grid{padding:5px;gap:4px}
 .procedural-board.atelier,.procedural-board.mosaico{max-width:min(245px,100%)}
 #reader-mini{bottom:max(8px,env(safe-area-inset-bottom));left:8px;right:8px;max-width:none;justify-content:space-between}
 #reader-mini button{padding-inline:8px}
 body.reader-minimized main{padding-bottom:130px}
 #bible-reader{max-height:calc(100dvh - 24px)}
 .reader-open #viewport{min-width:0}
}

#river-board{touch-action:none}
#river-board::after{display:none}
#river-launcher{position:absolute;left:50%;top:90%;translate:-50% -50%;width:16%;height:16%;pointer-events:none;background:url('/sprites/rio-lancador.webp') center/contain no-repeat;z-index:2}
#river-launcher::before{content:'';position:absolute;left:50%;bottom:83%;width:2px;height:150%;opacity:.78;background:repeating-linear-gradient(to top,#fff8d2 0 5px,transparent 5px 11px)}
.river-stone{position:absolute;transform:translate(-50%,-50%);isolation:isolate;display:grid;place-items:center;width:9%;aspect-ratio:1;color:#fff;text-shadow:0 1px 3px #151b14;font-size:clamp(.65rem,3vw,1rem)}
.river-stone::before{content:'';position:absolute;z-index:-1;inset:0;background:url('/sprites/rio-musgo.webp') center/contain no-repeat}
.river-stone[data-bead="0"]::before,.river-projectile[data-bead="0"]::before{background-image:url('/sprites/rio-azul.webp');filter:none}
.river-stone[data-bead="1"]::before,.river-projectile[data-bead="1"]::before{background-image:url('/sprites/rio-mel.webp')!important}
.river-stone[data-bead="3"]::before,.river-projectile[data-bead="3"]::before{background-image:url('/sprites/rio-laranja.webp');filter:none}
.river-aim{display:flex;align-items:center;gap:8px;width:100%;font-size:.875rem;font-weight:700}
.river-aim input{flex:1;min-height:44px;accent-color:#2c5444}
#river-fire{background:#315646;color:white;border-radius:9px;min-height:44px;padding:8px 16px;font-weight:700}
#river-fire:disabled{opacity:.55}

body[data-puzzle=pares] #puzzle-grid button:not(.lit){background:#dbc8a3 url('/sprites/pares-verso.webp') center/cover no-repeat}
body[data-puzzle=pares] #puzzle-grid button.lit{background:#405d77 url('/sprites/pares-frente.webp') center/cover no-repeat;color:#274339;text-shadow:none}
body[data-puzzle=luzes] #puzzle-grid button:not(.lit){background:#253a61 url('/sprites/luzes-apagada.webp') center/cover no-repeat}
body[data-puzzle=luzes] #puzzle-grid button.lit{background:#a6753f url('/sprites/luzes-acesa.webp') center/cover no-repeat}
#river-board{isolation:isolate}
#river-board::before{content:'';position:absolute;left:86%;top:80%;translate:-50% -50%;width:10%;aspect-ratio:1;background:url('/sprites/rio-saida.webp') center/contain no-repeat;pointer-events:none}
#river-beads{z-index:1}
.river-projectile::before{background-image:url('/sprites/rio-musgo.webp')}
@media(max-width:550px){
 .reader-open #viewport{max-width:100%}
 .procedural-board.canais{grid-template-columns:repeat(var(--cols),minmax(44px,1fr));overflow-x:auto}
}

.pad button{min-height:44px}
.procedural-buttons button,.toolbar button,.pad button,#puzzle-grid button,.liquid-tube,.pipe-cell,.screw-head{touch-action:manipulation}

body[data-puzzle=ordem] #puzzle-grid {
  isolation: isolate;
  gap: clamp(3px, 1vw, 6px);
  padding: 5px;
  border: clamp(9px, 2.8vw, 16px) solid #926039;
  border-color: #ecd8b0 #c0a075 #9d7752 #d7ba93;
  border-radius: 16px;
  background:
    radial-gradient(circle at 2px 2px, #59432b48 .5px, transparent 1px) 0 0 / 7px 9px,
    radial-gradient(circle at 4px 3px, #fff0cfaa .4px, transparent .92px) 0 0 / 11px 6px,
    linear-gradient(140deg, #cbb291, #e4cfaa 63%, #c3a683);
  box-shadow: inset 0 3px 8px #43200d85, inset 0 -1px 4px #48251159, 0 4px 0 #96704e, 0 7px 12px #54371d42;
}
body[data-puzzle=ordem] #puzzle-grid > button[data-cell] {
  position: relative;
  aspect-ratio: 1;
  background: #ad583a url('/sprites/ordem-peca.webp') center/cover no-repeat;
  color: #fff1d7;
  font: 500 clamp(1.8rem, 7.5vw, 3.7rem)/1 Georgia, serif;
  text-shadow: 0 2px 2px #592c17, 0 -1px 0 #fff4d78a;
  box-shadow: inset 0 2px 2px #ffd0a170, inset 0 -3px 2px #7c361a65, 0 2px 2px #4528128c;
  outline: 2px solid transparent;
  outline-offset: -3px;
}
body[data-puzzle=ordem] #puzzle-grid button:focus-visible {
  outline-color: #fff3ce;
}
#ordem-victory {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  padding: 10px;
  border: 1px solid #c99242;
  border-radius: 10px;
  background: #fff1cc;
  color: #694816;
}
#ordem-victory span {
  color: #a66b20;
}
body[data-puzzle=ordem] #puzzle-grid.ordem-solved {
  outline: 2px solid #d3a04e;
  outline-offset: 2px;
}
@media (prefers-reduced-motion: no-preference) {
  #puzzle-grid.ordem-celebrate button {
    animation: ordem-golden-glow 650ms ease-out 190ms;
  }
  #puzzle-grid.ordem-celebrate + #ordem-victory {
    animation: ordem-victory-arrive 430ms ease-out 190ms backwards;
  }
}
@keyframes ordem-golden-glow {
  40% { filter: brightness(1.32); }
}
@keyframes ordem-victory-arrive {
  from { opacity: 0; transform: translateY(7px); }
}

body[data-puzzle=luzes] #puzzle-grid {
  position:relative;
  isolation:isolate;
  padding:clamp(6px,2vw,10px);
  background:linear-gradient(150deg,#304359,#202d41);
  border:1px solid #53647a;
  box-shadow:inset 0 3px 7px #101b30,0 3px 8px #1c253c40;
}
body[data-puzzle=luzes] #puzzle-grid button[data-cell] {
  position:relative;
  isolation:isolate;
  background:#253a61 url('/sprites/luzes-apagada.webp') center/cover no-repeat;
  box-shadow:0 2px 0 #141a2b;
}
body[data-puzzle=luzes] #puzzle-grid button::before,
body[data-puzzle=luzes] #puzzle-grid button::after {
  content:'';
  position:absolute;
  inset:0;
  border-radius:inherit;
  pointer-events:none;
  opacity:0;
  transition:opacity .26s ease-out;
}
body[data-puzzle=luzes] #puzzle-grid button::before {
  background:#a6753f url('/sprites/luzes-acesa.webp') center/cover no-repeat;
}
body[data-puzzle=luzes] #puzzle-grid button::after {
  box-shadow:inset 0 0 0 1px #f9dd9b,0 0 12px #edb75580;
}
body[data-puzzle=luzes] #puzzle-grid button.lit::before,
body[data-puzzle=luzes] #puzzle-grid button.lit::after {opacity:1}
body[data-puzzle=luzes] #puzzle-grid.lights-solved {
  outline:2px solid #c79d55;
  outline-offset:2px;
}
#lights-victory {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  margin:12px 0 8px;
  padding:10px;
  border:1px solid #d8b67f;
  border-radius:10px;
  background:#fbefcf;
  color:#584325;
}
#lights-victory span {color:#967131}
#puzzle-grid.lights-celebrate::after {
  content:'';
  position:absolute;
  inset:-3px;
  border-radius:inherit;
  border:3px solid #f0c879;
  pointer-events:none;
  animation:lights-quiet-wave .95s ease-out both;
}
@keyframes lights-quiet-wave {
  from {opacity:1;transform:scale(.95);box-shadow:0 0 28px #f0c87996}
  to {opacity:0;transform:scale(1.04)}
}
@media(prefers-reduced-motion:reduce) {
  body[data-puzzle=luzes] #puzzle-grid button::before,
  body[data-puzzle=luzes] #puzzle-grid button::after {transition:none}
  #puzzle-grid.lights-celebrate::after {animation:none;display:none}
}

#orchard-grid {
  position:relative;
  isolation:isolate;
  overflow:hidden;
  touch-action:none;
  gap:clamp(3px,1vw,5px);
  padding:5px;
  box-sizing:border-box;
  border:clamp(7px,2.3vw,13px) solid transparent;
  border-radius:17px;
  background:
    linear-gradient(145deg,#535c36,#373c24) padding-box,
    linear-gradient(140deg,#c0ca8255,#38432477),url('/sprites/pomar-esmalte.webp') border-box;
  box-shadow:inset 0 2px 6px #1619069c,inset 0 0 0 1px #c8c68c72,
    0 4px 0 #4b522f,0 7px 12px #33382046;
}
#orchard-grid button {
  position:relative;
  display:grid;
  place-items:center;
  background:
    radial-gradient(circle at 1px 2px,#59442841 .42px,transparent .82px) 0 0 / 7px 8px,
    linear-gradient(148deg,#fff0d0,#ddc399);
  border-radius:14%;
  box-shadow:inset 0 1px 2px #fff6de,inset 0 -2px 2px #94724872,0 2px 1px #2a291f9c;
}
#orchard-grid button[aria-pressed=true]{outline:2px solid #365241;outline-offset:-2px;box-shadow:inset 0 0 0 4px #fff8df}
.orchard-fruit {
  pointer-events:none;
  width:77%;
  height:79%;
  background-position:center;
  background-size:contain;
  background-repeat:no-repeat;
  filter:drop-shadow(0 2px 1px #3a2a2260);
}
.orchard-fruit[data-sprite=damasco]{background-image:url('/sprites/pomar-damasco.webp')}
.orchard-fruit[data-sprite=ameixa]{background-image:url('/sprites/pomar-ameixa.webp')}
.orchard-fruit[data-sprite=folha]{background-image:url('/sprites/pomar-folha.webp')}
.orchard-fruit[data-sprite=maca]{background-image:url('/sprites/pomar-maca.webp')}
.orchard-fruit[data-sprite=pera]{background-image:url('/sprites/pomar-pera.webp')}
#orchard-progress {
  width:100%;
  height:12px;
  margin:2px 0 7px;
  accent-color:#6a7c41;
}
#orchard-victory {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  margin-bottom:8px;
  padding:9px;
  border:1px solid #d5ad66;
  border-radius:12px;
  background:#fff0c9;
  color:#55411c;
}
#orchard-victory span{color:#936325}
@media(prefers-reduced-motion:no-preference) {
  #orchard-victory.orchard-celebrate{animation:orchard-harvest-complete .64s ease-out both}
}
@keyframes orchard-harvest-complete {
  from{opacity:0;transform:translateY(7px) scale(.96)}
  60%{opacity:1;transform:translateY(0) scale(1.03);box-shadow:0 0 24px #e6bc6290}
}

#river-board{
  background:
    radial-gradient(circle at 2px 3px,#17393b38 .5px,transparent .95px) 0 0 / 7px 9px,
    radial-gradient(circle at 4px 3px,#d9e5ba32 .44px,transparent .95px) 0 0 / 11px 7px,
    linear-gradient(145deg,#739491,#436e71 58%,#294d55);
  box-shadow:inset 0 2px 12px #162f3966,0 4px 10px #284c3f28;
}
#river-launcher{
  width:15%;height:14%;
  border:1px solid #997e58;
  border-radius:45% 45% 53% 53%;
  background:
    radial-gradient(circle at 2px 2px,#654e3655 .45px,transparent .9px) 0 0 / 7px 9px,
    radial-gradient(ellipse at 38% 34%,#ffebc5,#c4a87c 82%);
  box-shadow:inset 0 2px 3px #fff1d391,0 4px 5px #1729328c;
}
#river-launcher::after{
  content:'';position:absolute;left:50%;top:35%;translate:-50% -50%;
  width:65%;aspect-ratio:1;border-radius:50%;background:#8f7656;
  box-shadow:inset 0 2px 4px #43342596;
}
#river-loaded{
  left:50%;top:35%;width:65%;z-index:1;
}
#river-effects{position:absolute;inset:0;z-index:4;pointer-events:none}
.river-stone{filter:drop-shadow(0 2px 2px #142d348f)}
.river-stone:not(.river-collect){font-size:clamp(.51rem,1.8vw,.89rem);color:#fff9e2;text-shadow:0 1px 2px #232621}
.river-projectile{z-index:5;filter:drop-shadow(0 0 5px #ffedba);animation:river-fired .2s ease-out both}
.river-ripple{position:absolute;width:12%;aspect-ratio:1;border:2px solid #f9e6b9;border-radius:50%;transform:translate(-50%,-50%);animation:river-ripple .38s ease-out both}
.river-match-ripple{border-color:#fbe193;box-shadow:0 0 14px #f9d98e}
.river-collect{animation:river-collected .42s ease-in-out both}
#river-victory{
  display:flex;align-items:center;justify-content:center;gap:12px;
  margin:10px 0;padding:10px;border-radius:11px;border:1px solid #d8ad64;background:#fff0ce;color:#57441d;
}
#river-victory span{color:#8c6027}
#river-victory.river-celebrate{animation:river-victory .7s ease-out both}
@keyframes river-fired{from{opacity:.6}to{opacity:1}}
@keyframes river-ripple{from{opacity:.9;transform:translate(-50%,-50%) scale(.4)}to{opacity:0;transform:translate(-50%,-50%) scale(1.55)}}
@keyframes river-collected{
  0%{opacity:1;transform:translate(-50%,-50%) scale(1)}
  40%{opacity:1;transform:translate(-50%,-56%) scale(1.18);filter:brightness(1.4)}
  100%{opacity:0;transform:translate(-50%,-110%) scale(.22)}
}
@keyframes river-victory{from{opacity:0;transform:translateY(7px)}60%{opacity:1;box-shadow:0 0 18px #dfbe68a6}}
@media(prefers-reduced-motion:reduce){.river-projectile,#river-victory.river-celebrate{animation:none}}

.procedural-board.aquarela {
  position:relative;
  display:grid;
  gap:16px;
  padding:12px 8px;
  border:1px solid #d7c7a9;
  border-radius:14px;
  background:
    repeating-linear-gradient(0deg,#725a3020 0 .5px,transparent 1px 3px),
    linear-gradient(155deg,#f7ecd6,#dac3a0);
  box-shadow:inset 0 2px 9px #99774526;
}
.liquid-rack {
  position:relative;
  isolation:isolate;
  display:flex;
  align-items:end;
  justify-content:center;
  gap:clamp(1px,1.5vw,9px);
  padding:0 6px 10px;
}
.liquid-rack::before {
  content:'';
  position:absolute;
  inset:auto 0 0;
  height:31px;
  border:1px solid #a36747;
  border-bottom:4px solid #8a4e37;
  border-radius:12px 12px 8px 8px;
  background:
    radial-gradient(circle at 3px 2px,#61321952 .45px,transparent .9px) 0 0 / 7px 8px,
    linear-gradient(180deg,#deb083 0%,#b27350 45%,#9f5a40 56%,#bc7854 100%);
  box-shadow:0 4px 5px #4b372072,inset 0 1px 2px #fce1b4b3;
}
.liquid-tube {
  position:relative;
  isolation:isolate;
  width:clamp(42px,14vw,57px);
  height:clamp(91px,33vw,147px);
  padding:0;
  border-radius:8px;
  background:none;
}
.liquid-tube::before {
  content:'';
  position:absolute;
  inset:auto 7% 0;
  height:12px;
  border-radius:50%;
  background:#512a1d;
  box-shadow:0 0 0 1px #e5ba8d,0 2px 3px #2e1c1585;
}
.liquid-glass {
  position:absolute;
  inset:0 9% 1%;
  border-radius:5px 5px 35% 35% / 5px 5px 12% 12%;
  background:url('/sprites/vidro.webp') center / 100% 100% no-repeat;
  filter:drop-shadow(2px 2px 1px #4d442642);
}
.liquid-glass::after{
  content:'';
  position:absolute;
  inset:7% 18% 8%;
  border-radius:inherit;
  pointer-events:none;
  background:linear-gradient(90deg,#fffcec70 4%,transparent 15% 80%,#fff5d046 90%,transparent);
}
.liquid-layer {
  position:absolute;
  left:15%;
  width:70%;
  height:20%;
  display:grid;
  place-items:center;
  color:#fff8e5;
  font-size:.78rem;
  text-shadow:0 1px 2px #241811;
  transform-origin:bottom;
  background:linear-gradient(100deg,#fff4,transparent 32%,#21110d35),var(--clay);
}
.liquid-layer:first-child{border-radius:0 0 42% 42%}
.liquid-layer:last-child{border-top:1px solid #fff8;border-radius:38% 38% 0 0 / 10% 10% 0 0}
.aquarela [data-clay="1"]{--clay:#b75d22}
.aquarela [data-clay="2"]{--clay:#266782}
.aquarela [data-clay="3"]{--clay:#27715a}
.aquarela [data-clay="4"]{--clay:#bc841b}
.aquarela [data-clay="5"]{--clay:#773957}
.aquarela [data-clay="6"]{--clay:#157772}
.liquid-tube[aria-pressed=true]{outline:2px solid #3a654a;outline-offset:1px}
.liquid-tube.liquid-full .liquid-glass{filter:drop-shadow(0 0 4px #eccd76)}
.liquid-tube.liquid-full::after{
  content:'✓';position:absolute;right:0;top:1px;display:grid;place-items:center;
  width:16px;aspect-ratio:1;border-radius:50%;background:#45664a;color:#fffbed;font-size:.69rem;font-weight:800;
}
.liquid-tube.liquid-moving{z-index:4;outline:0}
.liquid-rack:has(.liquid-moving){z-index:4}
.liquid-stream {
  position:absolute;
  z-index:5;
  height:5px;
  border-radius:50%;
  transform-origin:left center;
  background:linear-gradient(#fff7,transparent),var(--clay);
  pointer-events:none;
}
#liquid-victory {
  display:flex;align-items:center;justify-content:center;gap:11px;padding:9px;
  border:1px solid #d4af6a;border-radius:10px;background:#fff0cc;color:#624623;
}
#liquid-victory span{color:#947032}
@media(prefers-reduced-motion:no-preference) {
  .liquid-completed .liquid-glass{animation:liquid-full-glow .7s ease-out}
  #liquid-victory.liquid-celebrate{animation:liquid-celebrate .65s ease-out}
}
@keyframes liquid-full-glow{45%{filter:brightness(1.27) drop-shadow(0 0 10px #e9c054)}}
@keyframes liquid-celebrate{from{opacity:0;transform:translateY(6px)}60%{opacity:1;box-shadow:0 0 20px #e9c05480}}

.procedural-board.atelier{
  position:relative;isolation:isolate;overflow:hidden;
  gap:1px;padding:3px;border:clamp(7px,2.2vw,12px) solid #bfa57b;
  border-color:#ecd9b3 #c5a77d #ae8c62 #d7bc93;
  background:
    radial-gradient(circle at 2px 3px,#7d5d3b35 .5px,transparent .9px) 0 0 / 7px 8px,
    linear-gradient(150deg,#ead5ad,#bda178);
  box-shadow:inset 0 2px 6px #68482982,0 4px 0 #896744,0 7px 14px #48351f32;
}
.procedural-board.atelier > span{
  border-radius:2px;isolation:auto;background:#f4e4bd50;box-shadow:inset 0 0 1px #755c3b55;
}
.procedural-board.atelier > span::before{display:none}
.procedural-board.atelier i{
  position:absolute;inset:0;pointer-events:none;
  border-radius:4px;background:
    radial-gradient(circle at 2px 3px,#3c2c1a60 .4px,transparent .9px) 0 0 / 6px 7px,
    linear-gradient(145deg,#fff6cd66,#fff7d311 38%,#3c2c1a3f),var(--clay);
  box-shadow:inset 0 1px 1px #fff1b6a0,inset 0 -2px 1px #31291c70,0 1px 2px #4c362d8a;
}
.procedural-board.atelier [data-clay="0"] i{display:none}
.procedural-board.atelier [data-clay="1"]{--clay:#a95d42}
.procedural-board.atelier [data-clay="2"]{--clay:#527477}
.procedural-board.atelier [data-clay="3"]{--clay:#728148}
.procedural-board.atelier [data-clay="4"]{--clay:#af7c30}
.procedural-board.atelier [data-clay="5"]{--clay:#846582}
.procedural-board.atelier .moving{outline:none}
.procedural-board.atelier .moving i{z-index:2;box-shadow:inset 0 0 0 1px #f9eac38c,0 2px 3px #4c362d99}
#falling-victory{
  display:flex;align-items:center;justify-content:center;gap:11px;padding:9px;
  border:1px solid #d4af6a;border-radius:10px;background:#fff0cc;color:#624623;
}
#falling-victory span{color:#947032}
@media(prefers-reduced-motion:no-preference) {
  #falling-victory.falling-celebrate{animation:liquid-celebrate .65s ease-out}
}
#river-level{font-weight:700;color:#536558;font-size:.9rem}
#river-board::before{left:var(--river-end-x,86%);top:var(--river-end-y,80%)}
#river-next{min-height:44px;padding:8px 14px;border-radius:9px;background:#213f34;color:#fff9ed;font-weight:700;margin-bottom:8px}

.procedural-board.mosaico{
  position:relative;isolation:isolate;overflow:hidden;
  gap:2px;padding:4px;
  border:clamp(7px,2.2vw,13px) solid #6c474c;
  border-color:#986b69 #754f53 #53353c #855c5e;
  border-radius:14px;
  background:
    radial-gradient(circle at 2px 3px,#e5af8a25 .4px,transparent .85px) 0 0 / 7px 8px,
    linear-gradient(145deg,#5d4148,#392933);
  box-shadow:inset 0 3px 7px #1d111a9e,0 4px 0 #462b33,0 7px 12px #4b30383a;
}
.procedural-board.mosaico > span {isolation:auto;border-radius:45%;background:#2e213135;box-shadow:inset 0 1px 2px #2a1c2670}
.procedural-board.mosaico > span::before {display:none}
.procedural-board.mosaico [data-clay="1"]{--clay:#a95843}
.procedural-board.mosaico [data-clay="2"]{--clay:#486a80}
.procedural-board.mosaico [data-clay="3"]{--clay:#687446}
.procedural-board.mosaico [data-clay="4"]{--clay:#ab772b}
.procedural-board.mosaico [data-clay="5"]{--clay:#76526f}
.procedural-board.mosaico [data-clay="6"]{--clay:#3a736a}
.procedural-board.mosaico i{
  position:absolute;inset:1px 1px 2px;display:grid;place-items:center;
  border-radius:50%;font-style:normal;font-size:clamp(.51rem,2.5vw,.84rem);color:#fff1d2;
  pointer-events:none;
  background:
    radial-gradient(circle at 1px 2px,#28150d42 .35px,transparent .85px) 0 0 / 5px 6px,
    linear-gradient(145deg,#fff7cc58,#27160c27),var(--clay);
  box-shadow:inset 0 1px 2px #fff5cb95,inset 0 -3px 1px #2f201cb0,0 2px 1px #160c157e;
}
.procedural-board.mosaico [data-clay="0"] i{display:none}
.procedural-board.mosaico .moving{outline:none}
.procedural-board.mosaico .moving i{z-index:2;outline:1px solid #ffdf9ac2;box-shadow:inset 0 1px 2px #fff5cb95,inset 0 -3px 1px #2f201cb0,0 2px 4px #edb56364}

.procedural-board.canais {
  position:relative;
  isolation:isolate;
  gap:0;
  padding:6px;
  border:clamp(5px,1.8vw,10px) solid #c7a778;
  border-color:#ead8b3 #c7a778 #a48356 #d9bc91;
  border-radius:16px;
  background:
    radial-gradient(circle at 2px 2px,#68452d43 .4px,transparent .84px) 0 0 / 7px 8px,
    linear-gradient(145deg,#f0dcb6,#d7bb8d);
  box-shadow:inset 0 2px 4px #71563465,0 4px 0 #91714c,0 6px 10px #42302130;
}
.pipe-cell {
  display:block;
  position:relative;
  aspect-ratio:1;
  min-width:0;
  padding:0;
  border:0;
  border-radius:4px;
  background:
    radial-gradient(circle at 3px 3px,#946e4e43 .5px,transparent .9px) 0 0 / 12px 9px,
    linear-gradient(135deg,#f5e6c8,#ddbf95);
  box-shadow:inset 0 0 0 1px #9d7c5360,inset 0 2px 2px #fff1d76b;
}
.pipe-cell:focus-visible {z-index:2;outline-offset:-3px}
.pipe-part,.pipe-part canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.pipe-terminal{color:#3e5851;padding:5px 0;font-weight:800}
#pipe-victory{
  display:flex;align-items:center;justify-content:center;gap:10px;padding:9px;
  border:1px solid #87baba;border-radius:10px;background:#e0f1e7;color:#244c50;
}
#pipe-victory span{color:#237e91}
@media(prefers-reduced-motion:no-preference) {
  #pipe-victory.pipe-celebrate{animation:pipe-arrival .65s ease-out}
}
@keyframes pipe-arrival {from{opacity:0;transform:translateY(7px)}55%{opacity:1;box-shadow:0 0 20px #75dbee99}}

.procedural-board.parafusos {
  position:relative;aspect-ratio:1;overflow:hidden;isolation:isolate;
  border:clamp(6px,2vw,11px) solid #92613d;border-radius:15px;
  background:repeating-linear-gradient(1deg,#3e20142d 0 1px,transparent 1.5px 5px,#fff5d52b 6px 7px,transparent 8px 13px),
    repeating-linear-gradient(179deg,transparent 0 15px,#5733183b 17px,#eed0a456 19px,transparent 21px 31px),
    linear-gradient(125deg,#bd8656,#8b5031 55%,#ba8152);
  box-shadow:inset 0 0 0 1px #edc3966b,inset 0 0 18px #4423177b,0 5px 0 #663e2c,0 9px 14px #56362545;
}
.screw-plank {
  position:absolute;isolation:isolate;pointer-events:none;border-radius:100px;
  border:1px solid #472e273d;
  background:linear-gradient(145deg,#fff3d15e,transparent 34%,#2b181949),var(--clay);
  box-shadow:inset 0 2px 2px #fff0c789,inset 0 -3px 2px #41271e57,0 4px 5px #39251e9b;
}
.screw-plank::before {
  content:"";position:absolute;inset:0;border-radius:inherit;opacity:.2;
  background:url('/sprites/terracota.webp') center/cover;mix-blend-mode:soft-light;
}
.screw-plank[data-clay="1"] { --clay:#aa5d46; }
.screw-plank[data-clay="2"] { --clay:#54777a; }
.screw-plank[data-clay="3"] { --clay:#777851; }
.screw-plank[data-clay="4"] { --clay:#c08530; }
.screw-plank[data-clay="5"] { --clay:#c6b18c; }
.screw-socket {
  position:absolute;width:clamp(11px,4.3vw,21px);aspect-ratio:1;
  border-radius:50%;transform:translate(-50%,-50%);
  background:#51392f;box-shadow:0 1px 1px #fff4cc8c,inset 0 2px 3px #22160fb5;
}
.screw-socket-open { background:radial-gradient(circle at 45% 69%,#846554,#351f17 76%); }
.screw-head {
  position:absolute;display:grid;place-items:center;isolation:isolate;
  transform:translate(-50%,-50%);aspect-ratio:1;
  padding:0;border:0;border-radius:50%;background:transparent;
}
.screw-head::before {
  content:"";width:61%;aspect-ratio:1;border-radius:50%;
  background:radial-gradient(circle at 34% 23%,#f9e2af,#be9a66 54%,#755235 84%);
  border:1px solid #886543;
  box-shadow:inset 0 1px 2px #fff4d0,0 3px 4px #2b1a13b3;
}
.screw-head::after {
  content:"";position:absolute;width:42%;aspect-ratio:1;
  background:linear-gradient(145deg,#3d2618 40%,#634634 75%,#a18158);
  clip-path:polygon(36% 7%,64% 7%,65% 33%,93% 37%,93% 63%,65% 66%,64% 93%,36% 93%,35% 66%,7% 63%,7% 37%,35% 33%);
}
.screw-head:focus-visible { z-index:2;outline:2px solid #fff4ce;outline-offset:-2px; }
.screw-head-turning,.screw-plank-falling { z-index:2;pointer-events:none;will-change:transform; }
.screw-head-turning { filter:drop-shadow(0 0 6px #fff0a9); }
.screw-plank-released { box-shadow:inset 0 2px 2px #fff0c789,0 7px 9px #39251ea3,0 0 12px #ffe3a48c; }
.screw-release {
  position:absolute;z-index:3;bottom:2%;width:24%;height:12%;
  pointer-events:none;border-radius:50%;
  background:radial-gradient(ellipse,#ffcf7aa8,transparent 69%);
  animation:screw-dust 540ms ease-out both;
}
.screw-victory {
  position:absolute;z-index:3;inset:0;display:grid;place-content:center;text-align:center;
  color:#fff5d9;font-weight:850;font-size:clamp(1.2rem,5vw,2rem);
  text-shadow:0 2px 3px #492c1c;
  background:radial-gradient(ellipse,#5d742fdb,#344b2d73 58%,transparent 81%);
  animation:screw-celebrate 730ms cubic-bezier(.15,.7,.26,1.15) both;
}
@keyframes screw-dust {
  from { opacity:1;transform:translateX(-50%) scale(.35); }
  to { opacity:0;transform:translate(-50%,-35%) scale(1.7); }
}
@keyframes screw-celebrate {
  from { opacity:0;transform:scale(.68); }
  to { opacity:1;transform:none; }
}
@media(prefers-reduced-motion:reduce) {
  .screw-release { display:none; }
  .screw-victory { animation:none; }
}

.procedural-board.cascata {
  isolation:isolate;
  overflow:hidden;
  border:clamp(5px,1.7vw,10px) solid #a87950;
  border-radius:25% 25% 17px 17px / 13% 13% 17px 17px;
  padding:10px clamp(5px,1.6vw,12px) 13px;
  background:repeating-linear-gradient(94deg,#683c2012 0 1px,transparent 2px 7px),linear-gradient(125deg,#f5dbad,#debb8a 55%,#ebc795);
  box-shadow:inset 0 0 0 1px #fff0c594,inset 0 2px 10px #5f3a2455,0 4px 0 #78502f,0 7px 14px #593b292f;
}
.marble-targets { text-align:center;color:#402d21;font-weight:750;font-size:.875rem;margin:3px 18px 8px; }
.marble-hopper {
  width:clamp(35px,16%,72px);height:19px;margin:0 auto 6px;
  border:3px solid #b68958;border-radius:50% 50% 35% 35%;
  background:radial-gradient(ellipse at 50% 20%,#8a623f,#453122 72%);
  box-shadow:0 2px 3px #4d2f2a75,inset 0 2px 3px #3d281b;
}
.marble-row { display:grid;grid-template-columns:repeat(var(--marble-lanes),minmax(0,1fr));align-items:center; }
.marble-gate {
  --ramp-angle:29deg;
  position:relative;display:grid;place-items:center;isolation:isolate;
  min-height:clamp(43px,9vw,55px);padding:0;background:transparent;
  border:0;border-radius:10px;touch-action:manipulation;
}
.marble-gate[data-slope=left] { --ramp-angle:151deg; }
.marble-gate[data-slope=straight] { --ramp-angle:90deg; }
.marble-rail {
  position:absolute;z-index:-1;left:50%;top:50%;width:86%;height:clamp(10px,2.8vw,15px);
  transform-origin:0 0;transform:rotate(var(--ramp-angle)) translateY(-50%);
  border:1px solid #ad744e;border-radius:35% 72% 45% 60%;
  background:linear-gradient(#e0a373 8%,#fff2ce 17%,#efcda1 42%,#d7a475 75%,#9e6544 100%);
  box-shadow:0 3px 3px #573e3260;
  transition:transform 280ms cubic-bezier(.25,.8,.3,1.17),width 250ms ease;
}
.marble-gate[data-slope=straight] .marble-rail { width:26px; }
.marble-marker {
  display:grid;place-items:center;width:clamp(20px,5.8vw,28px);aspect-ratio:1;
  border-radius:50%;color:#482d20;font-weight:850;font-size:.82rem;
  background:radial-gradient(circle at 32% 25%,#fff0bf,#e3ad79 45%,#a16442 92%);
  box-shadow:inset 0 0 0 1px #78452650,0 3px 3px #49302268;
}
.marble-gate.passed .marble-marker { background:radial-gradient(circle at 30% 22%,#f0e7a6,#a3a16b 55%,#637044); }
.marble-gate:focus-visible { z-index:2;outline:2px solid #365744;outline-offset:-2px; }
.marble-trays { gap:3px;margin-top:10px; }
.marble-cup {
  --glaze:#9d513a;--lip:#f1ab84;--inside:#592b21;
  position:relative;isolation:isolate;display:grid;place-items:end center;
  height:clamp(29px,8vw,52px);padding-bottom:3px;
  border-radius:18% 18% 35% 35% / 30% 30% 55% 55%;
  color:#fff9e7;font-size:clamp(.72rem,3.4vw,1rem);font-weight:800;
  background:radial-gradient(ellipse at 29% 34%,#ffffff2b,transparent 61%),linear-gradient(95deg,var(--inside),var(--glaze) 24%,var(--glaze) 68%,var(--inside));
  box-shadow:inset 0 -4px 2px #281b183d,0 4px 5px #59362865;
}
.marble-cup::before {
  content:"";position:absolute;inset:-2px 0 auto;height:34%;
  border:2px solid var(--lip);border-radius:50%;
  background:radial-gradient(ellipse at 58% 85%,var(--glaze),var(--inside) 70%);
}
.marble-cup[data-glaze="1"] { --glaze:#49677a;--lip:#a5bcc7;--inside:#273844; }
.marble-cup[data-glaze="2"] { --glaze:#65713b;--lip:#bdc087;--inside:#333e21; }
.marble-cup[data-glaze="3"] { --glaze:#a97423;--lip:#ffcb73;--inside:#63421b; }
.marble-cup[data-glaze="4"] { --glaze:#753e58;--lip:#ca90a4;--inside:#3a2330; }
.marble-cup[data-glaze="5"] { --glaze:#376964;--lip:#8fbab0;--inside:#203d39; }
.marble-cup[data-glaze="6"] { --glaze:#8e5044;--lip:#deb28c;--inside:#4f3226; }
.marble-cup.target { outline:2px solid #345b40;outline-offset:2px; }
.marble-cup.landed::after {
  content:"";position:absolute;top:2%;left:33%;width:34%;aspect-ratio:1;max-width:18px;
  background:url('/sprites/esfera-musgo.webp') center/contain no-repeat;
}
.marble-cup.marble-hit { animation:marble-catch 620ms ease-out both; }
.marble-victory .marble-cup { animation:marble-catch 780ms ease-out both; }
.marble-victory .marble-cup:nth-child(2n) { animation-delay:85ms; }
.marble-victory .marble-cup:nth-child(3n) { animation-delay:170ms; }
.marble-banner {
  position:absolute;z-index:5;pointer-events:none;top:48%;left:50%;width:max-content;max-width:90%;
  padding:.5em .9em;border-radius:100px;border:1px solid #d3bb79;
  background:#fff4d7;color:#2e4d38;font-weight:850;box-shadow:0 4px 18px #58733e70;
  transform:translate(-50%,-50%);animation:marble-fanfare 1450ms ease-out both;
}
.marble-flight { width:clamp(14px,5.4%,25px);background-image:url('/sprites/esfera-musgo.webp'); }
@keyframes marble-catch {
  0% { transform:scale(1); }
  26% { transform:translateY(2px) scale(1.08,.88);filter:brightness(1.45); }
  58% { transform:translateY(-4px) scale(.97,1.05); }
  100% { transform:none;filter:none; }
}
@keyframes marble-fanfare {
  0% { opacity:0;transform:translate(-50%,-35%) scale(.8); }
  24% { opacity:1;transform:translate(-50%,-50%) scale(1); }
  77% { opacity:1; }
  100% { opacity:0;transform:translate(-50%,-76%) scale(1); }
}
@media(prefers-reduced-motion:reduce) {
  .marble-rail { transition:none; }
  .marble-cup.marble-hit,.marble-victory .marble-cup,.marble-banner { animation:none; }
  .marble-banner { position:static;display:block;margin:14px auto 2px;transform:none; }
}

#mosaic-pace{color:#655143;font-size:.85rem;font-weight:650}
.procedural-board.mosaico [data-clay="7"]{--clay:#a8a6a3}
.procedural-board.mosaico [data-clay="7"] i{color:#434646;box-shadow:inset 0 1px 2px #fffbeb, inset 0 -3px 1px #565354,0 2px 1px #160c157e}
.procedural-board.atelier{border-width:clamp(8px,2.6vw,15px);border-radius:17px;padding:3px;box-shadow:inset 0 3px 4px #70523897,inset 0 0 0 1px #fff1d084,0 4px 0 #906c48,0 7px 14px #48351f32}
.procedural-board.atelier .joins-left i{left:-.5px;border-top-left-radius:0;border-bottom-left-radius:0}
.procedural-board.atelier .joins-right i{right:-.5px;border-top-right-radius:0;border-bottom-right-radius:0}
.procedural-board.atelier .joins-up i{top:-.5px;border-top-left-radius:0;border-top-right-radius:0}
.procedural-board.atelier .joins-down i{bottom:-.5px;border-bottom-left-radius:0;border-bottom-right-radius:0;box-shadow:inset 0 1px 1px #fff1b640}

body[data-puzzle=luzes] #puzzle-grid{
  gap:clamp(3px,1vw,6px);
  border:clamp(7px,2.5vw,13px) solid #25334c;
  border-color:#536680 #354764 #1e2b44 #3c506d;border-radius:16px;
  background:radial-gradient(circle at 2px 2px,#98aabd37 .5px,transparent .9px) 0 0/7px 8px,linear-gradient(145deg,#344763,#1c293f);
  box-shadow:inset 0 4px 9px #111a30ac,0 4px 0 #1b263a,0 8px 13px #20304b38;
}
body[data-puzzle=luzes] #puzzle-grid button[data-cell]{border-radius:12%;box-shadow:inset 0 1px 3px #9ab5cb50,inset 0 -2px 2px #111e34,0 2px 0 #141d30}
body[data-puzzle=luzes] #puzzle-grid button::before{
  background:radial-gradient(ellipse at 45% 46%,#fff6c179,transparent 64%),#a6753f url('/sprites/luzes-acesa.webp') center/cover no-repeat;
}
body[data-puzzle=luzes] #puzzle-grid button::after{box-shadow:inset 0 0 0 1px #ffe2a5,inset 0 0 8px #f4c679,0 0 14px #edb75580}
