/* Configurador "Monte sua árvore" — tokens e componentes .lmda-* */
.lmda {
  --v: #1f3b2e;
  --v2: #2c5240;
  --fundo: #f7f4ee;
  --linha: #e2dccf;
  --linha-forte: #cfc8b8;
  --txt: #17201c;
  --txt2: #5b645f;
  --sel: #eaf3ed;
  --thumb: #f3f1ec;
  --ouro: #c9952b;
  --pix: #17703d;
  --erro: #b3261e;
  --off: #e3262f;
  --raio: 16px;
  --titulo: var(--fonte-titulo, Poppins, sans-serif);
  position: relative;
  width: 100%;
  max-width: 1180px;
  margin: 20px auto 40px;
  border-radius: 20px;
  background: var(--fundo);
  color: var(--txt);
  font: 15px/1.45 var(--fonte-texto, Inter, sans-serif);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}
.lmda * { box-sizing: border-box; }
.lmda button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.lmda :focus-visible { outline: 3px solid var(--ouro); outline-offset: 2px; }
.lmda h1, .lmda h2, .lmda h3, .lmda h4 { font-family: var(--titulo); }

/* topo */
.lmda-topo { padding: 18px 24px; background: linear-gradient(120deg, #1f3b2e, #2c5240); color: #fff; border-radius: 20px 20px 0 0; }
.lmda-topo h1 { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.lmda-topo p { margin: 4px 0 0; font-size: 14px; opacity: .8; }

/* corpo: palco à esquerda (sticky), controles à direita */
.lmda-corpo { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(360px, 1fr); }
.lmda-col, .lmda-ctrl, .lmda-esc { min-width: 0; }
.lmda-col { position: sticky; top: calc(var(--site-topo-h, 0px) + 12px); align-self: start; padding: 18px 0 18px 18px; z-index: 2; }

/* palco */
.lmda-palco {
  position: relative; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 14px; background: #2a2118;
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.lmda-palco.zoom { touch-action: none; cursor: grab; }
.lmda-palco.arrastando { cursor: grabbing; }
.lmda-palco canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.lmda-selo {
  position: absolute; left: 12px; bottom: 12px; z-index: 4; margin: 0; padding: 5px 12px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #fff; font: 600 13px/18px var(--titulo); pointer-events: none;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.lmda-carregando {
  position: absolute; right: 12px; top: 12px; z-index: 4; margin: 0; padding: 5px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .92); color: var(--v); font-size: 12px; font-weight: 600;
}
.lmda-zbt { position: absolute; right: 12px; bottom: 12px; z-index: 4; display: flex; flex-direction: column; gap: 6px; }
.lmda-zbt button {
  width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .94); color: var(--v);
  font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.lmda-zbt button[disabled] { opacity: .45; cursor: default; }
.lmda-zdica {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 4; margin: 0; padding: 4px 10px;
  border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; pointer-events: none; white-space: nowrap;
}

/* vista Foco/Ambiente */
.lmda-vista { display: inline-flex; gap: 2px; margin: 12px 0 0; padding: 3px; border-radius: 999px; background: #ebe5d9; }
.lmda-vista button {
  min-height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.lmda-vista button[aria-pressed="true"] { background: var(--v); color: #fff; }

/* lista "Sua árvore" (só desktop) */
.lmda-esc { margin-top: 12px; background: #fff; border: 1px solid var(--linha); border-radius: 14px; padding: 12px 14px; }
.lmda-esc h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--v); display: flex; justify-content: space-between; align-items: baseline; }
.lmda-esc h3 small { font: 400 12px var(--fonte-texto, Inter, sans-serif); color: var(--txt2); }
.lmda-esc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.lmda-esc li { display: grid; grid-template-columns: 36px 1fr auto 32px; gap: 10px; align-items: center; font-size: 13px; line-height: 1.25; }
.lmda-esc li img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: var(--thumb); }
.lmda-esc li small { display: block; color: var(--txt2); }
.lmda-esc li strong { font-weight: 600; white-space: nowrap; }
.lmda-tirar {
  width: 32px; height: 32px; border: 0; border-radius: 50%; background: #f4efe6; color: var(--erro);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.lmda-tirar:hover { background: #fbe4e2; }

/* controles */
.lmda-ctrl { padding: 18px 22px 24px; display: grid; gap: 14px; align-content: start; scroll-margin-top: calc(var(--site-topo-h, 0px) + 8px); }
.lmda-passo { background: #fff; border: 1px solid var(--linha); border-radius: var(--raio); padding: 18px; box-shadow: 0 2px 10px rgba(31, 59, 46, .05); }
.lmda-passo-topo { display: flex; align-items: flex-start; gap: 10px; }
.lmda-passo-topo h2 { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 700; color: var(--v); outline: none; }
.lmda-dica { margin: 2px 0 0; font-size: 13.5px; color: var(--txt2); }
.lmda-voltar {
  flex: none; width: 36px; height: 36px; margin-top: -2px; border: 1.5px solid var(--linha); border-radius: 50%;
  background: #fff; font-size: 17px; line-height: 1; cursor: pointer;
}
.lmda-voltar:hover { background: var(--sel); border-color: var(--v); }

/* barra de etapas */
.lmda-etapas ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.lmda-etapas li { position: relative; }
.lmda-etapas li + li::before {
  content: ""; position: absolute; top: 14px; right: calc(50% + 16px); width: calc(100% - 32px); height: 2px; border-radius: 2px; background: var(--linha);
}
.lmda-etapas li.feita::before, .lmda-etapas li.atual::before { background: var(--v); }
.lmda-etapas button {
  position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0;
  border: 0; background: none; font-size: 11.5px; line-height: 1.15; cursor: pointer; text-align: center; color: var(--txt2);
}
.lmda-etapas button:disabled { cursor: default; opacity: .5; }
.lmda-etapa-n {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--linha-forte);
  background: #fff; color: var(--txt2); font: 600 12px var(--titulo);
}
.lmda-etapas .feita .lmda-etapa-n { border-color: var(--v); background: var(--sel); color: var(--v); }
.lmda-etapas .atual .lmda-etapa-n { border-color: var(--v); background: var(--v); color: #fff; box-shadow: 0 0 0 4px rgba(31, 59, 46, .12); }
.lmda-etapas .atual .lmda-etapa-t { font-weight: 700; color: var(--v); }
.lmda-qt {
  position: absolute; top: -6px; left: calc(50% + 7px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--ouro); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px;
}

/* grupos e chips */
.lmda-grupo { margin-top: 16px; }
.lmda-grupo h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.lmda-grupo--volt { padding: 12px; border-radius: 12px; background: #fff7e8; border: 1.5px solid var(--ouro); }
.lmda-grupo--volt h4 { color: var(--erro); }
.lmda-grupo--volt.ok { background: var(--sel); border-color: var(--v); }
.lmda-grupo--volt.ok h4 { color: var(--v); }
.lmda-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }

.lmda-op { position: relative; display: flex; min-width: 0; }
.lmda-chip {
  position: relative; flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 58px;
  padding: 6px 10px 6px 6px; border: 1.5px solid var(--linha); border-radius: 12px; background: #fff;
  font-size: 13.5px; line-height: 1.25; cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.lmda-chip > span:last-child { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.lmda-chip:hover { border-color: #9db3a7; }
.lmda-chip--txt { padding-left: 14px; }
.lmda-chip img { width: 44px; height: 44px; flex: none; object-fit: contain; border-radius: 8px; background: var(--thumb); }
.lmda-chip small { display: block; margin-top: 2px; font: 700 13px var(--titulo); color: var(--pix); }
.lmda-chip[aria-checked="true"] { border-color: var(--v); box-shadow: inset 0 0 0 1px var(--v), 0 4px 12px rgba(31, 59, 46, .14); background: var(--sel); }
.lmda-chip[aria-checked="true"]::after {
  content: "\2713"; position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--v); color: #fff; font-size: 12px; font-weight: 800; line-height: 22px; text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.lmda-chip:disabled { opacity: .45; cursor: not-allowed; }
.lmda-chip:disabled small { color: var(--txt2); }
.lmda-cores { display: flex; flex-direction: column; gap: 3px; margin-left: -4px; flex: none; }
.lmda-cores i { display: block; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.lmda-lupa {
  position: absolute; left: 2px; bottom: 2px; z-index: 1; width: 24px; height: 24px; padding: 0; border: 0;
  border-radius: 50%; background: rgba(255, 255, 255, .95); font-size: 11px; line-height: 1; cursor: zoom-in; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.lmda-off {
  display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--off); color: #fff;
  font: 700 11px/18px var(--titulo); letter-spacing: .02em;
}

/* stepper de kits */
.lmda-qtds { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 8px; }
.lmda-qtd { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--v); }
.lmda-qtd button {
  width: 34px; height: 34px; border: 1.5px solid var(--v); border-radius: 50%; background: #fff; color: var(--v);
  font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer;
}
.lmda-qtd button:disabled { opacity: .35; cursor: default; }

/* revisão */
.lmda-rev { list-style: none; margin: 8px 0 0; padding: 0; }
.lmda-rev > li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid #efe9de; font-size: 14px; }
.lmda-rev > li:last-child { border-bottom: 0; }
.lmda-rev > li.vazia span { color: var(--txt2); }
.lmda-rev strong { display: block; font: 600 14px var(--titulo); color: var(--v); }
.lmda-rev ul { margin: 2px 0 0; padding-left: 18px; font-size: 13px; color: var(--txt2); }
.lmda-link { flex: none; min-height: 34px; padding: 0 4px; border: 0; background: none; color: var(--v); font-size: 13px; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* rodapé de compra */
.lmda-pe {
  position: sticky; bottom: 0; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 16px;
  padding: 14px 22px; background: rgba(255, 255, 255, .97); border-radius: 0 0 20px 20px; box-shadow: 0 -6px 20px rgba(0, 0, 0, .07);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.lmda-pe-precos { min-width: 0; }
.lmda-pe-de { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; color: var(--txt2); }
.lmda-pe-de:empty { display: none; }
.lmda-pe-total { display: block; font: 700 24px/1.15 var(--titulo); color: var(--pix); letter-spacing: -.01em; white-space: nowrap; }
.lmda-pe-total small { font-size: 14px; font-weight: 600; }
.lmda-pe-parc { margin: 0; font-size: 12.5px; color: var(--txt2); }
.lmda-pe-msg { grid-column: 1 / -1; margin: 0; font-size: 13px; line-height: 18px; color: var(--txt2); }
.lmda-pe-msg:empty { display: none; }
.lmda-pe-msg.erro { color: var(--erro); font-weight: 600; }
.lmda-add {
  min-height: 52px; padding: 0 28px; border: 0; border-radius: 999px; background: var(--v); color: #fff !important;
  font: 700 16px var(--titulo); cursor: pointer; white-space: nowrap; box-shadow: 0 6px 16px rgba(31, 59, 46, .25);
  transition: background .15s, transform .1s;
}
.lmda-add:hover { background: var(--v2); }
.lmda-add:active { transform: scale(.98); }
.lmda-add:disabled { opacity: .6; cursor: progress; }

/* modal de foto grande */
.lmda-foto {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 14, 12, .88);
}
.lmda-foto figure { margin: 0; display: grid; justify-items: center; gap: 10px; }
.lmda-foto img { max-width: min(94vw, 900px); max-height: 78vh; object-fit: contain; border-radius: 12px; background: #fff; }
.lmda-foto figcaption { color: #fff; font-size: 15px; text-align: center; }
.lmda-foto-x {
  position: fixed; top: 12px; right: 12px; width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .15); color: #fff; font-size: 28px; line-height: 1; cursor: pointer;
}


/* ---------- tablet e celular ---------- */
@media (max-width: 899px) {
  .lmda { --palco-h: clamp(190px, 56vw, 34vh); margin: 0; border-radius: 0; box-shadow: none; }
  .lmda-topo { border-radius: 0; padding: 10px 16px; }
  .lmda-topo h1 { font-size: 17px; }
  .lmda-topo p { display: none; }
  .lmda-corpo { grid-template-columns: minmax(0, 1fr); }
  .lmda-col {
    position: sticky; top: var(--site-topo-h, 0px); z-index: 4; padding: 0; background: var(--fundo);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .12);
  }
  .lmda-palco { aspect-ratio: auto; height: var(--palco-h); border-radius: 0; }
  .lmda-vista { position: absolute; left: 8px; top: 8px; z-index: 5; margin: 0; background: rgba(235, 229, 217, .92); }
  .lmda-vista button { min-height: 32px; padding: 0 11px; font-size: 12px; }
  .lmda-selo { left: 8px; bottom: 8px; padding: 3px 10px; font-size: 11.5px; }
  .lmda-zbt { right: 8px; bottom: 8px; flex-direction: row; }
  .lmda-zbt button { width: 36px; height: 36px; font-size: 18px; }
  .lmda-carregando { top: 8px; right: 8px; }
  .lmda-esc { display: none; }
  .lmda-ctrl { padding: 14px 12px 20px; gap: 12px; scroll-margin-top: calc(var(--site-topo-h, 0px) + var(--palco-h) + 8px); }
  .lmda-passo { padding: 14px; border-radius: 14px; }
  .lmda-passo-topo h2 { font-size: 18px; }
  .lmda-etapas .lmda-etapa-t { display: none; }
  .lmda-etapas .atual .lmda-etapa-t { display: block; position: absolute; top: 33px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
  .lmda-etapas { padding-bottom: 14px; }
  .lmda-chips { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

  .lmda-pe { border-radius: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); gap: 2px 12px; }
  .lmda-pe-total { font-size: 21px; }
  .lmda-pe-total small { font-size: 12.5px; }
  .lmda-pe-parc { font-size: 12px; }
  .lmda-add { min-height: 50px; padding: 0 20px; font-size: 15px; }
}
@media (max-width: 480px) {
  .lmda-add-extra { display: none; }
  .lmda-pe-parc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 340px) {
  .lmda-chips { grid-template-columns: minmax(0, 1fr); }
  .lmda-pe-total { font-size: 19px; }
  .lmda-add { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .lmda-chip, .lmda-add { transition: none; }
}
