/* ================================
   CSS 动画生成器 - 自定义样式
   配色与 Leowh 主页统一
   ================================ */

:root {
  --bg: #FAFAF9;
  --bg-alt: #F5F5F4;
  --surface: #FFFFFF;
  --border: #E7E5E4;
  --border-strong: #D6D3D1;
  --text: #1E293B;
  --text-secondary: #52525B;
  --text-muted: #71717A;
  --primary: #F43F5E;
  --primary-hover: #E11D48;
  --primary-light: rgba(244,63,94,0.08);
  --secondary: #F97316;
  --accent: #EC4899;
  --success: #059669;
  --radius: 10px;
  --radius-lg: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.toast {
  position: fixed; top: 24px; right: 24px;
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 100px;
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  z-index: 1000;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.toast.show { transform: translateX(0); }
.toast-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }

.page { max-width: 960px; margin: 0 auto; padding: 0 32px; }

#header.scrolled {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}

/* ══════════════════════════════════════════
   Animation Section
   ══════════════════════════════════════════ */
.anim-section { position: relative; z-index: 10; }

.anim-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}

/* ── Preview ── */
.anim-preview-col {
  display: flex; flex-direction: column; gap: 12px;
}
.anim-preview-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 300px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.anim-preview-box::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-conic-gradient(#f0f0f0 0% 25%, #fff 0% 50%) 50% / 20px 20px;
  z-index: 0;
}
.anim-preview-inner {
  width: 100px; height: 100px;
  background: linear-gradient(135deg, #F43F5E, #F97316);
  border-radius: 16px;
  position: relative; z-index: 1;
}
.btn-animate {
  padding: 10px 22px;
  background: var(--primary);
  border: 1px solid transparent;
  border-radius: 100px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: white; cursor: pointer;
  align-self: center;
  transition: background 0.15s ease;
}
.btn-animate:hover { background: var(--primary-hover); }

/* ── Control Panel ── */
.anim-control-col {
  display: flex; flex-direction: column; gap: 16px;
}

.anim-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}
.anim-panel-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.control-item {
  margin-bottom: 14px;
}
.control-item:last-child { margin-bottom: 0; }
.control-item-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.control-item-label {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.control-item-value {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  font-family: 'SF Mono', monospace;
}
.control-range { width: 100%; accent-color: var(--primary); }
.control-select {
  width: 100%; padding: 9px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 14px; color: var(--text);
  outline: none; cursor: pointer;
  transition: border-color 0.2s ease;
}
.control-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(244,63,94,0.1);
}
.control-input-text {
  width: 100%; padding: 9px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 14px; color: var(--text);
  outline: none;
  transition: border-color 0.2s ease;
}
.control-input-text:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(244,63,94,0.1);
}

/* ── Keyframe Editor ── */
.keyframe-editor {
  display: flex; flex-direction: column; gap: 12px;
}
.keyframe-block {
  padding: 12px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.keyframe-block-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.keyframe-pct {
  font-size: 13px; font-weight: 700; color: var(--text);
}
.keyframe-prop-select {
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 12px; color: var(--text);
  outline: none; cursor: pointer;
}
.keyframe-values {
  display: flex; flex-direction: column; gap: 6px;
}
.keyframe-value-row {
  display: flex; align-items: center; gap: 8px;
}
.keyframe-val-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  min-width: 24px; text-transform: uppercase;
}
.keyframe-val-input {
  flex: 1; padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'SF Mono', monospace;
  font-size: 12px; color: var(--text);
  outline: none;
}
.keyframe-val-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(244,63,94,0.1);
}

/* ── Code ── */
.anim-code-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.anim-code-title {
  font-size: 14px; font-weight: 700; color: var(--text);
}
.btn-sm {
  padding: 7px 16px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 100px;
  font-family: inherit; font-size: 12px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-sm:hover {
  background: var(--primary-light);
  border-color: rgba(244,63,94,0.25);
  color: var(--primary);
}
.anim-code-block {
  padding: 14px;
  background: #1e1e1e;
  border-radius: var(--radius);
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 13px; color: #d4d4d4;
  overflow-x: auto; margin: 0; white-space: pre-wrap;
}

/* ── Scrollbar & Selection ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #A5B4FC; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4F46E5; }
::selection { background: rgba(79, 70, 229, 0.2); color: #1E293B; }

/* ── Guide Section ── */
.guide-section {
  margin-top: 16px;
  margin-bottom: 64px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.guide-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 14px 20px; background: none;
  border: none; cursor: pointer; transition: background 0.15s ease;
}
.guide-toggle:hover { background: var(--bg-alt); }
.guide-toggle-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: #1E293B;
}
.guide-toggle.open .toggle-arrow { transform: rotate(180deg); }
.toggle-arrow { transition: transform 0.2s ease; color: var(--text-muted); }
.guide-list { padding: 0 20px 20px; }
.guide-list.hidden { display: none; }
.guide-item { padding: 16px 0; border-top: 1px solid var(--border); }
.guide-item:first-child { border-top: 1px solid var(--border); }
.guide-item-title {
  font-size: 14px; font-weight: 600; color: #1E293B; margin-bottom: 6px;
}
.guide-item-body {
  font-size: 13px; color: var(--text-secondary); line-height: 1.8;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .page { padding: 0 16px; }
  .anim-layout { grid-template-columns: 1fr; }
  .anim-preview-box { min-height: 220px; }
}
