/* ============================================
   AI降重工坊 前端样式 v3
   参照竞品模式，更精致的视觉设计
   ============================================ */

:root {
  --c-primary: #5B4FE9;
  --c-primary-dark: #4738C9;
  --c-primary-light: #EEEDFE;
  --c-accent: #0F6E56;
  --c-accent-light: #E1F5EE;
  --c-danger: #E5484D;
  --c-danger-light: #FFF0F0;
  --c-warning: #F5A623;
  --c-warning-light: #FFF8E6;
  --c-info: #0EA5E9;
  --c-info-light: #E0F2FE;
  --bg-page: #F5F5FA;
  --bg-card: #FFFFFF;
  --bg-soft: #FAFAFC;
  --text-1: #1A1A2E;
  --text-2: #6B6B7B;
  --text-3: #A0A0B0;
  --border: #ECECF2;
  --border-hover: #D8D8E2;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 1px 3px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.03);
  --shadow-lg: 0 4px 24px rgba(0,0,0,.06), 0 8px 32px rgba(0,0,0,.04);
  --shadow-glow: 0 4px 20px rgba(91,79,233,.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-page);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============ Header ============ */
.header {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-1);
}
.logo-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c-primary), #7B6FF5);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  box-shadow: var(--shadow-glow);
}
.logo-text-wrap {
  display: flex;
  flex-direction: column;
}
.logo-name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
}
.logo-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  line-height: 1.2;
}
.nav {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav a {
  font-size: 14px;
  color: var(--text-2);
  text-decoration: none;
  transition: color .15s;
  position: relative;
}
.nav a:hover, .nav a.active {
  color: var(--c-primary);
  font-weight: 500;
}
.nav a.active::after {
  content: '';
  position: absolute;
  bottom: -22px;
  left: 0; right: 0;
  height: 2px;
  background: var(--c-primary);
  border-radius: 1px;
}
.header-actions { display: flex; align-items: center; gap: 12px; }

/* ============ Hero ============ */
.hero {
  position: relative;
  padding: 64px 24px 48px;
  text-align: center;
  overflow: hidden;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.hero-bg {
  position: absolute;
  top: -100px; left: 50%;
  transform: translateX(-50%);
  width: 800px; height: 400px;
  background: radial-gradient(ellipse, var(--c-primary-light) 0%, transparent 70%);
  opacity: .6;
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 1;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--c-accent-light);
  border: 1px solid rgba(15,110,86,.15);
  border-radius: 20px;
  font-size: 12px;
  color: var(--c-accent);
  font-weight: 500;
  margin-bottom: 20px;
}
.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(15,110,86,.4); }
  50% { opacity: .7; box-shadow: 0 0 0 6px rgba(15,110,86,0); }
}
.hero h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -1px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--c-primary), #7B6FF5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 15px;
  color: var(--text-2);
  max-width: 560px;
  margin: 0 auto;
}

/* Hero 统计 */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-top: 36px;
  padding: 20px 40px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.hero-stat {
  padding: 0 28px;
  text-align: center;
}
.hero-stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--c-primary);
  line-height: 1.2;
}
.hero-stat-label {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
}
.hero-stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
}

/* ============ Container ============ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ============ Announcement ============ */
.announcement {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  background: var(--c-warning-light);
  border-bottom: 1px solid #F5D97A;
  color: #8A6D1A;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.announce-icon { font-size: 14px; }

/* ============ Warn banner ============ */
.warn-banner {
  background: var(--c-danger-light);
  border: 1px solid rgba(229,72,77,.2);
  color: var(--c-danger);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.warn-banner a { color: var(--c-primary); text-decoration: underline; }
.warn-banner code {
  background: rgba(0,0,0,.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* ============ Tab bar ============ */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 4px;
  border: 1px solid var(--border);
  width: fit-content;
  box-shadow: var(--shadow);
}
.tab {
  padding: 9px 24px;
  font-size: 14px;
  color: var(--text-2);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-icon { font-size: 16px; }
.tab.active {
  background: var(--c-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(91,79,233,.25);
}
.tab:not(.active):hover { color: var(--text-1); background: var(--bg-soft); }

/* ============ Control bar ============ */
.controls {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.control-group {
  display: flex; align-items: center; gap: 10px;
}
.control-label {
  font-size: 13px; color: var(--text-2); font-weight: 500;
  white-space: nowrap;
}
.seg {
  display: inline-flex;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.seg button {
  border: none; background: transparent;
  padding: 6px 14px;
  font-size: 13px; color: var(--text-2);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.seg button.active {
  background: var(--c-primary);
  color: #fff;
  font-weight: 500;
}
.seg button.aggressive.active {
  background: var(--c-danger);
}
.seg button:not(.active):hover { color: var(--text-1); }

.select-style, .select-model {
  padding: 7px 28px 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-1);
  background: var(--bg-card);
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B7B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color .15s;
}
.select-style:hover, .select-model:hover { border-color: var(--border-hover); }
.select-style:focus, .select-model:focus {
  outline: none;
  border-color: var(--c-primary);
}

/* ============ Panels ============ */
.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.panel-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-title {
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.panel-actions {
  display: flex;
  gap: 4px;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.dot-in { background: var(--c-danger); }
.dot-out { background: var(--c-accent); }
.panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  min-height: 360px;
}

/* ============ Textarea / result ============ */
textarea.input-area {
  width: 100%;
  flex: 1;
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 14px;
  line-height: 1.8;
  resize: vertical;
  font-family: inherit;
  color: var(--text-1);
  background: var(--bg-soft);
  transition: border-color .15s, background .15s;
}
textarea.input-area:focus {
  outline: none;
  border-color: var(--c-primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--c-primary-light);
}
.result-area {
  width: 100%;
  flex: 1;
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 14px;
  line-height: 1.8;
  overflow-y: auto;
  background: var(--bg-soft);
  color: var(--text-1);
  word-break: break-word;
}
.result-rewritten {
  white-space: pre-wrap;
  line-height: 1.9;
}
.result-rewritten br {
  margin-bottom: 0.6em;
}
.result-placeholder {
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  font-size: 13px;
  gap: 10px;
}
.result-placeholder .icon { font-size: 36px; opacity: .3; }

/* Panel footer */
.panel-foot {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.char-count {
  font-size: 12px; color: var(--text-3);
}
.char-hint {
  font-size: 12px; color: var(--c-warning);
}

/* ============ Buttons ============ */
.btn {
  border: none;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: var(--c-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(91,79,233,.25);
}
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-primary:disabled {
  background: #C0BAEE; cursor: not-allowed; box-shadow: none;
}
.btn-outline {
  background: transparent;
  color: var(--c-primary);
  border: 1px solid var(--c-primary);
}
.btn-outline:hover {
  background: var(--c-primary-light);
}
.btn-text {
  background: transparent;
  color: var(--text-2);
  border: none;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: color .15s;
}
.btn-text:hover { color: var(--c-primary); }
.btn-text:disabled { color: var(--text-3); cursor: not-allowed; opacity: .5; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 12px 48px; font-size: 15px; }

/* ============ Action bar ============ */
.action-bar {
  text-align: center;
  margin-top: 24px;
  padding-bottom: 8px;
}

/* ============ Score meters ============ */
.score-box {
  margin-top: 16px;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.score-box-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.score-row:last-of-type { margin-bottom: 0; }
.score-label {
  font-size: 12px; color: var(--text-2);
  width: 52px; flex-shrink: 0; font-weight: 500;
}
.score-track {
  flex: 1;
  height: 10px;
  background: #E8E8EF;
  border-radius: 5px;
  overflow: hidden;
}
.score-fill {
  height: 100%;
  border-radius: 5px;
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
.score-fill.before { background: linear-gradient(90deg, var(--c-danger), #FF6B6B); }
.score-fill.after { background: linear-gradient(90deg, var(--c-accent), #16C79A); }
.score-val {
  font-size: 14px; font-weight: 700;
  width: 36px; text-align: right; flex-shrink: 0;
}
.score-val.before { color: var(--c-danger); }
.score-val.after { color: var(--c-accent); }
.score-delta {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.score-delta b {
  color: var(--c-accent);
  font-size: 20px;
  font-weight: 700;
}
.score-level {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
  margin-left: 6px;
}
.score-level.high { background: var(--c-danger-light); color: var(--c-danger); }
.score-level.mid { background: var(--c-warning-light); color: var(--c-warning); }
.score-level.low { background: var(--c-accent-light); color: var(--c-accent); }

/* ============ Spinner ============ */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-1);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ Section title ============ */
.section-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 28px;
  letter-spacing: -.5px;
}

/* ============ Features ============ */
.features {
  margin-top: 56px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.feature-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}
.feature-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.feature-card p { font-size: 12px; color: var(--text-2); line-height: 1.7; }

/* ============ How it works ============ */
.how-it-works {
  margin-top: 56px;
}
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.step {
  flex: 1;
  max-width: 260px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.step-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: var(--shadow-glow);
}
.step-content h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.step-content p { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.step-arrow {
  font-size: 24px;
  color: var(--text-3);
  flex-shrink: 0;
}

/* ============ API section ============ */
.api-section {
  margin-top: 56px;
}
.api-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 800px;
  margin: 0 auto;
}
.api-card {
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}
.api-method {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--c-primary);
  color: #fff;
  flex-shrink: 0;
}
.api-card code {
  font-size: 13px;
  color: var(--c-primary);
  font-weight: 500;
}
.api-card p {
  font-size: 12px;
  color: var(--text-2);
  margin-left: auto;
}
.api-note {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-3);
}
.api-note a { color: var(--c-primary); text-decoration: none; }
.api-note code {
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ============ Footer ============ */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  margin-top: 56px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
}
.footer-links {
  display: flex;
  gap: 20px;
}
.footer-links a {
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
}
.footer-links a:hover { color: var(--c-primary); }
.footer-copy {
  font-size: 12px;
  color: var(--text-3);
}

/* ============ Responsive ============ */
@media (max-width: 860px) {
  .panels { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .controls { gap: 16px; }
  .nav { display: none; }
  .hero h1 { font-size: 26px; }
  .hero-stats { flex-wrap: wrap; gap: 12px; }
  .hero-stat-divider { display: none; }
  .steps { flex-direction: column; }
  .step-arrow { transform: rotate(90deg); }
  .api-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
}
@media (max-width: 520px) {
  .features-grid { grid-template-columns: 1fr; }
  .container { padding: 20px 16px; }
  .hero { padding: 40px 16px 32px; }
  .hero h1 { font-size: 22px; }
  .hero-stats { padding: 16px 20px; }
  .hero-stat { padding: 4px 16px; }
}
