/* Overlays cover the play screen; the board stays dimly visible. */
.ef-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 1em max(24px, env(safe-area-inset-right, 0px))
    max(40px, calc(env(safe-area-inset-bottom, 0px) + 24px))
    max(24px, env(safe-area-inset-left, 0px));
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.72);
}

.ef-overlay .ef-card {
  padding: 1em;
  border: 2px solid #2f4a35;
  border-radius: 1em;
  background: #141c16;
}

.ef-overlay .ef-button {
  width: min(100%, 14em);
}

.ef-overlay-title {
  margin: 0;
  font-size: 1.6em;
}

.ef-end-image {
  width: 100%;
  max-height: 26dvh;
  object-fit: contain;
  border-radius: 0.6em;
  background: #ffffff;
}

.ef-final {
  font-size: 1.3em;
}

.ef-new-best {
  display: block;
  color: #8ce390;
}


/* Landscape phones (~300px under the header): the end picture goes beside
   the score and buttons, so they stay clear of the bottom 40px. */
@media (orientation: landscape) and (max-height: 500px) {
  .ef-overlay .ef-card:has(.ef-end-image) {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
    grid-auto-flow: column;
    grid-template-rows: repeat(5, auto);
    justify-items: center;
    align-items: center;
    width: min(100%, 34em);
  }

  .ef-end-image {
    grid-row: 1 / -1;
    max-height: 60dvh;
  }
}
