/* 事件弹窗基础 */
.event-mount[hidden],
.building-summary[hidden] {
  display: none;
}

.event-mount {
  position: absolute;
  inset: 0;
  z-index: 40;
}

/* 背景遮罩 - 增强进入动画 */
.event-backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 18px;
  background: rgba(20, 31, 26, 0);
  animation: event-backdrop-fade-in 0.3s ease-out forwards;
}

@keyframes event-backdrop-fade-in {
  to { background: rgba(20, 31, 26, 0.48); }
}

/* NPC 对话区域 */
.event-npc-section {
  width: min(100%, 380px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(-12px);
  animation: npc-section-enter 0.4s ease-out 0.15s forwards;
}

@keyframes npc-section-enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* NPC 头像 */
.npc-portrait {
  width: 80px;
  height: 80px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 8px 16px rgba(20, 31, 26, 0.24));
  animation: npc-portrait-bounce 0.6s ease-out;
}

@keyframes npc-portrait-bounce {
  0% { transform: scale(0.3) translateY(-20px); opacity: 0; }
  50% { transform: scale(1.08) translateY(0); }
  70% { transform: scale(0.96); }
  100% { transform: scale(1); opacity: 1; }
}

.npc-portrait-frame {
  width: 80px;
  height: 80px;
  overflow: hidden;
  border: 3px solid rgba(255, 252, 244, 0.95);
  border-radius: 50%;
  background: linear-gradient(145deg, #f5f3ed, #fffdf7);
  box-shadow:
    0 8px 24px rgba(41, 76, 59, 0.2),
    inset 0 2px 6px rgba(255, 255, 255, 0.5);
}

.npc-portrait-frame img {
  display: block;
  width: 112%;
  height: 112%;
  object-fit: contain;
  object-position: center bottom;
}

/* 对话气泡 */
.dialogue-bubble {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  isolation: isolate;
  width: min(100%, 360px);
  min-height: 168px;
  margin-top: -10px;
  padding: 38px 34px 42px 38px;
  border: 0;
  border-radius: 28px;
  background: url('../../assets/runtime/ui/ui-dialogue-frame-oat-transparent.png') center / 100% 100% no-repeat;
  box-shadow: 0 16px 30px rgba(74, 55, 30, 0.16);
  color: #293f37;
  animation: dialogue-bubble-enter 0.4s ease-out 0.3s both;
}

.dialogue-bubble::before {
  content: none;
}

@keyframes dialogue-bubble-enter {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.dialogue-bubble-speaker {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 0;
  margin-bottom: 6px;
  border: 0;
  background: transparent;
  color: #6b7f59;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.dialogue-bubble-text {
  position: relative;
  z-index: 1;
  color: #283c34;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.55;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.dialogue-bubble-tail {
  display: none;
}

/* 事件卡片 */
.event-card {
  width: min(100%, 380px);
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(180deg, #fffdf7 0%, #fefbf3 100%);
  box-shadow:
    0 20px 60px rgba(20, 31, 26, 0.32),
    0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  opacity: 0;
  transform: translateY(20px);
  animation: event-card-enter 0.45s ease-out 0.2s forwards;
}

@keyframes event-card-enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 插图区域 */
.event-illustration {
  margin: -24px -24px 16px;
  height: 160px;
  display: grid;
  place-items: center;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #e8f0e6 0%, #f5f9f3 100%);
  overflow: hidden;
}

.event-illustration-img {
  max-width: 90%;
  max-height: 130px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(41, 76, 59, 0.15));
}

.event-illustration-logo {
  max-width: 118px;
  max-height: 118px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 30px;
  background:
    radial-gradient(circle at 45% 20%, rgba(255, 255, 255, 0.76), transparent 46%),
    rgba(255, 255, 255, 0.28);
  box-shadow:
    0 14px 30px rgba(41, 76, 59, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px) saturate(1.22);
  -webkit-backdrop-filter: blur(14px) saturate(1.22);
  filter: drop-shadow(0 10px 16px rgba(41, 76, 59, 0.18));
}

.event-illustration-building {
  max-width: 70%;
  max-height: 120px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 6px 16px rgba(41, 76, 59, 0.22));
}

.event-illustration-pulse {
  animation: illustration-pulse 2s ease-in-out infinite;
}

@keyframes illustration-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.event-illustration-icon {
  font-size: 4rem;
  animation: icon-float 3s ease-in-out infinite;
}

@keyframes icon-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* 奖励展示动画 */
.reward-showcase {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 10px 0 6px;
}

.reward-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 6px 13px 6px 7px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.72), transparent 32%),
    rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow:
    0 10px 22px rgba(41, 76, 59, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.36);
  opacity: 0;
  transform: scale(0.5) translateY(-10px);
  animation: reward-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.reward-item img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 5px 8px rgba(41, 76, 59, 0.16));
}

.reward-item:nth-child(1) { animation-delay: 0.1s; }
.reward-item:nth-child(2) { animation-delay: 0.2s; }
.reward-item:nth-child(3) { animation-delay: 0.3s; }

@keyframes reward-pop {
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.reward-coin {
  color: #9a681b;
  background-color: rgba(255, 242, 190, 0.82);
}

.reward-dice {
  color: #385f85;
  background-color: rgba(226, 241, 255, 0.84);
}

.reward-xp {
  color: #5f7d29;
  background-color: rgba(238, 249, 210, 0.82);
}

/* 文本内容 */
.event-eyebrow {
  display: inline-block;
  margin-bottom: 4px;
  color: #426b57;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.event-card h2 {
  margin: 6px 0 12px;
  color: #294c3b;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}

.event-body {
  margin: 0 0 20px;
  color: #426b57;
  font-size: 0.95rem;
  line-height: 1.6;
}

.event-message {
  padding: 10px 14px;
  margin: -8px 0 16px;
  border-radius: 12px;
  background: rgba(163, 59, 47, 0.08);
  color: #a33b2f;
  font-size: 0.85rem;
  font-weight: 600;
}

/* 按钮区域 */
.event-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.event-button {
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  background: linear-gradient(145deg, #2e6b4a, #234a37);
  color: white;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 200ms ease;
  box-shadow: 0 4px 12px rgba(41, 76, 59, 0.25);
  position: relative;
  overflow: hidden;
}

.event-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.event-button:hover:not(:disabled) {
  background: linear-gradient(145deg, #3a8557, #2e6b4a);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(41, 76, 59, 0.35);
}

.event-button:hover:not(:disabled)::before {
  opacity: 1;
}

.event-button:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
  transition: transform 100ms ease;
}

.event-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.event-button.is-secondary {
  background: rgba(255, 252, 244, 0.9);
  border-color: rgba(41, 76, 59, 0.16);
  color: #294c3b;
  box-shadow: 0 2px 8px rgba(41, 76, 59, 0.12);
}

.event-button.is-secondary:hover:not(:disabled) {
  background: rgba(255, 252, 244, 1);
  border-color: rgba(41, 76, 59, 0.22);
  box-shadow: 0 4px 12px rgba(41, 76, 59, 0.18);
}

.event-button.is-danger {
  background: linear-gradient(145deg, #c85a4a, #a33b2f);
  border-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.event-button.is-danger:hover:not(:disabled) {
  background: linear-gradient(145deg, #d66b5c, #c85a4a);
}

/* 建筑摘要 */
.building-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  font-size: 0.78rem;
}

/* 响应式 */
@media (max-width: 380px) {
  .event-backdrop { padding: 12px; }
  .event-card { padding: 20px; }
  .event-illustration {
    margin: -20px -20px 14px;
    height: 140px;
  }
  .dialogue-bubble {
    width: min(100%, 300px);
    padding: 16px 18px 18px;
  }
}
