/* ============================================================
 *  入场动画 & 微交互
 * ============================================================ */

/* 时钟从下方滑入 */
.clock {
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.greeting {
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s backwards;
}
.weather-inline {
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.15s backwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 格言淡入 */
.quote {
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s backwards;
}

/* 引擎按钮逐个滑入 */
.engine-btn {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.engine-btn:nth-child(1) { animation-delay: 0.20s; }
.engine-btn:nth-child(2) { animation-delay: 0.25s; }
.engine-btn:nth-child(3) { animation-delay: 0.30s; }
.engine-btn:nth-child(4) { animation-delay: 0.35s; }
.engine-btn:nth-child(5) { animation-delay: 0.40s; }
.engine-btn:nth-child(6) { animation-delay: 0.45s; }

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 搜索框淡入 */
.search-area {
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.3s backwards;
}

/* 书签卡片逐个淡入 */
.links-grid .link-item {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.links-grid .link-item:nth-child(1) { animation-delay: 0.40s; }
.links-grid .link-item:nth-child(2) { animation-delay: 0.44s; }
.links-grid .link-item:nth-child(3) { animation-delay: 0.48s; }
.links-grid .link-item:nth-child(4) { animation-delay: 0.52s; }
.links-grid .link-item:nth-child(5) { animation-delay: 0.56s; }
.links-grid .link-item:nth-child(6) { animation-delay: 0.60s; }
.links-grid .link-item:nth-child(7) { animation-delay: 0.64s; }
.links-grid .link-item:nth-child(8) { animation-delay: 0.68s; }

/* 小组件依次淡入 */
.widget {
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.6s backwards;
}

/* ============ 每日格言 ============ */
.quote {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  line-height: 1.5;
  position: relative;
  transition: opacity 0.3s;
}
.quote-mark {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  margin-right: 0.15rem;
  opacity: 0.6;
}
.quote-text {
  font-style: italic;
}
.quote-author {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 0.4rem;
}
.quote-author::before {
  content: '— ';
  opacity: 0.6;
}

/* ============ 搜索框复制按钮 ============ */
.copy-btn {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background-color: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  opacity: 0;
  pointer-events: none;
  font-family: var(--font-mono);
  line-height: 1;
  border: none;
}
.search-wrapper:hover .copy-btn,
.search-input:focus ~ .copy-btn {
  opacity: 1;
  pointer-events: auto;
}
.copy-btn:hover {
  background-color: var(--bg-hover);
  color: var(--accent);
}
.copy-btn:active { transform: translateY(-50%) scale(0.92); }

/* ============ 搜索历史 ============ */
.history-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: -0.4rem;
  min-height: 0;
}
.history-bar:empty { display: none; }

.history-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.history-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background-color: var(--accent-soft);
}
.history-chip .history-del {
  font-size: 0.7rem;
  opacity: 0.5;
  padding: 0 0.1rem;
  transition: opacity 0.15s;
}
.history-chip:hover .history-del {
  opacity: 1;
}
.history-chip .history-del:hover {
  color: var(--red);
}

/* ============ 极简模式 ============ */
body.minimal-mode .top-bar,
body.minimal-mode .engine-selector-wrapper,
body.minimal-mode .quote,
body.minimal-mode .history-bar,
body.minimal-mode .links-section,
body.minimal-mode .widgets-area,
body.minimal-mode .divider,
body.minimal-mode .footer-note,
body.minimal-mode .weather-inline,
body.minimal-mode .greeting {
  display: none !important;
}

body.minimal-mode .home {
  gap: 2rem;
  justify-content: center;
  min-height: 60vh;
}

body.minimal-mode .clock {
  font-size: 6rem;
  margin-bottom: 1rem;
}

body.minimal-mode .search-area {
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

/* 退出提示 */
.minimal-hint {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
  z-index: 50;
}
body.minimal-mode .minimal-hint {
  opacity: 1;
}
body.minimal-mode:hover .minimal-hint {
  opacity: 0.4;
}

/* ============ 搜索建议增强：引擎图标 ============ */
.suggest-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.suggest-engine-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 3px;
  background-color: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.suggest-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 移动端适配 */
@media (max-width: 640px) {
  body.minimal-mode .clock { font-size: 4rem; }
  .theme-market {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .theme-card { padding: 0.7rem; }
  .theme-card-preview { height: 26px; }
}