* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-image: url(hollywood.jpg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-family: Helvetica, sans-serif;
  zoom: 70%;
}

h1 {
  color: white;
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: normal;
  font-size: 47px;
  margin-bottom: 8px;
}

#btnUnlock, #btnLock {
  background: rgba(255, 255, 255, 0.4);
  color: #000;
  backdrop-filter: blur(4px);
  font-size: 18px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}

/* ── GRID ── */
.grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

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

/* ── CARDS ── */
.card {
  position: relative;
  width: 240px;
  height: 300px;
  border: 2px solid white;
  border-radius: 6px;
  cursor: pointer;
  perspective: 1000px; /* tarvitaan 3D-efektiin */
}

.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.card-large {
  width: 408px;
  height: 300px;
}

/* ── FLIP-RAKENNE ── */
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
  border-radius: 4px;
}

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

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 4px;
  overflow: hidden;
}

/* Etupuoli — numero */
.card-front {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Takapuoli — elokuvan kuva */
.card-back {
  transform: rotateY(180deg);
}

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

/* ── NUMEROT ── */
.card-number {
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(255, 255, 255, 0.4);
  color: #000;
  backdrop-filter: blur(4px);
  font-size: 32px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 2px;
}

.large-number {
  position: static;
  font-size: 48px;
}

.larger-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 100px;
  font-weight: 900;
  padding: 6px;
}

/* ── LUKITTU ── */
.card.locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(80%);
}

.card.locked:hover {
  box-shadow: none;
}

/* ── MODAL ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  position: relative;
  background: #ebe7e7;
  border-radius: 10px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.modal-box img {
  width: 100%;
  max-height: 55vh;
  border-radius: 6px;
  object-fit: contain;
}

.modal-box p {
  font-size: 15px;
  line-height: 1.6;
  color: #222;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #555;
  line-height: 1;
}

.modal-close:hover {
  color: #000;
}

/* ── TABLET ── */
@media (max-width: 768px) {
  .card {
    width: clamp(50px, 13vw, 120px);
    height: clamp(60px, 15vw, 140px);
  }

  .card-large {
    width: clamp(110px, 28vw, 260px);
    height: clamp(80px, 17vw, 180px);
  }
}

/* ── PHONE ── */
@media (max-width: 480px) {
  h1 {
    font-size: 16px;
    text-align: center;
  }

  .row {
    flex-wrap: wrap;
    justify-content: center;
  }

  .card {
    width: 28vw;
    height: 32vw;
  }

  .card-large {
    width: 60vw;
    height: 36vw;
  }

  .larger-number {
    font-size: 28px;
  }
}