:root {
  --primary: #f4a7b9;
  --primary-light: #f8c4d1;
  --primary-dark: #e08aa0;
  --success: #2ecc71;
  --success-light: #55e08f;
  --danger: #e74c3c;
  --danger-light: #f07060;
  --warning: #f39c12;
  --warning-light: #f5b041;
  --dark: #2c3e50;
  --border: #ddd;
  --gray: #95a5a6;
  --light-bg: #f8f9fa;
  --code-bg: #f5f7fa;
  --disabled-bg: #f9f9f9;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f4f6f9;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}
.container {
  max-width: 980px;
  margin: 20px auto;
  padding: 20px;
  flex: 1;
  width: 100%;
}
header {
  text-align: center;
  margin-bottom: 24px;
  color: var(--dark);
}
header h1 {
  font-size: 1.9em;
  margin-bottom: 8px;
}
header p {
  color: #666;
  font-size: 0.95em;
}
/* 模式选择提示 */
.mode-prompt {
  background: #fce4ec;
  border: 1px solid #f8bbd0;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  font-size: 1.05em;
  color: var(--primary-dark);
  font-weight: 600;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
  max-height: 100px;
  transition: all 0.4s ease-in-out;
  border-width: 1px;
}
.mode-prompt.hidden {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
  border-width: 0;
}
/* 模式选择 */
.mode-toggle {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 10px 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.mode-btn {
  background: white;
  border: none;
  padding: 12px 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95em;
  transition: background-color 0.2s;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mode-btn:hover {
  background: #f0f0f0;
}
.mode-btn.active {
  background: var(--primary);
  color: white;
}
/* 模式说明区 */
.mode-desc-container {
  margin: 10px 0;
}
.mode-desc {
  padding: 12px;
  background: var(--light-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9em;
  color: #555;
  line-height: 1.5;
  display: none;
}
.mode-desc.active {
  display: block;
}
.mode-desc strong {
  font-weight: 900;
  color: var(--dark);
}
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  padding: 22px;
  margin-bottom: 20px;
  width: 100%;
}
h3 {
  margin: 0 0 16px;
  font-size: 1.2em;
  color: var(--dark);
  font-weight: 600;
}
label {
  display: block;
  margin: 12px 0 6px;
  font-weight: 600;
  color: var(--dark);
  font-size: 0.95em;
}
input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1em;
}
input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(244, 167, 185, 0.2);
}
input:disabled {
  background: var(--disabled-bg);
  color: var(--gray);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 15px;
}
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1em;
  transition: all 0.2s;
}
.btn.primary {
  background: var(--primary);
  color: white;
}
.btn.primary:hover {
  background: var(--primary-light);
}
.btn.outline {
  background: white;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn.outline:hover {
  background: var(--primary);
  color: white;
}
.btn.success {
  background: var(--success);
  color: white;
}
.btn.success:hover {
  background: var(--success-light);
}
.btn.danger {
  background: var(--danger);
  color: white;
}
.btn.danger:hover {
  background: var(--danger-light);
}
.btn.warning {
  background: var(--warning);
  color: white;
}
.btn.warning:hover {
  background: var(--warning-light);
}
.btn.small {
  padding: 6px 10px;
  font-size: 0.9em;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
}
.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.action-row {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.action-row button {
  flex: 1;
  min-width: 130px;
}
/* 三功能横向排型 */
.option-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 12px;
  padding: 14px;
  background: var(--light-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95em;
  flex-wrap: wrap;
}
.option-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--dark);
  font-size: 0.9em;
  white-space: nowrap;
}
.option-item input[type="checkbox"] {
  margin: 0;
  vertical-align: middle;
}
.option-item label {
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
}
/* 日志框 */
.preview-box {
  margin-top: 16px;
  padding: 12px;
  background: #fce4ec;
  border: 1px dashed var(--primary);
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.9em;
  color: #c2185b;
  min-height: 40px;
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.4;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  white-space: pre-wrap;
  word-break: break-all;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) #fce4ec;
}
.preview-box::-webkit-scrollbar {
  width: 6px;
}
.preview-box::-webkit-scrollbar-track {
  background: #fce4ec;
}
.preview-box::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}
.history-panel {
  margin-bottom: 14px;
  padding: 14px;
  background: #fce4ec;
  border: 1px solid #f8bbd0;
  border-radius: 6px;
  font-size: 0.95em;
  color: var(--dark);
}
.history-status {
  font-weight: 600;
  color: var(--primary-dark);
}
.history-actions {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
/* 输出容器 */
.output-container {
  position: relative;
  border: 1px dashed var(--primary);
  border-radius: 6px;
  background: var(--code-bg);
  margin-top: 8px;
}
.output-header {
  background: #f0f0f0;
  padding: 8px 12px;
  font-size: 0.9em;
  color: var(--dark);
  display: flex;
  justify-content: space-between;
}
.output-wrapper {
  display: flex;
  font-family: 'Courier New', monospace;
  font-size: 0.95em;
  line-height: 1.5;
  min-height: 20px;
  max-height: 200px;
  overflow: hidden;
}
.line-numbers {
  text-align: right;
  padding: 12px 8px 12px 12px;
  background: #f0f0f0;
  color: var(--gray);
  user-select: none;
  min-width: 40px;
  border-right: 1px solid var(--border);
  white-space: pre;
  line-height: 1.5;
  margin: 0;
  overflow: hidden;
}
.output-content {
  flex: 1;
  padding: 12px;
  white-space: pre;
  color: #111;
  overflow-y: auto;
  max-height: 200px;
  margin: 0;
  line-height: 1.5;
  font-family: 'Courier New', monospace;
  overflow-x: auto;
}
.output-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.clear-options {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 20px;
  white-space: nowrap;
}
.clear-options label {
  margin: 0;
  font-weight: normal;
  font-size: 0.9em;
}
/* 灰色蒙层 */
.config-disabled {
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}
/* 确认对话框样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
}
.modal-content {
  background-color: white;
  margin: 15% auto;
  padding: 20px;
  border-radius: 8px;
  width: 80%;
  max-width: 500px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.modal-header {
  font-size: 1.2em;
  font-weight: bold;
  margin-bottom: 15px;
  color: var(--dark);
}
.modal-body {
  margin-bottom: 20px;
  line-height: 1.5;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
/* 续写模式解析按钮优化 */
#btn-parse {
  margin: 20px 0 0 0 !important;
  padding: 10px 16px !important;
  display: inline-block;
  width: auto;
}
/* 版本信息悬浮框 */
.version-badge {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(244, 167, 185, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85em;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 100;
  backdrop-filter: blur(5px);
}
/* 页脚 */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  color: var(--gray);
  font-size: 0.9em;
  background: white;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}
.footer-left, .footer-center, .footer-right {
  display: flex;
  align-items: center;
  gap: 15px;
}
/* 续写模式输入区域间隔 */
#section-continue {
  margin-bottom: 20px;
}
/* 生成按钮特殊样式 */
#btn-generate {
  background: white !important;
  color: var(--primary) !important;
  border: 1px solid var(--primary) !important;
  transition: all 0.2s !important;
}
#btn-generate:hover {
  background: var(--primary) !important;
  color: white !important;
}
/* 返回最新结果按钮优化 */
#btn-restore-current {
  background: #f0a0b8 !important;
  color: white !important;
}
#btn-restore-current:hover {
  background: #f4b4c8 !important;
}
/* 响应式优化 */
@media (max-width: 768px) {
  .version-badge {
    top: 10px;
    right: 10px;
    padding: 6px 10px;
    font-size: 0.8em;
  }
}
@media (max-width: 480px) {
  .option-row {
    flex-direction: column;
    gap: 10px;
  }
  .container {
    padding: 15px;
  }
  footer {
    flex-direction: column;
    text-align: center;
    gap: 5px;
    padding: 10px;
  }
  .footer-left, .footer-center, .footer-right {
    flex-direction: column;
    gap: 5px;
  }
  .output-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .clear-options {
    margin-left: 0;
    justify-content: flex-start;
    margin-top: 10px;
    order: 3;
    align-self: flex-start;
  }
}
footer a {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}
footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}
