<script setup lang="ts">
import { roleImageUrl } from '../logic/roles'

defineProps<{
  role: string | null
}>()

defineEmits<{
  confirm: []
}>()
</script>

<template>
  <div v-if="role" class="overlay" @click="$emit('confirm')">
    <div class="content" @click.stop="$emit('confirm')">
      <img :src="roleImageUrl(role)" :alt="role" class="role-img" />
      <p class="role-name">{{ role }}</p>
      <p class="hint">点击确认</p>
    </div>
  </div>
</template>

<style scoped>
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 600px;
  width: 100%;
}
.role-img {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  border-radius: 12px;
}
.role-name {
  font-size: 2rem;
  font-weight: bold;
  margin: 0;
  color: white;
}
.hint {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.7 } 50% { opacity: 1 } }
</style>
