:root {
  --bg: #fff7fa; /* 轻粉背景，保持清爽 */
  --card-bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #ec4899; /* 粉红主色 */
  --primary-dark: #db2777;
  --secondary: #f472b6; /* 次要粉色 */
  --secondary-dark: #be185d;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent; /* 移动端点击高亮 */
}

.app-header {
  padding: 28px 16px 24px;
  text-align: center;
  color: #0b1021;
  background: radial-gradient(1200px 300px at 50% -50px, #fde2e8 0%, var(--bg) 70%);
  border-bottom: 1px solid var(--border);
}
.app-header h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.app-header .subtitle { margin: 0; color: var(--muted); font-size: 13px; }

.container {
  max-width: 960px;
  margin: 20px auto 40px;
  padding: 0 16px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 8px 16px rgba(20, 30, 56, 0.06);
}
.card h2 { margin: 0 0 12px; font-size: 16px; }

.card-input { position: relative; }
.card-output { margin-bottom: 24px; }
.output-wrap { position: relative; }
.card-title { display: flex; align-items: center; gap: 8px; }
.card-title .icon { font-size: 18px; }
.btn-top-right { margin-left: auto; }
.card-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; }

.label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  outline: none;
  font-size: 14px;
}
.textarea:focus { border-color: #f9a8d4; box-shadow: 0 0 0 3px rgba(236, 72, 153, .18); }

.select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: #fff;
  font-size: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 680px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: var(--secondary-dark); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f3f4f6; }

/* 小屏时按钮下移，避免标题拥挤 */
@media (max-width: 480px) {
  .card-title { align-items: flex-start; }
  .card-actions { margin-left: 0; margin-top: 8px; flex-wrap: wrap; }
}

.hint { display: none; }

.output-meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }

.output {
  white-space: pre-wrap;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  border: 1px solid #0b132a;
  padding: 14px;
  font-size: 14px;
  min-height: 100px;
}

/* 加载指示器覆盖在结果框上 */
.loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
}
.loading.active { display: flex; }
.loading-text { font-size: 14px; }
.loader {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* 生成时按钮禁用态 */
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.toast { font-size: 12px; color: #059669; margin-left: 6px; min-height: 16px; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 16px;
}

/* 参考界面元素 */
.badge { display: inline-block; border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.badge-pink { background: #fde2e8; color: #9d174d; }

.range-wrap { margin-top: 8px; }
.range {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  -webkit-appearance: none;
  appearance: none;
  /* 动态填充：左侧使用主色，右侧为灰色，通过 --progress 控制 */
  background: linear-gradient(var(--primary), var(--primary)) 0 / var(--progress) 100% no-repeat, #e5e7eb;
}

/* 统一iOS/Android滑块样式 */
.range::-webkit-slider-runnable-track { height: 6px; background: transparent; border-radius: 999px; }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  background: var(--primary);
  border: 2px solid #fff;
  border-radius: 50%;
  margin-top: -6px; /* 对齐轨道 */
  box-shadow: 0 2px 6px rgba(236, 72, 153, .35);
}
.range::-moz-range-track {
  height: 6px; background: #e5e7eb; border-radius: 999px;
}
.range::-moz-range-progress { height: 6px; background: var(--primary); border-radius: 999px; }
.range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--primary); border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(236, 72, 153, .35);
}
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 6px; }

.btn-cta {
  background: linear-gradient(90deg, #f472b6 0%, #ec4899 50%, #fb7185 100%);
  color: #fff;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 600;
  width: 100%;
}
.btn-cta:hover { filter: brightness(0.95); }

.spacer-12 { height: 12px; }
.grid-single { grid-template-columns: 1fr; }

.checkbox { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
