/* 故事工坊本页交互：选中态、选项弹层、录音提示 */
.swx-page [role="button"],
.swx-page button {
  cursor: pointer;
}

.swx-page .is-selected {
  box-shadow: 0 0 0 2px #9B7BFF, 0 8px 20px rgba(123, 108, 219, 0.28) !important;
  transform: translateY(-2px);
}

.swx-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 16, 48, 0.45);
  backdrop-filter: blur(6px);
}

.swx-picker {
  width: min(420px, 100%);
  max-height: min(72vh, 560px);
  overflow-y: auto;
  padding: 22px 20px 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, #fff 0%, #f6f1ff 100%);
  box-shadow: 0 24px 50px rgba(70, 50, 140, 0.28);
}

.swx-picker h3 {
  margin: 0 0 14px;
  font-size: 18px;
  color: #4a3a86;
}

.swx-picker-list {
  display: grid;
  gap: 8px;
}

.swx-picker-option {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(155, 123, 255, 0.28);
  border-radius: 14px;
  background: #fff;
  color: #3d2f72;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 8px 14px;
  text-align: left;
}

.swx-picker-option small {
  font-size: 11px;
  font-weight: 600;
  color: #8a7bb8;
}

.swx-picker-option:hover,
.swx-picker-option:focus-visible {
  background: #f3edff;
  box-shadow: 0 6px 16px rgba(123, 108, 219, 0.18);
  transform: translateY(-1px);
}

.swx-picker-option:active {
  transform: scale(0.98);
}

.swx-picker-cancel {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 1px solid rgba(155, 123, 255, 0.28);
  border-radius: 14px;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: #6b6290;
  cursor: pointer;
}

.swx-stage-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(90, 70, 180, 0.88);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.swx-preview-panel {
  min-height: 0;
  overflow-y: auto;
}

.swx-preview-panel > .swx-quote,
.swx-preview-panel > .swx-actions {
  flex-shrink: 0;
  width: 100%;
}

.swx-preview-imgwrap {
  position: relative;
  overflow: hidden;
}

.swx-preview-imgwrap img {
  display: block;
  transition: opacity 0.45s ease, filter 0.45s ease;
}

.swx-preview-imgwrap.is-generating img,
.cc-preview-stage.is-generating .cc-preview-img {
  filter: brightness(0.72) saturate(1.15);
}

img.wv-pop,
.cc-preview-img.wv-pop {
  animation: wv-pop 0.7s cubic-bezier(0.22, 1.15, 0.32, 1);
}

@keyframes wv-pop {
  0% { transform: scale(1.08); filter: brightness(1.25) saturate(1.2); }
  100% { transform: scale(1); filter: none; }
}

.wv-studio-veil {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 4;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(18, 16, 64, 0.18), rgba(18, 16, 64, 0.42));
  pointer-events: none;
}

.swx-preview-imgwrap.is-generating .wv-studio-veil,
.cc-preview-stage.is-generating .wv-studio-veil {
  display: flex;
}

.wv-sparkles {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.wv-sparkles i {
  position: absolute;
  top: var(--x);
  left: var(--x);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffe9b0;
  box-shadow: 0 0 10px #fff4c8, 0 0 18px rgba(155, 123, 255, 0.8);
  animation: wv-spark 1.8s ease-in-out infinite;
  animation-delay: var(--d);
  opacity: 0;
}

@keyframes wv-spark {
  0%, 100% { opacity: 0; transform: scale(0.4) translateY(8px); }
  40% { opacity: 1; transform: scale(1) translateY(-10px); }
}

.wv-studio-veil span {
  position: relative;
  z-index: 1;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(20, 18, 70, 0.78);
  color: #ffe9b0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.wv-stage-caption {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  max-width: calc(100% - 24px);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(90, 70, 180, 0.88);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  pointer-events: none;
  box-shadow: 0 8px 18px rgba(60, 40, 120, 0.28);
}

.wv-stage-tags {
  position: absolute;
  top: 42px;
  left: 12px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 24px);
  pointer-events: none;
}

.wv-stage-tags span {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 246, 232, 0.92);
  color: #5a3f9a;
  font-size: 11px;
  font-weight: 800;
}

.wv-flavor-dock {
  position: relative;
  z-index: 6;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 241, 255, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 24px rgba(70, 50, 140, 0.18);
  backdrop-filter: blur(10px);
}

.wv-flavor-dock.is-overlay {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  width: auto;
  margin: 0;
}

.wv-flavor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.wv-flavor-label {
  flex: 0 0 32px;
  font-size: 11px;
  font-weight: 800;
  color: #7b6cdb;
}

.wv-flavor-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  min-width: 0;
  flex: 1;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.wv-flavor-chips::-webkit-scrollbar {
  height: 4px;
}

.wv-flavor-chip,
.wv-flavor-surprise {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(155, 123, 255, 0.28);
  border-radius: 999px;
  background: #fff;
  color: #3d2f72;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.wv-flavor-chip:hover,
.wv-flavor-surprise:hover,
.wv-flavor-chip:focus-visible,
.wv-flavor-surprise:focus-visible {
  transform: translateY(-1px);
  background: #f3edff;
  box-shadow: 0 6px 14px rgba(123, 108, 219, 0.16);
}

.wv-flavor-chip.is-on {
  background: linear-gradient(180deg, #9b7bff, #7b6cdb);
  color: #fff;
  border-color: transparent;
}

.wv-flavor-surprise {
  background: linear-gradient(180deg, #ffe9b0, #ffd27a);
  color: #8a5a12;
  border-color: rgba(255, 210, 120, 0.8);
}

.cc-preview-panel .wv-flavor-dock {
  margin: 8px 0 0;
}

.cc-preview-stage .wv-stage-caption {
  left: auto;
  right: 12px;
}

.wv-studio-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 3;
  border-radius: inherit;
}

.swx-page.is-recording .swx-preview-imgwrap::after {
  content: '录制中';
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 7;
  padding: 6px 12px;
  border-radius: 999px;
  background: #e2558d;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

body.gn-eye-on .goodnight-page,
body.gn-eye-on .character-creator-page {
  filter: brightness(0.78) saturate(0.88);
}
