/* ==========================================================================
   AI 创作：便当盒式的能力网格，每格一个会动的小示意
   ========================================================================== */

.ai {
  overflow: hidden;
  background: var(--white);
}

/* 极光：几团缓慢漂移的绿光 */
.ai__aurora {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.4;
}

.ai__aurora i {
  position: absolute;
  border-radius: 50%;
}

.ai__aurora i:nth-child(1) {
  left: 8%;
  top: 30%;
  width: 520px;
  height: 380px;
  background: rgba(var(--brand-rgb), 0.35);
}

.ai__aurora i:nth-child(2) {
  right: 4%;
  top: 12%;
  width: 460px;
  height: 340px;
  background: rgba(184, 240, 74, 0.45);
}

.ai__aurora i:nth-child(3) {
  left: 40%;
  bottom: -10%;
  width: 560px;
  height: 300px;
  background: rgba(134, 235, 175, 0.4);
}

.ai.is-active .ai__aurora i {
  animation: ai-drift 18s var(--ease-in-out) infinite alternate;
}

.ai.is-active .ai__aurora i:nth-child(2) {
  animation-duration: 22s;
  animation-delay: -6s;
}

.ai.is-active .ai__aurora i:nth-child(3) {
  animation-duration: 26s;
  animation-delay: -11s;
}

@keyframes ai-drift {
  to {
    transform: translate(60px, -40px) scale(1.12);
  }
}

/* ---------- 网格 ---------- */

.ai__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(0, auto);
  gap: 16px;
}

.ai__tile {
  --mx: 50%;
  --my: 0%;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  min-width: 0;
  padding: 20px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(420px circle at var(--mx) var(--my), rgba(var(--brand-rgb), 0.12), transparent 45%),
    linear-gradient(180deg, #ffffff, var(--mint-50));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transition:
    border-color var(--t-mid) var(--ease-out),
    transform var(--t-slow) var(--ease-out);
}

.ai__tile:hover {
  border-color: rgba(var(--brand-rgb), 0.35);
}

.ai__tile--film {
  grid-column: 1 / span 2;
  grid-row: 1 / span 2;
}

.ai__tile--copy {
  grid-column: 3;
  grid-row: 1;
}

.ai__tile--avatar {
  grid-column: 4;
  grid-row: 1;
}

.ai__tile--voice {
  grid-column: 3;
  grid-row: 2;
}

.ai__tile--break {
  grid-column: 4;
  grid-row: 2;
}

.ai__tile--covers {
  grid-column: 1;
  grid-row: 3;
}

.ai__tile--remix {
  grid-column: 2 / span 2;
  grid-row: 3;
}

.ai__tile--ideas {
  grid-column: 4;
  grid-row: 3;
}

.ai__viz {
  position: relative;
  min-height: 150px;
  border-radius: 16px;
  background: rgba(12, 31, 21, 0.03);
  border: 1px solid var(--line);
  overflow: hidden;
}

.ai__text {
  display: grid;
  align-content: start;
  gap: 8px;
}

.ai__text h3 {
  font-weight: 700;
}

.ai__text p {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-2);
  text-wrap: pretty;
}

.ai__tile--film .ai__text p {
  font-size: 16px;
  max-width: 34em;
}

/* ---------- 一键成片 ---------- */

.ai__film {
  display: grid;
  gap: 16px;
  padding: 18px;
  min-height: 360px;
  align-content: start;
}

.ai__film-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--text);
  background: rgba(12, 31, 21, 0.05);
  border: 1px solid rgba(var(--brand-rgb), 0.3);
}

.ai__film-spark {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--brand), var(--gold), var(--brand));
}

.ai.is-active .ai__film-spark {
  animation: ai-spin 2.6s linear infinite;
}

@keyframes ai-spin {
  to {
    transform: rotate(360deg);
  }
}

.ai__shots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.ai__shots li {
  display: grid;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-3);
  text-align: center;
}

.ai__shot {
  position: relative;
  aspect-ratio: 9 / 16;
  max-height: 150px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(12, 31, 21, 0.05);
  border: 1px dashed var(--line-strong);
}

.ai__shot::before {
  /* 生成出来的画面 */
  content: "";
  position: absolute;
  inset: 0;
  /* 分镜：同一次拍摄的不同景别 */
  background: url("../../img/scenes/coffee.jpg") var(--pos, center) / var(--zoom, cover) no-repeat, #173024;
  opacity: 0;
  transform: scale(1.08);
  transition:
    opacity 600ms var(--ease-out),
    transform 900ms var(--ease-out);
}

.ai__shots li.is-done .ai__shot {
  border-style: solid;
  border-color: rgba(var(--brand-rgb), 0.4);
}

.ai__shots li.is-done .ai__shot::before {
  opacity: 1;
  transform: none;
}

.ai__shots li.is-done span {
  color: var(--text-2);
}

.ai__tracks {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(12, 31, 21, 0.03);
  border: 1px solid var(--line);
}

.ai__track {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-3);
}

.ai__track p {
  display: flex;
  gap: 3px;
  height: 12px;
}

.ai__track i {
  flex: 0 0 var(--w);
  border-radius: 3px;
  background: rgba(12, 31, 21, 0.08);
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform 800ms var(--ease-out);
}

.ai__track--video i {
  background: linear-gradient(90deg, rgba(var(--brand-rgb), 0.75), rgba(184, 240, 74, 0.8));
}

.ai__track--voice i {
  background: repeating-linear-gradient(90deg, rgba(10, 138, 62, 0.6) 0 2px, transparent 2px 4px);
}

.ai__track--subs i {
  background: rgba(12, 31, 21, 0.22);
}

.ai__film.is-tracks .ai__track i {
  transform: scaleX(1);
}

.ai__film.is-tracks .ai__track--voice i {
  transition-delay: 150ms;
}

.ai__film.is-tracks .ai__track--subs i {
  transition-delay: 300ms;
}

.ai__playhead {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: calc(56px + (100% - 68px) * var(--p, 0));
  width: 2px;
  border-radius: 2px;
  background: var(--brand);
  box-shadow: 0 0 8px rgba(var(--brand-rgb), 0.6);
  opacity: 0;
  transition: opacity var(--t-mid) var(--ease-out);
}

.ai__film.is-playing .ai__playhead {
  opacity: 1;
}

.ai__film-done {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  padding: 8px 14px 8px 10px;
  border-radius: var(--r-pill);
  background: rgba(74, 222, 154, 0.1);
  border: 1px solid rgba(74, 222, 154, 0.3);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 500ms var(--ease-out),
    transform 600ms var(--ease-spring);
}

.ai__film-done b {
  color: var(--text);
  font-weight: 600;
}

.ai__film-done em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--text-3);
}

.ai__film-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'><path d='M5 9.4l2.6 2.6L13 6.4' fill='none' stroke='%230b2b1c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>")
      center / 100% no-repeat,
    var(--live);
}

.ai__film.is-done .ai__film-done {
  opacity: 1;
  transform: none;
}

/* ---------- AI 文案 ---------- */

.ai__copy {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
}

.ai__copy-tabs {
  display: flex;
  gap: 6px;
}

.ai__copy-tabs span {
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  color: var(--text-3);
  border: 1px solid var(--line);
  transition:
    color var(--t-mid) var(--ease-out),
    background-color var(--t-mid) var(--ease-out),
    border-color var(--t-mid) var(--ease-out);
}

.ai__copy-tabs span.is-on {
  color: var(--text);
  border-color: rgba(var(--brand-rgb), 0.55);
  background: rgba(var(--brand-rgb), 0.14);
}

.ai__copy-line {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--brand-700);
  min-height: 1.5em;
}

.ai__copy-line--title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-height: 3.1em;
}

.ai__copy-line.is-typing::after,
.ai__subtitle.is-typing::after {
  content: "";
  display: inline-block;
  width: 1.5px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.12em;
  background: var(--brand);
}

/* ---------- 数字人口播 ---------- */

.ai__avatar {
  display: grid;
  justify-items: center;
  align-content: end;
  padding: 12px 12px 10px;
  background:
    radial-gradient(60% 70% at 50% 35%, rgba(var(--brand-rgb), 0.22), transparent 70%),
    rgba(12, 31, 21, 0.03);
}

.ai__person {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 128px;
  transform: translateX(-50%);
}

.ai__mouth {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.ai.is-active .ai__mouth {
  animation: ai-talk 0.46s var(--ease-in-out) infinite alternate;
}

@keyframes ai-talk {
  0% {
    transform: scaleY(0.4);
  }
  60% {
    transform: scaleY(1.6);
  }
  100% {
    transform: scaleY(0.8);
  }
}

.ai__ring {
  position: absolute;
  left: 50%;
  top: 22%;
  width: 70px;
  height: 70px;
  margin-left: -35px;
  border-radius: 50%;
  border: 1.5px solid rgba(var(--brand-rgb), 0.5);
  opacity: 0;
}

.ai.is-active .ai__ring {
  animation: ai-ring 2s var(--ease-out) infinite;
}

@keyframes ai-ring {
  0% {
    opacity: 0.8;
    transform: scale(0.9);
  }
  100% {
    opacity: 0;
    transform: scale(2);
  }
}

.ai__subtitle {
  position: relative;
  z-index: 1;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  text-align: center;
  min-height: 1.45em;
}

.ai__langs {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  gap: 4px;
}

.ai__langs span {
  padding: 2px 7px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  text-align: center;
  transition:
    color var(--t-mid) var(--ease-out),
    border-color var(--t-mid) var(--ease-out);
}

.ai__langs span.is-on {
  color: var(--text);
  border-color: rgba(var(--brand-rgb), 0.55);
}

/* ---------- 声音克隆 ---------- */

.ai__voice {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 18px 16px;
}

.ai__voice-row {
  display: grid;
  gap: 8px;
}

.ai__voice-tag {
  justify-self: start;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  color: var(--text-2);
  border: 1px solid var(--line-strong);
}

.ai__voice-tag--out {
  color: var(--brand-700);
  border-color: rgba(var(--brand-rgb), 0.45);
}

.ai__wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 34px;
}

.ai__wave i {
  flex: 1;
  height: 30%;
  border-radius: 2px;
  background: rgba(12, 31, 21, 0.18);
}

.ai__wave--sample i:nth-child(3n) { height: 70%; }
.ai__wave--sample i:nth-child(4n + 1) { height: 50%; }
.ai__wave--sample i:nth-child(5n + 2) { height: 90%; }

.ai__wave--live i {
  background: linear-gradient(180deg, var(--gold), var(--brand));
}

.ai.is-active .ai__wave--live i {
  animation: ai-wave 1.1s var(--ease-in-out) infinite alternate;
}

.ai__wave--live i:nth-child(2n) { animation-delay: -0.3s !important; }
.ai__wave--live i:nth-child(3n) { animation-delay: -0.55s !important; }
.ai__wave--live i:nth-child(5n) { animation-delay: -0.8s !important; }
.ai__wave--live i:nth-child(7n) { animation-delay: -0.15s !important; }

@keyframes ai-wave {
  0% {
    height: 18%;
  }
  100% {
    height: 100%;
  }
}

/* ---------- 爆款拆解 ---------- */

.ai__break {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 16px;
}

.ai__link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-2);
  background: rgba(12, 31, 21, 0.05);
  border: 1px solid var(--line);
}

.ai__link-icon {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1.5px solid var(--brand-700);
}

.ai__segs {
  display: flex;
  gap: 3px;
  height: 44px;
}

.ai__segs li {
  flex: 0 0 calc(var(--w) - 3px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1px;
  border-radius: 6px;
  background: hsl(calc(146 - var(--i) * 14) 72% calc(52% + var(--i) * 4%) / 0.9);
  color: var(--on-accent);
  opacity: 0.18;
  transform: translateY(6px);
  transition:
    opacity 400ms var(--ease-out),
    transform 500ms var(--ease-spring);
  transition-delay: calc(var(--i) * 160ms);
}

.ai__segs b {
  font-size: 11.5px;
  font-weight: 700;
}

.ai__segs em {
  font-style: normal;
  font-size: 9.5px;
  opacity: 0.8;
}

.ai.is-active .ai__segs li {
  opacity: 1;
  transform: none;
}

.ai__rewrite {
  font-size: 12px;
  color: var(--brand-700);
}

/* ---------- AI 封面 ---------- */

.ai__covers {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  height: 170px;
  padding: 18px 12px;
}

.ai__cv {
  position: relative;
  display: grid;
  place-items: end start;
  padding: 7px;
  border-radius: 8px;
  overflow: hidden;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 11px;
  line-height: 1.15;
  color: #fff;
  background:
    linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.6)),
    url("../../img/scenes/coffee.jpg") 60% 50% / cover no-repeat,
    #173024;
  box-shadow: 0 10px 24px -14px rgba(12, 31, 21, 0.5);
}

.ai__cv--916 {
  width: 62px;
  aspect-ratio: 9 / 16;
}

.ai__cv--34 {
  width: 84px;
  aspect-ratio: 3 / 4;
  place-items: center;
  text-align: center;
}

.ai__cv--34 span {
  padding: 3px 4px;
  border-radius: 4px;
  color: #0c1f15;
  background: #ffffff;
  transform: rotate(-3deg);
}

.ai__cv--169 {
  width: 120px;
  aspect-ratio: 16 / 9;
  place-items: center start;
  font-size: 12px;
}

.ai.is-active .ai__cv {
  animation: ai-float 4s var(--ease-in-out) infinite;
}

.ai.is-active .ai__cv--34 {
  animation-delay: -1.3s;
}

.ai.is-active .ai__cv--169 {
  animation-delay: -2.6s;
}

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

/* ---------- 智能混剪 ---------- */

.ai__remix {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 170px;
  padding: 16px 18px;
}

.ai__mosaic {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
}

.ai__mosaic i {
  aspect-ratio: 9 / 14;
  border-radius: 4px;
  background: var(--c, #d7eee0);
  transition: background-color 700ms var(--ease-out);
}

.ai__remix-meta {
  display: grid;
  gap: 12px;
  text-align: right;
}

.ai__remix-meta p {
  display: grid;
  font-size: 12px;
  color: var(--text-3);
}

.ai__remix-meta b {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}

/* ---------- 选题灵感 ---------- */

.ai__ideas {
  height: 170px;
  padding: 0 14px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
}

.ai__ideas-list {
  display: grid;
  gap: 8px;
  padding: 14px 0;
}

.ai.is-active .ai__ideas-list {
  animation: ai-scroll 12s linear infinite;
}

@keyframes ai-scroll {
  to {
    transform: translateY(calc(-50% - 4px));
  }
}

.ai__ideas-list li {
  display: grid;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--text);
  background: rgba(12, 31, 21, 0.05);
  border: 1px solid var(--line);
}

.ai__ideas-list i {
  display: block;
  height: 3px;
  width: var(--v);
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand), var(--gold));
}

/* ---------- 还有 ---------- */

.ai__more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}

.ai__more span {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: 13.5px;
  color: var(--text-2);
  border: 1px solid var(--line);
}

.ai__more .ai__more-label {
  padding-left: 0;
  border: 0;
  color: var(--text-3);
}

/* ---------- 响应式 ---------- */

@media (max-width: 1100px) {
  .ai__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ai__tile {
    grid-column: auto !important;
    grid-row: auto !important;
  }
  .ai__tile--film,
  .ai__tile--remix {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 640px) {
  .ai__grid {
    grid-template-columns: 1fr;
  }
  .ai__film {
    min-height: 0;
  }
  .ai__shots {
    gap: 6px;
  }
  .ai__remix {
    grid-template-columns: 1fr;
  }
  .ai__remix-meta {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }
  .ai__mosaic {
    grid-template-columns: repeat(9, 1fr);
  }
}
