/* ==========================================================================
   IDO搜索 - 二次元风格样式
   --------------------------------------------------------------------------
   设计要点：
   - 深蓝紫夜空渐变背景 + 樱花飘落 / 星星闪烁动画（尊重 prefers-reduced-motion）
   - 糖果色徽章引擎卡片，柔和光晕
   - 所有主题色集中在 :root，换肤只改这里
   ========================================================================== */

:root {
  /* ---- 主题色（换肤改这里） ---- */
  --bg-top: #17103a;
  --bg-mid: #2b1a5e;
  --bg-bot: #46277f;
  --pink: #ff8ad4;
  --violet: #a78bfa;
  --cyan: #67e8f9;
  --gold: #ffd97a;

  /* ---- 文字 ---- */
  --ink: #fdf6ff;
  --ink-dim: rgba(253, 246, 255, 0.74);
  --ink-faint: rgba(253, 246, 255, 0.48);

  /* ---- 卡片 ---- */
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.16);

  /* ---- 字体 ---- */
  --font-display: "ZCOOL KuaiLe", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  /* ---- 圆角 ---- */
  --r-lg: 28px;
  --r-md: 16px;
  --r-sm: 12px;
}

/* ===== 基础 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(60% 45% at 85% 12%, rgba(255, 138, 212, 0.16), transparent 60%),
    radial-gradient(50% 40% at 8% 88%, rgba(103, 232, 249, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 55%, var(--bg-bot) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ===== 背景装饰：樱花 + 星星 ===== */
.bg-decor { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

.petal {
  position: absolute;
  top: -5%;
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 30% 30%, #ffd6ec, #ff8ad4 70%);
  border-radius: 100% 0 100% 0;
  opacity: 0.85;
  animation: petal-fall linear infinite;
}
.p1 { left: 6%;  animation-duration: 13s; animation-delay: 0s;  transform: scale(0.9); }
.p2 { left: 22%; animation-duration: 17s; animation-delay: 3s;  transform: scale(0.7); }
.p3 { left: 43%; animation-duration: 15s; animation-delay: 6s;  transform: scale(1.1); }
.p4 { left: 62%; animation-duration: 19s; animation-delay: 2s;  transform: scale(0.8); }
.p5 { left: 78%; animation-duration: 14s; animation-delay: 8s;  transform: scale(1); }
.p6 { left: 92%; animation-duration: 18s; animation-delay: 5s;  transform: scale(0.7); }

@keyframes petal-fall {
  0%   { transform: translateY(-4vh) rotate(0deg); }
  100% { transform: translateY(106vh) rotate(300deg); }
}

.star {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--gold);
  clip-path: polygon(50% 0, 63% 38%, 100% 50%, 63% 62%, 50% 100%, 37% 62%, 0 50%, 37% 38%);
  animation: twinkle ease-in-out infinite;
}
.s1 { top: 16%; left: 12%; animation-duration: 3s; }
.s2 { top: 30%; left: 88%; animation-duration: 4s; }
.s3 { top: 62%; left: 4%;  animation-duration: 3.6s; }
.s4 { top: 74%; left: 94%; animation-duration: 4.4s; }
.s5 { top: 8%;  left: 55%; animation-duration: 3.2s; }

@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.7); }
  50%      { opacity: 1;    transform: scale(1.15); }
}

/* ===== 页头 ===== */
.site-header {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 44px 20px 8px;
}

.site-logo {
  width: clamp(150px, 24vw, 210px);
  height: auto;
  filter: drop-shadow(0 10px 28px rgba(255, 138, 212, 0.35));
  animation: logo-float 5s ease-in-out infinite;
}

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

.tagline {
  margin-top: 12px;
  font-size: 15px;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
}

/* ===== 主体 ===== */
.page-main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: min(1080px, 94vw);
  margin: 0 auto;
  padding: 26px 0 40px;
}

/* ===== 搜索区 ===== */
.search-box { display: flex; flex-direction: column; align-items: center; }

.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px 6px 8px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-dim);
  backdrop-filter: blur(6px);
}

.chip-badge {
  width: 26px;
  height: 26px;
  border-radius: 32%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--pink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 2px 8px rgba(0, 0, 0, 0.25);
}

.search-form {
  display: flex;
  align-items: center;
  width: min(720px, 100%);
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid var(--card-border);
  border-radius: 999px;
  padding: 7px 7px 7px 22px;
  gap: 10px;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
  backdrop-filter: blur(8px);
}

.search-form:focus-within {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 138, 212, 0.18), 0 12px 36px rgba(0, 0, 0, 0.3);
}

.search-icon { width: 20px; height: 20px; color: var(--ink-faint); flex: none; }

.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
  padding: 10px 0;
}
.search-input::placeholder { color: var(--ink-faint); }

.search-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pink) 0%, var(--violet) 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.05em;
  box-shadow: 0 6px 22px rgba(255, 138, 212, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.search-btn svg { width: 18px; height: 18px; }
.search-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(255, 138, 212, 0.55); }
.search-btn:active { transform: translateY(0); }

.hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}

/* 空输入抖动提示 */
.search-form.shake { animation: shake 0.4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* ===== 引擎区 ===== */
.engines { margin-top: 34px; }

.category-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.tab {
  padding: 9px 22px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-dim);
  font-size: 14.5px;
  letter-spacing: 0.08em;
  transition: all 0.22s;
}
.tab:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.35); transform: translateY(-2px); }
.tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(255, 138, 212, 0.4);
}

.engine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}

.engine-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 10px 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--r-md);
  background: var(--card-bg);
  color: var(--ink);
  transition: transform 0.22s, border-color 0.22s, box-shadow 0.22s, background 0.22s;
}

.engine-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 138, 212, 0.7);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 28px rgba(255, 138, 212, 0.22);
}

.engine-card.selected {
  border-color: var(--pink);
  background: linear-gradient(160deg, rgba(255, 138, 212, 0.18), rgba(167, 139, 250, 0.18));
  box-shadow: 0 8px 26px rgba(255, 138, 212, 0.3);
}

/* “使用中”角标 */
.engine-card.selected::after {
  content: "使用中";
  position: absolute;
  top: 7px;
  right: 7px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  font-size: 10.5px;
  color: #fff;
  letter-spacing: 0.04em;
}

.engine-badge {
  width: 48px;
  height: 48px;
  border-radius: 32%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  background: var(--c, var(--violet));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 4px 14px rgba(0, 0, 0, 0.3);
  transition: transform 0.22s;
}
.engine-card:hover .engine-badge { transform: scale(1.08) rotate(-4deg); }

.engine-name {
  font-size: 14px;
  color: var(--ink);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.engine-desc {
  font-size: 12px;
  color: var(--ink-faint);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 页脚 ===== */
.site-footer {
  position: relative;
  z-index: 1;
  padding: 18px 20px 26px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}

/* ===== 键盘焦点可见 ===== */
:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ===== 尊重减弱动效偏好 ===== */
@media (prefers-reduced-motion: reduce) {
  .petal, .star { animation: none !important; opacity: 0; }
  .site-logo { animation: none; }
  * { transition: none !important; }
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .site-header { padding-top: 30px; }
  .site-logo { width: clamp(130px, 42vw, 180px); }
  .search-input { font-size: 16px; }
  .search-btn { padding: 12px 18px; font-size: 15px; }
  .search-btn span { display: none; }
  .engine-grid { grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 11px; }
  .engine-card { padding: 15px 8px 12px; }
  .hint { text-align: center; }
}

@media (max-width: 380px) {
  .engine-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}
