/* Tailwind CSS CDN(按规范引入, 与自定义样式互补) */
@import url("https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css");

:root {
  --bg-0: #0f172a;
  --bg-1: #1e293b;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --primary-3: #ec4899;
  --text: #f8fafc;
  --text-soft: #cbd5e1;
  --text-faint: #94a3b8;
  --ok: #22c55e;
  --err: #ef4444;
  --warn: #f59e0b;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-brd: rgba(255, 255, 255, 0.12);
  --radius: 18px;
  --shadow: 0 20px 60px rgba(2, 6, 23, 0.55);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 15% -10%, #1b2547 0%, var(--bg-0) 55%) fixed;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── 背景动态光斑 ── */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; }
.orb--1 { width: 420px; height: 420px; background: var(--primary); top: -80px; left: -60px; animation: float 14s ease-in-out infinite; }
.orb--2 { width: 380px; height: 380px; background: var(--primary-3); bottom: -120px; right: -40px; animation: float 18s ease-in-out infinite reverse; }
.orb--3 { width: 300px; height: 300px; background: var(--primary-2); top: 40%; left: 55%; animation: float 22s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
}

/* ── 主容器 ── */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 20px 40px;
}

.hero { position: relative; text-align: center; margin-bottom: 26px; }
.hero__title {
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: 0.01em;
  margin: 0;
  background: linear-gradient(100deg, #a5b4fc, #c4b5fd 40%, #f9a8d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__sub { color: var(--text-soft); margin: 10px 0 0; font-size: 15px; }

/* ── 语言切换胶囊(中 / EN) ── */
.lang-switch {
  position: absolute;
  top: -6px;
  right: 0;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.lang-switch__btn {
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.lang-switch__btn:hover { color: var(--text); }
.lang-switch__btn.is-active {
  color: #fff;
  background: linear-gradient(100deg, var(--primary), var(--primary-2) 55%, var(--primary-3));
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}
@media (max-width: 520px) {
  .lang-switch { position: static; display: flex; width: fit-content; margin: 0 auto 14px; }
}

/* ── 玻璃卡片 ── */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  padding: 26px;
}

.grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }

.panel { display: flex; flex-direction: column; gap: 12px; }

.field-label { font-size: 13px; font-weight: 600; color: var(--text-soft); }

/* ── 文本输入 ── */
.text-input {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--glass-brd);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}
.meta { display: flex; align-items: center; gap: 12px; font-size: 12.5px; }
.meta__count { color: var(--text-faint); }
.meta__hint { color: var(--warn); }

/* ── 参数面板 ── */
.ctrl { gap: 14px; }
.row { display: flex; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.field--sm { flex: 0 0 38%; }

.select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-brd);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text);
  font-size: 14px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25); }
.select--voice { max-height: 220px; }
.select option { background: #0f172a; color: var(--text); }

/* ── 语言自绘下拉(带国旗) ── */
.lang-dd { position: relative; width: 100%; }
.lang-dd__native { display: none; }
.lang-dd__btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-brd);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.lang-dd__btn:focus,
.lang-dd.is-open .lang-dd__btn {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  outline: none;
}
.lang-dd__flag {
  width: 22px;
  height: 16px;
  border-radius: 3px;
  object-fit: cover;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.lang-dd__name {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lang-dd__caret {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  stroke: var(--text-faint);
  transition: transform 0.2s ease;
}
.lang-dd.is-open .lang-dd__caret { transform: rotate(180deg); }

.lang-dd__list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  animation: ddIn 0.16s ease;
}
@keyframes ddIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.lang-dd__list::-webkit-scrollbar { width: 8px; }
.lang-dd__list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 8px; }
.lang-dd__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.lang-dd__item:hover,
.lang-dd__item.is-active {
  background: rgba(99, 102, 241, 0.16);
  color: var(--text);
}
.lang-dd__item.is-active { font-weight: 600; }

/* ── 滑块 ── */
.slider-field { display: flex; flex-direction: column; gap: 8px; }
.slider-head { display: flex; justify-content: space-between; align-items: center; }
.slider-val {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.35);
  padding: 1px 10px;
  border-radius: 999px;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-3));
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--primary);
  box-shadow: 0 2px 8px rgba(2, 6, 23, 0.4);
  transition: transform 0.12s ease;
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.12); }
.slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid var(--primary); cursor: pointer;
}

/* ── 操作区 ── */
.actions { display: flex; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.btn {
  position: relative;
  border: none;
  border-radius: 14px;
  padding: 13px 26px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn--primary {
  color: #fff;
  background: linear-gradient(100deg, var(--primary), var(--primary-2) 55%, var(--primary-3));
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.4);
}
.btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(139, 92, 246, 0.5); }
.btn--ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-brd);
}
.btn--ghost:hover:not(:disabled) { transform: translateY(-2px); background: rgba(255, 255, 255, 0.14); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.player { width: 100%; margin-top: 18px; border-radius: 12px; }

/* ── 页脚 / Toast ── */
.ad-slot { margin-top: 30px; text-align: center; }
.ad-slot ins { margin: 0 auto; }
.foot { text-align: center; margin-top: 22px; color: var(--text-faint); font-size: 13px; }
.foot strong { color: var(--text-soft); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(16px);
  z-index: 50;
  max-width: 90vw;
  padding: 12px 20px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--glass-brd);
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--err { border-color: rgba(239, 68, 68, 0.6); }
.toast--ok { border-color: rgba(34, 197, 94, 0.6); }
