/* Canetinha: botão no canto da página e janela do "Prompt". Arquivo igual nos três projetos
   (loja, lista e jogo); ao mudar, copie para os outros. */

.canetinha {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 150;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgb(15 23 42 / 12%);
  border-radius: 50%;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 6px 20px rgb(15 23 42 / 22%);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.canetinha:hover { transform: translateY(-2px) rotate(-8deg); box-shadow: 0 10px 26px rgb(15 23 42 / 28%); }
.canetinha:focus-visible { outline: 3px solid rgb(249 115 22 / 75%); outline-offset: 3px; }
body.em-jogo .canetinha { display: none; }   /* durante a partida o jogo usa a tela inteira */

.canetinha-janela {
  box-sizing: border-box;
  width: min(480px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 24px 64px rgb(0 0 0 / 30%);
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
.canetinha-janela::backdrop { background: rgb(11 17 32 / 55%); }
.canetinha-janela *, .canetinha-janela *::before, .canetinha-janela *::after { box-sizing: border-box; }
.canetinha-form { display: grid; gap: 12px; margin: 0; padding: 20px; }
.canetinha-cab { display: flex; align-items: center; gap: 10px; }
.canetinha-cab h2 { flex: 1; margin: 0; font-size: 1.25rem; line-height: 1.2; color: inherit; }
.canetinha-icone {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: rgb(249 115 22 / 14%); color: #c2410c;
}
.canetinha-x {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: #64748b; cursor: pointer;
}
.canetinha-x:hover { background: #f1f5f9; color: #0f172a; }
.canetinha-desc { margin: 0; color: #475569; font-size: .95rem; font-weight: 400; }
.canetinha-form textarea {
  width: 100%; min-height: 130px; margin: 0; padding: 10px 12px; resize: vertical;
  border: 1px solid #cbd5e1; border-radius: 10px; background: #f8fafc; color: inherit;
  font: inherit;
}
.canetinha-form textarea:focus { outline: none; border-color: #f97316; box-shadow: 0 0 0 3px rgb(249 115 22 / 25%); }
.canetinha-msg { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: .92rem; font-weight: 600; }
.canetinha-msg[hidden] { display: none; }
.canetinha-msg.erro { background: #fee2e2; color: #b91c1c; }
.canetinha-msg.ok { background: #dcfce7; color: #15803d; }
.canetinha-botoes { display: flex; justify-content: flex-end; gap: 8px; }
.canetinha-btn {
  min-height: 42px; margin: 0; padding: 0 18px;
  border: 1px solid transparent; border-radius: 10px;
  background: #0f172a; color: #ffffff;
  font: inherit; font-weight: 650; cursor: pointer;
}
.canetinha-btn:disabled { opacity: .6; cursor: progress; }
.canetinha-btn.canetinha-sec { background: transparent; color: inherit; border-color: #cbd5e1; }
.canetinha-btn:focus-visible, .canetinha-x:focus-visible { outline: 3px solid rgb(249 115 22 / 75%); outline-offset: 2px; }

@media (prefers-color-scheme: dark) {
  .canetinha { background: #1e293b; color: #f1f5f9; border-color: rgb(255 255 255 / 14%); }
  .canetinha-janela { background: #111827; color: #e5e7eb; border-color: #334155; }
  .canetinha-icone { background: rgb(249 115 22 / 18%); color: #fb923c; }
  .canetinha-x { color: #94a3b8; }
  .canetinha-x:hover { background: #1f2937; color: #f1f5f9; }
  .canetinha-desc { color: #94a3b8; }
  .canetinha-form textarea { background: #0b1220; border-color: #334155; }
  .canetinha-msg.erro { background: #3b1414; color: #fca5a5; }
  .canetinha-msg.ok { background: #12321f; color: #86efac; }
  .canetinha-btn { background: #f97316; color: #0f172a; }
  .canetinha-btn.canetinha-sec { border-color: #334155; }
}

@media (prefers-reduced-motion: reduce) {
  .canetinha { transition: none; }
}
