/* ==============================
   GIF工坊 — 设计令牌 & 基础
   ============================== */
:root {
  --bg-0: #08070d;
  --bg-1: #0d0c18;
  --bg-2: #14121f;

  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text: #ecebf3;
  --text-2: #b8b5cf;
  --muted: #8a86a8;

  --accent: #8b5cf6;
  --accent-2: #ec4899;
  --gradient: linear-gradient(135deg, #8b5cf6 0%, #a855f7 50%, #ec4899 100%);

  --good: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 10px 30px rgba(0,0,0,.4);
  --shadow-lg: 0 30px 60px rgba(0,0,0,.5);
  --shadow-glow: 0 8px 32px rgba(139, 92, 246, 0.35);

  --t: 180ms cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input[type="range"] { font: inherit; }

/* 背景氛围 */
.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 600px at 8% -10%, rgba(124, 58, 237, 0.28), transparent 60%),
    radial-gradient(800px 600px at 100% 110%, rgba(236, 72, 153, 0.20), transparent 60%),
    radial-gradient(600px 400px at 50% 50%, rgba(168, 85, 247, 0.06), transparent 70%);
}

/* ==============================
   顶栏
   ============================== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(11,10,18,.72), rgba(11,10,18,.45));
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; overflow: hidden;
  box-shadow: 0 4px 12px rgba(139,92,246,.4);
}
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-text strong { display: block; font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.brand-text em { display: block; font-style: normal; font-size: 12px; color: var(--muted); }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.privacy-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #6ee7b7; font-size: 12px; font-weight: 600;
}
.privacy-badge svg { color: #34d399; }

/* ==============================
   通用按钮
   ============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--panel-2); color: var(--text);
  font-weight: 600; font-size: 14px;
  transition: transform var(--t), background var(--t), box-shadow var(--t), border-color var(--t);
  white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,0.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-mini { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-big { padding: 14px 18px; font-size: 15px; border-radius: 14px; width: 100%; }
.btn-primary {
  background: var(--gradient);
  border: none;
  color: white;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 10px 38px rgba(236,72,153,.42); }
.btn-primary:disabled { box-shadow: none; }

/* ==============================
   主区
   ============================== */
.main {
  position: relative; z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* ==============================
   Hero 上传区
   ============================== */
.hero { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 160px); padding: 32px 0; }
.hero-inner { max-width: 720px; text-align: center; }
.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.5px;
  margin: 0 0 16px;
  background: linear-gradient(180deg, #fff 0%, #c9c5e0 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero h1 b {
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle { color: var(--text-2); font-size: 17px; margin: 0 0 36px; }
.subtitle b { color: #fff; }

.dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 48px 24px;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 2px dashed var(--border-strong);
  cursor: pointer;
  transition: all var(--t);
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(139,92,246,0.10), rgba(236,72,153,0.04));
  outline: none;
  transform: translateY(-2px);
}
.dropzone.is-drag {
  border-color: var(--accent-2);
  background: linear-gradient(180deg, rgba(236,72,153,0.14), rgba(139,92,246,0.06));
  box-shadow: var(--shadow-glow);
}
.dropzone-icon {
  width: 96px; height: 96px; border-radius: 24px;
  display: grid; place-items: center;
  background: var(--gradient);
  color: white;
  box-shadow: var(--shadow-glow);
}
.dropzone-text strong { display: block; font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.dropzone-text span { color: var(--muted); font-size: 13px; }

.feature-chips {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin: 36px 0 0; padding: 0; list-style: none;
}
.feature-chips li {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text-2); font-size: 13px; font-weight: 500;
}
.feature-chips li span { font-size: 13px; }

/* ==============================
   卡片
   ============================== */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card h3 { margin: 0 0 16px; font-size: 15px; font-weight: 700; letter-spacing: .2px; color: var(--text); }

/* ==============================
   编辑器
   ============================== */
.editor-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 16px;
}
.file-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-sub { color: var(--muted); font-size: 13px; }

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 880px) {
  .editor-grid { grid-template-columns: 1fr; }
}

/* 预览卡 */
.preview-card { padding: 14px; }
.preview-frame {
  position: relative; aspect-ratio: 16/9; border-radius: var(--r-md); overflow: hidden;
  background: #000;
}
.preview-frame video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.preview-empty {
  position: absolute; inset: 0; display: none; place-items: center;
  color: var(--muted); font-size: 14px; background: rgba(0,0,0,0.4);
}
.preview-empty.is-on { display: grid; }

.player-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 6px 4px;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: none;
  background: var(--panel-2); color: var(--text);
  display: grid; place-items: center;
  transition: background var(--t);
}
.icon-btn:hover { background: rgba(255,255,255,0.10); }
.time { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--text-2); font-weight: 600; }
.time-sep { color: var(--muted); }
.spacer { flex: 1; }
.toggle {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer;
  user-select: none;
}
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

/* 设置卡 */
.setting { margin-bottom: 18px; }
.setting:last-of-type { margin-bottom: 8px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.setting-row label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.setting-row output, .setting-row .muted { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }
.setting-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px;
  background: rgba(255,255,255,0.08);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 0 4px rgba(139,92,246,0.18);
  cursor: pointer; transition: box-shadow var(--t);
}
input[type="range"]::-webkit-slider-thumb:hover { box-shadow: 0 0 0 6px rgba(139,92,246,0.28); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border: none; border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 3px; gap: 2px;
}
.seg button {
  background: transparent; border: none;
  padding: 8px 6px; border-radius: 9px;
  color: var(--text-2); font-size: 13px; font-weight: 600;
  transition: all var(--t);
}
.seg button:hover { color: var(--text); }
.seg button.on {
  background: var(--gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(139,92,246,0.4);
}

.summary {
  background: rgba(0,0,0,0.25); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; margin: 8px 0 16px;
}
.summary-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.summary-row span { color: var(--text-2); }
.summary-row b { font-variant-numeric: tabular-nums; }
.summary-warn {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fde68a; font-size: 12px; line-height: 1.4;
}

.progress { margin-top: 12px; }
.progress-bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.progress-fill {
  height: 100%; width: 0%;
  background: var(--gradient);
  transition: width 120ms linear;
  box-shadow: 0 0 12px rgba(236,72,153,0.5);
}
.progress-text { margin-top: 6px; font-size: 12px; color: var(--muted); text-align: center; }

/* ==============================
   时间轴
   ============================== */
.timeline-card { padding: 18px 20px 16px; }
.timeline-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.timeline-head strong { font-size: 14px; }
.timeline-actions { display: flex; gap: 6px; }

.timeline { position: relative; border-radius: 12px; overflow: hidden; background: #0a0913; user-select: none; }
.filmstrip {
  display: block; width: 100%; height: 64px; background: #0a0913;
  image-rendering: -webkit-optimize-contrast;
}
.track-overlay {
  position: relative; height: 44px; cursor: pointer;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
}
.dim { position: absolute; top: 0; bottom: 0; background: rgba(5, 4, 12, 0.72); pointer-events: none; }
.dim.left { left: 0; }
.dim.right { right: 0; }
.selection {
  position: absolute; top: 0; bottom: 0;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(139,92,246,0.6), 0 0 24px rgba(139,92,246,0.4);
  background: rgba(139,92,246,0.05);
  outline: none;
}
.selection:focus-visible { box-shadow: 0 0 0 1px rgba(236,72,153,0.7), 0 0 24px rgba(236,72,153,0.5); }
.handle {
  position: absolute; top: -2px; bottom: -2px; width: 14px;
  background: white; border-radius: 4px; cursor: ew-resize;
  display: grid; place-items: center;
  box-shadow: 0 0 0 2px rgba(139,92,246,0.7);
}
.handle-start { left: -7px; }
.handle-end { right: -7px; }
.grip { width: 2px; height: 16px; background: rgba(139,92,246,0.85); border-radius: 2px; }
.playhead {
  position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent-2);
  pointer-events: none; transform: translateX(-1px);
  box-shadow: 0 0 12px rgba(236,72,153,0.6);
}
.playhead::before {
  content: ""; position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 8px; background: var(--accent-2); border-radius: 50%;
  box-shadow: 0 0 12px rgba(236,72,153,0.7);
}

.timeline-labels {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; font-size: 13px; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.timeline-labels .muted b { color: var(--text); }

/* ==============================
   结果
   ============================== */
.result-head { text-align: center; margin-bottom: 20px; }
.result-title { display: inline-flex; align-items: center; gap: 12px; }
.check {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(52, 211, 153, 0.12); color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
  box-shadow: 0 0 24px rgba(52,211,153,0.3);
}
.result h2 { margin: 0; font-size: 22px; font-weight: 800; }
.result-grid {
  display: grid; grid-template-columns: 1fr 320px; gap: 16px;
}
@media (max-width: 880px) { .result-grid { grid-template-columns: 1fr; } }
.preview-result { padding: 14px; }
.checker {
  border-radius: var(--r-md); overflow: hidden; aspect-ratio: 16/9;
  background-color: #1a1825;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.04) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.04) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.04) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  display: grid; place-items: center;
}
.checker img { max-width: 100%; max-height: 100%; display: block; object-fit: contain; }

.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-row:last-of-type { border-bottom: none; }
.info-row span { color: var(--text-2); }
.info-row b { font-variant-numeric: tabular-nums; }

.result-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.result-actions .btn-big { width: 100%; }

/* ==============================
   Toast & 脚部
   ============================== */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(80px);
  background: rgba(20, 18, 31, 0.95);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: transform 280ms var(--t), opacity 280ms var(--t);
  z-index: 50; max-width: 90%;
  display: flex; align-items: center; gap: 10px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast.ok { border-color: rgba(52,211,153,0.4); }
.toast.err { border-color: rgba(248,113,113,0.5); }

.foot {
  text-align: center; padding: 24px 16px 36px; color: var(--muted);
  font-size: 12px; line-height: 1.6; border-top: 1px solid var(--border);
}

/* ==============================
   移动端微调
   ============================== */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .brand-text em { display: none; }
  .privacy-badge { padding: 5px 10px; font-size: 11px; }
  .main { padding: 16px 14px 40px; }
  .hero h1 { font-size: 30px; }
  .dropzone { padding: 32px 18px; }
  .editor-head { flex-direction: column; align-items: stretch; }
  .preview-card .preview-frame { aspect-ratio: 16/9; }
  .timeline-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .timeline-actions { justify-content: stretch; }
  .timeline-actions .btn { flex: 1; }
}
