/* ============================================================
   千面智语 · 功能演示页专用样式
   直播应答模拟器 + 千面·知客 交互演示
   ============================================================ */

/* ---------- 页内标签（二级菜单） ---------- */
.demo-tabs {
  display: flex;
  gap: clamp(14px, 2vw, 34px);
  padding: 15px var(--pad);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 30;
  overflow-x: auto;
  scrollbar-width: none;
}
.demo-tabs::-webkit-scrollbar { display: none; }
.demo-tab {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-40);
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  transition: color .3s var(--ease);
  padding: 0;
}
.demo-tab .n { color: var(--ink-25); }
.demo-tab:hover { color: var(--blue); }
.demo-tab.is-active { color: var(--blue); }
.demo-tab.is-active .n { color: var(--blue); }
.demo-tab .dot { width: 6px; height: 6px; background: var(--blue); opacity: 0; transition: opacity .3s; }
.demo-tab.is-active .dot { opacity: 1; }

.demo-panel[hidden] { display: none; }

/* ---------- 控制台布局 ---------- */
.console {
  display: grid;
  grid-template-columns: var(--axis) minmax(0, 1fr);
  align-items: stretch;
}
.console-left {
  padding: clamp(24px, 4vh, 48px) clamp(16px, 1.6vw, 28px) clamp(24px, 4vh, 48px) var(--pad);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.4vh, 28px);
  min-width: 0;
}
.console-right {
  padding: clamp(24px, 4vh, 48px) var(--pad) clamp(24px, 4vh, 48px) clamp(16px, 1.6vw, 28px);
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.2vh, 24px);
  min-width: 0;
}

/* ---------- 直播画面 ---------- */
.stage {
  position: relative;
  background: var(--blue);
  color: var(--paper-hi);
  aspect-ratio: 16 / 9.6;
  min-height: 280px;
  max-height: 64vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(0, 0, 0, .16)),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 3px);
  pointer-events: none;
  opacity: .5;
}
.stage-scan {
  position: absolute;
  left: 0; right: 0;
  height: 34%;
  background: linear-gradient(180deg, transparent, rgba(242, 241, 235, .10), transparent);
  animation: scan 7s linear infinite;
  pointer-events: none;
}
@keyframes scan { 0% { top: -40%; } 100% { top: 110%; } }

.stage-badges {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  z-index: 3;
}
.badge-ai {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-hi);
  color: var(--blue);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 7px 10px;
  font-weight: 500;
}
.badge-ai .lock { font-size: 10px; }
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(242, 241, 235, .82);
}
.badge-live .dot { width: 6px; height: 6px; border-radius: 50%; background: #FF5A5A; animation: pulse 1.8s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.stage-avatar-wrap {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(46%, 260px);
  z-index: 2;
}
.stage-avatar { width: 100%; height: auto; color: var(--paper-hi); }
.stage-avatar .head { fill: url(#qmDots); stroke: currentColor; stroke-width: 1.4; }
.stage-avatar .body { fill: url(#qmDots); stroke: currentColor; stroke-width: 1.4; }
.stage-avatar .ring { fill: none; stroke: currentColor; stroke-width: 1; opacity: .45; }

.muzzle {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, 0);
  display: flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  z-index: 3;
}
.muzzle i {
  display: block;
  width: 4px;
  height: 4px;
  background: var(--paper-hi);
  transition: height .18s var(--ease), opacity .3s;
  opacity: .55;
}
.stage.is-speaking .muzzle i { opacity: 1; }
.stage.is-speaking .muzzle i:nth-child(1) { height: 8px; animation: mouth1 .5s infinite alternate; }
.stage.is-speaking .muzzle i:nth-child(2) { height: 14px; animation: mouth2 .42s infinite alternate; }
.stage.is-speaking .muzzle i:nth-child(3) { height: 18px; animation: mouth3 .58s infinite alternate; }
.stage.is-speaking .muzzle i:nth-child(4) { height: 14px; animation: mouth2 .46s infinite alternate; }
.stage.is-speaking .muzzle i:nth-child(5) { height: 8px; animation: mouth1 .52s infinite alternate; }
@keyframes mouth1 { from { transform: scaleY(.5); } to { transform: scaleY(1); } }
@keyframes mouth2 { from { transform: scaleY(.35); } to { transform: scaleY(1); } }
@keyframes mouth3 { from { transform: scaleY(.3); } to { transform: scaleY(1.15); } }

.stage-sub {
  position: relative;
  z-index: 3;
  margin: 0 16px 14px;
  padding: 12px 14px;
  background: rgba(16, 16, 20, .30);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-left: 2px solid var(--paper-hi);
  font-size: clamp(12.5px, .95vw, 15px);
  line-height: 1.75;
  min-height: 66px;
  color: rgba(242, 241, 235, .95);
}
.stage-sub .ph {
  color: #FFD98A;
  border-bottom: 1px dashed rgba(255, 217, 138, .7);
}
.stage-sub .ph.is-verified {
  color: var(--paper-hi);
  background: rgba(242, 241, 235, .16);
  border-bottom-color: transparent;
  padding: 0 4px;
  animation: verifyflash .9s var(--ease);
}
@keyframes verifyflash {
  0% { background: rgba(255, 217, 138, .55); }
  100% { background: rgba(242, 241, 235, .16); }
}
.stage-sub .caret { display: inline-block; width: 7px; height: 1.05em; background: var(--paper-hi); vertical-align: -2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.stage-meta {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 14px;
}
.product-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-hi);
  color: var(--ink);
  padding: 8px 12px;
  font-size: 12px;
}
.product-chip b { font-weight: 600; }
.product-chip .price { color: var(--blue); font-weight: 700; font-family: var(--disp); }
.wave { display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.wave i {
  width: 3px;
  height: 6px;
  background: rgba(242, 241, 235, .45);
  transition: height .16s var(--ease), background .3s;
}
.stage.is-speaking .wave i { background: var(--paper-hi); animation: wav .6s infinite alternate; }
.stage.is-speaking .wave i:nth-child(3n) { animation-duration: .44s; }
.stage.is-speaking .wave i:nth-child(4n) { animation-duration: .78s; }
.stage.is-speaking .wave i:nth-child(5n) { animation-duration: .52s; }
@keyframes wav { from { transform: scaleY(.35); } to { transform: scaleY(1); } }

.stage-status {
  position: absolute;
  left: 16px;
  top: 52px;
  z-index: 3;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(242, 241, 235, .6);
}

/* ---------- 链路 ---------- */
.pipe-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-40);
}
.pipe-head b { color: var(--ink); font-weight: 500; }
.pipe {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  margin-top: 12px;
}
.pipe-step {
  padding: 12px 10px 14px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 96px;
  transition: background .35s var(--ease), color .35s var(--ease);
}
.pipe-step:last-child { border-right: 0; }
.pipe-step .pn { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; color: var(--ink-40); }
.pipe-step .pt { font-size: clamp(11px, .85vw, 13px); font-weight: 600; line-height: 1.3; }
.pipe-step .ps { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-25); margin-top: auto; }
.pipe-step.is-active { background: var(--blue); color: var(--paper-hi); }
.pipe-step.is-active .pn, .pipe-step.is-active .ps { color: rgba(242, 241, 235, .7); }
.pipe-step.is-done { background: var(--blue-soft); }
.pipe-step.is-done .ps { color: var(--blue); }
.pipe-step.is-skip { opacity: .45; }

/* ---------- 弹幕 ---------- */
.dm-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-40);
}
.dm-head b { color: var(--ink); font-weight: 500; }
.dm-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--line);
  overflow: hidden;
  max-height: clamp(320px, 46vh, 480px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.dm {
  display: grid;
  grid-template-columns: minmax(70px, 96px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  width: 100%;
  animation: dmIn .5s var(--ease-out);
}
@keyframes dmIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.dm-name { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; color: var(--ink-40); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-text { font-size: clamp(12.5px, .95vw, 14.5px); line-height: 1.6; color: var(--ink-70); min-width: 0; }
.dm-tag { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-25); white-space: nowrap; }
.dm.is-must .dm-text { color: var(--ink); font-weight: 600; }
.dm.is-must .dm-tag { color: var(--blue); }
.dm.is-vip .dm-name { color: var(--blue); }
.dm.is-vip .dm-name::after { content: " ◆"; font-size: 8px; }
.dm.is-vip .dm-tag { color: var(--blue); }
.dm.is-skip .dm-text { color: var(--ink-25); }
.dm.is-picked { background: var(--blue-soft); }
.dm.is-picked .dm-text { color: var(--blue); }

/* ---------- 控制区 ---------- */
.controls { display: flex; flex-direction: column; gap: 14px; }
.controls .k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-40);
}
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--ink-60);
  border: 1px solid var(--line);
  padding: 9px 12px;
  transition: color .3s, border-color .3s, background .3s;
  text-align: left;
  line-height: 1.4;
}
.preset:hover { color: var(--blue); border-color: var(--blue); }
.preset.is-vip { border-color: rgba(29, 57, 245, .45); color: var(--blue); }
.preset.is-skip { color: var(--ink-25); }
.preset:disabled { opacity: .4; cursor: not-allowed; }
.ask-form { display: flex; gap: 8px; }
.ask-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 0;
}
.ask-form input:focus { outline: none; border-color: var(--blue); }
.ask-form button {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--blue);
  color: var(--paper-hi);
  padding: 0 18px;
  transition: background .3s;
  white-space: nowrap;
}
.ask-form button:hover { background: var(--blue-deep); }
.ask-form button:disabled { opacity: .5; }

.toggles { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.toggle-row .tl { display: flex; flex-direction: column; gap: 3px; }
.toggle-row .tl b { font-size: 13px; font-weight: 600; }
.toggle-row .tl span { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-40); }
.switch {
  position: relative;
  width: 42px;
  height: 22px;
  border: 1px solid var(--line);
  background: var(--paper);
  flex: none;
  transition: background .3s, border-color .3s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--ink-25);
  transition: transform .35s var(--ease-out), background .3s;
}
.switch.is-on { border-color: var(--blue); background: var(--blue-soft); }
.switch.is-on::after { transform: translateX(20px); background: var(--blue); }
.switch.is-locked { cursor: not-allowed; }
.switch.is-shake { animation: shake .5s var(--ease); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ---------- 知客演示 ---------- */
.zhike-grid {
  display: grid;
  grid-template-columns: var(--axis) minmax(0, 1fr);
}
.zhike-left {
  padding: clamp(24px, 4vh, 48px) clamp(16px, 1.6vw, 28px) clamp(24px, 4vh, 48px) var(--pad);
  border-right: 1px solid var(--line);
  min-width: 0;
}
.zhike-right {
  padding: clamp(24px, 4vh, 48px) var(--pad) clamp(24px, 4vh, 48px) clamp(16px, 1.6vw, 28px);
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.4vh, 28px);
  min-width: 0;
}
.viewer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 14px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  padding: 15px 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  transition: background .3s var(--ease), border-color .3s;
  cursor: pointer;
}
.viewer:last-of-type { border-bottom: 1px solid var(--line); }
.viewer:hover { background: var(--blue-soft); }
.viewer.is-active { background: var(--blue); border-color: var(--blue); color: var(--paper-hi); }
.viewer.is-active .v-name, .viewer.is-active .v-meta, .viewer.is-active .v-conf { color: rgba(242, 241, 235, .8); }
.v-name { font-size: clamp(14px, 1.05vw, 16px); font-weight: 600; }
.v-conf { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--ink-40); }
.v-meta { grid-column: 1 / -1; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: var(--ink-40); text-transform: uppercase; }
.v-levels { display: flex; gap: 5px; grid-column: 1 / -1; }
.v-level {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  padding: 3px 7px;
  color: var(--ink-40);
}
.viewer.is-active .v-level { border-color: rgba(242, 241, 235, .4); color: rgba(242, 241, 235, .85); }

.profile { border: 1px solid var(--line); padding: clamp(18px, 2vw, 28px); background: var(--paper); }
.profile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.profile-head h3 { font-family: var(--disp); font-weight: 800; font-size: clamp(20px, 1.7vw, 27px); letter-spacing: -.01em; }
.profile-head .mono { color: var(--ink-40); }
.profile-rows { border-top: 1px solid var(--line); }
.profile-rows > div { display: flex; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.profile-rows .k { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-40); padding-top: 4px; }
.profile-rows .v { text-align: right; color: var(--ink-70); }
.profile-empty { color: var(--ink-40); font-size: 13.5px; line-height: 1.8; }

.tone-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tone-tab {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-40);
  border: 1px solid var(--line);
  padding: 9px 13px;
  transition: all .3s var(--ease);
}
.tone-tab:hover { color: var(--blue); border-color: var(--blue); }
.tone-tab.is-active { background: var(--blue); border-color: var(--blue); color: var(--paper-hi); }
.care-quote {
  border-left: 2px solid var(--blue);
  padding: 4px 0 4px 18px;
  font-size: clamp(14px, 1.1vw, 17px);
  line-height: 1.85;
  color: var(--ink);
}
.care-quote .name { color: var(--blue); font-weight: 700; }
.care-note { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-40); }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .pipe { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pipe-step { border-bottom: 1px solid var(--line); }
  .pipe-step:nth-child(4n) { border-right: 0; }
}
@media (max-width: 860px) {
  .console, .zhike-grid { grid-template-columns: 1fr; }
  .console-left, .zhike-left { border-right: 0; border-bottom: 1px solid var(--line); }
  .console-right, .zhike-right { padding-left: var(--pad); }
  .pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipe-step:nth-child(4n) { border-right: 1px solid var(--line); }
  .pipe-step:nth-child(2n) { border-right: 0; }
}
@media (max-width: 640px) {
  .pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipe-step { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .pipe-step:nth-child(2n) { border-right: 0; }
  .dm { grid-template-columns: minmax(60px, 80px) minmax(0, 1fr); }
  .dm-tag { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .stage-scan, .badge-live .dot { animation: none; }
}
