.photo-puzzle-app {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 10px;
  height: 100%;
  min-height: 0;
  padding: clamp(10px, 1.5vw, 16px);
  color: #f8fbff;
  background:
    radial-gradient(circle at top left, rgba(255, 185, 70, 0.24), transparent 26%),
    radial-gradient(circle at top right, rgba(94, 183, 255, 0.22), transparent 30%),
    linear-gradient(180deg, #121826 0%, #0a1020 100%);
  border-radius: 20px;
  overflow: hidden;
}

.photo-puzzle-app__topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.photo-puzzle-app__back {
  width: auto;
  color: #f8fbff;
  padding-inline: 0;
}

.photo-puzzle-app__title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.photo-puzzle-app__title strong {
  font-size: clamp(18px, 2vw, 22px);
}

.photo-puzzle-app__title span,
.photo-puzzle-app__statusline {
  font-size: 12px;
  color: rgba(248, 251, 255, 0.72);
}

.photo-puzzle-app__filters {
  min-height: 0;
}

.photo-puzzle-app__statusline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, auto);
  gap: 8px;
  align-items: center;
}

.photo-puzzle-app__statusline span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-puzzle-app__board-shell {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
}

.photo-puzzle-app__board {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 0;
  padding: 4px;
  background: rgba(4, 10, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.photo-puzzle-app__tile {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  background-color: #22304e;
  box-shadow: none;
  transition: opacity 160ms ease;
}

.photo-puzzle-app__tile:hover {
  opacity: 0.94;
}

.photo-puzzle-app__tile em {
  position: absolute;
  left: 4px;
  bottom: 4px;
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  background: rgba(5, 11, 23, 0.72);
  color: #fff;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
}

.photo-puzzle-app__tile--blank {
  background: rgba(255, 255, 255, 0.08);
  cursor: default;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.photo-puzzle-app__tile--blank:hover {
  opacity: 1;
}

.photo-puzzle-app__success {
  position: absolute;
  inset: 10px;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  border-radius: 8px;
  background: rgba(7, 14, 28, 0.82);
  backdrop-filter: blur(4px);
}

.photo-puzzle-app__success .anticon {
  font-size: 28px;
  color: #ffd76f;
}

.photo-puzzle-app__bottom {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 8px;
  min-height: 0;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.photo-puzzle-app__controls,
.photo-puzzle-app__actions,
.photo-puzzle-app__thumbs-header,
.photo-puzzle-app__thumbs-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.photo-puzzle-app__controls {
  justify-content: space-between;
}

.photo-puzzle-app__actions {
  justify-content: flex-end;
}

.photo-puzzle-app__thumbs-header {
  justify-content: space-between;
  font-size: 12px;
  color: rgba(248, 251, 255, 0.7);
}

.photo-puzzle-app__thumbs-complete {
  color: #73ffa7;
}

.photo-puzzle-app__thumbs {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  min-height: 0;
}

.photo-puzzle-app__thumb {
  display: grid;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 14, 28, 0.78);
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
}

.photo-puzzle-app__thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
}

.photo-puzzle-app__thumb span {
  font-size: 10px;
  color: rgba(248, 251, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-puzzle-app__thumb--active {
  border-color: rgba(255, 206, 107, 0.72);
  background: rgba(19, 29, 52, 0.96);
}

@media (max-width: 900px) {
  .photo-puzzle-app__controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .photo-puzzle-app__actions {
    justify-content: stretch;
  }

  .photo-puzzle-app__actions .ant-btn {
    flex: 1 1 0;
  }
}

@media (max-width: 720px) {
  .photo-puzzle-app {
    padding: 10px;
  }

  .photo-puzzle-app__statusline {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .photo-puzzle-app__statusline span:first-child {
    grid-column: 1 / -1;
  }

  .photo-puzzle-app__thumbs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .photo-puzzle-app__topbar {
    gap: 6px;
  }

  .photo-puzzle-app__title strong {
    font-size: 16px;
  }

  .photo-puzzle-app__bottom {
    padding: 6px;
  }

  .photo-puzzle-app__thumbs {
    gap: 4px;
  }

  .photo-puzzle-app__thumb {
    padding: 3px;
  }

  .photo-puzzle-app__thumb span {
    display: none;
  }
}
