/* Base layout */
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; background: #ffffff; color: #1f1f1f; }

.header { display: flex; align-items: center; justify-content: center; padding: 16px 24px; border-bottom: 1px solid #ddd; position: relative; }
.header h1 { font-size: 20px; margin: 0; text-align: center; width: 100%; color: #1f5db8; }
.header-actions { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); display: flex; gap: 8px; align-items: center; }
.user { font-size: 14px; color: #555; }

.container { max-width: 900px; margin: 24px auto; padding: 0 16px; text-align: center; }
.container.narrow { max-width: 420px; }

.card { border: 1px solid #eee; border-radius: 8px; padding: 16px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.card h2 { margin-top: 0; }

.form { display: grid; gap: 10px; }
.form label { font-size: 14px; color: #333; }
.form input[type="text"], .form input[type="password"] { padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; border: 1px solid #ccc; background: #f7f7f7; color: #222; border-radius: 6px; text-decoration: none; cursor: pointer; }
.btn.primary { background: #2ecc71; border-color: #28a745; color: #fff; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.muted { color: #4a4a4a; font-size: 14px; }
.alert { padding: 8px 10px; border-radius: 6px; font-size: 14px; }
.alert-error { background: #fdecea; color: #9b1c1c; border: 1px solid #f7c5c0; }
.hidden { display: none; }

/* Conteúdo público */
.lead { font-size: 19px; font-weight: 700; text-align: center; margin: 8px 0; color: #1f1f1f; }
.sublead { font-size: 16px; color: #2c2c2c; text-align: center; margin: 6px 0 12px; }
.prize-title { font-size: 20px; font-weight: 800; text-align: center; margin: 16px 0 12px; color: #1f5db8; }
.prizes { display: grid; grid-template-columns: repeat(2, 300px); gap: 16px; align-items: start; justify-content: center; }
.prize-list { list-style: none; margin: 0; padding: 12px; display: grid; gap: 8px; text-align: left; background: #ffffff; border: 1px solid #e5e5e5; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.info-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; text-align: center; }
.cta { font-weight: 700; text-align: center; margin: 8px 0 14px; color: #1f1f1f; }
.pix-box { border: 1px solid #d5eefc; background: #f0f9ff; padding: 12px; border-radius: 8px; font-weight: 700; display: grid; gap: 6px; max-width: 480px; margin: 0 auto 18px; text-align: center; color: #0c4a6e; }

/* Grid de cotas */
.grid { display: grid; grid-template-columns: repeat(10, 60px); grid-auto-rows: 60px; gap: 10px; justify-content: center; }
.cota { position: relative; width: 60px; height: 60px; border-radius: 8px; border: 1px solid #cfcfcf; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
.cota.livre { background: #28a745; color: #fff; }
.cota.parcial { background: linear-gradient(to right, #7f8c8d 50%, #28a745 50%); color: #fff; }
.cota.vendida { background: #7f8c8d; color: #fff; }
.footer { text-align: center; font-size: 13px; color: #5a5a5a; padding: 14px 16px; border-top: 1px solid #e5e5e5; margin-top: 24px; }
.footer a { color: #1f5db8; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.cota.vendida:disabled { opacity: 1; }
.cota:hover { filter: brightness(0.97); }

/* Tooltip leve */
.cota.vendida:hover::after,
.cota.parcial:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal.hidden { display: none; }
.modal-content { background: #fff; border-radius: 10px; padding: 18px; width: 100%; max-width: 520px; margin: 0 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.modal-content h3 { margin-top: 0; }
.form-row { display: grid; gap: 6px; margin-bottom: 10px; }
.radio-group { display: grid; gap: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Travar scroll quando modal aberto */
.no-scroll { overflow: hidden; }

/* Responsivo */
@media (max-width: 1024px) {
  .prizes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(8, 56px); grid-auto-rows: 56px; gap: 9px; }
  .cota { width: 56px; height: 56px; font-size: 13px; }
}

@media (max-width: 700px) {
  .grid { grid-template-columns: repeat(6, 52px); grid-auto-rows: 52px; gap: 8px; }
  .cota { width: 52px; height: 52px; font-size: 13px; }
  .prizes { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(5, 48px); grid-auto-rows: 48px; gap: 7px; }
  .cota { width: 48px; height: 48px; font-size: 12px; }
  .container { padding: 0 12px; }
  .header h1 { font-size: 18px; }
  .pix-box { margin: 0 auto 14px; }
  .modal { padding: 12px; }
  .modal-content { max-width: 95vw; }
}

/* Header responsivo: empilhar ações abaixo do título em tablets/celulares */
@media (max-width: 900px) {
  .header { flex-direction: column; padding: 12px 16px; }
  .header-actions { position: static; transform: none; margin-top: 8px; justify-content: center; flex-wrap: wrap; }
  .user { text-align: center; }
}