/* Restoria · 与 PixCast / SheetKit 同源的设计系统 */
:root {
  --primary: #059669;
  --primary-hover: #047857;
  --primary-soft: #ecfdf5;
  --primary-deep: #064e3b;
  --primary-ring: rgba(5, 150, 105, 0.18);
  --accent: #0891b2;
  --warning: #f59e0b;
  --danger: #ef4444;

  --bg: #fafafe;
  --bg-deep: #f4f4fb;
  --surface: #ffffff;
  --surface-soft: #fafbff;
  --border: #e7e9f3;
  --border-strong: #d1d5e0;
  --text: #0f172a;
  --text-soft: #475569;
  --muted: #94a3b8;
  --muted-soft: #cbd5e1;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 0 4px var(--primary-ring);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; font-size: 18px; letter-spacing: -0.01em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  color: var(--text-soft); text-decoration: none; font-size: 14px;
  padding: 6px 14px; border-radius: 8px; transition: all 0.15s var(--ease);
}
.site-nav a:hover { color: var(--text); background: var(--bg-deep); }

/* Hero */
.main { padding: 40px 24px 80px; }
.hero { text-align: center; margin-bottom: 32px; padding: 8px 0 4px; }
.hero h1 { margin: 0 0 12px; font-size: 40px; font-weight: 700; letter-spacing: -0.02em; }
.hero p { margin: 0 auto; max-width: 720px; color: var(--text-soft); font-size: 16px; }
.hero p strong { color: var(--text); }
.feature-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.feature-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; color: var(--text-soft); box-shadow: var(--shadow-xs);
}
.feature-chip svg { width: 14px; height: 14px; color: var(--primary); }

/* Panel */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 28px;
  box-shadow: var(--shadow-sm); margin-bottom: 32px;
}

/* Upload Drop */
.upload-row { margin-bottom: 16px; }
.file-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 56px 24px;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-lg);
  cursor: pointer; background: var(--surface-soft);
  transition: all 0.18s var(--ease); text-align: center;
}
.file-drop:hover, .file-drop.is-drag { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.drop-icon {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--primary); transition: all 0.2s var(--ease);
}
.drop-icon svg { width: 28px; height: 28px; }
.drop-text { font-weight: 600; font-size: 16px; }
.drop-sub { color: var(--muted); font-size: 13px; }
.sample-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.sample-btn {
  appearance: none; background: transparent; border: none; cursor: pointer;
  color: var(--primary); font-weight: 600; font-size: 13px;
  padding: 4px 8px; border-radius: 6px; transition: background 0.15s;
}
.sample-btn:hover { background: var(--primary-soft); }

/* Workspace */
.workspace {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  margin-top: 4px;
}
@media (max-width: 920px) { .workspace { grid-template-columns: 1fr; } }

/* Compare slider */
.compare {
  display: flex; flex-direction: column; gap: 10px;
}
.compare-frame {
  position: relative; width: 100%;
  background: #1f1f24;
  border-radius: var(--radius-lg);
  touch-action: none; /* 防止移动端拖动滑块时页面跟随滚动 */
  overflow: hidden;
  aspect-ratio: 4 / 3;
  user-select: none;
  border: 1px solid var(--border);
}
.compare-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  background: #1f1f24;
}
/* clip-path 方案:before-img 充满整个 frame,通过 inset() 显示左半 */
.compare-clip {
  position: absolute; inset: 0;
  clip-path: inset(0 50% 0 0);
  pointer-events: none;
  transition: clip-path 0s; /* 拖动时即时更新 */
}
.compare-clip .compare-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
}

.compare-handle {
  position: absolute; top: 0; bottom: 0;
  left: 50%; width: 2px; background: rgba(255,255,255,0.95);
  transform: translateX(-50%);
  cursor: ew-resize;
  touch-action: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 0 16px rgba(0,0,0,0.4);
}
.compare-handle-line { position: absolute; inset: 0; }
.compare-handle-knob {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 36px; height: 36px;
  background: #fff; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  gap: 0; font-size: 18px; color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.compare-handle-knob span { line-height: 1; padding: 0 1px; }

.compare-label {
  position: absolute; top: 12px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.compare-label-left { left: 12px; }
.compare-label-right { right: 12px; }

.compare-hint { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }

/* Controls */
.controls { display: flex; flex-direction: column; gap: 16px; }
.control-tabs {
  display: flex; gap: 4px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
}
.ctl-tab {
  appearance: none; flex: 1;
  padding: 8px 12px; border: none; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text-soft);
  border-radius: 7px; cursor: pointer; transition: all 0.12s var(--ease);
  font-family: inherit;
}
.ctl-tab:hover { color: var(--text); }
.ctl-tab.is-on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

.control-pane { display: none; flex-direction: column; gap: 14px; }
.control-pane.is-on { display: flex; }
.ctl-desc { margin: 0; font-size: 13px; color: var(--text-soft); line-height: 1.6; }
.ctl-desc code { background: var(--bg-deep); padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.ctl-hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.ctl-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-soft); line-height: 1.7; }
.ctl-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

.strength-row { display: flex; align-items: center; gap: 12px; }
.strength-row label { font-size: 13px; color: var(--muted); font-weight: 600; flex-shrink: 0; }
.strength-chips { display: flex; gap: 6px; }

.chip {
  appearance: none; padding: 6px 14px; border: 1px solid var(--border-strong); border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--surface); color: var(--text);
  cursor: pointer; transition: all 0.15s var(--ease); user-select: none; font-family: inherit;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.is-on {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(5, 150, 105, 0.28);
}

/* Sliders */
.slider-group { display: flex; flex-direction: column; gap: 6px; }
.slider-group label {
  font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
  display: flex; justify-content: space-between; align-items: baseline;
}
.slider-group label em { color: var(--primary); font-style: normal; font-size: 13px; font-variant-numeric: tabular-nums; }
.slider {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 6px;
  background: var(--bg-deep); border-radius: 999px; outline: none;
  border: 1px solid var(--border);
}
.slider::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); cursor: pointer;
  border: 2px solid #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 3px rgba(5, 150, 105, 0.4);
}
.slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); cursor: pointer; border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.4);
}

/* AI status */
.ai-status {
  background: var(--bg-deep); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
}
.ai-status-text { font-size: 13px; color: var(--text-soft); margin-bottom: 8px; }
.ai-progress {
  height: 6px; background: var(--surface); border-radius: 999px;
  border: 1px solid var(--border); overflow: hidden;
}
.ai-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s var(--ease);
}

/* Buttons */
.action-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn {
  appearance: none; position: relative;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: var(--radius);
  cursor: pointer; font-size: 14px; font-family: inherit; font-weight: 600;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease), color 0.12s var(--ease), box-shadow 0.12s var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.04);
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn:hover { border-color: var(--text-soft); background: var(--bg-deep); box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 2px 6px rgba(15, 23, 42, 0.06); }
.btn:active { background: var(--border); box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-glow), 0 1px 2px rgba(15, 23, 42, 0.04); }
.btn.primary {
  background: var(--primary); color: #fff; border-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.10),
    0 1px 2px rgba(5, 150, 105, 0.28),
    0 0 0 1px rgba(5, 150, 105, 0.08);
}
.btn.primary:hover {
  background: var(--primary-hover); color: #fff; border-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.20),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(5, 150, 105, 0.32),
    0 0 0 1px rgba(5, 150, 105, 0.10);
}
.btn.primary:active {
  background: var(--primary-deep);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.20), 0 0 0 1px rgba(5, 150, 105, 0.10);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.meta-info {
  font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  line-height: 1.6;
}

/* Info section */
.info-section h2 { font-size: 22px; margin: 0 0 16px; font-weight: 700; letter-spacing: -0.01em; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.info-card {
  padding: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.info-card h3 {
  margin: 0 0 8px; font-size: 14px; font-weight: 600;
  color: var(--primary-deep);
  display: flex; align-items: center; gap: 6px;
}
.info-card h3::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.info-card p { margin: 0; font-size: 13px; color: var(--text-soft); line-height: 1.6; }
.info-card p strong { color: var(--text); }
.info-card p em { color: var(--primary-deep); font-style: normal; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  color: #fff; padding: 12px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: all 0.3s var(--ease); z-index: 100;
  box-shadow: var(--shadow-lg);
  max-width: calc(100% - 48px);
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

.site-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 28px 0; color: var(--muted); font-size: 13px; text-align: center;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .hero h1 { font-size: 28px; }
  .panel { padding: 18px; }
  .compare-frame { aspect-ratio: 1 / 1; }
  .control-tabs { font-size: 13px; }
  .strength-row { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 24px; }
  .hero p { font-size: 13px; }
  .feature-chips { gap: 6px; }
  .feature-chip { padding: 5px 10px; font-size: 12px; }
  .panel { padding: 14px; border-radius: var(--radius); }
  .compare-label { font-size: 11px; padding: 4px 8px; }
  .compare-handle-knob { width: 30px; height: 30px; }
  .chip { padding: 6px 12px; font-size: 12px; }
  .strength-chips { flex-wrap: wrap; gap: 4px; }
  .controls { gap: 12px; }
}
