:root{
  --pv-madeira: #B98A5C;  --pv-madeira-lado: #7A5533; --pv-madeira-rustica: #D9A978; --pv-rustica-lado: #9A6A3C;
  --pv-linho: #EEF1F4;    --pv-juta: #E9DCC3;
  --pv-metal: #B8C2CC;    --pv-metal-lado: #6C7A88;   --pv-visor: #1E2630;
  --pv-plastico: #FFD166; --pv-plastico-lado: #C99A22; --pv-visor-plastico: #22313A;
  --pv-peca: #F1EDE4;     --pv-peca-lado: #B9AE9C;    --pv-peca-tinta: #1A2130;
  --pv-chapa: #E8EEF4;    --pv-chapa-lado: #9AA8B8;
  --pv-ativa: #2F6FED;    --pv-ativa-lado: #1F4FB0;
  --pv-casa-clara: #d9dfd5; --pv-casa-escura: #6b8f71;
  --pv-mar: #2E6FA8; --pv-mar-claro: #3F86C2; --pv-casco: #9AA8B8; --pv-casco-lado: #5F6C7A;
  --pv-acerto: #E8834A; --pv-trilho: #5B3A22; --pv-dormente: #8B6142;
}
html.night{
  --pv-mar: #1F4E78; --pv-mar-claro: #2B6296; --pv-casco: #6B7887; --pv-casco-lado: #3A4450;
  --pv-acerto: #D9733C; --pv-trilho: #2A1B10; --pv-dormente: #6B4A30;
}

.lf-board, .lx-grid, .mz-board, .ch-board, .pp-board{
  border-radius: 14px;
}
.lx-grid, .ch-board{
  background: var(--pv-madeira) url("img/madeira.webp") center / cover;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 0 var(--pv-madeira-lado), 0 8px 12px rgba(0,0,0,.25);
}
.mz-board{
  border: 5px solid transparent;
  background: url("img/linho.webp") padding-box, linear-gradient(var(--pv-juta), var(--pv-juta)) padding-box, url("img/madeira.webp") center / cover border-box, linear-gradient(var(--pv-madeira-rustica), var(--pv-madeira-rustica)) border-box;
  box-shadow: inset 0 3px 4px rgba(42,23,3,.35), 0 4px 0 var(--pv-rustica-lado), 0 8px 12px rgba(0,0,0,.25);
}
.lf-board{
  border: 5px solid transparent;
  border-radius: 8px;
  background: linear-gradient(var(--pv-visor), var(--pv-visor)) padding-box, repeating-linear-gradient(90deg, rgba(255,255,255,.07) 0 1px, rgba(0,0,0,.06) 1px 3px) border-box, linear-gradient(160deg, rgba(255,255,255,.32), rgba(255,255,255,0) 35%, rgba(0,0,0,.2) 85%) border-box, linear-gradient(var(--pv-metal), var(--pv-metal)) border-box;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.6), 0 3px 0 var(--pv-metal-lado), 0 7px 10px rgba(0,0,0,.3);
}
.pp-board{
  border: 6px solid transparent;
  border-radius: 16px;
  background: linear-gradient(var(--pv-visor-plastico), var(--pv-visor-plastico)) padding-box, linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,.1) 20%, rgba(255,255,255,0) 55%, rgba(0,0,0,.07)) border-box, linear-gradient(var(--pv-plastico), var(--pv-plastico)) border-box;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.55), 0 4px 0 var(--pv-plastico-lado), 0 8px 12px rgba(0,0,0,.25);
}

.lf-board{
  overflow: hidden;
  width: 58%;
  height: 80%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  padding: 6px;
}
.lf-row{ display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
.lf-row b, .lf-row i, .lf-drop{
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: clamp(9px, 1.15vw, 13px);
  line-height: 1;
  font-style: normal;
}
.lf-row i{ background: rgba(255,255,255,.04); }
.lf-row b{
  background: linear-gradient(170deg, rgba(255,255,255,.3), rgba(255,255,255,0) 50%), var(--pv-chapa);
  color: var(--pv-peca-tinta);
  box-shadow: 0 2px 0 var(--pv-chapa-lado), 0 3px 3px rgba(0,0,0,.35);
}
.lf-row b.lf-drop{
  background: linear-gradient(170deg, rgba(255,255,255,.3), rgba(255,255,255,0) 50%), var(--pv-ativa);
  color: #fff;
  box-shadow: 0 2px 0 var(--pv-ativa-lado), 0 3px 3px rgba(0,0,0,.35);
  animation: lf-fall 2.6s cubic-bezier(.5,0,.8,.6) infinite;
}
@keyframes lf-fall{
  0%   { transform: translateY(-330%); opacity: 0; }
  12%  { opacity: 1; }
  62%  { transform: translateY(0); opacity: 1; }
  88%  { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(0); opacity: 0; }
}

.lx-grid{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  width: 58%;
  padding: 6px;
}
.lx-grid span{
  aspect-ratio: 1;
  min-width: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,.25), rgba(255,255,255,0) 55%), var(--pv-peca);
  border-radius: 4px;
  box-shadow: 0 2px 0 var(--pv-peca-lado), 0 3px 3px rgba(0,0,0,.22);
  font-weight: 700;
  font-size: clamp(9px, 1.15vw, 13px);
  line-height: 1;
  color: var(--pv-peca-tinta);
}
.lx-grid span.hit{
  background: linear-gradient(180deg, rgba(255,255,255,.25), rgba(255,255,255,0) 55%), var(--pv-ativa);
  color: #fff;
  box-shadow: 0 2px 0 var(--pv-ativa-lado), 0 3px 3px rgba(0,0,0,.22);
  animation: lx-pop 2.8s ease-in-out infinite;
}
.lx-grid span.hit:nth-child(7){ animation-delay: .12s; }
.lx-grid span.hit:nth-child(8){ animation-delay: .24s; }
.lx-grid span.hit:nth-child(9){ animation-delay: .36s; }
.lx-grid span.hit:nth-child(10){ animation-delay: .48s; }
@keyframes lx-pop{
  0%, 55%, 100% { transform: scale(1); }
  65% { transform: scale(1.14); box-shadow: 0 4px 0 var(--pv-ativa-lado), 0 6px 8px rgba(0,0,0,.3); }
}

.mz-board{ width: 70%; height: 80%; padding: 6px; display: flex; }
.mz-board svg{ width: 100%; height: 100%; }
.mz-walls{ fill: none; stroke: #8B6142; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.mz-path{ fill: none; stroke: #8B6142; stroke-width: 1.6; stroke-dasharray: 2 4; stroke-linecap: round; opacity: .35; }
.mz-goal{ fill: none; stroke: #6B4A30; stroke-width: 1.6; }
.mz-goal-dot{ fill: #6B4A30; opacity: .35; }
.mz-me{
  fill: #F4ECE1;
  filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.45));
  transform: translate(17px, 15px);
  animation: mz-anda 6s linear infinite;
}
@keyframes mz-anda{
  0%    { transform: translate(17px, 15px); opacity: 0; }
  4%    { opacity: 1; }
  15.5% { transform: translate(17px, 55px); }
  24.1% { transform: translate(39px, 55px); }
  39.6% { transform: translate(39px, 15px); }
  48.2% { transform: translate(61px, 15px); }
  63.7% { transform: translate(61px, 55px); }
  72.2% { transform: translate(83px, 55px); }
  80%   { transform: translate(83px, 35px); opacity: 1; }
  92%   { transform: translate(83px, 35px); opacity: 1; }
  100%  { transform: translate(83px, 35px); opacity: 0; }
}

.ch-board{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 44%;
  padding: 7px;
}
.ch-board span{
  aspect-ratio: 1;
  min-width: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(13px, 1.9vw, 22px);
  line-height: 1;
  color: #111827;
  background: var(--pv-casa-clara);
}
.ch-board span:nth-child(8n+2), .ch-board span:nth-child(8n+4),
.ch-board span:nth-child(8n+5), .ch-board span:nth-child(8n+7){
  background: var(--pv-casa-escura);
}
.ch-board span:nth-child(-n+4):nth-child(n+1), .ch-board span:nth-child(n+5):nth-child(-n+8){ color: #111827; text-shadow: 0 0 1px rgba(255,255,255,.45); }
.ch-board span:nth-child(n+9){ color: #fff; text-shadow: 0 0 1px rgba(17,24,39,.6), 0 1px 2px rgba(17,24,39,.35); }
.ch-board span:nth-child(1){ border-top-left-radius: 5px; }
.ch-board span:nth-child(4){ border-top-right-radius: 5px; }
.ch-board span:nth-child(13){ border-bottom-left-radius: 5px; }
.ch-board span:nth-child(16){ border-bottom-right-radius: 5px; }
.ch-board span.to{
  position: relative;
  background-image: linear-gradient(rgba(245,158,11,.32), rgba(245,158,11,.32));
  box-shadow: inset 0 0 0 3px rgba(245,158,11,.65);
  animation: ch-brilho 2.4s ease-in-out infinite;
}
@keyframes ch-brilho{
  0%, 100% { box-shadow: inset 0 0 0 3px rgba(245,158,11,.65); }
  50%      { box-shadow: inset 0 0 0 3px rgba(245,158,11,.15); }
}

.pp-board{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  width: 66.25%;
  aspect-ratio: 106 / 79;
  padding: 4.375% 5.625%;
}
.pp-row{ display: flex; justify-content: center; gap: 4.545%; width: 100%; }
.pp-row i{
  --pp: #4F8FCE;
  flex: none;
  width: 21.59%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, rgba(255,255,255,.7) 0 7%, rgba(255,255,255,0) 30%), radial-gradient(circle at 50% 42%, rgba(0,0,0,0) 0 55%, rgba(0,0,0,.3) 100%), var(--pp);
  box-shadow: 0 0 0 3px rgba(0,0,0,.35), 0 3px 0 3px rgba(0,0,0,.25);
  filter: saturate(.75) brightness(.92);
}
.pp-row:nth-child(1) i:nth-child(2){ --pp: #E8834A; } .pp-row:nth-child(1) i:nth-child(3){ --pp: #D9A92A; }
.pp-row:nth-child(2) i:nth-child(1){ --pp: #3BAA83; } .pp-row:nth-child(2) i:nth-child(2){ --pp: #22B3AE; } .pp-row:nth-child(2) i:nth-child(3){ --pp: #5470E0; } .pp-row:nth-child(2) i:nth-child(4){ --pp: #8E5BD8; }
.pp-row:nth-child(3) i:nth-child(1){ --pp: #D65C8A; } .pp-row:nth-child(3) i:nth-child(2){ --pp: #EF4F5F; } .pp-row:nth-child(3) i:nth-child(3){ --pp: #8CC63F; }
.pp-row i.on{ animation: pp-luz 2.4s ease-in-out infinite; }
.pp-row:nth-child(2) i.on{ animation-delay: .8s; }
.pp-row:nth-child(3) i.on{ animation-delay: 1.6s; }
@keyframes pp-luz{
  0%, 40%, 100% { filter: saturate(.75) brightness(.92); transform: scale(1); }
  12%, 28%      { filter: saturate(1.15) brightness(1.25); transform: scale(1.08); box-shadow: 0 0 0 3px rgba(255,255,255,.35), 0 0 14px 4px var(--pp); }
}

.ck-board, .sh-board, .ln-board, .ft-board{ border-radius: 14px; }

.ck-board{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 44%;
  padding: 7px;
  background: var(--pv-madeira) url("img/madeira.webp") center / cover;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 0 var(--pv-madeira-lado), 0 8px 12px rgba(0,0,0,.25);
}
.ck-board span{
  aspect-ratio: 1;
  min-width: 0;
  display: flex; align-items: center; justify-content: center;
  background: #E9D3B0;
}
.ck-board span:nth-child(8n+2), .ck-board span:nth-child(8n+4),
.ck-board span:nth-child(8n+5), .ck-board span:nth-child(8n+7){ background: #8A5A36; }
.ck-board span:nth-child(1){ border-top-left-radius: 5px; }
.ck-board span:nth-child(4){ border-top-right-radius: 5px; }
.ck-board span:nth-child(13){ border-bottom-left-radius: 5px; }
.ck-board span:nth-child(16){ border-bottom-right-radius: 5px; }
.ck-board i{
  width: 72%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 0 46%, rgba(0,0,0,.18) 48% 54%, rgba(0,0,0,0) 56%), radial-gradient(circle at 35% 30%, rgba(255,255,255,.35), rgba(255,255,255,0) 55%), #1F2937;
  box-shadow: 0 2px 0 #0B0F17, 0 3px 3px rgba(0,0,0,.35);
}
.ck-board i.ck-clara{
  background: radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 0 46%, rgba(0,0,0,.14) 48% 54%, rgba(0,0,0,0) 56%), radial-gradient(circle at 35% 30%, rgba(255,255,255,.7), rgba(255,255,255,0) 55%), #F4ECE1;
  box-shadow: 0 2px 0 #B9AE9C, 0 3px 3px rgba(0,0,0,.3);
}
.ck-board i.ck-dama{
  box-shadow: 0 2px 0 #B9AE9C, 0 4px 0 #F4ECE1, 0 5px 0 #B9AE9C, 0 6px 5px rgba(0,0,0,.3);
  transform: translateY(-3px);
}

.sh-board{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  width: 58%;
  padding: 6px;
  border: 5px solid transparent;
  border-radius: 8px;
  background: linear-gradient(var(--pv-visor), var(--pv-visor)) padding-box, repeating-linear-gradient(90deg, rgba(255,255,255,.07) 0 1px, rgba(0,0,0,.06) 1px 3px) border-box, linear-gradient(160deg, rgba(255,255,255,.32), rgba(255,255,255,0) 35%, rgba(0,0,0,.2) 85%) border-box, linear-gradient(var(--pv-metal), var(--pv-metal)) border-box;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.6), 0 3px 0 var(--pv-metal-lado), 0 7px 10px rgba(0,0,0,.3);
}
.sh-board span{
  aspect-ratio: 1;
  min-width: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--pv-mar-claro), var(--pv-mar));
  font-weight: 700;
  font-size: clamp(9px, 1.15vw, 13px);
  line-height: 1;
  color: #fff;
}
.sh-board span.agua::after{
  content: "";
  width: 26%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255,255,255,.65);
}
.sh-board span.barco{
  background: linear-gradient(170deg, rgba(255,255,255,.3), rgba(255,255,255,0) 50%), var(--pv-casco);
  box-shadow: 0 2px 0 var(--pv-casco-lado);
  color: var(--pv-peca-tinta);
}
.sh-board span.acerto{
  background: linear-gradient(170deg, rgba(255,255,255,.3), rgba(255,255,255,0) 50%), var(--pv-acerto);
  box-shadow: 0 2px 0 rgba(0,0,0,.3);
  color: #fff;
}

.ln-board{
  width: 70%;
  height: 80%;
  padding: 6px;
  display: flex;
  background: var(--pv-madeira-rustica) url("img/madeira.webp") center / cover;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 0 var(--pv-rustica-lado), 0 8px 12px rgba(0,0,0,.25);
}
.ln-board svg{ width: 100%; height: 100%; }
.ln-dormentes{ fill: none; stroke: var(--pv-dormente); stroke-width: 9; stroke-dasharray: 2.4 3.2; }
.ln-trilho{ fill: none; stroke: var(--pv-trilho); stroke-width: 1.5; }
.ln-vagao{ fill: #3BAA83; stroke: rgba(0,0,0,.35); stroke-width: .8; }
.ln-claraboia{ fill: #FFF6E5; opacity: .7; }
.ln-carga{ fill: #5B6270; stroke: #2B1E3D; stroke-width: .9; }
.ln-conteiner{ fill: #F2C230; }
.ln-nervura{ fill: none; stroke: #2B1E3D; stroke-width: .5; opacity: .35; }
.ln-loco{ fill: #2E6BD1; stroke: #2B1E3D; stroke-width: .9; }
.ln-cabine, .ln-chamine{ fill: #2B1E3D; }
.ln-parachoque{ fill: #D8342C; }
.ln-farol{ fill: #FFE08A; }
.ln-baforada{
  fill: #FFFFFF;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: ln-baforada 2.1s ease-out infinite;
}
.ln-baforada:nth-of-type(2){ animation-delay: .7s; }
.ln-baforada:nth-of-type(3){ animation-delay: 1.4s; }
@keyframes ln-baforada{
  0%   { opacity: 0; transform: translate(0, 0) scale(.6); }
  12%  { opacity: .9; }
  100% { opacity: 0; transform: translate(-9px, -2.5px) scale(2.6); }
}

.ft-board{
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 70%;
  height: 62%;
  padding: 6px 10px;
  background: var(--pv-madeira-rustica) url("img/madeira.webp") center / cover;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 0 var(--pv-rustica-lado), 0 8px 12px rgba(0,0,0,.25);
}
.ft-board i{
  position: relative;
  width: 26%;
  aspect-ratio: 1;
  display: block;
}
.ft-board svg{ position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ft-rebaixo{ fill: rgba(42,23,3,.38); }
.ft-rebaixo-borda{ fill: none; stroke: rgba(255,255,255,.25); stroke-width: 2; }
.ft-peca{ fill: #4F8FCE; stroke: #3A6FA6; stroke-width: 3; filter: drop-shadow(0 3px 2px rgba(0,0,0,.35)); }
.ft-board i.ft-solta svg + svg{ transform: translate(14%, -26%) rotate(-12deg); }

.gr-board{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  width: 50%;
  padding: 7px;
  border-radius: 14px;
  background: #E8CB9B url("img/madeira.webp") center / cover;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 0 #B58B56, 0 8px 12px rgba(0,0,0,.25);
}
.gr-board span{
  aspect-ratio: 1;
  min-width: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  font-weight: 800;
  font-size: clamp(9px, 1.15vw, 13px);
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,.3);
}
.gr-board span.gr-a{ background: var(--mt-c0, #4F8FCE); box-shadow: 0 2px 0 var(--mt-c0-l, #3A6FA6); }
.gr-board span.gr-b{ background: var(--mt-c1, #E8834A); box-shadow: 0 2px 0 var(--mt-c1-l, #BE6230); }
.gr-board span.gr-vazia{ background: #CFAE7C; box-shadow: inset 0 2px 3px #94703F; }

.ft-board i.ft-solta svg + svg{ animation: ft-encaixa 4.2s cubic-bezier(.45,.05,.3,1) infinite; }
@keyframes ft-encaixa{
  0%, 12%   { transform: translate(14%, -26%) rotate(-12deg); }
  40%, 78%  { transform: none; }
  100%      { transform: translate(14%, -26%) rotate(-12deg); }
}

.ck-board span:nth-child(12) i{ animation: ck-salto 3.6s ease-in-out infinite; }
@keyframes ck-salto{
  0%, 18%   { transform: none; }
  32%       { transform: translate(-70%, -78%) scale(1.18); }
  44%, 74%  { transform: translate(-139%, -139%); }
  88%       { transform: translate(-70%, -78%) scale(1.18); }
  100%      { transform: none; }
}

.sh-board span.acerto{ animation: sh-acerto 2.8s ease-out infinite; }
@keyframes sh-acerto{
  0%, 30%   { transform: none; }
  38%       { transform: scale(1.25); box-shadow: 0 0 0 3px rgba(255,255,255,.55), 0 2px 0 rgba(0,0,0,.3); }
  52%, 100% { transform: none; }
}
.sh-board span.agua::after{ animation: sh-onda 2.8s ease-out infinite; }
.sh-board span.agua:nth-child(14)::after{ animation-delay: .9s; }
.sh-board span.agua:nth-child(16)::after{ animation-delay: 1.8s; }
@keyframes sh-onda{
  0%   { transform: scale(.4); opacity: .9; }
  60%  { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}

.gr-board span.gr-b{ animation: gr-encaixa 4s cubic-bezier(.45,.05,.3,1) infinite; }
@keyframes gr-encaixa{
  0%, 12%   { transform: translate(22%, -30%) rotate(7deg) scale(1.08); filter: drop-shadow(0 4px 3px rgba(0,0,0,.35)); }
  40%, 82%  { transform: none; filter: none; }
  100%      { transform: translate(22%, -30%) rotate(7deg) scale(1.08); filter: drop-shadow(0 4px 3px rgba(0,0,0,.35)); }
}

@media (prefers-reduced-motion: reduce){
  .lf-drop, .lx-grid span.hit, .mz-me, .ch-board span.to, .pp-row i.on, .ln-baforada,
  .ft-board i.ft-solta svg + svg, .ck-board span:nth-child(12) i, .sh-board span.acerto, .sh-board span.agua::after, .gr-board span.gr-b{ animation: none; }
}
