/* Família "em Ação" — design Membrana */
.via { display: grid; gap: 16px; }
.via-grade { display: grid; grid-template-columns: 300px minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .via-grade { grid-template-columns: 260px minmax(0, 1fr); } .via-grade .bandejas { grid-column: 1 / -1; } }
@media (max-width: 760px) { .via-grade { grid-template-columns: 1fr; } .via-grade .trilho-card { order: 3; } }

.cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cab .tabs { margin: 0; }
.cab .opts { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.cab select { font: inherit; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); }
.sec[hidden] { display: none; }

/* ---------- trilho ---------- */
.trilho-card { padding: 14px; }
.trilho-card h2 { font-size: .95rem; }
.trilho { width: 100%; height: auto; display: block; }
.tr-rail { fill: none; stroke: var(--line-2); stroke-width: 3; stroke-dasharray: 2 5; stroke-linecap: round; }
.tr-seta { fill: none; stroke: var(--line-2); stroke-width: 2.2; }
.tr-ponta { fill: var(--line-2); }
.tr-etapa.feita .tr-seta { stroke: var(--prog); }
.tr-etapa.feita .tr-ponta { fill: var(--prog); }
.tr-etapa.atual .tr-seta { stroke: var(--prog); stroke-dasharray: 4 4; animation: anda 1.2s linear infinite; }
@keyframes anda { to { stroke-dashoffset: -16; } }
.tr-no circle { fill: var(--surface); stroke: var(--line-2); stroke-width: 2.5; cursor: pointer; transition: fill .2s, stroke .2s; }
.tr-no.feito circle { fill: var(--prog); stroke: var(--prog); }
.tr-no.atual circle { stroke: var(--prog); stroke-width: 3.5; animation: pulsa 1.4s ease-in-out infinite; }
.tr-no:hover circle, .tr-no:focus-visible circle { stroke: var(--ink); }
@keyframes pulsa { 50% { r: 12; } }
.tr-rotulo { font: 600 11px var(--font); fill: var(--ink-2); pointer-events: none; }
.tr-no.feito .tr-rotulo { fill: var(--ink); }
.tr-enz { font: 500 9.5px var(--font); fill: var(--prog); }
.tr-badge { fill: var(--surface); stroke: var(--line-2); stroke-width: 1.5; }
.tr-badge-n { font: 700 9px var(--font); fill: var(--ink-3); text-anchor: middle; pointer-events: none; }
.tr-etapa.feita .tr-badge { fill: var(--prog); stroke: var(--prog); }
.tr-etapa.feita .tr-badge-n { fill: #fff; }
.tr-etapa.atual .tr-badge { stroke: var(--prog); stroke-width: 2.5; }
.tr-seta.entra { stroke: var(--ink-3); }
.tr-enz.lateral { fill: var(--ink-3); }
.tr-etapa.feita .tr-enz.lateral { fill: var(--prog); }

/* ---------- palco ---------- */
.palco-card { padding: 16px; position: relative; overflow: hidden; }
.palco-card h2 { display: flex; align-items: baseline; gap: .5em; flex-wrap: wrap; font-size: 1rem; }
.palco-card h2 .num { font-family: var(--display); font-size: 1.6rem; color: var(--prog); }
.compart { font-size: .8rem; color: var(--ink-3); margin-left: auto; letter-spacing: .06em; text-transform: uppercase; }
.palco {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; min-height: 260px;
  padding: 14px; border-radius: 18px; border: 2px dashed transparent;
  background:
    radial-gradient(60% 80% at 50% 50%, color-mix(in srgb, var(--prog) 10%, transparent), transparent 70%),
    repeating-radial-gradient(circle at 30% 20%, transparent 0 14px, color-mix(in srgb, var(--prog) 5%, transparent) 14px 16px),
    var(--surface-2);
  transition: border-color .15s, background-color .15s;
}
.palco.alvo { border-color: color-mix(in srgb, var(--prog) 55%, transparent); }
.palco.sobre { border-color: var(--prog); background-color: color-mix(in srgb, var(--prog) 12%, var(--surface-2)); }
.palco.treme { animation: treme .35s; }
@keyframes treme { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.palco.reagindo .no-palco { animation: funde .9s ease-in forwards; }
@keyframes funde { 60% { transform: scale(.9); filter: brightness(1.3); } 100% { transform: scale(.4); opacity: 0; } }
@media (max-width: 640px) { .palco { grid-template-columns: 1fr; min-height: 0; } }
.zona { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 120px; padding: 8px 6px 10px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 60%, transparent); }
.z-rotulo { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.vazio { margin: auto; color: var(--ink-3); font-size: .82rem; text-align: center; padding: 10px; border: 1.5px dashed var(--line-2); border-radius: 12px; }
.no-palco { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); animation: entra .25s ease-out; }
@keyframes entra { from { transform: scale(.7); opacity: 0; } }
.no-palco .nome { font-size: .78rem; font-weight: 600; text-align: center; max-width: 150px; }
.no-palco.fixo { background: color-mix(in srgb, var(--prog) 8%, var(--surface)); }
.no-palco.novo { outline: 2px solid var(--prog); }
.no-palco.sobe { animation: sobe 1.6s ease-out forwards; }
@keyframes sobe { 0% { transform: translateY(14px); opacity: 0; } 25% { transform: none; opacity: 1; } 100% { transform: translateY(-6px); opacity: .9; } }
.remover { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); font-size: 14px; line-height: 1; cursor: pointer; }
.blob { display: block; width: 56px; height: 44px; background: radial-gradient(120% 120% at 30% 25%, color-mix(in srgb, var(--prog) 50%, #fff) 0%, var(--prog) 45%, color-mix(in srgb, var(--prog) 70%, #000) 100%);
  border-radius: 46% 54% 52% 48% / 58% 44% 56% 42%; box-shadow: inset 0 -3px 6px rgba(0,0,0,.18); position: relative; }
.blob::after { content: ""; position: absolute; left: 50%; top: 56%; width: 22px; height: 12px; transform: translate(-50%, -50%); border-radius: 50% 50% 40% 40%; background: rgba(0,0,0,.18); }
.blob.grande { width: 110px; height: 86px; }
.blob.grande::after { width: 44px; height: 24px; }

.acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.acoes .placar { margin-left: auto; font-size: .85rem; color: var(--ink-3); }
.msg { min-height: 1.5em; margin-top: 10px; font-weight: 600; font-size: .95rem; }
.msg.erro { color: var(--danger); }
.msg.ok { color: var(--ok); }
.explica { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); font-size: .93rem; }
.explica p { margin: .4em 0 0; }
.balanco { margin-top: 14px; padding: 14px; border-radius: 14px; background: color-mix(in srgb, var(--prog) 10%, var(--surface)); }
.balanco h3 { font-size: 1rem; margin-bottom: .4em; }
.balanco table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.balanco td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.balanco td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.pequeno { font-size: .82rem; }

/* ---------- bandejas ---------- */
.bandejas { display: grid; gap: 12px; }
.bandeja-card { padding: 12px; }
.bandeja-card h2 { font-size: .9rem; margin-bottom: 8px; }
.bandeja { display: flex; flex-wrap: wrap; gap: 6px; touch-action: none; }
.peca { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  font: inherit; color: var(--ink); cursor: grab; text-align: center; max-width: 150px; transition: transform .1s, box-shadow .15s, border-color .15s; user-select: none; -webkit-user-select: none; }
.peca:hover { border-color: var(--prog); box-shadow: var(--shadow); transform: translateY(-1px); }
.peca:active { cursor: grabbing; }
.peca .nome { font-size: .74rem; font-weight: 600; line-height: 1.2; }
.peca.enzima { flex-direction: row; gap: 8px; text-align: left; max-width: none; width: 100%; padding: 5px 8px; }
.peca.enzima .blob { width: 34px; height: 27px; flex: none; }
.peca.enzima .blob::after { width: 14px; height: 7px; }
.peca.enzima .nome { font-size: .8rem; }
.peca.no-palco-ja { opacity: .45; }
.ficha-svg { width: 84px; height: 38px; }
.ficha-txt { font: 700 15px var(--font); fill: #fff; text-anchor: middle; }
.no-palco.cof .ficha-svg { width: 100px; height: 46px; }
.peca.metab .formula { height: auto; max-height: 90px; width: 70px; }
.fantasma { position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -50%) scale(1.05); box-shadow: var(--shadow-lg); opacity: .95; }
.fantasma.enzima { width: 190px; }

/* ---------- fórmulas ---------- */
.formula { width: auto; display: block; }
.fm-a { font: 600 12px var(--mono); fill: var(--ink); text-anchor: middle; }
.fm-s { font: 500 10.5px var(--mono); fill: var(--ink-2); }
.fm-b { stroke: var(--ink-2); stroke-width: 1.3; stroke-linecap: round; }
.no-palco.metab .formula { max-width: 150px; }

/* ---------- revisão ---------- */
.revisao { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); font-size: .92rem; }
.rev-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.rev-eq { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rev-m { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.rev-m small { font-size: .7rem; color: var(--ink-2); max-width: 110px; text-align: center; }
.rev-m .formula { max-height: 110px; width: auto; }
.rev-f .ficha-svg { width: 72px; height: 32px; }
.rev-mais, .rev-seta { font-size: 1.2rem; color: var(--ink-3); padding: 0 2px; }
.rev-seta { font-size: 1.6rem; color: var(--prog); }

/* ---------- galeria / objetivos ---------- */
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gal-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.gal-item .formula { max-height: 180px; width: auto; }
.gal-nome { font-size: .8rem; font-weight: 600; text-align: center; }
.lista-tipos dt { font-weight: 700; margin-top: .6em; color: var(--prog); }
.lista-tipos dd { margin: 0; }
.obj-lista { counter-reset: n; list-style: none; padding: 0; display: grid; gap: 8px; }
.obj-lista li { counter-increment: n; display: flex; align-items: center; gap: 12px; }
.obj-lista li::before { content: counter(n); display: grid; place-items: center; width: 30px; height: 30px; flex: none; color: #fff; font-weight: 700;
  background: var(--prog); border-radius: 46% 54% 52% 48% / 58% 44% 56% 42%; }

/* modo livre: sem ajudas */
body.livre .palco-card h2 .muted { display: none; }

/* celular: peças de enzima em "chips" (cabem várias por linha) e barra fixa com o que está no palco */
.palco-mini { display: none; }
@media (max-width: 760px) {
  .peca.enzima { width: auto; flex: 1 1 calc(50% - 6px); min-width: 0; }
  .peca.enzima .blob { width: 24px; height: 19px; }
  .peca.enzima .nome { font-size: .74rem; }
  .palco-mini.visivel { display: flex; position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 30;
    align-items: center; gap: 6px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg, 0 6px 24px rgba(0,0,0,.18)); }
  .palco-mini .pm-txt { flex: 1; min-width: 0; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .palco-mini .btn { flex: none; }
}
