*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}

/* ── Home screen ── */
#home {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding:
    max(env(safe-area-inset-top), 20px)
    max(env(safe-area-inset-right), 16px)
    0px
    max(env(safe-area-inset-left), 16px);
}

#header {
  text-align: center;
  padding: 16px 0 22px;
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 8px;
  text-transform: uppercase;
}

#header::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: #f5c500;
  margin: 10px auto 0;
  border-radius: 2px;
}

#grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}

.tile {
  border-radius: 18px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.tile:active {
  transform: scale(0.94);
  opacity: 0.82;
}

#tile-red    { background: #e00000; }
#tile-yellow { background: #f5c500; }

#tile-loser {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: clamp(18px, 5.5vw, 28px);
  font-weight: 900;
  letter-spacing: 5px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

#tile-offside {
  background-image: url('offside.png');
  background-size: cover;
  background-position: center;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* ── Fullscreen cards ── */
.card {
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card.active {
  opacity: 1;
  pointer-events: all;
}

#card-red    { background: #e00000; }
#card-yellow { background: #f5c500; }

#card-loser {
  background: #000;
  color: #fff;
  font-size: clamp(72px, 22vw, 120px);
  font-weight: 900;
  letter-spacing: 10px;
}

#card-offside {
  background-image: url('offside.png');
  background-size: cover;
  background-position: center;
}
