/* ============================================
   RIFAS PROJECT M - UNIFIED FINAL VERSION
   Unifica styles.css + minimal_pure.css
   ============================================ */

/* === VARIABLES UNIFICADAS === */
:root {
  /* Colores sistema */
  --bg: #0b0b0c;
  --panel: #111114;
  --muted: #a6a6a6;
  --text: #e7e7e7;
  --accent: #BB0E22;
  --accent-red: #BB0E22; /* Alias para compatibilidad */
  --accent-dark: #8a0a19;
  --accent-red-dark: #8a0a19; /* Alias */
  --accent-2: #d91020;
  --ring: 0 0 0 2px var(--accent);
  --ok: #5de596;
  --warn: #f7c34d;
  
  /* Hero */
  --hero-h: 100svh;
  --hero-img: url('');
  --hero-tilt: 6deg;
  
  /* Grid Desktop (NO tocar en móvil) */
  --grid-cell-size: 42px;
  --grid-font-size: 0.7rem;
  
  /* Grid Mobile (ajustables para móvil) */
  --grid-cell-mobile: 38px;
  --grid-font-mobile: 0.8rem;
}

/* === RESET & BASE === */
* {
  box-sizing: border-box;
  scroll-behavior: smooth;
}

html {
  overflow: hidden;
  height: 100%;
  scroll-padding-top: 80px;
}

body {
  height: 100%;
  margin: 0;
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Poppins, Arial, sans-serif;
  background: 
    radial-gradient(1200px 800px at 80% -10%, rgba(187, 14, 34, .25), transparent 60%),
    radial-gradient(900px 700px at -10% 110%, rgba(187, 14, 34, .18), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  letter-spacing: .2px;
  -webkit-tap-highlight-color: rgba(187, 14, 34, 0.2);
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}

/* === SCROLLBAR GLOBAL === */
body::-webkit-scrollbar {
  width: 12px;
  background: var(--bg);
}

body::-webkit-scrollbar-track {
  background: #0b0b0c;
  border: 1px solid rgba(187, 14, 34, .08);
}

body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  border-radius: 10px;
  border: 3px solid #0b0b0c;
  transition: background 0.3s ease;
}

body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

body {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) #0b0b0c;
}

/* === NAVEGACIÓN === */
.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 10px 12px;
  flex-wrap: wrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.35), 0 1px 0 rgba(0,0,0,.12) inset;
  border-bottom: 1px solid rgba(0,0,0,.15);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand .logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #0f0f12;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
  overflow: hidden;
  flex-shrink: 0;
}

.brand .logo svg,
.brand .logo img {
  width: 86%;
  height: 86%;
  display: block;
}

.brand-title {
  font-size: 1.05rem;
  white-space: nowrap;
}

.tabs {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.tab-btn {
  background: #161619;
  color: #fff;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  border-color: transparent;
  position: relative;
  border-bottom: 2px solid var(--accent);
}

/* === HERO / CARDS === */
.hero {
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.0));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.03) inset;
  border-bottom: 1px solid rgba(29,9,20,.12);
}

.title {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.badge {
  color: white;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .85rem;
  letter-spacing: .5px;
}

h1 {
  margin: 4px 0 12px;
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem);
  font-weight: 700;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 2px solid transparent;
  transition: border-left-color 0.3s ease;
}

.card:hover {
  border-left-color: rgba(187, 14, 34, .5);
}

.card label {
  font-size: .9rem;
  color: #cfcfcf;
}

/* === INPUTS & FORMS === */
input[type="number"],
input[type="text"],
input[type="tel"],
select,
textarea {
  background: #0f0f12;
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 86px;
  font-size: .95rem;
}

#buyerName {
  background: #000 !important;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(187, 14, 34, .6);
  box-shadow: 0 0 0 3px rgba(187, 14, 34, .15);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* === BOTONES === */
.btn {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  border: none;
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  letter-spacing: .3px;
  cursor: pointer;
  transition: transform .05s ease, box-shadow .2s ease, filter .2s ease;
  box-shadow: 0 8px 24px rgba(187, 14, 34, .25);
}

.btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 18px rgba(187, 14, 34, .35);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.secondary {
  background: #17171a;
  border: 1px solid rgba(255,255,255,.12);
  color: #f2f2f2;
  box-shadow: none;
}

.controls {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* === GRID === */
.grid-wrap {
  max-height: 72vh;
  overflow: auto;
  overflow-x: hidden;
  position: relative;
  padding: 14px;
  padding-right: 8px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(0,0,0,.3);
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  animation: fadeIn 0.5s ease-out;
}

.grid-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #0f0f12;
  border-bottom: 1px solid rgba(29,9,20,.18);
  border-radius: 12px 12px 0 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(25, var(--grid-cell-size));
  gap: 8px;
  justify-content: center;
}

.cell {
  width: var(--grid-cell-size);
  height: var(--grid-cell-size);
  min-width: var(--grid-cell-size);
  min-height: var(--grid-cell-size);
  font-size: var(--grid-font-size);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.3px;
  user-select: none;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.08);
  background: #171718;
  color: #fff;
  transition: all 0.2s ease;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  will-change: transform;
}

.cell:hover:not(.sold):not(.reserved):not(.selected) {
  border-color: rgba(187, 14, 34, .8);
  box-shadow: 0 0 0 2px rgba(187, 14, 34, .55) inset, 0 2px 10px rgba(187, 14, 34, .12);
  transform: translateY(-1px);
}

.cell.selected {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff;
  border-color: rgba(187, 14, 34, .85);
  box-shadow: 0 4px 14px rgba(187, 14, 34, .35), 0 0 0 2px rgba(187, 14, 34, .55) inset;
  font-weight: 900;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

.cell.sold,
.cell.reserved {
  background: #000;
  color: #7f7f7f;
  border-color: #2a2a2a;
  cursor: not-allowed;
}

.cell:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(187, 14, 34, .2);
}

/* Grid Scrollbar */
.grid-wrap::-webkit-scrollbar {
  width: 8px;
  background: transparent;
}

.grid-wrap::-webkit-scrollbar-track {
  background: rgba(15,15,18,.5);
  border-radius: 4px;
  margin: 4px 0;
}

.grid-wrap::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  border-radius: 4px;
  transition: background 0.3s ease;
}

.grid-wrap::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

.grid-wrap {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

/* === PILLS === */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .85rem;
  background: #141417;
  border: 1px solid rgba(255,255,255,.08);
  transition: all 0.2s ease;
}

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px currentColor;
}

/* === PREVIEW === */
.preview {
  background: #000;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  padding: 12px;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  animation: fadeIn 0.5s ease-out;
}

.preview:hover {
  border-left-color: rgba(187, 14, 34, .5);
}

.preview h3 {
  margin: 6px 0 10px 0;
}

#previewTiles {
  display: grid;
  grid-template-columns: repeat(25, 1fr);
  gap: 8px;
}

.tile {
  width: var(--grid-cell-size);
  height: var(--grid-cell-size);
  font-size: var(--grid-font-size);
  background: #171718;
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1/1;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.tile:hover {
  border-color: rgba(187, 14, 34, .85);
  box-shadow: 0 0 0 2px rgba(187, 14, 34, .55) inset, 0 2px 10px rgba(187, 14, 34, .14);
  transform: scale(1.05);
}

.buyer-card {
  background: #0f0f12;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 10px;
  margin-top: 10px;
  font-size: .92rem;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}

.buyer-card:hover {
  border-left-color: rgba(187, 14, 34, .5);
}

.comp-list {
  max-height: 220px;
  overflow: auto;
  margin-top: 4px;
  padding-right: 4px;
}

/* === MEGA HERO === */
.mega-hero {
  position: relative;
  min-height: var(--hero-h);
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}

.mega-hero .hero-media {
  position: absolute;
  inset: -2% -2% 0;
  background:
    radial-gradient(1200px 800px at 90% -10%, rgba(199,160,70,.28), transparent 60%),
    radial-gradient(1000px 680px at -20% 120%, rgba(199,160,70,.18), transparent 60%),
    var(--hero-img), linear-gradient(180deg, #0b0b0c, #0b0b0c);
  background-size: cover;
  background-position: center;
  transform: skewY(calc(var(--hero-tilt) * -1));
  filter: saturate(1.05) contrast(1.02) brightness(1.03);
}

.mega-hero .mega-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(115deg, rgba(255,255,255,.02) 0 22px, rgba(255,255,255,0) 22px 44px),
    linear-gradient(180deg, rgba(0,0,0,.0) 0%, rgba(0,0,0,.35) 60%, rgba(0,0,0,.75) 100%);
  transform: skewY(calc(var(--hero-tilt) * -1));
  mix-blend-mode: overlay;
}

.mega-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 20px;
  max-width: 1100px;
  transform: translateY(-4vh);
}

.mega-title {
  margin: 0;
  font-size: clamp(2.2rem, 5.4vw, 7.5rem);
  line-height: .95;
  font-weight: 1000;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-shadow: 0 10px 40px rgba(0,0,0,.45);
}

.mega-title span:last-child {
  display: block;
  background: linear-gradient(180deg, #fff, #d7d7d7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.scroll-cue {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 14px 30px rgba(0,0,0,.45);
  cursor: pointer;
  z-index: 100;
  pointer-events: auto;
  transition: opacity 0.3s ease, transform 0.3s ease;
  animation: bob 1.5s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -6px); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

body:not(.on-hero) .scroll-cue {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
}

.hero-cta-only {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  gap: 16px;
}

.hero-logo-giant {
  width: clamp(220px, 50vw, 760px);
  max-width: 92vw;
  display: inline-block;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,.45));
}

.hero-logo-giant svg,
.hero-logo-giant img {
  width: 100%;
  height: auto;
  display: block;
}

.hero-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
}

.hero-buttons .btn {
  min-width: 220px;
  min-height: 48px;
  padding: 12px 18px;
  font-weight: 900;
  letter-spacing: .3px;
  border-radius: 14px;
  text-decoration: none;
  flex-shrink: 0;
}

.mega-hero .btn.cta-lux,
#inicio .btn.cta-lux {
  background: linear-gradient(180deg, rgba(199,160,70,.18), rgba(199,160,70,.06));
  border: 3px solid rgba(199,160,70,.55);
  box-shadow: 0 6px 18px rgba(199,160,70,.25), inset 0 1px 0 rgba(255,255,255,.08);
  color: #fff;
}

.mega-hero .btn.cta-lux:hover {
  box-shadow: 0 10px 28px rgba(199,160,70,.35), inset 0 1px 0 rgba(255,255,255,.1);
}

#siteLinkMinimal {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 40;
  color: #ffffff;
  pointer-events: none;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* === PREMIOS / CAROUSEL === */
#premios {
  scroll-margin-top: 80px;
  margin: 26px 0 12px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 18px;
  padding: 18px;
}

#premios .premios-card {
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 26px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.03) inset;
}

#premios .premios-title {
  margin: 0;
  font-size: clamp(1.1rem, 1rem + .9vw, 1.8rem);
  font-weight: 1000;
  letter-spacing: .02em;
}

#premios .ruler {
  height: 10px;
  border-radius: 8px;
  margin: 12px 0;
  background: repeating-linear-gradient(90deg, rgba(187, 14, 34, .65) 0 12px, transparent 12px 24px);
  opacity: .22;
}

#premios .carousel {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(180deg, #111216, #0e0f13);
  border: 1px solid rgba(255,255,255,.06);
  padding: 14px;
}

#premios .viewport {
  overflow: hidden;
}

#premios .track {
  display: flex;
  gap: 14px;
  align-items: stretch;
  transition: transform .35s ease;
  will-change: transform;
}

#premios .slide {
  flex: 0 0 auto;
  width: clamp(260px, 34vw, 360px);
  aspect-ratio: 16/10;
  border-radius: 14px;
  overflow: hidden;
  background: #0f0f12;
  border: 1px solid rgba(255,255,255,.08);
  position: relative;
  isolation: isolate;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

#premios .slide:hover {
  transform: translateY(-4px);
  border-color: rgba(187, 14, 34, .5);
  box-shadow: 0 8px 24px rgba(187, 14, 34, .25);
}

#premios .slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#premios .slide .cap {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  font-weight: 800;
  font-size: .85rem;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.55);
  z-index: 2;
}

#premios .foot-nav button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, border-color 0.3s ease;
}

#premios .foot-nav button:hover {
  transform: translateY(-2px);
  border-color: rgba(187, 14, 34, .6);
  background: rgba(0,0,0,.6);
}

/* === MODAL === */
.modal {
  width: min(520px, 92vw);
  background: #121216;
  border: 2px solid rgba(187, 14, 34, .3);
  border-radius: 16px;
  padding: 16px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

#buyerName,
#buyerPhone {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}

/* === BOTÓN BORRAR Y DADITO === */
/* Toolbar con orden específico */
.grid-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 10px;
  padding: 8px 10px;
  background:none;
  border-bottom: 1px solid rgba(29,9,20,.18);
  border-radius: 12px 12px 0 0;
}

/* Orden de elementos en toolbar */
.grid-toolbar > * {
  order: 1; /* Todo por defecto en orden 1 */
}

/* Borrar siempre en orden 10 */
.clear-selection-btn {
  order: 10;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #16161a;
  color: #fff;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  padding: 6px 10px;
  min-height: 36px;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  margin-right: 0;
}

.clear-selection-btn:hover {
  filter: brightness(1.05);
  border-color: rgba(187, 14, 34, .6);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(187, 14, 34, .25);
}

/* Dado SIEMPRE después de Borrar (orden 11) */
#btnDicePick {
  order: 11;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: #16161a;
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
  
  /* AJUSTES DE POSICIÓN - Modifica estos valores */
  margin-left: 8px;      /* Separación del botón Borrar (aumenta/disminuye) */
  margin-right: 0;       /* Separación del siguiente elemento */
  margin-top: 0;         /* Mover arriba/abajo */
  margin-bottom: 0;      /* Espacio inferior */
  
  /* Si quieres moverlo con transform (más fino) */
  /* transform: translateX(10px) translateY(-5px); */
}

#btnDicePick:hover {
  border-color: rgba(187, 14, 34, .6);
  transform: scale(1.05);
}

/* Texto "Dado de la suerte" debajo */
#btnDicePick::after {
  content: "Dado de la suerte";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  
  /* AJUSTES DEL TEXTO - Modifica estos valores */
  margin-top: 4px;       /* Distancia del texto al dado (aumenta/disminuye) */
  font-size: 0.65rem;    /* Tamaño del texto */
  
  white-space: nowrap;
  color: #888;           /* Color del texto (cámbialo si quieres) */
  font-weight: 600;
  pointer-events: none;
  text-align: center;
}

/* Espacio extra en toolbar para el texto del dado */
.grid-toolbar {
  padding-bottom: 24px;
}

@keyframes spin360 {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}

#btnDicePick.spin .dice-icon {
  animation: spin360 .6s linear;
}

/* === PAGOS === */
.pay-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pay-btn {
  background: #17171a;
  color: #fff;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  letter-spacing: .2px;
  cursor: pointer;
  transition: transform .05s, box-shadow .2s, filter .2s;
}

.pay-btn:active {
  transform: translateY(1px);
}

.pay-btn.active {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(187, 14, 34, .25);
}

/* === ADMIN / TABLA === */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border: 1px solid rgba(255,255,255,.1);
  padding: 10px;
  text-align: left;
}

th {
  background: #17171a;
}

/* === SECCIONES === */
.section {
  display: none;
}

.section.active {
  display: block;
}

/* === ESTADOS === */
body.raffle-closed .grid {
  pointer-events: none;
  opacity: .85;
}

body.raffle-closed #btnFinalizar {
  opacity: .65;
  cursor: not-allowed;
}

body.page-paused .grid .cell {
  cursor: not-allowed;
}

#btnPausePage.btn,
#btnPausePage.btn.secondary {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff;
  border-color: rgba(187, 14, 34, .75);
}

#btnPausePage.btn:hover {
  box-shadow: 0 6px 16px rgba(187, 14, 34, .25);
}

/* === OCULTAR ELEMENTOS === */
#btnGuardar,
#btnCargar,
#buyerEmail,
#inComprados,
#smartPickChips,
.grid-help,
.hero-cta-only .hero-logo,
.mega-hero .tagline,
.mega-hero .mega-title,
.mega-hero .mega-sub,
.mega-hero .mega-stats,
.mega-hero .mega-cta {
  display: none !important;
}

/* Ocultar SOLO las pills de estado (Vendido, Disponible, Seleccionados) */
.grid-toolbar > .pill:not(:has(select)):not(:has(input)):not(:has(button)) {
  display: none !important;
}

.grid-toolbar label[title="Cambia de pagina"] {
  display: none !important;
}

/* === MISC === */
footer {
  opacity: .8;
  font-size: .9rem;
  margin: 22px 0;
  text-align: center;
  border-top: 1px solid rgba(187, 14, 34, .15);
  padding-top: 20px;
  margin-top: 30px;
}

a {
  color: #ff7d86;
}

a:not(.btn):hover {
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

#secciones {
  position: relative;
  scroll-margin-top: 80px;
}

#buyerCity option[value=""] {
  color: #9CA3AF;
}

#buyerCity:invalid {
  color: #9CA3AF;
}

/* === RESPONSIVE DESKTOP === */
@media (max-width: 920px) {
  .grid {
    grid-template-columns: repeat(15, var(--grid-cell-size));
  }
  
  #previewTiles {
    grid-template-columns: repeat(15, 1fr);
  }
}

@media (max-width: 680px) {
  .grid {
    grid-template-columns: repeat(10, var(--grid-cell-size));
  }
  
  #previewTiles {
    grid-template-columns: repeat(10, 1fr);
  }
}

/* === RESPONSIVE MOBILE === */
@media (max-width: 768px) {
  /* APLICAR VARIABLES MÓVIL AL GRID */
  .grid {
    grid-template-columns: repeat(15, var(--grid-cell-mobile)) !important;
    gap: 10px;
  }
  
  .cell {
    width: var(--grid-cell-mobile) !important;
    height: var(--grid-cell-mobile) !important;
    min-width: var(--grid-cell-mobile) !important;
    min-height: var(--grid-cell-mobile) !important;
    font-size: var(--grid-font-mobile) !important;
  }
  
  #previewTiles .tile {
    width: var(--grid-cell-mobile) !important;
    height: var(--grid-cell-mobile) !important;
    font-size: var(--grid-font-mobile) !important;
  }
  
  #previewTiles {
    grid-template-columns: repeat(15, 1fr) !important;
  }
  
  /* Ocultar brand completamente */
  .brand {
    display: none !important;
  }
  
  /* Nav centrado */
  .nav {
    padding: 6px 8px;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .tabs {
    margin-left: 0;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }
  
  .tab-btn {
    padding: 7px 10px;
    font-size: 0.8rem;
    border-radius: 8px;
    flex: 0 0 auto;
  }
  
  /* Pills responsive */
  .card .pill {
    font-size: 0.75rem;
    padding: 5px 8px;
    gap: 4px;
  }
  
  .card .pill .dot {
    width: 6px;
    height: 6px;
  }
  
  .card .pill b {
    font-size: 0.75rem;
  }
  
  /* Controls: Finalizar Compra debajo de Preview */
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .controls .card {
    width: 100%;
    order: 1;
  }
  
  #btnFinalizar {
    order: 3;
    width: 100%;
  }
  
  aside.preview {
    order: 2;
  }
  
  .controls .btn:not(#btnFinalizar) {
    width: 100%;
  }
  
  /* Grid wrap */
  .grid-wrap {
    padding: 8px;
    padding-right: 12px;
    max-height: 65vh;
  }
  
  /* Scrollbar MÁS VISIBLE */
  .grid-wrap::-webkit-scrollbar {
    width: 12px;
  }
  
  .grid-wrap::-webkit-scrollbar-track {
    background: rgba(15,15,18,.8);
    border-radius: 6px;
    margin: 6px 0;
  }
  
  .grid-wrap::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    border-radius: 6px;
    min-height: 40px;
  }
  
  .grid-wrap {
    scrollbar-width: auto;
    scrollbar-color: var(--accent) rgba(15,15,18,.8);
  }
  
  /* Grid toolbar */
  .grid-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
  }
  
  .grid-toolbar label {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .grid-toolbar select,
  .grid-toolbar input {
    flex: 1;
    font-size: 0.85rem;
  }
  
  .grid-toolbar .btn {
    width: 100%;
    font-size: 0.85rem;
  }
  
  /* Botón borrar */
  .clear-selection-btn {
    padding: 5px 8px;
    min-height: 32px;
    font-size: 0.75rem;
    gap: 4px;
  }
  
  /* Preview/Aside */
  .selector-layout {
    display: flex;
    flex-direction: column;
  }
  
  aside.preview {
    margin-top: 16px;
  }
  
  /* Modal responsive */
  .modal {
    width: 94vw;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .actions {
    flex-direction: column;
  }
  
  .actions .btn {
    width: 100%;
  }
  
  /* Hero responsive */
  .mega-hero {
    min-height: 100vh;
    padding: 20px 10px;
  }
  
  .hero-logo-giant {
    width: clamp(180px, 60vw, 480px);
  }
  
  .hero-buttons {
    flex-wrap: nowrap;
    width: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 10px;
  }
  
  .hero-buttons .btn {
    min-width: 180px;
    max-width: none;
    flex-shrink: 0;
  }
  
  /* Scroll cue */
  .scroll-cue {
    width: 48px;
    height: 48px;
    bottom: 16px;
  }
  
  .scroll-cue svg {
    width: 28px;
    height: 28px;
  }
  
  /* Site link */
  #siteLinkMinimal {
    font-size: 0.65rem;
    left: 8px;
    top: 8px;
  }
  
  /* Premios */
  #premios .slide {
    width: clamp(220px, 70vw, 300px);
  }
  
  #premios .premios-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  #premios .foot-nav {
    width: 100%;
    justify-content: center;
  }
  
  /* Inputs sin zoom */
  input,
  select,
  textarea {
    font-size: 16px;
  }
  
  /* Dado */
  #btnDicePick {
    width: 40px;
    height: 40px;
  }
  
  /* Performance */
  * {
    animation-duration: 0.15s;
    transition-duration: 0.15s;
  }
  
  .hero-media,
  .mega-overlay {
    transform: none;
  }
  
  /* Hover disabled en móvil */
  .cell:hover:not(.sold):not(.reserved):not(.selected) {
    transform: none;
  }
}

@media (max-width: 680px) {
  .grid {
    grid-template-columns: repeat(10, var(--grid-cell-mobile)) !important;
  }
  
  #previewTiles {
    grid-template-columns: repeat(10, 1fr) !important;
  }
}

@media (max-width: 460px) {
  /* Ajuste más pequeño */
  :root {
    --grid-cell-mobile: 34px;
    --grid-font-mobile: 0.75rem;
  }
  
  .grid {
    grid-template-columns: repeat(8, var(--grid-cell-mobile)) !important;
  }
  
  #previewTiles {
    grid-template-columns: repeat(8, 1fr) !important;
  }
  
  .tab-btn {
    padding: 6px 8px;
    font-size: 0.75rem;
  }
}

@media (max-width: 390px) {
  .tab-btn {
    padding: 5px 7px;
    font-size: 0.7rem;
  }
  
  .nav {
    padding: 5px 6px;
    gap: 4px;
  }
  
  .tabs {
    gap: 4px;
  }
  
  .clear-selection-btn {
    padding: 4px 6px;
    min-height: 28px;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  #siteLinkMinimal {
    display: none;
  }
}

/* === LANDSCAPE === */
@media (max-width: 920px) and (orientation: landscape) {
  .mega-hero {
    min-height: 100vh;
  }
  
  .mega-content {
    padding: 10px;
  }
  
  .mega-title {
    font-size: clamp(1.8rem, 4vw, 3.5rem);
  }
}

/* === SAFE AREA === */
@supports (padding: max(0px)) {
  .nav {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  
  .wrap {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
}

/* === TOUCH DEVICES === */
@media (hover: none) and (pointer: coarse) {
  .cell:hover,
  .btn:hover,
  .tab-btn:hover {
    transform: none;
  }
  
  .btn:active {
    transform: scale(0.97);
    opacity: 0.9;
  }
  
  .cell:active {
    transform: scale(0.95);
  }
}

/* === CONTRASTE ALTO === */
@media (prefers-contrast: high) {
  .nav,
  .card,
  .grid-wrap {
    border-width: 2px;
  }
  
  .cell {
    font-weight: 900;
  }
}

/* === FIN === */