/* 页面内弹窗 */
/* —— Page modal —— */
.page-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.page-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.page-modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.page-modal-card-wide {
  max-width: 560px;
}

.page-modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.page-modal-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.page-modal-actions {
  display: flex;
  gap: 12px;
}

.page-modal-actions .btn-primary,
.page-modal-actions .btn-secondary {
  flex: 1;
  height: 44px;
}

/* 风格词编辑弹窗（#style-word-edit-modal）：预览图多时可滚动，底部按钮始终可见 */
#style-word-edit-modal.page-modal {
  overflow-y: auto;
  align-items: flex-start;
  justify-content: center;
}

#style-word-edit-modal .style-word-edit-modal-card {
  margin: auto;
  flex-shrink: 0;
}

#style-word-edit-modal .style-word-edit-modal-body {
  max-height: calc(100vh - 240px);
  max-height: calc(100dvh - 240px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#style-word-edit-modal .style-word-edit-modal-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* 提示词规则查看弹窗：尽量大、内容可滚动 */
#prompt-rules-modal.page-modal {
  overflow-y: auto;
  align-items: flex-start;
  justify-content: center;
}

.prompt-rules-modal-card {
  width: min(960px, 96vw);
  max-width: none;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  margin: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.prompt-rules-modal-body {
  flex: 1;
  min-height: 200px;
  max-height: calc(100vh - 180px);
  max-height: calc(100dvh - 180px);
  overflow: auto;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  color: var(--text);
}

.prompt-rules-modal-body.is-empty {
  color: var(--text-secondary);
}

.prompt-rules-modal-actions .btn-primary {
  flex: none;
  min-width: 120px;
  margin-left: auto;
}

/* 工作流向导：提示词规则预览 + 编辑弹窗 */
.prompt-rules-wizard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.prompt-rules-wizard-head .field-label {
  margin-bottom: 0;
}

.prompt-rules-wizard-preview {
  margin: 0;
  padding: 12px 14px;
  min-height: 72px;
  max-height: 120px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  cursor: pointer;
}

.prompt-rules-wizard-preview.is-empty {
  color: var(--text-secondary);
}

.prompt-rules-wizard-preview:hover {
  border-color: var(--primary, #3b82f6);
}

.prompt-rules-edit-hint {
  margin: 0 0 12px;
}

.prompt-rules-edit-textarea {
  flex: 1;
  min-height: min(520px, calc(100vh - 260px));
  min-height: min(520px, calc(100dvh - 260px));
  max-height: calc(100vh - 200px);
  max-height: calc(100dvh - 200px);
  width: 100%;
  resize: vertical;
  margin-bottom: 20px;
  padding: 16px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.65;
  box-sizing: border-box;
}

