:root {
  --bg: #f6f3e7;
  --card-bg: #ffffff;
  --text: #1f2428;
  --muted: #6a6a6a;
  --primary: #c63c2e;
  --primary-dark: #a92b1a;
  --secondary: #d4af37;
  --secondary-dark: #b88f1a;
  --border: #e5dcc8;
}

* { 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, #efe6d2 0%, var(--bg) 70%);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.app-header h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; font-family: "KaiTi", "STKaiti", "Kaiti SC", "Songti SC", "PingFang SC", serif; letter-spacing: 1px; }
.app-header .subtitle { margin: 0; color: var(--muted); font-size: 13px; }

.app-header::before,
.app-header::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  filter: blur(24px);
  z-index: 0;
}
.app-header::before {
  top: -20px;
  width: 280px;
  height: 140px;
  background: radial-gradient(circle at 30% 50%, rgba(198,60,46,.25), transparent 60%), radial-gradient(circle at 70% 50%, rgba(212,175,55,.25), transparent 60%);
  animation: floatA 10s ease-in-out infinite;
}
.app-header::after {
  top: 40px;
  width: 220px;
  height: 120px;
  background: radial-gradient(circle at 60% 50%, rgba(47,127,62,.18), transparent 60%), radial-gradient(circle at 40% 50%, rgba(29,60,100,.18), transparent 60%);
  animation: floatB 12s ease-in-out infinite;
}

.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; }

.decor { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 10px; position: relative; z-index: 1; }
.taiji-wrap { width: 72px; height: 72px; }
.taiji { width: 100%; height: 100%; display: block; animation: spin 20s linear infinite; filter: drop-shadow(0 6px 12px rgba(0,0,0,.15)); }
.wuxing-chips { display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 13px; color: #fff; letter-spacing: 1px; box-shadow: 0 4px 10px rgba(0,0,0,.08); animation: pulse 4s ease-in-out infinite; }
.chip.mu { background: #2f7f3e; }
.chip.huo { background: #c63c2e; }
.chip.tu { background: #c89b3c; }
.chip.jin { background: #d4af37; color: #262626; }
.chip.shui { background: #1d3c64; }

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

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

.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: 12px 42px 12px 12px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: #fff;
  font-size: 16px;
  color: #0b0b0b;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236A6A6A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 22px;
  touch-action: manipulation;
}
.select.ios { -webkit-appearance: menulist; appearance: menulist; background-image: none; padding: 12px; color: #0b0b0b; -webkit-text-fill-color: #0b0b0b; }
.select option { color: #0b0b0b; }
.select:focus { border-color: #c89b3c; box-shadow: 0 0 0 3px rgba(200, 155, 60, .18); }
.select::-ms-expand { display: none; }

.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: #10151b;
  color: #e2e8f0;
  border-radius: 10px;
  border: 1px solid #0f1826;
  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(16, 21, 27, 0.65);
  color: #fff;
}
.loading.active { display: flex; }
.loading-text { font-size: 14px; }
.loader { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(#0d0d0f 0 180deg, #f6f3e7 180deg); position: relative; animation: spin 1.2s linear infinite; box-shadow: 0 0 0 2px rgba(255,255,255,.15) inset; }
.loader::before { content: ""; position: absolute; left: 50%; top: 25%; transform: translate(-50%, -50%); width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle, #f6f3e7 0 4px, #0d0d0f 4px); }
.loader::after { content: ""; position: absolute; left: 50%; bottom: 25%; transform: translate(-50%, 50%); width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle, #0d0d0f 0 4px, #f6f3e7 4px); }
@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: #efe6d2; color: #7a4e1d; }

.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, #c63c2e 0%, #d4af37 100%); color: #fff; border-radius: 14px; padding: 14px 18px; font-weight: 600; width: 100%; position: relative; overflow: hidden; }
.btn-cta::after { content: ""; position: absolute; top: 0; left: -40%; width: 40%; height: 100%; background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.28) 50%, rgba(255,255,255,0) 100%); transform: skewX(-20deg); animation: glint 3s ease-in-out infinite; }
.btn-cta:hover { filter: brightness(0.98); }

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

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

@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes floatA { 0%,100% { transform: translate(-50%, 0); opacity: .6; } 50% { transform: translate(-50%, 8px); opacity: .9; } }
@keyframes floatB { 0%,100% { transform: translate(-50%, 0); opacity: .6; } 50% { transform: translate(-50%, -10px); opacity: .85; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes glint { 0% { left: -40%; } 50% { left: 80%; } 100% { left: 140%; } }
