:root{
  --card-aspect-w: 2.5;
  --card-aspect-h: 3.5;
  --gap: 12px;
  --board-max-w: 520px;
}

*{ box-sizing: border-box; }
html, body{
  height: 100%;
  margin: 0;
  background: #000;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  overflow: hidden;
}

#app{
  height: 100%;
  width: 100%;
  position: relative;
}

.screen{
  position: absolute;
  inset: 0;
  display: none;
}
.screen.is-active{ display: block; }

.attract-bg,
.game-bg{
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.full-hit{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.hud{
  position: relative;
  z-index: 2;
  height: 72px;
  padding: 36px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* evita taps accidentales en kiosko */
}

.brand-logo{
  height: 100px;
  width: auto;
  object-fit: contain;
}

.timer{
  position: absolute;
  right: 14px;
  top: 12px;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
}

.time-label{
  font-size: 14px;
  opacity: .9;
}
.time-value{
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  min-width: 2ch;
  text-align: right;
}

.board-wrap{
  position: relative;
  z-index: 2;
  height: calc(100% - 72px);
  display: grid;
  place-items: center;
  padding: 12px 14px 18px;
}

.board{
  width: min(92vw, var(--board-max-w));
  aspect-ratio: 1 / 1; /* tablero cuadrado dentro del 9:16 */
  display: grid;
  gap: var(--gap);
}

.card{
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.card-inner{
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 220ms ease;
  border-radius: 14px;
}

.card.is-flipped .card-inner{
  transform: rotateY(180deg);
}

.face{
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
}

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

.face.front{
  transform: rotateY(180deg);
}

.card-shell{
  /* Mantener “carta de baraja” dentro de la celda */
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
.card-sizer{
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: calc(var(--card-aspect-w) / var(--card-aspect-h));
}

.overlay{
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,.45);
}
.overlay.is-active{
  display: flex;
}
.overlay-card{
  width: min(520px, 92vw);
  padding: 18px 16px;
  border-radius: 18px;
  background: rgba(0,0,0,.55);
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
}
.overlay-text{
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

/* Puntaje flotante al hacer match */

.score-float{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 32px;
  font-weight: 800;
  pointer-events: none;
  text-shadow: 0 4px 14px rgba(0,0,0,.6);
  animation: scorePop 600ms ease-out forwards;
}

@keyframes scorePop{
  0%{
    opacity: 0;
    transform: translate(-50%, -40%) scale(.8);
  }
  20%{
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100%{
    opacity: 0;
    transform: translate(-50%, -80%) scale(1);
  }
}