/* PixCast · 与 SheetKit 同源的设计系统
 * 主色:祖母绿 emerald-600
 */
:root {
  --primary: #059669;
  --primary-hover: #047857;
  --primary-soft: #ecfdf5;
  --primary-deep: #064e3b;
  --primary-ring: rgba(5, 150, 105, 0.18);

  --accent: #0891b2;
  --success: #10b981;
  --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; color: var(--text); }
.hero p { margin: 0 auto; max-width: 640px; color: var(--text-soft); font-size: 16px; }
.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;
}

/* ===== File 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);
}
.file-drop:hover .drop-icon { transform: scale(1.05); color: var(--primary); }
.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; color: var(--text); }
.drop-sub { color: var(--muted); font-size: 13px; }

/* ===== Options ===== */
.options-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px; margin-bottom: 18px; padding: 20px;
  background: var(--surface-soft); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.opt { display: flex; flex-direction: column; gap: 8px; }
.opt-block { grid-column: 1 / -1; }
.opt > span {
  font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  display: flex; justify-content: space-between; align-items: baseline;
}
.opt > span em { color: var(--primary); font-style: normal; font-size: 14px; font-variant-numeric: tabular-nums; }
.opt-hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

.input {
  appearance: none; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 9px 12px; font-size: 14px; color: var(--text);
  font-family: inherit; transition: all 0.15s var(--ease);
}
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--shadow-glow); }

/* ===== Format Chips ===== */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none; display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 18px; border: 1px solid var(--border-strong); border-radius: 999px;
  font-size: 14px; 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);
}
.chip small { font-size: 11px; opacity: 0.8; font-weight: 500; margin-left: 2px; }

/* ===== Slider ===== */
.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);
  transition: all 0.15s var(--ease);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.1); }
.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);
}

/* ===== Buttons (Stripe / Linear 风格质感) ===== */
.action-row {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px; margin: 18px 0;
}
.btn {
  appearance: none; position: relative;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 10px 18px; border-radius: var(--radius);
  cursor: pointer; font-size: 14px; font-family: inherit;
  font-weight: 600; letter-spacing: -0.005em;
  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; }

/* ===== Result Cards ===== */
.result-list {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 6px;
}
.result-card {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px; align-items: center;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.15s var(--ease);
}
.result-card:hover { border-color: var(--primary); }
.result-card.is-done { background: var(--primary-soft); border-color: #a7f3d0; }
.result-card.is-error { background: #fef2f2; border-color: #fecaca; }

.result-thumb {
  width: 80px; height: 80px;
  border-radius: var(--radius); overflow: hidden;
  background: var(--bg-deep);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  border: 1px solid var(--border);
}
.result-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.result-thumb.is-loading::before {
  content: ''; position: absolute; inset: 0;
  background: var(--bg-deep);
  background-image: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  from { background-position: -200% 0; }
  to { background-position: 200% 0; }
}

.result-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.result-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; font-variant-numeric: tabular-nums; }
.result-meta .arrow { color: var(--muted-soft); }
.result-meta .new-size { color: var(--text); font-weight: 600; }

.savings-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.savings-badge.saved { background: var(--primary-soft); color: var(--primary-deep); border: 1px solid #a7f3d0; }
.savings-badge.expanded { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.savings-badge.error-text { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.result-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  appearance: none; border: 1px solid var(--border-strong); background: var(--surface);
  width: 36px; height: 36px; border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s var(--ease);
  color: var(--text-soft); font-family: inherit;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.is-spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 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 .info-note { margin-top: 6px; color: var(--muted); font-size: 12px; }

/* ===== 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); }

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

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 14px; }
  .panel { padding: 18px; }
  .header-inner { height: 56px; }
  .site-nav { display: none; }
  .file-drop { padding: 36px 16px; }
  .result-card { grid-template-columns: 60px 1fr; gap: 12px; }
  .result-thumb { width: 60px; height: 60px; }
  .result-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@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); }
  .options-row { padding: 14px; gap: 14px; }
  .chip { padding: 7px 14px; font-size: 13px; }
  .chip small { display: none; } /* \u5c0f\u5c4f\u9690\u85cf\u683c\u5f0f\u540e\u7f00\u63d0\u793a */
  .file-drop { padding: 28px 12px; }
  .result-card { padding: 10px; }
  .result-thumb { width: 52px; height: 52px; }
  .result-name { font-size: 13px; }
  .result-meta { font-size: 11px; }
}
