/* ===== Play Farm Agro — cena premium (vista 3D isométrica, clima, animais) ===== */
.cena {
  position: relative; border-radius: 14px; overflow: hidden; box-shadow: 0 6px 22px rgba(20, 40, 80, .25);
  background: #5aa33c; user-select: none; -webkit-user-select: none;
}

/* ---------- céu por fase do dia ---------- */
.cena .ceu {
  position: relative; height: 150px; border-radius: 0; overflow: hidden;
  background: linear-gradient(#5db7ff, #bfe6ff 75%, #e9f7ff); transition: background 3s;
}
.cena .ceu.amanhecer { background: linear-gradient(#6d8fd8, #f8b98a 70%, #ffe2b8); }
.cena .ceu.entardecer { background: linear-gradient(#4a5fa8, #f08a5d 65%, #ffcf8a); }
.cena .ceu.noite { background: linear-gradient(#071330, #1d2d5c 70%, #34467a); }
.cena .ceu.seca:not(.noite) { filter: saturate(.85) sepia(.15); }
.cena .ceu.nublado:not(.noite) { background: linear-gradient(#7d8da3, #b7c3d1 75%, #d5dde6); }

.cena .sol {
  position: absolute; width: 46px; height: 46px; border-radius: 50%; top: 18px; left: 10%;
  background: radial-gradient(#fffbe0, #ffd23f 60%, #ffb300); box-shadow: 0 0 50px 10px rgba(255, 210, 63, .55);
  transition: left 2s, top 2s, background 2s, box-shadow 2s;
}
.cena .ceu.noite .sol { background: radial-gradient(circle at 35% 35%, #fff, #dfe6f5 55%, #b8c3dc); box-shadow: 0 0 30px 6px rgba(220, 230, 255, .35); }
.cena .ceu.nublado .sol { opacity: .35; }

.cena .estrelas {
  position: absolute; inset: 0; opacity: 0; transition: opacity 3s;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 20%, #fff, transparent), radial-gradient(1px 1px at 18% 60%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 30% 15%, #fff, transparent), radial-gradient(1px 1px at 42% 40%, #fff, transparent),
    radial-gradient(2px 2px at 55% 12%, #fff, transparent), radial-gradient(1px 1px at 63% 55%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 74% 25%, #fff, transparent), radial-gradient(1px 1px at 86% 48%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 93% 10%, #fff, transparent), radial-gradient(1px 1px at 4% 45%, #fff, transparent);
  animation: piscar 4s ease-in-out infinite;
}
.cena .ceu.noite .estrelas { opacity: 1; }
@keyframes piscar { 50% { filter: brightness(.6); } }

.cena .nuvem { position: absolute; width: 90px; height: 26px; background: #fff; border-radius: 30px; opacity: .92; animation: nuvem 70s linear infinite; }
.cena .nuvem::before { content: ""; position: absolute; width: 44px; height: 40px; background: inherit; border-radius: 50%; top: -18px; left: 16px; }
.cena .nuvem::after { content: ""; position: absolute; width: 30px; height: 28px; background: inherit; border-radius: 50%; top: -10px; left: 50px; }
.cena .n1 { top: 22px; left: -120px; }
.cena .n2 { top: 52px; left: -120px; animation-delay: -35s; transform: scale(.7); }
.cena .n3 { top: 10px; left: -120px; animation-delay: -55s; transform: scale(1.2); animation-duration: 90s; }
.cena .ceu.noite .nuvem { background: #42557f; opacity: .6; }
.cena .ceu.nublado .nuvem { background: #8a97aa; }
@keyframes nuvem { to { left: 110%; } }

.cena .paisagem { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 100px; display: block; }
.cena .ceu.noite .paisagem { filter: brightness(.45) saturate(.7) hue-rotate(10deg); }
.cena .ceu.entardecer .paisagem, .cena .ceu.amanhecer .paisagem { filter: brightness(.85) sepia(.2); }
.cena .pas-silo { opacity: 0; transition: opacity .6s; }
.cena .pas-silo.on { opacity: 1; }
.cena .helice { transform-origin: 712px 46px; animation: girar 6s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.cena .janela { fill: #ffe9a8; transition: fill 2s; }
.cena .ceu.noite .janela { fill: #ffd34d; filter: drop-shadow(0 0 4px #ffd34d); }

/* ---------- chão e tabuleiro ---------- */
.cena .terreno {
  position: relative; padding: 0; border-radius: 0; box-shadow: none; overflow-x: auto; overflow-y: hidden;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.07) 2px, transparent 3px) 0 0/24px 24px,
    radial-gradient(circle at 70% 80%, rgba(0,60,0,.08) 2px, transparent 3px) 0 0/31px 31px,
    linear-gradient(#67b444, #4f9a33 60%, #3f8a2a);
  transition: filter 3s;
}
.cena.noite .terreno { filter: brightness(.55) saturate(.75) hue-rotate(-8deg); }
.cena.entardecer .terreno, .cena.amanhecer .terreno { filter: brightness(.9) sepia(.12); }
.cena.seca .terreno { filter: saturate(.8) sepia(.18); }
.cena.noite.seca .terreno { filter: brightness(.55) saturate(.6) sepia(.15); }

.tabuleiro { position: relative; margin: 0 auto; }
.tabuleiro.ferramenta-ativa { touch-action: none; }

.canteiro.iso {
  position: absolute; aspect-ratio: auto; display: block; border-radius: 0; background: none; box-shadow: none;
  pointer-events: none; animation: none; transition: none; font-size: inherit;
}
.canteiro.iso:hover { transform: none; filter: none; }
.canteiro.iso .topo {
  position: absolute; left: 0; top: 0; width: 100%; height: var(--th); pointer-events: auto; cursor: pointer;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background:
    radial-gradient(circle at 30% 40%, rgba(255,255,255,.18) 1px, transparent 2px) 0 0/9px 9px,
    linear-gradient(135deg, #8ad766, #62b545);
  transition: filter .15s;
}
.canteiro.iso .lado {
  position: absolute; left: 0; top: 0; width: 100%; height: calc(var(--th) + var(--dep)); pointer-events: none;
  clip-path: polygon(0 calc(var(--th) / 2), 50% var(--th), 100% calc(var(--th) / 2), 100% calc(var(--th) / 2 + var(--dep)), 50% calc(var(--th) + var(--dep)), 0 calc(var(--th) / 2 + var(--dep)));
  background: linear-gradient(90deg, #3f7f2a 50%, #336b22 50%);
}
.canteiro.iso.arado .topo, .canteiro.iso.plantado .topo, .canteiro.iso.pronto .topo {
  background:
    repeating-linear-gradient(26.6deg, rgba(0,0,0,0) 0 5px, rgba(40,20,5,.28) 5px 7px),
    linear-gradient(135deg, #9a6532, #6e4320);
}
.canteiro.iso.arado .lado, .canteiro.iso.plantado .lado, .canteiro.iso.pronto .lado { background: linear-gradient(90deg, #5a3618 50%, #47290f 50%); }
.canteiro.iso.regado .topo {
  background:
    repeating-linear-gradient(26.6deg, rgba(0,0,0,0) 0 5px, rgba(20,10,0,.35) 5px 7px),
    radial-gradient(ellipse at 40% 40%, rgba(140,200,255,.25), transparent 60%),
    linear-gradient(135deg, #6f4422, #4a2c12);
}
.canteiro.iso .topo:hover { filter: brightness(1.18); }
.canteiro.iso.marcado .topo { filter: brightness(1.35) drop-shadow(0 0 0 #fff); }

.canteiro.iso .planta { position: absolute; left: 0; top: 0; width: 100%; height: var(--th); pointer-events: none; }
.canteiro.iso .pl {
  position: absolute; transform: translate(-50%, -88%); line-height: 1; transition: font-size .6s;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.35)); transform-origin: 50% 100%;
}
.canteiro.iso .pl.a { left: 30%; top: 42%; }
.canteiro.iso .pl.b { left: 50%; top: 58%; }
.canteiro.iso .pl.c { left: 70%; top: 74%; }
.canteiro.iso .pl.d { left: 50%; top: 30%; }
.canteiro.iso.plantado .pl { animation: balancar 3.2s ease-in-out infinite; }
.canteiro.iso.plantado .pl.b { animation-delay: -1s; }
.canteiro.iso.plantado .pl.c { animation-delay: -2s; }
@keyframes balancar { 50% { transform: translate(-50%, -88%) rotate(4deg); } }
.canteiro.iso.pronto .pl { animation: pular 1.6s ease-in-out infinite; }
.canteiro.iso.pronto .pl.b { animation-delay: -.5s; }
.canteiro.iso.pronto .pl.c { animation-delay: -1s; }
@keyframes pular { 50% { transform: translate(-50%, -100%) scale(1.08); } }
.canteiro.iso .brilho { position: absolute; left: 64%; top: 6%; font-size: .32em; animation: cintilar 1.3s ease-in-out infinite; }
@keyframes cintilar { 0%, 100% { opacity: .2; transform: scale(.6) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(25deg); } }
.canteiro.iso .praga { position: absolute; left: 58%; top: 18%; right: auto; font-size: .3em; animation: rastejar 1.2s ease-in-out infinite; }
@keyframes rastejar { 50% { transform: translateX(6px) rotate(-10deg); } }
.canteiro.iso .gota { position: absolute; left: 22%; top: 8%; font-size: .2em; opacity: .85; }
.canteiro.iso .bar {
  position: absolute; left: 32%; right: 32%; top: 86%; height: 4px; border-radius: 4px; background: rgba(0,0,0,.45);
  box-shadow: 0 0 0 1px rgba(255,255,255,.35);
}
.canteiro.iso .bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #b6ff7a, #4fd14f); }
.canteiro.iso .escudo { position: absolute; left: 26%; top: 64%; font-size: .22em; opacity: .9; }

/* trator na vista 3D */
.cena .trator { font-size: 40px; z-index: 900; filter: drop-shadow(0 4px 2px rgba(0,0,0,.35)); }
.cena .poeira { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: rgba(160,110,60,.5); pointer-events: none; z-index: 899; animation: poeira 1s forwards; }
@keyframes poeira { to { transform: scale(3) translateY(-10px); opacity: 0; } }

/* ---------- lago, pasto, garagem ---------- */
.cena .lago {
  position: absolute; width: 22%; height: 30%; left: 2%; bottom: 6%; border-radius: 50%;
  background: radial-gradient(ellipse at 40% 35%, #9fe0ff, #3f9fd6 55%, #2a78b0);
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.15), 0 0 0 5px #c9b27c, 0 0 0 8px #8fbf5a; overflow: hidden; pointer-events: none;
}
.cena .lago::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-radial-gradient(ellipse at 50% 50%, rgba(255,255,255,0) 0 10px, rgba(255,255,255,.18) 11px 12px);
  animation: ondas 5s linear infinite;
}
@keyframes ondas { to { transform: scale(1.25); opacity: .4; } }
.cena .lago .peixe { position: absolute; font-size: 14px; animation: nadar 9s ease-in-out infinite; pointer-events: auto; cursor: pointer; z-index: 2; }
@keyframes nadar { 0%, 100% { transform: translateX(0) scaleX(1); } 49% { transform: translateX(40px) scaleX(1); } 50% { transform: translateX(40px) scaleX(-1); } 99% { transform: translateX(0) scaleX(-1); } }

.cena .bicho {
  position: absolute; font-size: 26px; cursor: pointer; z-index: 600; transform-origin: 50% 100%;
  filter: drop-shadow(0 3px 1px rgba(0,0,0,.3)); animation: passear var(--dur, 14s) ease-in-out infinite; animation-delay: var(--atraso, 0s);
}
.cena .bicho .ic { display: inline-block; animation: passo .5s ease-in-out infinite; }
@keyframes passo { 50% { transform: translateY(-2px); } }
@keyframes passear {
  0%, 100% { transform: translateX(0) scaleX(1); }
  45% { transform: translateX(var(--dx, 40px)) scaleX(1); }
  50% { transform: translateX(var(--dx, 40px)) scaleX(-1); }
  95% { transform: translateX(0) scaleX(-1); }
}
.cena .bicho .balao {
  position: absolute; left: 50%; top: -22px; transform: translateX(-50%); font-size: 13px; background: #fff; border-radius: 10px;
  padding: 1px 5px; box-shadow: 0 2px 4px rgba(0,0,0,.25); animation: pular2 1s ease-in-out infinite; white-space: nowrap;
}
@keyframes pular2 { 50% { transform: translate(-50%, -4px); } }
.cena .garagem { position: absolute; left: 3%; top: 6px; display: flex; gap: 2px; font-size: 24px; pointer-events: none; z-index: 500; }
.cena .garagem span { position: relative; filter: drop-shadow(0 3px 1px rgba(0,0,0,.3)); }
.cena .garagem small { position: absolute; right: -4px; top: -6px; font-size: 12px; }

/* ---------- chuva, vagalumes ---------- */
.cena .chuva {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 2s; z-index: 950;
  background-image:
    linear-gradient(105deg, transparent 0 48%, rgba(200,225,255,.55) 49% 50%, transparent 51%),
    linear-gradient(105deg, transparent 0 48%, rgba(200,225,255,.4) 49% 50%, transparent 51%);
  background-size: 22px 46px, 31px 63px;
  animation: chover .45s linear infinite;
}
.cena.chovendo .chuva { opacity: 1; }
@keyframes chover { to { background-position: -8px 46px, -11px 63px; } }
.cena .vagalume { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #e8ff7a; box-shadow: 0 0 8px 3px rgba(232,255,122,.7); opacity: 0; pointer-events: none; z-index: 940; }
.cena.noite .vagalume { animation: vagar 7s ease-in-out infinite; }
@keyframes vagar { 0%, 100% { transform: translate(0, 0); opacity: .2; } 30% { opacity: 1; } 50% { transform: translate(30px, -20px); } 75% { transform: translate(-10px, -40px); opacity: .9; } }

/* ---------- HUD ---------- */
.cena .hud { position: absolute; left: 8px; right: 8px; top: 8px; display: flex; justify-content: space-between; gap: 6px; z-index: 960; pointer-events: none; }
.cena .hud > div { display: flex; gap: 5px; flex-wrap: wrap; }
.cena .chip {
  pointer-events: auto; background: rgba(255,255,255,.88); border-radius: 20px; padding: 4px 10px; font: 700 11px system-ui, sans-serif;
  color: #2b3a52; box-shadow: 0 2px 6px rgba(0,0,0,.18); border: 0; backdrop-filter: blur(4px); white-space: nowrap;
}
.cena button.chip { cursor: pointer; }
.cena button.chip:active { transform: translateY(1px); }

/* ---------- partículas e celebração ---------- */
.particula { position: fixed; pointer-events: none; z-index: 80; font-size: 20px; animation: voar .9s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes voar { to { transform: translate(var(--px), var(--py)) scale(.6) rotate(var(--pr)); opacity: 0; } }
.celebrar { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(15, 25, 55, .55); animation: aparecer .25s; padding: 16px; }
.celebrar[hidden] { display: none; }
.celebrar .caixa {
  position: relative; text-align: center; background: linear-gradient(#fffdf2, #fff3c4); border: 4px solid #f5b301; border-radius: 18px;
  padding: 22px 26px; width: min(380px, 100%); box-shadow: 0 16px 40px rgba(0,0,0,.35); animation: estourar .45s cubic-bezier(.2,1.6,.4,1);
}
@keyframes estourar { from { transform: scale(.4); opacity: 0; } }
.celebrar h2 { margin: 4px 0; color: #b3540a; font-size: 26px; }
.celebrar .grande { font-size: 56px; line-height: 1; }
.celebrar ul { list-style: none; padding: 0; margin: 10px 0; text-align: left; }
.celebrar li { padding: 5px 8px; margin: 4px 0; background: rgba(255,255,255,.7); border-radius: 8px; }
.confete { position: fixed; top: -12px; width: 9px; height: 14px; z-index: 91; pointer-events: none; animation: cair var(--d, 2.6s) linear forwards; }
@keyframes cair { to { transform: translateY(105vh) rotate(720deg); } }

/* ---------- responsivo ---------- */
@media (max-width: 820px) {
  .cena { border-radius: 12px; }
  .cena .ceu { height: 118px; }
  .cena .paisagem { height: 78px; }
  .cena .bicho { font-size: 22px; }
  .cena .garagem { font-size: 19px; }
  .cena .chip { font-size: 10px; padding: 3px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .cena *, .particula, .confete { animation: none !important; }
}

/* vista plana: esconde o cenário 3D e volta ao grid simples */
.cena.plana .terreno { padding: 14px; height: auto !important; overflow: visible; }
.cena.plana #pasto, .cena.plana .lago, .cena.plana .garagem { display: none; }
.cena.plana .trator { font-size: 40px; }

/* código da fazenda */
.codigo-fazenda { font: 700 22px ui-monospace, monospace; letter-spacing: 1px; text-align: center; padding: 10px; margin: 6px 0;
  background: #fff; border: 2px dashed #c99a5b; border-radius: 10px; user-select: all; -webkit-user-select: all; }
#btnAparelho { display: block; margin: 8px auto 0; }

/* ---------- horta orgânica ---------- */
.horta-card h3 small { font-weight: 400; font-size: 12px; }
.horta-passos { font-size: 12px; background: #f0f7ea; border-left: 4px solid #5aa33c; padding: 8px 10px; border-radius: 6px; margin: 8px 0; line-height: 1.6; }
.horta-sementes { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; }
.semente-h { position: relative; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 82px; padding: 6px 6px 5px;
  border: 2px solid transparent; border-radius: 10px; background: #f3f6fc; font: 600 11px Verdana, sans-serif; color: #2b2f3a; cursor: pointer; }
.semente-h span { font-size: 24px; }
.semente-h small { font-weight: 400; color: #6b7280; font-size: 10px; }
.semente-h.sel { border-color: #5aa33c; background: #eaf7e2; }
.semente-h i { position: absolute; top: 2px; right: 3px; font-style: normal; font-size: 11px; }
.horta-ferr { box-shadow: none; padding: 4px 0; border: 0; margin: 0; }
.horta-ferr .ferr.active { border-color: #5aa33c; background: #eaf7e2; }
.horta-canteiros { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; padding: 14px; border-radius: 12px; margin-top: 6px;
  background: radial-gradient(circle at 20% 30%, rgba(255,255,255,.08) 2px, transparent 3px) 0 0/20px 20px, linear-gradient(#78bf52, #5a9f3a); }
.leito { text-align: center; cursor: pointer; user-select: none; }
.leito small { display: block; font-size: 10px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); margin-top: 3px; font-weight: 700; }
.lt-terra { position: relative; height: 78px; border-radius: 8px; display: grid; place-items: center; font-size: 26px; transition: transform .1s; overflow: hidden; }
.leito:hover .lt-terra { transform: scale(1.04); }
.leito.mato .lt-terra { background: linear-gradient(#5f9b3d, #4a8530); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.leito.limpo .lt-terra { background: linear-gradient(#b48a5a, #9c7448); }
.leito.preparado .lt-terra, .leito.adubado .lt-terra, .leito.plantado .lt-terra {
  background: repeating-linear-gradient(0deg, transparent 0 9px, rgba(0,0,0,.12) 9px 11px), linear-gradient(#5b3a1f, #47290f);
  border: 6px solid #a8743f; box-shadow: 0 5px 0 #7a4f26, 0 7px 10px rgba(0,0,0,.25); }
.leito.adubado .lt-terra { background: radial-gradient(circle at 30% 40%, #2c1a0a 2px, transparent 3px) 0 0/10px 10px, linear-gradient(#4a2e15, #36200c); }
.leito.palha .lt-terra { background: repeating-linear-gradient(35deg, rgba(232,200,110,.55) 0 3px, transparent 3px 7px), repeating-linear-gradient(-30deg, rgba(210,170,80,.5) 0 2px, transparent 2px 8px), linear-gradient(#5b3a1f, #47290f); }
.leito.seco .lt-plantas { filter: grayscale(.6) brightness(.85); transform: rotate(8deg); }
.leito.pronto .lt-terra { animation: pulsar 1.4s ease-in-out infinite; }
.lt-ic.pequeno { font-size: 14px; letter-spacing: 4px; }
.lt-plantas { letter-spacing: -2px; filter: drop-shadow(0 2px 1px rgba(0,0,0,.35)); }
.lt-praga { position: absolute; top: 4px; right: 6px; font-size: 16px; animation: rastejar 1.2s infinite; }
.lt-brilho { position: absolute; top: 2px; left: 6px; font-size: 14px; animation: cintilar 1.3s infinite; }
.lt-escudo { position: absolute; bottom: 2px; right: 4px; font-size: 12px; }
.lt-agua, .lt-cresc { display: block; height: 4px; border-radius: 3px; background: rgba(0,0,0,.35); margin: 3px 8px 0; overflow: hidden; }
.lt-agua i { display: block; height: 100%; background: linear-gradient(90deg, #4fa8ff, #9fd6ff); }
.lt-cresc i { display: block; height: 100%; background: linear-gradient(90deg, #b6ff7a, #4fd14f); }
.horta-rodape { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-weight: 700; }
.horta-real { margin-top: 10px; background: #fffdf2; border: 1px solid #ead9a8; border-radius: 10px; padding: 8px 12px; }
.horta-real summary { cursor: pointer; font-weight: 700; }
.horta-real li { margin: 5px 0; line-height: 1.45; }
@media (max-width: 600px) { .horta-canteiros { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px; } .lt-terra { height: 64px; font-size: 20px; } }
.layout > * { min-width: 0; }
.horta-card { overflow: hidden; }
.lt-erva { position: absolute; bottom: 2px; left: 4px; font-size: 18px; animation: balancar2 2s ease-in-out infinite; }
@keyframes balancar2 { 50% { transform: rotate(-8deg); } }
