/* Validador Timemania
   Corrige html,body{height:100%} do main.css que fixa o viewport em 100vh
   e deixa conteúdo vazando abaixo do rodapé quando os resultados crescem.
   :root tem especificidade maior que html, então sobrescreve corretamente. */
:root {
  height: auto;
  min-height: 100%;
}

body.validator-page--timemania {
  height: auto;
  min-height: 100vh;
}

/* Layout padrão: seletor centralizado antes de validar */
.lv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  max-width: 680px;
  transition: max-width 0.4s ease-in-out;
  margin: 0 auto;
  padding: 16px 16px 50px;
}

/* Após validar: layout 2 colunas (40% seletor / 60% resultados) */
.lv-layout--active {
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  max-width: 1400px;
}

/* Cabeçalho e loading sempre ocupam todas as colunas */
.lv-layout > .lv-header,
.lv-layout > .lv-loading {
  grid-column: 1 / -1;
  padding: 24px 0 8px;
}

.lv-header h1 {
    font-size: 33px;
    max-width: 330px;
    color: #2c3e50;
    margin-bottom: 6px;
}

.lv-header p {
  font-size: 14px;
  color: #7f8c8d;
  margin: 0;
}

/* Coluna esquerda: seletor */
.lv-selector {
  background: #fff;
  border-radius: 12px;
  padding: 20px 20px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.lv-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.lv-selector-header h2 {
  color: #2c3e50;
  margin: 0;
  font-size: 20px;
}

.lv-counter {
  background: #ffed00;
  color: #111;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

/* Grid de números: 10 colunas fixas para 80 números */
.lv-numbers-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 20px;
}

.lv-num-btn {
  aspect-ratio: 1;
  border: 2px solid #bdc3c7;
  background: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  color: #2c3e50;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, transform .1s;
  padding: 0;
  width: 100%;
  max-width: 56px;
  height: auto;
  max-height: none;
  margin: 0 auto;
  touch-action: manipulation;
}

@media (hover: hover) {
  .lv-num-btn:hover {
    border-color: #ffed00;
    background: #fffde6;
    transform: scale(1.08);
  }
}

.lv-num-btn.selected {
  background: #ffed00;
  border-color: #ffed00;
  color: #111;
  transform: scale(1.05);
}

/* Time do coração seletor */
.lv-heart-team-selector {
  margin: 15px 0 25px;
  text-align: center;
}

.lv-heart-team-selector h3 {
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 16px;
}

.lv-heart-team-input {
  padding: 10px 14px;
  border: 2px solid #bdc3c7;
  border-radius: 5px;
  background: #fff;
  color: #2c3e50;
  font-size: 14px;
  width: 100%;
  max-width: 250px;
  min-height: 44px;
  touch-action: manipulation;
}

.lv-heart-team-input:focus {
  border-color: #209869;
  outline: none;
}

/* Ações */
.lv-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 4px;
}

.lv-btn {
  padding: 10px 22px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  width: auto;
  height: auto;
  max-height: none;
  margin-bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  touch-action: manipulation;
}

.lv-btn-primary {
  background: #209869;
  color: #fff;
}

.lv-btn-primary:hover:not(:disabled) {
  background: #187652;
}

.lv-btn-primary:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

.lv-btn-secondary {
  background: #c62828;
  color: #fff;
}

.lv-btn-secondary:hover {
  background: #b71c1c;
}

.lv-btn-blue {
  background: #1976d2;
  color: #fff;
}

.lv-btn-blue:hover {
  background: #1565c0;
}

.lv-btn-sm {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 5px;
}

/* Coluna direita: resultados */
.lv-results {
  background: #fff;
  border-radius: 12px;
  padding: 20px 20px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.lv-placeholder {
  text-align: center;
  color: #7f8c8d;
  padding: 32px 16px;
  border: 1px dashed #ddd;
  border-radius: 10px;
}

/* Cabeçalho dos resultados */
.lv-results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.lv-expand-btn {
  flex-shrink: 0;
  align-self: flex-start;
}

.lv-numbers-display,
.lv-heart-team-display {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
  margin-bottom: 8px;
  align-items: center;
}

.lv-heart-team-display {
  color: #2c3e50;
  font-size: 14px;
}

.lv-number-chip {
  background: #ffed00;
  color: #111;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
}

.lv-heart-chip {
  background: #ffed00;
  color: #111;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  margin-left: 6px;
}

/* Cards de resumo */
.lv-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.lv-summary-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 16px;
  border-left: 4px solid #ffed00;
}

.lv-summary-card h3 {
  color: #2c3e50;
  margin: 0 0 12px;
  font-size: 15px;
  text-align: center;
}

.lv-stats { display: flex; flex-direction: column; gap: 8px; }

.lv-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #ecf0f1;
  font-size: 14px;
}

.lv-stat:last-child { border-bottom: none; }
.lv-stat-label { font-weight: 600; color: #34495e; }
.lv-stat-value { color: #209869; font-weight: 700; }

/* Distribuição de acertos */
.lv-hits-dist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid #eee;
  border-radius: 8px;
}

.lv-hit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.lv-hit-badge {
  background: #ffed00;
  color: #111;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

/* Filtros */
.lv-filters-section { margin-top: 24px; }

.lv-filters-section h3 {
  color: #2c3e50;
  margin: 0 0 16px;
  font-size: 16px;
  text-align: center;
}

.lv-filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.lv-filter-controls label {
  font-size: 13px;
  font-weight: 600;
  color: #2c3e50;
}

.lv-filter-controls select,
.lv-filter-controls input {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 13px;
  background: #fff;
  width: auto;
  height: auto;
  margin: 0;
  min-height: 44px;
  touch-action: manipulation;
}

/* Lista de concursos */
.lv-contests-list {
  max-height: 600px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.lv-contests-list::-webkit-scrollbar { width: 6px; }
.lv-contests-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 6px; }

.lv-contest-item {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  border-left: 4px solid #ffed00;
}

.lv-contest-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.lv-contest-info { display: flex; flex-direction: column; gap: 2px; }
.lv-contest-num { font-weight: 700; color: #2c3e50; }
.lv-contest-date { color: #7f8c8d; font-size: 12px; }

.lv-hits-label {
  padding: 5px 12px;
  border-radius: 14px;
  font-weight: 700;
  color: #fff;
  font-size: 13px;
}

.lv-hits-label.high   { background: #209869; }
.lv-hits-label.medium { background: #f39c12; }
.lv-hits-label.low    { background: #c62828; }

.lv-drawn-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.lv-ball {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: #fff;
}

.lv-ball.hit    { background: #209869; }
.lv-ball.missed { background: #c62828; }

.lv-contest-team {
  font-size: 13px;
  color: #2c3e50;
  margin-bottom: 10px;
  font-weight: 600;
}

.lv-badge-hit {
  background: #ffed00;
  color: #111;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 6px;
  font-size: 11px;
}

.lv-contest-details { display: flex; flex-direction: column; gap: 6px; }

.lv-detail {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
}

.lv-detail-label { font-weight: 600; color: #2c3e50; white-space: nowrap; }
.lv-detail-value { color: #34495e; text-align: right; }

/* Loading */
.lv-loading {
  display: none;
  text-align: center;
  padding: 40px;
  grid-column: 1 / -1;
}

.lv-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #ffed00;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: lv-spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes lv-spin {
  to { transform: rotate(360deg); }
}

/* Modal de visitante */
.lv-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lv-modal-overlay.open { display: flex; }

.lv-modal {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
  text-align: center;
}

.lv-modal h2 { margin: 0 0 14px; font-size: 26px; }
.lv-modal p  { margin: 0 0 28px; font-size: 17px; }

/* Título de resultados sr-only */
.lv-results-title-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.lv-layout--active .lv-results-title-sr {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0 0 12px;
  overflow: visible;
  clip: auto;
  white-space: normal;
  color: #2c3e50;
  font-size: 22px;
}

.lv-results:not(.lv-results--active) .lv-results-header { display: none; }

/* Modo expandido */
.lv-layout--active.full-view {
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  max-width: 1400px;
}

/* Responsivo */
@media (max-width: 1100px) {
  .lv-layout--active {
    grid-template-columns: 1fr;
    max-width: 700px;
  }

  .lv-layout--active.full-view {
    grid-template-columns: 1fr;
    max-width: 700px;
  }

  #lv-toggle-view { display: none; }
}

@media (max-width: 600px) {
  .lv-selector {
    padding: 16px;
  }

  .lv-numbers-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }

  .lv-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 400px) {
  .lv-selector {
    padding: 16px 12px;
  }

  .lv-numbers-grid {
    gap: 6px;
  }

  .lv-layout { padding: 12px 12px 0; }
}