:root {
  --bg: #08080a;
  --card: #12121a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f5;
  --muted: #71717a;
  --accent: #fbbf24;
  --accent-dim: rgba(251, 191, 36, 0.12);
}

* { box-sizing: border-box; }

body.anim-tool {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.anim-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.anim-hero { margin-bottom: 28px; }

.anim-badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid rgba(251, 191, 36, 0.35);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fde68a;
}

.anim-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.anim-hero .dim { color: var(--muted); }

.anim-lead {
  margin: 0;
  max-width: 640px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 15px;
}

.anim-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 16px;
}

.anim-card h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 700;
}

.anim-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.anim-field span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.anim-field input,
.anim-field select,
.anim-controls input,
.anim-controls select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0a0a10;
  color: var(--text);
}

.anim-drop {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}

.anim-drop:hover,
.anim-drop:focus,
.anim-drop.dragover { border-color: rgba(251, 191, 36, 0.45); }

.anim-drop.has-file { border-color: rgba(34, 197, 94, 0.45); }

.anim-choose-btn {
  margin-top: 10px;
  width: auto;
  min-width: 180px;
}

.anim-file-label {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.anim-drop .hint { color: var(--muted); font-size: 13px; }

.anim-video {
  width: 100%;
  max-height: 280px;
  border-radius: 10px;
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

.btn-primary {
  background: #fff;
  color: #111;
}

.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 100%;
  margin-bottom: 8px;
}

.anim-err { color: #f87171; font-size: 13px; }

.anim-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-bottom: 10px;
}

.anim-progress div {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #fbbf24, #f97316);
  transition: width 0.3s;
}

.anim-status { color: var(--muted); font-size: 14px; margin: 0; }

.anim-editor-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.anim-controls-full {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
}

.anim-controls-full .btn-ghost,
.anim-controls-full .btn-primary {
  width: auto;
  justify-self: start;
}

.anim-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.anim-preview-head h2 {
  margin: 0 0 4px;
}

.anim-split-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.anim-split-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.anim-split-label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.anim-source-stage {
  position: relative;
  flex: 1;
  height: 440px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: radial-gradient(ellipse at 50% 120%, rgba(251, 191, 36, 0.04), transparent 55%), #0a0a10;
}

.anim-source-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.anim-source-placeholder p {
  margin: 0;
  max-width: 220px;
}

.anim-source-video,
.anim-skeleton-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.anim-skeleton-canvas {
  pointer-events: none;
}

.anim-preview-controls {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.anim-preview-controls input[type="range"] {
  width: 100%;
  margin: 0 0 8px;
}

.anim-preview-pane canvas {
  width: 100%;
  border-radius: 12px;
  background: #0a0a10;
  border: 1px solid var(--border);
}

.anim-preview-card {
  margin-bottom: 16px;
}

.anim-preview-note {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.anim-preview-status {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.anim-preview-3d {
  position: relative;
  width: 100%;
  height: 440px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, #eef2f8 0%, #e2e8f0 100%);
}

.anim-preview-3d canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.anim-ped-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #92400e;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(251, 191, 36, 0.45);
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.anim-preview-pane input[type="range"] { width: 100%; margin-top: 10px; }

.anim-frame-label { font-size: 12px; color: var(--muted); text-align: center; }

.anim-controls label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.hidden { display: none !important; }

@media (max-width: 860px) {
  .anim-row,
  .anim-editor-grid,
  .anim-split-preview { grid-template-columns: 1fr; }

  .anim-source-stage,
  .anim-preview-3d { height: 360px; }
}
