:root {
  --verde: #00843d;
  --verde-escuro: #006431;
  --verde-claro: #e7f5ec;
  --amarelo: #f5c400;
  --amarelo-escuro: #d9a900;
  --texto: #1d2420;
  --texto-suave: #5b6660;
  --branco: #ffffff;
  --sombra: 0 10px 40px rgba(0, 40, 20, .25);
  --raio: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe6d8; }
body {
  font-family: Poppins, system-ui, sans-serif;
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#app, #cena { position: fixed; inset: 0; width: 100%; height: 100%; }
#cena { display: block; outline: none; }
#cena.arrastando { cursor: grabbing; }
#cena.sobre-produto { cursor: pointer; }

/* ---------- Botões ---------- */
.btn {
  border: 0; border-radius: 999px; padding: 14px 26px;
  font-weight: 600; font-size: 16px; line-height: 1;
  transition: transform .15s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled] { opacity: .6; cursor: default; }
a.btn { display: block; text-align: center; text-decoration: none; }
.btn-primario { background: var(--verde); color: #fff; }
.btn-primario:hover:not(:disabled) { background: var(--verde-escuro); }
.btn-amarelo { background: var(--amarelo); color: var(--verde-escuro); }
.btn-amarelo:hover { background: var(--amarelo-escuro); }
.btn-claro { background: var(--verde-claro); color: var(--verde-escuro); }

/* ---------- Entrada ---------- */
.tela {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 30% 20%, rgba(0,132,61,.55), rgba(0,70,35,.85));
  backdrop-filter: blur(4px);
  z-index: 30;
}
.entrada-card {
  width: min(460px, 100%); background: #fff; border-radius: 26px; padding: 30px 28px 26px;
  box-shadow: var(--sombra); text-align: center;
}
.entrada-logo { width: 130px; height: auto; }
.entrada-card h1 { font-size: 24px; line-height: 1.25; margin: 14px 0 8px; color: var(--verde-escuro); }
.entrada-card h1 span { color: var(--verde); font-weight: 800; }
.entrada-card p { margin: 0 0 18px; color: var(--texto-suave); font-size: 14.5px; line-height: 1.5; }
.entrada-dicas { display: grid; gap: 8px; margin-bottom: 20px; text-align: left; }
.dica { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--texto-suave); background: #f4f8f5; border-radius: 12px; padding: 9px 12px; }
.dica kbd { font: 600 12px Poppins, sans-serif; background: #fff; border: 1px solid #d4ddd7; border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px; color: var(--texto); }
.dica .ico { font-size: 17px; }
.so-touch { display: none; }
body.touch .so-touch { display: flex; }
body.touch .so-desktop { display: none; }
#btn-entrar { width: 100%; font-size: 17px; padding: 16px; }
.barra { height: 4px; background: #e6eee9; border-radius: 4px; margin-top: 14px; overflow: hidden; }
#barra-progresso { height: 100%; width: 0; background: var(--amarelo); transition: width .2s; }

/* ---------- HUD ---------- */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  pointer-events: none;
}
#hud > * { pointer-events: auto; }
.hud-logo { width: 74px; background: #fff; border-radius: 12px; padding: 6px 8px; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
#atalhos { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; padding: 2px; }
#atalhos::-webkit-scrollbar { display: none; }
#atalhos button {
  flex: none; border: 0; background: rgba(255,255,255,.92); color: var(--verde-escuro);
  font-size: 13px; font-weight: 600; padding: 8px 13px; border-radius: 999px;
  box-shadow: 0 3px 12px rgba(0,0,0,.12);
}
#atalhos button:hover { background: #fff; }
.btn-carrinho {
  position: relative; display: flex; align-items: center; gap: 10px; border: 0;
  background: var(--verde); color: #fff; padding: 10px 16px 10px 14px; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,80,40,.35); font-weight: 600;
}
.btn-carrinho .badge {
  position: absolute; top: -5px; left: 26px; min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--amarelo); color: var(--verde-escuro); border-radius: 10px; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.btn-carrinho.pulo { animation: pulo .45s; }
@keyframes pulo { 30% { transform: scale(1.12); } 60% { transform: scale(.96); } }

#mapa {
  position: fixed; left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 9; margin: 0;
  width: 270px; background: rgba(255,255,255,.94); border-radius: 14px; padding: 6px 6px 7px;
  box-shadow: 0 6px 22px rgba(0,40,20,.2);
}
#mapa canvas { display: block; border-radius: 9px; cursor: pointer; }
#mapa figcaption { font-size: 11px; font-weight: 600; color: var(--verde-escuro); padding: 1px 4px 5px; display: flex; justify-content: space-between; }
#mapa figcaption span { color: var(--texto-suave); font-weight: 500; }
body.touch #mapa { bottom: auto; top: calc(max(12px, env(safe-area-inset-top)) + 54px); left: 12px; width: 210px; padding: 4px; }
body.touch #mapa figcaption { display: none; }

#mira {
  position: fixed; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 0 0 2px rgba(0,0,0,.25);
  pointer-events: none; z-index: 5;
}
#dica-alvo {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 6;
  background: rgba(255,255,255,.96); border-radius: 14px; padding: 10px 16px; box-shadow: var(--sombra);
  font-size: 14px; text-align: center; pointer-events: none; max-width: calc(100% - 32px);
}
#dica-alvo b { display: block; color: var(--verde-escuro); font-size: 15px; }
#dica-alvo .p { color: var(--verde); font-weight: 700; }
#dica-alvo small { color: var(--texto-suave); }

#aviso-caixa {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 7;
  display: flex; align-items: center; gap: 14px; background: var(--verde); color: #fff;
  border-radius: 999px; padding: 8px 8px 8px 22px; box-shadow: var(--sombra); font-weight: 600; white-space: nowrap;
}
#toast {
  position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 12;
  background: var(--texto); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--sombra); max-width: calc(100% - 32px); text-align: center;
}
.voando {
  position: fixed; z-index: 20; width: 70px; height: 70px; border-radius: 14px; object-fit: cover;
  box-shadow: var(--sombra); pointer-events: none; background: #fff;
  transition: transform .75s cubic-bezier(.5,-0.2,.4,1), opacity .75s;
}

/* ---------- Joystick ---------- */
#joystick {
  position: fixed; left: 28px; bottom: max(28px, env(safe-area-inset-bottom)); z-index: 8;
  width: 124px; height: 124px; border-radius: 50%;
  background: rgba(255,255,255,.28); border: 2px solid rgba(255,255,255,.7);
  backdrop-filter: blur(2px);
}
#joystick-pino {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: rgba(255,255,255,.92); box-shadow: 0 4px 14px rgba(0,0,0,.25);
}

/* ---------- Modais ---------- */
.modal { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; padding: 16px; }
.modal-fundo { position: absolute; inset: 0; background: rgba(10,30,20,.55); }
.modal-card {
  position: relative; background: #fff; border-radius: 24px; box-shadow: var(--sombra);
  width: min(820px, 100%); max-height: calc(100% - 16px); overflow: auto; user-select: text; -webkit-user-select: text;
  animation: sobe .25s ease-out;
}
@keyframes sobe { from { transform: translateY(16px); opacity: 0; } }
.fechar {
  position: absolute; top: 10px; right: 12px; z-index: 2; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: #f0f4f1; font-size: 24px; line-height: 1; color: var(--texto);
}
.produto { display: grid; grid-template-columns: 1fr 1.1fr; }
.produto-foto { background: #f6f8f6; display: grid; place-items: center; padding: 18px; border-radius: 24px 0 0 24px; }
.produto-foto img { width: 100%; max-width: 360px; aspect-ratio: 1; object-fit: contain; }
.produto-info { padding: 28px 26px 22px; display: flex; flex-direction: column; gap: 8px; }
.etiqueta { align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--verde-escuro); background: var(--verde-claro); padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.produto-info h2 { margin: 2px 0 0; font-size: 22px; line-height: 1.25; padding-right: 30px; }
.preco-linha { display: flex; align-items: baseline; gap: 10px; }
.preco { font-size: 28px; font-weight: 800; color: var(--verde); }
.preco-de { color: var(--texto-suave); text-decoration: line-through; font-size: 15px; }
.promo { color: #b26b00; font-size: 13px; font-weight: 600; }
.promo:empty, .preco-de:empty { display: none; }
.produto-info p { margin: 0; font-size: 14px; color: var(--texto-suave); line-height: 1.5; }
details { background: #f6f8f6; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; }
details summary { font-weight: 600; cursor: pointer; color: var(--verde-escuro); }
details ul { margin: 8px 0 0; padding-left: 18px; max-height: 180px; overflow: auto; color: var(--texto-suave); line-height: 1.55; }
.acoes { display: flex; gap: 12px; margin-top: 8px; }
.qtd { display: flex; align-items: center; border: 2px solid #e1e8e3; border-radius: 999px; }
.qtd button { width: 40px; height: 44px; border: 0; background: none; font-size: 20px; color: var(--verde-escuro); }
.qtd span { min-width: 26px; text-align: center; font-weight: 700; }
#mp-add { flex: 1; }
#mp-link { font-size: 13px; color: var(--verde); text-align: center; }

.gaveta-card {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: #fff;
  display: flex; flex-direction: column; padding: 22px 20px max(20px, env(safe-area-inset-bottom));
  box-shadow: var(--sombra); animation: entra .25s ease-out; user-select: text; -webkit-user-select: text;
}
@keyframes entra { from { transform: translateX(30px); opacity: 0; } }
.gaveta-card h2 { margin: 4px 0 14px; font-size: 22px; color: var(--verde-escuro); }
#gaveta-lista { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; display: grid; gap: 10px; align-content: start; }
#gaveta-lista li { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; background: #f6f8f6; border-radius: 14px; padding: 8px; }
#gaveta-lista img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 10px; }
#gaveta-lista .nome { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
#gaveta-lista .sub { font-size: 13px; color: var(--verde); font-weight: 700; margin-top: 3px; }
#gaveta-lista .qtd { border-width: 1px; background: #fff; }
#gaveta-lista .qtd button { width: 30px; height: 32px; font-size: 17px; }
#gaveta-vazio { color: var(--texto-suave); font-size: 14px; padding: 20px 4px; flex: 1; }
.gaveta-rodape { border-top: 1px solid #e6ece8; padding-top: 14px; display: grid; gap: 10px; }
.gaveta-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; }
.gaveta-total strong { font-size: 24px; color: var(--verde); }
.nota { margin: 0; font-size: 12.5px; color: var(--texto-suave); }

@media (max-width: 720px) {
  .produto { grid-template-columns: 1fr; }
  .produto-foto { border-radius: 24px 24px 0 0; padding: 12px; }
  .produto-foto img { max-width: 220px; }
  .produto-info { padding: 18px 18px 18px; }
  .produto-info h2 { font-size: 19px; }
  .hud-logo { width: 58px; }
  #atalhos button { font-size: 12px; padding: 7px 11px; }
  .btn-carrinho .total { display: none; }
  #aviso-caixa { bottom: auto; top: 76px; font-size: 14px; }
}
