/* =========================
   TC Sorteos - Elegante
   + Fix grid + Reset botones
   + Modal con X
   ========================= */

.tcsorteos-box{
  background:#fff;
  border:1px solid #ececec;
  border-radius:18px;
  padding:16px;
  max-width:980px;
  margin:0 auto;
  box-shadow:0 10px 30px rgba(0,0,0,.05);
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

/* Cover */
.tcsorteos-cover{ margin:-16px -16px 12px; border-radius:16px; overflow:hidden; }
.tcsorteos-cover--yt{ aspect-ratio:16/9; background:#f2f2f2; }
.tcsorteos-cover img{ width:100%; height:100%; object-fit:cover; display:block; }

/* Header */
.tcsorteos-head{ padding:6px 2px 0; }
.tcsorteos-topline{ display:flex; gap:10px; align-items:flex-start; justify-content:space-between; }
.tcsorteos-title{ margin:0; font-size:22px; line-height:1.15; font-weight:700; color:#111; }
.tcsorteos-chip-state{
  font-size:12px; font-weight:600; padding:8px 10px; border-radius:999px;
  border:1px solid #dfe8ff; background:#f2f6ff; color:#0b3d91; white-space:nowrap;
}
.tcsorteos-subline{ margin-top:8px; }
.tcsorteos-chip{
  display:inline-flex; gap:8px; align-items:center; padding:8px 10px;
  border:1px solid #eee; border-radius:12px; background:#fafafa; font-size:13px; color:#111;
}
.tcsorteos-time{ font-weight:600; }

/* Prizes */
.tcsorteos-prizes{ margin-top:12px; padding-top:12px; border-top:1px dashed #eee; }
.tcsorteos-prizes h3{ margin:0 0 10px; font-size:16px; font-weight:650; }
.tcsorteos-prize-list{ margin:0; padding:0; list-style:none; display:grid; gap:8px; counter-reset:tcs_prize; }
.tcsorteos-prize-list li{
  background:#f8fbff; border:1px solid #e1ecff; border-radius:14px;
  padding:10px 12px; font-weight:600; color:#111; counter-increment:tcs_prize;
}
.tcsorteos-prize-list li:before{ content:counter(tcs_prize) ". "; color:#0b3d91; font-weight:700; }

/* Winners */
.tcsorteos-winners{ margin-top:12px; padding-top:12px; border-top:1px dashed #eee; }
.tcsorteos-winners h3{ margin:0 0 10px; font-size:16px; font-weight:650; }
.tcsorteos-table-wrap{ width:100%; overflow:auto; border:1px solid #eee; border-radius:14px; background:#fff; }
.tcsorteos-table{ width:100%; border-collapse:collapse; min-width:560px; }
.tcsorteos-table th, .tcsorteos-table td{
  padding:10px 12px; border-bottom:1px solid #f0f0f0; text-align:left; font-size:14px; color:#111;
}
.tcsorteos-table th{ background:#fafafa; font-weight:650; }
.tcsorteos-table tr:last-child td{ border-bottom:none; }
.tcsorteos-muted{ opacity:.75; margin:0; }

/* Join */
.tcsorteos-join{ margin-top:12px; }
.tcsorteos-join h3{ margin:0 0 10px; font-size:16px; font-weight:650; }

/* Grid */
.tcsorteos-grid{
  display:grid;
  grid-template-columns:repeat(10,minmax(0,1fr));
  gap:8px;
}
@media(max-width:520px){
  .tcsorteos-grid{ grid-template-columns:repeat(6,minmax(0,1fr)); }
}
.tcsorteos-loading{ grid-column:1/-1; padding:10px 0; opacity:.75; }

/* Números (reset anti-tema) */
.tcsorteos-num{
  -webkit-appearance:none !important;
  appearance:none !important;
  border:1px solid #e6e6e6 !important;
  background:#fff !important;
  color:#111 !important;
  -webkit-text-fill-color:#111 !important;

  width:100%;
  min-height:44px;
  padding:0 !important;
  margin:0 !important;

  display:flex !important;
  align-items:center !important;
  justify-content:center !important;

  border-radius:14px;
  font-weight:600;
  font-size:15px;
  line-height:1 !important;
  text-align:center;

  box-shadow:0 6px 14px rgba(0,0,0,.04);
  cursor:pointer;
  user-select:none;
  transition:box-shadow .15s ease, transform .06s ease, border-color .15s ease, background .15s ease;
}
.tcsorteos-num:active{ transform:scale(.99); }
.tcsorteos-num:focus{ outline:none; }
.tcsorteos-num:focus-visible{
  box-shadow:0 0 0 3px rgba(11,61,145,.12), 0 6px 14px rgba(0,0,0,.04);
  border-color:#0b3d91 !important;
}
.tcsorteos-num.free:hover{
  border-color:#0b3d91 !important;
  box-shadow:0 0 0 3px rgba(11,61,145,.10), 0 6px 14px rgba(0,0,0,.04);
}
.tcsorteos-num.taken{
  background:#f3f3f3 !important;
  color:#7a7a7a !important;
  -webkit-text-fill-color:#7a7a7a !important;
  text-decoration:line-through;
  opacity:.85;
  box-shadow:none;
  cursor:not-allowed !important;
}
.tcsorteos-num.selected{
  background:#0b3d91 !important;
  border-color:#0b3d91 !important;
  color:#fff !important;
  -webkit-text-fill-color:#fff !important;
  box-shadow:0 10px 22px rgba(11,61,145,.22);
}
.tcsorteos-num.free:disabled{ opacity:.6; cursor:not-allowed !important; }

/* Picked */
.tcsorteos-picked{
  margin-top:12px; padding:10px 12px; border:1px solid #eee; border-radius:14px;
  background:#fafafa; font-weight:600; color:#111;
}

/* Form */
.tcsorteos-formwrap{
  margin-top:12px; padding:14px; border:1px solid #eee; border-radius:16px; background:#fff;
}
.tcsorteos-form label{ display:block; margin-top:10px; font-weight:650; color:#111; font-size:14px; }
.tcsorteos-form input{
  width:100%; max-width:520px; padding:12px 12px; border:1px solid #e6e6e6; border-radius:12px;
  outline:none; background:#fff; color:#111; font-size:15px; font-weight:500;
}
.tcsorteos-field-error{ border-color:#ff7b7b !important; background:#fff5f5 !important; }
.tcsorteos-help{ margin-top:6px; font-size:13px; font-weight:600; color:#8a0b0b; }

/* Mensaje dentro del formulario (debajo del botón) */
.tcsorteos-form-msg{
  margin-top:12px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid transparent;
  font-size:14px;
  font-weight:600;
}
.tcsorteos-form-msg.ok{ background:#eaffea; border-color:#b9efb9; color:#0a6a0a; }
.tcsorteos-form-msg.err{ background:#ffecec; border-color:#ffbaba; color:#8a0b0b; }

/* Button */
.tcsorteos-submit{
  margin-top:12px; padding:12px 14px; border:none; border-radius:14px;
  background:#0b3d91; color:#fff; font-weight:650; cursor:pointer;
}
.tcsorteos-submit:disabled{ opacity:.7; cursor:not-allowed; }

/* Share */
.tcsorteos-share{
  display:flex !important; flex-direction:column !important; gap:10px !important;
  margin-top:14px !important; padding-top:12px !important; border-top:1px dashed #eee !important;
}
.tcsorteos-share-text{ margin:0; opacity:.8; color:#111; }
.tcsorteos-share-btn{
  display:block !important; width:100% !important; min-height:48px !important;
  border-radius:14px !important; padding:12px 14px !important;
  border:1px solid #dfe8ff !important; background:#f2f6ff !important;
  font-weight:650 !important; color:#0b3d91 !important; text-align:center !important; cursor:pointer !important;
}
.tcsorteos-share-btn:active{ transform:scale(.99); }
.tcsorteos-share-msg{ display:inline-block; font-weight:600; font-size:12px; }
.tcsorteos-share-msg.ok{ color:#0a6a0a; }
.tcsorteos-share-msg.err{ color:#8a0b0b; }

/* Evitar que el menú inferior tape el final */
@media (max-width: 782px){
  .tcsorteos-box{ padding-bottom:90px !important; }
}

/* Mobile winners -> cards */
@media (max-width: 700px){
  .tcsorteos-table{ min-width:0; }
  .tcsorteos-table thead{ display:none; }
  .tcsorteos-table, .tcsorteos-table tbody, .tcsorteos-table tr, .tcsorteos-table td{ display:block; width:100%; }
  .tcsorteos-table tr{ border-bottom:1px solid #eee; padding:12px 12px; }
  .tcsorteos-table td{ border:none; padding:6px 0; }
  .tcsorteos-table td:nth-child(1)::before{ content:"Lugar: "; font-weight:650; color:#0b3d91; }
  .tcsorteos-table td:nth-child(2)::before{ content:"Número: "; font-weight:650; color:#0b3d91; }
  .tcsorteos-table td:nth-child(3)::before{ content:"Ganador: "; font-weight:650; color:#0b3d91; }
  .tcsorteos-table td:nth-child(4)::before{ content:"Premio: "; font-weight:650; color:#0b3d91; }
}

/* Historial */
.tcsorteos-history{ margin-top:18px; display:flex; flex-direction:column; gap:14px; }
.tcsorteos-history h2{ margin:0 0 6px; font-weight:700; }
.tcsorteos-history-item{
  background:#fff; border:1px solid #e8e8e8; border-radius:16px; padding:16px; box-shadow:0 1px 0 rgba(0,0,0,.03);
}
.tcsorteos-history-cover{
  border-radius:16px; overflow:hidden; margin:-16px -16px 12px; background:#f1f1f1; aspect-ratio:16 / 9;
}
.tcsorteos-history-cover img{ width:100%; height:100%; object-fit:cover; display:block; }
.tcsorteos-history-head{ display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
.tcsorteos-history-head h3{ margin:0; font-size:18px; line-height:1.2; font-weight:700; color:#111; }

/* Mis tickets */
.tcsorteos-my-tickets{
  margin-top:12px; padding:12px 12px; border:1px solid #e1ecff; border-radius:16px; background:#f8fbff;
}
.tcsorteos-my-tickets h3{ margin:0 0 10px; font-size:16px; font-weight:650; color:#0b3d91; }
.tcsorteos-my-tickets-list{ display:grid; gap:8px; }
.tcsorteos-my-ticket{
  display:flex; gap:10px; align-items:center; padding:10px 10px;
  border:1px solid #dfe8ff; border-radius:14px; background:#fff;
}
.tcsorteos-my-ticket-num{
  min-width:72px; text-align:center; padding:10px 10px; border-radius:12px;
  background:#0b3d91; color:#fff; font-weight:650; font-size:14px;
}
.tcsorteos-my-ticket-meta{ display:flex; flex-direction:column; gap:2px; }
.tcsorteos-my-ticket-name{ font-weight:650; color:#111; font-size:14px; }
.tcsorteos-my-ticket-phone{ font-weight:500; color:#111; opacity:.85; font-size:13px; }
.tcsorteos-my-tickets-note{ margin-top:10px; font-size:13px; font-weight:500; color:#111; opacity:.75; }

/* =========================
   MODAL (X + botón cerrar)
   ========================= */
.tcsorteos-modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.45);
  z-index:999999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}
.tcsorteos-modal{
  width:100%;
  max-width:420px;
  background:#fff;
  border:1px solid rgba(0,0,0,.08);
  border-radius:18px;
  box-shadow:0 20px 60px rgba(0,0,0,.22);
  position:relative;
  overflow:hidden;
}
.tcsorteos-modal-x{
  position:absolute;
  top:10px;
  right:10px;
  width:38px;
  height:38px;
  border-radius:12px;
  border:1px solid #eee;
  background:#fff;
  color:#111;
  font-size:22px;
  line-height:1;
  cursor:pointer;
}
.tcsorteos-modal-body{ padding:18px 16px 16px; }
.tcsorteos-modal-text{
  font-size:15px;
  font-weight:600;
  color:#111;
  line-height:1.35;
  padding-top:10px;
}
.tcsorteos-modal.ok .tcsorteos-modal-text{ color:#0a6a0a; }
.tcsorteos-modal.err .tcsorteos-modal-text{ color:#8a0b0b; }

.tcsorteos-modal-close{
  margin-top:14px;
  width:100%;
  min-height:46px;
  border-radius:14px;
  border:1px solid #e6e6e6;
  background:#fafafa;
  color:#111;
  font-weight:650;
  cursor:pointer;
}
.tcsorteos-modal-close:active{ transform:scale(.99); }