<script setup lang="ts">
import { useI18n } from '@/composables/useI18n'

defineProps<{
  showResume: boolean
  showStory: boolean
  showAchievements: boolean
  isGameEnd: boolean
}>()

const emit = defineEmits<{
  start: []
  resume: []
  story: []
  achievements: []
  settings: []
}>()

const { t } = useI18n()
</script>

<template>
  <div class="main-menu-overlay">
    <div class="menu-center" v-if="isGameEnd">
      <div class="brand-title">天书 TianShu</div>
      <div class="brand-slogan">剧本由你执笔，命运自有分岔</div>
    </div>

    <div class="menu-bottom">
      <div class="bottom-left">
        <button v-if="showStory" class="sub-btn" @click="emit('story')">{{ t('ui.story') }}</button>
        <span v-if="showStory && showAchievements" class="sub-sep">·</span>
        <button v-if="showAchievements" class="sub-btn" @click="emit('achievements')">{{ t('ui.achievements') }}</button>
        <span v-if="(showStory || showAchievements)" class="sub-sep">·</span>
        <button class="sub-btn" @click="emit('settings')">{{ t('ui.settings') }}</button>
        <span v-if="showResume" class="sub-sep">·</span>
        <button v-if="showResume" class="sub-btn" @click="emit('start')">{{ t('ui.start') }}</button>
      </div>

      <div class="bottom-right">
        <button v-if="!showResume" class="action-btn" @click="emit('start')">{{ t('ui.start') }}</button>
        <button v-if="showResume" class="action-btn" @click="emit('resume')">{{ t('ui.resume') }}</button>
      </div>
    </div>
  </div>
</template>

<style scoped>
.main-menu-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 100;
  pointer-events: none;
}

.main-menu-overlay > * {
  pointer-events: auto;
}

.menu-center {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.brand-title {
  font-size: 22px;
  font-weight: 400;
  color: rgba(201, 168, 76, 0.5);
  letter-spacing: 10px;
  margin-bottom: 8px;
}

.brand-slogan {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.18);
  letter-spacing: 4px;
}

.menu-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 20px 28px 32px;
  background: linear-gradient(to top, rgba(0,0,0,0.4), transparent);
}

.bottom-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sub-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  transition: color 0.2s;
}

.sub-btn:hover {
  color: rgba(255, 255, 255, 0.7);
}

.sub-sep {
  color: rgba(255, 255, 255, 0.12);
  font-size: 12px;
  user-select: none;
}

.bottom-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.action-btn {
  padding: 8px 32px;
  font-size: 15px;
  color: #c9a84c;
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 3px;
  transition: all 0.2s;
}

.action-btn:hover {
  background: rgba(201, 168, 76, 0.2);
  border-color: rgba(201, 168, 76, 0.4);
}
</style>
