<template>
  <button
    class="word-card"
    :class="[`tone-${word.tone}`, { 'is-muted': word.muted }]"
    type="button"
    @click="$emit('click', word)"
  >
    <strong class="word-text">{{ word.word }}</strong>
    <span class="word-meaning">{{ word.meaning }}</span>
    <span class="word-pos">{{ word.partOfSpeech }}</span>
  </button>
</template>

<script setup lang="ts">
export interface WordCardItem {
  id: number;
  word: string;
  meaning: string;
  partOfSpeech: string;
  tone: "pink" | "cream" | "yellow" | "green" | "gray";
  muted?: boolean;
  grade: string;
  status: string;
}

defineProps<{
  word: WordCardItem;
}>();

defineEmits<{
  click: [word: WordCardItem];
}>();
</script>

<style scoped lang="scss">
.word-card {
  display: flex;
  min-width: 0;
  height: 248px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(212, 222, 238, 0.8);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(54, 84, 132, 0.06);
  cursor: pointer;
  font: inherit;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;

  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(54, 84, 132, 0.12);
  }
}

.tone-pink {
  background: #fff5f6;
}

.tone-cream {
  background: #fff9f4;
}

.tone-yellow {
  background: #fffdf0;
}

.tone-green {
  background: #effff7;
}

.tone-gray {
  background: #f8f8f8;
}

.is-muted {
  color: #999;
}

.word-text {
  color: #121212;
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
}

.word-meaning {
  margin-top: 32px;
  color: #333;
  font-size: 28px;
  line-height: 1;
}

.word-pos {
  margin-top: 20px;
  color: #333;
  font-size: 26px;
  line-height: 1;
}

.is-muted .word-text,
.is-muted .word-meaning,
.is-muted .word-pos {
  color: #999;
}
</style>
